This commit is contained in:
陈向学 2024-08-28 19:19:02 +08:00
parent 6e3ba07fe0
commit 20312ee14d
6 changed files with 130 additions and 10 deletions

View File

@ -35,7 +35,8 @@ public class Check_JieXian : PermanentTriggerBase
tipPanel.Init("接线完好!");
}
if (GameManager.ProcessMgr != null)
GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, true);
GameManager.ProcessMgr?.IsRightSubProcessStepsTriggerID(triggerName, true);
base.CallScoreAction(true);
}
}

View File

@ -36,18 +36,28 @@ public class Score_1002 : ScoreBase
{
steps.Add(a.subProcessId, a);
});
TestPen3list.Clear();
}
/// <summary>
/// 三步验电顺序
/// </summary>
List<string> TestPen3list = new List<string>();
/// <summary>
/// 开关验电
/// </summary>
List<string> TestInSwitchList=new List<string>();
public override void CheckScore(string triggerName, object para)
{
base.CheckScore(triggerName, para);
if(triggerName =="手机")
if (triggerName == "手机")
{
if(para.ToString()== "任务接受完成")
if (para.ToString() == "任务接受完成")
{
steps[3001].SetScore(true);
}
else if(para.ToString()== "任务接受完成")
else if (para.ToString() == "任务接受完成")
{
steps[3002].SetScore(true);
}
@ -56,20 +66,112 @@ public class Score_1002 : ScoreBase
{
//쇱꿴角뤠누덖
float tmp = 0;
tmp +=(PacksackBagMgr.Instance.wearDic.ContainsKey("国网安全帽") ? 0.25f : 0);
tmp += (PacksackBagMgr.Instance.wearDic.ContainsKey("国网安全帽") ? 0.25f : 0);
tmp += (PacksackBagMgr.Instance.wearDic.ContainsKey("묏鱗륩") ? 0.25f : 0);
tmp += (PacksackBagMgr.Instance.wearDic.ContainsKey("없鍍癎敬") ? 0.25f : 0);
tmp += (PacksackBagMgr.Instance.wearDic.ContainsKey("없鍍棄") ? 0.25f : 0);
steps[3003].SetScore(tmp);
steps[3005].SetScore(tmp);
//쇱꿴교관角뤠赳던
string[] shoudleTools = new string[] { "괆窟풂", "없鍍쭁介독", "駱든궝", "묏鱗聯", "분陋룐丹", "없鍍스던", "힛宮愷窟든콘깊", "벌貢갛홍챰", "묏鱗륩", "없鍍癎敬", "없鍍棄" };
float tmp2 = 1;
shoudleTools.ToList().ForEach(a =>
shoudleTools.ToList().ForEach(a =>
{
tmp2 -= (PacksackBagMgr.Instance.toolAndMaterialDic.ContainsKey(a) ? 0 : 0.1f);
});
steps[3004].SetScore(Mathf.Clamp01(tmp2));
steps[3006].SetScore(Mathf.Clamp01(tmp2));
}
else if (triggerName == "工作证")
{
//与客户沟通
steps[3007].SetScore(true);
}
else if (triggerName == "NPC负责人")
{
//班前会
steps[3008].SetScore(true);
}
else if (triggerName == "检查接线")
{
if ((bool)para)
{
//接线检查打分
//判断验电是否正确
if (isCheckE())
{
steps[3009].SetScore(true);
}
else
{
}
}
}
else if (triggerName == "验电笔+插座" || triggerName == "验电笔+柜门")
{
//记录验电顺序
TestPen3list.Add(triggerName);
}
else if (triggerName == "验电笔+in开关_螺丝1" || triggerName == "验电笔+in开关_螺丝2" || triggerName == "验电笔+in开关_螺丝3")
{
if(SiteManager.instance.measuringCabinet.inSwitch.isOpen==false)
{
TestInSwitchList.Add(triggerName);
isInSwitchCheckE();
}
}
}
/// <summary>
/// 检查三步验电
/// </summary>
/// <returns></returns>
private bool isCheckE()
{
int guimen = 0;
if (TestPen3list.Count >= 3)
{
for (int i = 0; i < TestPen3list.Count; i++)
{
if (i == 0)
{
if (TestPen3list[i] != "验电笔+插座")
break;
}
else
{
if (TestPen3list[i] == "验电笔+柜门")
{
guimen = i;
}
else
{
if (guimen != 0)
{
//三步验电完成
Debug.Log("三步验电正确");
return true;
}
}
}
}
}
return false;
}
/// <summary>
/// 开关验电
/// </summary>
/// <returns></returns>
private bool isInSwitchCheckE()
{
if (TestInSwitchList.Contains("验电笔+in开关_螺丝1") && TestInSwitchList.Contains("验电笔+in开关_螺丝2") && TestInSwitchList.Contains("验电笔+in开关_螺丝2"))
{
return true;
}
else
{
return false;
}
}
}

View File

@ -83,6 +83,7 @@ public class Tool_TestPen : Tool_Base
Debug.Log("źĆÁżšń_˛ĺ×ů ŇŃŃéľç");
isFlicker = tmp.hasElectricity;
screem.materials[0].color = isFlicker ? Color.red : Color.white;
base.CallScoreAction(null, $"{triggerName}+{device_base.triggerName}");
});
}
else if (device_base.deviceType == DeviceType.źĆÁżšń_šńĂĹ)
@ -97,6 +98,7 @@ public class Tool_TestPen : Tool_Base
Debug.Log("źĆÁżšń_šńĂĹ ŇŃŃéľç");
isFlicker = tmp.hasElectricity;
screem.materials[0].color = isFlicker ? Color.red : Color.white;
base.CallScoreAction(null, $"{triggerName}+{device_base.triggerName}");
});
}
}
@ -121,6 +123,7 @@ public class Tool_TestPen : Tool_Base
Debug.Log("ÂÝËż ŇŃŃéľç");
isFlicker = tmp.hasElectricity;
screem.materials[0].color = isFlicker ? Color.red : Color.white;
base.CallScoreAction(null, $"{triggerName}+{tool_base.triggerName}");
});
}
}

