Exemple #1
0
        public Collection(Drawing.SpriteManager sprites, Animations.AnimationManager animations, Audio.SoundManager sounds, Drawing.FontMap fontmap)
        {
            if (sprites == null)
            {
                throw new ArgumentNullException("sprites");
            }
            if (animations == null)
            {
                throw new ArgumentNullException("animations");
            }
            if (sounds == null)
            {
                throw new ArgumentNullException("sounds");
            }
            if (fontmap == null)
            {
                throw new ArgumentNullException("fontmap");
            }

            m_elements         = new KeyedCollection <String, Elements.Base>(x => x.Name, StringComparer.OrdinalIgnoreCase);
            m_spritemanager    = sprites;
            m_animationmanager = animations;
            m_soundmanager     = sounds;
            m_fontmap          = fontmap;
        }
Exemple #2
0
        public Collection(Drawing.SpriteManager sprites, Animations.AnimationManager animations, Audio.SoundManager sounds, Drawing.FontMap fontmap)
        {
            if (sprites == null)
            {
                throw new ArgumentNullException(nameof(sprites));
            }
            if (animations == null)
            {
                throw new ArgumentNullException(nameof(animations));
            }
            if (sounds == null)
            {
                throw new ArgumentNullException(nameof(sounds));
            }
            if (fontmap == null)
            {
                throw new ArgumentNullException(nameof(fontmap));
            }

            m_elements         = new Dictionary <string, Base>(StringComparer.OrdinalIgnoreCase);
            m_spritemanager    = sprites;
            m_animationmanager = animations;
            m_soundmanager     = sounds;
            m_fontmap          = fontmap;
        }
Exemple #3
0
        public Base(Collection collection, String name, DataMap datamap, Drawing.SpriteManager sprites, Animations.AnimationManager animations, Audio.SoundManager sounds)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (datamap == null)
            {
                throw new ArgumentNullException("datamap");
            }
            if (sprites == null)
            {
                throw new ArgumentNullException("sprites");
            }
            if (animations == null)
            {
                throw new ArgumentNullException("animations");
            }
            if (sounds == null)
            {
                throw new ArgumentNullException("sounds");
            }

            m_collection       = collection;
            m_name             = name;
            m_data             = datamap;
            m_spritemanager    = sprites;
            m_animationmanager = animations.Clone();
            m_soundmanager     = sounds;
        }
Exemple #4
0
        public Static(TextSection textsection, Drawing.SpriteManager spritemanager)
            : base(textsection)
        {
            if (spritemanager == null)
            {
                throw new ArgumentNullException("spritemanager");
            }

            m_spritemanager = spritemanager;
            m_spriteid      = textsection.GetAttribute <SpriteId>("spriteno", SpriteId.Invalid);
            m_sprite        = SpriteManager.GetSprite(SpriteId);
        }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        /// <param name="spritemanager">The xnaMugen.Sprites.SpriteManager used by all backgrounds in this collection.</param>
        /// <param name="animationmanager">The xnaMugen.Animations.AnimationManager used by all backgrounds in this collection.</param>
        public Collection(Drawing.SpriteManager spritemanager, Animations.AnimationManager animationmanager)
        {
            if (spritemanager == null)
            {
                throw new ArgumentNullException(nameof(spritemanager));
            }
            if (animationmanager == null)
            {
                throw new ArgumentNullException(nameof(animationmanager));
            }

            m_backgrounds      = new List <Base>();
            m_spritemanager    = spritemanager;
            m_animationmanager = animationmanager;
        }
Exemple #6
0
        public Animated(TextSection textsection, Drawing.SpriteManager spritemanager, Animations.AnimationManager animationmanager)
            : base(textsection)
        {
            if (spritemanager == null)
            {
                throw new ArgumentNullException("spritemanager");
            }
            if (animationmanager == null)
            {
                throw new ArgumentNullException("animationmanager");
            }

            m_spritemanager    = spritemanager;
            m_animationmanager = animationmanager;
            m_animationnumber  = textsection.GetAttribute <Int32>("actionno", Int32.MinValue);
        }
        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 AnimatedImage(Collection collection, string name, DataMap datamap, Drawing.SpriteManager sprites, Animations.AnimationManager animations, Audio.SoundManager sounds)
     : base(collection, name, datamap, sprites, animations, sounds)
 {
     Reset();
 }
Exemple #9
0
 public Text(Collection collection, String name, DataMap datamap, Drawing.SpriteManager sprites, Animations.AnimationManager animations, Audio.SoundManager sounds)
     : base(collection, name, datamap, sprites, animations, sounds)
 {
 }
Exemple #10
0
        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();
        }