game end screen l10 fix

This commit is contained in:
2026-04-05 21:43:25 +05:30
parent 4cabf27f29
commit cace0cc664
9 changed files with 1081 additions and 4390 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -5
View File
@@ -8730,16 +8730,13 @@ MonoBehaviour:
redGoalEffects:
- {fileID: 1207099707}
- {fileID: 1826642063}
- {fileID: 348182973}
- {fileID: 6517165855333884865}
blueGoalEffects:
- {fileID: 2754783705440688386}
- {fileID: 1510554619}
- {fileID: 6517165855333884865}
- {fileID: 348182973}
redScoreText: {fileID: 689409415}
blueScoreText: {fileID: 215557299}
gameOverPanel: {fileID: 976909848}
blueWon: {fileID: 2114154720}
redWon: {fileID: 867463508}
blueTimerGroup: {fileID: 2028496749}
redTimerGroup: {fileID: 1693353735}
minFlashSpeed: 5
+1 -3695
View File
File diff suppressed because it is too large Load Diff
+55
View File
@@ -603,7 +603,62 @@ public class GameManager : NetworkBehaviour
IEnumerator CoroutineGameOver(Team team){
yield return new WaitForSeconds(2f);
yield return CoroutineFetchBothPlayersL10();
LevelLoadManager.instance.SetupGameOver(team,redScore,blueScore);
LevelLoadManager.LoadLevel("MainMenu");
}
IEnumerator CoroutineFetchBothPlayersL10()
{
var my = LevelLoadManager.myPlayer;
var opp = LevelLoadManager.opponentPlayer;
if (my == null || opp == null)
yield break;
string baseUrl = (DedicatedInternalApiBase ?? "").TrimEnd('/');
if (string.IsNullOrEmpty(baseUrl))
yield break;
if (my.UserId > 0){
yield return CoFetchPlayerL10Apply(baseUrl, my);
}
if (opp.UserId > 0 && opp.UserId != my.UserId){
yield return CoFetchPlayerL10Apply(baseUrl, opp);
}
LevelLoadManager.myPlayer = my;
LevelLoadManager.opponentPlayer = opp;
}
static IEnumerator CoFetchPlayerL10Apply(string baseUrl, MatchmadePlayer player)
{
string url = baseUrl + "/players/" + player.UserId + "/l10";
using (var req = UnityWebRequest.Get(url))
{
yield return req.SendWebRequest();
if (req.result != UnityWebRequest.Result.Success)
{
Logger.Log("Player L10 fetch failed: " + req.error + " " + url);
yield break;
}
var resp = JsonUtility.FromJson<PlayerL10Response>(req.downloadHandler.text);
if (resp != null && resp.ok)
{
player.l10_wins = resp.l10_wins;
player.l10_losses = resp.l10_losses;
}
}
}
[Serializable]
class PlayerL10Response
{
public bool ok;
public int player_id;
public int l10_wins;
public int l10_losses;
}
bool freezeInput = false;
@@ -115,8 +115,8 @@ public class LevelLoadManager : MonoBehaviour
p2_l10.text = opponentL10;
}
MatchmadePlayer myPlayer;
MatchmadePlayer opponentPlayer;
public static MatchmadePlayer myPlayer;
public static MatchmadePlayer opponentPlayer;
public void SetupMatchMade(Team myTeam_, MatchmadePlayer myPlayer_, MatchmadePlayer opponentPlayer_){
myTeam = myTeam_;
@@ -140,21 +140,9 @@ public class LevelLoadManager : MonoBehaviour
if(myTeam == winningTeam){
p1_winner.SetActive(true);
p2_winner.SetActive(false);
myPlayer.l10_wins++;
myPlayer.l10_losses--;
opponentPlayer.l10_losses++;
opponentPlayer.l10_wins--;
}else{
p1_winner.SetActive(false);
p2_winner.SetActive(true);
opponentPlayer.l10_wins++;
opponentPlayer.l10_losses--;
myPlayer.l10_losses++;
myPlayer.l10_wins--;
}
p1_l10.text = $"L10 {myPlayer.l10_wins}-{myPlayer.l10_losses}";