修改此步骤需要点击的工具函数

考核模式支持两个工具任选一个即可
This commit is contained in:
“CongG” 2025-01-04 21:25:05 +08:00
parent e3a815c7d0
commit 620f4155e5
5 changed files with 129 additions and 68 deletions

View File

@ -365,7 +365,7 @@
"CameraDefaultTR": "1.346_-2.303_-0.54|0_0_0",
"CameraNearTR": "",
"QNextNum": 16,
"ExamModelBT": "",
"ExamModelBT": "阴道栓*长柄钳",
"ExamTip": "请按顺序进行相关操作",
"ExamEvvr": "选择错误,应先准备阴道栓",
"Question": "",
@ -1665,7 +1665,7 @@
"CameraDefaultTR": "1.346_-2.303_-0.54|0_0_0",
"CameraNearTR": "",
"QNextNum": 68,
"ExamModelBT": "",
"ExamModelBT": "阴道栓*长柄钳",
"ExamTip": "请按顺序进行相关操作",
"ExamEvvr": "选择错误,应先准备阴道栓",
"Question": "",
@ -2390,7 +2390,7 @@
"CameraDefaultTR": "",
"CameraNearTR": "",
"QNextNum": 97,
"ExamModelBT": "",
"ExamModelBT": "玻璃棒*牛的精液A*牛的精液B*牛的精液C",
"ExamTip": "请按顺序进行相关操作",
"ExamEvvr": "选择错误,应蘸取精液",
"Question": "",
@ -3140,7 +3140,7 @@
"CameraDefaultTR": "1.7027_-2.303_-0.659|7_0_0",
"CameraNearTR": "",
"QNextNum": 128,
"ExamModelBT": "",
"ExamModelBT": "0.3%高锰酸钾*消毒纸巾",
"ExamTip": "",
"ExamEvvr": "",
"Question": "",
@ -3815,7 +3815,7 @@
"CameraDefaultTR": "1.7027_-2.303_-0.659|7_0_0",
"CameraNearTR": "",
"QNextNum": 155,
"ExamModelBT": "",
"ExamModelBT": "Cpbeizi*Cpxiaoduzhijin",
"ExamTip": "请按顺序进行相关操作",
"ExamEvvr": "选择错误,应使用扩张棒操作",
"Question": "",
@ -4515,7 +4515,7 @@
"CameraDefaultTR": "",
"CameraNearTR": "",
"QNextNum": 182,
"ExamModelBT": "",
"ExamModelBT": "高硼硅玻璃细管*口吸管",
"ExamTip": "请按顺序进行相关操作",
"ExamEvvr": "选择错误,应选择玻璃细管和口吸管",
"Question": "",

View File

@ -6834,6 +6834,12 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 416603169}
m_PrefabAsset: {fileID: 0}
--- !u!1 &416603171 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 265685189950564712, guid: a623bdd0c9a05dd448dd9cc858aca9f1,
type: 3}
m_PrefabInstance: {fileID: 416603169}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &422360618
PrefabInstance:
m_ObjectHideFlags: 0
@ -9230,6 +9236,12 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 587790278}
m_PrefabAsset: {fileID: 0}
--- !u!1 &587790280 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 265685189950564712, guid: a623bdd0c9a05dd448dd9cc858aca9f1,
type: 3}
m_PrefabInstance: {fileID: 587790278}
m_PrefabAsset: {fileID: 0}
--- !u!1 &588346246
GameObject:
m_ObjectHideFlags: 0
@ -10994,6 +11006,12 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 694871476}
m_PrefabAsset: {fileID: 0}
--- !u!1 &694871478 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 265685189950564712, guid: a623bdd0c9a05dd448dd9cc858aca9f1,
type: 3}
m_PrefabInstance: {fileID: 694871476}
m_PrefabAsset: {fileID: 0}
--- !u!1 &698929352
GameObject:
m_ObjectHideFlags: 0
@ -13830,6 +13848,14 @@ MonoBehaviour:
- {fileID: 985674199115698890}
- {fileID: 1752369248}
- {fileID: 1608547272}
_signTrans:
- {fileID: 412918334}
- {fileID: 1385361293}
- {fileID: 416603171}
- {fileID: 587790280}
- {fileID: 1800198919}
- {fileID: 694871478}
- {fileID: 1160721213}
_peoplePlanTimeLineClip: {fileID: 11400000, guid: 650596eb2f54a364eaf5458ae2439d75,
type: 2}
_CSPLCLTimeLineClip: {fileID: 11400000, guid: 66029414ec3d89b469ed349852ba3d92,
@ -17526,6 +17552,12 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 1160721211}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1160721213 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 265685189950564712, guid: a623bdd0c9a05dd448dd9cc858aca9f1,
type: 3}
m_PrefabInstance: {fileID: 1160721211}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1161844727
GameObject:
m_ObjectHideFlags: 0
@ -19760,6 +19792,12 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 1385361291}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1385361293 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 265685189950564712, guid: a623bdd0c9a05dd448dd9cc858aca9f1,
type: 3}
m_PrefabInstance: {fileID: 1385361291}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1391538821
GameObject:
m_ObjectHideFlags: 0
@ -22818,6 +22856,12 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 1800198917}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1800198919 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 265685189950564712, guid: a623bdd0c9a05dd448dd9cc858aca9f1,
type: 3}
m_PrefabInstance: {fileID: 1800198917}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1808384780
GameObject:
m_ObjectHideFlags: 0

