记录分数

This commit is contained in:
liuyu 2024-09-03 17:34:49 +08:00
parent 2adbebe563
commit b5083fa17e
3 changed files with 57 additions and 215 deletions

View File

@ -6,6 +6,16 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
//用于记录当前得分情况
[Serializable]
public class ReconnectSubScoreInfo
{
public int index = -1;
public int subProcessId;
public float currentScore = 0.0f;
public bool isDone;
}
//用于记录现场中各项出发物品信息 //用于记录现场中各项出发物品信息
[Serializable] [Serializable]
public class ReconnectTriggerInfo public class ReconnectTriggerInfo
@ -29,11 +39,18 @@ public class ReconnectItemInfo
} }
public class TB_UserExamStat public class TB_UserExamStat
{ {
/*public int schemeID = -1;//当前方案ID public int systemID = -1;//当前系统ID
public int processId = -1;// 当前流程Id public int schemeID = -1;//当前方案ID
/*public int processId = -1;// 当前流程Id
public int subProcessId = -1;//当前子流程Id public int subProcessId = -1;//当前子流程Id
public int subProcessStepId = -1;//当前子流程步骤Id*/ public int subProcessStepId = -1;//当前子流程步骤Id*/
/// <summary>
/// 当前得分情况
/// </summary>
public float currentScore = 0;
public List<ReconnectSubScoreInfo> allSubScore = new List<ReconnectSubScoreInfo>();
/// <summary> /// <summary>
/// 背包中所有的工具和材料 /// 背包中所有的工具和材料
/// </summary> /// </summary>

View File

@ -41,10 +41,26 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
/// </summary> /// </summary>
public void RealtimeStatWriter() public void RealtimeStatWriter()
{ {
//记录步骤相关各项信息 //记录步骤相关各项信息
/*UserExamStat.schemeID = ProcessManager.Instance.schemeID; UserExamStat.schemeID = ProcessManager.Instance.schemeID;
UserExamStat.processId = ProcessManager.Instance.processId;
//¼Ç¼µÃ·ÖÇé¿ö
ScoreBase scoreBase = FindFirstObjectByType<ScoreBase>();
UserExamStat.systemID = scoreBase.systemId;
UserExamStat.allSubScore.Clear();
if ( scoreBase != null )
{
foreach (var item in scoreBase.GetStepScore())
{
ReconnectSubScoreInfo sub = new ReconnectSubScoreInfo();
sub.index = item.Key;
sub.subProcessId = item.Value.subProcessId;
sub.currentScore = item.Value.currentScore;
sub.isDone = item.Value.isDone;
UserExamStat.allSubScore.Add( sub );
};
}
/*UserExamStat.processId = ProcessManager.Instance.processId;
UserExamStat.subProcessId = ProcessManager.Instance.subProcessId; UserExamStat.subProcessId = ProcessManager.Instance.subProcessId;
UserExamStat.subProcessStepId = ProcessManager.Instance.subProcessStepId;*/ UserExamStat.subProcessStepId = ProcessManager.Instance.subProcessStepId;*/
@ -102,7 +118,6 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
//转换为JSON //转换为JSON
string UserJson = JsonConvert.SerializeObject(UserExamStat, Formatting.Indented); string UserJson = JsonConvert.SerializeObject(UserExamStat, Formatting.Indented);
Debug.Log("自动保存成功"); Debug.Log("自动保存成功");
File.WriteAllText(localStatPath, UserJson); File.WriteAllText(localStatPath, UserJson);
} }
@ -192,11 +207,6 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
} }
}); });
} }
// Start is called before the first frame update
//void Start()
//{
//}
// Update is called once per frame // Update is called once per frame
void Update() void Update()
@ -204,7 +214,6 @@ public class ReconnectMgr : SingletonMono<ReconnectMgr>
if (Input.GetKeyDown(KeyCode.T))//测试用,按T读取状态保存 if (Input.GetKeyDown(KeyCode.T))//测试用,按T读取状态保存
{ {
RealtimeStatWriter(); RealtimeStatWriter();
//Dictionary<string, List<ItemInfo>> tmpDic = PacksackBagMgr.Instance.GetCurrentBagData();
Debug.Log("当前场景:" + UserExamStat.sceneName); Debug.Log("当前场景:" + UserExamStat.sceneName);
} }
else if(Input.GetKeyDown(KeyCode.Y)) else if(Input.GetKeyDown(KeyCode.Y))

View File

@ -1,209 +1,25 @@
{ {
"allToolAndMaterial": [ "systemID": -1,
"国网安全帽", "schemeID": 1002,
"工作服" "currentScore": 0.0,
], "allSubScore": [],
"allToolAndMaterial": [],
"allWear": [], "allWear": [],
"sceneName": "04_ToolMaterialScene", "sceneName": "03_OfficeScene",
"currentSceneTools": [ "currentSceneTools": [],
"currentSceneTriggers": [
{ {
"toolId": 5008, "triggerID": 5005,
"triggerID": 5008, "triggerName": "手机",
"toolName": "国网安全帽", "selfPosInScene": {
"selfPosInToolRoom": { "x": 0.0244421959,
"x": 0.263, "y": 0.885706842,
"y": 1.60900009, "z": -1.00569367
"z": -1.369 },
} "selfRotInScene": {
}, "x": 0.0,
{ "y": 0.0,
"toolId": 5003, "z": 0.0
"triggerID": 5003,
"toolName": "绝缘螺丝刀",
"selfPosInToolRoom": {
"x": -3.22629857,
"y": 1.129,
"z": -1.12697673
}
},
{
"toolId": 5015,
"triggerID": 5015,
"toolName": "盒装封印",
"selfPosInToolRoom": {
"x": 0.305,
"y": 1.556,
"z": -3.328
}
},
{
"toolId": 5010,
"triggerID": 5010,
"toolName": "绝缘手套",
"selfPosInToolRoom": {
"x": 0.265,
"y": 0.6700001,
"z": -1.387
}
},
{
"toolId": 5017,
"triggerID": 5017,
"toolName": "三相四线电能表",
"selfPosInToolRoom": {
"x": -3.2316,
"y": 1.1067,
"z": -2.258
}
},
{
"toolId": 5002,
"triggerID": 5002,
"toolName": "剥线钳",
"selfPosInToolRoom": {
"x": -3.1648,
"y": 0.217400074,
"z": -0.731
}
},
{
"toolId": 5004,
"triggerID": 5004,
"toolName": "验电笔",
"selfPosInToolRoom": {
"x": -3.212,
"y": 1.128,
"z": -0.672
}
},
{
"toolId": 5009,
"triggerID": 5009,
"toolName": "工作服",
"selfPosInToolRoom": {
"x": 0.311,
"y": 1.1358,
"z": -1.381
}
},
{
"toolId": 5015,
"triggerID": 5015,
"toolName": "盒装封印",
"selfPosInToolRoom": {
"x": 0.305,
"y": 1.556,
"z": -3.808
}
},
{
"toolId": 5003,
"triggerID": 5003,
"toolName": "绝缘螺丝刀",
"selfPosInToolRoom": {
"x": -3.223,
"y": 1.124,
"z": -1.649
}
},
{
"toolId": 5004,
"triggerID": 5004,
"toolName": "验电笔",
"selfPosInToolRoom": {
"x": -3.21036649,
"y": 1.1167,
"z": -0.173
}
},
{
"toolId": 5017,
"triggerID": 5017,
"toolName": "三相四线电能表",
"selfPosInToolRoom": {
"x": -3.2316,
"y": 1.1067,
"z": -2.7405
}
},
{
"toolId": 5002,
"triggerID": 5002,
"toolName": "剥线钳",
"selfPosInToolRoom": {
"x": -3.1648,
"y": 0.217400074,
"z": -0.189
}
},
{
"toolId": 5010,
"triggerID": 5010,
"toolName": "绝缘手套",
"selfPosInToolRoom": {
"x": 0.265,
"y": 0.6700001,
"z": -1.849
}
},
{
"toolId": 5014,
"triggerID": 5014,
"toolName": "工作证",
"selfPosInToolRoom": {
"x": 0.238,
"y": 1.134,
"z": -3.807
}
},
{
"toolId": 5011,
"triggerID": 5011,
"toolName": "绝缘靴",
"selfPosInToolRoom": {
"x": 0.315,
"y": 0.207000017,
"z": -1.377
}
},
{
"toolId": 5014,
"triggerID": 5014,
"toolName": "工作证",
"selfPosInToolRoom": {
"x": 0.238,
"y": 1.134,
"z": -3.353
}
},
{
"toolId": 5016,
"triggerID": 5016,
"toolName": "绝缘胶带",
"selfPosInToolRoom": {
"x": 0.281,
"y": 1.55870008,
"z": -4.595
}
},
{
"toolId": 5016,
"triggerID": 5016,
"toolName": "绝缘胶带",
"selfPosInToolRoom": {
"x": 0.281,
"y": 1.55870008,
"z": -4.202
}
},
{
"toolId": 5011,
"triggerID": 5011,
"toolName": "绝缘靴",
"selfPosInToolRoom": {
"x": 0.315,
"y": 0.207000017,
"z": -1.852
} }
} }
] ]