This commit is contained in:
YangHua 2024-08-29 14:04:58 +08:00
commit f49906f062
13 changed files with 291 additions and 25 deletions

Binary file not shown.

View File

@ -285,7 +285,7 @@ MonoBehaviour:
id: id:
isInstall: 1 isInstall: 1
installPos: {fileID: 2576541080142119082} installPos: {fileID: 2576541080142119082}
hasElectricity: 1 hasElectricity: 0
initPostionY: 0.0256958 initPostionY: 0.0256958
--- !u!114 &2576541079962278358 --- !u!114 &2576541079962278358
MonoBehaviour: MonoBehaviour:
@ -5765,7 +5765,7 @@ MonoBehaviour:
id: id:
isInstall: 1 isInstall: 1
installPos: {fileID: 2576541079818901621} installPos: {fileID: 2576541079818901621}
hasElectricity: 1 hasElectricity: 0
initPostionY: 0.0256958 initPostionY: 0.0256958
--- !u!1 &4627208948562638019 --- !u!1 &4627208948562638019
GameObject: GameObject:
@ -9551,7 +9551,7 @@ MonoBehaviour:
id: id:
isInstall: 1 isInstall: 1
installPos: {fileID: 2576541081300379520} installPos: {fileID: 2576541081300379520}
hasElectricity: 1 hasElectricity: 0
initPostionY: 0.02220154 initPostionY: 0.02220154
--- !u!1 &7847778419808227353 --- !u!1 &7847778419808227353
GameObject: GameObject:
@ -9838,7 +9838,7 @@ MonoBehaviour:
id: id:
isInstall: 1 isInstall: 1
installPos: {fileID: 2576541081225681401} installPos: {fileID: 2576541081225681401}
hasElectricity: 1 hasElectricity: 0
initPostionY: 0.02220154 initPostionY: 0.02220154
--- !u!114 &2576541080563400542 --- !u!114 &2576541080563400542
MonoBehaviour: MonoBehaviour:

View File

@ -188,6 +188,7 @@ public class Device_3Phase4WireMeter : Device_Base
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);
gameObject.SetActive(false); gameObject.SetActive(false);
}); });
} }
@ -209,6 +210,7 @@ public class Device_3Phase4WireMeter : Device_Base
{ {
LiveSceneManager.Instance.currentTool = null; LiveSceneManager.Instance.currentTool = null;
Debug.Log("电能表已安装"); Debug.Log("电能表已安装");
CallScoreAction(true);
}); });
} }
} }

View File

@ -48,6 +48,7 @@ public class Device_NamePlate : Device_Base
tip2.Init("核对和抄录完成!"); tip2.Init("核对和抄录完成!");
} }
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true)); int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
CallScoreAction();
} }
}); });
} }

View File

@ -182,8 +182,17 @@ public class Device_MeasuringCabinet : MonoBehaviour
{ {
a.screws.ForEach(b => a.screws.ForEach(b =>
{ {
//安装了则带电 //安装了则
b.hasElectricity = b.isInstall; //零线无电流,有电压
if(b.triggerName.Contains("零"))
{
b.hasElectricity = false;
}
else
{
//其他的看是否上电
b.hasElectricity = b.isInstall;
}
}); });
} }
} }

View File

@ -9,5 +9,8 @@ public class Device_Sundries : Device_Base
base.OnMDown(); base.OnMDown();
Debug.Log("清理柜子杂物"); Debug.Log("清理柜子杂物");
gameObject.SetActive(false); gameObject.SetActive(false);
triggerAction.Invoke(triggerName, false);
base.CallScoreAction();
} }
} }

View File

