Ejemplo n.º 1
0
 public bool Close()
 {
     if (this._pTasks != null)
     {
         for (int i = 0; i < this._pTasks.taskNum; i++)
         {
             DebugUtils.dbgAssert(null != this._pTasks.tasks);
             if (this._pTasks.tasks[i] != null)
             {
                 if (this == this._pTasks.tasks[i]._pTaskParent && !this._pTasks.tasks[i].Close())
                 {
                     return(false);
                 }
             }
         }
     }
     this._iMode = Task.TaskMode.TaskMode_UnInit;
     if (!this.UnInit())
     {
         return(false);
     }
     if (this._pTasks != null)
     {
         DebugUtils.dbgAssert(null != this._pTasks.tasks);
         DebugUtils.dbgAssert(this._iTask >= 0 && this._iTask < this._pTasks.taskNum);
         this._pTasks.tasks[this._iTask] = null;
     }
     this._pTasks      = null;
     this._iTask       = -1;
     this._pTaskParent = null;
     this._iMode       = Task.TaskMode.TaskMode_ST;
     return(true);
 }
Ejemplo n.º 2
0
 public Task()
 {
     this._pTasks      = null;
     this._iTask       = -1;
     this._pTaskParent = null;
     this._iMode       = Task.TaskMode.TaskMode_ST;
 }
Ejemplo n.º 3
0
        public bool Run()
        {
            switch (this._iMode)
            {
            case Task.TaskMode.TaskMode_Init:
                if (this.Init())
                {
                    this._iMode = Task.TaskMode.TaskMode_Update;
                }
                break;

            case Task.TaskMode.TaskMode_Update:
                if (!this.Update())
                {
                    this._iMode = Task.TaskMode.TaskMode_UnInit;
                }
                break;

            case Task.TaskMode.TaskMode_UnInit:
                if (!this.Close())
                {
                }
                break;
            }
            return(this.IsRun());
        }
Ejemplo n.º 4
0
 public bool Open(Tasks pTasks, int iTask, Task pTaskParent)
 {
     this._pTasks = pTasks;
     DebugUtils.dbgAssert(this._iMode == Task.TaskMode.TaskMode_ST);
     if (pTasks != null)
     {
         pTasks.tasks[iTask] = this;
     }
     this._iTask       = iTask;
     this._pTaskParent = pTaskParent;
     this._iMode       = Task.TaskMode.TaskMode_Init;
     return(true);
 }