Compare commits
3 Commits
0aa001c950
...
c4d6ab745f
Author | SHA1 | Date |
---|---|---|
|
c4d6ab745f | |
|
5f1e34b3d0 | |
|
066c238fea |
|
@ -39,7 +39,7 @@ public class ScoreManager : MonoBehaviour
|
|||
scoreSubjectList.Find(a => a.systemId == systemctlid && a.schemeId == schemeid)?.CheckScore(triggerName, para);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取总分
|
||||
/// 根据方案/科目ID获取总分
|
||||
/// </summary>
|
||||
/// <param name="subjectid"></param>
|
||||
/// <returns></returns>
|
||||
|
@ -61,4 +61,5 @@ public class ScoreManager : MonoBehaviour
|
|||
|
||||
return scoreModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ public class LiveSceneManager : SingletonMono<LiveSceneManager>
|
|||
base.Awake();
|
||||
firstPersonController = GameObject.FindGameObjectWithTag("Player").GetComponent<FirstPersonController>();
|
||||
tMDTips.gameObject.SetActive(false);
|
||||
GameManager.EventMgr.AddEventListener<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, SetSpawnToolInfo);
|
||||
firstPersonController.zoomAction += OnZoom;
|
||||
}
|
||||
|
||||
|
@ -26,6 +27,7 @@ public class LiveSceneManager : SingletonMono<LiveSceneManager>
|
|||
}
|
||||
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<LiveSceneManager>
|
|||
tMDTips.gameObject.SetActive(false);
|
||||
currentTool.transform.localEulerAngles = new Vector3(-90, 0, -180);
|
||||
}
|
||||
if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
|
||||
GameManager.EventMgr.EventTrigger<bool>(Enum_EventType.TakeOutAndRetrievingTheTools, false);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
@ -99,8 +99,7 @@ public class LiveSceneManager : SingletonMono<LiveSceneManager>
|
|||
if (ifdestroy)
|
||||
Destroy(currentTool);
|
||||
currentTool = null;
|
||||
if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
|
||||
GameManager.EventMgr.EventTrigger<bool>(Enum_EventType.TakeOutAndRetrievingTheTools, true);
|
||||
GameManager.EventMgr.EventTrigger<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, null);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
|
|
@ -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 = $"<color=#00EEE6>{sInfo.pointScore}<color>/{sInfo.maxScore}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,8 @@ public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
|
|||
currentTool.GetComponent<BaseToolOrDevice>().enabled = false;
|
||||
currentTool.GetComponent<Collider>().enabled = false;
|
||||
currentTool.name = currentItem.toolName;
|
||||
LiveSceneManager.Instance.SetSpawnToolInfo(currentTool);
|
||||
GameManager.EventMgr.EventTrigger<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, currentTool);
|
||||
//LiveSceneManager.Instance.SetSpawnToolInfo(currentTool);
|
||||
GameManager.UIMgr.imageTips.HideTips();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -57,13 +57,13 @@ public class UI_MenuBar : BasePanel
|
|||
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
|
||||
GameManager.EventMgr.AddEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
|
||||
else
|
||||
GameManager.EventMgr.AddEventListener<bool>(Enum_EventType.TakeOutAndRetrievingTheTools, TakeOutAndRetrievingTheTools);
|
||||
GameManager.EventMgr.AddEventListener<GameObject>(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<E_SceneType>(Enum_EventType.SwitchScene, CheckBtnBySceneName);
|
||||
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
|
||||
GameManager.EventMgr.RemoveEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
|
||||
else
|
||||
GameManager.EventMgr.RemoveEventListener<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, TakeOutAndRetrievingTheTools);
|
||||
}
|
||||
public void CheckBtnBySceneName(E_SceneType type)
|
||||
{
|
||||
|
|
|
@ -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<TextMeshProUGUI>("ScoreRes").text = scoreModel.score.ToString();
|
||||
GetControl<TextMeshProUGUI>("UsedTimesRes").text = "00:555";
|
||||
GetControl<TextMeshProUGUI>("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<UI_PracticeCompletedPanel>();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
GameManager.UIMgr.HidePanel<UI_PracticeCompletedPanel>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,18 @@ public class EventInfo<T> : IEventInfo
|
|||
actions += action;
|
||||
}
|
||||
}
|
||||
public class EventInfo<T, D> : IEventInfo
|
||||
{
|
||||
public UnityAction<T, D> actions;
|
||||
|
||||
public EventInfo(UnityAction<T, D> action)
|
||||
{
|
||||
actions += action;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class EventInfo: IEventInfo
|
||||
public class EventInfo : IEventInfo
|
||||
{
|
||||
public UnityAction actions;
|
||||
|
||||
|
@ -80,6 +89,23 @@ public class EventCenter : BaseManager<EventCenter>
|
|||
eventEnumDic.Add(type, new EventInfo<T>(action));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加有多个参事件监听
|
||||
/// </summary>
|
||||
/// <typeparam name="T">参数类型</typeparam>
|
||||
/// <param name="type">事件名称</param>
|
||||
/// <param name="action">有参委托函数</param>
|
||||
public void AddEventListener<T,D>(Enum_EventType type, UnityAction<T,D> action)
|
||||
{
|
||||
if (eventEnumDic.ContainsKey(type))
|
||||
{
|
||||
(eventEnumDic[type] as EventInfo<T,D>).actions += action;
|
||||
}
|
||||
else
|
||||
{
|
||||
eventEnumDic.Add(type, new EventInfo<T,D>(action));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除无参事件监听
|
||||
|
@ -107,6 +133,19 @@ public class EventCenter : BaseManager<EventCenter>
|
|||
(eventEnumDic[type] as EventInfo<T>).actions -= action;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 移除有多个参事件监听
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="action"></param>
|
||||
public void RemoveEventListener<T,D>(Enum_EventType type, UnityAction<T,D> action)
|
||||
{
|
||||
if (eventEnumDic.ContainsKey(type))
|
||||
{
|
||||
(eventEnumDic[type] as EventInfo<T,D>).actions -= action;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发无参事件
|
||||
|
@ -130,7 +169,16 @@ public class EventCenter : BaseManager<EventCenter>
|
|||
(eventEnumDic[type] as EventInfo<T>).actions?.Invoke(info);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发有多个参事件
|
||||
/// </summary>
|
||||
public void EventTrigger<T, D>(Enum_EventType type, T info, D info2)
|
||||
{
|
||||
if (eventEnumDic.ContainsKey(type))
|
||||
{
|
||||
(eventEnumDic[type] as EventInfo<T, D>).actions?.Invoke(info, info2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加无参事件监听
|
||||
|
@ -194,6 +242,8 @@ public class EventCenter : BaseManager<EventCenter>
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 触发无参事件
|
||||
/// </summary>
|
||||
|
@ -217,16 +267,7 @@ public class EventCenter : BaseManager<EventCenter>
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发有参事件
|
||||
/// </summary>
|
||||
public void EventTrigger<T,D>(string eventName, T info)
|
||||
{
|
||||
if (eventDic.ContainsKey(eventName))
|
||||
{
|
||||
(eventDic[eventName] as EventInfo<T>).actions?.Invoke(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 清空所有事件监听
|
||||
|
|
Loading…
Reference in New Issue