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();
        }
Exemple #2
0
        void CheckReady()
        {
            if (m_isdone == true)
            {
                return;
            }
            if (m_stageselected == false || m_p1info.IsSelected == false || m_p2info.IsSelected == false)
            {
                return;
            }

            m_isdone = true;

            if (m_currentstage == -1)
            {
                m_currentstage = MenuSystem.GetSubSystem <Random>().NewInt(0, StageProfiles.Count - 1);
            }

            Int32 p1index = (m_p1info.CurrentCell.Y * m_gridsize.X) + m_p1info.CurrentCell.X;
            Int32 p2index = (m_p2info.CurrentCell.Y * m_gridsize.X) + m_p2info.CurrentCell.X;

            PlayerSelect p1    = PlayerProfiles[p1index];
            PlayerSelect p2    = PlayerProfiles[p2index];
            StageProfile stage = StageProfiles[m_currentstage];

            Combat.EngineInitialization init = new Combat.EngineInitialization(CombatMode.Versus, p1.Profile, m_p1info.PaletteIndex, p2.Profile, m_p2info.PaletteIndex, stage);

            MenuSystem.PostEvent(new Events.SetupCombat(init));
            MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Versus));
        }
        public override void Update(GameTime gametime)
        {
            base.Update(gametime);

            if (m_over == true)
            {
                return;
            }

            if (FightEngine.TickCount >= m_recording.Data.Count)
            {
                if (MenuSystem.GetSubSystem <InitializationSettings>().QuitAfterReplay == true)
                {
                    MenuSystem.PostEvent(new Events.FadeScreen(FadeDirection.Out));
                }

                m_over = true;
                return;
            }

            InjectRecordingInput();

            if (Pause == PauseState.Unpaused || Pause == PauseState.PauseStep)
            {
                FightEngine.Update(gametime);
            }

            if (Pause == PauseState.PauseStep)
            {
                m_pause = PauseState.Paused;
            }
        }
Exemple #4
0
        private void SelectActiveMenuItem(bool pressed)
        {
            if (pressed)
            {
                SoundManager.Play(m_soundselect);
                switch (m_currentmenuitem)
                {
                case (int)MainMenuOption.Arcade:
                    MenuSystem.PostEvent(new Events.SetupCombatMode(CombatMode.Arcade));
                    MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Select));
                    break;

                case (int)MainMenuOption.Versus:
                    MenuSystem.PostEvent(new Events.SetupCombatMode(CombatMode.Versus));
                    MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Select));
                    break;

                case (int)MainMenuOption.TeamArcade:
                    MenuSystem.PostEvent(new Events.SetupCombatMode(CombatMode.TeamArcade));
                    MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Select));
                    break;

                case (int)MainMenuOption.TeamVersus:
                    MenuSystem.PostEvent(new Events.SetupCombatMode(CombatMode.TeamVersus));
                    MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Select));
                    break;

                case (int)MainMenuOption.Quit:
                    QuitGame(true);
                    break;
                }
            }
        }
