- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
140 lines
4.9 KiB
Plaintext
140 lines
4.9 KiB
Plaintext
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using XFramework;
|
|
|
|
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
|
|
button_quit.onClick.AddListener(QuitButton);
|
|
button_start = ActivePanel.FindChildTrans("Button_start").GetComponent<Button>();//Button_start
|
|
button_start.onClick.AddListener(StartButtonClick);
|
|
AnserWindow = ActivePanel.Find("Image_答题框").GetComponent<AnserWindowCtrl>();
|
|
}
|
|
|
|
public override void OnStart()
|
|
{
|
|
base.OnStart();
|
|
StepWindowCtrl.Hide();//开始隐藏 步骤规划面板
|
|
AnserWindow.Hide();//开始隐藏 问题面板
|
|
button_start.gameObject.SetActive(true);
|
|
}
|
|
|
|
//传入维修案例信息
|
|
public override void Change(object newData)
|
|
{
|
|
fixLinks = newData as List<FixLink>;
|
|
}
|
|
|
|
//面板退出按钮
|
|
private void QuitButton()
|
|
{
|
|
//跳转到登陆场景
|
|
SceneSystem.Instance.SetScene(new StudentLoginScene(LoadSceneType.Login));
|
|
}
|
|
|
|
//开始维修按钮 从第一环节开始
|
|
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
|
|
{
|
|
PlayAnim(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();//关闭答题窗口
|
|
PlayAnim(fixLinks[linkIndex].fixLinkEnum);
|
|
}
|
|
}
|
|
|
|
|
|
//播放 拆卸/安装 动画
|
|
private void PlayAnim(FixLinkEnum linkEnum)
|
|
{
|
|
Game.StartCoroutine(SimulateAnimOver());
|
|
}
|
|
|
|
//动画不存在时制作时模拟动画播放完成逻辑
|
|
IEnumerator SimulateAnimOver()
|
|
{
|
|
yield return new WaitForSeconds(5f);
|
|
Debug.LogError("动画还没有!");
|
|
AnimOver();
|
|
}
|
|
|
|
//动画播放完成 注册到动画管理类中 动画结束时调用
|
|
private void AnimOver()
|
|
{
|
|
if (linkIndex < fixLinks.Count - 1)//存在未完成的环节
|
|
{
|
|
linkIndex++;
|
|
StepWindowCtrl.ActiveWindow(fixLinks[linkIndex].steps, PlanningStepOver);//继续规划步骤
|
|
}
|
|
else//结束场景 传回消息事件
|
|
{
|
|
//NetResultMsg resultMsg = new NetResultMsg();//计算成绩返回等待界面
|
|
////resultMsg.score = score;
|
|
//resultMsg.errors = StudentOperateRecorder.Instance.GetAllOperate();
|
|
NetAnswerSheet resultMsg = StudentOperateRecorder.Instance.GetResultMsg();
|
|
TCPManager.Instance.SendNetMsg<NetAnswerSheet>(resultMsg, NetMsgName.AnswerSheet);//传回评估结果
|
|
//StudentOperateRecorder.Instance.Clear();//设置科目时自动清空
|
|
//SceneSystem.Instance.SetScene(new StudentLoginScene(LoadSceneType.Login));//否则完成编辑 返回初始界面
|
|
Push(new WaitResultPanel());
|
|
}
|
|
}
|
|
}
|