View File

@ -35,6 +35,7 @@ public class LiveSceneManager : SingletonMono<LiveSceneManager>
p.Init(currentTool.name, "您好我是xx供电公司员工这是我的工作证。现在我们要对贵户更换电能计量表", (intTemp) =>
{
GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(intTemp, true);
ScoreManager.instance.Check(currentTool.name, null);
Destroy(currentTool);
});
});

View File

@ -33,6 +33,8 @@ public class NPCController : PermanentTriggerBase
else
{
GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, true);
//̸»°»Øµ÷
ScoreManager.instance.Check(triggerName, null);
if (GameManager.UIMgr.GetPanel<UI_CustomSessionPanel>())
GameManager.UIMgr.HidePanel<UI_CustomSessionPanel>();
speackIndex = 0;

View File

@ -17,7 +17,7 @@ public class PermanentTriggerBase : MonoBehaviour
/// <summary>
/// 打分事件
/// </summary>
public Action<string, object, int, int> scoreAction;
private Action<string, object, int, int> scoreAction;
private void Awake()
{
@ -100,4 +100,15 @@ public class PermanentTriggerBase : MonoBehaviour
{
this.scoreAction = back;
}
/// <summary>
/// 调用打分功能
/// </summary>
/// <param name="para">参数 默认不传</param>
/// /// <param name="triggerName">触发的物体识别号 默认传自己的</param>
/// <param name="systemcid">系统id 默认当前系统</param>
/// <param name="shchmeid">科目id 默认当前科目</param>
public void CallScoreAction(object para=null ,string triggerName = null, int systemcid=0,int shchmeid=0)
{
scoreAction?.Invoke(triggerName==null?this.triggerName:triggerName, para, systemcid, shchmeid);
}
}