|
|
@@ -6,6 +6,7 @@ using UnityEngine;
|
|
|
using ChivaXR.Op;
|
|
|
using System.Linq;
|
|
|
using UnityEngine.Events;
|
|
|
+using QFramework;
|
|
|
|
|
|
public class OperationListener : MonoBehaviour
|
|
|
{
|
|
|
@@ -15,7 +16,8 @@ public class OperationListener : MonoBehaviour
|
|
|
{
|
|
|
foreach (var item in opDataInfos)
|
|
|
{
|
|
|
- item.OpDataActive();
|
|
|
+ ///无步骤控制
|
|
|
+ item.OpDataActive(0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -26,6 +28,8 @@ public class OpDataInfo
|
|
|
[HideInInspector]
|
|
|
public string operationDataName;
|
|
|
|
|
|
+ [HideInInspector]
|
|
|
+ public int ActiveStepID;
|
|
|
[ShowInInspector]
|
|
|
[PropertyOrder(-1)]
|
|
|
[ValueDropdown("GetAllOperationDataNames", IsUniqueList = true)]
|
|
|
@@ -60,7 +64,11 @@ public class OpDataInfo
|
|
|
public CVR_OpDataInfoEventHandle OperationDataFinished;
|
|
|
|
|
|
[HideInInspector]
|
|
|
- public bool finish = false;
|
|
|
+ public bool isOpFinished = false;
|
|
|
+ [HideInInspector]
|
|
|
+ public bool isQuestionFinished = false;
|
|
|
+ [HideInInspector]
|
|
|
+ public QuestionInfo m_QuesionInfo;
|
|
|
|
|
|
public bool RangeCondition()
|
|
|
{
|
|
|
@@ -90,8 +98,10 @@ public class OpDataInfo
|
|
|
return AnimationManager.Instance.animationDatas.Select(s => new ValueDropdownItem(s.AniDataName, s.AniDataName));
|
|
|
}
|
|
|
|
|
|
- public void OpDataActive()
|
|
|
+ public void OpDataActive(int activeStepID)
|
|
|
{
|
|
|
+ ActiveStepID = activeStepID;
|
|
|
+ InitQuestion();
|
|
|
OpDataInfoManager.Instance.RegisterOpSystem(this);
|
|
|
|
|
|
OperationDataBase itemOpData = OperationManager.Instance.GetOpData(OperationDataName);
|
|
|
@@ -108,6 +118,7 @@ public class OpDataInfo
|
|
|
public void OpDataDisActive()
|
|
|
{
|
|
|
OperationDataBase itemOpData = OperationManager.Instance.GetOpData(OperationDataName);
|
|
|
+
|
|
|
if (!itemOpData)
|
|
|
{
|
|
|
Debug.LogError("无该操作名称");
|
|
|
@@ -140,16 +151,27 @@ public class OpDataInfo
|
|
|
|
|
|
if (finished)
|
|
|
{
|
|
|
- if (!string.IsNullOrEmpty(aniDataName))
|
|
|
- {
|
|
|
- AnimationManager.Instance.PlayAniData(aniDataName, OnOpListenerFinished);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperationDataFinished?.Invoke(this, new ChivaVR_OpDataInfoEventArgs() { opDataInfo = this });
|
|
|
- }
|
|
|
+ OpenQuestion();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isQuestionFinished)
|
|
|
+ {
|
|
|
+ PlayAnimation();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void PlayAnimation()
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(aniDataName))
|
|
|
+ {
|
|
|
+ AnimationManager.Instance.PlayAniData(aniDataName, OnOpListenerFinished);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperationDataFinished?.Invoke(this, new ChivaVR_OpDataInfoEventArgs() { opDataInfo = this });
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 动画播放完成
|
|
|
/// </summary>
|
|
|
@@ -161,6 +183,50 @@ public class OpDataInfo
|
|
|
OperationDataFinished?.Invoke(this, new ChivaVR_OpDataInfoEventArgs() { opDataInfo = this });
|
|
|
}
|
|
|
|
|
|
+ public void InitQuestion()
|
|
|
+ {
|
|
|
+ if (ActiveStepID == 0) return;
|
|
|
+ isQuestionFinished = false;
|
|
|
+ m_QuesionInfo = OperateSetting.Instance.GetQuestionInfo(ActiveStepID);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 打开题库
|
|
|
+ /// </summary>
|
|
|
+ public void OpenQuestion()
|
|
|
+ {
|
|
|
+ if (m_QuesionInfo == null) isQuestionFinished = true;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (m_QuesionInfo.QuestionType == "图文")
|
|
|
+ {
|
|
|
+ UIKit.OpenPanel<ImageAndTextNamePanel>(new ImageAndTextNamePanelData() { questionInfo = m_QuesionInfo, answerCallBack = AnswerCallBack });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ UIKit.OpenPanel<QuestionPanel>(new QuestionPanelData() { questionInfo = m_QuesionInfo, answerCallBack = AnswerCallBack });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 关闭题库
|
|
|
+ /// </summary>
|
|
|
+ public void CloseQuestion()
|
|
|
+ {
|
|
|
+ if (UIKit.GetPanel<ImageAndTextNamePanel>()) UIKit.ClosePanel<ImageAndTextNamePanel>();
|
|
|
+
|
|
|
+ if (UIKit.GetPanel<QuestionPanel>()) UIKit.ClosePanel<QuestionPanel>();
|
|
|
+ }
|
|
|
+ public void AnswerCallBack(bool result)
|
|
|
+ {
|
|
|
+ if (!result && OperateSetting.Instance.m_CurrentOperationMode == OperationMode.Exam)
|
|
|
+ {
|
|
|
+ ExamManagerForPC.instance.RecordFault(ProcessManagement.Instance.currentStepID, ErrorReason.AnswerWrong);
|
|
|
+ }
|
|
|
+ isQuestionFinished = true;
|
|
|
+
|
|
|
+ PlayAnimation();
|
|
|
+ }
|
|
|
+
|
|
|
public OperationDataBase GetCurrentOpData()
|
|
|
{
|
|
|
return OperationManager.Instance.GetOpData(OperationDataName);
|