-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for Logo and Intro storyboards;
- Loading branch information
Showing
5 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Collections.Generic; | ||
using Negum.Core.Managers.Entries; | ||
|
||
namespace Negum.Core.Managers.Types | ||
{ | ||
/// <summary> | ||
/// Manager which handles Storyboard configuration. | ||
/// | ||
/// NOTE: | ||
/// Similar to ICharacterStoryboardSceneManager but for different purposes. | ||
/// </summary> | ||
/// | ||
/// <author> | ||
/// https://github.com/TheNegumProject/Negum.Core | ||
/// </author> | ||
public interface IStoryboardManager : IManager | ||
{ | ||
IStoryboardSceneDef SceneDef => this.GetSection<IStoryboardSceneDef>("SceneDef"); | ||
IEnumerable<IStoryboardScene> Scenes => this.GetSubsections<IStoryboardScene>("SceneDef"); | ||
} | ||
|
||
public interface IStoryboardSceneDef : IManagerSection | ||
{ | ||
string SpriteFile => this.GetValue<string>("spr"); | ||
|
||
/// <summary> | ||
/// Stating scene number (for debugging). | ||
/// </summary> | ||
int StartScene => this.GetValue<int>("startscene"); | ||
} | ||
|
||
public interface IStoryboardScene : IManagerSection | ||
{ | ||
ITimeEntry FadeInTime => this.GetValue<ITimeEntry>("fadein.time"); | ||
IVectorEntry FadeInColor => this.GetValue<IVectorEntry>("fadein.col"); | ||
ITimeEntry FadeOutTime => this.GetValue<ITimeEntry>("fadeout.time"); | ||
IVectorEntry FadeOutColor => this.GetValue<IVectorEntry>("fadeout.col"); | ||
IVectorEntry ClearColor => this.GetValue<IVectorEntry>("clearcolor"); | ||
IVectorEntry LayerAllPosition => this.GetValue<IVectorEntry>("layerall.pos"); | ||
IImageEntry Layer0 => this.GetValue<IImageEntry>("layer0"); | ||
IImageEntry Layer1 => this.GetValue<IImageEntry>("layer1"); | ||
IAudioEntry BackgroundMusic => this.GetValue<IAudioEntry>("bgm"); | ||
ITimeEntry TotalTime => this.GetValue<ITimeEntry>("end.time"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Negum.Core.Configurations; | ||
|
||
namespace Negum.Core.Managers.Types | ||
{ | ||
/// <summary> | ||
/// </summary> | ||
/// | ||
/// <author> | ||
/// https://github.com/TheNegumProject/Negum.Core | ||
/// </author> | ||
public class StoryboardManager : Manager, IStoryboardManager | ||
{ | ||
protected override IManagerSection GetNewManagerSection(string sectionName, IConfigurationSection configSection) => | ||
new StoryboardManagerSection(sectionName, configSection); | ||
} | ||
|
||
public class StoryboardManagerSection : | ||
ManagerSection, | ||
IStoryboardSceneDef, | ||
IStoryboardScene | ||
{ | ||
public StoryboardManagerSection(string name, IConfigurationSection section) : | ||
base(name, section) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Negum.Core.Containers; | ||
using Negum.Core.Managers.Types; | ||
using Xunit; | ||
|
||
namespace Negum.Core.Tests.Managers | ||
{ | ||
/// <summary> | ||
/// </summary> | ||
/// | ||
/// <author> | ||
/// https://github.com/TheNegumProject/Negum.Core | ||
/// </author> | ||
public class StoryboardManagerTests : TestBase | ||
{ | ||
[Theory] | ||
[InlineData("https://raw.githubusercontent.com/TheNegumProject/DragonBallMugenEdition2009/main/data/Backup/intro.def")] | ||
public async Task Should_Count_Number_Of_Scenes_And_Print_Details(string path) | ||
{ | ||
this.InitializeContainer(); | ||
|
||
var config = await this.ParseWithSubsections(path); | ||
var manager = (IStoryboardManager) NegumContainer.Resolve<IStoryboardManager>().UseConfiguration(config); | ||
var scenes = manager.Scenes; | ||
|
||
Assert.True(scenes.Count() == 3); | ||
|
||
var time = scenes.FirstOrDefault().FadeInTime; | ||
var timeDetails = time.GetTimeSpan().Ticks; | ||
|
||
Assert.True(timeDetails == 35); | ||
} | ||
} | ||
} |