Merge branch 'main' into HQB_workspace

This commit is contained in:
liuyu 2024-09-06 11:00:25 +08:00
commit 9e3d0fd4f1
3 changed files with 76 additions and 32 deletions

View File

@ -7127,7 +7127,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4675619581299266311, guid: 10f4454f32eb20e4298912d896f6020e, type: 3} - target: {fileID: 4675619581299266311, guid: 10f4454f32eb20e4298912d896f6020e, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: "\u4E09\u76F8\u56DB\u7EBF\u7535\u8868" value: "\u539F\u4E09\u76F8\u56DB\u7EBF\u7535\u8868"
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5209635747906703206, guid: 10f4454f32eb20e4298912d896f6020e, type: 3} - target: {fileID: 5209635747906703206, guid: 10f4454f32eb20e4298912d896f6020e, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder

View File

@ -91,10 +91,14 @@ public class Device_Control_1002 : Device_Control
{ {
if (a) if (a)
{ {
//拆下场景中自带的电能表才显示杂物
if (meteringDevice.name == "原三相四线电表")
{
sundries.gameObject.SetActive(true);
}
meteringDevice = null; meteringDevice = null;
//情况接线关联螺丝 //情况接线关联螺丝
ClearLineScrew(); ClearLineScrew();
sundries.gameObject.SetActive(true);
//打分 //打分
dianTrigger.CallScoreAction(false); dianTrigger.CallScoreAction(false);
} }
@ -127,10 +131,13 @@ public class Device_Control_1002 : Device_Control
}); });
}); });
//接线连接和取下回调 //接线连接和取下回调,判断回调
jieXian_lines.ForEach(line => jieXian_lines.ForEach(line =>
{ {
line.AddAction(isConnected => //无电能表不可移动
line.AddCanMoveCheck(() => { return meteringDevice != null; });
line.AddCompleteAction(isConnected =>
{ {
//刷新带点状态 //刷新带点状态
CheckHasElectricity(); CheckHasElectricity();
@ -138,6 +145,18 @@ public class Device_Control_1002 : Device_Control
CheckJieXianOk(check_JieXian); CheckJieXianOk(check_JieXian);
}); });
}); });
///开关螺丝不可拆卸
inSwitchScrews.ForEach(a =>
{
a.AddCheckAction(() =>
{
//提示不可拆
TipPanel tip2 = Instantiate(Resources.Load<TipPanel>("UI/UI_Tip/TipPanel"), GameManager.UIMgr.canvas.transform);
tip2.Init("当前螺丝不可拆卸!");
return false;
});
});
} }
/// <summary> /// <summary>

View File

@ -30,19 +30,43 @@ public class Tool_Line: Tool_Base
/// </summary> /// </summary>
public float InstallPosY; public float InstallPosY;
/// <summary>
/// 操作后回调
/// </summary>
private Action<bool> actionBack; private Action<bool> actionBack;
/// <summary>
/// 是否可移动判断
/// </summary>
private Func<bool> checkCanMove;
//protected override void OnAwake()
//{
// base.OnAwake();
// id = gameObject.name;
//}
public void AddAction(Action<bool> actionBack) public void AddCompleteAction(Action<bool> actionBack)
{ {
this.actionBack = actionBack; this.actionBack = actionBack;
} }
public void AddCanMoveCheck(Func<bool> canMoveCheck)
{
this.checkCanMove = canMoveCheck;
}
/// <summary>
/// 是否可以
/// </summary>
/// <returns></returns>
public bool CanMove()
{
if (checkCanMove == null)
{
return true;
}
else
{
return checkCanMove.Invoke();
}
}
protected override void OnMDown() protected override void OnMDown()
{
if (CanMove())
{ {
if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0) if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0)
{ {
@ -78,3 +102,4 @@ public class Tool_Line: Tool_Base
} }
} }
} }
}