public override void Enter() { ipAddressTextbox = new Textbox("") { Position = new Vector2f(GameOptions.Width * PaddingHorizontal + 32.0f, GameOptions.Height * PaddingVertical + 128.0f), Size = new Vector2f(GameOptions.Width * (1.0f - PaddingHorizontal * 2.0f) - 64.0f, 48.0f), Selected = true }; Entities.Add(ipAddressTextbox); Button okButton = new Button(new Vector2f(GameOptions.Width / 2.0f, GameOptions.Height * PaddingVertical + GameOptions.Height * (1.0f - PaddingVertical * 2.0f) - 64.0f), "Alright"); okButton.OnClick += () => { Game.PopState(); JoinNext(ipAddressTextbox.Value); return true; }; Entities.Add(okButton); base.Enter(); }
private bool MenuJoin() { Entities.Clear(); // IP Address textbox Textbox ipTextbox = new Textbox("IP Address") { Position = new Vector2f(GameOptions.Width / 2.0f - GameOptions.Width / 3.0f, 250.0f + 128.0f + 16.0f), Selected = true }; Entities.Add(ipTextbox); // Display Name textbox Textbox nameTextbox = new Textbox("Display Name") { Position = new Vector2f(GameOptions.Width / 2.0f - GameOptions.Width / 3.0f, 250.0f + 128.0f + 84.0f + 16.0f), Value = persistentDisplayName }; nameTextbox.OnReturn += a => JoinNext(nameTextbox.Value, ipTextbox.Value); Entities.Add(nameTextbox); // Next button AddButton(new Vector2f(GameOptions.Width / 2.0f, 250.0f + 128.0f + 84.0f + 16.0f + 96.0f), "Next", () => { JoinNext(nameTextbox.Value, ipTextbox.Value); return true; } ); AddButton(new Vector2f(GameOptions.Width / 2.0f, 350.0f + 288.0f), "Back", () => { persistentDisplayName = nameTextbox.Value; return MenuPlay(); } ); return true; }
private bool MenuHost() { Entities.Clear(); Textbox nameTextbox = new Textbox("Display Name") { Position = new Vector2f(GameOptions.Width / 2.0f - GameOptions.Width / 3.0f, 250.0f + 128.0f + 16.0f), Selected = true, Value = persistentDisplayName }; nameTextbox.OnReturn += value => HostNext(nameTextbox.Value); Entities.Add(nameTextbox); AddButton(new Vector2f(GameOptions.Width / 2.0f, 350.0f + 128.0f + 12.0f), "Settings", () => { persistentDisplayName = nameTextbox.Value; Game.PushState(new HostSettingsOverlay()); return true; } ); AddButton(new Vector2f(GameOptions.Width / 2.0f, 350.0f + 128.0f + 12.0f + 64.0f), "Next", () => { HostNext(nameTextbox.Value); return true; } ); AddButton(new Vector2f(GameOptions.Width / 2.0f, 350.0f + 288.0f), "Back", () => { persistentDisplayName = nameTextbox.Value; return MenuPlay(); } ); return true; }