Пример #1
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();
        }
Пример #2
0
        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;
            }
        }
Пример #3
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();
        }
Пример #4
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));
        }
Пример #5
0
        public override void FadeOutComplete()
        {
            base.FadeOutComplete();

            Recorder.EndRecording();

            MenuSystem.GetSubSystem <Audio.SoundSystem>().StopAllSounds();
        }
Пример #6
0
        public virtual void SetInput(Input.InputState inputstate)
        {
            if (inputstate == null)
            {
                throw new ArgumentNullException("inputstate");
            }

            MenuSystem.GetSubSystem <Input.InputSystem>().SaveInputState();
        }
Пример #7
0
        public override void FadingIn()
        {
            if (MenuSystem.GetSubSystem <InitializationSettings>().RecordReplay == true)
            {
                Recorder.StartRecording();
            }

            base.FadingIn();
        }
Пример #8
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;
        }
Пример #9
0
 /// <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();
         }
     }
 }
Пример #10
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();
         }
     }
 }
Пример #11
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";
        }
Пример #12
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");
                }
            }
        }
Пример #13
0
 public virtual void FadingIn()
 {
     SetInput(MenuSystem.GetSubSystem <Input.InputSystem>().CurrentInput);
 }