This commit is contained in:
2026-04-29 01:04:28 +07:00
parent 29888fadfa
commit 21c999a904
32 changed files with 1423 additions and 894 deletions

View File

@@ -47,7 +47,7 @@ namespace Hallucinate.UI
// Event Bindings
root.Q<Button>("GoToCreateBtn").clicked += ShowCreate;
root.Q<Button>("CancelCreateBtn").clicked += ShowJoin;
root.Q<Button>("BackToMenuBtn").clicked += () => uiManager.Pop();
root.Q<Button>("BackToMenuBtn").clicked += async () => await uiManager.Pop();
root.Q<Button>("ConfirmCreateBtn").clicked += OnCreateRoomClicked;
root.Q<Button>("ConfirmJoinBtn").clicked += OnConfirmPasswordClicked;
root.Q<Button>("ClosePassBtn").clicked += () => _passOverlay.style.display = DisplayStyle.None;
@@ -88,7 +88,6 @@ namespace Hallucinate.UI
if (string.IsNullOrEmpty(id)) return;
await _spawner.StartHost(id, pass);
// Logic chuyển sang Lounge sẽ được xử lý qua sự kiện OnPlayerJoined trong Spawner
}
private void UpdateRoomList(List<SessionInfo> sessions)
@@ -100,7 +99,7 @@ namespace Hallucinate.UI
item.Q<Label>("RoomName").text = session.Name;
item.Q<Label>("PlayerCount").text = $"{session.PlayerCount}/{session.MaxPlayers}";
bool needsPass = session.Properties.ContainsKey("pw"); // Giả sử dùng metadata
bool needsPass = session.Properties.ContainsKey("pw");
item.Q<Label>("LockIcon").style.display = needsPass ? DisplayStyle.Flex : DisplayStyle.None;
var joinBtn = item.Q<Button>("JoinBtn");
@@ -113,7 +112,6 @@ namespace Hallucinate.UI
private void OnRoomItemClicked(SessionInfo session)
{
_selectedSession = session;
// Fusion dùng Password trong StartGameArgs, nên ta hiện popup nhập trước
_passOverlay.style.display = DisplayStyle.Flex;
_joinPassError.style.display = DisplayStyle.None;
_joinPassInput.value = "";