diff --git a/Assets/Scenes/10002_1002计量装置轮换及现场校验仿真_直接接入式电能计量装置装拆及验收标准化作业指导书/10002_1002_05_LiveScene.unity b/Assets/Scenes/10002_1002计量装置轮换及现场校验仿真_直接接入式电能计量装置装拆及验收标准化作业指导书/10002_1002_05_LiveScene.unity index 8b314c0..220c501 100644 --- a/Assets/Scenes/10002_1002计量装置轮换及现场校验仿真_直接接入式电能计量装置装拆及验收标准化作业指导书/10002_1002_05_LiveScene.unity +++ b/Assets/Scenes/10002_1002计量装置轮换及现场校验仿真_直接接入式电能计量装置装拆及验收标准化作业指导书/10002_1002_05_LiveScene.unity @@ -3077,6 +3077,7 @@ MonoBehaviour: animatorParameters: target: {fileID: 1501092963} minDistance: 2 + isClose: 0 --- !u!136 &890581131 CapsuleCollider: m_ObjectHideFlags: 0 @@ -4753,6 +4754,7 @@ MonoBehaviour: animatorParameters: NPCState target: {fileID: 1501092963} minDistance: 2 + isClose: 0 --- !u!4 &1198127457 Transform: m_ObjectHideFlags: 0 @@ -6310,6 +6312,7 @@ MonoBehaviour: spawnToolPos: {fileID: 1927580343} tMDTips: {fileID: 1180096483} triggerName: "\u6536\u56DE\u5DE5\u5177" + npcCustomController: {fileID: 890581130} device_Control: {fileID: 1723332379} --- !u!4 &2109812127 Transform: diff --git a/Assets/Scripts/CXX/StepState/1002/StepState_1002.cs b/Assets/Scripts/CXX/StepState/1002/StepState_1002.cs index 1abf9dd..3571eae 100644 --- a/Assets/Scripts/CXX/StepState/1002/StepState_1002.cs +++ b/Assets/Scripts/CXX/StepState/1002/StepState_1002.cs @@ -44,7 +44,7 @@ public class StepState_1002 : StepState /// public override void SetStepState(int num, int lastNum) { - Debug.Log("л"+num); + Debug.Log("л" + num); //ɾĶ LiveSceneManager.Instance?.OnCheckSubProcess(); @@ -52,20 +52,24 @@ public class StepState_1002 : StepState { //鿴 OfficeManager.Instance.mobileController.downIndex = 0; + PacksackBagMgr.Instance.ClearAllData(); } else if (num == 2) { //ԤԼ OfficeManager.Instance.mobileController.downIndex = 1; + PacksackBagMgr.Instance.ClearAllData(); } else if (num == 3) { //Ʊ OfficeManager.Instance.mobileController.downIndex = 2; + PacksackBagMgr.Instance.ClearAllData(); } else if (num == 4) { //дװ𹤵 + PacksackBagMgr.Instance.ClearAllData(); } else if (num == 5) { @@ -74,7 +78,7 @@ public class StepState_1002 : StepState //ձ PacksackBagMgr.Instance.ClearAllToolAndDiveceAndMaterial(); - + TooRoomMannger.Instance.CheckWearByWearDic(); //ɵһȥ߼ if (num == lastNum) { @@ -93,8 +97,8 @@ public class StepState_1002 : StepState //ѡȡ //װõ - List items=ToolAndmaterialMgr.Instance.GetItemInfoByName(new List { "ȫñ", "", "Ե", "Եѥ" }); - items.ForEach(item => + List items = ToolAndmaterialMgr.Instance.GetItemInfoByName(new List { "ȫñ", "", "Ե", "Եѥ" }); + items.ForEach(item => { PacksackBagMgr.Instance.AddOneToolOrMater(item.itemInfo); Destroy(item.gameObject); @@ -129,9 +133,9 @@ public class StepState_1002 : StepState //ձ PacksackBagMgr.Instance.ClearAllData(); //ɷװ - List items=ToolAndmaterialMgr.Instance.CreateItemInfoByName(new List { "ȫñ", "", "Ե", "Եѥ" }); + List items = ToolAndmaterialMgr.Instance.CreateItemInfoByName(new List { "ȫñ", "", "Ե", "Եѥ" }); //뱳 - items.ForEach(item => + items.ForEach(item => { PacksackBagMgr.Instance.AddOneToolOrMater(item); // @@ -139,7 +143,7 @@ public class StepState_1002 : StepState }); //ɹ List items2 = ToolAndmaterialMgr.Instance.CreateItemInfoByName(new List { "ǯ", "Ե˿", "", "֤", "װӡ", "Ե", "ߵܱ" }); - items2.ForEach(item => + items2.ForEach(item => { PacksackBagMgr.Instance.AddOneToolOrMater(item); }); @@ -150,9 +154,9 @@ public class StepState_1002 : StepState device_Control.Init(); //ԭnpcԻ - GameObject.FindObjectsOfType().ToList().ForEach(a => + GameObject.FindObjectsOfType().ToList().ForEach(a => { - a.speackIndex = 0; + a.speackIndex = 0; a.spriteRenderer.gameObject.SetActive(true); }); } @@ -161,7 +165,7 @@ public class StepState_1002 : StepState //ǰ GameObject.FindObjectsOfType().ToList().Find(a => a.triggerName == "NPCͻ").spriteRenderer.gameObject.SetActive(false); } - else if (num == 9) + else if (num == 9) { //߼ @@ -171,12 +175,12 @@ public class StepState_1002 : StepState //ԭnpc GameObject.FindObjectsOfType().ToList().ForEach(a => { - if(a.triggerName == "NPC") + if (a.triggerName == "NPC") a.speackIndex = 1; a.spriteRenderer.gameObject.SetActive(false); }); } - else if(num == 10) + else if (num == 10) { //ϿԴ @@ -200,13 +204,13 @@ public class StepState_1002 : StepState //ԴϿ device_Control.inSwitch.CloseState(); } - else if(num== 12) + else if (num == 12) { //ܼװ //Ѷȡ device_Control.meteringDevice.namePlate.isChecked = true; } - else if( num == 13) + else if (num == 13) { //װܱ @@ -221,7 +225,7 @@ public class StepState_1002 : StepState device_Control.jieXian_lines.ForEach(screw => { screw.isConnected = false; - screw.transform.localPosition = new Vector3(screw.transform.localPosition.x, screw.InstallPosY-2, screw.transform.localPosition.z); + screw.transform.localPosition = new Vector3(screw.transform.localPosition.x, screw.InstallPosY - 2, screw.transform.localPosition.z); }); //ˢ´״̬ device_Control.CheckHasElectricity(); @@ -250,7 +254,7 @@ public class StepState_1002 : StepState //ˢ´״̬ device_Control.CheckHasElectricity(); } - else if(num== 15) + else if (num == 15) { //ֳͨ缰 @@ -258,7 +262,7 @@ public class StepState_1002 : StepState device_Control.check_JieXian.isChecked = true; device_Control.check_JieXian.GetComponent().enabled = false; } - else if(num== 16) + else if (num == 16) { //ʵʩӡ @@ -267,13 +271,13 @@ public class StepState_1002 : StepState //Ӹ device_Control.meteringDevice.CoverInstallState(); } - else if(num== 17) + else if (num == 17) { //д֪ device_Control.meteringDevice.cover.cover_seal_Left.Install(); device_Control.meteringDevice.cover.cover_seal_Right.Install(); } - else if(num== 18) + else if (num == 18) { //ֳ } diff --git a/Assets/Scripts/Project/Manager/GameManager.cs b/Assets/Scripts/Project/Manager/GameManager.cs index 80e7f7c..f72a16f 100644 --- a/Assets/Scripts/Project/Manager/GameManager.cs +++ b/Assets/Scripts/Project/Manager/GameManager.cs @@ -173,7 +173,7 @@ public class GameManager : SingletonAutoMono }); } /// - ///返回模式选择界面 + ///首次加载和返回模式选择界面 /// /// public void ShowUIPanelAndLoadScene(bool isReset = false) @@ -196,7 +196,7 @@ public class GameManager : SingletonAutoMono } /// - /// 练习 + /// 练习,重新练习会调用 /// public void Practice() { @@ -206,11 +206,6 @@ public class GameManager : SingletonAutoMono ProcessMgr.Init(RunModelMgr.schemeID, RunModelMgr.ModeType); UIMgr.ShowPanel(E_UI_Layer.System, (panel) => { - UIMgr.ShowPanel(E_UI_Layer.Bot, (panel) => - { - panel.Init(); - }); - panel.Init(); EventMgr.EventTrigger(Enum_EventType.UpdateProgress, 0.1f); ScenesMgr.LoadSceneAsyn($"{systemId}_{RunModelMgr.schemeID}_03_OfficeScene", () => @@ -235,8 +230,10 @@ public class GameManager : SingletonAutoMono UIMgr.HidePanel(); if (UIMgr.GetPanel()) UIMgr.HidePanel(); + UIMgr.GetPanel().ResetByModeType(); PacksackBagMgr.ClearAllData(); EventMgr.Clear(); + UIMgr.GetPanel().ShowMe(); ScoreManager.instance.ReInit(); RunModelMgr.startTime = DateTime.Now; Debug.Log("重置开始时间"); diff --git a/Assets/Scripts/Project/Manager/LiveSceneManager.cs b/Assets/Scripts/Project/Manager/LiveSceneManager.cs index 4405437..e5a6476 100644 --- a/Assets/Scripts/Project/Manager/LiveSceneManager.cs +++ b/Assets/Scripts/Project/Manager/LiveSceneManager.cs @@ -12,6 +12,7 @@ public class LiveSceneManager : SingletonMono public Transform spawnToolPos; public Transform tMDTips; public string triggerName; + public NPCController npcCustomController; //豸ƽű public Device_Control device_Control; @@ -38,6 +39,7 @@ public class LiveSceneManager : SingletonMono public void SetSpawnToolInfo(GameObject tool) { if (tool == null) return; + currentTool = tool; currentTool.transform.parent = Camera.main.transform; currentTool.transform.localPosition = spawnToolPos.localPosition; @@ -57,12 +59,6 @@ public class LiveSceneManager : SingletonMono if (currentTool.GetComponent()) { currentTool.GetComponent().SetHeadPosAndEulerang(currentTool.transform.localPosition, currentTool.transform.localEulerAngles); - currentTool.GetComponent().AddStartAction(() => - { - }); - currentTool.GetComponent().AddEndAction(() => - { - }); } tMDTips.gameObject.SetActive(true); if (currentTool.name.Equals("֤")) diff --git a/Assets/Scripts/Project/Manager/NetManager.cs b/Assets/Scripts/Project/Manager/NetManager.cs index 2662baa..995cd1c 100644 --- a/Assets/Scripts/Project/Manager/NetManager.cs +++ b/Assets/Scripts/Project/Manager/NetManager.cs @@ -21,17 +21,8 @@ public class NetManager : BaseManager public string token; public string url; - /// - /// UI_CheckTaskPanel面板内容的学习、练习模式可以外配,读取json的名称 - /// - string fileName = "10001.json"; - public string content { get; private set; } - [Serializable] - public class IPConfig - { - public string content; - } - + + /// @@ -67,69 +58,5 @@ public class NetManager : BaseManager string path = Application.streamingAssetsPath + "/Config/info.txt"; Debug.Log(path); File.WriteAllText(path, info); - } - - /// - /// UI_CheckTaskPanel面板内容的学习、练习模式用json读取,可以外配 - /// - /// - public void GetCheckTaskState(UnityAction action) - { - - MonoMgr.Instance.StartCoroutine(GetCheckTaskStateAsync(action)); - } - - private IEnumerator GetCheckTaskStateAsync(UnityAction action) - { - string path = System.IO.Path.Combine(Application.streamingAssetsPath, fileName); - UnityWebRequest request = UnityWebRequest.Get(path); - yield return request.SendWebRequest(); - - if (request.result != UnityWebRequest.Result.Success) - { - Debug.Log("Failed to load file: " + request.error); - } - else - { - // 获取文件内容 - string fileContent = request.downloadHandler.text; - IPConfig config = JsonUtility.FromJson(fileContent); - content = config.content; - Debug.Log(content); - action?.Invoke(true); - } - - } - - /// - /// UI_CheckTaskPanel面板内容的考试模式用接口调取 - /// - /// - public void GetCheckTaskExam(UnityAction action) - { - MonoMgr.Instance.StartCoroutine(GetCheckTaskExamAsync(action)); - } - - private IEnumerator GetCheckTaskExamAsync(UnityAction action) - { - using (UnityWebRequest unityWebRequest = UnityWebRequest.Post("", string.Empty)) - { - yield return unityWebRequest.SendWebRequest(); - if (unityWebRequest.result == UnityWebRequest.Result.Success) - { - Debug.Log("连接成功:*******************\n" + unityWebRequest.downloadHandler.text); - string json = unityWebRequest.downloadHandler.text; - action?.Invoke(true); - Debug.Log("连接成功 "); - } - else - { - Debug.Log("连接失败 "); - action?.Invoke(false); - } - } - - } - } diff --git a/Assets/Scripts/Project/Manager/OfficeManager.cs b/Assets/Scripts/Project/Manager/OfficeManager.cs index 8183068..20e0d0e 100644 --- a/Assets/Scripts/Project/Manager/OfficeManager.cs +++ b/Assets/Scripts/Project/Manager/OfficeManager.cs @@ -76,10 +76,10 @@ public class OfficeManager : SingletonMono if (!GameManager.UIMgr.GetPanel()) { GameManager.UIMgr.ShowPanel(E_UI_Layer.Mid, (panel) => - { - panel.Init(); - GameManager.EventMgr.EventTrigger(Enum_EventType.SwitchScene, GameManager.RunModelMgr.SceneType); - }); + { + panel.Init(); + GameManager.EventMgr.EventTrigger(Enum_EventType.SwitchScene, GameManager.RunModelMgr.SceneType); + }); } firstPersonController.gameObject.SetActive(true); } diff --git a/Assets/Scripts/Project/Manager/ProcessManager.cs b/Assets/Scripts/Project/Manager/ProcessManager.cs index af87b1a..bcc71b2 100644 --- a/Assets/Scripts/Project/Manager/ProcessManager.cs +++ b/Assets/Scripts/Project/Manager/ProcessManager.cs @@ -158,7 +158,7 @@ public class ProcessManager : BaseManager { Debug.Log($"完成所有"); //HQB 20240828完成后展示学习完成Tips - GameManager.UIMgr.ShowPanel(E_UI_Layer.System); + GameManager.UIMgr.ShowPanel(E_UI_Layer.Mid); return 0; } diff --git a/Assets/Scripts/Project/Manager/TooRoomMannger.cs b/Assets/Scripts/Project/Manager/TooRoomMannger.cs index beb7319..ba83232 100644 --- a/Assets/Scripts/Project/Manager/TooRoomMannger.cs +++ b/Assets/Scripts/Project/Manager/TooRoomMannger.cs @@ -30,7 +30,31 @@ public class TooRoomMannger : SingletonMono tmd.GetInfo(); } RemoveRepeat(); + CheckWearByWearDic(); } + + /// + /// ͨwearDicݼǷ + /// + public void CheckWearByWearDic() + { + var wearData = GameManager.PacksackBagMgr.wearDic; + if (wearData.Count > 0) + { + foreach (var item in wearData) + { + Wear(item.Key, true); + } + } + else + { + Wear("ȫñ", false); + Wear("", false); + Wear("Ե", false); + Wear("Եѥ", false); + } + } + public void SwitchFirstPersonControllerMove(bool isMove) { firstPersonController.playerCanMove = isMove; @@ -92,6 +116,14 @@ public class TooRoomMannger : SingletonMono } } + //public void ResetManWear() + //{ + // headSlot.GetComponent().material = _cancel.SingleOrDefault(s => s.name == "ȫñ"); + // bodySlot.GetComponent().material = _cancel.SingleOrDefault(s => s.name == ""); + // handSlot.GetComponent().material = _cancel.SingleOrDefault(s => s.name == "Ե"); + // shoesSlot.GetComponent().material = _cancel.SingleOrDefault(s => s.name == "Եѥ"); + //} + private void OnDestroy() { GameManager.EventMgr.RemoveEventListener(Enum_EventType.PlayerCanMove, SwitchFirstPersonControllerMove); diff --git a/Assets/Scripts/Project/Objects/Other/MirrorController.cs b/Assets/Scripts/Project/Objects/Other/MirrorController.cs index 9812ffa..d88dd28 100644 --- a/Assets/Scripts/Project/Objects/Other/MirrorController.cs +++ b/Assets/Scripts/Project/Objects/Other/MirrorController.cs @@ -24,6 +24,7 @@ public class MirrorController : PermanentTriggerBase if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, true) == 0) { GameManager.UIMgr.ShowPanel(E_UI_Layer.Mid); + _highlight.SetHighlighted(false); } } } diff --git a/Assets/Scripts/Project/Objects/Other/NPCController.cs b/Assets/Scripts/Project/Objects/Other/NPCController.cs index a25abb9..5723a89 100644 --- a/Assets/Scripts/Project/Objects/Other/NPCController.cs +++ b/Assets/Scripts/Project/Objects/Other/NPCController.cs @@ -15,7 +15,7 @@ public class NPCController : PermanentTriggerBase /// /// Ƿ񿿽 /// - private bool isClose = false; + public bool isClose = false; private void Update() { diff --git a/Assets/Scripts/Project/UI/UI_Item/UI_SubProcessItem.cs b/Assets/Scripts/Project/UI/UI_Item/UI_SubProcessItem.cs index 4ca0103..24fa229 100644 --- a/Assets/Scripts/Project/UI/UI_Item/UI_SubProcessItem.cs +++ b/Assets/Scripts/Project/UI/UI_Item/UI_SubProcessItem.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; +using System; public class UI_SubProcessItem : BaseItem { @@ -10,6 +11,7 @@ public class UI_SubProcessItem : BaseItem public int subProcessID; public int subProcessStepID; public string warnnigTips; + private Action cancelCallback; public void Init(D_SubProcess d_SubProcess, int subProcessID) { @@ -41,17 +43,20 @@ public class UI_SubProcessItem : BaseItem GetControl("learningTips").gameObject.SetActive(false); } /// - /// + /// ݴ״̬ȥлѧϰл /// - /// + /// true Ƿѧϰ ,false ǰ軹ûѧ꣬ȷҪл /// 0 δвת1 вת - public void OnResetClick(bool isReset, int state) + /// cancelCallback :еò֮ڵýѡѧϰ֮󣬵ȷϿѡȡҪ÷ + public void OnResetClick(bool isReset, int state, Action _cancelCallback = null) { warnnigTips = isReset ? "Ƿѧϰ" : "ǰ軹ûѧ꣬ȷҪл"; if (state == 0) OnClick("subProcessBtn"); else CheckSubProcess(); + if (_cancelCallback != null) + cancelCallback += _cancelCallback; } protected override void OnClick(string btnName) { @@ -68,6 +73,9 @@ public class UI_SubProcessItem : BaseItem break; } } + /// + /// Ƿѧϰ + /// private void CheckSubProcess() { GameManager.UIMgr.ShowPanel(E_UI_Layer.System, (p) => @@ -81,6 +89,9 @@ public class UI_SubProcessItem : BaseItem GameManager.EventMgr.EventTrigger(Enum_EventType.SwitchSubProcess, subProcessID); //֪ͨ GameManager.EventMgr.EventTrigger(Enum_EventType.SwitchSubProcessStepTriggerID, ProcessManager.Instance.subProcessStepTriggerID); + }, () => + { + cancelCallback?.Invoke(); }); }); } diff --git a/Assets/Scripts/Project/UI/UI_Item/UI_ToolOrMaterialsOrDeviceItem.cs b/Assets/Scripts/Project/UI/UI_Item/UI_ToolOrMaterialsOrDeviceItem.cs index eafd2a2..a88ec70 100644 --- a/Assets/Scripts/Project/UI/UI_Item/UI_ToolOrMaterialsOrDeviceItem.cs +++ b/Assets/Scripts/Project/UI/UI_Item/UI_ToolOrMaterialsOrDeviceItem.cs @@ -64,6 +64,18 @@ public class UI_ToolOrMaterialsOrDeviceItem : BaseItem break; case "iconBtn": bool isWorkCard = currentItem.toolName.Equals("֤") ? false : true; + if (GameManager.RunModelMgr.ModeType != E_ModeType.Study) + { + if (currentItem.toolName.Equals("֤") && !LiveSceneManager.Instance.npcCustomController.isClose) + { + GameManager.UIMgr.ShowPanel(E_UI_Layer.System, (p) => + { + p.Init($"ʾ:뿿"); + }); + GameManager.EventMgr.EventTrigger(Enum_EventType.TakeOutAndRetrievingTheTools, null); + return; + } + } if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(currentItem.toolName, isWorkCard) == 0) { GameManager.UIMgr.HidePanel(); diff --git a/Assets/Scripts/Project/UI/UI_Panel/UI_CheckTaskPanel.cs b/Assets/Scripts/Project/UI/UI_Panel/UI_CheckTaskPanel.cs index b8825ad..6dc050e 100644 --- a/Assets/Scripts/Project/UI/UI_Panel/UI_CheckTaskPanel.cs +++ b/Assets/Scripts/Project/UI/UI_Panel/UI_CheckTaskPanel.cs @@ -1,12 +1,16 @@ +using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; - +[Serializable] +public class Mission +{ + public string content; +} public class UI_CheckTaskPanel : BasePanel { - public override void ShowMe() { base.ShowMe(); @@ -19,41 +23,8 @@ public class UI_CheckTaskPanel : BasePanel } public void Init() { - switch (ProcessManager.Instance.mode) - { - case E_ModeType.Study: - NetManager.Instance.GetCheckTaskState((value) => - { - if (value) - { - GetControl("Text_Content").text = NetManager.Instance.content; - Debug.Log(NetManager.Instance.content); - } - }); - break; - case E_ModeType.Practice: - NetManager.Instance.GetCheckTaskState((value) => - { - if (value) - { - GetControl("Text_Content").text = NetManager.Instance.content; - Debug.Log(NetManager.Instance.content); - } - }); - break; - case E_ModeType.Exam: - NetManager.Instance.GetCheckTaskExam((value) => - { - if (value) - { - GetControl("Text_Content").text = NetManager.Instance.content; - Debug.Log(NetManager.Instance.content); - } - }); - break; - } - - + Mission jsonData = GameManager.JsonMgr.LoadData($"MissionData/{GameManager.RunModelMgr.schemeID.ToString()}"); + GetControl("Text_Content").text = jsonData.content; } protected override void OnClick(string btnName) diff --git a/Assets/Scripts/Project/UI/UI_Panel/UI_MainTitlePanel.cs b/Assets/Scripts/Project/UI/UI_Panel/UI_MainTitlePanel.cs index 80260aa..fbce933 100644 --- a/Assets/Scripts/Project/UI/UI_Panel/UI_MainTitlePanel.cs +++ b/Assets/Scripts/Project/UI/UI_Panel/UI_MainTitlePanel.cs @@ -16,7 +16,7 @@ public class UI_MainTitlePanel : BasePanel internal void Init() { SwitchTitleImg(); - SwitchMode(); + //SwitchMode(); SwitchUserName(); } @@ -27,14 +27,18 @@ public class UI_MainTitlePanel : BasePanel public override void ShowMe() { GameManager.EventMgr.AddEventListener(Enum_EventType.SwitchMode, SwitchMode); + GameManager.EventMgr.AddEventListener(Enum_EventType.InitializationUI, InitializationUI); } + + /// /// 隐藏 /// public override void HideMe() { GameManager.EventMgr.RemoveEventListener(Enum_EventType.SwitchMode, SwitchMode); + GameManager.EventMgr.RemoveEventListener(Enum_EventType.InitializationUI, InitializationUI); } /// @@ -58,14 +62,26 @@ public class UI_MainTitlePanel : BasePanel mode = "考试模式"; break; } - GetControl