@ -19,7 +19,7 @@ public class ScoreSubjectStep
/// <summary> /// <summary>
/// 步骤是否已完成 /// 步骤是否已完成
/// </summary> /// </summary>
bool isDone; public bool isDone;
public ScoreSubjectStep(int subProcessId,float maxScore) public ScoreSubjectStep(int subProcessId,float maxScore)
{ {
@ -35,9 +35,10 @@ public class ScoreSubjectStep
/// 得全或扣光 /// 得全或扣光
/// </summary> /// </summary>
/// <param name="AllScore"></param> /// <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; isDone = true;
currentScore = (AllScore ? maxScore : 0); currentScore = (AllScore ? maxScore : 0);
@ -48,9 +49,9 @@ public class ScoreSubjectStep
/// 百分比分数 /// 百分比分数
/// </summary> /// </summary>
/// <param name="scaleScore"></param> /// <param name="scaleScore"></param>
public void SetScore(float scaleScore) public void SetScore(float scaleScore, bool canRepeat=false)
{ {
if (!isDone) if (!isDone || canRepeat)
{ {
isDone = true; isDone = true;
currentScore = scaleScore*maxScore; currentScore = scaleScore*maxScore;

View File

@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
public class Score_1002 : ScoreBase public class Score_1002 : ScoreBase
@ -45,9 +46,62 @@ public class Score_1002 : ScoreBase
/// </summary> /// </summary>
List<string> TestPen3list = new List<string>(); List<string> TestPen3list = new List<string>();
/// <summary> /// <summary>
/// 开关验电 /// 开关断电验电
/// </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) public override void CheckScore(string triggerName, object para)
{ {
base.CheckScore(triggerName, para); base.CheckScore(triggerName, para);
@ -95,15 +149,16 @@ public class Score_1002 : ScoreBase
{ {
if ((bool)para) if ((bool)para)
{ {
//接线检查打分 //3012之前时拆除流程之后时安装流程
//判断验电是否正确 if (!steps[3012].isDone)
if (isCheckE())
{ {
steps[3009].SetScore(true); //接线检查打分,判断三步验电是否正确
steps[3009].SetScore(isCheckE());
} }
else 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") 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> /// <returns></returns>
private bool isInSwitchCheckE() 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; return true;
} }
@ -174,4 +334,76 @@ public class Score_1002 : ScoreBase
return false; 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;
}
} }

View File

@ -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.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) 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.Install();
//打分
SiteManager.instance.measuringCabinet.meteringDevice.cover.cover_seal_Right.CallScoreAction(true);
} }
} }
} }

View File

@ -57,6 +57,7 @@ public class Tool_Line: Tool_Base
isConnected = false; isConnected = false;
actionBack?.Invoke(isConnected); actionBack?.Invoke(isConnected);
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true)); int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
CallScoreAction(false);
}); });
} }
} }
@ -70,6 +71,7 @@ public class Tool_Line: Tool_Base
isConnected = true; isConnected = true;
actionBack?.Invoke(isConnected); actionBack?.Invoke(isConnected);
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true)); int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
CallScoreAction(true);
}); });
} }
} }

View File

@ -85,6 +85,8 @@ public class Tool_Screw : Tool_Base
isMoving = false; isMoving = false;
installAction?.Invoke(true); installAction?.Invoke(true);
screwdriver.ReBackHead(); screwdriver.ReBackHead();
screwdriver.isUseing = false;
CallScoreAction(true);
}); });
}); });
} }
@ -120,6 +122,8 @@ public class Tool_Screw : Tool_Base
isMoving = false; isMoving = false;
installAction?.Invoke(false); installAction?.Invoke(false);
screwdriver.ReBackHead(); screwdriver.ReBackHead();
screwdriver.isUseing = false;
CallScoreAction(false);
}); });
}); });
} }

View File

@ -8,6 +8,12 @@ using UnityEngine;
/// </summary> /// </summary>
public class Tool_Screwdriver : Tool_Base public class Tool_Screwdriver : Tool_Base
{ {
/// <summary>
/// 正在使用
/// </summary>
[HideInInspector]
public bool isUseing;
/// <summary> /// <summary>
/// 开始安装螺丝 /// 开始安装螺丝
/// </summary> /// </summary>
@ -16,6 +22,7 @@ public class Tool_Screwdriver : Tool_Base
{ {
if (!screw.isInstall) if (!screw.isInstall)
{ {
isUseing = true;
screw.BeInstalled(this); screw.BeInstalled(this);
} }
} }
@ -28,13 +35,14 @@ public class Tool_Screwdriver : Tool_Base
{ {
if (screw.isInstall) if (screw.isInstall)
{ {
isUseing = true;
screw.BeUnInstalled(this); screw.BeUnInstalled(this);
} }
} }
private void Update() private void Update()
{ {
if (Input.GetMouseButtonDown(0)) if (Input.GetMouseButtonDown(0) && !isUseing)
{ {
//点击螺丝验电 //点击螺丝验电
Ray tmpray = Camera.main.ScreenPointToRay(Input.mousePosition); Ray tmpray = Camera.main.ScreenPointToRay(Input.mousePosition);