Compare commits

..

No commits in common. "01eea003950c4ccbd991da7a89173460a388f303" and "dec8d776555391501c1298dfab361dc95b0fb626" have entirely different histories.

11 changed files with 47 additions and 116 deletions

View File

@ -14,6 +14,11 @@ 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;
@ -23,6 +28,7 @@ public class Device_Base : PermanentTriggerBase
{
base.OnStart();
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
AddScoreAction(ScoreManager.instance.Check);
}
}
@ -47,6 +53,10 @@ public class Device_Base : PermanentTriggerBase
{
this.triggerAction = action;
}
public void AddScoreAction(Action<string, object, int, int> back)
{
this.scoreAction = back;
}
/// <summary>
/// 设置工具回到手中的位置

View File

@ -35,7 +35,7 @@ public abstract class ScoreBase : MonoBehaviour
/// <summary>
/// 判分
/// </summary>
public virtual void CheckScore(string triggerName,object para)
public virtual void CheckScore()
{
}

View File

@ -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(triggerName, para);
scoreSubjectList.Find(a => a.systemId == systemctlid && a.schemeId == schemeid)?.CheckScore();
}
}

View File

@ -4,10 +4,6 @@ using UnityEngine;
public class ScoreSubjectStep
{
/// <summary>
/// 步骤id
/// </summary>
public int subProcessId;
/// <summary>
/// 步骤满分
/// </summary>
@ -15,46 +11,19 @@ public class ScoreSubjectStep
/// <summary>
/// 步骤得分
/// </summary>
float currentScore=0;
float currentScore;
/// <summary>
/// 步骤是否已完成
/// </summary>
bool isDone;
public ScoreSubjectStep(int subProcessId,float maxScore)
{
this.subProcessId = subProcessId;
this.maxScore = maxScore;
}
public ScoreSubjectStep(float maxScore)
{
this.maxScore = maxScore;
}
/// <summary>
/// 得全或扣光
/// </summary>
/// <param name="AllScore"></param>
public void SetScore(bool AllScore)
public void SetScore(float score)
{
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));
}
isDone = true;
}
}

View File

@ -1,6 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class Score_1002 : ScoreBase
@ -11,65 +10,30 @@ 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>();
tmps.ForEach(a =>
{
steps.Add(a.subProcessId, a);
});
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));
}
public override void CheckScore(string triggerName, object para)
public override void 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);
base.CheckScore();
//检查背包是否携带
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));
}
}
}

View File

@ -18,7 +18,10 @@ 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;
@ -29,6 +32,7 @@ public class Tool_Base : PermanentTriggerBase
{
base.OnStart();
AddTriggerAction(GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID);
AddScoreAction(ScoreManager.instance.Check);
}
}
protected override void OnMEnter()
@ -54,6 +58,10 @@ public class Tool_Base : PermanentTriggerBase
this.triggerAction = action;
}
public void AddScoreAction(Action<string, object, int, int> back)
{
this.scoreAction = back;
}
/// <summary>
/// 设置工具回到手中的位置
/// </summary>

View File

@ -10,7 +10,7 @@ public class PacksackBagMgr : BaseManager<PacksackBagMgr>
/// <summary>
/// 背包里所有东西
/// </summary>
public Dictionary<string, List<ItemInfo>> toolAndMaterialDic = new Dictionary<string, List<ItemInfo>>();
private Dictionary<string, List<ItemInfo>> toolAndMaterialDic = new Dictionary<string, List<ItemInfo>>();
/// <summary>
/// 已经穿戴
/// </summary>

View File

@ -40,11 +40,7 @@ public class MobileController : PermanentTriggerBase
{
GameManager.UIMgr.ShowPanel<UI_CustomSessionPanel>(E_UI_Layer.Mid, (panel) =>
{
panel.Init(triggerID, "好的", (intTemp) =>
{
ScoreManager.instance.Check(triggerName, "工作预约完成");
GameManager.UIMgr.HidePanel<UI_CustomSessionPanel>();
});
panel.Init(triggerID, "好的", (intTemp) => { GameManager.UIMgr.HidePanel<UI_CustomSessionPanel>(); });
});
}
}

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using UnityEngine;
using HighlightPlus;
using UnityEngine.EventSystems;
using System;
/// <summary>
/// ³£×¤½»»¥
@ -13,16 +12,9 @@ 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()
@ -95,9 +87,4 @@ public class PermanentTriggerBase : MonoBehaviour
//{
// GameManager.EventMgr.RemoveEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
//}
public void AddScoreAction(Action<string, object, int, int> back)
{
this.scoreAction = back;
}
}

View File

@ -184,8 +184,6 @@ 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);

View File

@ -17,7 +17,6 @@ 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>();
}