private void OnClickGet(GameObject go) { if (MainTaskManager.Instance.ClickLock) { return; } BaseTask task = MainTaskManager.Instance.GetTask(TaskDescUI.OpenByTaskId, true); if (task != null) { switch (task.Task.status) { case Package.Task.TaskStatus.TaskCanAccept: task.Accept(); this.Show(false); break; case Package.Task.TaskStatus.TaskReceived: task.Execute(false, false); this.Show(false); break; case Package.Task.TaskStatus.WaitingToClaimPrize: if (TaskDescUI.OpenByNpc > 0 || task.Data.quickComplete == 1) { bool isUseDiamond = go.Equals(this.mBtnGetMultiple.get_gameObject()); if (GodWeaponProgressManager.Instance.NeedPlayCommitEffect(task, new Action <BaseTask, bool>(this.CommitTask), isUseDiamond)) { MainTaskManager.Instance.ClickLock = true; } else { this.CommitTask(task, isUseDiamond); } } else { task.Execute(false, false); this.Show(false); } break; } } }
private void ProcessTask(BaseTask task) { if (!task.ShouldExecute()) { AddTaskToQueue(task); } else { task.Execute(); } }
public void Enqueue(BaseTask task) { if (task.ShouldExecute()) { task.Execute(); } else { var timer = _dependencyFactory.TimerFactory.CreateTimer(); timer.Action = () => { Enqueue(task); timer.Dispose(); }; timer.Interval = (task.ExecuteAtTime - _dependencyFactory.DateTimeProvider.Now).TotalMilliseconds; timer.Start(); } }