分数读取后赋值

This commit is contained in:
liuyu 2024-09-04 10:38:36 +08:00
parent ce401f8b53
commit 096c742205
2 changed files with 22 additions and 0 deletions

View File

@ -70,4 +70,12 @@ public abstract class ScoreBase : MonoBehaviour
Debug.LogError(JsonConvert.SerializeObject(steps));
return steps;
}
/// <summary>
/// 设置科目得分,用于断线重连恢复
/// </summary>
public void setCurrentScore(float _score)
{
this.currentScore = _score;
}
}

View File

@ -6,6 +6,7 @@ using Newtonsoft.Json.Linq;
using System.IO;
using LitJson;
using System;
using Unity.Burst.CompilerServices;
/// <summary>
/// 断线重连管理
@ -205,6 +206,19 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
}
}
}
//»Ö¸´¼Ç¼µÄ·ÖÊý
ScoreBase scoreBase = FindFirstObjectByType<ScoreBase>();
Dictionary<int, ScoreSubjectStep> reconnectScore = scoreBase.GetStepScore();
foreach (var item in UserExamStat.allSubScore)
{
if (reconnectScore.ContainsKey(item.index))
{
reconnectScore[item.index].currentScore = item.currentScore;
reconnectScore[item.index].isDone = item.isDone;
}
}
scoreBase.setCurrentScore(UserExamStat.currentScore);
});
}