rematch complete

This commit is contained in:
2026-05-04 23:57:56 +05:30
parent 82287d74fb
commit 184d4fbc04
8 changed files with 1489 additions and 1166 deletions
+30 -3
View File
@@ -33,7 +33,7 @@ public class GameOverCanvas : MonoBehaviour
[Header("Game Over Data")]
public Button btnRematch;
public Button btnLeave;
public GameObject rematchWarningLoser;
public TMP_Text rematchWarningLoser;
public TMP_Text txtRewardRC;
public TMP_Text txtRewardCC;
public TMP_Text countdownTxt;
@@ -79,6 +79,21 @@ public class GameOverCanvas : MonoBehaviour
btnLeave.onClick.AddListener(OnBtnLeaveGameClicked);
betSlider.onValueChanged.AddListener(OnBetSliderValueChanged);
btnConfirmBet.onClick.AddListener(OnBetAccepted);
btnCancelBet.onClick.AddListener(OnBetCancelled);
}
void OnBetAccepted(){
NetPlayer.localPlayer.AcceptRematch((int)betSlider.value);
rematchPanel.interactable=false;
}
void OnBetCancelled(){
NetPlayer.localPlayer.AcceptRematch(0);
rematchPanel.interactable=false;
rematchPanel.blocksRaycasts=false;
rematchPanel.DOFade(0,0.3f).SetEase(Ease.InOutBack);
}
void OnBetSliderValueChanged(float value){
@@ -95,6 +110,8 @@ public class GameOverCanvas : MonoBehaviour
if(winningTeam == myTeam){
//Only i can initiate the rematch, so here we go
ShowRematchPanel();
}else{
rematchWarningLoser.text = "Waiting for opponent to accept";
}
}
@@ -232,7 +249,11 @@ public class GameOverCanvas : MonoBehaviour
}
btnRematch.interactable = winningTeam != myTeam;
rematchWarningLoser.SetActive(winningTeam == myTeam);
if(winningTeam == myTeam){
rematchWarningLoser.text = "Only the loser can request a rematch";
}else{
rematchWarningLoser.text = "";
}
StartCoroutine(CoroutineShow());
@@ -330,8 +351,14 @@ public class GameOverCanvas : MonoBehaviour
public void OnRematchCancelled(){
SetRematchPendingState(false);
btnRematch.interactable=false;
btnLeave.interactable=true;
rematchWarningLoser.text = "Rematch declined.";
StartCoroutine(CoroutineHideRematchPanel());
countdownCoroutine = StartCoroutine(CoroutineCountdown());
}
IEnumerator CoroutineHideRematchPanel(){