From 8c57515bb21e848e26b0b8b81b779f0f0e51ef5d Mon Sep 17 00:00:00 2001
From: chenxiangxue <910695411@qq.com>
Date: Tue, 3 Sep 2024 09:48:19 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Assets/Scripts/CXX/Score/ScoreBase.cs | 13 +++++++--
Assets/Scripts/CXX/Score/ScoreManager.cs | 28 ++++++++++++++++++--
Assets/Scripts/CXX/Score/ScoreSubjectStep.cs | 4 +++
Assets/Scripts/CXX/Score/Score_1002.cs | 23 +++++++++-------
4 files changed, 54 insertions(+), 14 deletions(-)
diff --git a/Assets/Scripts/CXX/Score/ScoreBase.cs b/Assets/Scripts/CXX/Score/ScoreBase.cs
index a09cc30..d4de891 100644
--- a/Assets/Scripts/CXX/Score/ScoreBase.cs
+++ b/Assets/Scripts/CXX/Score/ScoreBase.cs
@@ -42,9 +42,9 @@ public abstract class ScoreBase : MonoBehaviour
}
///
- /// 获取总分和各步骤分数
+ /// 获取总分
///
- public void GetTotalScore()
+ public float GetTotalScore()
{
float all = 0;
foreach (var item in steps)
@@ -58,6 +58,15 @@ public abstract class ScoreBase : MonoBehaviour
}
Debug.LogError("总分为:" + all);
+ return all;
+ }
+ ///
+ /// 返回成绩详情
+ ///
+ ///
+ public Dictionary GetStepScore()
+ {
Debug.LogError(JsonConvert.SerializeObject(steps));
+ return steps;
}
}
diff --git a/Assets/Scripts/CXX/Score/ScoreManager.cs b/Assets/Scripts/CXX/Score/ScoreManager.cs
index 6943b74..c32fc59 100644
--- a/Assets/Scripts/CXX/Score/ScoreManager.cs
+++ b/Assets/Scripts/CXX/Score/ScoreManager.cs
@@ -12,12 +12,18 @@ public class ScoreManager : MonoBehaviour
{
instance = this;
scoreSubjectList = transform.GetComponentsInChildren(true).ToList();
- scoreSubjectList.ForEach(a =>
+ ReInit();
+ }
+ ///
+ /// 重置数据
+ ///
+ public void ReInit()
+ {
+ scoreSubjectList.ForEach(a =>
{
a.Init();
});
}
-
///
/// 检测分数
///
@@ -33,4 +39,22 @@ public class ScoreManager : MonoBehaviour
scoreSubjectList.Find(a => a.systemId == systemctlid && a.schemeId == schemeid)?.CheckScore(triggerName, para);
}
+ ///
+ /// 获取总分
+ ///
+ ///
+ ///
+ public float GetScore(int subjectid)
+ {
+ return scoreSubjectList.Find(a=>a.schemeId== subjectid).GetTotalScore();
+ }
+ ///
+ /// 获取分步骤得分详情
+ ///
+ ///
+ ///
+ public Dictionary GetStepScore(int subjectid)
+ {
+ return scoreSubjectList.Find(a => a.schemeId == subjectid).GetStepScore();
+ }
}
diff --git a/Assets/Scripts/CXX/Score/ScoreSubjectStep.cs b/Assets/Scripts/CXX/Score/ScoreSubjectStep.cs
index b8c3ccb..d836558 100644
--- a/Assets/Scripts/CXX/Score/ScoreSubjectStep.cs
+++ b/Assets/Scripts/CXX/Score/ScoreSubjectStep.cs
@@ -24,6 +24,10 @@ public class ScoreSubjectStep
/// 是否一票否决
///
public bool isOneVoteVeto;
+ ///
+ /// 步骤
+ ///
+ public D_SubProcess setp;
public ScoreSubjectStep(int subProcessId,float maxScore,bool isOneVoteVeto=false)
{
diff --git a/Assets/Scripts/CXX/Score/Score_1002.cs b/Assets/Scripts/CXX/Score/Score_1002.cs
index 09090a5..e63c32c 100644
--- a/Assets/Scripts/CXX/Score/Score_1002.cs
+++ b/Assets/Scripts/CXX/Score/Score_1002.cs
@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
+using Unity.VisualScripting.Antlr3.Runtime.Misc;
using UnityEngine;
public class Score_1002 : ScoreBase
@@ -39,6 +40,18 @@ public class Score_1002 : ScoreBase
steps.Add(a.subProcessId, a);
});
+ List dsteps=new List();
+ DataManager.Instance.d_System.subjects.Find(a => a.id == 1002).processes.ForEach(a =>
+ {
+ dsteps.AddRange(a.subProcesses);
+ });
+
+ for (int i = 0; i < steps.Count; i++)
+ {
+ steps[i].setp = dsteps[i];
+ }
+
+ //清理缓存
TestPen3list.Clear();
InSwitchCloseYDList.Clear();
InSwitchOpenYDList.Clear();
@@ -48,16 +61,6 @@ public class Score_1002 : ScoreBase
currentInstallTestJieXian.Clear();
}
- #if UNITY_EDITOR
- private void Update()
- {
- if (Input.GetKeyDown(KeyCode.O))
- {
- GetTotalScore();
- }
- }
-#endif
-
///
/// 三步验电顺序
///