Compare commits

..

No commits in common. "9e3d0fd4f1c85152d875d2194c615af15bd9dd38" and "5276fcaede929a4c68b518b5e66e9b5067068c56" have entirely different histories.

3 changed files with 32 additions and 76 deletions

View File

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

View File

@ -91,14 +91,10 @@ public class Device_Control_1002 : Device_Control
{
if (a)
{
//拆下场景中自带的电能表才显示杂物
if (meteringDevice.name == "原三相四线电表")
{
sundries.gameObject.SetActive(true);
}
meteringDevice = null;
//情况接线关联螺丝
ClearLineScrew();
sundries.gameObject.SetActive(true);
//打分
dianTrigger.CallScoreAction(false);
}
@ -131,13 +127,10 @@ public class Device_Control_1002 : Device_Control
});
});
//接线连接和取下回调,判断回调
//接线连接和取下回调
jieXian_lines.ForEach(line =>
{
//无电能表不可移动
line.AddCanMoveCheck(() => { return meteringDevice != null; });
line.AddCompleteAction(isConnected =>
line.AddAction(isConnected =>
{
//刷新带点状态
CheckHasElectricity();
@ -145,18 +138,6 @@ public class Device_Control_1002 : Device_Control
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>

View File

@ -30,74 +30,49 @@ public class Tool_Line: Tool_Base
/// </summary>
public float InstallPosY;
/// <summary>
/// 操作后回调
/// </summary>
private Action<bool> actionBack;
/// <summary>
/// 是否可移动判断
/// </summary>
private Func<bool> checkCanMove;
//protected override void OnAwake()
//{
// base.OnAwake();
// id = gameObject.name;
//}
public void AddCompleteAction(Action<bool> actionBack)
public void AddAction(Action<bool> 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()
{
if (CanMove())
if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0)
{
if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0)
base.OnMDown();
if (isConnected)
{
base.OnMDown();
if (isConnected)
//ȡϽÓÏß
if (screws.TrueForAll(a => !a.isInstall))
{
//取下接线
if (screws.TrueForAll(a => !a.isInstall))
transform.DOLocalMoveY(InstallPosY - 2, 1).OnComplete(() =>
{
transform.DOLocalMoveY(InstallPosY - 2, 1).OnComplete(() =>
{
isConnected = false;
actionBack?.Invoke(isConnected);
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
CallScoreAction(false);
});
}
isConnected = false;
actionBack?.Invoke(isConnected);
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
CallScoreAction(false);
});
}
else
}
else
{
//×°ÉϽÓÏß
if (screws.TrueForAll(a => !a.isInstall))
{
//装上接线
if (screws.TrueForAll(a => !a.isInstall))
transform.DOLocalMoveY(InstallPosY, 1).OnComplete(() =>
{
transform.DOLocalMoveY(InstallPosY, 1).OnComplete(() =>
{
isConnected = true;
actionBack?.Invoke(isConnected);
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
CallScoreAction(true);
});
}
isConnected = true;
actionBack?.Invoke(isConnected);
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
CallScoreAction(true);
});
}
}
}