update: basicspawner( => random)

This commit is contained in:
manhduyhoang90
2026-04-23 08:56:35 +07:00
parent d2e3dbf653
commit fb50541036
6 changed files with 66 additions and 24 deletions

View File

@@ -14,10 +14,7 @@
[Header("Character Selection")] public TMP_InputField playerNameInput;
public Image[] characterPreviewImages;
public int selectedCharacterIndex = 0;
[Header("Room List")] public GameObject roomListParent;
public GameObject roomListItemPrefab;
@@ -28,23 +25,13 @@
{
lobbyPanel.SetActive(false);
characterSelectionPanel.SetActive(true);
OnSelectCharacter(selectedCharacterIndex);
spawner = FindFirstObjectByType<_BasicSpawner>();
await spawner.StartLobby();
}
public void OnSelectCharacter(int index)
{
selectedCharacterIndex = index;
// update preview images
for (var i = 0; i < characterPreviewImages.Length; i++)
{
characterPreviewImages[i].color = (i == index)
? Color.green
: Color.white;
}
}
public void OnNextButton()
{
@@ -59,11 +46,11 @@
var _profile = new _PlayerProfile()
{
Name = playerName,
Class = (_CharacterClass)selectedCharacterIndex
};
spawner.SetLocalPlayerProfile(_profile);
// đưa lên host để tạo player object, ở đây tạm thời chỉ log ra console
Debug.Log($"Player Name: {_profile.Name}, Class: {_profile.Class}");
Debug.Log($"Player Name: {_profile.Name}, Class: {_profile.Role}");
// chuyển sang lobby panel
characterSelectionPanel.SetActive(false);
lobbyPanel.SetActive(true);