Compare commits

..

No commits in common. "25ee0c522d8bda647f8bf8148d8cce254d06b59d" and "d78414e9236970de9eeefe309fb885a03e9b6fb4" have entirely different histories.

12 changed files with 77 additions and 109 deletions

View File

@ -67,7 +67,7 @@ TextureImporter:
platformSettings: platformSettings:
- serializedVersion: 3 - serializedVersion: 3
buildTarget: DefaultTexturePlatform buildTarget: DefaultTexturePlatform
maxTextureSize: 64 maxTextureSize: 8192
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1

View File

@ -13,10 +13,6 @@ public class Device_Base : PermanentTriggerBase
/// trigger触发事件 /// trigger触发事件
/// </summary> /// </summary>
public Func<string, bool, int> triggerAction; public Func<string, bool, int> triggerAction;
/// <summary>
/// 是否正在移动
/// </summary>
public bool isMoving;
private Vector3 head_LocalPos; private Vector3 head_LocalPos;
private Vector3 head_LocalEulerAnglesl; private Vector3 head_LocalEulerAnglesl;

View File

@ -184,13 +184,11 @@ public class Device_3Phase4WireMeter : Device_Base
//拆下电能表 //拆下电能表
if (!fix_screw_left.isInstall && !fix_screw_right.isInstall) if (!fix_screw_left.isInstall && !fix_screw_right.isInstall)
{ {
startAction?.Invoke();
SiteManager.instance.measuringCabinet.meteringDevice = null; SiteManager.instance.measuringCabinet.meteringDevice = null;
Debug.Log("电能表已拆除"); Debug.Log("电能表已拆除");
transform.DOLocalMove(transform.localPosition - new Vector3(0, 0.2f, 0.2f), 2).OnComplete(() => transform.DOLocalMove(transform.localPosition - new Vector3(0, 0.2f, 0.2f), 2).OnComplete(() =>
{ {
CallScoreAction(false); CallScoreAction(false);
endAction?.Invoke();
gameObject.SetActive(false); gameObject.SetActive(false);
}); });
} }
@ -205,7 +203,6 @@ public class Device_3Phase4WireMeter : Device_Base
SiteManager.instance.measuringCabinet.meteringDevice = this; SiteManager.instance.measuringCabinet.meteringDevice = this;
//默认是拆除的状态 //默认是拆除的状态
Init(false); Init(false);
startAction?.Invoke();
transform.DOLocalMove(new Vector3(0.1469002f, -0.1793365f, 0.5191498f), 2).OnStart(() => transform.DOLocalMove(new Vector3(0.1469002f, -0.1793365f, 0.5191498f), 2).OnStart(() =>
{ {
transform.localEulerAngles = Vector3.zero; transform.localEulerAngles = Vector3.zero;
@ -214,7 +211,6 @@ public class Device_3Phase4WireMeter : Device_Base
LiveSceneManager.Instance.currentTool = null; LiveSceneManager.Instance.currentTool = null;
Debug.Log("电能表已安装"); Debug.Log("电能表已安装");
CallScoreAction(true); CallScoreAction(true);
endAction?.Invoke();
}); });
} }
} }

View File

@ -31,25 +31,22 @@ public class Device_Cover : Device_Base
protected override void OnMDown() protected override void OnMDown()
{ {
base.OnMDown(); base.OnMDown();
if (!isMoving) if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0)
{ {
if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0) isCheckOK = true;
{
isCheckOK = true;
if (!isOpen) if (!isOpen)
{
//螺丝都拧松才能拆盖子
if (!cover_screw_Left.isInstall && !cover_screw_Right.isInstall)
{ {
//ÂÝË¿¶¼Å¡ËɲÅÄܲð¸Ç×Ó Open();
if (!cover_screw_Left.isInstall && !cover_screw_Right.isInstall)
{
Open();
}
}
else
{
Close();
} }
} }
else
{
Close();
}
} }
} }
@ -61,21 +58,17 @@ public class Device_Cover : Device_Base
//盖子螺丝不在动才能动盖子 //盖子螺丝不在动才能动盖子
if (!cover_screw_Left.isMoving && !cover_screw_Right.isMoving) if (!cover_screw_Left.isMoving && !cover_screw_Right.isMoving)
{ {
isMoving = true;
Debug.Log("打开盖子"); Debug.Log("打开盖子");
startAction?.Invoke(); isOpen = true;
Transform parent = cover_screw_Left.transform.parent; Transform parent = cover_screw_Left.transform.parent;
cover_screw_Left.transform.parent = transform; cover_screw_Left.transform.parent = transform;
cover_screw_Right.transform.parent = transform; cover_screw_Right.transform.parent = transform;
transform.DOLocalMove(new Vector3(transform.localPosition.x, -0.1388763f, -0.2485413f), 2).OnComplete(() => transform.DOLocalMove(new Vector3(transform.localPosition.x, -0.1388763f, -0.2485413f), 2).OnComplete(() =>
{ {
isOpen = true;
cover_screw_Left.transform.parent = parent; cover_screw_Left.transform.parent = parent;
cover_screw_Right.transform.parent = parent; cover_screw_Right.transform.parent = parent;
isMoving = false;
int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true)); int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
endAction?.Invoke();
}); });
} }
} }
@ -88,21 +81,17 @@ public class Device_Cover : Device_Base
//盖子螺丝不在动才能动盖子 //盖子螺丝不在动才能动盖子
if (!cover_screw_Left.isMoving && !cover_screw_Right.isMoving) if (!cover_screw_Left.isMoving && !cover_screw_Right.isMoving)
{ {
isMoving=true;
Debug.Log("盖上盖子"); Debug.Log("盖上盖子");
startAction?.Invoke(); isOpen = false;
Transform parent = cover_screw_Left.transform.parent; Transform parent = cover_screw_Left.transform.parent;
cover_screw_Left.transform.parent = transform; cover_screw_Left.transform.parent = transform;
cover_screw_Right.transform.parent = transform; cover_screw_Right.transform.parent = transform;
transform.DOLocalMove(new Vector3(transform.localPosition.x, 0.01112366f, -0.09854126f), 2).OnComplete(() => transform.DOLocalMove(new Vector3(transform.localPosition.x, 0.01112366f, -0.09854126f), 2).OnComplete(() =>
{ {
isOpen = false;
cover_screw_Left.transform.parent = parent; cover_screw_Left.transform.parent = parent;
cover_screw_Right.transform.parent = parent; cover_screw_Right.transform.parent = parent;
isMoving = false;
int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true)); int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
endAction?.Invoke();
}); });
} }
} }

View File

@ -34,7 +34,6 @@ public class Device_NamePlate : Device_Base
GameObject tip = Instantiate<GameObject>(checkUiPrefb, GameManager.UIMgr.canvas.transform); GameObject tip = Instantiate<GameObject>(checkUiPrefb, GameManager.UIMgr.canvas.transform);
ProcessTipPanel processTipPanel = tip.GetComponent<ProcessTipPanel>(); ProcessTipPanel processTipPanel = tip.GetComponent<ProcessTipPanel>();
startAction?.Invoke();
//¿ªÊ¼×ß½ø¶È //¿ªÊ¼×ß½ø¶È
processTipPanel.StartProcess(result => processTipPanel.StartProcess(result =>
{ {
@ -50,7 +49,6 @@ public class Device_NamePlate : Device_Base
} }
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true)); int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
CallScoreAction(); CallScoreAction();
endAction?.Invoke();
} }
}); });
} }

View File

@ -23,7 +23,6 @@ public class Device_CabinetDoor : Device_Base
public void Open() public void Open()
{ {
Debug.Log("开门"); Debug.Log("开门");
startAction?.Invoke();
//开锁 //开锁
transform.Find("计量柜锁2/计量柜锁3").DOLocalRotate(new Vector3(-45f, 0, 0), 1).OnComplete(() => transform.Find("计量柜锁2/计量柜锁3").DOLocalRotate(new Vector3(-45f, 0, 0), 1).OnComplete(() =>
{ {
@ -31,14 +30,12 @@ public class Device_CabinetDoor : Device_Base
transform.DOLocalRotate(new Vector3(0, 0, 180), 3).OnComplete(() => transform.DOLocalRotate(new Vector3(0, 0, 180), 3).OnComplete(() =>
{ {
isOpen = true; isOpen = true;
endAction?.Invoke();
}); });
}); });
} }
public void Close() public void Close()
{ {
Debug.Log("关门"); Debug.Log("关门");
startAction?.Invoke();
//关门 //关门
transform.DOLocalRotate(new Vector3(0, 0, 0), 3).OnComplete(() => transform.DOLocalRotate(new Vector3(0, 0, 0), 3).OnComplete(() =>
{ {
@ -46,7 +43,6 @@ public class Device_CabinetDoor : Device_Base
transform.Find("计量柜锁2/计量柜锁3").DOLocalRotate(new Vector3(0, 0, 0), 1).OnComplete(() => transform.Find("计量柜锁2/计量柜锁3").DOLocalRotate(new Vector3(0, 0, 0), 1).OnComplete(() =>
{ {
isOpen = false; isOpen = false;
endAction?.Invoke();
}); });
}); });
} }

View File

@ -90,7 +90,6 @@ public class Tool_Base : PermanentTriggerBase
transform.localPosition = head_LocalPos; transform.localPosition = head_LocalPos;
transform.localEulerAngles = head_LocalEulerAnglesl; transform.localEulerAngles = head_LocalEulerAnglesl;
isMoving = false; isMoving = false;
endAction?.Invoke();
}); });
} }
} }

View File