Exemple #5
0
        public Storyboard(MenuSystem menuSystem, string path)
        {
            var fileSystem = menuSystem.GetSubSystem <FileSystem>();
            var fileExits  = fileSystem.DoesFileExist(path);

            if (!fileExits)
            {
                IsFinished = true;
                return;
            }
            var textfile         = fileSystem.OpenTextFile(path);
            var animationManager = menuSystem.GetSubSystem <AnimationSystem>().CreateManager(textfile.Filepath);
            var sceneDef         = textfile.GetSection("SceneDef");
            var directoryName    = System.IO.Path.GetDirectoryName(path);
            var fileName         = System.IO.Path.GetFileNameWithoutExtension(path);
            var spritePath       = $"{directoryName}/" + sceneDef.GetAttribute <string>("spr");
            var soundPath        = $"{directoryName}/" + sceneDef.GetAttribute("snd", $"{fileName}.snd");
            var spritemanager    = menuSystem.GetSubSystem <SpriteSystem>().CreateManager(spritePath);
            var soundManager     = menuSystem.GetSubSystem <SoundSystem>().CreateManager(soundPath);
            var fontMap          = new FontMap(new Dictionary <int, Font>());

            Vector2?position   = null;
            Color?  clearColor = null;

            m_scenes = new List <Scene>();
            var sceneSections = textfile.Where(o => o.Title.StartsWith("Scene ", StringComparison.OrdinalIgnoreCase));

            foreach (var sceneSection in sceneSections)
            {
                var scene = new Scene(menuSystem, sceneSection, spritemanager, animationManager, soundManager, fontMap);
                if (scene.Position.HasValue)
                {
                    position = scene.Position;
                }
                else if (position.HasValue)
                {
                    scene.Position = position;
                }
                if (scene.ClearColor.HasValue)
                {
                    clearColor = scene.ClearColor;
                }
                else if (clearColor.HasValue)
                {
                    scene.ClearColor = clearColor;
                }
                m_scenes.Add(scene);
            }
            m_index = sceneDef.GetAttribute("startscene", 0);
            if (m_index < 0)
            {
                m_index = 0;
            }
            if (m_index >= m_scenes.Count)
            {
                m_index = m_scenes.Count - 1;
            }
            m_scenes[m_index].Reset();
        }
Exemple #6
0
 public override void Update(GameTime gametime)
 {
     Storyboard?.Update();
     if (Storyboard?.IsFinished == true)
     {
         MenuSystem.PostEvent(Event);
     }
 }
Exemple #7
0
        public SelectScreen(MenuSystem screensystem, TextSection textsection, string spritepath, string animationpath, string soundpath)
            : base(screensystem, textsection, spritepath, animationpath, soundpath)
        {
            m_textsection = textsection;
            var elements = new Collection(SpriteManager, AnimationManager, SoundManager, MenuSystem.FontMap);

            Grid = new SelectGrid(textsection, elements, PlayerProfiles);
        }
Exemple #8
0
        public override void FadeOutComplete()
        {
            base.FadeOutComplete();

            Recorder.EndRecording();

            MenuSystem.GetSubSystem <Audio.SoundSystem>().StopAllSounds();
        }
Exemple #9
0
 public VersusScreen(MenuSystem screensystem, TextSection textsection, String spritepath, String animationpath, String soundpath)
     : base(screensystem, textsection, spritepath, animationpath, soundpath)
 {
     m_visibletime = textsection.GetAttribute<Int32>("time");
     m_p1 = new VersusData("p1.", textsection);
     m_p2 = new VersusData("p2.", textsection);
     m_timer = new CountdownTimer(TimeSpan.FromSeconds(m_visibletime / 60.0f), this.ShowTimeComplete);
 }
Exemple #10
0
 public VersusScreen(MenuSystem screensystem, TextSection textsection, string spritepath, string animationpath, string soundpath)
     : base(screensystem, textsection, spritepath, animationpath, soundpath)
 {
     m_visibletime = textsection.GetAttribute <int>("time");
     m_p1          = new VersusData("p1.", textsection);
     m_p2          = new VersusData("p2.", textsection);
     m_timer       = new CountdownTimer(TimeSpan.FromSeconds(m_visibletime / 60.0f), ShowTimeComplete);
 }
Exemple #11
0
        void CancelCombat(Boolean pressed)
        {
            if (pressed == true)
            {
                Pause = PauseState.Unpaused;

                MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Title));
            }
        }
Exemple #12
0
        protected Screen(MenuSystem menusystem)
        {
            if (menusystem == null)
            {
                throw new ArgumentNullException(nameof(menusystem));
            }

            MenuSystem = menusystem;
        }
Exemple #13
0
        private void CancelCombat(bool pressed)
        {
            if (pressed)
            {
                Pause = PauseState.Unpaused;

                MenuSystem.PostEvent(new Events.FadeScreen(FadeDirection.Out));
            }
        }
Exemple #14
0
        protected Screen(MenuSystem menusystem)
        {
            if (menusystem == null)
            {
                throw new ArgumentNullException("menusystem");
            }

            m_menusystem = menusystem;
        }
Exemple #15
0
        public override void FadingIn()
        {
            if (MenuSystem.GetSubSystem <InitializationSettings>().RecordReplay == true)
            {
                Recorder.StartRecording();
            }

            base.FadingIn();
        }
Exemple #16
0
        public virtual void SetInput(Input.InputState inputstate)
        {
            if (inputstate == null)
            {
                throw new ArgumentNullException("inputstate");
            }

            MenuSystem.GetSubSystem <Input.InputSystem>().SaveInputState();
        }
        void CancelCombat(Boolean pressed)
        {
            if (pressed == true)
            {
                Pause = PauseState.Unpaused;

                MenuSystem.PostEvent(new Events.FadeScreen(FadeDirection.Out));
            }
        }
Exemple #18
0
        private void CancelCombat(bool pressed)
        {
            if (pressed)
            {
                Pause = PauseState.Unpaused;

                MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Title));
            }
        }
Exemple #19
0
        private void BackToTitleScreen(bool pressed)
        {
            if (pressed)
            {
                SoundManager.Play(m_soundCancel);

                MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Title));
            }
        }
Exemple #20
0
 private void QuitGame(bool pressed)
 {
     if (pressed)
     {
         m_quitselected = true;
         SoundManager.Play(m_soundcancel);
         MenuSystem.PostEvent(new Events.FadeScreen(FadeDirection.Out));
     }
 }
Exemple #21
0
        public override void Draw(Boolean debugdraw)
        {
            base.Draw(debugdraw);

            Point shift = new Point(Mugen.ScreenSize.X / 2, 0);

            MenuSystem.GetSubSystem <Video.VideoSystem>().CameraShift += shift;
            m_backgrounds.Draw();
            MenuSystem.GetSubSystem <Video.VideoSystem>().CameraShift -= shift;
        }
 /// <summary>
 /// Input handler for toggling pause state.
 /// </summary>
 /// <param name="pressed">Whether the button is pressed or released.</param>
 void TogglePause(Boolean pressed)
 {
     if (pressed == true)
     {
         if (Pause == PauseState.Paused || Pause == PauseState.PauseStep)
         {
             m_pause = PauseState.Unpaused;
             MenuSystem.GetSubSystem <Audio.SoundSystem>().UnPauseSounds();
         }
         else
         {
             m_pause = PauseState.Paused;
             MenuSystem.GetSubSystem <Audio.SoundSystem>().PauseSounds();
         }
     }
 }
Exemple #23
0
        void SelectActiveMenuItem(Boolean pressed)
        {
            if (pressed == true)
            {
                SoundManager.Play(m_soundselect);

                if (m_currentmenuitem == (Int32)MainMenuOption.Versus)
                {
                    MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Select));
                }
                else if (m_currentmenuitem == (Int32)MainMenuOption.Quit)
                {
                    QuitGame(true);
                }
            }
        }
Exemple #24
0
 /// <summary>
 /// Input handler for toggling pause state.
 /// </summary>
 /// <param name="pressed">Whether the button is pressed or released.</param>
 private void TogglePause(bool pressed)
 {
     if (pressed)
     {
         if (Pause == PauseState.Paused || Pause == PauseState.PauseStep)
         {
             Pause = PauseState.Unpaused;
             MenuSystem.GetSubSystem <Audio.SoundSystem>().UnPauseSounds();
         }
         else
         {
             Pause = PauseState.Paused;
             MenuSystem.GetSubSystem <Audio.SoundSystem>().PauseSounds();
         }
     }
 }
Exemple #25
0
        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();
        }
Exemple #26
0
        public SelectScreen(MenuSystem screensystem, TextSection textsection, String spritepath, String animationpath, String soundpath)
            : base(screensystem, textsection, spritepath, animationpath, soundpath)
        {
            m_selectmap     = new Dictionary <Point, PlayerSelect>();
            m_selectmovemap = new Dictionary <Point, PlayerSelect>();

            m_gridsize   = new Point();
            m_gridsize.X = textsection.GetAttribute <Int32>("columns");
            m_gridsize.Y = textsection.GetAttribute <Int32>("rows");

            m_wrapping           = textsection.GetAttribute <Boolean>("wrapping");
            m_showemptyboxes     = textsection.GetAttribute <Boolean>("showEmptyBoxes");
            m_moveoveremptyboxes = textsection.GetAttribute <Boolean>("moveOverEmptyBoxes");
            m_gridposition       = textsection.GetAttribute <Point>("pos");
            m_cellsize           = textsection.GetAttribute <Point>("cell.size");
            m_cellspacing        = textsection.GetAttribute <Int32>("cell.spacing");

            m_elements = new Elements.Collection(SpriteManager, AnimationManager, SoundManager, MenuSystem.FontMap);
            m_elements.Build(textsection, "cell.bg");
            m_elements.Build(textsection, "cell.random");

            m_cursorblinking      = textsection.GetAttribute <Boolean>("p2.cursor.blink");
            m_soundcancel         = textsection.GetAttribute <SoundId>("cancel.snd");
            m_titlelocation       = textsection.GetAttribute <Point>("title.offset");
            m_titlefont           = textsection.GetAttribute <PrintData>("title.font");
            m_stageposition       = textsection.GetAttribute <Point>("stage.pos");
            m_soundstagemove      = textsection.GetAttribute <SoundId>("stage.move.snd");
            m_soundstageselect    = textsection.GetAttribute <SoundId>("stage.done.snd");
            m_stagefont1          = textsection.GetAttribute <PrintData>("stage.active.font");
            m_stagefont2          = textsection.GetAttribute <PrintData>("stage.active2.font");
            m_stagedonefont       = textsection.GetAttribute <PrintData>("stage.done.font");
            m_randomswitchtime    = textsection.GetAttribute <Int32>("cell.random.switchtime", 5);
            m_p1info              = new SelectData(this, MenuSystem.GetSubSystem <Input.InputSystem>().CurrentInput[1], textsection, "p1", m_moveoveremptyboxes);
            m_p2info              = new SelectData(this, MenuSystem.GetSubSystem <Input.InputSystem>().CurrentInput[2], textsection, "p2", m_moveoveremptyboxes);
            m_isdone              = false;
            m_stagedisplaybuilder = new StringBuilder();

#warning Hack for now
            VersusMode = "Versus Mode";
        }
Exemple #27
0
		public TitleScreen(MenuSystem screensystem, TextSection textsection, String spritepath, String animationpath, String soundpath) :
			base(screensystem, textsection, spritepath, animationpath, soundpath)
		{
			m_menuposition = textsection.GetAttribute<Point>("menu.pos");
			m_mainfont = textsection.GetAttribute<PrintData>("menu.item.font");
			m_activefont = textsection.GetAttribute<PrintData>("menu.item.active.font");
			m_spacing = textsection.GetAttribute<Point>("menu.item.spacing");
			m_visiblemenuitems = textsection.GetAttribute<Int32>("menu.window.visibleitems");
			m_cursorvisible = textsection.GetAttribute<Boolean>("menu.boxcursor.visible");
			m_soundcursormove = textsection.GetAttribute<SoundId>("cursor.move.snd");
			m_soundselect = textsection.GetAttribute<SoundId>("cursor.done.snd");
			m_soundcancel = textsection.GetAttribute<SoundId>("cancel.snd");

			m_menutext = BuildMenuText(textsection);

			Point margins = textsection.GetAttribute<Point>("menu.window.margins.y");
			m_marginytop = margins.X;
			m_marginybottom = margins.Y;

			m_currentmenuitem = 0;
			m_verticalmenudrawoffset = 0;
			m_quitselected = false;
		}
