public void Unselection() { if (selectedPiece != null) { Square square = board[selectedPiece.Position.x, selectedPiece.Position.y]; if (step != e_step.Placement) { selectedPiece.NotifyMovement(square, false); } else { MoveHeroPiece(selectedPiece.Index, square.Position, false); } selectedPiece.HighLight(false); } selectedPiece = null; selectedActive = null; canUnselect = false; toDrag = null; movementList.Clear(); attackList.Clear(); activeList.Clear(); if (step != e_step.Placement) { foreach (Square s in board) { s.UnHighLight(); } } }
public void SelectByUid(int uid) { if (_activeButtons.ContainsKey(uid)) { Select = _activeButtons[uid]; } }
public void ClickOnActive(ActiveButton _active) { Unselection(); selectedActive = _active; HeroPiece piece = _active.Piece; Ability activeAbility = piece.Hero.Active; if (activeAbility.Targetting == e_targetting.Default) { activeList.Add(board[piece.Position.x, piece.Position.y]); activeList = utility.GetRange(activeList, piece.Hero.Active); foreach (Square s in activeList) { s.HighLight(1); } } else if (activeAbility.Targetting == e_targetting.AutomaticTarget) { activeList.Add(board[piece.Position.x, piece.Position.y]); activeList = utility.GetRange(activeList, piece.Hero.Active); piece.ActivePower(activeList.ToArray()); Unselection(); } else { piece.ActivePower(null); Unselection(); } }
public override void Draw(CustomSpriteBatch g) { DrawBox(g, new Vector2(), Constants.Width, Constants.Height, Color.White); DrawBox(g, new Vector2(0, 0), (int)(Constants.Width * 0.7), TopSectionHeight, Color.White); g.DrawString(fntArial12, "INVENTORY", new Vector2(10, 20), Color.White); //Left side DrawBox(g, new Vector2(0, HeaderSectionY), LeftSideWidth, HeaderSectionHeight, Color.White); DrawBox(g, new Vector2(0, MiddleSectionY), LeftSideWidth, MiddleSectionHeight, Color.White); DrawBox(g, new Vector2(0, BottomSectionY), LeftSideWidth, Constants.Height - BottomSectionY, Color.White); DrawBox(g, new Vector2(LeftSideWidth, HeaderSectionY), LeftSideWidth, HeaderSectionHeight, Color.White); DrawBox(g, new Vector2(LeftSideWidth, MiddleSectionY), LeftSideWidth, MiddleSectionHeight, Color.White); DrawBox(g, new Vector2(LeftSideWidth, BottomSectionY), LeftSideWidth, Constants.Height - BottomSectionY, Color.White); g.DrawStringRightAligned(fntArial12, "Money: 14360 cr", new Vector2(LeftSideWidth - 12, BottomSectionY + 11), Color.White); ActiveSubScreen.Draw(g); foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } }
public override void Draw(CustomSpriteBatch g) { g.Draw(sprBackground, new Vector2(Constants.Width / 2, Constants.Height / 2), null, Color.White, 0f, new Vector2(sprBackground.Width / 2, sprBackground.Height / 2), 1f, SpriteEffects.None, 0f); foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } if (RoomSubtype == "Capture The Flag") { g.Draw(sprTextCaptureTheFlag, new Vector2(255, 280), Color.White); } else if (RoomSubtype == "Deathmatch") { g.Draw(sprTextDeathmatch, new Vector2(255, 280), Color.White); } else if (RoomSubtype == "Survival") { g.Draw(sprTextSurvival, new Vector2(255, 280), Color.White); } RoomNameInput.Draw(g); PasswordInput.Draw(g); }
//Edit Added Skill------------------// internal void EditSkill() { ActiveButton.Click(); //clicking active button Thread.Sleep(2000); ActiveButton.Click(); //clicking Active button Thread.Sleep(7000); }
public override void Update(GameTime gameTime) { foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } }
public override void Draw(CustomSpriteBatch g) { int DrawX = PanelX; int DrawY = PanelY; DrawBox(g, new Vector2(DrawX, DrawY), PanelWidth, PanelHeight, Color.White); DrawBox(g, new Vector2(DrawX, DrawY), PanelWidth, 30, Color.White); g.DrawString(fntText, "Bots", new Vector2(DrawX + 10, DrawY + 8), Color.White); DrawY += 40; g.DrawString(fntText, "Number of Bots", new Vector2(DrawX + 10, DrawY), Color.White); DrawY += 105; DrawBox(g, new Vector2(DrawX, DrawY), PanelWidth, PanelHeight + 30, Color.White); DrawBox(g, new Vector2(DrawX, DrawY), PanelWidth, 30, Color.White); g.DrawString(fntText, "Game", new Vector2(DrawX + 10, DrawY + 8), Color.White); DrawY += 40; g.DrawString(fntText, "Goal Score", new Vector2(DrawX + 10, DrawY), Color.White); g.DrawString(fntText, "Time Limit", new Vector2(RightColumnX + 10, DrawY), Color.White); DrawY += 30; g.DrawString(fntText, "Turn Limit", new Vector2(RightColumnX + 10, DrawY), Color.White); DrawY += 30; g.DrawString(fntText, "Min Players", new Vector2(DrawX + 10, DrawY), Color.White); g.DrawString(fntText, "Max Players", new Vector2(RightColumnX + 10, DrawY), Color.White); DrawY += 30; g.DrawString(fntText, "Max Squad Per Player", new Vector2(DrawX + 10, DrawY), Color.White); foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } }
public override void Draw(CustomSpriteBatch g) { g.Draw(sprBackground, Vector2.Zero, Color.White); g.Draw(sprTeamSeparatorBlue, new Vector2(285, 220), Color.White); g.Draw(sprTeamSeparatorRed, new Vector2(55, 220), Color.White); g.Draw(sprActivePlayerIcon, new Vector2(570, 11), Color.White); DrawNumberRightAligned(g, fntTest, Room.MaxKill, new Vector2(700, 294)); DrawNumberRightAligned(g, fntTest, Room.MaxGameLengthInMinutes, new Vector2(700, 318)); g.DrawString(fntText, "Off", new Vector2(643, 355), Color.White); DrawNumberRightAligned(g, fntTest, Room.MaxNumberOfPlayer, new Vector2(753, 356)); g.Draw(sprMapImage, new Vector2(579, 437), Color.White); if (Room.MapPath != "Random") { g.Draw(MapTextOverlay, new Vector2(595, 486), Color.White); g.Draw(MapStar, new Vector2(616, 503), Color.White); MapLevelCategory.Draw(g, new Vector2(680, 513), Color.White); g.Draw(MapStar, new Vector2(740, 503), Color.White); } foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } if (OnlineCommunicationClient != null) { ChatHelper.DrawChat(g, sprTabChat, fntText, OnlineCommunicationClient.Chat, ChatInput); } ModeSelectTextButton.Draw(g); g.DrawString(fntText, Room.RoomName, new Vector2(75, 7), Color.White); int RedPlayerCount = 0; int BluePlayerCount = 0; for (int P = 0; P < Room.ListRoomPlayer.Count; ++P) { int DrawX = 0; int DrawY = 0; if (Room.ListRoomPlayer[P].Team == 0) { DrawX = 155 + (PlayerInfo.SpriteWidth + 40) * (RedPlayerCount % 2); DrawY = 125 + (RedPlayerCount / 2) * 64; ++RedPlayerCount; } else if (Room.ListRoomPlayer[P].Team == 1) { DrawX = 155 + (PlayerInfo.SpriteWidth + 40) * (BluePlayerCount % 2); DrawY = 275 + (BluePlayerCount / 2) * 64; ++BluePlayerCount; } DrawPlayerBox(g, DrawX, DrawY, Room.ListRoomPlayer[P], Room.ListRoomPlayer[P].Team == 1 || !Room.UseTeams); } }
public override void Update(GameTime gameTime) { if (FMODSystem.sndActiveBGM != sndBGM) { sndBGM.PlayAsBGM(); } if (DragAndDropEquipment == null) { foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } switch (ShopFilter) { case ShopFilters.Characters: UpdateCharacterPage(); break; case ShopFilters.Equipment: UpdateEquipmentPage(); break; } } else { DoDragDrop(); } }
public override void Update(GameTime gameTime) { if (DragAndDropEquipment == null) { foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } if (MouseHelper.InputLeftButtonPressed()) { WeaponMenuEquipment SelectedEquipment = GetOwnedWeaponUnderMouse(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y); if (SelectedEquipment != null) { StartDragDrop(SelectedEquipment); } else { WeaponMenuEquipment EquipmentToBuy = GetShopWeaponUnderMouse(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y); if (EquipmentToBuy != null) { PushScreen(new BuyWeapon(EquipmentToBuy, Owner)); } } } } else { DoDragDrop(); } }
void Start() { SetUp(); allButtons.Add(mainMenuButton); allButtons.Add(exitButton); ActiveButton.GetComponent <Text> ().fontStyle = FontStyle.Bold; }
void Awake() { ab = buttonUnit.GetComponent<ActiveButton>(); player = GameObject.Find("N40"); plum = GameObject.Find("Plum"); anim = GetComponent<Animator>(); }
public override bool HitTest(int x, int y, out int controlID, out bool focused) { int focusedControlID = 0; if (ImgUpButtonNormal.InControl(x, y, out focusedControlID)) { _CurrentActiveButton = ActiveButton.Up; } else if (ImgDownButtonNormal.InControl(x, y, out focusedControlID)) { _CurrentActiveButton = ActiveButton.Down; } else if (ImgDeleteButtonNormal.InControl(x, y, out focusedControlID)) { _CurrentActiveButton = ActiveButton.Delete; } else { _CurrentActiveButton = ActiveButton.Main; } return(base.HitTest(x, y, out controlID, out focused)); }
public override void Draw(CustomSpriteBatch g) { g.Draw(sprBackground, Vector2.Zero, Color.White); if (RoomType == RoomInformations.RoomTypeMission) { g.Draw(sprLicenseAll, new Rectangle(572, 16, 24, 24), new Rectangle(1 * 24, 0, 24, 24), Color.White); } else { g.Draw(sprTitleBattle, new Vector2(160, 16), Color.White); g.Draw(sprLicenseAll, new Rectangle(572, 16, 24, 24), new Rectangle(2 * 24, 0, 24, 24), Color.White); } g.DrawString(fntArial12, "Lv." + PlayerManager.OnlinePlayerLevel, new Vector2(610, 17), Color.White); g.DrawString(fntArial12, PlayerManager.OnlinePlayerName, new Vector2(670, 15), Color.White); g.End(); g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); DrawRooms(g); if (OnlineCommunicationClient != null) { ChatHelper.DrawChat(g, sprTabChat, fntArial12, OnlineCommunicationClient.Chat, ChatInput); } DrawPlayers(g); foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } }
static int OnActive(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); ActiveButton obj = (ActiveButton)LuaScriptMgr.GetUnityObjectSelf(L, 1, "ActiveButton"); obj.OnActive(); return(0); }
public override void Update(GameTime gameTime) { if (OnlineGameClient != null) { OnlineGameClient.ExecuteDelayedScripts(); } if (OnlineCommunicationClient != null) { OnlineCommunicationClient.ExecuteDelayedScripts(); } if (FMODSystem.sndActiveBGM != sndBGM) { sndBGM.PlayAsBGM(); } foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } if (OnlineCommunicationClient != null) { ChatHelper.UpdateChat(gameTime, OnlineCommunicationClient.Chat, ChatInput); } if (SelectingTeam == -1 && Room.UseTeams && ListMapTeam.Count > 0 && MouseHelper.InputLeftButtonPressed()) { int DrawX = 10; int DrawY = 45; int PlayerIndex = (MouseHelper.MouseStateCurrent.Y - DrawY) / 45; if (PlayerIndex >= 0 && PlayerIndex < Room.ListRoomPlayer.Count) { Rectangle TeamCollisionBox = new Rectangle(DrawX + 280, DrawY + PlayerIndex * 45, 80, 25); if (PlayerManager.ListLocalPlayer.Contains(Room.ListRoomPlayer[PlayerIndex]) && TeamCollisionBox.Contains(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y)) { SelectingTeam = PlayerIndex; } } } else if (SelectingTeam != -1 && MouseHelper.InputLeftButtonPressed()) { int DrawX = 10; int DrawY = 45 + 30 + SelectingTeam * 45; int TeamIndex = (MouseHelper.MouseStateCurrent.Y - DrawY) / 25; if (TeamIndex >= 0 && TeamIndex < ListMapTeam.Count) { Rectangle TeamCollisionBox = new Rectangle(DrawX + 285, DrawY + TeamIndex * 25, 85, 25); if (TeamCollisionBox.Contains(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y)) { Room.ListRoomPlayer[SelectingTeam].Team = TeamIndex; } } SelectingTeam = -1; } }
static int AddActiveButton(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); ActiveGroup obj = (ActiveGroup)LuaScriptMgr.GetUnityObjectSelf(L, 1, "ActiveGroup"); ActiveButton arg0 = (ActiveButton)LuaScriptMgr.GetUnityObject(L, 2, typeof(ActiveButton)); obj.AddActiveButton(arg0); return(0); }
public override void Draw(CustomSpriteBatch g) { g.End(); g.Begin(); g.Draw(sprBackground, Vector2.Zero, Color.White); int LeftSideWidth = (int)(Constants.Width * 0.7); int TopSectionHeight = (int)(Constants.Height * 0.1); int MiddleSectionY = TopSectionHeight; int MiddleSectionHeight = (int)(Constants.Height * 0.6); int RoomSectionY = (int)(MiddleSectionY + MiddleSectionHeight * 0.2); int RoomSectionHeight = MiddleSectionHeight - (RoomSectionY - MiddleSectionY); int BottomSectionY = MiddleSectionY + MiddleSectionHeight; //Left side DrawBox(g, new Vector2(0, 0), LeftSideWidth, TopSectionHeight, Color.White); g.DrawString(fntArial12, "Player 1", new Vector2(10, 15), Color.White); g.DrawString(fntArial12, "Player 2", new Vector2(110, 15), Color.White); g.DrawString(fntArial12, "Player 3", new Vector2(210, 15), Color.White); g.DrawString(fntArial12, "Player 4", new Vector2(310, 15), Color.White); DrawBox(g, new Vector2(0, MiddleSectionY), LeftSideWidth, MiddleSectionHeight - RoomSectionHeight, Color.White); DrawBox(g, new Vector2(0, RoomSectionY), LeftSideWidth, RoomSectionHeight, Color.White); DrawBox(g, new Vector2(0, BottomSectionY), LeftSideWidth, Constants.Height - BottomSectionY, Color.White); int RightSideWidth = Constants.Width - LeftSideWidth; int PlayerInfoHeight = (int)(Constants.Height * 0.2); int PlayerListY = PlayerInfoHeight; int PlayerListHeight = (int)(Constants.Height * 0.6); int InventoryShopListY = PlayerListY + PlayerListHeight; int InventoryShopListHeight = Constants.Height - InventoryShopListY; //Right side DrawBox(g, new Vector2(LeftSideWidth, 0), RightSideWidth, PlayerListY, Color.White); DrawBox(g, new Vector2(LeftSideWidth, PlayerListY), RightSideWidth, PlayerListHeight, Color.White); DrawBox(g, new Vector2(LeftSideWidth, InventoryShopListY), RightSideWidth, InventoryShopListHeight, Color.White); g.DrawString(fntArial12, "Inventory*Shop", new Vector2(LeftSideWidth + 5, InventoryShopListY + 5), Color.White); g.DrawString(fntArial12, "Lv." + PlayerManager.OnlinePlayerLevel, new Vector2(610, 17), Color.White); g.DrawString(fntArial12, PlayerManager.OnlinePlayerName, new Vector2(670, 15), Color.White); g.End(); g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); DrawRooms(g); if (OnlineCommunicationClient != null) { ChatHelper.DrawChat(g, fntArial12, OnlineCommunicationClient.Chat, ChatInput); } DrawPlayers(g); foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } }
public override void Update(GameTime gameTime) { foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } RoomNameInput.Update(gameTime); PasswordInput.Update(gameTime); }
public override void Draw(CustomSpriteBatch g) { g.Draw(sprBackground, Vector2.Zero, Color.White); ActiveShopScreen.Draw(g); foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } }
//Choose the radio button based on the Active Status public void ChooseActiveStatus(String Status) { if (Status == "Active") { ActiveButton.Click(); } else { HiddenButton.Click(); } }
public void AddActiveButton(ActiveButton button) { if (!_activeButtons.ContainsKey(button.uid)) { _activeButtons.Add(button.uid, button); } else { _activeButtons[button.uid] = button; } }
public override void Update(GameTime gameTime) { if (FMODSystem.sndActiveBGM != sndBGM) { sndBGM.PlayAsBGM(); } ChatInput.Update(gameTime); Rectangle LicenseBox = new Rectangle(572, 16, 24, 24); if (LicenseBox.Intersects(new Rectangle(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y, 1, 1))) { if (MouseHelper.InputLeftButtonPressed()) { if (RoomType == RoomInformations.RoomTypeMission) { RoomType = RoomInformations.RoomTypeBattle; } else { RoomType = RoomInformations.RoomTypeMission; } } } int i = 0; foreach (KeyValuePair <string, RoomInformations> ActiveRoom in DicAllRoom) { int X = 148 + (i % 2) * 248; int Y = 169 + (i / 2) * 60; if (MouseHelper.MouseStateCurrent.X >= X - sprRoom.Origin.X && MouseHelper.MouseStateCurrent.X <= X + sprRoom.Origin.X && MouseHelper.MouseStateCurrent.Y >= Y - sprRoom.Origin.Y && MouseHelper.MouseStateCurrent.Y <= Y + sprRoom.Origin.Y) { if (MouseHelper.InputLeftButtonPressed()) { Dictionary <string, OnlineScript> DicCreateRoomScript = new Dictionary <string, OnlineScript>(); OnlineClient.Host.AddOrReplaceScripts(DicCreateRoomScript); OnlineClient.JoinRoom(ActiveRoom.Key); } } ++i; } foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } }
public override void Draw(CustomSpriteBatch g) { g.Draw(sprBackground, Vector2.Zero, Color.White); g.Draw(sprActivePlayerIcon, new Vector2(570, 11), Color.White); foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } if (OnlineCommunicationClient != null) { ChatHelper.DrawChat(g, sprTabChat, fntText, OnlineCommunicationClient.Chat, ChatInput); } MissionScrollbar.Draw(g); g.DrawString(fntText, Room.RoomName, new Vector2(68, 7), Color.White); g.DrawStringMiddleAligned(fntText, CurrentMissionName, new Vector2(170, 114), Color.White); g.DrawStringMiddleAligned(fntText, CurrentMissionDescription, new Vector2(170, 270), Color.White); if (sprCurrentMissionImage != null) { g.Draw(sprCurrentMissionImage, new Vector2(57, 139), Color.White); } for (int P = 0; P < Room.ListRoomPlayer.Count; ++P) { int DrawX = 678; int DrawY = 310 + P * 64; DrawPlayerBox(g, DrawX, DrawY, Room.ListRoomPlayer[P], true); } for (int M = MissionInfoStartIndex, i = 0; M < ListMissionInfo.Count && i < 4; ++M, ++i) { QuestButton.Draw(g, new Vector2(405, 140 + i * 64), Color.White); g.DrawString(fntText, (M + 1).ToString().PadLeft(2, '0'), new Vector2(395, 120 + i * 64), Color.FromNonPremultiplied(0, 255, 0, 255)); g.DrawString(fntText, "1", new Vector2(485, 120 + i * 64), Color.White); g.DrawString(fntText, ListMissionInfo[M].MissionName, new Vector2(328, 145 + i * 64), Color.FromNonPremultiplied(0, 255, 0, 255)); Rectangle QuestButtonCollisionBox = new Rectangle(405 - (int)QuestButton.Origin.X, 140 - (int)QuestButton.Origin.Y + i * 64, QuestButton.SpriteWidth, QuestButton.SpriteHeight); if (QuestButtonCollisionBox.Contains(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y)) { PlayerInfoOutline.Draw(g, new Vector2(405, 140 + i * 64), Color.White); } } }
public override void Update(GameTime gameTime) { if (FMODSystem.sndActiveBGM != sndBGM) { sndBGM.PlayAsBGM(); } foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } ActiveShopScreen.Update(gameTime); }
public override void Draw(CustomSpriteBatch g) { int BoxWidth = (int)(Constants.Width * 0.55); int InnerBoxWidth = (int)(BoxWidth * 0.95); int BoxHeigth = (int)(Constants.Height * 0.7); int BoxX = Constants.Width / 2 - BoxWidth / 2; int InnerBoxX = BoxX + (int)(BoxWidth * 0.025); int BoxY = Constants.Height / 2 - BoxHeigth / 2; int RoomInfoX = InnerBoxX; int RoomInfoY = BoxY + (int)(BoxHeigth * 0.1); int RoomInfoHeight = (int)(BoxHeigth * 0.2); DrawBox(g, new Vector2(BoxX, BoxY), BoxWidth, BoxHeigth, Color.White); g.DrawString(fntArial12, "Create a Room", new Vector2(BoxX + 20, BoxY + 15), Color.White); DrawBox(g, new Vector2(RoomInfoX, RoomInfoY), InnerBoxWidth, RoomInfoHeight, Color.White); g.DrawString(fntArial12, "Name", new Vector2(BoxX + 25, RoomInfoY + 18), Color.White); DrawBox(g, new Vector2(RoomInfoX + 64, RoomInfoY + 15), (int)(BoxWidth * 0.75), 30, Color.White); g.DrawString(fntArial12, "Make a locked room", new Vector2(BoxX + 25, RoomInfoY + 53), Color.White); DrawBox(g, new Vector2(BoxX + 175, BoxY + 95), (int)(BoxWidth * 0.05), 22, Color.White); g.DrawString(fntArial12, "Password", new Vector2(BoxX + 200, RoomInfoY + 53), Color.White); DrawBox(g, new Vector2(BoxX + 272, BoxY + 90), (int)(BoxWidth * 0.32), 30, Color.White); g.DrawString(fntArial12, "4 digit", new Vector2(BoxX + 360, RoomInfoY + 53), Color.White); DrawBox(g, new Vector2(BoxX + 280, BoxY + 90), (int)(BoxWidth * 0.17), 30, Color.White); int ModeX = InnerBoxX; int ModeY = RoomInfoY + RoomInfoHeight; int ModeHeight = (int)(BoxHeigth * 0.28); int ModeBoxWith = (int)(BoxWidth * 0.37); int ModeBoxSeparation = (int)(BoxWidth * 0.01); DrawBox(g, new Vector2(ModeX, ModeY), InnerBoxWidth, ModeHeight, Color.White); g.DrawString(fntArial12, "Mode", new Vector2(ModeX + 15, ModeY + 18), Color.White); DrawBox(g, new Vector2(ModeX + 10, ModeY + 48), InnerBoxWidth - 20, 60, Color.White); g.DrawString(fntArial12, "Campaign", new Vector2(ModeX + 18, ModeY + 53), Color.White); g.DrawString(fntArial12, "Progress through multiple missions to save the world", new Vector2(ModeX + 18, ModeY + 71), Color.White); int PlayerX = InnerBoxX; int PlayerY = ModeY + ModeHeight; int PlayerHeight = (int)(BoxHeigth * 0.1); DrawBox(g, new Vector2(PlayerX, PlayerY), InnerBoxWidth, PlayerHeight, Color.White); g.DrawString(fntArial12, "Max Players", new Vector2(PlayerX + 15, PlayerY + 10), Color.White); foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } }
/// <summary> /// Handles the Click event of the title bar buttons. /// </summary> /// <param name = "sender">The source of the event.</param> /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param> private void ButtonClick(object sender, EventArgs e) { ActiveButton button = (ActiveButton)sender; label1.Text = string.Format("Button {0}", button.Text); if (button.BackColor == BackColor) { label1.ForeColor = Color.Black; } else { label1.ForeColor = button.BackColor; } }
public override void Draw(CustomSpriteBatch g) { DrawMyCharactersAndEquipment(g); foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } if (DragAndDropEquipment != null) { g.Draw(DragAndDropEquipment.sprIcon, new Vector2(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y), Color.White); } }
public override void Update(GameTime gameTime) { if (!IsDragDropActive) { foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } UpdateEquipmentPage(); } else { DoDragDrop(); } }
public override void Update(GameTime gameTime) { if (FMODSystem.sndActiveBGM != sndBGM) { sndBGM.PlayAsBGM(); } foreach (InteractiveButton ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } foreach (Player ActiveRobot in Room.ListRoomPlayer) { if (ActiveRobot.CharacterPreview != null) { ActiveRobot.CharacterPreview.Update(gameTime); ActiveRobot.CharacterPreview.UpdateAllWeaponsAngle(new Vector2(5, 0)); } } if (KeyboardHelper.KeyPressed(Microsoft.Xna.Framework.Input.Keys.F1)) { Player NewPlayer = new Player("", "", Player.PlayerTypes.Player, false, 0); Room.AddLocalPlayer(NewPlayer); NewPlayer.GameplayType = GameplayTypes.Controller1; } else if (KeyboardHelper.KeyPressed(Microsoft.Xna.Framework.Input.Keys.F2)) { Player NewPlayer = new Player("", "", Player.PlayerTypes.Player, false, 0); Room.AddLocalPlayer(NewPlayer); NewPlayer.GameplayType = GameplayTypes.Controller2; } else if (KeyboardHelper.KeyPressed(Microsoft.Xna.Framework.Input.Keys.F3)) { Player NewPlayer = new Player("", "", Player.PlayerTypes.Player, false, 0); Room.AddLocalPlayer(NewPlayer); NewPlayer.GameplayType = GameplayTypes.Controller3; } else if (KeyboardHelper.KeyPressed(Microsoft.Xna.Framework.Input.Keys.F4)) { Player NewPlayer = new Player("", "", Player.PlayerTypes.Player, false, 0); Room.AddLocalPlayer(NewPlayer); NewPlayer.GameplayType = GameplayTypes.Controller4; } }
public override bool HitTest(int x, int y, out int controlID, out bool focused) { int focusedControlID = 0; if (ImgUpButtonNormal.InControl(x, y, out focusedControlID)) { _CurrentActiveButton = ActiveButton.Up; } else if (ImgDownButtonNormal.InControl(x, y, out focusedControlID)) { _CurrentActiveButton = ActiveButton.Down; } else if (ImgDeleteButtonNormal.InControl(x, y, out focusedControlID)) { _CurrentActiveButton = ActiveButton.Delete; } else { _CurrentActiveButton = ActiveButton.Main; } return base.HitTest(x, y, out controlID, out focused); }
public override bool OnMessage(GUIMessage message) { if (message.Message == GUIMessage.MessageType.GUI_MSG_SETFOCUS || message.Message == GUIMessage.MessageType.GUI_MSG_LOSTFOCUS) { IsEditImageHot = false; } else if (message.Message == GUIMessage.MessageType.GUI_MSG_LOSTFOCUS) { _CurrentActiveButton = ActiveButton.None; } else if (message.Message == GUIMessage.MessageType.GUI_MSG_SETFOCUS) { _CurrentActiveButton = ActiveButton.Main; } return base.OnMessage(message); }
private void FocusPreviousButton() { if (_CurrentActiveButton == ActiveButton.Delete) { if (_DownButtonEnabled) { _CurrentActiveButton = ActiveButton.Down; } else if (_UpButtonEnabled) { _CurrentActiveButton = ActiveButton.Up; } else { _CurrentActiveButton = ActiveButton.Main; } } else if (_CurrentActiveButton == ActiveButton.Down) { if (_UpButtonEnabled) { _CurrentActiveButton = ActiveButton.Up; } else { _CurrentActiveButton = ActiveButton.Main; } } else if (_CurrentActiveButton == ActiveButton.Up) { _CurrentActiveButton = ActiveButton.Main; } }
private void FocusNextButton() { if (_CurrentActiveButton == ActiveButton.Main) { if (_UpButtonEnabled) { _CurrentActiveButton = ActiveButton.Up; } else if (_DownButtonEnabled) { _CurrentActiveButton = ActiveButton.Down; } else if (_DeleteButtonEnabled) { _CurrentActiveButton = ActiveButton.Delete; } } else if (_CurrentActiveButton == ActiveButton.Up) { if (_DownButtonEnabled) { _CurrentActiveButton = ActiveButton.Down; } else if (_DeleteButtonEnabled) { _CurrentActiveButton = ActiveButton.Delete; } } else if (_CurrentActiveButton == ActiveButton.Down) { if (_DeleteButtonEnabled) { _CurrentActiveButton = ActiveButton.Delete; } } }
public override void OnAction(Action action) { if (action.wID == Action.ActionType.ACTION_MOUSE_CLICK || action.wID == Action.ActionType.ACTION_SELECT_ITEM) { //Console.WriteLine("ACTION_MOUSE_CLICK ActiveButton:{0}", _CurrentActiveButton); switch (_CurrentActiveButton) { case ActiveButton.Main: { //Console.WriteLine("Clicked ActiveButton.Main"); break; } case ActiveButton.Up: { //Console.WriteLine("Clicked ActiveButton.Up"); break; } case ActiveButton.Down: { //Console.WriteLine("Clicked ActiveButton.Down"); break; } case ActiveButton.Delete: { //Console.WriteLine("Clicked ActiveButton.Delete"); break; } case ActiveButton.None: { // We should never get here! //Console.WriteLine("Clicked ActiveButton.None"); break; } } } else if (action.wID == Action.ActionType.ACTION_MOVE_LEFT) { if (_CurrentActiveButton != ActiveButton.Main) { FocusPreviousButton(); return; } else { if (NavigateLeft != _windowId) { _CurrentActiveButton = ActiveButton.None; } else { return; } } } else if (action.wID == Action.ActionType.ACTION_MOVE_RIGHT) { if (_CurrentActiveButton != ActiveButton.Delete) { FocusNextButton(); return; } else { if (NavigateRight != _windowId) { _CurrentActiveButton = ActiveButton.None; } else { return; } } } base.OnAction(action); }
public override void Render(float timePassed) { bool isFocused = this.Focus; if (!isFocused) { _CurrentActiveButton = ActiveButton.Main; } if (IsEditImageHot) { Focus = false; } int xPos = 0; int yPos = 0; if (!_SuppressActiveButtonReset && Focus && _CurrentActiveButton == ActiveButton.Main) { _imageFocused.Render(timePassed); } else { _imageNonFocused.Render(timePassed); } xPos = _imageNonFocused.XPosition + UpBtnXOffset; yPos = _imageNonFocused.YPosition + UpBtnYOffset; ImgUpButtonFocused.SetPosition(xPos, yPos); ImgUpButtonNormal.SetPosition(xPos, yPos); if (ImgUpButtonDisabled != null) { ImgUpButtonDisabled.SetPosition(xPos, yPos); } if (isFocused && _CurrentActiveButton == ActiveButton.Up && _UpButtonEnabled) { ImgUpButtonFocused.Render(timePassed); } else { if (!_UpButtonEnabled && ImgUpButtonDisabled != null) { ImgUpButtonDisabled.Render(timePassed); } else { ImgUpButtonNormal.Render(timePassed); } } xPos = _imageNonFocused.XPosition + DownBtnXOffset; yPos = _imageNonFocused.YPosition + DownBtnYOffset; ImgDownButtonFocused.SetPosition(xPos, yPos); ImgDownButtonNormal.SetPosition(xPos, yPos); if (ImgDownButtonDisabled != null) { ImgDownButtonDisabled.SetPosition(xPos, yPos); } if (isFocused && _CurrentActiveButton == ActiveButton.Down && _DownButtonEnabled) { ImgDownButtonFocused.Render(timePassed); } else { if (!_DownButtonEnabled && ImgDownButtonDisabled != null) { ImgDownButtonDisabled.Render(timePassed); } else { ImgDownButtonNormal.Render(timePassed); } } xPos = _imageNonFocused.XPosition + DeleteBtnXOffset; yPos = _imageNonFocused.YPosition + DeleteBtnYOffset; ImgDeleteButtonFocused.SetPosition(xPos, yPos); ImgDeleteButtonNormal.SetPosition(xPos, yPos); if (ImgDeleteButtonDisabled != null) { ImgDeleteButtonDisabled.SetPosition(xPos, yPos); } if (isFocused && _CurrentActiveButton == ActiveButton.Delete && _DeleteButtonEnabled) { ImgDeleteButtonFocused.Render(timePassed); } else { if (!_DeleteButtonEnabled && ImgDeleteButtonDisabled != null) { ImgDeleteButtonDisabled.Render(timePassed); } else { ImgDeleteButtonNormal.Render(timePassed); } } base.Render(timePassed); }