using Godot; using System; public partial class start_game_menu : Control { enum _state { START, LAN, HOST, JOIN, QUIT }; enum _gameType { SINGLE, LOCAL, LAN }; private _state _currState = _state.START; private const string _path = "/root/StartGameMenu/"; private Button _localMulti, _single, _LANMulti, _join, _host, _cancel, _quit, _yes, _no; private LineEdit _ip; private Label _error, _lip; private string Error { set { _error.Set("text", value); } } private string IP_address { set { _ip.Set("text", value); } get => (string)_ip.Get("text"); } private _state State { get => _currState; set { if (value == _currState) return; IP_address = ""; switch (value) { case _state.START: Error = ""; _single.Set("visible", true); //_localMulti.Set("visible", true); //_LANMulti.Set("visible", true); _cancel.Set("visible", false); _yes.Set("visible", false); _no.Set("visible", false); _join.Set("visible", false); _host.Set("visible", false); _quit.Set("visible", true); _ip.Set("visible", false); _lip.Set("visible", false); break; case _state.LAN: Error = ""; _single.Set("visible", false); //_localMulti.Set("visible", false); //_LANMulti.Set("visible", false); _cancel.Set("visible", true); _yes.Set("visible", false); _no.Set("visible", false); _join.Set("visible", true); _host.Set("visible", true); _quit.Set("visible", true); _ip.Set("visible", true); _lip.Set("visible", true); break; case _state.QUIT: Error = "Are you sure you want to quit?"; _single.Set("visible", false); //_localMulti.Set("visible", false); //_LANMulti.Set("visible", false); _cancel.Set("visible", false); _yes.Set("visible", true); _no.Set("visible", true); _join.Set("visible", false); _host.Set("visible", false); _quit.Set("visible", false); _ip.Set("visible", false); _lip.Set("visible", false); break; case _state.HOST: Error = "Waiting for peer to join..."; _single.Set("visible", false); //_localMulti.Set("visible", false); //_LANMulti.Set("visible", false); _cancel.Set("visible", true); _yes.Set("visible", false); _no.Set("visible", false); _join.Set("visible", false); _host.Set("visible", false); _quit.Set("visible", false); _ip.Set("visible", false); _lip.Set("visible", false); break; case _state.JOIN: Error = "Waiting for server..."; _single.Set("visible", false); //_localMulti.Set("visible", false); //_LANMulti.Set("visible", false); _cancel.Set("visible", true); _yes.Set("visible", false); _no.Set("visible", false); _join.Set("visible", false); _host.Set("visible", false); _quit.Set("visible", false); _ip.Set("visible", false); _lip.Set("visible", false); break; default: return; } _currState = value; }} // Called when the node enters the scene tree for the first time. public override void _Ready() { _single = GetNode