コード例 #1
0
 public void OnViewFrameTime(float dt)
 {
     if (this.currentTask == null)
     {
         if (this.tasks.Count == 0)
         {
             if (this.completeCallback != null)
             {
                 this.completeCallback();
             }
             Service.ViewTimeEngine.UnregisterFrameTimeObserver(this);
         }
         else
         {
             this.currentTask = this.tasks.Dequeue();
             float endPercentage = (this.tasks.Count != 0) ? this.tasks.Peek().Percentage : 100f;
             this.currentTask.EndPercentage = endPercentage;
             this.currentTaskCompleted      = false;
             this.currentTask.Start();
             if (this.allStartsMustComplete && !this.currentTaskCompleted)
             {
                 Service.Logger.Error(this.currentTask.GetType().Name + " must call Complete() from its Start()");
             }
         }
     }
     if (this.progressCallback != null && this.currentTask != null)
     {
         this.progressCallback(this.currentTask.Percentage, this.currentTask.Description);
     }
 }
コード例 #2
0
 public void OnViewFrameTime(float dt)
 {
     if (this.currentTask == null)
     {
         if (this.tasks.Count == 0)
         {
             if (this.completeCallback != null)
             {
                 this.completeCallback();
             }
             Service.Get <ViewTimeEngine>().UnregisterFrameTimeObserver(this);
         }
         else
         {
             this.currentTask = this.tasks.Dequeue();
             float endPercentage = (this.tasks.Count == 0) ? 100f : this.tasks.Peek().Percentage;
             this.currentTask.EndPercentage = endPercentage;
             this.currentTaskCompleted      = false;
             this.currentTask.Start();
         }
     }
     if (this.progressCallback != null && this.currentTask != null)
     {
         this.progressCallback(this.currentTask.Percentage, this.currentTask.Description);
     }
 }
コード例 #3
0
 public StartupTaskController(StartupTaskProgress progressCallback, StartupTaskComplete completeCallback)
 {
     this.progressCallback      = progressCallback;
     this.completeCallback      = completeCallback;
     this.tasks                 = new Queue <StartupTask>();
     this.currentTask           = null;
     this.allStartsMustComplete = false;
     this.currentTaskCompleted  = false;
 }
コード例 #4
0
 public void AddTask(StartupTask task)
 {
     task.Startup = this;
     if (this.tasks.Count == 0)
     {
         Service.ViewTimeEngine.RegisterFrameTimeObserver(this);
     }
     if (task != null)
     {
         this.tasks.Enqueue(task);
     }
 }
コード例 #5
0
 public void OnTaskComplete(StartupTask task)
 {
     if (task == this.currentTask)
     {
         this.currentTaskCompleted = true;
         if (this.progressCallback != null)
         {
             this.progressCallback(this.currentTask.EndPercentage, this.currentTask.Description);
         }
         task.Startup     = null;
         this.currentTask = null;
     }
 }