protected NonCombatScreen(MenuSystem menusystem, TextSection textsection, String spritepath, String animationpath, String soundpath) : base(menusystem) { if (textsection == null) { throw new ArgumentNullException("textsection"); } if (spritepath == null) { throw new ArgumentNullException("spritepath"); } if (animationpath == null) { throw new ArgumentNullException("animationpath"); } if (soundpath == null) { throw new ArgumentNullException("soundpath"); } m_soundmanager = MenuSystem.GetSubSystem <Audio.SoundSystem>().CreateManager(soundpath); m_spritemanager = MenuSystem.GetSubSystem <Drawing.SpriteSystem>().CreateManager(spritepath); m_animationmanager = MenuSystem.GetSubSystem <Animations.AnimationSystem>().CreateManager(animationpath); m_backgrounds = new Backgrounds.Collection(m_spritemanager.Clone(), m_animationmanager.Clone()); m_fadeintime = textsection.GetAttribute <Int32>("fadein.time"); m_fadeouttime = textsection.GetAttribute <Int32>("fadeout.time"); SpriteManager.LoadAllSprites(); }
protected NonCombatScreen(MenuSystem menusystem, TextSection textsection, String spritepath, String animationpath, String soundpath) : base(menusystem) { if (textsection == null) throw new ArgumentNullException("textsection"); if (spritepath == null) throw new ArgumentNullException("spritepath"); if (animationpath == null) throw new ArgumentNullException("animationpath"); if (soundpath == null) throw new ArgumentNullException("soundpath"); m_soundmanager = MenuSystem.GetSubSystem<Audio.SoundSystem>().CreateManager(soundpath); m_spritemanager = MenuSystem.GetSubSystem<Drawing.SpriteSystem>().CreateManager(spritepath); m_animationmanager = MenuSystem.GetSubSystem<Animations.AnimationSystem>().CreateManager(animationpath); m_backgrounds = new Backgrounds.Collection(m_spritemanager.Clone(), m_animationmanager.Clone()); m_fadeintime = textsection.GetAttribute<Int32>("fadein.time"); m_fadeouttime = textsection.GetAttribute<Int32>("fadeout.time"); SpriteManager.LoadAllSprites(); }
public Stage(FightEngine engine, StageProfile profile) : base(engine) { if (profile == null) { throw new ArgumentNullException(nameof(profile)); } m_profile = profile; m_camerastartlocation = new Point(0, 0); m_p1start = new Vector2(0, 0); m_p2start = new Vector2(0, 0); m_palettefx = new PaletteFx(); var textfile = Engine.GetSubSystem <FileSystem>().OpenTextFile(Profile.Filepath); var infosection = textfile.GetSection("Info"); var camerasection = textfile.GetSection("Camera"); var playerinfosection = textfile.GetSection("PlayerInfo"); var boundsection = textfile.GetSection("Bound"); var stageinfosection = textfile.GetSection("StageInfo"); var shadowsection = textfile.GetSection("Shadow"); var reflectionsection = textfile.GetSection("Reflection"); var musicsection = textfile.GetSection("Music"); var bgdefsection = textfile.GetSection("BGDef"); if (infosection == null) { throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Info' section"); } if (camerasection == null) { throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Camera' section"); } if (playerinfosection == null) { throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'PlayerInfo' section"); } if (boundsection == null) { throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Bound' section"); } if (stageinfosection == null) { throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'StageInfo' section"); } if (shadowsection == null) { throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Shadow' section"); } //if (reflectionsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Reflection' section"); if (musicsection == null) { throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Music' section"); } if (bgdefsection == null) { throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'BGDef' section"); } m_name = infosection.GetAttribute <string>("name"); m_camerastartlocation.X = camerasection.GetAttribute <int>("startx"); m_camerastartlocation.Y = camerasection.GetAttribute <int>("starty"); m_camerabounds = BuildBoundsRect(camerasection, "boundleft", "boundright", "boundhigh", "boundlow"); m_floortension = camerasection.GetAttribute("floortension", 0); m_tension = camerasection.GetAttribute <int>("tension"); m_verticalfollow = camerasection.GetAttribute <float>("verticalfollow"); m_p1start.X = playerinfosection.GetAttribute <float>("p1startx"); m_p1start.Y = playerinfosection.GetAttribute <float>("p1starty"); m_p1facing = playerinfosection.GetAttribute <Facing>("p1facing"); m_p2start.X = playerinfosection.GetAttribute <float>("p2startx"); m_p2start.Y = playerinfosection.GetAttribute <float>("p2starty"); m_p2facing = playerinfosection.GetAttribute <Facing>("p2facing"); m_p3start.X = playerinfosection.GetAttribute("p3startx", m_p1start.X); m_p3start.Y = playerinfosection.GetAttribute("p3starty", m_p1start.Y); m_p3facing = playerinfosection.GetAttribute("p3facing", m_p1facing); m_p4start.X = playerinfosection.GetAttribute("p4startx", m_p2start.X); m_p4start.Y = playerinfosection.GetAttribute("p4starty", m_p2start.Y); m_p4facing = playerinfosection.GetAttribute("p4facing", m_p2facing); m_playerbounds = BuildBoundsRect(playerinfosection, "leftbound", "rightbound", "topbound", "botbound"); m_screenleft = boundsection.GetAttribute <int>("screenleft"); m_screenright = boundsection.GetAttribute <int>("screenright"); m_zoffset = stageinfosection.GetAttribute <int>("zoffset"); m_zoffsetlink = stageinfosection.GetAttribute <int?>("zoffsetlink", null); m_autoturn = stageinfosection.GetAttribute <bool>("autoturn"); m_resetbg = stageinfosection.GetAttribute <bool>("resetBG"); m_shadowintensity = stageinfosection.GetAttribute <byte>("intensity", 128); m_shadowcolor = stageinfosection.GetAttribute("color", Color.TransparentBlack); m_shadowscale = stageinfosection.GetAttribute("yscale", 0.4f); m_shadowfade = stageinfosection.GetAttribute <Point?>("fade.range", null); if (reflectionsection != null) { m_shadowreflection = reflectionsection.GetAttribute("reflect", false); } else { m_shadowreflection = false; } m_musicfile = musicsection.GetAttribute("bgmusic", string.Empty); m_volumeoffset = musicsection.GetAttribute("bgvolume", 0); m_spritefile = bgdefsection.GetAttribute <string>("spr"); m_debug = bgdefsection.GetAttribute("debugbg", false); if (Engine.GetSubSystem <FileSystem>().DoesFileExist(m_spritefile) == false) { m_spritefile = Engine.GetSubSystem <FileSystem>().CombinePaths("stages", m_spritefile); } var spritemanager = Engine.GetSubSystem <Drawing.SpriteSystem>().CreateManager(SpritePath); var animationmanager = Engine.GetSubSystem <Animations.AnimationSystem>().CreateManager(Profile.Filepath); m_backgrounds = new Backgrounds.Collection(spritemanager, animationmanager); foreach (var textsection in textfile) { if (s_bgtitleregex.Match(textsection.Title).Success) { m_backgrounds.CreateBackground(textsection); } } Reset(); }
public Stage(FightEngine engine, StageProfile profile) : base(engine) { if (profile == null) throw new ArgumentNullException("profile"); m_profile = profile; m_camerastartlocation = new Point(0, 0); m_p1start = new Vector2(0, 0); m_p2start = new Vector2(0, 0); m_palettefx = new PaletteFx(); TextFile textfile = Engine.GetSubSystem<IO.FileSystem>().OpenTextFile(Profile.Filepath); TextSection infosection = textfile.GetSection("Info"); TextSection camerasection = textfile.GetSection("Camera"); TextSection playerinfosection = textfile.GetSection("PlayerInfo"); TextSection boundsection = textfile.GetSection("Bound"); TextSection stageinfosection = textfile.GetSection("StageInfo"); TextSection shadowsection = textfile.GetSection("Shadow"); TextSection reflectionsection = textfile.GetSection("Reflection"); TextSection musicsection = textfile.GetSection("Music"); TextSection bgdefsection = textfile.GetSection("BGDef"); if (infosection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Info' section"); if (camerasection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Camera' section"); if (playerinfosection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'PlayerInfo' section"); if (boundsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Bound' section"); if (stageinfosection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'StageInfo' section"); if (shadowsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Shadow' section"); //if (reflectionsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Reflection' section"); if (musicsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Music' section"); if (bgdefsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'BGDef' section"); m_name = infosection.GetAttribute<String>("name"); m_camerastartlocation.X = camerasection.GetAttribute<Int32>("startx"); m_camerastartlocation.Y = camerasection.GetAttribute<Int32>("starty"); m_camerabounds = BuildBoundsRect(camerasection, "boundleft", "boundright", "boundhigh", "boundlow"); m_floortension = camerasection.GetAttribute<Int32>("floortension", 0); m_tension = camerasection.GetAttribute<Int32>("tension"); m_verticalfollow = camerasection.GetAttribute<Single>("verticalfollow"); m_p1start.X = playerinfosection.GetAttribute<Single>("p1startx"); m_p1start.Y = playerinfosection.GetAttribute<Single>("p1starty"); m_p1facing = playerinfosection.GetAttribute<Facing>("p1facing"); m_p2start.X = playerinfosection.GetAttribute<Single>("p2startx"); m_p2start.Y = playerinfosection.GetAttribute<Single>("p2starty"); m_p2facing = playerinfosection.GetAttribute<Facing>("p2facing"); m_playerbounds = BuildBoundsRect(playerinfosection, "leftbound", "rightbound", "topbound", "botbound"); m_screenleft = boundsection.GetAttribute<Int32>("screenleft"); m_screenright = boundsection.GetAttribute<Int32>("screenright"); m_zoffset = stageinfosection.GetAttribute<Int32>("zoffset"); m_zoffsetlink = stageinfosection.GetAttribute<Int32?>("zoffsetlink", null); m_autoturn = stageinfosection.GetAttribute<Boolean>("autoturn"); m_resetbg = stageinfosection.GetAttribute<Boolean>("resetBG"); m_shadowintensity = stageinfosection.GetAttribute<Byte>("intensity", 128); m_shadowcolor = stageinfosection.GetAttribute<Color>("color", Color.TransparentBlack); m_shadowscale = stageinfosection.GetAttribute<Single>("yscale", 0.4f); m_shadowfade = stageinfosection.GetAttribute<Point?>("fade.range", null); if (reflectionsection != null) { m_shadowreflection = reflectionsection.GetAttribute<Boolean>("reflect", false); } else { m_shadowreflection = false; } m_musicfile = musicsection.GetAttribute<String>("bgmusic", String.Empty); m_volumeoffset = musicsection.GetAttribute<Int32>("bgvolume", 0); m_spritefile = bgdefsection.GetAttribute<String>("spr"); m_debug = bgdefsection.GetAttribute<Boolean>("debugbg", false); if (Engine.GetSubSystem<IO.FileSystem>().DoesFileExist(m_spritefile) == false) { m_spritefile = Engine.GetSubSystem<IO.FileSystem>().CombinePaths("stages", m_spritefile); } Drawing.SpriteManager spritemanager = Engine.GetSubSystem<Drawing.SpriteSystem>().CreateManager(SpritePath); Animations.AnimationManager animationmanager = Engine.GetSubSystem<Animations.AnimationSystem>().CreateManager(Profile.Filepath); m_backgrounds = new Backgrounds.Collection(spritemanager, animationmanager); foreach (TextSection textsection in textfile) { if (s_bgtitleregex.Match(textsection.Title).Success == true) { m_backgrounds.CreateBackground(textsection); } } Reset(); }