Пример #1
0
        public static void ChangeSquadBetweenMaps(DeathmatchMap Map, Squad ActiveSquad, MapSwitchPoint ActiveSwitchPoint)
        {
            Map.ListPlayer[Map.ActivePlayerIndex].ListSquad.Remove(ActiveSquad);
            Map.ListPlayer[Map.ActivePlayerIndex].UpdateAliveStatus();
            DeathmatchMap SwitchMap = (DeathmatchMap)Map.ListSubMap.Find(x => x.BattleMapPath == ActiveSwitchPoint.SwitchMapPath);

            if (!SwitchMap.IsInit)
            {
                SwitchMap.Init();
                SwitchMap.TogglePreview(true);
            }

            for (int U = 0; U < ActiveSquad.UnitsInSquad; ++U)
            {
                ActiveSquad.At(U).ReinitializeMembers(Map.DicUnitType[ActiveSquad.At(U).UnitTypeName]);
            }

            ActiveSquad.ReloadSkills(SwitchMap.DicUnitType, SwitchMap.DicRequirement, SwitchMap.DicEffect, SwitchMap.DicAutomaticSkillTarget, SwitchMap.DicManualSkillTarget);
            SwitchMap.ListPlayer[Map.ActivePlayerIndex].ListSquad.Add(ActiveSquad);
            SwitchMap.ListPlayer[Map.ActivePlayerIndex].UpdateAliveStatus();
            ActiveSquad.SetPosition(new Vector3(ActiveSwitchPoint.OtherMapEntryPoint.X, ActiveSwitchPoint.OtherMapEntryPoint.Y, ActiveSquad.Z));

            Map.ListGameScreen.Remove(Map);
            Map.ListGameScreen.Insert(0, SwitchMap);
        }
 public void InitMap()
 {
     ActiveMap.Load();
     ActiveMap.Init();
 }
Пример #3
0
        public override void Update(GameTime gameTime)
        {
            EllapsedTime += gameTime.ElapsedGameTime.TotalSeconds;

            if (EllapsedTime >= 10)
            {
                RemoveScreen(this);
                MultiplayerScreen Autoplay = new MultiplayerScreen();
                Autoplay.Load();
                Constants.ShowAnimation = false;
                PushScreen(Autoplay.LoadAutoplay());
            }

            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(), string.Empty, new Dictionary <string, List <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.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;
                }
            }
        }