public virtual void OnDropGameServerConnection(Exception ex) { if (ex != null) { PopupHandler.Add(PopupAlertMessageBuilder.GameServerDisconnection()); } }
public GameList() { animatedButtonList = new List <AnimatedButton>(); roomButtonList = new List <RoomButton>(); requestedRoomMetadataList = new List <RoomMetadata>(); Background = new Sprite(@"Interface/InGame/Scene/GameList/Background", position: Parameter.ScreenCenter, layerDepth: DepthParameter.Background, shouldCopyAsset: false); CreateBottomBarAnimatedButtons(); CreateRoomFilteringAnimatedButtons(); //popups PopupHandler.PopupGameOptions.OnClose = OptionsCloseAction; createGamePopup = new PopupCreateGame(Vector2.Zero); createGamePopup.OnClose = (sender) => { UnlockAllInterfaceElements(); }; PopupHandler.Add(createGamePopup); //button positioning variables widthFactor = Background.SpriteWidth / 3; heightFactor = 69; buttonHeightPosition = 140 - (int)Parameter.ScreenCenter.Y; //Room Filtering roomFilter = new RoomMetadata(GameMode.Any, default, default, default, default, 0, default, default);
//MatchMetadata matchMetadata; public GameRoom() { animatedButtonList = new List <AnimatedButton>(); buttonList = new List <Button>(); spriteList = new List <Sprite>(); //Background Background = new Sprite(@"Interface/InGame/Scene/GameRoom/Background", position: Parameter.ScreenCenter, layerDepth: DepthParameter.Foreground, shouldCopyAsset: false); //UI Components CreatePlayerButton(); CreateMiddleBarAnimatedButtons(); CreateBottomBarAnimatedButtons(); CreateMatchMetadataButtons(); CreateRoomName(); CreateMobilePortrait(); //text box textBox = new TextBox(new Vector2(-391, 139), new Vector2(410, 135), 100, 0, hasScrollBar: true, scrollBackgroundAlpha: 0.6f, hasTextField: true, textFieldBackground: 0, textFieldOffset: new Vector2(30, -1), maximumTextLength: 50, onSendMessage: OnSendMessage); textBox.EnableTextField(); matchConfigurationGrid = new MatchConfigurationGrid(Parameter.ScreenCenter - new Vector2(-1, 115)); ServerInformationBroker.Instance.ActionCallbackDictionary[NetworkObjectParameters.GameServerRoomRefreshMetadata] += UpdateRoomMetadataAsyncCallback; ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerRoomLeaveRoom, LeaveRoomAsyncCallback); ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerRoomReadyRoom, ReadyRoomAsyncCallback); //Textual callbacks ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerChatSendPlayerMessage, OnReceiveMessageAsyncCallback); ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerChatSendSystemMessage, OnReceiveMessageAsyncCallback); playerButtonList.UpdatePlayerButtonList(); //Popup menus popupSelectMobile = new PopupSelectMobile(SelectMobileAction, CloseSelectMobileAction); PopupHandler.Add(popupSelectMobile); PopupHandler.PopupGameOptions.OnClose = OptionsCloseAction; popupSelectItem = new PopupSelectItem(); popupSelectItem.OnClose += SelectItemCloseAction; //Connect to channel ServerInformationHandler.SendChatDisconnectionRequest(); ServerInformationHandler.SendChatConnectionRequest(Message.BuildGameServerChatGameRoom(GameInformation.Instance.RoomMetadata.ID)); #warning Pre-release deactivation animatedButtonList[2].Disable(); animatedButtonList[5].Disable(); animatedButtonList[6].Disable(); animatedButtonList[8].Disable(); buttonList.Remove(metadataRenameRoom); }
private void RequestGameEndAsyncCallback(object answer) { RoomMetadata room = GameInformation.Instance.RoomMetadata; lock (room) { GameInformation.Instance.RoomMetadata.VictoriousTeam = (PlayerTeam)answer; PopupHandler.Add(new PopupGameResults()); } }
/// <summary> /// Creates a popup for avatar purchase and disable the try/buy button. /// While the popup is open the interface buttons are disabled. /// </summary> private void BuyButtonAction(object sender) { popupBuyAvatar = new PopupBuyAvatar(selectedAvatarMetadata, OnCloseBuyAvatarPopupDialog, OnBuyCash, OnBuyGold); PopupHandler.Add(popupBuyAvatar); buyButton.Disable(true); tryButton.Disable(true); DisableInterfaceElements(); }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (InputHandler.IsBeingPressed(Keys.F1)) { //CurrentTurnOwner.LoseTurn(); MobileList[0].GrantTurn(); MobileList[0].LayerDepth = 0.6f; MobileList.ForEach((x) => x.Movement.RemainingStepsThisTurn = 100000); } if (InputHandler.IsBeingPressed(Keys.F4)) { MatchMetadata.WindForce = r.Next(0, 35); MatchMetadata.WindAngleDegrees = r.Next(0, 360); HUD.WindCompass.ChangeWind(MatchMetadata.WindAngleDegrees, MatchMetadata.WindForce); } if (InputHandler.IsBeingPressed(Keys.F5)) { WeatherHandler.Add(WeatherType.Mirror, new Vector2(-500, -Topography.MapHeight / 2)); WeatherHandler.Add(WeatherType.Mirror, new Vector2(-300, -Topography.MapHeight / 2)); } if (InputHandler.IsBeingPressed(Keys.F6)) { WeatherHandler.Add(WeatherType.Weakness, new Vector2(-400, -Topography.MapHeight / 2)); WeatherHandler.Add(WeatherType.Weakness, new Vector2(0, -Topography.MapHeight / 2)); } if (InputHandler.IsBeingPressed(Keys.F7)) { WeatherHandler.Add(WeatherType.Force, new Vector2(-300, -Topography.MapHeight / 2)); WeatherHandler.Add(WeatherType.Force, new Vector2(0, -Topography.MapHeight / 2)); } if (InputHandler.IsBeingPressed(Keys.F8)) { WeatherHandler.Add(WeatherType.Tornado, new Vector2(400, -Topography.MapHeight / 2)); } if (InputHandler.IsBeingPressed(Keys.F9)) { WeatherHandler.Add(WeatherType.Electricity, new Vector2(-100, -Topography.MapHeight / 2)); WeatherHandler.Add(WeatherType.Electricity, new Vector2(0, -Topography.MapHeight / 2)); } if (InputHandler.IsBeingPressed(Keys.F10)) { WeatherHandler.Add(WeatherType.Random, WeatherType.Weakness, new Vector2(0, -Topography.MapHeight / 2)); } if (InputHandler.IsBeingPressed(Keys.F11)) { Color green = new Color(57, 255, 20, 255 / 4); Color blue = new Color(27, 3, 163, 255 / 4); Color red = new Color(255, 7, 58, 255 / 4); Color white = new Color(255, 255, 255, 255 / 4); Color yellow = new Color(204, 255, 0, 255 / 4); Vector2 position = Vector2.Zero; for (int i = 0; i < 10; i++) { SpecialEffectBuilder.ThorShot(position, Color.Lerp(green, blue, i / 9f), 6, 0); position += Vector2.UnitX * 15; } for (int i = 0; i < 10; i++) { SpecialEffectBuilder.ThorShot(position, Color.Lerp(blue, yellow, i / 9f), 6, 0); position += Vector2.UnitX * 15; } for (int i = 0; i < 10; i++) { SpecialEffectBuilder.ThorShot(position, Color.Lerp(yellow, red, i / 9f), 6, 0); position += Vector2.UnitX * 15; } for (int i = 0; i < 10; i++) { SpecialEffectBuilder.ThorShot(position, Color.Lerp(red, white, i / 9f), 6, 0); position += Vector2.UnitX * 15; } } if (InputHandler.IsBeingPressed(Keys.F12)) { MineList[0].GrantTurn(); } if (InputHandler.IsBeingPressed(Keys.F2)) { WeatherHandler.Add(WeatherType.Thor, WeatherType.Weakness, new Vector2(0, -Topography.MapHeight / 2)); } if (InputHandler.IsBeingPressed(Keys.F3)) { SpecialEffectBuilder.RaonLauncherProjectile2ActiveTornado(MobileList[0].Position); } if (InputHandler.IsBeingPressed(Keys.D1)) { SpecialEffectBuilder.RaonLauncherProjectile2DormantTornado(MobileList[0].Position); } if (InputHandler.IsBeingPressed(Keys.D2)) { MobileList[3].Die(); } if (InputHandler.IsBeingPressed(Keys.D3)) { MobileList[0].ChangeFlipbookState(ActorFlipbookState.BeingDamaged2, true); } if (InputHandler.IsBeingPressed(Keys.D4)) { new PopupSelectItem() { ShouldRender = true }; } if (InputHandler.IsBeingPressed(Keys.D5)) { HUD.OnReceiveMessageAsyncCallback(new PlayerMessage() { Player = MobileList[0].Owner, PlayerTeam = PlayerTeam.Red, Text = "Abiruindjo abirual" }, 0); HUD.OnReceiveMessageAsyncCallback(new CustomMessage() { FontTextType = FontTextType.Consolas10, TextBorderColor = Color.Red.PackedValue, TextColor = Color.Blue.PackedValue, Text = "Abiruindjo abirual" }, 1); } if (InputHandler.IsBeingPressed(Keys.D6)) { PopupHandler.Add(new PopupSelectItem() { ShouldRender = true }); } if (InputHandler.IsBeingPressed(Keys.D7)) { SceneHandler.Instance.RequestSceneChange(SceneType.DebugScene, TransitionEffectType.RotatingRectangles); } if (InputHandler.IsBeingPressed(Keys.D8)) { //SpecialEffectBuilder.HitEffect(new Vector2(100, 100), 4, MathHelper.TwoPi * (float)Parameter.Random.NextDouble()); for (int i = 0; i < 8; i++) { MobileList[0].Owner.Attribute[i] = 1; } } if (InputHandler.IsBeingPressed(Keys.D9)) { //MobileList[0].ReceiveDamage(10); for (int i = 0; i < 8; i++) { if (Parameter.Random.NextDouble() < 0.1) { MobileList[0].Owner.Attribute[i] = Math.Sign(MobileList[0].Owner.Attribute[i]) * (Math.Abs(MobileList[0].Owner.Attribute[i]) + 1) * -1; } } //HUD.StatusBarDictionary.ForEach((x) => x.UpdateAttributeList()); } if (InputHandler.IsBeingReleased(Keys.D0)) { //tb = new TextBalloon(MobileList[0], "123123123 123123123 1231231234814812749817498174 71829741984712984721941928471924721984"); } tb?.Update(gameTime); }
//static List<Mobile> mobList; public DebugScene() { sceneTimespan = 1f; hasRequestedNextScene = false; Camera.Zoom = new Vector2(1, 1); #region Mobile List /* * mobList = new List<Mobile>(); * mobList.Add(ActorBuilder.BuildMobile(MobileType.Knight, sMobList[0].Owner, new Vector2(100 * 1, 100))); * mobList.Add(ActorBuilder.BuildMobile(MobileType.Knight, sMobList[1].Owner, new Vector2(100 * 2, 100))); * mobList.Add(ActorBuilder.BuildMobile(MobileType.Knight, sMobList[2].Owner, new Vector2(100 * 3, 100))); * mobList.Add(ActorBuilder.BuildMobile(MobileType.Knight, sMobList[3].Owner, new Vector2(100 * 4, 100))); * mobList.Add(ActorBuilder.BuildMobile(MobileType.Knight, sMobList[4].Owner, new Vector2(100 * 5, 100))); * mobList.Add(ActorBuilder.BuildMobile(MobileType.Knight, sMobList[5].Owner, new Vector2(100 * 6, 100))); * mobList.Add(ActorBuilder.BuildMobile(MobileType.Knight, sMobList[6].Owner, new Vector2(100 * 7, 100))); * mobList.Add(ActorBuilder.BuildMobile(MobileType.Knight, sMobList[7].Owner, new Vector2(100 * 8, 100))); * * for (int i = 0; i < 8; i++) ;*/ MobileList.ForEach((x) => { x.SyncMobile = sMobList[MobileList.IndexOf(x)]; }); #endregion MatchMetadata = new MatchMetadata(); //MatchMetadata.CurrentTurnOwner = MobileList[0].SyncMobile; //optionsMenu.ShouldRender = true; //Popup create char popupSelectMobile = new PopupSelectMobile((x) => { }, () => { }); PopupHandler.Add(popupSelectMobile); //MobFlipbook mFlipbook = new List <MobileFlipbook>(); for (int k = 0; k < 21; k++) { mFlipbook.Add(MobileFlipbook.CreateMobileFlipbook(MobileType.RaonLauncher, new Vector2(-500 + 100 * (k % 5), -500 + 100 * (k / 5)))); } int i = 0; mFlipbook[i++].ChangeState(ActorFlipbookState.Stand, true); mFlipbook[i++].ChangeState(ActorFlipbookState.StandLowHealth, true); mFlipbook[i++].ChangeState(ActorFlipbookState.Moving, true); mFlipbook[i++].ChangeState(ActorFlipbookState.MovingLowHealth, true); mFlipbook[i++].ChangeState(ActorFlipbookState.UnableToMove, true); mFlipbook[i++].ChangeState(ActorFlipbookState.Emotion1, true); mFlipbook[i++].ChangeState(ActorFlipbookState.Emotion2, true); mFlipbook[i++].ChangeState(ActorFlipbookState.BeingDamaged1, true); mFlipbook[i++].ChangeState(ActorFlipbookState.BeingDamaged2, true); mFlipbook[i++].ChangeState(ActorFlipbookState.BeingShocked, true); mFlipbook[i++].ChangeState(ActorFlipbookState.BeingFrozen, true); mFlipbook[i++].ChangeState(ActorFlipbookState.ChargingS1, true); mFlipbook[i++].ChangeState(ActorFlipbookState.ShootingS1, true); mFlipbook[i++].ChangeState(ActorFlipbookState.ChargingS2, true); mFlipbook[i++].ChangeState(ActorFlipbookState.ShootingS2, true); mFlipbook[i++].ChangeState(ActorFlipbookState.ChargingSS, true); mFlipbook[i++].ChangeState(ActorFlipbookState.ShootingSS, true); mFlipbook[i++].ChangeState(ActorFlipbookState.UsingItem, true); mFlipbook[i++].ChangeState(ActorFlipbookState.Dead, true); mFlipbook[i++].ChangeState(ActorFlipbookState.Falling, true); mFlipbook[i++].ChangeState(ActorFlipbookState.All, true); }