- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
170 lines
6.7 KiB
C#
170 lines
6.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using XFramework;
|
|
using XFramework.NetOuter;
|
|
|
|
public class StudentSub3Panel : BasePanel
|
|
{
|
|
const string panelName = "Panel_studentSub3推演";
|
|
Button button_quit;//退出本科目
|
|
Button button_start;//开始维修
|
|
|
|
FixStepWindowCtrl StepWindowCtrl;
|
|
AnserWindowCtrl AnserWindow;
|
|
|
|
//维修环节信息
|
|
List<FixLink> fixLinks;
|
|
int linkIndex = 0;//当前进行维修环节索引
|
|
public StudentSub3Panel():base(new UIType(panelName))
|
|
{
|
|
|
|
}
|
|
|
|
protected override void InitEvent()
|
|
{
|
|
StepWindowCtrl = ActivePanel.FindChildTrans("Image_fixStepsWindow").GetComponent<FixStepWindowCtrl>();
|
|
button_quit = ActivePanel.FindChildTrans("Button_quit").GetComponent<Button>();//Button_start
|
|
//if (StudentStateManager.Instance.LearnState == LearnState.examing)//训练模式可以主动结束 考虑到可能出现异常操作 本科目任何模式都能自主结束
|
|
//button_quit.gameObject.SetActive(false);
|
|
button_quit.onClick.AddListener(QuitButton);
|
|
button_start = ActivePanel.FindChildTrans("Button_start").GetComponent<Button>();//Button_start
|
|
button_start.onClick.AddListener(StartButtonClick);
|
|
if (GroupLearnHelper.isGroup && !GroupLearnHelper.isMaster)//编组训练时 由组长进行虚拟训练步骤规划和开始操作设置
|
|
{
|
|
button_start.gameObject.SetActive(false);
|
|
//button_quit.gameObject.SetActive(false);
|
|
}
|
|
AnserWindow = ActivePanel.Find("Image_答题框").GetComponent<AnserWindowCtrl>();
|
|
}
|
|
|
|
|
|
public override void OnStart()
|
|
{
|
|
base.OnStart();
|
|
StepWindowCtrl.Hide();//开始隐藏 步骤规划面板
|
|
AnserWindow.Hide();//开始隐藏 问题面板
|
|
|
|
}
|
|
|
|
//传入维修案例信息
|
|
public override void Change(object newData)
|
|
{
|
|
fixLinks = newData as List<FixLink>;
|
|
}
|
|
|
|
//中途 退出训练
|
|
private void QuitButton()
|
|
{
|
|
SubOver();// 虚拟维修中途退出 同样上传成绩
|
|
}
|
|
|
|
//开始维修按钮 从第一环节开始
|
|
private void StartButtonClick()
|
|
{
|
|
StepWindowCtrl.ActiveWindow(fixLinks[linkIndex].steps,PlanningStepOver);
|
|
button_start.gameObject.SetActive(false);
|
|
}
|
|
|
|
//当前环节规划完成 记录规划的步骤
|
|
private void PlanningStepOver(List<StepData> stepDatas)
|
|
{
|
|
StudentOperateRecorder.Instance.InjectOperateMsg($"{fixLinks[linkIndex].fixLinkEnum}环节规划完成,步骤如下:");//
|
|
for (int i = 0; i < stepDatas.Count; i++)
|
|
{
|
|
StudentOperateRecorder.Instance.InjectOperateMsg($"{i}、{stepDatas[i].describe}");
|
|
}
|
|
if (fixLinks[linkIndex].questions != null && fixLinks[linkIndex].questions.Count > 0)//当前环节存在需要回答的问题
|
|
{
|
|
currentQuestionIdex = 0;
|
|
AnserWindow.SetQuestion(fixLinks[linkIndex].questions[currentQuestionIdex], AnswerQuestion); //从第一题开始回答
|
|
}
|
|
else
|
|
{
|
|
StartVRProcess(fixLinks[linkIndex].fixLinkEnum);
|
|
}
|
|
}
|
|
int currentQuestionIdex = 0;
|
|
|
|
//回答完一个问题
|
|
private void AnswerQuestion(bool isRight,string msg)
|
|
{
|
|
if (!isRight)//回答错误时 记录 正确时不做处理
|
|
{
|
|
StudentOperateRecorder.Instance.InjectOperateMsg($"{fixLinks[linkIndex].questions[currentQuestionIdex].question}回答错误!");
|
|
}
|
|
|
|
if (currentQuestionIdex < fixLinks[linkIndex].questions.Count - 1)//当前修理环节存在未回答的问题
|
|
{
|
|
currentQuestionIdex++;
|
|
|
|
AnserWindow.SetQuestion(fixLinks[linkIndex].questions[currentQuestionIdex], AnswerQuestion); //继续回答下一道题
|
|
}
|
|
else//播放当前修理环节的动画
|
|
{
|
|
AnserWindow.Hide();//关闭答题窗口
|
|
StartVRProcess(fixLinks[linkIndex].fixLinkEnum);
|
|
}
|
|
}
|
|
|
|
//开始拆卸/安装流程虚拟操作 分组训练时组长端发送流程开始指令 每开始一个环节的流程发送一次 正常发送两次 第一次拆 第二次装
|
|
private void StartVRProcess(FixLinkEnum linkEnum)
|
|
{
|
|
ProcessManager.Instance.SetProcess((ProcessEnum)linkEnum);
|
|
ProcessManager.Instance.StartProcess(VROperatorProcessOver);
|
|
ProcessManager.Instance.StepOverEvent += VRStepOverEvent;
|
|
|
|
if (GroupLearnHelper.isMaster)
|
|
{
|
|
IProtoBuilder protoBuilder = new MasterActionProtoBuilder(MasterActionType.StartSyncOperation);
|
|
NetUDPManager.Instance.SendNetMess(protoBuilder.GetProto());
|
|
}
|
|
//Game.StartCoroutine(SimulateAnimOver());
|
|
}
|
|
|
|
|
|
//VR虚拟操作流程完成 所有操作流程均完成后 科目结束 若仍存在未完成的流程则自动开始下一流程
|
|
private void VROperatorProcessOver(ProcessEnum processEnum)
|
|
{
|
|
ProcessManager.Instance.StepOverEvent -= VRStepOverEvent;
|
|
StudentOperateRecorder.Instance.InjectOperateMsg($"完成{processEnum.ToString()}流程虚拟操作。",true);
|
|
if (linkIndex < fixLinks.Count - 1)//存在未完成的环节
|
|
{
|
|
linkIndex++;
|
|
StepWindowCtrl.ActiveWindow(fixLinks[linkIndex].steps, PlanningStepOver);//继续规划步骤
|
|
}
|
|
else//结束场景 传回消息事件
|
|
{
|
|
SubOver();
|
|
}
|
|
}
|
|
|
|
//科目结束 上传成绩 断开VR设备 弹出等待界面 分组训练时发送同步结束消息
|
|
void SubOver()
|
|
{
|
|
NetAnswerSheet resultMsg = StudentOperateRecorder.Instance.GetResultMsg();
|
|
TCPManager.Instance.SendNetMsg<NetAnswerSheet>(resultMsg, NetMsgName.AnswerSheet);//传回评估结果
|
|
EventCenter.Instance.EventTrigger("ShutDownVR");//关闭VR
|
|
Push(new WaitResultPanel());
|
|
if (GroupLearnHelper.isMaster)
|
|
{
|
|
IProtoBuilder protoBuilder = new MasterActionProtoBuilder(MasterActionType.StopSyncOperation);
|
|
NetUDPManager.Instance.SendNetMess(protoBuilder.GetProto());
|
|
}
|
|
}
|
|
|
|
|
|
private void VRStepOverEvent(string arg0)
|
|
{
|
|
if (StepName.StepNameDic.ContainsKey(arg0))//步骤名称存在补充数据
|
|
{
|
|
if (!string.IsNullOrEmpty(StepName.StepNameDic[arg0]))//补充数据不为空时
|
|
StudentOperateRecorder.Instance.InjectOperateMsg($"{StepName.StepNameDic[arg0]}{fixLinks[linkIndex].fixLinkEnum}完成。", true);
|
|
return;//为空则代表该步骤不做记录
|
|
}
|
|
//步骤名称不存在补充数据 按照原有规则记录
|
|
StudentOperateRecorder.Instance.InjectOperateMsg($"{arg0}{fixLinks[linkIndex].fixLinkEnum}完成。", true);
|
|
}
|
|
}
|