diff --git a/Assets/Scripts/CXX/Score/ScoreManager.cs b/Assets/Scripts/CXX/Score/ScoreManager.cs
index f22daf6..a82e2da 100644
--- a/Assets/Scripts/CXX/Score/ScoreManager.cs
+++ b/Assets/Scripts/CXX/Score/ScoreManager.cs
@@ -39,7 +39,7 @@ public class ScoreManager : MonoBehaviour
scoreSubjectList.Find(a => a.systemId == systemctlid && a.schemeId == schemeid)?.CheckScore(triggerName, para);
}
///
- /// 获取总分
+ /// 根据方案/科目ID获取总分
///
///
///
@@ -61,4 +61,5 @@ public class ScoreManager : MonoBehaviour
return scoreModel;
}
+
}
diff --git a/Assets/Scripts/Project/Manager/LiveSceneManager.cs b/Assets/Scripts/Project/Manager/LiveSceneManager.cs
index 996f6e6..396e5c8 100644
--- a/Assets/Scripts/Project/Manager/LiveSceneManager.cs
+++ b/Assets/Scripts/Project/Manager/LiveSceneManager.cs
@@ -17,6 +17,7 @@ public class LiveSceneManager : SingletonMono
base.Awake();
firstPersonController = GameObject.FindGameObjectWithTag("Player").GetComponent();
tMDTips.gameObject.SetActive(false);
+ GameManager.EventMgr.AddEventListener(Enum_EventType.TakeOutAndRetrievingTheTools, SetSpawnToolInfo);
firstPersonController.zoomAction += OnZoom;
}
@@ -26,6 +27,7 @@ public class LiveSceneManager : SingletonMono
}
public void SetSpawnToolInfo(GameObject tool)
{
+ if (tool == null) return;
currentTool = tool;
currentTool.transform.parent = Camera.main.transform;
currentTool.transform.localPosition = spawnToolPos.localPosition;
@@ -73,8 +75,6 @@ public class LiveSceneManager : SingletonMono
tMDTips.gameObject.SetActive(false);
currentTool.transform.localEulerAngles = new Vector3(-90, 0, -180);
}
- if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
- GameManager.EventMgr.EventTrigger(Enum_EventType.TakeOutAndRetrievingTheTools, false);
}
private void Update()
@@ -99,8 +99,7 @@ public class LiveSceneManager : SingletonMono
if (ifdestroy)
Destroy(currentTool);
currentTool = null;
- if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
- GameManager.EventMgr.EventTrigger(Enum_EventType.TakeOutAndRetrievingTheTools, true);
+ GameManager.EventMgr.EventTrigger(Enum_EventType.TakeOutAndRetrievingTheTools, null);
}
private void OnDestroy()
diff --git a/Assets/Scripts/Project/UI/UI_Item/UI_PracticeInfoItem.cs b/Assets/Scripts/Project/UI/UI_Item/UI_PracticeInfoItem.cs
index 9d50d65..9c7a08e 100644
--- a/Assets/Scripts/Project/UI/UI_Item/UI_PracticeInfoItem.cs
+++ b/Assets/Scripts/Project/UI/UI_Item/UI_PracticeInfoItem.cs
@@ -9,11 +9,11 @@ public class UI_PracticeInfoItem : BaseItem
public TextMeshProUGUI point;
public TextMeshProUGUI pointInfo;
public TextMeshProUGUI score;
- public void Init(string _number,string _point,string _pointInfo,string _score)
+ public void Init(int count, ScoreInfo sInfo)
{
- number.text = _number;
- point.text = _point;
- pointInfo.text = _pointInfo;
- score.text = _score;
+ number.text = count.ToString();
+ point.text = sInfo.point;
+ pointInfo.text = sInfo.pointInfo;
+ score.text = $"{sInfo.pointScore}/{sInfo.maxScore}";
}
}
diff --git a/Assets/Scripts/Project/UI/UI_Item/UI_ToolOrMaterialsOrDeviceItem.cs b/Assets/Scripts/Project/UI/UI_Item/UI_ToolOrMaterialsOrDeviceItem.cs
index 844583f..1624c35 100644
--- a/Assets/Scripts/Project/UI/UI_Item/UI_ToolOrMaterialsOrDeviceItem.cs
+++ b/Assets/Scripts/Project/UI/UI_Item/UI_ToolOrMaterialsOrDeviceItem.cs
@@ -71,7 +71,8 @@ public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
currentTool.GetComponent().enabled = false;
currentTool.GetComponent().enabled = false;
currentTool.name = currentItem.toolName;
- LiveSceneManager.Instance.SetSpawnToolInfo(currentTool);
+ GameManager.EventMgr.EventTrigger(Enum_EventType.TakeOutAndRetrievingTheTools, currentTool);
+ //LiveSceneManager.Instance.SetSpawnToolInfo(currentTool);
GameManager.UIMgr.imageTips.HideTips();
}
break;
diff --git a/Assets/Scripts/Project/UI/UI_Panel/UI_MenuBar.cs b/Assets/Scripts/Project/UI/UI_Panel/UI_MenuBar.cs
index 5d9aa50..e833b8e 100644
--- a/Assets/Scripts/Project/UI/UI_Panel/UI_MenuBar.cs
+++ b/Assets/Scripts/Project/UI/UI_Panel/UI_MenuBar.cs
@@ -57,13 +57,13 @@ public class UI_MenuBar : BasePanel
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
GameManager.EventMgr.AddEventListener(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
else
- GameManager.EventMgr.AddEventListener(Enum_EventType.TakeOutAndRetrievingTheTools, TakeOutAndRetrievingTheTools);
+ GameManager.EventMgr.AddEventListener(Enum_EventType.TakeOutAndRetrievingTheTools, TakeOutAndRetrievingTheTools);
}
- private void TakeOutAndRetrievingTheTools(bool isOn)
+ private void TakeOutAndRetrievingTheTools(GameObject obj)
{
- toolKitBtn.interactable = isOn;
+ toolKitBtn.interactable = (obj == null);
}
private void SwitchSubProcessStepTriggerID(string triggerID)
@@ -124,6 +124,8 @@ public class UI_MenuBar : BasePanel
GameManager.EventMgr.RemoveEventListener(Enum_EventType.SwitchScene, CheckBtnBySceneName);
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
GameManager.EventMgr.RemoveEventListener(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
+ else
+ GameManager.EventMgr.RemoveEventListener(Enum_EventType.TakeOutAndRetrievingTheTools, TakeOutAndRetrievingTheTools);
}
public void CheckBtnBySceneName(E_SceneType type)
{
diff --git a/Assets/Scripts/Project/UI/UI_Panel/UI_PracticeCompletedPanel.cs b/Assets/Scripts/Project/UI/UI_Panel/UI_PracticeCompletedPanel.cs
index 57ba759..fbe7985 100644
--- a/Assets/Scripts/Project/UI/UI_Panel/UI_PracticeCompletedPanel.cs
+++ b/Assets/Scripts/Project/UI/UI_Panel/UI_PracticeCompletedPanel.cs
@@ -10,11 +10,17 @@ public class UI_PracticeCompletedPanel : BasePanel
public RectTransform content;
public void Init()
{
- //ScoreManager.instance.GetScore();
- //ScoreManager.instance.GetStepScore();
- UI_PracticeInfoItem temp = Instantiate(piiPrefab, content);
+ ScoreModel scoreModel = ScoreManager.instance.GetScore(GameManager.RunModelMgr.schemeID);
+
+ for (int i = 0; scoreModel.pointList.Count > 0; i++)
+ {
+ int index = i;
+ UI_PracticeInfoItem temp = Instantiate(piiPrefab, content);
+ temp.Init(index + 1, scoreModel.pointList[index]);
+ }
+
+ GetControl("ScoreRes").text = scoreModel.score.ToString();
GetControl("UsedTimesRes").text = "00:555";
- GetControl("ScoreRes").text = "123";
}
protected override void OnClick(string btnName)
@@ -28,10 +34,10 @@ public class UI_PracticeCompletedPanel : BasePanel
GameManager.Instance.ShowUIPanelAndLoadScene(true);
break;
case "closeBtn":
+ GameManager.UIMgr.HidePanel();
break;
default:
break;
}
- GameManager.UIMgr.HidePanel();
}
}
diff --git a/Assets/Scripts/ProjectBase/EventCenter/EventCenter.cs b/Assets/Scripts/ProjectBase/EventCenter/EventCenter.cs
index 94552d9..e505308 100644
--- a/Assets/Scripts/ProjectBase/EventCenter/EventCenter.cs
+++ b/Assets/Scripts/ProjectBase/EventCenter/EventCenter.cs
@@ -17,9 +17,18 @@ public class EventInfo : IEventInfo
actions += action;
}
}
+public class EventInfo : IEventInfo
+{
+ public UnityAction actions;
+
+ public EventInfo(UnityAction action)
+ {
+ actions += action;
+ }
+}
-public class EventInfo: IEventInfo
+public class EventInfo : IEventInfo
{
public UnityAction actions;
@@ -80,6 +89,23 @@ public class EventCenter : BaseManager
eventEnumDic.Add(type, new EventInfo(action));
}
}
+ ///
+ /// 娣诲姞鏈夊涓弬浜嬩欢鐩戝惉
+ ///
+ /// 鍙傛暟绫诲瀷
+ /// 浜嬩欢鍚嶇О
+ /// 鏈夊弬濮旀墭鍑芥暟
+ public void AddEventListener(Enum_EventType type, UnityAction action)
+ {
+ if (eventEnumDic.ContainsKey(type))
+ {
+ (eventEnumDic[type] as EventInfo).actions += action;
+ }
+ else
+ {
+ eventEnumDic.Add(type, new EventInfo(action));
+ }
+ }
///
/// 绉婚櫎鏃犲弬浜嬩欢鐩戝惉
@@ -107,6 +133,19 @@ public class EventCenter : BaseManager
(eventEnumDic[type] as EventInfo).actions -= action;
}
}
+ ///
+ /// 绉婚櫎鏈夊涓弬浜嬩欢鐩戝惉
+ ///
+ ///
+ ///
+ ///
+ public void RemoveEventListener(Enum_EventType type, UnityAction action)
+ {
+ if (eventEnumDic.ContainsKey(type))
+ {
+ (eventEnumDic[type] as EventInfo).actions -= action;
+ }
+ }
///
/// 瑙﹀彂鏃犲弬浜嬩欢
@@ -130,7 +169,16 @@ public class EventCenter : BaseManager
(eventEnumDic[type] as EventInfo).actions?.Invoke(info);
}
}
-
+ ///
+ /// 瑙﹀彂鏈夊涓弬浜嬩欢
+ ///
+ public void EventTrigger(Enum_EventType type, T info, D info2)
+ {
+ if (eventEnumDic.ContainsKey(type))
+ {
+ (eventEnumDic[type] as EventInfo).actions?.Invoke(info, info2);
+ }
+ }
///
/// 娣诲姞鏃犲弬浜嬩欢鐩戝惉
@@ -194,6 +242,8 @@ public class EventCenter : BaseManager
}
}
+
+
///
/// 瑙﹀彂鏃犲弬浜嬩欢
///
@@ -217,16 +267,7 @@ public class EventCenter : BaseManager
}
}
- ///
- /// 瑙﹀彂鏈夊弬浜嬩欢
- ///
- public void EventTrigger(string eventName, T info)
- {
- if (eventDic.ContainsKey(eventName))
- {
- (eventDic[eventName] as EventInfo).actions?.Invoke(info);
- }
- }
+
///
/// 娓呯┖鎵鏈変簨浠剁洃鍚