aaaa
This commit is contained in:
parent
f3cfd65e99
commit
0966d0e826
|
@ -61,11 +61,11 @@ public class Device_Base : PermanentTriggerBase
|
|||
|
||||
public void AddStartAction(Action callback)
|
||||
{
|
||||
startAction += callback;
|
||||
hand_out_action += callback;
|
||||
}
|
||||
public void AddEndAction(Action callback)
|
||||
{
|
||||
endAction += callback;
|
||||
hand_back_action += callback;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -184,13 +184,12 @@ public class Device_3Phase4WireMeter : Device_Base
|
|||
//拆下电能表
|
||||
if (!fix_screw_left.isInstall && !fix_screw_right.isInstall)
|
||||
{
|
||||
startAction?.Invoke();
|
||||
hand_out_action?.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);
|
||||
});
|
||||
}
|
||||
|
@ -205,7 +204,7 @@ public class Device_3Phase4WireMeter : Device_Base
|
|||
SiteManager.instance.measuringCabinet.meteringDevice = this;
|
||||
//默认是拆除的状态
|
||||
Init(false);
|
||||
startAction?.Invoke();
|
||||
hand_out_action?.Invoke();
|
||||
transform.DOLocalMove(new Vector3(0.1469002f, -0.1793365f, 0.5191498f), 2).OnStart(() =>
|
||||
{
|
||||
transform.localEulerAngles = Vector3.zero;
|
||||
|
@ -215,7 +214,6 @@ public class Device_3Phase4WireMeter : Device_Base
|
|||
|
||||
Debug.Log("电能表已安装");
|
||||
CallScoreAction(true);
|
||||
endAction?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ public class Device_Cover : Device_Base
|
|||
{
|
||||
isMoving = true;
|
||||
Debug.Log("´ò¿ª¸Ç×Ó");
|
||||
startAction?.Invoke();
|
||||
Transform parent = cover_screw_Left.transform.parent;
|
||||
cover_screw_Left.transform.parent = transform;
|
||||
cover_screw_Right.transform.parent = transform;
|
||||
|
@ -75,7 +74,6 @@ public class Device_Cover : Device_Base
|
|||
isMoving = false;
|
||||
|
||||
int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
endAction?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +88,6 @@ public class Device_Cover : Device_Base
|
|||
{
|
||||
isMoving=true;
|
||||
Debug.Log("¸ÇÉϸÇ×Ó");
|
||||
startAction?.Invoke();
|
||||
Transform parent = cover_screw_Left.transform.parent;
|
||||
cover_screw_Left.transform.parent = transform;
|
||||
cover_screw_Right.transform.parent = transform;
|
||||
|
@ -102,7 +99,6 @@ public class Device_Cover : Device_Base
|
|||
isMoving = false;
|
||||
|
||||
int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
endAction?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ public class Device_NamePlate : Device_Base
|
|||
GameObject tip = Instantiate<GameObject>(checkUiPrefb, GameManager.UIMgr.canvas.transform);
|
||||
ProcessTipPanel processTipPanel = tip.GetComponent<ProcessTipPanel>();
|
||||
|
||||
startAction?.Invoke();
|
||||
//¿ªÊ¼×ß½ø¶È
|
||||
processTipPanel.StartProcess(result =>
|
||||
{
|
||||
|
@ -50,7 +49,6 @@ public class Device_NamePlate : Device_Base
|
|||
}
|
||||
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
CallScoreAction();
|
||||
endAction?.Invoke();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class Device_CabinetDoor : Device_Base
|
|||
public void Open()
|
||||
{
|
||||
Debug.Log("开门");
|
||||
startAction?.Invoke();
|
||||
hand_out_action?.Invoke();
|
||||
//开锁
|
||||
transform.Find("计量柜锁2/计量柜锁3").DOLocalRotate(new Vector3(-45f, 0, 0), 1).OnComplete(() =>
|
||||
{
|
||||
|
@ -32,14 +32,13 @@ public class Device_CabinetDoor : Device_Base
|
|||
{
|
||||
isOpen = true;
|
||||
int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
endAction?.Invoke();
|
||||
});
|
||||
});
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
Debug.Log("关门");
|
||||
startAction?.Invoke();
|
||||
hand_out_action?.Invoke();
|
||||
//关门
|
||||
transform.DOLocalRotate(new Vector3(0, 0, 0), 3).OnComplete(() =>
|
||||
{
|
||||
|
@ -48,7 +47,6 @@ public class Device_CabinetDoor : Device_Base
|
|||
{
|
||||
isOpen = false;
|
||||
int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
endAction?.Invoke();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -67,11 +67,11 @@ public class Tool_Base : PermanentTriggerBase
|
|||
}
|
||||
public void AddStartAction(Action callback)
|
||||
{
|
||||
startAction += callback;
|
||||
hand_out_action += callback;
|
||||
}
|
||||
public void AddEndAction(Action callback)
|
||||
{
|
||||
endAction += callback;
|
||||
hand_back_action += callback;
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置工具回到手中的位置
|
||||
|
@ -97,7 +97,7 @@ public class Tool_Base : PermanentTriggerBase
|
|||
transform.localPosition = head_LocalPos;
|
||||
transform.localEulerAngles = head_LocalEulerAnglesl;
|
||||
isMoving = false;
|
||||
endAction?.Invoke();
|
||||
hand_back_action?.Invoke();
|
||||
back?.Invoke();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class Tool_Screwdriver : Tool_Base
|
|||
screw.isMoving = true;
|
||||
isMoving = true;
|
||||
Debug.Log("开始拧紧螺丝");
|
||||
startAction?.Invoke();
|
||||
hand_out_action?.Invoke();
|
||||
//螺丝刀移到螺丝上
|
||||
transform.parent = null;
|
||||
transform.DOLocalRotate(screw.installPos.localEulerAngles, 0.5f);
|
||||
|
@ -41,7 +41,7 @@ public class Tool_Screwdriver : Tool_Base
|
|||
screw.isMoving = true;
|
||||
isMoving = true;
|
||||
Debug.Log("开始卸螺丝");
|
||||
startAction?.Invoke();
|
||||
hand_out_action?.Invoke();
|
||||
//螺丝刀移到螺丝处
|
||||
transform.parent = null;
|
||||
transform.DOLocalRotate(screw.installPos.localEulerAngles, 0.5f);
|
||||
|
|
|
@ -75,7 +75,7 @@ public class Tool_TestPen : Tool_Base
|
|||
{
|
||||
var tmp = ((Device_Socket)device_base);
|
||||
//位置移动
|
||||
base.startAction?.Invoke();
|
||||
base.hand_out_action?.Invoke();
|
||||
transform.parent = null;
|
||||
transform.DORotate(tmp.testPosAndRot.eulerAngles, 0.5f);
|
||||
transform.DOMove(tmp.testPosAndRot.position, 1).OnComplete(() =>
|
||||
|
@ -84,7 +84,7 @@ public class Tool_TestPen : Tool_Base
|
|||
isFlicker = tmp.hasElectricity;
|
||||
screem.materials[0].color = isFlicker ? Color.red : Color.white;
|
||||
int index = (triggerAction == null ? 0 : triggerAction.Invoke($"{triggerName}+{device_base.triggerName}", true));
|
||||
base.endAction?.Invoke();
|
||||
base.hand_back_action?.Invoke();
|
||||
base.CallScoreAction(null, $"{triggerName}+{device_base.triggerName}");
|
||||
});
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class Tool_TestPen : Tool_Base
|
|||
var tmp = ((Device_CabinetDoor)device_base);
|
||||
|
||||
//位置移动
|
||||
base.startAction?.Invoke();
|
||||
base.hand_out_action?.Invoke();
|
||||
transform.parent = null;
|
||||
transform.DOLocalRotate(tmp.testPosAndRot.localEulerAngles, 0.5f);
|
||||
transform.DOMove(tmp.testPosAndRot.position, 1).OnComplete(() =>
|
||||
|
@ -102,7 +102,7 @@ public class Tool_TestPen : Tool_Base
|
|||
isFlicker = tmp.hasElectricity;
|
||||
screem.materials[0].color = isFlicker ? Color.red : Color.white;
|
||||
int index = (triggerAction == null ? 0 : triggerAction.Invoke($"{triggerName}+{device_base.triggerName}", true));
|
||||
base.endAction?.Invoke();
|
||||
base.hand_back_action?.Invoke();
|
||||
base.CallScoreAction(null, $"{triggerName}+{device_base.triggerName}");
|
||||
});
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class Tool_TestPen : Tool_Base
|
|||
if (tool_base.toolType == ToolType.螺丝)
|
||||
{
|
||||
var tmp = ((Tool_Screw)tool_base);
|
||||
base.startAction?.Invoke();
|
||||
base.hand_out_action?.Invoke();
|
||||
//位置移动
|
||||
transform.parent = null;
|
||||
transform.DOLocalRotate(tmp.installPos.localEulerAngles, 0.5f);
|
||||
|
@ -129,7 +129,7 @@ public class Tool_TestPen : Tool_Base
|
|||
Debug.Log("螺丝 已验电");
|
||||
isFlicker = tmp.hasElectricity;
|
||||
screem.materials[0].color = isFlicker ? Color.red : Color.white;
|
||||
base.endAction?.Invoke();
|
||||
base.hand_back_action?.Invoke();
|
||||
base.CallScoreAction(null, $"{triggerName}+{tool_base.triggerName}");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class Tool_WireStripper : Tool_Base
|
|||
/// <param name="device_Seal"></param>
|
||||
public void CutOpen(Device_Seal device_Seal)
|
||||
{
|
||||
base.startAction?.Invoke();
|
||||
base.hand_out_action?.Invoke();
|
||||
base.isMoving = true;
|
||||
transform.parent = null;
|
||||
transform.DORotate(device_Seal.testPosAndRot.eulerAngles, 0.5f);
|
||||
|
|
|
@ -41,11 +41,9 @@ public class LiveSceneManager : SingletonMono<LiveSceneManager>
|
|||
currentTool.GetComponent<Device_Base>().SetHeadPosAndEulerang(currentTool.transform.localPosition, currentTool.transform.localEulerAngles);
|
||||
currentTool.GetComponent<Device_Base>().AddStartAction(() =>
|
||||
{
|
||||
tMDTips.gameObject.SetActive(false);
|
||||
});
|
||||
currentTool.GetComponent<Device_Base>().AddEndAction(() =>
|
||||
{
|
||||
tMDTips.gameObject.SetActive(true);
|
||||
});
|
||||
}
|
||||
tMDTips.gameObject.SetActive(true);
|
||||
|
|
|
@ -19,13 +19,13 @@ public class PermanentTriggerBase : MonoBehaviour
|
|||
/// </summary>
|
||||
private Action<string, object, int, int> scoreAction;
|
||||
/// <summary>
|
||||
/// 开始操作的回调(工具为从手里开始使用时调用,设备为开始操作时调用)
|
||||
/// 手中飞出时的回调
|
||||
/// </summary>
|
||||
protected Action startAction;
|
||||
protected Action hand_out_action;
|
||||
/// <summary>
|
||||
/// 操作结束回调(工具为回到手中时调用,设备为操作结束时调用)
|
||||
/// 收回手里的回调
|
||||
/// </summary>
|
||||
protected Action endAction;
|
||||
protected Action hand_back_action;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue