This commit is contained in:
parent
9e83a5e606
commit
afed813ff8
|
@ -14,11 +14,6 @@ public class Device_Base : PermanentTriggerBase
|
|||
/// </summary>
|
||||
public Func<string,bool,int> triggerAction;
|
||||
|
||||
/// <summary>
|
||||
/// 打分事件
|
||||
/// </summary>
|
||||
public Action<string, object, int, int> scoreAction;
|
||||
|
||||
private Vector3 head_LocalPos;
|
||||
private Vector3 head_LocalEulerAnglesl;
|
||||
|
||||
|
@ -28,7 +23,6 @@ public class Device_Base : PermanentTriggerBase
|
|||
{
|
||||
base.OnStart();
|
||||
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
|
||||
AddScoreAction(ScoreManager.instance.Check);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,10 +47,6 @@ public class Device_Base : PermanentTriggerBase
|
|||
{
|
||||
this.triggerAction = action;
|
||||
}
|
||||
public void AddScoreAction(Action<string, object, int, int> back)
|
||||
{
|
||||
this.scoreAction = back;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置工具回到手中的位置
|
||||
|
|
|
@ -35,7 +35,7 @@ public abstract class ScoreBase : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 判分
|
||||
/// </summary>
|
||||
public virtual void CheckScore()
|
||||
public virtual void CheckScore(string triggerName,object para)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,6 @@ public class ScoreManager : MonoBehaviour
|
|||
if (schemeid == 0)
|
||||
schemeid = GameManager.RunModelMgr.schemeID;
|
||||
|
||||
scoreSubjectList.Find(a => a.systemId == systemctlid && a.schemeId == schemeid)?.CheckScore();
|
||||
scoreSubjectList.Find(a => a.systemId == systemctlid && a.schemeId == schemeid)?.CheckScore(triggerName, para);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@ using UnityEngine;
|
|||
|
||||
public class ScoreSubjectStep
|
||||
{
|
||||
/// <summary>
|
||||
/// 步骤id
|
||||
/// </summary>
|
||||
public int subProcessId;
|
||||
/// <summary>
|
||||
/// 步骤满分
|
||||
/// </summary>
|
||||
|
@ -11,19 +15,46 @@ public class ScoreSubjectStep
|
|||
/// <summary>
|
||||
/// 步骤得分
|
||||
/// </summary>
|
||||
float currentScore;
|
||||
float currentScore=0;
|
||||
/// <summary>
|
||||
/// 步骤是否已完成
|
||||
/// </summary>
|
||||
bool isDone;
|
||||
|
||||
public ScoreSubjectStep(int subProcessId,float maxScore)
|
||||
{
|
||||
this.subProcessId = subProcessId;
|
||||
this.maxScore = maxScore;
|
||||
}
|
||||
|
||||
public ScoreSubjectStep(float maxScore)
|
||||
{
|
||||
this.maxScore = maxScore;
|
||||
}
|
||||
public void SetScore(float score)
|
||||
/// <summary>
|
||||
/// 得全或扣光
|
||||
/// </summary>
|
||||
/// <param name="AllScore"></param>
|
||||
public void SetScore(bool AllScore)
|
||||
{
|
||||
isDone = true;
|
||||
|
||||
if (!isDone)
|
||||
{
|
||||
isDone = true;
|
||||
currentScore = (AllScore ? maxScore : 0);
|
||||
Debug.Log(string.Format("打分:{0} 得分:{1}", subProcessId, currentScore));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 百分比分数
|
||||
/// </summary>
|
||||
/// <param name="scaleScore"></param>
|
||||
public void SetScore(float scaleScore)
|
||||
{
|
||||
if (!isDone)
|
||||
{
|
||||
isDone = true;
|
||||
currentScore = scaleScore*maxScore;
|
||||
Debug.Log(string.Format("打分:{0} 得分:{1}", subProcessId, currentScore));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class Score_1002 : ScoreBase
|
||||
|
@ -10,30 +11,65 @@ public class Score_1002 : ScoreBase
|
|||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
List<ScoreSubjectStep> tmps= new List<ScoreSubjectStep>();
|
||||
tmps.Add(new ScoreSubjectStep(3001, 0));
|
||||
tmps.Add(new ScoreSubjectStep(3002,0));
|
||||
tmps.Add(new ScoreSubjectStep(3003,5));
|
||||
tmps.Add(new ScoreSubjectStep(3004,5));
|
||||
tmps.Add(new ScoreSubjectStep(3005, 5));
|
||||
tmps.Add(new ScoreSubjectStep(3006, 10));
|
||||
tmps.Add(new ScoreSubjectStep(3007, 5));
|
||||
tmps.Add(new ScoreSubjectStep(3008, 0));
|
||||
tmps.Add(new ScoreSubjectStep(3009, 3));
|
||||
tmps.Add(new ScoreSubjectStep(3010,4));
|
||||
tmps.Add(new ScoreSubjectStep(3011, 3));
|
||||
tmps.Add(new ScoreSubjectStep(3012, 20));
|
||||
tmps.Add(new ScoreSubjectStep(3013, 20));
|
||||
tmps.Add(new ScoreSubjectStep(3014, 5));
|
||||
tmps.Add(new ScoreSubjectStep(3015, 5));
|
||||
tmps.Add(new ScoreSubjectStep(3016, 3));
|
||||
tmps.Add(new ScoreSubjectStep(3017, 4));
|
||||
tmps.Add(new ScoreSubjectStep(3018, 3));
|
||||
|
||||
steps = new Dictionary<int, ScoreSubjectStep>();
|
||||
steps.Add(3001, new ScoreSubjectStep(0));
|
||||
steps.Add(3002, new ScoreSubjectStep(0));
|
||||
steps.Add(3003, new ScoreSubjectStep(5));
|
||||
steps.Add(3004, new ScoreSubjectStep(5));
|
||||
steps.Add(3005, new ScoreSubjectStep(5));
|
||||
steps.Add(3006, new ScoreSubjectStep(10));
|
||||
steps.Add(3007, new ScoreSubjectStep(5));
|
||||
steps.Add(3008, new ScoreSubjectStep(0));
|
||||
steps.Add(3009, new ScoreSubjectStep(3));
|
||||
steps.Add(3010, new ScoreSubjectStep(4));
|
||||
steps.Add(3011, new ScoreSubjectStep(3));
|
||||
steps.Add(3012, new ScoreSubjectStep(20));
|
||||
steps.Add(3013, new ScoreSubjectStep(20));
|
||||
steps.Add(3014, new ScoreSubjectStep(5));
|
||||
steps.Add(3015, new ScoreSubjectStep(5));
|
||||
steps.Add(3016, new ScoreSubjectStep(3));
|
||||
steps.Add(3017, new ScoreSubjectStep(4));
|
||||
steps.Add(3018, new ScoreSubjectStep(3));
|
||||
tmps.ForEach(a =>
|
||||
{
|
||||
steps.Add(a.subProcessId, a);
|
||||
});
|
||||
}
|
||||
|
||||
public override void CheckScore()
|
||||
public override void CheckScore(string triggerName, object para)
|
||||
{
|
||||
base.CheckScore();
|
||||
base.CheckScore(triggerName, para);
|
||||
if(triggerName =="手机")
|
||||
{
|
||||
if(para.ToString()== "任务接受完成")
|
||||
{
|
||||
steps[3001].SetScore(true);
|
||||
}
|
||||
else if(para.ToString()== "任务接受完成")
|
||||
{
|
||||
steps[3002].SetScore(true);
|
||||
}
|
||||
}
|
||||
else if (triggerName == "现场按钮")
|
||||
{
|
||||
//检查是否穿戴
|
||||
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);
|
||||
steps[3003].SetScore(tmp);
|
||||
|
||||
//检查背包是否携带
|
||||
string[] shoudleTools = new string[] { "剥线钳", "绝缘螺丝刀", "验电笔", "工作证", "盒装封印", "绝缘胶带", "三相四线电能表", "国网安全帽", "工作服", "绝缘手套", "绝缘靴" };
|
||||
float tmp2 = 1;
|
||||
shoudleTools.ToList().ForEach(a =>
|
||||
{
|
||||
tmp2 -= (PacksackBagMgr.Instance.toolAndMaterialDic.ContainsKey(a) ? 0 : 0.1f);
|
||||
});
|
||||
steps[3004].SetScore(Mathf.Clamp01(tmp2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,7 @@ public class Tool_Base : PermanentTriggerBase
|
|||
/// trigger触发事件
|
||||
/// </summary>
|
||||
public Func<string, bool, int> triggerAction;
|
||||
/// <summary>
|
||||
/// 打分事件
|
||||
/// </summary>
|
||||
public Action<string, object, int, int> scoreAction;
|
||||
|
||||
|
||||
private Vector3 head_LocalPos;
|
||||
private Vector3 head_LocalEulerAnglesl;
|
||||
|
@ -32,7 +29,6 @@ public class Tool_Base : PermanentTriggerBase
|
|||
{
|
||||
base.OnStart();
|
||||
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
|
||||
AddScoreAction(ScoreManager.instance.Check);
|
||||
}
|
||||
}
|
||||
protected override void OnMEnter()
|
||||
|
@ -58,10 +54,6 @@ public class Tool_Base : PermanentTriggerBase
|
|||
this.triggerAction = action;
|
||||
}
|
||||
|
||||
public void AddScoreAction(Action<string, object, int, int> back)
|
||||
{
|
||||
this.scoreAction = back;
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置工具回到手中的位置
|
||||
/// </summary>
|
||||
|
|
|
@ -10,7 +10,7 @@ public class PacksackBagMgr : BaseManager<PacksackBagMgr>
|
|||
/// <summary>
|
||||
/// 背包里所有东西
|
||||
/// </summary>
|
||||
private Dictionary<string, List<ItemInfo>> toolAndMaterialDic = new Dictionary<string, List<ItemInfo>>();
|
||||
public Dictionary<string, List<ItemInfo>> toolAndMaterialDic = new Dictionary<string, List<ItemInfo>>();
|
||||
/// <summary>
|
||||
/// 已经穿戴
|
||||
/// </summary>
|
||||
|
|
|
@ -40,7 +40,11 @@ public class MobileController : PermanentTriggerBase
|
|||
{
|
||||
GameManager.UIMgr.ShowPanel<UI_CustomSessionPanel>(E_UI_Layer.Mid, (panel) =>
|
||||
{
|
||||
panel.Init(triggerID, "好的", (intTemp) => { GameManager.UIMgr.HidePanel<UI_CustomSessionPanel>(); });
|
||||
panel.Init(triggerID, "好的", (intTemp) =>
|
||||
{
|
||||
ScoreManager.instance.Check(triggerName, "工作预约完成");
|
||||
GameManager.UIMgr.HidePanel<UI_CustomSessionPanel>();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
using HighlightPlus;
|
||||
using UnityEngine.EventSystems;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// ³£×¤½»»¥
|
||||
|
@ -12,9 +13,16 @@ public class PermanentTriggerBase : MonoBehaviour
|
|||
public int triggerID;
|
||||
public string triggerName;
|
||||
public HighlightEffect _highlight;
|
||||
|
||||
/// <summary>
|
||||
/// 打分事件
|
||||
/// </summary>
|
||||
public Action<string, object, int, int> scoreAction;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
OnAwake();
|
||||
AddScoreAction(ScoreManager.instance.Check);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
|
@ -87,4 +95,9 @@ public class PermanentTriggerBase : MonoBehaviour
|
|||
//{
|
||||
// GameManager.EventMgr.RemoveEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
|
||||
//}
|
||||
|
||||
public void AddScoreAction(Action<string, object, int, int> back)
|
||||
{
|
||||
this.scoreAction = back;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,6 +184,8 @@ public class UI_MenuBar : BasePanel
|
|||
{
|
||||
panel.Init();
|
||||
GameManager.EventMgr.EventTrigger<float>(Enum_EventType.UpdateProgress, 0.1f);
|
||||
//判分
|
||||
ScoreManager.instance.Check(siteName, null);
|
||||
GameManager.ScenesMgr.LoadSceneAsyn("05_LiveScene", () =>
|
||||
{
|
||||
GameManager.EventMgr.EventTrigger<float>(Enum_EventType.UpdateProgress, 0.9f);
|
||||
|
|
|
@ -17,6 +17,7 @@ public class UI_ReceiveTaskPanel : BasePanel
|
|||
case "Button_Accept":
|
||||
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, true) == 0)
|
||||
{
|
||||
ScoreManager.instance.Check(triggerName, "任务接受完成");
|
||||
//GameManager.ProcessMgr.CheckSubProcessSteps(GameManager.ProcessMgr.subProcessStepId);
|
||||
GameManager.UIMgr.HidePanel<UI_ReceiveTaskPanel>();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue