diff --git a/Assets/ArtRes/Sprite/UI_Panel/UI_ProcessTipPanel/任务感叹号按钮.png.meta b/Assets/ArtRes/Sprite/UI_Panel/UI_ProcessTipPanel/任务感叹号按钮.png.meta index d7d7a3d..07697e3 100644 --- a/Assets/ArtRes/Sprite/UI_Panel/UI_ProcessTipPanel/任务感叹号按钮.png.meta +++ b/Assets/ArtRes/Sprite/UI_Panel/UI_ProcessTipPanel/任务感叹号按钮.png.meta @@ -67,7 +67,7 @@ TextureImporter: platformSettings: - serializedVersion: 3 buildTarget: DefaultTexturePlatform - maxTextureSize: 8192 + maxTextureSize: 64 resizeAlgorithm: 0 textureFormat: -1 textureCompression: 1 diff --git a/Assets/Scripts/CXX/Devices/Device_Base.cs b/Assets/Scripts/CXX/Devices/Device_Base.cs index b1bc1c0..b9b1a44 100644 --- a/Assets/Scripts/CXX/Devices/Device_Base.cs +++ b/Assets/Scripts/CXX/Devices/Device_Base.cs @@ -13,6 +13,10 @@ public class Device_Base : PermanentTriggerBase /// trigger¼ /// public Func triggerAction; + /// + /// Ƿƶ + /// + public bool isMoving; private Vector3 head_LocalPos; private Vector3 head_LocalEulerAnglesl; diff --git a/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_3Phase4WireMeter.cs b/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_3Phase4WireMeter.cs index 525d457..7240442 100644 --- a/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_3Phase4WireMeter.cs +++ b/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_3Phase4WireMeter.cs @@ -184,11 +184,13 @@ public class Device_3Phase4WireMeter : Device_Base //µܱ if (!fix_screw_left.isInstall && !fix_screw_right.isInstall) { + startAction?.Invoke(); SiteManager.instance.measuringCabinet.meteringDevice = null; Debug.Log("ܱѲ"); transform.DOLocalMove(transform.localPosition - new Vector3(0, 0.2f, 0.2f), 2).OnComplete(() => { CallScoreAction(false); + endAction?.Invoke(); gameObject.SetActive(false); }); } @@ -203,6 +205,7 @@ public class Device_3Phase4WireMeter : Device_Base SiteManager.instance.measuringCabinet.meteringDevice = this; //ĬDz״̬ Init(false); + startAction?.Invoke(); transform.DOLocalMove(new Vector3(0.1469002f, -0.1793365f, 0.5191498f), 2).OnStart(() => { transform.localEulerAngles = Vector3.zero; @@ -211,6 +214,7 @@ public class Device_3Phase4WireMeter : Device_Base LiveSceneManager.Instance.currentTool = null; Debug.Log("ܱѰװ"); CallScoreAction(true); + endAction?.Invoke(); }); } } diff --git a/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_Cover.cs b/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_Cover.cs index 59c5a1c..50d2df9 100644 --- a/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_Cover.cs +++ b/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_Cover.cs @@ -31,21 +31,24 @@ public class Device_Cover : Device_Base protected override void OnMDown() { base.OnMDown(); - if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0) + if (!isMoving) { - isCheckOK = true; + if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0) + { + isCheckOK = true; - if (!isOpen) - { - //˿šɲܲ - if (!cover_screw_Left.isInstall && !cover_screw_Right.isInstall) + if (!isOpen) { - Open(); + //˿šɲܲ + if (!cover_screw_Left.isInstall && !cover_screw_Right.isInstall) + { + Open(); + } + } + else + { + Close(); } - } - else - { - Close(); } } } @@ -58,17 +61,21 @@ public class Device_Cover : Device_Base //˿ڶܶ if (!cover_screw_Left.isMoving && !cover_screw_Right.isMoving) { + isMoving = true; Debug.Log("򿪸"); - isOpen = true; - + startAction?.Invoke(); Transform parent = cover_screw_Left.transform.parent; cover_screw_Left.transform.parent = transform; cover_screw_Right.transform.parent = transform; transform.DOLocalMove(new Vector3(transform.localPosition.x, -0.1388763f, -0.2485413f), 2).OnComplete(() => { + isOpen = true; cover_screw_Left.transform.parent = parent; cover_screw_Right.transform.parent = parent; + isMoving = false; + int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true)); + endAction?.Invoke(); }); } } @@ -81,17 +88,21 @@ public class Device_Cover : Device_Base //˿ڶܶ if (!cover_screw_Left.isMoving && !cover_screw_Right.isMoving) { + isMoving=true; Debug.Log("ϸ"); - isOpen = false; - + startAction?.Invoke(); Transform parent = cover_screw_Left.transform.parent; cover_screw_Left.transform.parent = transform; cover_screw_Right.transform.parent = transform; transform.DOLocalMove(new Vector3(transform.localPosition.x, 0.01112366f, -0.09854126f), 2).OnComplete(() => { + isOpen = false; cover_screw_Left.transform.parent = parent; cover_screw_Right.transform.parent = parent; + isMoving = false; + int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true)); + endAction?.Invoke(); }); } } diff --git a/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_NamePlate.cs b/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_NamePlate.cs index ecb116a..4fe5d69 100644 --- a/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_NamePlate.cs +++ b/Assets/Scripts/CXX/Devices/直接接入式电能计量装置/Device_NamePlate.cs @@ -34,6 +34,7 @@ public class Device_NamePlate : Device_Base GameObject tip = Instantiate(checkUiPrefb, GameManager.UIMgr.canvas.transform); ProcessTipPanel processTipPanel = tip.GetComponent(); + startAction?.Invoke(); //ʼ߽ processTipPanel.StartProcess(result => { @@ -49,6 +50,7 @@ public class Device_NamePlate : Device_Base } int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true)); CallScoreAction(); + endAction?.Invoke(); } }); } diff --git a/Assets/Scripts/CXX/Devices/计量柜/Device_CabinetDoor.cs b/Assets/Scripts/CXX/Devices/计量柜/Device_CabinetDoor.cs index 16fa77a..b929175 100644 --- a/Assets/Scripts/CXX/Devices/计量柜/Device_CabinetDoor.cs +++ b/Assets/Scripts/CXX/Devices/计量柜/Device_CabinetDoor.cs @@ -23,6 +23,7 @@ public class Device_CabinetDoor : Device_Base public void Open() { Debug.Log(""); + startAction?.Invoke(); // transform.Find("2/3").DOLocalRotate(new Vector3(-45f, 0, 0), 1).OnComplete(() => { @@ -30,12 +31,14 @@ public class Device_CabinetDoor : Device_Base transform.DOLocalRotate(new Vector3(0, 0, 180), 3).OnComplete(() => { isOpen = true; + endAction?.Invoke(); }); }); } public void Close() { Debug.Log(""); + startAction?.Invoke(); // transform.DOLocalRotate(new Vector3(0, 0, 0), 3).OnComplete(() => { @@ -43,6 +46,7 @@ public class Device_CabinetDoor : Device_Base transform.Find("2/3").DOLocalRotate(new Vector3(0, 0, 0), 1).OnComplete(() => { isOpen = false; + endAction?.Invoke(); }); }); } diff --git a/Assets/Scripts/CXX/Tools/Tool_Base.cs b/Assets/Scripts/CXX/Tools/Tool_Base.cs index 9418304..3f00d11 100644 --- a/Assets/Scripts/CXX/Tools/Tool_Base.cs +++ b/Assets/Scripts/CXX/Tools/Tool_Base.cs @@ -90,6 +90,7 @@ public class Tool_Base : PermanentTriggerBase transform.localPosition = head_LocalPos; transform.localEulerAngles = head_LocalEulerAnglesl; isMoving = false; + endAction?.Invoke(); }); } } diff --git a/Assets/Scripts/CXX/Tools/Tool_Screw.cs b/Assets/Scripts/CXX/Tools/Tool_Screw.cs index d7ba4ee..f975cc3 100644 --- a/Assets/Scripts/CXX/Tools/Tool_Screw.cs +++ b/Assets/Scripts/CXX/Tools/Tool_Screw.cs @@ -55,36 +55,24 @@ public class Tool_Screw : Tool_Base /// public void BeInstalled(Tool_Screwdriver screwdriver) { - if (!isMoving && !screwdriver.isMoving) - { - isMoving = true; - screwdriver.isMoving = true; - Debug.Log("ʼš˿"); - //˿ʼλ - screwdriver.transform.parent = null; - screwdriver.transform.DOLocalRotate(installPos.localEulerAngles, 0.5f); - screwdriver.transform.DOMove(installPos.position, 1).OnComplete(() => + // + transform.DOLocalMoveY(initPostionY, 1) + .OnUpdate(() => { - // - transform.DOLocalMoveY(initPostionY, 1) - .OnUpdate(() => - { - transform.RotateAroundLocal(Vector3.up, 1); - screwdriver.transform.position = installPos.position; - screwdriver.transform.RotateAroundLocal(Vector3.right, 10); - }) - .OnComplete(() => - { - Debug.Log("˿š"); - isInstall = true; - isMoving = false; - screwdriver.isMoving = false; - installAction?.Invoke(true); - screwdriver.ReBackHead(); - CallScoreAction(true); - }); + transform.RotateAroundLocal(Vector3.up, 1); + screwdriver.transform.position = installPos.position; + screwdriver.transform.RotateAroundLocal(Vector3.right, 10); + }) + .OnComplete(() => + { + Debug.Log("˿š"); + isInstall = true; + isMoving = false; + screwdriver.isMoving = false; + installAction?.Invoke(true); + screwdriver.ReBackHead(); + CallScoreAction(true); }); - } } /// @@ -93,35 +81,23 @@ public class Tool_Screw : Tool_Base /// public void BeUnInstalled(Tool_Screwdriver screwdriver) { - if (!isMoving && !screwdriver.isMoving) - { - isMoving = true; - screwdriver.isMoving = true; - Debug.Log("ʼж˿"); - //˿ʼλ - screwdriver.transform.parent = null; - screwdriver.transform.DOLocalRotate(installPos.localEulerAngles, 0.5f); - screwdriver.transform.DOMove(installPos.position, 1).OnComplete(() => + // + transform.DOLocalMoveY(initPostionY - 0.02f, 1) + .OnUpdate(() => { - // - transform.DOLocalMoveY(initPostionY - 0.02f, 1) - .OnUpdate(() => - { - transform.RotateAroundLocal(Vector3.up, 1); - screwdriver.transform.position = installPos.position; - screwdriver.transform.RotateAroundLocal(Vector3.right, 10); - }) - .OnComplete(() => - { - Debug.Log("˿š"); - isInstall = false; - isMoving = false; - screwdriver.isMoving = false; - installAction?.Invoke(false); - screwdriver.ReBackHead(); - CallScoreAction(false); - }); + transform.RotateAroundLocal(Vector3.up, 1); + screwdriver.transform.position = installPos.position; + screwdriver.transform.RotateAroundLocal(Vector3.right, 10); + }) + .OnComplete(() => + { + Debug.Log("˿š"); + isInstall = false; + isMoving = false; + screwdriver.isMoving = false; + installAction?.Invoke(false); + screwdriver.ReBackHead(); + CallScoreAction(false); }); - } } } diff --git a/Assets/Scripts/CXX/Tools/Tool_Screwdriver.cs b/Assets/Scripts/CXX/Tools/Tool_Screwdriver.cs index 1cc3efa..fabc7ac 100644 --- a/Assets/Scripts/CXX/Tools/Tool_Screwdriver.cs +++ b/Assets/Scripts/CXX/Tools/Tool_Screwdriver.cs @@ -14,9 +14,19 @@ public class Tool_Screwdriver : Tool_Base /// public void Install(Tool_Screw screw) { - if (!screw.isInstall) + if (!screw.isInstall && !screw.isMoving && !isMoving) { - screw.BeInstalled(this); + screw.isMoving = true; + isMoving = true; + Debug.Log("ʼš˿"); + startAction?.Invoke(); + //˿Ƶ˿ + transform.parent = null; + transform.DOLocalRotate(screw.installPos.localEulerAngles, 0.5f); + transform.DOMove(screw.installPos.position, 1).OnComplete(() => + { + screw.BeInstalled(this); + }); } } @@ -26,9 +36,19 @@ public class Tool_Screwdriver : Tool_Base /// public void UnInstall(Tool_Screw screw) { - if (screw.isInstall) + if (screw.isInstall && !screw.isMoving && !isMoving) { - screw.BeUnInstalled(this); + screw.isMoving = true; + isMoving = true; + Debug.Log("ʼж˿"); + startAction?.Invoke(); + //˿Ƶ˿ + transform.parent = null; + transform.DOLocalRotate(screw.installPos.localEulerAngles, 0.5f); + transform.DOMove(screw.installPos.position, 1).OnComplete(() => + { + screw.BeUnInstalled(this); + }); } } diff --git a/Assets/Scripts/CXX/Tools/Tool_TestPen.cs b/Assets/Scripts/CXX/Tools/Tool_TestPen.cs index bc7cdbd..829bbc4 100644 --- a/Assets/Scripts/CXX/Tools/Tool_TestPen.cs +++ b/Assets/Scripts/CXX/Tools/Tool_TestPen.cs @@ -116,6 +116,7 @@ public class Tool_TestPen : Tool_Base if (tool_base.toolType == ToolType.˿) { var tmp = ((Tool_Screw)tool_base); + base.startAction?.Invoke(); //λƶ transform.parent = null; transform.DOLocalRotate(tmp.installPos.localEulerAngles, 0.5f); diff --git a/Assets/Scripts/CXX/Tools/Tool_WireStripper.cs b/Assets/Scripts/CXX/Tools/Tool_WireStripper.cs index 3e601f6..a131a11 100644 --- a/Assets/Scripts/CXX/Tools/Tool_WireStripper.cs +++ b/Assets/Scripts/CXX/Tools/Tool_WireStripper.cs @@ -15,7 +15,8 @@ public class Tool_WireStripper : Tool_Base /// public void CutOpen(Device_Seal device_Seal) { - isMoving = true; + base.startAction?.Invoke(); + base.isMoving = true; transform.parent = null; transform.DORotate(device_Seal.testPosAndRot.eulerAngles, 0.5f); transform.DOMove(device_Seal.testPosAndRot.position, 1).OnComplete(() => diff --git a/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs b/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs index adef67b..015c8ca 100644 --- a/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs +++ b/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs @@ -18,6 +18,14 @@ public class PermanentTriggerBase : MonoBehaviour /// ¼ /// private Action scoreAction; + /// + /// ʼĻصΪ↑ʼʹʱã豸Ϊʼʱã + /// + protected Action startAction; + /// + /// صΪصʱã豸Ϊʱã + /// + protected Action endAction; private void Awake() {