This commit is contained in:
wangyang 2025-05-22 18:05:24 +08:00
commit 2991508c36
6 changed files with 93 additions and 29 deletions

View File

@ -8,6 +8,10 @@ using UnityEngine;
/// </summary> /// </summary>
public class OfficeManager : SingletonMono<OfficeManager> public class OfficeManager : SingletonMono<OfficeManager>
{ {
public GameObject currentTool;
public Transform spawnToolPos;
public Transform tMDTips;
/// <summary> /// <summary>
/// ÊÖ»ú /// ÊÖ»ú
@ -21,11 +25,17 @@ public class OfficeManager : SingletonMono<OfficeManager>
//GameManager.EventMgr.AddEventListener(Enum_EventType.OfficeTimeLineOver, OfficeTimeLineOver); //GameManager.EventMgr.AddEventListener(Enum_EventType.OfficeTimeLineOver, OfficeTimeLineOver);
//GameManager.EventMgr.AddEventListener<bool>(Enum_EventType.PlayerCanMove, SwitchFirstPersonControllerMove); //GameManager.EventMgr.AddEventListener<bool>(Enum_EventType.PlayerCanMove, SwitchFirstPersonControllerMove);
GameManager.EventMgr.AddEventListener(Enum_EventType.InitializationUI, InitializationUI); GameManager.EventMgr.AddEventListener(Enum_EventType.InitializationUI, InitializationUI);
GameManager.RunModelMgr.SceneType = E_SceneType.Site;
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study) if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{ {
GameManager.EventMgr.AddEventListener<int>(Enum_EventType.SwitchSubProcess, SwitchSubProcess); GameManager.EventMgr.AddEventListener<int>(Enum_EventType.SwitchSubProcess, SwitchSubProcess);
} }
InitializationUI(); InitializationUI();
GameManager.EventMgr.AddEventListener<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, SetSpawnToolInfo);
} }
public void SwitchFirstPersonControllerMove(bool isMove) public void SwitchFirstPersonControllerMove(bool isMove)
@ -97,6 +107,8 @@ public class OfficeManager : SingletonMono<OfficeManager>
{ {
//GameManager.EventMgr.RemoveEventListener(Enum_EventType.OfficeTimeLineOver, OfficeTimeLineOver); //GameManager.EventMgr.RemoveEventListener(Enum_EventType.OfficeTimeLineOver, OfficeTimeLineOver);
GameManager.EventMgr.RemoveEventListener(Enum_EventType.InitializationUI, InitializationUI); GameManager.EventMgr.RemoveEventListener(Enum_EventType.InitializationUI, InitializationUI);
GameManager.EventMgr.RemoveEventListener<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, SetSpawnToolInfo);
//GameManager.EventMgr.RemoveEventListener<bool>(Enum_EventType.PlayerCanMove, SwitchFirstPersonControllerMove); //GameManager.EventMgr.RemoveEventListener<bool>(Enum_EventType.PlayerCanMove, SwitchFirstPersonControllerMove);
if (GameManager.UIMgr.GetPanel<UI_MiddleTipPanel>()) if (GameManager.UIMgr.GetPanel<UI_MiddleTipPanel>())
{ {
@ -106,4 +118,56 @@ public class OfficeManager : SingletonMono<OfficeManager>
//GameManager.EventMgr.RemoveEventListener<int>(Enum_EventType.SwitchSubProcess, SwitchSubProcess); //GameManager.EventMgr.RemoveEventListener<int>(Enum_EventType.SwitchSubProcess, SwitchSubProcess);
} }
//ÒÆÖ²ÓÚLiveSceneManager
public void SetSpawnToolInfo(GameObject tool)
{
if (tool == null)
return;
currentTool = tool;
currentTool.transform.parent = Camera.main.transform;
currentTool.transform.localPosition = spawnToolPos.localPosition;
currentTool.transform.localEulerAngles = spawnToolPos.localEulerAngles;
if (currentTool.GetComponent<Tool_Base>())
{
currentTool.GetComponent<Tool_Base>().SetHeadPosAndEulerang(currentTool.transform.localPosition, currentTool.transform.localEulerAngles);
currentTool.GetComponent<Tool_Base>().AddStartAction(() =>
{
tMDTips.gameObject.SetActive(false);
});
currentTool.GetComponent<Tool_Base>().AddEndAction(() =>
{
tMDTips.gameObject.SetActive(true);
});
}
if (currentTool.GetComponent<Device_Base>())
{
currentTool.GetComponent<Device_Base>().SetHeadPosAndEulerang(currentTool.transform.localPosition, currentTool.transform.localEulerAngles);
}
tMDTips.gameObject.SetActive(true);
}
public void OnCheckSubProcess(bool ifdestroy = true)
{
if (currentTool != null)
{
if (tMDTips != null)
tMDTips.gameObject.SetActive(false);
if (ifdestroy)
DestroyImmediate(currentTool);
currentTool = null;
GameManager.EventMgr.EventTrigger<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, null);
}
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (currentTool != null)
{
Debug.Log("Escape");
OnCheckSubProcess();
}
}
}
} }

