using Godot; using Godot.Collections; public partial class GameLobby : Control { GlobalManager global = GlobalManager.Instance; readonly Logging.Logger logger = Logging.GetLogger("GameLobby"); Timer timer = null!; ItemList lists = null!; ConfirmationDialog dialog = null!; string URL = null!; string userName = null!; // Called when the node enters the scene tree for the first time. public override void _Ready() { lists = GetNode("%ItemList_Users"); // TODO using % dialog = GetNode("Dialogs/ConfirmationDialog"); URL = global.ConfigManager.GetValue("server_addr"); userName = global.ConfigManager.GetValue("user_name"); dialog.MinSize = new Vector2I(400, 200); dialog.DialogAutowrap = true; dialog.Canceled += () => { // TODO Cancel to Accept Session Create }; dialog.Confirmed += () => { if (dialog.Title == "Session Created") { // TODO Create Session } }; // TODO using new State Shower And Using Heartbeat to calucate the delay time ColorRect colorRect = GetNode("MarginContainer/VBoxContainer/MarginContainer2/MarginContainer2/ColorRect"); Connect(); } public void Connect() { logger.Info("Connect To Server"); // TODO connet to server global.SetProcess(true); } private void OnItemSelected(int index) { Dictionary item = lists.GetItemMetadata(index).AsGodotDictionary(); logger.Debug($"Item {index} selected, {item}"); string[] _ = [item["id"].ToString()]; // TODO new a Session } private void FlushUserData() { // TODO Flush user data or heartbeat flush } private void OnBack() { // TODO ExitServer(); global.GotoScene("res://Main.tscn"); } }