1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class TimeLineControl : MonoBehaviour {
- public static TimeLineControl Instance;
- public List<TimeLineChange> mTimeLineChange = new List<TimeLineChange>();
- private void Awake()
- {
- Instance = this;
- }
- public TimeLineControlType ControlType = TimeLineControlType.E_None;
- public int CurIndex = 0;
- public bool isOpen = false;
- public TimeLineChange CurTimeLineChange
- {
- get{ return mTimeLineChange[CurIndex]; }
- }
-
- void Start() {
- MessageCenterController.Instance.Register(GameEnum.MESSAGE_EXPLAIN_CLICK, OnEXPLAIN);
- MessageCenterController.Instance.Register(GameEnum.MESSAGE_PARCTICE_CLICK, OnPARCTICE);
- MessageCenterController.Instance.Register(GameEnum.MESSAGE_TAB_CHANGE, OnEnd);
- }
- private void OnDestroy()
- {
- MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_EXPLAIN_CLICK, OnEXPLAIN);
- MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_PARCTICE_CLICK, OnPARCTICE);
- MessageCenterController.Instance.UnRegister(GameEnum.MESSAGE_TAB_CHANGE, OnEnd);
- }
- void OnEXPLAIN(System.Object o)
- {
- CurTimeLineChange.CloseAllTimeLine();
- CurIndex = (int)o;
- ControlType = TimeLineControlType.E_Explain;
- CurTimeLineChange.SwitchDirector(ControlType);
- isOpen = true;
- TaskCanvas.Instance.gameObject.SetActive(false);
- }
- void OnPARCTICE(System.Object o)
- {
- CurTimeLineChange.CloseAllTimeLine();
- CurIndex = (int)o;
- ControlType = TimeLineControlType.E_StudentPractice;
- CurTimeLineChange.SwitchDirector(ControlType);
- TaskCanvas.Instance.gameObject.SetActive(true);
- isOpen = true;
- }
- void OnEnd(System.Object o)
- {
- CurTimeLineChange.CloseAllTimeLine();
- CurIndex = 0;
- ControlType = TimeLineControlType.E_None;
- isOpen = false;
- TaskCanvas.Instance.gameObject.SetActive(false);
- }
- private void Update()
- {
- if (!isOpen)
- { return; }
- }
- }
- public enum TimeLineControlType
- {
- E_Explain, //讲解
- E_StudentPractice, //学生练习
- E_None,
- }
|