Пример #1
0
 public void Initial(ResGameTask config, GameTaskSys rootSys)
 {
     this._rootSys     = rootSys;
     this._config      = config;
     this._current     = 0;
     this._timer       = 0;
     this._readyTimer  = 0;
     this._ownerGroups = null;
     this._state       = GameTask.State.AWAKE;
     DebugHelper.Assert(null != this._config, "GameTask.config must not be null!");
     this.OnInitial();
 }
Пример #2
0
        private void DoStart()
        {
            this._current = this.StartValue;
            Singleton <CTimerManager> .instance.RemoveTimerSafely(ref this._timer);

            if (this.TimeLimit > 0)
            {
                this._timer = Singleton <CTimerManager> .instance.AddTimer(this.TimeLimit, 1, new CTimer.OnTimeUpHandler(this.OnTimeOut), true);
            }
            this._state = GameTask.State.START;
            this.OnStart();
            this.RootSys._OnTaskStart(this);
        }
Пример #3
0
        public void Close()
        {
            if (this._state != GameTask.State.START)
            {
                return;
            }
            Singleton <CTimerManager> .instance.RemoveTimerSafely(ref this._timer);

            this.OnClose();
            this._state = GameTask.State.CLOSE;
            this.RootSys._OnTaskClose(this);
            if (this._ownerGroups != null)
            {
                for (int i = 0; i < this._ownerGroups.Count; i++)
                {
                    this._ownerGroups[i]._OnChildClosed(this);
                }
            }
        }
Пример #4
0
        public void Start()
        {
            if (this._state != GameTask.State.AWAKE)
            {
                return;
            }
            if (this.TimeReady > 0)
            {
                Singleton <CTimerManager> .instance.RemoveTimerSafely(ref this._readyTimer);

                this._readyTimer = Singleton <CTimerManager> .instance.AddTimer(this.TimeReady, 1, new CTimer.OnTimeUpHandler(this.OnReadyOver), true);

                this._state = GameTask.State.READY;
                this._rootSys._OnTaskReady(this);
            }
            else
            {
                this.DoStart();
            }
        }