This commit is contained in:
2026-08-20 19:45:38 +05:30
parent 74d9fae6e6
commit 78592e8d8e
87 changed files with 13154 additions and 223 deletions
+58 -2
View File
@@ -22,6 +22,7 @@ public class GameCanvas : MonoBehaviour
ShowWaitingForOpponentPanel();
HideEmotesPanel();
HideAllPostGamePanels();
}
void OnDestroy()
@@ -60,7 +61,9 @@ public class GameCanvas : MonoBehaviour
bool isShowingEmotes=> emotesPanel.gameObject.activeSelf;
public RectTransform kickWarning;
public GameObject[] postGamePanels;
public TMP_Text txtMatchNumber;
const float PostGamePanelDuration = 3f;
void Start(){
@@ -93,6 +96,9 @@ public class GameCanvas : MonoBehaviour
if (txtRcPrize != null)
txtRcPrize.text = CoinHelper.FormatString(GameManager.MatchRcPrizeCoins) + " RC";
if (txtMatchNumber != null && GameManager.DedicatedMatchId > 0)
txtMatchNumber.text = "M" + GameManager.DedicatedMatchId;
}
void OnEmoteTextPressed(string txtName){
@@ -166,13 +172,36 @@ public class GameCanvas : MonoBehaviour
}
void OnLeaveGamePressed()
{
if (MessageBoxDialog.IsAvailable)
{
MessageBoxDialog.Show(
"Forfeit match?",
"Leaving will result in a loss, making opponent the winner. Are you sure?",
confirmed =>
{
if (confirmed)
ConfirmLeaveMatch();
});
return;
}
ConfirmLeaveMatch();
}
void ConfirmLeaveMatch()
{
if (CupidLobby.instance != null)
CupidLobby.instance.Cancel();
LoginManager.ClearMatchYourTeam();
NetManager.StopNetworkingForSceneChange();
if (GameManager.instance != null)
{
GameManager.instance.Leave();
return;
}
NetManager.StopNetworkingForSceneChange();
LevelLoadManager.LoadLevel("MainMenu");
}
@@ -314,4 +343,31 @@ public class GameCanvas : MonoBehaviour
});
}
public IEnumerator ShowRandomPostGamePanelThenHide()
{
HideAllPostGamePanels();
if (postGamePanels == null || postGamePanels.Length == 0)
yield break;
GameObject chosen = postGamePanels[Random.Range(0, postGamePanels.Length)];
if (chosen == null)
yield break;
chosen.SetActive(true);
yield return new WaitForSeconds(PostGamePanelDuration);
chosen.SetActive(false);
}
void HideAllPostGamePanels()
{
if (postGamePanels == null)
return;
for (int i = 0; i < postGamePanels.Length; i++)
{
if (postGamePanels[i] != null)
postGamePanels[i].SetActive(false);
}
}
}