读取缓存
This commit is contained in:
parent
8fdc47d314
commit
1597d53826
|
@ -82,5 +82,9 @@ public abstract class ScoreBase : MonoBehaviour
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 记录现场环境中scoreBase的各项List缓存
|
/// 记录现场环境中scoreBase的各项List缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void SaveSceneBufferList();
|
public abstract string SaveSceneBufferList();
|
||||||
|
/// <summary>
|
||||||
|
/// 还原现场环境中scoreBase的各项List缓存
|
||||||
|
/// </summary>
|
||||||
|
public abstract void LoadSceneBufferList(string sceneInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,7 +465,7 @@ public class Score_1002 : ScoreBase
|
||||||
/// 保存场景中List缓存,用于断线重连
|
/// 保存场景中List缓存,用于断线重连
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="System.NotImplementedException"></exception>
|
/// <exception cref="System.NotImplementedException"></exception>
|
||||||
public override void SaveSceneBufferList()
|
public override string SaveSceneBufferList()
|
||||||
{
|
{
|
||||||
BufferTemp_1002 tmp = new BufferTemp_1002();
|
BufferTemp_1002 tmp = new BufferTemp_1002();
|
||||||
tmp.TestPen3list = TestPen3list;
|
tmp.TestPen3list = TestPen3list;
|
||||||
|
@ -477,6 +477,21 @@ public class Score_1002 : ScoreBase
|
||||||
tmp.currentInstallTestJieXian = currentInstallTestJieXian;
|
tmp.currentInstallTestJieXian = currentInstallTestJieXian;
|
||||||
string sceneInfo = JsonConvert.SerializeObject(tmp, Formatting.Indented);
|
string sceneInfo = JsonConvert.SerializeObject(tmp, Formatting.Indented);
|
||||||
Debug.Log("==场景信息:" + sceneInfo);
|
Debug.Log("==场景信息:" + sceneInfo);
|
||||||
|
return sceneInfo;
|
||||||
|
//throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LoadSceneBufferList(string sceneInfo)
|
||||||
|
{
|
||||||
|
BufferTemp_1002 tmp = new BufferTemp_1002();
|
||||||
|
tmp = JsonMapper.ToObject<BufferTemp_1002>(sceneInfo);
|
||||||
|
TestPen3list = tmp.TestPen3list;
|
||||||
|
InSwitchCloseYDList = tmp.InSwitchCloseYDList;
|
||||||
|
InSwitchOpenYDList = tmp.InSwitchOpenYDList;
|
||||||
|
currentunInstallJieXian = tmp.currentunInstallJieXian;
|
||||||
|
currentInstallJieXian = tmp.currentInstallJieXian;
|
||||||
|
installCover = tmp.installCover;
|
||||||
|
currentInstallTestJieXian = tmp.currentInstallTestJieXian;
|
||||||
//throw new System.NotImplementedException();
|
//throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,4 +75,9 @@ public class TB_UserExamStat
|
||||||
/// 当前场景内的所有可触发物品
|
/// 当前场景内的所有可触发物品
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ReconnectTriggerInfo> currentSceneTriggers = new List<ReconnectTriggerInfo>();
|
public List<ReconnectTriggerInfo> currentSceneTriggers = new List<ReconnectTriggerInfo>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 场景内所有缓存信息,不定数据格式
|
||||||
|
/// </summary>
|
||||||
|
public string currentSceneOtherInfo = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
|
||||||
sub.isDone = item.Value.isDone;
|
sub.isDone = item.Value.isDone;
|
||||||
UserExamStat.allSubScore.Add( sub );
|
UserExamStat.allSubScore.Add( sub );
|
||||||
};
|
};
|
||||||
|
//保存场景内独有信息
|
||||||
|
UserExamStat.currentSceneOtherInfo = scoreBase.SaveSceneBufferList();
|
||||||
}
|
}
|
||||||
/*UserExamStat.processId = ProcessManager.Instance.processId;
|
/*UserExamStat.processId = ProcessManager.Instance.processId;
|
||||||
UserExamStat.subProcessId = ProcessManager.Instance.subProcessId;
|
UserExamStat.subProcessId = ProcessManager.Instance.subProcessId;
|
||||||
|
@ -123,15 +125,6 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
|
||||||
File.WriteAllText(localStatPath, UserJson);
|
File.WriteAllText(localStatPath, UserJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 记录场景中的信息
|
|
||||||
/// </summary>
|
|
||||||
public void RealtimeSceneWriter()
|
|
||||||
{
|
|
||||||
ScoreBase scoreBase = FindAnyObjectByType<ScoreBase>();
|
|
||||||
scoreBase.SaveSceneBufferList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取用户状态(先使用同步,后用异步)
|
/// 读取用户状态(先使用同步,后用异步)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -280,10 +273,6 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(KeyCode.U))
|
|
||||||
{
|
|
||||||
RealtimeSceneWriter();
|
|
||||||
}
|
|
||||||
if (Input.GetKeyDown(KeyCode.T))//测试用,按T读取状态保存
|
if (Input.GetKeyDown(KeyCode.T))//测试用,按T读取状态保存
|
||||||
{
|
{
|
||||||
RealtimeStatWriter();
|
RealtimeStatWriter();
|
||||||
|
|
Loading…
Reference in New Issue