Merge branch 'main' of http://7d2f0537.r5.cpolar.top/WangWeiZhi/YanCheng_Metrology
This commit is contained in:
commit
f49906f062
Binary file not shown.
|
@ -285,7 +285,7 @@ MonoBehaviour:
|
|||
id:
|
||||
isInstall: 1
|
||||
installPos: {fileID: 2576541080142119082}
|
||||
hasElectricity: 1
|
||||
hasElectricity: 0
|
||||
initPostionY: 0.0256958
|
||||
--- !u!114 &2576541079962278358
|
||||
MonoBehaviour:
|
||||
|
@ -5765,7 +5765,7 @@ MonoBehaviour:
|
|||
id:
|
||||
isInstall: 1
|
||||
installPos: {fileID: 2576541079818901621}
|
||||
hasElectricity: 1
|
||||
hasElectricity: 0
|
||||
initPostionY: 0.0256958
|
||||
--- !u!1 &4627208948562638019
|
||||
GameObject:
|
||||
|
@ -9551,7 +9551,7 @@ MonoBehaviour:
|
|||
id:
|
||||
isInstall: 1
|
||||
installPos: {fileID: 2576541081300379520}
|
||||
hasElectricity: 1
|
||||
hasElectricity: 0
|
||||
initPostionY: 0.02220154
|
||||
--- !u!1 &7847778419808227353
|
||||
GameObject:
|
||||
|
@ -9838,7 +9838,7 @@ MonoBehaviour:
|
|||
id:
|
||||
isInstall: 1
|
||||
installPos: {fileID: 2576541081225681401}
|
||||
hasElectricity: 1
|
||||
hasElectricity: 0
|
||||
initPostionY: 0.02220154
|
||||
--- !u!114 &2576541080563400542
|
||||
MonoBehaviour:
|
||||
|
|
|
@ -188,6 +188,7 @@ public class Device_3Phase4WireMeter : Device_Base
|
|||
Debug.Log("电能表已拆除");
|
||||
transform.DOLocalMove(transform.localPosition - new Vector3(0, 0.2f, 0.2f), 2).OnComplete(() =>
|
||||
{
|
||||
CallScoreAction(false);
|
||||
gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
@ -209,6 +210,7 @@ public class Device_3Phase4WireMeter : Device_Base
|
|||
{
|
||||
LiveSceneManager.Instance.currentTool = null;
|
||||
Debug.Log("电能表已安装");
|
||||
CallScoreAction(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public class Device_NamePlate : Device_Base
|
|||
tip2.Init("核对和抄录完成!");
|
||||
}
|
||||
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
CallScoreAction();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -182,8 +182,17 @@ public class Device_MeasuringCabinet : MonoBehaviour
|
|||
{
|
||||
a.screws.ForEach(b =>
|
||||
{
|
||||
//安装了则带电
|
||||
b.hasElectricity = b.isInstall;
|
||||
//安装了则
|
||||
//零线无电流,有电压
|
||||
if(b.triggerName.Contains("零"))
|
||||
{
|
||||
b.hasElectricity = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//其他的看是否上电
|
||||
b.hasElectricity = b.isInstall;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,5 +9,8 @@ public class Device_Sundries : Device_Base
|
|||
base.OnMDown();
|
||||
Debug.Log("清理柜子杂物");
|
||||
gameObject.SetActive(false);
|
||||
triggerAction.Invoke(triggerName, false);
|
||||
base.CallScoreAction();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ScoreSubjectStep
|
|||
/// <summary>
|
||||
/// 步骤是否已完成
|
||||
/// </summary>
|
||||
bool isDone;
|
||||
public bool isDone;
|
||||
|
||||
public ScoreSubjectStep(int subProcessId,float maxScore)
|
||||
{
|
||||
|
@ -35,9 +35,10 @@ public class ScoreSubjectStep
|
|||
/// 得全或扣光
|
||||
/// </summary>
|
||||
/// <param name="AllScore"></param>
|
||||
public void SetScore(bool AllScore)
|
||||
/// <param name="canRepeat">是否可以重复打分</param>
|
||||
public void SetScore(bool AllScore,bool canRepeat=false)
|
||||
{
|
||||
if (!isDone)
|
||||
if (!isDone || canRepeat)
|
||||
{
|
||||
isDone = true;
|
||||
currentScore = (AllScore ? maxScore : 0);
|
||||
|
@ -48,9 +49,9 @@ public class ScoreSubjectStep
|
|||
/// 百分比分数
|
||||
/// </summary>
|
||||
/// <param name="scaleScore"></param>
|
||||
public void SetScore(float scaleScore)
|
||||
public void SetScore(float scaleScore, bool canRepeat=false)
|
||||
{
|
||||
if (!isDone)
|
||||
if (!isDone || canRepeat)
|
||||
{
|
||||
isDone = true;
|
||||
currentScore = scaleScore*maxScore;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class Score_1002 : ScoreBase
|
||||
|
@ -45,9 +46,62 @@ public class Score_1002 : ScoreBase
|
|||
/// </summary>
|
||||
List<string> TestPen3list = new List<string>();
|
||||
/// <summary>
|
||||
/// 开关验电
|
||||
/// 开关断电验电
|
||||
/// </summary>
|
||||
List<string> TestInSwitchList=new List<string>();
|
||||
List<string> InSwitchCloseYDList=new List<string>();
|
||||
/// <summary>
|
||||
/// 开关通电验电
|
||||
/// </summary>
|
||||
List<string> InSwitchOpenYDList = new List<string>();
|
||||
/// <summary>
|
||||
/// 拆除接线顺序
|
||||
/// </summary>
|
||||
List<string> unInstallJieXian=new List<string>()
|
||||
{
|
||||
"A_in_螺丝up", "A_in_螺丝down", "A_in_线",
|
||||
"B_in_螺丝up","B_in_螺丝down","B_in_线",
|
||||
"C_in_螺丝up","C_in_螺丝down","C_in_线",
|
||||
"A_out_螺丝up","A_out_螺丝down","A_out_线",
|
||||
"B_out_螺丝up","B_out_螺丝down","B_out_线",
|
||||
"C_out_螺丝up","C_out_螺丝down","C_out_线",
|
||||
"零_地_螺丝up","零_地_螺丝down","零_地_线",
|
||||
"零_out_螺丝up","零_out_螺丝down","零_out_线"
|
||||
};
|
||||
/// <summary>
|
||||
/// 拆除接线螺丝操作
|
||||
/// </summary>
|
||||
List<string> currentunInstallJieXian = new List<string>();
|
||||
/// <summary>
|
||||
/// 安装接线螺丝顺序
|
||||
/// </summary>
|
||||
List<string> installJieXian = new List<string>()
|
||||
{
|
||||
"零_out_线","零_out_螺丝up","零_out_螺丝down",
|
||||
"零_地_线","零_地_螺丝up","零_地_螺丝down",
|
||||
"C_out_线","C_out_螺丝up","C_out_螺丝down",
|
||||
"B_out_线","B_out_螺丝up","B_out_螺丝down",
|
||||
"A_out_线","A_out_螺丝up","A_out_螺丝down",
|
||||
"C_in_线","C_in_螺丝up","C_in_螺丝down",
|
||||
"B_in_线","B_in_螺丝up","B_in_螺丝down",
|
||||
"A_in_线","A_in_螺丝up", "A_in_螺丝down"
|
||||
};
|
||||
/// <summary>
|
||||
/// 安装接线螺丝操作
|
||||
/// </summary>
|
||||
List<string> currentInstallJieXian = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 安装流程安装盖子
|
||||
/// </summary>
|
||||
List<string> installCover = new List<string>();
|
||||
/// <summary>
|
||||
/// 安装流程对接验电螺丝
|
||||
/// </summary>
|
||||
List<string> installTestJieXian=new List<string>() { "验电笔+A_in_螺丝", "验电笔+B_in_螺丝", "验电笔+C_in_螺丝" };
|
||||
/// <summary>
|
||||
/// 安装流程对接验电操作
|
||||
/// </summary>
|
||||
List<string> currentInstallTestJieXian = new List<string>();
|
||||
public override void CheckScore(string triggerName, object para)
|
||||
{
|
||||
base.CheckScore(triggerName, para);
|
||||
|
@ -95,15 +149,16 @@ public class Score_1002 : ScoreBase
|
|||
{
|
||||
if ((bool)para)
|
||||
{
|
||||
//接线检查打分
|
||||
//判断验电是否正确
|
||||
if (isCheckE())
|
||||
//3012之前时拆除流程,之后时安装流程
|
||||
if (!steps[3012].isDone)
|
||||
{
|
||||
steps[3009].SetScore(true);
|
||||
//接线检查打分,判断三步验电是否正确
|
||||
steps[3009].SetScore(isCheckE());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//安装检查
|
||||
steps[3014].SetScore(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,10 +169,115 @@ public class Score_1002 : ScoreBase
|
|||
}
|
||||
else if (triggerName == "验电笔+in开关_螺丝1" || triggerName == "验电笔+in开关_螺丝2" || triggerName == "验电笔+in开关_螺丝3")
|
||||
{
|
||||
if(SiteManager.instance.measuringCabinet.inSwitch.isOpen==false)
|
||||
//3012之前是拆除,之后是安装
|
||||
if (!steps[3012].isDone)
|
||||
{
|
||||
TestInSwitchList.Add(triggerName);
|
||||
isInSwitchCheckE();
|
||||
//断电情况下
|
||||
if (SiteManager.instance.measuringCabinet.inSwitch.isOpen == false)
|
||||
{
|
||||
InSwitchCloseYDList.Add(triggerName);
|
||||
steps[3010].SetScore(isInSwitchCheckE(),true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//通电情况下
|
||||
if (SiteManager.instance.measuringCabinet.inSwitch.isOpen==true)
|
||||
{
|
||||
InSwitchOpenYDList.Add(triggerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(triggerName == "电能表铭牌")
|
||||
{
|
||||
steps[3011].SetScore(true);
|
||||
}
|
||||
else if(unInstallJieXian.Contains(triggerName))
|
||||
{
|
||||
//3012之前是拆除,之后是安装
|
||||
//接线螺丝和线
|
||||
if (!steps[3012].isDone)
|
||||
{
|
||||
//判断拆接线
|
||||
if ((bool)para)
|
||||
currentunInstallJieXian.Remove(triggerName);
|
||||
else
|
||||
currentunInstallJieXian.Add(triggerName);
|
||||
}
|
||||
else
|
||||
{
|
||||
//判断安装接线
|
||||
if ((bool)para)
|
||||
currentInstallJieXian.Add(triggerName);
|
||||
else
|
||||
currentInstallJieXian.Remove(triggerName);
|
||||
|
||||
//判分
|
||||
if (triggerName.Contains("A_in_螺丝"))
|
||||
{
|
||||
steps[3013].SetScore(IsInstallJieXianCheckE(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(triggerName== "电能表区域碰撞")
|
||||
{
|
||||
//取下电能表时判断验电顺序
|
||||
if(!(bool)para)
|
||||
{
|
||||
steps[3012].SetScore(IsUninstallJieXianCheckE());
|
||||
}
|
||||
}
|
||||
else if(triggerName.Contains("电能表拆装螺丝"))
|
||||
{
|
||||
//安装流程下
|
||||
if (steps[3012].isDone)
|
||||
{
|
||||
//拆装螺丝
|
||||
if ((bool)para)
|
||||
currentInstallJieXian.Add(triggerName);
|
||||
else
|
||||
currentInstallJieXian.Remove(triggerName);
|
||||
}
|
||||
}
|
||||
else if(triggerName.Contains("电能表盖子固定螺丝"))
|
||||
{
|
||||
//安装流程
|
||||
if (steps[3012].isDone)
|
||||
{
|
||||
if ((bool)para)
|
||||
installCover.Add(triggerName);
|
||||
else
|
||||
installCover.Remove(triggerName);
|
||||
|
||||
steps[3015].SetScore(Check3015(),true);
|
||||
}
|
||||
}
|
||||
else if(installTestJieXian.Any(a=>triggerName.StartsWith(a)))
|
||||
{
|
||||
//接线验电
|
||||
if (steps[3012].isDone)
|
||||
{
|
||||
currentInstallTestJieXian.Add(triggerName);
|
||||
}
|
||||
}
|
||||
else if(triggerName.Contains("电能表封印"))
|
||||
{
|
||||
if (steps[3012].isDone)
|
||||
{
|
||||
if((bool)para)
|
||||
{
|
||||
if(!SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_seal_Left.isCut && !SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_seal_Right.isCut)
|
||||
{
|
||||
steps[3016].SetScore(true,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(triggerName== "垃圾")
|
||||
{
|
||||
if (steps[3012].isDone)
|
||||
{
|
||||
steps[3018].SetScore(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +325,7 @@ public class Score_1002 : ScoreBase
|
|||
/// <returns></returns>
|
||||
private bool isInSwitchCheckE()
|
||||
{
|
||||
if (TestInSwitchList.Contains("验电笔+in开关_螺丝1") && TestInSwitchList.Contains("验电笔+in开关_螺丝2") && TestInSwitchList.Contains("验电笔+in开关_螺丝2"))
|
||||
if (InSwitchCloseYDList.Contains("验电笔+in开关_螺丝1") && InSwitchCloseYDList.Contains("验电笔+in开关_螺丝2") && InSwitchCloseYDList.Contains("验电笔+in开关_螺丝2"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -174,4 +334,76 @@ public class Score_1002 : ScoreBase
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断拆接线顺序
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool IsUninstallJieXianCheckE()
|
||||
{
|
||||
if(currentunInstallJieXian.Count!= unInstallJieXian.Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//一一比对
|
||||
for (int i = 0; i < currentunInstallJieXian.Count; i++)
|
||||
{
|
||||
if (currentunInstallJieXian[i] != unInstallJieXian[i])
|
||||
{
|
||||
//不分上下螺丝
|
||||
if (currentunInstallJieXian[i].Replace("up","").Replace("down","") != unInstallJieXian[i].Replace("up", "").Replace("down", ""))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断安装接线顺序
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsInstallJieXianCheckE()
|
||||
{
|
||||
if(!currentInstallJieXian.Contains("电能表拆装螺丝1") || !currentInstallJieXian.Contains("电能表拆装螺丝2"))
|
||||
return false;
|
||||
|
||||
if (currentInstallJieXian.Count < currentInstallJieXian.Count+2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//一一比对
|
||||
string[] tmps=new string[currentInstallJieXian.Count];
|
||||
currentInstallJieXian.CopyTo(tmps);
|
||||
var tmplist=tmps.ToList();
|
||||
tmplist.Remove("电能表拆装螺丝1");
|
||||
tmplist.Remove("电能表拆装螺丝2");
|
||||
|
||||
|
||||
for (int i = 0; i < tmplist.Count; i++)
|
||||
{
|
||||
//不分上下螺丝
|
||||
if (tmplist[i].Replace("up", "").Replace("down", "") != installJieXian[i].Replace("up", "").Replace("down", ""))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Check3015()
|
||||
{
|
||||
//开关关了,盖子拧上了
|
||||
if (SiteManager.instance.measuringCabinet.inSwitch.isOpen && installCover.Contains("电能表盖子固定螺丝1") && installCover.Contains("电能表盖子固定螺丝2"))
|
||||
{
|
||||
//无验电顺序
|
||||
if(installTestJieXian.TrueForAll(a => currentInstallTestJieXian.Contains(a.Replace("up","").Replace("down",""))))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,15 @@ public class Tool_BoxSeal : Tool_Base
|
|||
{
|
||||
//¸Ç×Ó×ó·âÓ¡
|
||||
SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_seal_Left.Install();
|
||||
//打分
|
||||
SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_seal_Left.CallScoreAction(true);
|
||||
}
|
||||
else if (screw == SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_screw_Right && SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_screw_Right.isInstall)
|
||||
{
|
||||
//¸Ç×ÓÓÒ·âÓ¡
|
||||
SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_seal_Right.Install();
|
||||
//打分
|
||||
SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_seal_Right.CallScoreAction(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ public class Tool_Line: Tool_Base
|
|||
isConnected = false;
|
||||
actionBack?.Invoke(isConnected);
|
||||
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
CallScoreAction(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +71,7 @@ public class Tool_Line: Tool_Base
|
|||
isConnected = true;
|
||||
actionBack?.Invoke(isConnected);
|
||||
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
CallScoreAction(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,6 +85,8 @@ public class Tool_Screw : Tool_Base
|
|||
isMoving = false;
|
||||
installAction?.Invoke(true);
|
||||
screwdriver.ReBackHead();
|
||||
screwdriver.isUseing = false;
|
||||
CallScoreAction(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -120,6 +122,8 @@ public class Tool_Screw : Tool_Base
|
|||
isMoving = false;
|
||||
installAction?.Invoke(false);
|
||||
screwdriver.ReBackHead();
|
||||
screwdriver.isUseing = false;
|
||||
CallScoreAction(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -8,6 +8,12 @@ using UnityEngine;
|
|||
/// </summary>
|
||||
public class Tool_Screwdriver : Tool_Base
|
||||
{
|
||||
/// <summary>
|
||||
/// 正在使用
|
||||
/// </summary>
|
||||
[HideInInspector]
|
||||
public bool isUseing;
|
||||
|
||||
/// <summary>
|
||||
/// 开始安装螺丝
|
||||
/// </summary>
|
||||
|
@ -16,6 +22,7 @@ public class Tool_Screwdriver : Tool_Base
|
|||
{
|
||||
if (!screw.isInstall)
|
||||
{
|
||||
isUseing = true;
|
||||
screw.BeInstalled(this);
|
||||
}
|
||||
}
|
||||
|
@ -28,13 +35,14 @@ public class Tool_Screwdriver : Tool_Base
|
|||
{
|
||||
if (screw.isInstall)
|
||||
{
|
||||
isUseing = true;
|
||||
screw.BeUnInstalled(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
if (Input.GetMouseButtonDown(0) && !isUseing)
|
||||
{
|
||||
//点击螺丝验电
|
||||
Ray tmpray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue