public override void Update(GameTime gameTime) { if (Client == null) { RemoveScreen(this); ScreenToLoad.Load(); ScreenToLoad.Init(); ScreenToLoad.TogglePreview(true); ListGameScreen.Insert(0, ScreenToLoad); } else if (Client != null && Client.IsConnected && Client.Host.IsGameReady) { if (!HasAskedForInfo) { Client.SetGame(ScreenToLoad); Client.Host.Send(new AskGameDataScriptClient()); HasAskedForInfo = true; } else if (ScreenToLoad.IsInit) { RemoveScreen(this); ListGameScreen.Insert(0, ScreenToLoad); } } }
public override void Update(GameTime gameTime) { if (Stage == -1) { if (InputHelper.InputUpPressed()) { if (CursorIndex > 0) { CursorIndex--; } } else if (InputHelper.InputDownPressed()) { if (CursorIndex < 8 && CursorIndex + 1 + (PageCurrent - 1) * 8 < ListPresentSquad.Count) { CursorIndex++; } } else if (InputHelper.InputLeftPressed()) { if (PageCurrent > 1) { PageCurrent--; } } else if (InputHelper.InputRightPressed()) { if (PageCurrent * 8 < ListPresentSquad.Count) { PageCurrent++; } } else if (InputHelper.InputConfirmPressed()) { if (ListSpawnSquad.Count == ListSingleplayerSpawns.Count) { RemoveAllScreens(); ListGameScreen.Insert(0, NewMap); NewMap = null; } else { ListSpawnSquad.Add(ListPresentSquad[CursorIndex + (PageCurrent - 1) * 8]); } } else if (InputHelper.InputCancelPressed()) { RemoveScreen(this); } } else { if (InputHelper.InputCancelPressed() || InputHelper.InputConfirmPressed()) { Stage--; } } }
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); } }
private void StartGame() { sndButtonClick.Play(); if (OnlineGameClient != null && OnlineGameClient.IsConnected) { OnlineGameClient.StartGame(); } else { Dictionary <string, List <Squad> > DicSpawnSquadByPlayer = new Dictionary <string, List <Squad> >(); for (int P = 0; P < Room.ListRoomPlayer.Count; ++P) { DicSpawnSquadByPlayer.Add(Room.ListRoomPlayer[P].Name, Room.ListRoomPlayer[P].Inventory.ActiveLoadout.ListSquad); } BattleMap NewMap; if (Room.MapPath == "Random") { NewMap = BattleMap.DicBattmeMapType[Room.MapType].GetNewMap(Room.RoomType); } else { NewMap = BattleMap.DicBattmeMapType[Room.MapType].GetNewMap(Room.RoomType); } NewMap.BattleMapPath = Room.MapPath; NewMap.DicSpawnSquadByPlayer = DicSpawnSquadByPlayer; NewMap.ListGameScreen = ListGameScreen; for (int P = 0; P < 10; P++) { if (P < PlayerManager.ListLocalPlayer.Count) { BattleMapPlayer ActivePlayer = PlayerManager.ListLocalPlayer[P]; NewMap.AddLocalPlayer(ActivePlayer); } else//Fill with empty players to ensure the enemy player is always player 10+ { NewMap.AddLocalPlayer(null); } } NewMap.Load(); NewMap.Init(); NewMap.TogglePreview(true); ListGameScreen.Insert(0, NewMap); } }
public override void Update(GameTime gameTime) { if (InputHelper.InputUpPressed()) { --LineIndex; if (LineIndex < 0) { LineIndex = MinIndex; } } else if (InputHelper.InputDownPressed()) { ++LineIndex; if (LineIndex > MinIndex) { LineIndex = 0; } } else if (InputHelper.InputConfirmPressed() || InputHelper.InputCancelPressed()) { ListGameScreen.Remove(this); } }
public void InitPlayerBattle(Squad ActiveSquad, SupportSquadHolder ActiveSquadSupport, int AttackerPlayerIndex, Squad TargetSquad, SupportSquadHolder TargetSquadSupport, int DefenderPlayerIndex, bool IsActiveSquadOnRight) { if (TargetSquad.CurrentLeader.Boosts.AttackFirstModifier && !ActiveSquad.CurrentLeader.Boosts.AttackFirstModifier) { Squad ActiveSquadTemp = ActiveSquad; SupportSquadHolder ActiveSquadSupportTemp = ActiveSquadSupport; int AttackerPlayerIndexTemp = AttackerPlayerIndex; ActiveSquad = TargetSquad; ActiveSquadSupport = TargetSquadSupport; AttackerPlayerIndex = DefenderPlayerIndex; TargetSquad = ActiveSquadTemp; TargetSquadSupport = ActiveSquadSupportTemp; DefenderPlayerIndex = AttackerPlayerIndexTemp; } ActivePlayerIndex = AttackerPlayerIndex; ActiveSquadIndex = ListPlayer[AttackerPlayerIndex].ListSquad.IndexOf(ActiveSquad); TargetPlayerIndex = DefenderPlayerIndex; TargetSquadIndex = ListPlayer[TargetPlayerIndex].ListSquad.IndexOf(TargetSquad); bool ShowAnimation = Constants.ShowAnimation && ActiveSquad.CurrentLeader.CurrentAttack.Animations.Start.AnimationName != null; ListNextAnimationScreen.Clear(); NonDemoScreen.ListNonDemoBattleFrame.Clear(); ListActionMenuChoice.RemoveAllSubActionPanels(); SquadBattleResult AttackingResult = CalculateFinalHP(ActiveSquad, ActiveSquadSupport.ActiveSquadSupport, ActivePlayerIndex, BattleMenuOffenseFormationChoice, TargetSquad, TargetSquadSupport.ActiveSquadSupport, TargetPlayerIndex, true, true); AnimationScreen.AnimationUnitStats UnitStats = new AnimationScreen.AnimationUnitStats(ActiveSquad, TargetSquad, IsActiveSquadOnRight); SquadBattleResult DefendingResult = new SquadBattleResult(new BattleResult[1] { new BattleResult() }); if (ShowAnimation) { if (IsActiveSquadOnRight) { GenerateNextAnimationScreens(ActiveSquad, ActiveSquadSupport, TargetSquad, TargetSquadSupport, UnitStats, AnimationScreen.BattleAnimationTypes.RightAttackLeft, AttackingResult); } else { GenerateNextAnimationScreens(ActiveSquad, ActiveSquadSupport, TargetSquad, TargetSquadSupport, UnitStats, AnimationScreen.BattleAnimationTypes.LeftAttackRight, AttackingResult); } } if (AttackingResult.ArrayResult[0].Target.ComputeRemainingHPAfterDamage(AttackingResult.ArrayResult[0].AttackDamage) > 0) { //Counter. if (TargetSquad.CurrentLeader.BattleDefenseChoice == Unit.BattleDefenseChoices.Attack) { DefendingResult = CalculateFinalHP(TargetSquad, null, TargetPlayerIndex, BattleMenuDefenseFormationChoice, ActiveSquad, null, ActivePlayerIndex, true, true); if (ShowAnimation) { if (IsActiveSquadOnRight) { GenerateNextAnimationScreens(ActiveSquad, ActiveSquadSupport, TargetSquad, TargetSquadSupport, UnitStats, AnimationScreen.BattleAnimationTypes.RightConteredByLeft, DefendingResult); } else { GenerateNextAnimationScreens(ActiveSquad, ActiveSquadSupport, TargetSquad, TargetSquadSupport, UnitStats, AnimationScreen.BattleAnimationTypes.LeftConteredByRight, DefendingResult); } } } } if (ShowAnimation) { PushScreen(ListNextAnimationScreen[0]); ListNextAnimationScreen.RemoveAt(0); ListNextAnimationScreen.Add(new EndBattleAnimationScreen(this, ActiveSquad, ActiveSquadSupport, AttackerPlayerIndex, TargetSquad, TargetSquadSupport, DefenderPlayerIndex, AttackingResult, DefendingResult)); } else { NonDemoScreen.InitNonDemo(ActiveSquad, ActiveSquadSupport, AttackerPlayerIndex, AttackingResult, BattleMenuOffenseFormationChoice, TargetSquad, TargetSquadSupport, DefenderPlayerIndex, DefendingResult, BattleMenuDefenseFormationChoice, IsActiveSquadOnRight); NonDemoScreen.Alive = true; ListGameScreen.Insert(0, NonDemoScreen); } //AttackingSquad Activations. for (int U = 0; U < ActiveSquad.UnitsAliveInSquad; U++) { ActiveSquad[U].UpdateSkillsLifetime(SkillEffect.LifetimeTypeBattle); } //DefendingSquad Activations. for (int U = 0; U < TargetSquad.UnitsAliveInSquad; U++) { TargetSquad[U].UpdateSkillsLifetime(SkillEffect.LifetimeTypeBattle); } FinalizeMovement(ActiveSquad, (int)GetTerrain(ActiveSquad).MovementCost); ActiveSquad.EndTurn(); bool HasAfterAttack = false; ActionPanelDeathmatch AfterAttack = new ActionPanelMainMenu(this, ActiveSquad, AttackerPlayerIndex); if (ActiveSquad.CurrentLeader.Boosts.PostAttackModifier.Attack) { HasAfterAttack = true; AfterAttack.AddChoiceToCurrentPanel(new ActionPanelAttackPart1(ActiveSquad.CanMove, ActiveSquad, AttackerPlayerIndex, this)); } if (ActiveSquad.CurrentLeader.Boosts.PostAttackModifier.Move) { HasAfterAttack = true; CursorPosition = ActiveSquad.Position; AfterAttack.AddChoiceToCurrentPanel(new ActionPanelMovePart1(this, ActiveSquad.Position, CameraPosition, ActiveSquad, AttackerPlayerIndex, true)); } if (HasAfterAttack) { AfterAttack.AddChoiceToCurrentPanel(new ActionPanelWait(this, ActiveSquad)); ListActionMenuChoice.Add(AfterAttack); } }
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; } } }
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(); /*StreamReader BR = new StreamReader("Content/Map path.ini"); * PushScreen(new DeathmatchMap(BR.ReadLine(), 0, new System.Collections.Generic.List<Core.Units.Squad>())); * BR.Close();*/ PushScreen(new GameSelection()); break; case MenuChoices.QuickLoad: if (File.Exists("TempSave.sav")) { sndIntroSong.Stop(); sndConfirm.Play(); BattleMap QuickLoadMap = BattleMap.LoadTemporaryMap(); QuickLoadMap.ListGameScreen = ListGameScreen; 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("SRWE Save.bin")) { sndIntroSong.Stop(); sndConfirm.Play(); PushScreen(new IntermissionScreen()); } else { sndDeny.Play(); } break; } } }
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); } }