View File

@ -79,28 +79,28 @@ public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
Destroy(gameObject); Destroy(gameObject);
break; break;
case "iconBtn": case "iconBtn":
bool isWorkCard = currentItem.toolName.Equals("工作证") ? false : true; //bool isWorkCard = currentItem.toolName.Equals("工作证") ? false : true;
if (currentItem.toolName.Equals("工作证") && !LiveSceneManager.Instance.npcCustomController.isClose) //if (currentItem.toolName.Equals("工作证") && !LiveSceneManager.Instance.npcCustomController.isClose)
{ //{
if (GameManager.UIMgr.GetPanel<UI_MiddleTipPanel>() != null) // if (GameManager.UIMgr.GetPanel<UI_MiddleTipPanel>() != null)
GameManager.UIMgr.GetPanel<UI_MiddleTipPanel>().Init("提示:请移动到交互对象附近"); // GameManager.UIMgr.GetPanel<UI_MiddleTipPanel>().Init("提示:请移动到交互对象附近");
if (GameManager.UIMgr.GetPanel<UI_MiddleTipPanel>() == null) // if (GameManager.UIMgr.GetPanel<UI_MiddleTipPanel>() == null)
{ // {
GameManager.UIMgr.ShowPanel<UI_MiddleTipPanel>(E_UI_Layer.System, (p) => // GameManager.UIMgr.ShowPanel<UI_MiddleTipPanel>(E_UI_Layer.System, (p) =>
{ // {
p.Init($"提示:请移动到交互对象附近"); // p.Init($"提示:请移动到交互对象附近");
}); // });
} // }
//GameManager.UIMgr.ShowPanel<UI_MiddleTipPanel>(E_UI_Layer.System, (p) => // //GameManager.UIMgr.ShowPanel<UI_MiddleTipPanel>(E_UI_Layer.System, (p) =>
//{ // //{
// p.Init($"提示:请移动到交互对象附近"); // // p.Init($"提示:请移动到交互对象附近");
//}); // //});
GameManager.EventMgr?.EventTrigger<bool>(Enum_EventType.PlayerCanMove, true); // GameManager.EventMgr?.EventTrigger<bool>(Enum_EventType.PlayerCanMove, true);
return; // return;
} //}
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(currentItem.toolName, isWorkCard) == 0) //if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(currentItem.toolName, isWorkCard) == 0)
{ //{
GameManager.UIMgr.HidePanel<UI_ToolAndMaterialPanel>(); GameManager.UIMgr.HidePanel<UI_ToolAndMaterialPanel>();
GameObject currentTool = Instantiate(currentItem.objPrefab); GameObject currentTool = Instantiate(currentItem.objPrefab);
currentTool.GetComponent<BaseToolOrDevice>().enabled = false; currentTool.GetComponent<BaseToolOrDevice>().enabled = false;
@ -109,7 +109,7 @@ public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
GameManager.EventMgr.EventTrigger<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, currentTool); GameManager.EventMgr.EventTrigger<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, currentTool);
if (currentTool.name != "ľçÄÜąíĐŁŃéŇÇĆ÷") if (currentTool.name != "ľçÄÜąíĐŁŃéŇÇĆ÷")
GameManager.UIMgr.imageTips.HideTips(); GameManager.UIMgr.imageTips.HideTips();
} //}
break; break;
} }
} }

View File

