feat: Add quiz scene with scoreboard, team machine, door, and player management systems.
This commit is contained in:
@@ -12,37 +12,28 @@ public class ScoreboardRowSpawner : Scoreboard
|
||||
|
||||
public override void UpdateScoreboard()
|
||||
{
|
||||
// Clear existing rows
|
||||
foreach (Transform child in rowContainer)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
|
||||
// Spawn new rows based on player data
|
||||
VRCPlayerApi[] players = playerManager.GetCurrentPlayers();
|
||||
foreach (VRCPlayerApi player in players)
|
||||
{
|
||||
GameObject newRow = Instantiate(rowPrefab, rowContainer);
|
||||
|
||||
Debug.Log("Spawning scoreboard row for player: " + player.displayName);
|
||||
|
||||
// Get all TMP_Text components from the children
|
||||
TMPro.TMP_Text[] textComponents = newRow.GetComponentsInChildren<TMPro.TMP_Text>();
|
||||
|
||||
// Set the first TMP_Text to the player's display name
|
||||
if (textComponents.Length > 0)
|
||||
{
|
||||
textComponents[0].text = player.displayName;
|
||||
}
|
||||
|
||||
// Set the second TMP_Text to the player's score
|
||||
if (textComponents.Length > 1)
|
||||
{
|
||||
textComponents[1].text = playerManager.GetScore(player.playerId).ToString();
|
||||
}
|
||||
|
||||
// 3. Set the Background Color
|
||||
// We get the Image component from the root of the prefab
|
||||
Image backgroundComponent = newRow.GetComponent<Image>();
|
||||
if (backgroundComponent != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user