rematch complete
This commit is contained in:
@@ -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(){
|
||||
|
||||
Reference in New Issue
Block a user