Exemple #28
0
        public Scene(MenuSystem menuSystem, TextSection textSection,
                     SpriteManager spriteManager, AnimationManager animationManager,
                     SoundManager soundManager, FontMap fontMap)
        {
            m_endTime = textSection.GetAttribute <int>("end.time");
            var clearColor = textSection.GetAttribute("clearcolor", (Vector3?)null);

            if (clearColor.HasValue)
            {
                ClearColor = new Color(clearColor.Value);
            }
            Position = textSection.GetAttribute("layerall.pos", (Vector2?)null);
            var collection = new Collection(spriteManager, animationManager, soundManager, fontMap);

            m_videoSystem = menuSystem.GetSubSystem <VideoSystem>();
            m_spriteBatch = new SpriteBatch(m_videoSystem.Device);

            m_fader  = new Fader(m_videoSystem.EmptyTexture, textSection);
            m_layers = new Layer[10];
            for (var i = 0; i < m_layers.Length; i++)
            {
                m_layers[i] = new Layer();
                var prefix = $"layer{i}";
                if (textSection.HasAttribute($"{prefix}.starttime"))
                {
                    m_layers[i].StartTime = textSection.GetAttribute <int>($"{prefix}.starttime");
                }
                if (textSection.HasAttribute($"{prefix}.anim"))
                {
                    m_layers[i].AnimatedImage = (AnimatedImage)collection.Build(textSection, prefix);
                }
                if (textSection.HasAttribute($"{prefix}.offset"))
                {
                    m_layers[i].Offset = textSection.GetAttribute <Vector2>($"{prefix}.offset");
                }
            }
        }
Exemple #29
0
        public TitleScreen(MenuSystem screensystem, TextSection textsection, string spritepath, string animationpath, string soundpath) :
            base(screensystem, textsection, spritepath, animationpath, soundpath)
        {
            m_menuposition     = textsection.GetAttribute <Point>("menu.pos");
            m_mainfont         = textsection.GetAttribute <PrintData>("menu.item.font");
            m_activefont       = textsection.GetAttribute <PrintData>("menu.item.active.font");
            m_spacing          = textsection.GetAttribute <Point>("menu.item.spacing");
            m_visiblemenuitems = textsection.GetAttribute <int>("menu.window.visibleitems");
            m_cursorvisible    = textsection.GetAttribute <bool>("menu.boxcursor.visible");
            m_soundcursormove  = textsection.GetAttribute <SoundId>("cursor.move.snd");
            m_soundselect      = textsection.GetAttribute <SoundId>("cursor.done.snd");
            m_soundcancel      = textsection.GetAttribute <SoundId>("cancel.snd");

            m_menutext = BuildMenuText(textsection);

            var margins = textsection.GetAttribute <Point>("menu.window.margins.y");

            m_marginytop    = margins.X;
            m_marginybottom = margins.Y;

            m_currentmenuitem        = 0;
            m_verticalmenudrawoffset = 0;
            m_quitselected           = false;
        }
Exemple #30
0
 public virtual void FadingIn()
 {
     SetInput(MenuSystem.GetSubSystem <Input.InputSystem>().CurrentInput);
 }
Exemple #31
0
 public OptionsScreen(MenuSystem menusystem, TextSection titleSection, TextSection textsection, string spritepath, string animationpath, string soundpath) : base(menusystem, textsection, spritepath, animationpath, soundpath)
 {
     m_mainFont    = titleSection.GetAttribute <PrintData>("menu.item.font");
     m_soundCancel = textsection.GetAttribute <SoundId>("cancel.snd");
 }
 public RecordedCombatScreen(MenuSystem menusystem)
     : base(menusystem)
 {
     m_pause = PauseState.Unpaused;
     m_over = false;
 }
Exemple #33
0
 public CombatScreen(MenuSystem menusystem)
     : base(menusystem)
 {
     m_pause = PauseState.Unpaused;
     m_recorder = new Replay.Recorder(this);
 }
Exemple #34
0
        protected Screen(MenuSystem menusystem)
        {
            if (menusystem == null) throw new ArgumentNullException("menusystem");

            m_menusystem = menusystem;
        }
 public RecordedCombatScreen(MenuSystem menusystem)
     : base(menusystem)
 {
     m_pause = PauseState.Unpaused;
     m_over  = false;
 }
Exemple #36
0
 public StoryboardScreen(MenuSystem menusystem)
     : base(menusystem)
 {
 }