@ -314,10 +314,10 @@ public class UI_MenuBar : BasePanel
} }
break; break;
case "ToolKitBtn": case "ToolKitBtn":
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(toolKitName, true) == 0) //if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(toolKitName, true) == 0)
{ //{
GameManager.UIMgr.ShowPanel<UI_ToolAndMaterialPanel>(E_UI_Layer.Mid); GameManager.UIMgr.ShowPanel<UI_ToolAndMaterialPanel>(E_UI_Layer.Mid);
} //}
break; break;
case "NotifyBtn": case "NotifyBtn":
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(notifyName, false) == 0) if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(notifyName, false) == 0)

View File

@ -16,8 +16,8 @@ public class UI_TaskListPanel : BasePanel
public void Init(int subProcessID) public void Init(int subProcessID)
{ {
rePractice.SetActive(GameManager.RunModelMgr.ModeType == E_ModeType.Practice); //rePractice.SetActive(GameManager.RunModelMgr.ModeType == E_ModeType.Practice);
reStudy.SetActive(GameManager.RunModelMgr.ModeType == E_ModeType.Study); //reStudy.SetActive(GameManager.RunModelMgr.ModeType == E_ModeType.Study);
taskListScrollView.SetActive(GameManager.RunModelMgr.ModeType == E_ModeType.Study); taskListScrollView.SetActive(GameManager.RunModelMgr.ModeType == E_ModeType.Study);
GetControl<Button>("BackBtn").gameObject.SetActive(GameManager.RunModelMgr.ModeType != E_ModeType.Exam); GetControl<Button>("BackBtn").gameObject.SetActive(GameManager.RunModelMgr.ModeType != E_ModeType.Exam);
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study) if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)

View File

@ -25,7 +25,7 @@ public class UI_ToolAndMaterialPanel : BasePanel
CreatItem(E_ToolOrDeviceOrMaterials.Tool); //默认打开显示工器具 CreatItem(E_ToolOrDeviceOrMaterials.Tool); //默认打开显示工器具
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study) if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{ {
GetControl<Button>("closeBtn").gameObject.SetActive(false); //GetControl<Button>("closeBtn").gameObject.SetActive(false);
GameManager.EventMgr.AddEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID); GameManager.EventMgr.AddEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
Debug.Log("注册高亮 UI_ToolAndMaterialPanel"); Debug.Log("注册高亮 UI_ToolAndMaterialPanel");
//手动高亮 //手动高亮

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<TB_System id="10002" systemName="酿酒高粱的形态特征及类型识别" loadName="酿酒高粱的形态特征及类型识别" titleName="酿酒高粱的形态特征及类型识别"> <TB_System id="10002" systemName="酿酒高粱的形态特征及类型识别" loadName="酿酒高粱的形态特征及类型识别" titleName="酿酒高粱的形态特征及类型识别">
<Subject id="2002" deviceTypeId="20002" schemeName="酿酒高粱的形态特征及类型识别" deviceMap="单相表" isFault="0" schemeDes="" ToolOrMaterilOrDevice="剥线钳,绝缘螺丝刀,验电笔,国网安全帽,工作服,编织手套,绝缘靴,工作证,盒装封印,绝缘胶带,三相四线费控智能电能表"> <Subject id="2002" deviceTypeId="20002" schemeName="酿酒高粱的形态特征及类型识别" deviceMap="单相表" isFault="0" schemeDes="" ToolOrMaterilOrDevice="剥线钳,绝缘螺丝刀">
<Process id="" processName="观察高粱特征" processDes=""> <Process id="" processName="观察高粱特征" processDes="">
<Step id="" subProcessName="从老师处拿取工具" isPrecondition="FALSE" precondition="" tipTitle="" tips=""> <Step id="" subProcessName="从老师处拿取工具" isPrecondition="FALSE" precondition="" tipTitle="" tips="">
<operation id="" subProcessStepName="填写拆装工作单" isPrecondition="" precondition="Office" triggerID="拆装工单按钮" tipTitle="请填写拆装工作单" score=""></operation> <operation id="" subProcessStepName="填写拆装工作单" isPrecondition="" precondition="Office" triggerID="拆装工单按钮" tipTitle="请填写拆装工作单" score=""></operation>