public override void Update(GameTime gameTime) { foreach (IUIElement ActiveUIElement in ArrayUIElement) { ActiveUIElement.Update(gameTime); } int MenuWidth = (int)(Constants.Width * 0.45); int MenuHeight = (int)(Constants.Height * 0.45); float MenuX = Constants.Width / 2 - MenuWidth / 2; float MenuY = Constants.Height / 2 - MenuHeight / 2; float DrawY = MenuY + 45; for (int CurrentIndex = MapScrollbarValue; CurrentIndex < ListPlayerProfile.Count; CurrentIndex++) { if (InputHelper.InputConfirmPressed() && MouseHelper.MouseStateCurrent.X >= MenuX && MouseHelper.MouseStateCurrent.X < MenuX + MenuWidth && MouseHelper.MouseStateCurrent.Y >= DrawY && MouseHelper.MouseStateCurrent.Y < DrawY + 25) { SelectedProfileIndex = CurrentIndex; } DrawY += 25; } }
public override void Update(GameTime gameTime) { foreach (IUIElement ActiveUIElement in ArrayUIElement) { ActiveUIElement.Update(gameTime); } }
public override void Draw(CustomSpriteBatch g) { int MenuWidth = (int)(Constants.Width * 0.45); int MenuHeight = (int)(Constants.Height * 0.45); float MenuX = Constants.Width / 2 - MenuWidth / 2; float MenuY = Constants.Height / 2 - MenuHeight / 2; DrawBox(g, new Vector2(MenuX, MenuY), MenuWidth, MenuHeight, Color.White); DrawBox(g, new Vector2(MenuX, MenuY), MenuWidth, 40, Color.White); g.DrawString(fntArial12, "Local Players Mangement", new Vector2(MenuX + 10, MenuY + 10), Color.White); g.DrawString(fntArial12, "Name", new Vector2(MenuX + 10, MenuY + 42), Color.White); g.DrawString(fntArial12, "Controls", new Vector2(MenuX + 150, MenuY + 42), Color.White); g.DrawString(fntArial12, "Profile", new Vector2(MenuX + MenuWidth - 60, MenuY + 42), Color.White); for (int P = 0; P < PlayerManager.ListLocalPlayer.Count; P++) { float ActivePlayerY = MenuY + 75 + P * 40; g.DrawString(fntArial12, PlayerManager.ListLocalPlayer[P].Name, new Vector2(MenuX + 10, ActivePlayerY + 5), Color.White); } DrawBox(g, new Vector2(MenuX, MenuY + MenuHeight), MenuWidth, 40, Color.White); foreach (IUIElement ActiveUIElement in ArrayUIElement) { ActiveUIElement.Draw(g); } }
private void UpdateUIElements() { if (PlayerManager.ListLocalPlayer.Count == 1) { ArrayUIElement = new IUIElement[] { CloseButton, ArrayPlayerControlDropDown[0], ArrayPlayerLoadProfileButton[0], ArrayAddPlayerButton[0], }; } else if (PlayerManager.ListLocalPlayer.Count == 2) { ArrayUIElement = new IUIElement[] { CloseButton, ArrayPlayerControlDropDown[0], ArrayPlayerControlDropDown[1], ArrayPlayerLoadProfileButton[0], ArrayPlayerLoadProfileButton[1], ArrayAddPlayerButton[1], ArrayRemovePlayerButton[0], }; } else if (PlayerManager.ListLocalPlayer.Count == 3) { ArrayUIElement = new IUIElement[] { CloseButton, ArrayPlayerControlDropDown[0], ArrayPlayerControlDropDown[1], ArrayPlayerControlDropDown[2], ArrayPlayerLoadProfileButton[0], ArrayPlayerLoadProfileButton[1], ArrayPlayerLoadProfileButton[2], ArrayAddPlayerButton[2], ArrayRemovePlayerButton[1], }; } else if (PlayerManager.ListLocalPlayer.Count == 4) { ArrayUIElement = new IUIElement[] { CloseButton, ArrayPlayerControlDropDown[0], ArrayPlayerControlDropDown[1], ArrayPlayerControlDropDown[2], ArrayPlayerControlDropDown[3], ArrayPlayerLoadProfileButton[0], ArrayPlayerLoadProfileButton[1], ArrayPlayerLoadProfileButton[2], ArrayPlayerLoadProfileButton[3], ArrayRemovePlayerButton[2], }; } foreach (IUIElement ActiveUIElement in ArrayUIElement) { ActiveUIElement.Unselect(); } }
public override void Draw(CustomSpriteBatch g) { int MenuWidth = (int)(Constants.Width * 0.45); int MenuHeight = (int)(Constants.Height * 0.45); float MenuX = Constants.Width / 2 - MenuWidth / 2; float MenuY = Constants.Height / 2 - MenuHeight / 2; DrawBox(g, new Vector2(MenuX, MenuY), MenuWidth, MenuHeight, Color.White); DrawBox(g, new Vector2(MenuX, MenuY), MenuWidth, 40, Color.White); g.DrawString(fntArial12, "Select Profile", new Vector2(MenuX + 10, MenuY + 10), Color.White); float DrawY = MenuY + 45; for (int CurrentIndex = MapScrollbarValue; CurrentIndex < ListPlayerProfile.Count; CurrentIndex++) { string ActiveMap = ListPlayerProfile[CurrentIndex]; g.DrawString(fntArial12, ActiveMap, new Vector2(MenuX + 10, DrawY), Color.White); if (CurrentIndex == SelectedProfileIndex) { g.Draw(sprPixel, new Rectangle((int)MenuX + 5, (int)DrawY, MenuWidth - 25, 20), Color.FromNonPremultiplied(255, 255, 255, 127)); } if (MouseHelper.MouseStateCurrent.X >= MenuX && MouseHelper.MouseStateCurrent.X < MenuX + MenuWidth && MouseHelper.MouseStateCurrent.Y >= DrawY && MouseHelper.MouseStateCurrent.Y < DrawY + 25) { g.Draw(sprPixel, new Rectangle((int)MenuX + 5, (int)DrawY, MenuWidth - 25, 20), Color.FromNonPremultiplied(255, 255, 255, 127)); } DrawY += 25; if (DrawY >= MenuY + MenuHeight) { break; } } DrawBox(g, new Vector2(MenuX, MenuY + MenuHeight), MenuWidth, 40, Color.White); foreach (IUIElement ActiveUIElement in ArrayUIElement) { ActiveUIElement.Draw(g); } }