Update
This commit is contained in:
@@ -89,14 +89,14 @@ namespace Hallucinate.UI
|
||||
});
|
||||
}
|
||||
|
||||
// Đăng ký sự kiện từ Spawner (Sử dụng Instance)
|
||||
// Đăng ký sự kiện từ Spawner
|
||||
if (BasicSpawner.Instance != null)
|
||||
{
|
||||
RegisterSpawnerEvents();
|
||||
_ = BasicSpawner.Instance.StartLobby();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nếu chưa có, thử tìm sau một chút
|
||||
Invoke(nameof(RegisterSpawnerEvents), 0.1f);
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@ namespace Hallucinate.UI
|
||||
BasicSpawner.Instance.OnSessionListUpdatedEvent += UpdateRoomList;
|
||||
BasicSpawner.Instance.OnJoinFailedEvent += () => { if(_joinPassError != null) _joinPassError.style.display = DisplayStyle.Flex; };
|
||||
BasicSpawner.Instance.OnJoinStartedEvent += () => { /* Show loading if needed */ };
|
||||
_ = BasicSpawner.Instance.StartLobby();
|
||||
}
|
||||
|
||||
public void SetRoomTemplate(VisualTreeAsset template) => _roomItemTemplate = template;
|
||||
@@ -122,7 +123,7 @@ namespace Hallucinate.UI
|
||||
if (_joinContainer != null) _joinContainer.style.display = DisplayStyle.Flex;
|
||||
if (_createContainer != null) _createContainer.style.display = DisplayStyle.None;
|
||||
if (_loungeContainer != null) _loungeContainer.style.display = DisplayStyle.None;
|
||||
BasicSpawner.Instance?.StartLobby();
|
||||
_ = BasicSpawner.Instance?.StartLobby();
|
||||
}
|
||||
|
||||
public void ShowCreate()
|
||||
@@ -144,11 +145,7 @@ namespace Hallucinate.UI
|
||||
private async void OnCreateRoomClicked()
|
||||
{
|
||||
var spawner = BasicSpawner.Instance;
|
||||
if (spawner == null)
|
||||
{
|
||||
Debug.LogError("[LobbyController] BasicSpawner.Instance is missing!");
|
||||
return;
|
||||
}
|
||||
if (spawner == null) return;
|
||||
|
||||
string id = _roomIDInput != null && !string.IsNullOrEmpty(_roomIDInput.value)
|
||||
? _roomIDInput.value.Trim()
|
||||
@@ -165,14 +162,7 @@ namespace Hallucinate.UI
|
||||
: null;
|
||||
|
||||
bool success = await spawner.StartHost(id, pass);
|
||||
if (success)
|
||||
{
|
||||
ShowLounge(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[LobbyController] Failed to create room. Please check AppID/Region.");
|
||||
}
|
||||
if (success) ShowLounge(name);
|
||||
}
|
||||
|
||||
private void UpdateRoomList(List<SessionInfo> sessions)
|
||||
|
||||
Reference in New Issue
Block a user