保存场景缓存
This commit is contained in:
parent
009110306d
commit
8fdc47d314
|
@ -72,10 +72,15 @@ public abstract class ScoreBase : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置科目得分,用于断线重连恢复
|
/// 设置科目得分,用于断线重连恢复 HQB
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void setCurrentScore(float _score)
|
public void setCurrentScore(float _score)
|
||||||
{
|
{
|
||||||
this.currentScore = _score;
|
this.currentScore = _score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录现场环境中scoreBase的各项List缓存
|
||||||
|
/// </summary>
|
||||||
|
public abstract void SaveSceneBufferList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,21 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using LitJson;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转存场景buffer
|
||||||
|
/// </summary>
|
||||||
|
public class BufferTemp_1002
|
||||||
|
{
|
||||||
|
public List<string> TestPen3list;
|
||||||
|
public List<string> InSwitchCloseYDList;
|
||||||
|
public List<string> InSwitchOpenYDList;
|
||||||
|
public List<string> currentunInstallJieXian;
|
||||||
|
public List<string> currentInstallJieXian;
|
||||||
|
public List<string> installCover;
|
||||||
|
public List<string> currentInstallTestJieXian;
|
||||||
|
}
|
||||||
|
|
||||||
public class Score_1002 : ScoreBase
|
public class Score_1002 : ScoreBase
|
||||||
{
|
{
|
||||||
|
@ -445,4 +460,23 @@ public class Score_1002 : ScoreBase
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存场景中List缓存,用于断线重连
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="System.NotImplementedException"></exception>
|
||||||
|
public override void SaveSceneBufferList()
|
||||||
|
{
|
||||||
|
BufferTemp_1002 tmp = new BufferTemp_1002();
|
||||||
|
tmp.TestPen3list = TestPen3list;
|
||||||
|
tmp.InSwitchCloseYDList = InSwitchCloseYDList;
|
||||||
|
tmp.InSwitchOpenYDList = InSwitchOpenYDList;
|
||||||
|
tmp.currentunInstallJieXian = currentunInstallJieXian;
|
||||||
|
tmp.currentInstallJieXian = currentInstallJieXian;
|
||||||
|
tmp.installCover = installCover;
|
||||||
|
tmp.currentInstallTestJieXian = currentInstallTestJieXian;
|
||||||
|
string sceneInfo = JsonConvert.SerializeObject(tmp, Formatting.Indented);
|
||||||
|
Debug.Log("==场景信息:" + sceneInfo);
|
||||||
|
//throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,15 @@ 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>
|
||||||
|
@ -271,6 +280,10 @@ 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