summaryrefslogtreecommitdiff
path: root/Assets/Scripts/UI/UIBinding.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/UI/UIBinding.cs')
-rw-r--r--Assets/Scripts/UI/UIBinding.cs40
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);
+ }
}
}
}