✨ Block placing
This commit is contained in:
@ -2,15 +2,16 @@ using Godot;
|
||||
|
||||
namespace CodingLand.Scripts.UI;
|
||||
|
||||
public partial class MultiplayerUi : Control
|
||||
public partial class StartScreen : Control
|
||||
{
|
||||
[Export] public int DefaultServerPort = 4343;
|
||||
[Export] public string DefaultServerAddr = "127.0.0.1";
|
||||
|
||||
[Export] public Multiplayer MultiplayerController;
|
||||
[Export] public Launcher Launcher;
|
||||
|
||||
[Export] public LineEdit ServerPortInput;
|
||||
[Export] public LineEdit ServerAddrInput;
|
||||
[Export] public Button StartAsSingleButton;
|
||||
[Export] public Button StartAsServerButton;
|
||||
[Export] public Button StartAsClientButton;
|
||||
|
||||
@ -41,6 +42,11 @@ public partial class MultiplayerUi : Control
|
||||
ServerPortInput.Text = DefaultServerPort.ToString();
|
||||
ServerAddrInput.Text = DefaultServerAddr;
|
||||
|
||||
StartAsSingleButton.Pressed += () =>
|
||||
{
|
||||
Launcher.StartAsSingle();
|
||||
Hide();
|
||||
};
|
||||
StartAsServerButton.Pressed += () =>
|
||||
{
|
||||
if (!DoValidation())
|
||||
@ -50,7 +56,7 @@ public partial class MultiplayerUi : Control
|
||||
}
|
||||
|
||||
var port = ServerPortInput.Text;
|
||||
var result = MultiplayerController.StartAsServer(int.Parse(port));
|
||||
var result = Launcher.StartAsServer(int.Parse(port));
|
||||
|
||||
if (result)
|
||||
Hide();
|
||||
@ -65,7 +71,7 @@ public partial class MultiplayerUi : Control
|
||||
|
||||
var addr = ServerAddrInput.Text;
|
||||
var port = ServerPortInput.Text;
|
||||
var result = MultiplayerController.StartAsClient(addr, int.Parse(port));
|
||||
var result = Launcher.StartAsClient(addr, int.Parse(port));
|
||||
|
||||
if (result)
|
||||
Hide();
|
Reference in New Issue
Block a user