Partially updating WinScreen

This commit is contained in:
Julia Butenhoff 2021-12-08 14:23:30 -06:00
parent 5bccece90b
commit 989a47dca9
3 changed files with 35 additions and 3 deletions

View File

@ -657,6 +657,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
ReturnToLobbyText: {fileID: 1246267347}
ReturnToLobbyTimer: 10
HeaderText: {fileID: 482208058}
--- !u!114 &2036818938
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -10,11 +10,42 @@ public class PostGameUI : NetworkBehaviour {
[SerializeField] private TMP_Text ReturnToLobbyText;
[SerializeField] private int ReturnToLobbyTimer;
[SerializeField] private TMP_Text HeaderText;
void Start() {
ReturnToLobbyText.text = "Returning to the lobby in " + ReturnToLobbyTimer + " seconds...";
StartCoroutine(BeginCountdown());
//todo: do logic to determine and update who won the round
List<string> playerFinishedNames = new List<string>();
string kingName = "";
int winnerCount = 0;
foreach (PlayerData pData in ServerGameNetPortal.Instance.clientData.Values) {
if (pData.IsKing) {
kingName = pData.PlayerName;
} else {
if (pData.Finished) {
playerFinishedNames.Add(pData.PlayerName);
winnerCount++;
}
}
}
if (winnerCount > 0) {
// Runners win
switch(winnerCount) {
case 1:
HeaderText.text = "And the winner is the Runner " + playerFinishedNames[0] + "!";
break;
case 2:
HeaderText.text = "And the winners are the Runners " + playerFinishedNames[0] + " and " + playerFinishedNames[1] + "!";
break;
}
} else {
// King wins
HeaderText.text = "And the winner is King " + kingName + "!";
}
}
IEnumerator BeginCountdown() {

View File

@ -24,16 +24,16 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c6f1f05033f2b212d111c633c133af6f9
flags: 0
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c6f1f05033f2b212d68252320092a
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
value: 22424703114646680e0b0227036c6f1f05033f2b212d68252320092a
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
value: 22424703114646680e0b0227036c6f1f05033f2b212d68252320092a
flags: 0
UnityRemoteCompression:
value: 337f73