@ -55,24 +55,36 @@ public class Tool_Screw : Tool_Base
/// <param name="screwdriver"></param> /// <param name="screwdriver"></param>
public void BeInstalled(Tool_Screwdriver screwdriver) public void BeInstalled(Tool_Screwdriver screwdriver)
{ {
//动画 if (!isMoving && !screwdriver.isMoving)
transform.DOLocalMoveY(initPostionY, 1) {
.OnUpdate(() => 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.RotateAroundLocal(Vector3.up, 1); //动画
screwdriver.transform.position = installPos.position; transform.DOLocalMoveY(initPostionY, 1)
screwdriver.transform.RotateAroundLocal(Vector3.right, 10); .OnUpdate(() =>
}) {
.OnComplete(() => transform.RotateAroundLocal(Vector3.up, 1);
{ screwdriver.transform.position = installPos.position;
Debug.Log("螺丝已拧紧"); screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
isInstall = true; })
isMoving = false; .OnComplete(() =>
screwdriver.isMoving = false; {
installAction?.Invoke(true); Debug.Log("螺丝已拧紧");
screwdriver.ReBackHead(); isInstall = true;
CallScoreAction(true); isMoving = false;
screwdriver.isMoving = false;
installAction?.Invoke(true);
screwdriver.ReBackHead();
CallScoreAction(true);
});
}); });
}
} }
/// <summary> /// <summary>
@ -81,23 +93,35 @@ public class Tool_Screw : Tool_Base
/// <param name="screwdriver"></param> /// <param name="screwdriver"></param>
public void BeUnInstalled(Tool_Screwdriver screwdriver) public void BeUnInstalled(Tool_Screwdriver screwdriver)
{ {
//动画 if (!isMoving && !screwdriver.isMoving)
transform.DOLocalMoveY(initPostionY - 0.02f, 1) {
.OnUpdate(() => 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.RotateAroundLocal(Vector3.up, 1); //动画
screwdriver.transform.position = installPos.position; transform.DOLocalMoveY(initPostionY - 0.02f, 1)
screwdriver.transform.RotateAroundLocal(Vector3.right, 10); .OnUpdate(() =>
}) {
.OnComplete(() => transform.RotateAroundLocal(Vector3.up, 1);
{ screwdriver.transform.position = installPos.position;
Debug.Log("螺丝已拧松"); screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
isInstall = false; })
isMoving = false; .OnComplete(() =>
screwdriver.isMoving = false; {
installAction?.Invoke(false); Debug.Log("螺丝已拧松");
screwdriver.ReBackHead(); isInstall = false;
CallScoreAction(false); isMoving = false;
screwdriver.isMoving = false;
installAction?.Invoke(false);
screwdriver.ReBackHead();
CallScoreAction(false);
});
}); });
}
} }
} }

View File

@ -14,19 +14,9 @@ public class Tool_Screwdriver : Tool_Base
/// <param name="screw"></param> /// <param name="screw"></param>
public void Install(Tool_Screw screw) public void Install(Tool_Screw screw)
{ {
if (!screw.isInstall && !screw.isMoving && !isMoving) if (!screw.isInstall)
{ {
screw.isMoving = true; screw.BeInstalled(this);
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);
});
} }
} }
@ -36,19 +26,9 @@ public class Tool_Screwdriver : Tool_Base
/// <param name="screw"></param> /// <param name="screw"></param>
public void UnInstall(Tool_Screw screw) public void UnInstall(Tool_Screw screw)
{ {
if (screw.isInstall && !screw.isMoving && !isMoving) if (screw.isInstall)
{ {
screw.isMoving = true; screw.BeUnInstalled(this);
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);
});
} }
} }

View File

@ -116,7 +116,6 @@ public class Tool_TestPen : Tool_Base
if (tool_base.toolType == ToolType.) if (tool_base.toolType == ToolType.)
{ {
var tmp = ((Tool_Screw)tool_base); var tmp = ((Tool_Screw)tool_base);
base.startAction?.Invoke();
//位置移动 //位置移动
transform.parent = null; transform.parent = null;
transform.DOLocalRotate(tmp.installPos.localEulerAngles, 0.5f); transform.DOLocalRotate(tmp.installPos.localEulerAngles, 0.5f);

View File

@ -15,8 +15,7 @@ public class Tool_WireStripper : Tool_Base
/// <param name="device_Seal"></param> /// <param name="device_Seal"></param>
public void CutOpen(Device_Seal device_Seal) public void CutOpen(Device_Seal device_Seal)
{ {
base.startAction?.Invoke(); isMoving = true;
base.isMoving = true;
transform.parent = null; transform.parent = null;
transform.DORotate(device_Seal.testPosAndRot.eulerAngles, 0.5f); transform.DORotate(device_Seal.testPosAndRot.eulerAngles, 0.5f);
transform.DOMove(device_Seal.testPosAndRot.position, 1).OnComplete(() => transform.DOMove(device_Seal.testPosAndRot.position, 1).OnComplete(() =>

View File

@ -18,14 +18,6 @@ public class PermanentTriggerBase : MonoBehaviour
/// 打分事件 /// 打分事件
/// </summary> /// </summary>
private Action<string, object, int, int> scoreAction; private Action<string, object, int, int> scoreAction;
/// <summary>
/// 开始操作的回调(工具为从手里开始使用时调用,设备为开始操作时调用)
/// </summary>
protected Action startAction;
/// <summary>
/// 操作结束回调(工具为回到手中时调用,设备为操作结束时调用)
/// </summary>
protected Action endAction;
private void Awake() private void Awake()
{ {