public ClientField(Client client, int nr) { // need to check if in multiplayer you can change the type of a different player SpriteFont textFieldFont = GameEnvironment.AssetManager.GetFont("Arial26"); SelectField <SelectPlayer> SelectPlayer = new SelectField <SelectPlayer>(true, textFieldFont, Color.Red); SelectPlayer.Options = new List <SelectPlayer>() { new SelectPlayer(PlayerType.Warrior, client), new SelectPlayer(PlayerType.Archer, client), new SelectPlayer(PlayerType.Mage, client), new SelectPlayer(PlayerType.Random, client) }; Add(SelectPlayer); Button setTypeButton = new Button("button", "Select Hero", textFieldFont, Color.Black); setTypeButton.Position = SelectPlayer.Position + new Vector2(SelectPlayer.Width, 0); setTypeButton.Action = () => { ClientPlayerType CPT = new ClientPlayerType(client.ClientName, client.playerType); Server.Send(CPT); }; Add(setTypeButton); TextGameObject name = new TrackingTextGameObject <Client>(client, c => nr + ". " + c.ClientName, "Arial26"); name.Color = Color.White; name.Position = setTypeButton.Position + new Vector2(setTypeButton.Width, 0); Add(name); }
public OptionsMenu() { Point screen = GameEnvironment.Screen; SpriteFont textFieldFont = GameEnvironment.AssetManager.GetFont("Arial26"); SelectField <Resolution> resolutionSelect = new SelectField <Resolution>(true, textFieldFont, Color.Red); resolutionSelect.Options = new List <Resolution>() { new Resolution(1024, 586), new Resolution(1440, 825) }; resolutionSelect.Position = new Vector2((screen.X - resolutionSelect.Width) / 2, 100); Add(resolutionSelect); //Create a button to go back to the main menu. back = new Button("button", "Back", textFieldFont, Color.Black); back.Action = () => { GameEnvironment.GameStateManager.SwitchTo("mainMenuState"); }; back.Position = new Vector2(100, screen.Y - 100); Add(back); }