Ejemplo n.º 1
0
        public override void Update(double ElapsedSeconds)
        {
            GameTime UpdateTime = new GameTime(TimeSpan.Zero, TimeSpan.FromSeconds(ElapsedSeconds));

            if (!IsInit)
            {
                if (ListGameScreen.Count == 0)
                {
                    Load();
                    Init();
                    TogglePreview(true);

                    if (ListGameScreen.Count == 0)
                    {
                        foreach (IOnlineConnection ActivePlayer in GameGroup.Room.ListOnlinePlayer)
                        {
                            ActivePlayer.Send(new ServerIsReadyScriptServer());
                        }
                    }
                    else
                    {
                        IsInit = false;
                    }
                }
                else
                {
                    ListGameScreen[0].Update(UpdateTime);
                    if (!ListGameScreen[0].Alive)
                    {
                        ListGameScreen.RemoveAt(0);
                    }

                    if (ListGameScreen.Count == 0)
                    {
                        foreach (IOnlineConnection ActivePlayer in GameGroup.Room.ListOnlinePlayer)
                        {
                            ActivePlayer.Send(new ServerIsReadyScriptServer());
                        }

                        IsInit = true;
                    }
                }
            }

            LayerManager.Update(UpdateTime);

            if (!ListPlayer[ActivePlayerIndex].IsPlayerControlled && ListActionMenuChoice.HasMainPanel)
            {
                ListActionMenuChoice.Last().Update(UpdateTime);
            }
        }
Ejemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            EllapsedTime += gameTime.ElapsedGameTime.TotalSeconds;

            if (EllapsedTime >= 10)
            {
                int OldNumberOfGameScreen  = ListGameScreen.Count;
                MultiplayerScreen Autoplay = new MultiplayerScreen();
                Autoplay.Load();
                Constants.ShowAnimation = false;
                DeathmatchMap NewMap = Autoplay.LoadAutoplay();
                NewMap.ListGameScreen = ListGameScreen;
                NewMap.Load();
                NewMap.Init();
                NewMap.TogglePreview(true);

                //Remove any GameScreen created by the map so they don't show up immediately.
                List <GameScreen> ListGameScreenCreatedByMap = new List <GameScreen>(ListGameScreen.Count - OldNumberOfGameScreen);
                for (int S = ListGameScreen.Count - 1 - OldNumberOfGameScreen; S >= 0; --S)
                {
                    ListGameScreenCreatedByMap.Add(ListGameScreen[S]);
                    ListGameScreen.RemoveAt(S);
                }

                RemoveAllScreens();
                ListGameScreen.Insert(0, NewMap);
                NewMap.Update(gameTime);

                for (int S = 0; S < ListGameScreenCreatedByMap.Count; ++S)
                {
                    ListGameScreen.Insert(0, ListGameScreenCreatedByMap[S]);
                    ListGameScreenCreatedByMap[S].Update(gameTime);
                }

                ListGameScreenCreatedByMap.Clear();
            }

            if (InputHelper.InputUpPressed())
            {
                EllapsedTime = 0;

                SelectedChoice--;
                sndSelection.Play();

                if (SelectedChoice == -1)
                {
                    SelectedChoice = 4;
                }
            }
            else if (InputHelper.InputDownPressed())
            {
                EllapsedTime = 0;

                SelectedChoice++;
                sndSelection.Play();

                if (SelectedChoice == 5)
                {
                    SelectedChoice = 0;
                }
            }
            else if (InputHelper.InputConfirmPressed())
            {
                switch ((MenuChoices)SelectedChoice)
                {
                case MenuChoices.NewGame:
                    sndIntroSong.Stop();
                    sndConfirm.Play();

                    /*
                     *
                     * int OldNumberOfGameScreen = ListGameScreen.Count;
                     * StreamReader BR = new StreamReader("Content/Map path.ini");
                     * DeathmatchMap NewMap = new DeathmatchMap(BR.ReadLine(), 0, new Dictionary<string, List<Core.Units.Squad>>());
                     * BR.Close();
                     * NewMap.ListGameScreen = ListGameScreen;
                     * NewMap.PlayerRoster = new Roster();
                     * NewMap.PlayerRoster.LoadRoster();
                     * NewMap.Load();
                     * NewMap.Init();
                     * NewMap.TogglePreview(true);
                     *
                     * //Remove any GameScreen created by the map so they don't show up immediately.
                     * List<GameScreen> ListGameScreenCreatedByMap = new List<GameScreen>(ListGameScreen.Count - OldNumberOfGameScreen);
                     * for (int S = ListGameScreen.Count - 1 - OldNumberOfGameScreen; S >= 0; --S)
                     * {
                     *  ListGameScreenCreatedByMap.Add(ListGameScreen[S]);
                     *  ListGameScreen.RemoveAt(S);
                     * }
                     *
                     * RemoveAllScreens();
                     * ListGameScreen.Insert(0, NewMap);
                     * NewMap.Update(gameTime);
                     *
                     * for (int S = 0; S < ListGameScreenCreatedByMap.Count; ++S)
                     * {
                     *  ListGameScreen.Insert(0, ListGameScreenCreatedByMap[S]);
                     *  ListGameScreenCreatedByMap[S].Update(gameTime);
                     * }
                     *
                     * ListGameScreenCreatedByMap.Clear();*/
                    PushScreen(new GameSelection());
                    break;

                case MenuChoices.QuickLoad:
                    if (File.Exists("User Data/Saves/TempSave.sav"))
                    {
                        sndIntroSong.Stop();
                        sndConfirm.Play();
                        BattleMap QuickLoadMap = BattleMap.LoadTemporaryMap(ListGameScreen);
                        QuickLoadMap.TogglePreview(true);
                        ListGameScreen.Insert(0, QuickLoadMap);
                    }
                    else
                    {
                        sndDeny.Play();
                    }
                    break;

                case MenuChoices.Encyclopedia:
                    sndDeny.Play();
                    break;

                case MenuChoices.Option:
                    PushScreen(new OptionMenu());
                    sndConfirm.Play();
                    break;

                case MenuChoices.LoadGame:
                    if (File.Exists("User Data/Saves/SRWE Save.bin"))
                    {
                        sndIntroSong.Stop();
                        sndConfirm.Play();

                        Roster PlayerRoster = new Roster();
                        PlayerRoster.LoadRoster();
                        Dictionary <string, Unit> DicUnitType = Unit.LoadAllUnits();
                        Dictionary <string, BaseSkillRequirement>     DicRequirement          = BaseSkillRequirement.LoadAllRequirements();
                        Dictionary <string, BaseEffect>               DicEffect               = BaseEffect.LoadAllEffects();
                        Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget = AutomaticSkillTargetType.LoadAllTargetTypes();
                        Dictionary <string, ManualSkillTarget>        DicManualSkillTarget    = ManualSkillTarget.LoadAllTargetTypes();
                        DataScreen.LoadProgression(PlayerRoster, DicUnitType, DicRequirement, DicEffect, DicAutomaticSkillTarget, DicManualSkillTarget);
                        PushScreen(new NewIntermissionScreen(PlayerRoster));
                    }
                    else
                    {
                        sndDeny.Play();
                    }
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public override void Update(GameTime gameTime)
        {
            if (InputHelper.InputUpPressed())
            {
                SelectedChoice--;
                sndSelection.Play();

                if (SelectedChoice == -1)
                {
                    SelectedChoice = 12;
                }
            }
            else if (InputHelper.InputDownPressed())
            {
                SelectedChoice++;
                sndSelection.Play();

                if (SelectedChoice == 13)
                {
                    SelectedChoice = 0;
                }
            }
            else if (InputHelper.InputConfirmPressed())
            {
                InputHelper.ResetState();

                switch ((MenuChoices)SelectedChoice)
                {
                case MenuChoices.Normal:
                    int           OldNumberOfGameScreen = ListGameScreen.Count;
                    StreamReader  BR     = new StreamReader("Content/Map path.ini");
                    DeathmatchMap NewMap = new DeathmatchMap(BR.ReadLine(), string.Empty, new Dictionary <string, List <Core.Units.Squad> >());
                    BR.Close();
                    NewMap.ListGameScreen = ListGameScreen;
                    NewMap.PlayerRoster   = new Roster();
                    NewMap.PlayerRoster.LoadRoster();
                    NewMap.Load();
                    NewMap.Init();
                    NewMap.TogglePreview(true);

                    //Remove any GameScreen created by the map so they don't show up immediately.
                    List <GameScreen> ListGameScreenCreatedByMap = new List <GameScreen>(ListGameScreen.Count - OldNumberOfGameScreen);
                    for (int S = ListGameScreen.Count - 1 - OldNumberOfGameScreen; S >= 0; --S)
                    {
                        ListGameScreenCreatedByMap.Add(ListGameScreen[S]);
                        ListGameScreen.RemoveAt(S);
                    }

                    RemoveAllScreens();
                    ListGameScreen.Insert(0, NewMap);
                    NewMap.Update(gameTime);

                    for (int S = 0; S < ListGameScreenCreatedByMap.Count; ++S)
                    {
                        ListGameScreen.Insert(0, ListGameScreenCreatedByMap[S]);
                        ListGameScreenCreatedByMap[S].Update(gameTime);
                    }

                    ListGameScreenCreatedByMap.Clear();
                    break;

                case MenuChoices.SuperTreeWar:
                    int           OldNumberOfGameScreenSTW = ListGameScreen.Count;
                    DeathmatchMap NewMapSTW = new DeathmatchMap("Super Tree Wars/Holy Temple", string.Empty, new Dictionary <string, List <Core.Units.Squad> >());
                    NewMapSTW.ListGameScreen = ListGameScreen;
                    NewMapSTW.PlayerRoster   = new Roster();
                    NewMapSTW.PlayerRoster.LoadRoster();
                    NewMapSTW.Load();
                    NewMapSTW.Init();
                    NewMapSTW.TogglePreview(true);

                    //Remove any GameScreen created by the map so they don't show up immediately.
                    List <GameScreen> ListGameScreenCreatedByMapSTW = new List <GameScreen>(ListGameScreen.Count - OldNumberOfGameScreenSTW);
                    for (int S = ListGameScreen.Count - 1 - OldNumberOfGameScreenSTW; S >= 0; --S)
                    {
                        ListGameScreenCreatedByMapSTW.Add(ListGameScreen[S]);
                        ListGameScreen.RemoveAt(S);
                    }

                    RemoveAllScreens();
                    ListGameScreen.Insert(0, NewMapSTW);
                    NewMapSTW.Update(gameTime);

                    for (int S = 0; S < ListGameScreenCreatedByMapSTW.Count; ++S)
                    {
                        ListGameScreen.Insert(0, ListGameScreenCreatedByMapSTW[S]);
                        ListGameScreenCreatedByMapSTW[S].Update(gameTime);
                    }

                    ListGameScreenCreatedByMapSTW.Clear();
                    break;

                case MenuChoices.Intermission:
                    BattleMap.NextMapType = "Deathmatch";
                    BattleMap.NextMapPath = "New Item";

                    PushScreen(new IntermissionScreen());
                    break;

                case MenuChoices.MultiplayerClassic:
                    PushScreen(new MultiplayerScreen());
                    break;

                case MenuChoices.MultiplayerLobby:
                    Constants.Width      = 800;
                    Constants.Height     = 600;
                    Constants.ScreenSize = 0;
                    Constants.graphics.PreferredBackBufferWidth  = Constants.Width;
                    Constants.graphics.PreferredBackBufferHeight = Constants.Height;
                    Constants.graphics.ApplyChanges();
                    PushScreen(new Lobby(true));
                    break;

                case MenuChoices.MultiplayerLobbyOffline:
                    Constants.Width      = 800;
                    Constants.Height     = 600;
                    Constants.ScreenSize = 0;
                    Constants.graphics.PreferredBackBufferWidth  = Constants.Width;
                    Constants.graphics.PreferredBackBufferHeight = Constants.Height;
                    Constants.graphics.ApplyChanges();
                    PushScreen(new Lobby(false));
                    break;

                case MenuChoices.WorldMap:
                    PushScreen(new WorldMap("Test Map", string.Empty, new Dictionary <string, List <Core.Units.Squad> >()));
                    break;

                case MenuChoices.Conquest:
                    PushScreen(new GameScreens.ConquestMapScreen.ConquestMap("Conquest Test", string.Empty, null));
                    break;

                case MenuChoices.SorcererStreet:
                    PushScreen(new GameScreens.SorcererStreetScreen.SorcererStreetMap("New Item", string.Empty));
                    break;

                case MenuChoices.Racing:
                    PushScreen(new RacingMap());
                    break;

                case MenuChoices.SuperTank:
                    Constants.Width      = 1024;
                    Constants.Height     = 768;
                    Constants.ScreenSize = 0;
                    Constants.graphics.PreferredBackBufferWidth  = Constants.Width;
                    Constants.graphics.PreferredBackBufferHeight = Constants.Height;
                    Constants.graphics.ApplyChanges();

                    PushScreen(new GameScreens.SuperTankScreen.SuperTank2());
                    break;

                case MenuChoices.TripleThunderOnline:
                    Constants.Width      = 800;
                    Constants.Height     = 600;
                    Constants.ScreenSize = 0;
                    Constants.graphics.PreferredBackBufferWidth  = Constants.Width;
                    Constants.graphics.PreferredBackBufferHeight = Constants.Height;
                    Constants.graphics.ApplyChanges();
                    PushScreen(new GameScreens.TripleThunderScreen.Lobby(true));
                    break;

                case MenuChoices.TripleThunderOffline:
                    Constants.Width      = 800;
                    Constants.Height     = 600;
                    Constants.ScreenSize = 0;
                    Constants.graphics.PreferredBackBufferWidth  = Constants.Width;
                    Constants.graphics.PreferredBackBufferHeight = Constants.Height;
                    Constants.graphics.ApplyChanges();
                    PushScreen(new GameScreens.TripleThunderScreen.Lobby(false));
                    break;
                }
            }
            else if (InputHelper.InputCancelPressed())
            {
                RemoveScreen(this);
            }
        }