View File

@ -19,11 +19,15 @@ namespace ZXK.LouDiXvMuNiu
//物品展示
[SerializeField]
private Transform[] _toolContain = null;
[SerializeField]//所有作为标签出现在场景中的物体
private GameObject[] _signTrans = null;
private List<Transform> _curModuleToolArray = new List<Transform>();//当前步骤需要用到的所有工具
//动画交互
public NiuData _CurSceneStep;//为了方便做对比,临时保存当前步骤
private Dictionary<bool, List<GameObject>> _curStepUseBTDic;//当前步骤要点击的所有物体true表示正确选项false表示错误选项
private Dictionary<bool, List<GameObject>> _curStepUseBTDic;//当前步骤要点击的所有物体true表示两个物体都要点false表示点击其中一个即可
public Dictionary<bool, List<GameObject>> _CurStepUseBtDic { get => _curStepUseBTDic; }
private List<OutLineRender> _currentHighlights = new List<OutLineRender>();
private PlayableDirector _curTimeLine = null;
private TimelineDirectorCtrl _curTimeLineCtrl = null;
@ -304,67 +308,69 @@ namespace ZXK.LouDiXvMuNiu
/// 获取此步骤需要点击的工具
/// </summary>
/// <param name="step"></param>
public List<GameObject> GetNeedClickTools(NiuData step)
public void GetNeedClickTools(NiuData step)
{
List<GameObject> triGeos = new List<GameObject>();
List<NiuData> tempData = GameManager.Instance._DataNiuHandler.NiuStepTypeDic[GameManager.Instance._CurModelType];
for (int i = 0; i < tempData.Count; i++)
for (int i = 0; i < _signTrans.Length; i++)
{
if (tempData[i].TaskType==ConstCtrl.TASKTYPE_Tran) continue;
string[] tris = tempData[i].ModelBT.Split("|");
for (int j = 0; j < tris.Length; j++)
{
GameObject toolGeo = UtilitiesMng.GetGeoByName(new Transform[1] { transform }, tris[j], true);
if (toolGeo && !triGeos.Contains(toolGeo))
{
if (toolGeo.name.Contains("sign"))
{
toolGeo.SetActive(false);
_signTrans[i].SetActive(false);
}
triGeos.Add(toolGeo);
}
}
}
_curStepUseBTDic = new Dictionary<bool, List<GameObject>>();
List<GameObject> toolTemp = new List<GameObject>();
string[] tempBtArray = step.ModelBT.Split("+");
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState")
&&!string.IsNullOrEmpty(step.ExamModelBT))
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
{
tempBtArray = step.ExamModelBT.Split("+");
}
for (int i = 0; i < tempBtArray.Length; i++)
string[] tempBts = step.ModelBT.Split("|");
string[] tempSelects = tempBts[0].Split("+");
for (int i = 0; i < tempSelects.Length; i++)
{
string[] tempBts = tempBtArray[i].Split("|");
int count = 0;
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
{
count = tempBts.Length;
}
else
{
count = 1;
}
for (int j = 0; j < count; j++)
{
GameObject tempGeo = UtilitiesMng.GetGeoByName(new Transform[1] { transform }, tempBts[j], true);
GameObject tempGeo = UtilitiesMng.GetGeoByName(new Transform[1] { transform }, tempSelects[i], true);
if (tempGeo == null) continue;
tempGeo.SetActive(true);
toolTemp.Add(tempGeo);
if (_curStepUseBTDic.ContainsKey(j == 0))
}
_curStepUseBTDic.Add(true, toolTemp);
}
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
{
_curStepUseBTDic[j == 0].Add(tempGeo);
string[] tempBts = step.ModelBT.Split("|");
if (!string.IsNullOrEmpty(step.ExamModelBT))
{
tempBts = step.ExamModelBT.Split("|");
}
for (int i = 0; i < tempBts.Length; i++)
{
string[] tempExamSelects = null;
if (tempBts[i].Contains("+"))
{
tempExamSelects = tempBts[i].Split("+");
}
else if (tempBts[i].Contains("*"))
{
tempExamSelects = tempBts[i].Split("*");
}
else
{
List<GameObject> tempList = new List<GameObject>();
tempList.Add(tempGeo);
_curStepUseBTDic.Add(j == 0, tempList);
tempExamSelects = new string[1] { tempBts[i] };
}
for (int j = 0; j < tempExamSelects.Length; j++)
{
GameObject tempGeo = UtilitiesMng.GetGeoByName(new Transform[1] { transform }, tempExamSelects[j], true);
if (tempGeo == null) continue;
tempGeo.SetActive(true);
if (i == 0)
{
toolTemp.Add(tempGeo);
}
}
if (tempBts[i].Contains("*"))
{
_curStepUseBTDic.Add(false, toolTemp);
}
else
{
_curStepUseBTDic.Add(true, toolTemp);
}
}
}
return toolTemp;
}
/// <summary>
/// 让此步骤需要点击的物体高亮显示
@ -447,8 +453,18 @@ namespace ZXK.LouDiXvMuNiu
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
{
bool addScoreTemp = true;
List<GameObject> useBts = _curStepUseBTDic[true];
List<GameObject> useBts = new List<GameObject>();
if (_curStepUseBTDic.ContainsKey(false))
{
useBts = _curStepUseBTDic[false];
if (useBts.Contains(triGeo))
{
useBts.Clear();
}
}
else if(_curStepUseBTDic.ContainsKey(true))
{
useBts = _curStepUseBTDic[true];
if (useBts.Contains(triGeo))
{
if (triGeo.GetComponent<OutLineRender>())
@ -467,6 +483,7 @@ namespace ZXK.LouDiXvMuNiu
useBts.Clear();
addScoreTemp = false;
}
}
if (useBts.Count == 0)
{

View File

@ -345,8 +345,8 @@ namespace ZXK.LouDiXvMuNiu
}
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
{
List<GameObject> tempToolArray = NiuSceneMng._Instance.GetNeedClickTools(obj);
NiuSceneMng._Instance.OnlyShowBTGeo(tempToolArray.ToArray());
NiuSceneMng._Instance.GetNeedClickTools(obj);
NiuSceneMng._Instance.OnlyShowBTGeo(NiuSceneMng._Instance._CurStepUseBtDic[true].ToArray());
}
else if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
{
@ -388,8 +388,8 @@ namespace ZXK.LouDiXvMuNiu
{
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
{
List<GameObject> tempToolArray = NiuSceneMng._Instance.GetNeedClickTools(obj);
NiuSceneMng._Instance.OnlyShowBTGeo(tempToolArray.ToArray());
NiuSceneMng._Instance.GetNeedClickTools(obj);
NiuSceneMng._Instance.OnlyShowBTGeo(NiuSceneMng._Instance._CurStepUseBtDic[true].ToArray());
}
else if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
{