Merge branch 'main' of http://7d2f0537.r5.cpolar.top/WangWeiZhi/YanCheng_Metrology
This commit is contained in:
commit
c01e05ddef
|
@ -67,7 +67,7 @@ TextureImporter:
|
||||||
platformSettings:
|
platformSettings:
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
buildTarget: DefaultTexturePlatform
|
buildTarget: DefaultTexturePlatform
|
||||||
maxTextureSize: 8192
|
maxTextureSize: 64
|
||||||
resizeAlgorithm: 0
|
resizeAlgorithm: 0
|
||||||
textureFormat: -1
|
textureFormat: -1
|
||||||
textureCompression: 1
|
textureCompression: 1
|
||||||
|
|
|
@ -13,6 +13,10 @@ 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;
|
||||||
|
|
|
@ -184,11 +184,13 @@ 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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -203,6 +205,7 @@ 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;
|
||||||
|
@ -211,6 +214,7 @@ public class Device_3Phase4WireMeter : Device_Base
|
||||||
LiveSceneManager.Instance.currentTool = null;
|
LiveSceneManager.Instance.currentTool = null;
|
||||||
Debug.Log("电能表已安装");
|
Debug.Log("电能表已安装");
|
||||||
CallScoreAction(true);
|
CallScoreAction(true);
|
||||||
|
endAction?.Invoke();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,21 +31,24 @@ public class Device_Cover : Device_Base
|
||||||
protected override void OnMDown()
|
protected override void OnMDown()
|
||||||
{
|
{
|
||||||
base.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 (!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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,17 +61,21 @@ 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("打开盖子");
|
||||||
isOpen = true;
|
startAction?.Invoke();
|
||||||
|
|
||||||
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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,17 +88,21 @@ 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("盖上盖子");
|
||||||
isOpen = false;
|
startAction?.Invoke();
|
||||||
|
|
||||||
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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ 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 =>
|
||||||
{
|
{
|
||||||
|
@ -49,6 +50,7 @@ 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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ 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(() =>
|
||||||
{
|
{
|
||||||
|
@ -30,12 +31,14 @@ 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(() =>
|
||||||
{
|
{
|
||||||
|
@ -43,6 +46,7 @@ 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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,7 @@ 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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,36 +55,24 @@ 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)
|
||||||
isMoving = true;
|
.OnUpdate(() =>
|
||||||
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);
|
||||||
transform.DOLocalMoveY(initPostionY, 1)
|
screwdriver.transform.position = installPos.position;
|
||||||
.OnUpdate(() =>
|
screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
|
||||||
{
|
})
|
||||||
transform.RotateAroundLocal(Vector3.up, 1);
|
.OnComplete(() =>
|
||||||
screwdriver.transform.position = installPos.position;
|
{
|
||||||
screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
|
Debug.Log("螺丝已拧紧");
|
||||||
})
|
isInstall = true;
|
||||||
.OnComplete(() =>
|
isMoving = false;
|
||||||
{
|
screwdriver.isMoving = false;
|
||||||
Debug.Log("螺丝已拧紧");
|
installAction?.Invoke(true);
|
||||||
isInstall = true;
|
screwdriver.ReBackHead();
|
||||||
isMoving = false;
|
CallScoreAction(true);
|
||||||
screwdriver.isMoving = false;
|
|
||||||
installAction?.Invoke(true);
|
|
||||||
screwdriver.ReBackHead();
|
|
||||||
CallScoreAction(true);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -93,35 +81,23 @@ 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)
|
||||||
isMoving = true;
|
.OnUpdate(() =>
|
||||||
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);
|
||||||
transform.DOLocalMoveY(initPostionY - 0.02f, 1)
|
screwdriver.transform.position = installPos.position;
|
||||||
.OnUpdate(() =>
|
screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
|
||||||
{
|
})
|
||||||
transform.RotateAroundLocal(Vector3.up, 1);
|
.OnComplete(() =>
|
||||||
screwdriver.transform.position = installPos.position;
|
{
|
||||||
screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
|
Debug.Log("螺丝已拧松");
|
||||||
})
|
isInstall = false;
|
||||||
.OnComplete(() =>
|
isMoving = false;
|
||||||
{
|
screwdriver.isMoving = false;
|
||||||
Debug.Log("螺丝已拧松");
|
installAction?.Invoke(false);
|
||||||
isInstall = false;
|
screwdriver.ReBackHead();
|
||||||
isMoving = false;
|
CallScoreAction(false);
|
||||||
screwdriver.isMoving = false;
|
|
||||||
installAction?.Invoke(false);
|
|
||||||
screwdriver.ReBackHead();
|
|
||||||
CallScoreAction(false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,19 @@ 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)
|
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
|
||||||
/// <param name="screw"></param>
|
/// <param name="screw"></param>
|
||||||
public void UnInstall(Tool_Screw screw)
|
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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,7 @@ 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);
|
||||||
|
|
|
@ -15,7 +15,8 @@ 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)
|
||||||
{
|
{
|
||||||
isMoving = true;
|
base.startAction?.Invoke();
|
||||||
|
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(() =>
|
||||||
|
|
|
@ -18,6 +18,14 @@ 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()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue