diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-02-01 11:19:03 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-02-01 11:19:03 +0800 |
| commit | 8475753cafd825a937e45336e4d8bafd5c6e4643 (patch) | |
| tree | 18b190f2845a72e415a3c05401372aee11a2dc15 /Assets/Scripts/UI/UIBinding.cs | |
| parent | 33b65a2911b5362453bdd4567e14ae619c4fdd59 (diff) | |
aaa
Diffstat (limited to 'Assets/Scripts/UI/UIBinding.cs')
| -rw-r--r-- | Assets/Scripts/UI/UIBinding.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Assets/Scripts/UI/UIBinding.cs b/Assets/Scripts/UI/UIBinding.cs index 9830b03..2856393 100644 --- a/Assets/Scripts/UI/UIBinding.cs +++ b/Assets/Scripts/UI/UIBinding.cs @@ -18,6 +18,10 @@ namespace UI public Image player1ScoreDisplay; public Image player2ScoreDisplay; + public GameObject noPlayerJoinedLayer; + public GameObject player1JoinedLayer; + public GameObject allPlayerJoinedLayer; + private void FixedUpdate() { // 更新时间文本 @@ -39,6 +43,42 @@ namespace UI // 更新问题显示 questionText.text = progress.questionPlayer.currentQuestion.QuestionText; + + // 更新玩家加入显示 + if (progress.sceneStatus.current == Status.Waiting) + { + var player1Joined = progress.player1.bindPlayer != null; + var player2Joined = progress.player2.bindPlayer != null; + + if (!player1Joined && !player2Joined) + { + noPlayerJoinedLayer.SetActive(true); + player1JoinedLayer.SetActive(false); + allPlayerJoinedLayer.SetActive(false); + return; + } + + if (player1Joined && !player2Joined) + { + noPlayerJoinedLayer.SetActive(false); + player1JoinedLayer.SetActive(true); + allPlayerJoinedLayer.SetActive(false); + return; + } + + if (player1Joined && player2Joined) + { + noPlayerJoinedLayer.SetActive(false); + player1JoinedLayer.SetActive(false); + allPlayerJoinedLayer.SetActive(true); + } + } + else + { + noPlayerJoinedLayer.SetActive(false); + player1JoinedLayer.SetActive(false); + allPlayerJoinedLayer.SetActive(false); + } } } } |
