protected HandleExceptionAndRetryActionDecorator(ITaskAction action, IExceptionHandler exceptionHandler)
        {
            RetryInterval = BackoffInterval.Default;

            _action = action;
            _exceptionHandler = exceptionHandler;
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <param name="taskAction"></param>
 public void RegisterAction(string name, ITaskAction taskAction)
 {
     lock (SyncObject)
     {
         if (this.actionMap.ContainsKey(name) == false)
         {
             this.waitIntervalMap[name] = TimeSpan.Zero;
             this.actionMap[name]       = taskAction;
         }
     }
 }
示例#3
0
        // Concat
        public static ITaskAction Concat(this ITaskAction firstAction, ITaskAction secondAction)
        {
            #region Contracts

            if (firstAction == null) throw new ArgumentNullException();
            if (secondAction == null) throw new ArgumentNullException();

            #endregion

            // Return
            return new ConcatAction(firstAction, secondAction);
        }
 public void AddWork(ITaskAction action)
 {
     lockSlim.EnterWriteLock();
     try
     {
         queue.Enqueue(action);
     }
     finally
     {
         lockSlim.ExitWriteLock();
     }
 }
示例#5
0
        // Constructors
        public ConcatAction(ITaskAction firstAction, ITaskAction secondAction)
        {
            #region Contracts

            if (firstAction == null) throw new ArgumentNullException();
            if (secondAction == null) throw new ArgumentNullException();

            #endregion

            // Arguments
            _firstAction = firstAction;
            _secondAction = secondAction;
        }
示例#6
0
 public ITaskAction RequestNextTask()
 {
     if (taskList.Count > 0)
     {
         ITaskAction task = taskList[0];
         _curTask = task;
         taskList.RemoveAt(0);
         return(task);
     }
     else
     {
         // No tasks are available
         return(null);
     }
 }
示例#7
0
        // Constructors
        public TaskSetting(string taskSettingId, string taskSettingName, ITaskTrigger taskTrigger, ITaskAction taskAction)
        {
            #region Contracts

            if (string.IsNullOrEmpty(taskSettingName) == true) throw new ArgumentNullException();
            if (taskTrigger == null) throw new ArgumentNullException();
            if (taskAction == null) throw new ArgumentNullException();

            #endregion

            // Arguments
            this.TaskSettingId = taskSettingId;
            this.TaskSettingName = taskSettingName;
            this.TaskTrigger = taskTrigger;
            this.TaskAction = taskAction;
        }
        public static void AddWork(ITaskAction taskAction, int userId)
        {
            if (workers.ContainsKey(userId))
            {
                workers[userId].AddWork(taskAction);
            }
            else
            {
                var worker = new Worker();

                worker.AddWork(taskAction);

                Task.Run(() => worker.Run());

                workers.Add(userId, worker);
            }
        }
示例#9
0
        public ITaskAction CreateInstanceByTypeName(string typename)
        {
            if (pairs == null)
            {
                LoadTypesInfo();
            }
            ITaskAction obj = null;

            if (pairstypename.TryGetValue(typename, out var t))
            {
                obj = CreateInstance(t);
            }
            if (obj != null)
            {
                obj.ServiceProvider = this._sp;
            }
            return(obj);
        }
    private void ExecuteTask(ITaskAction task)
    {
        //ICharacterAnim ica = task.TheCharacter;

        //if (task.TheActionName.CompareTo(GameSettings.Instance.Toss) == 0)
        //{

        //    ica.AnimateToss(DelayedCallBAckWhenTossPeacks);
        //}
        //else
        //if (task.TheActionName.CompareTo(GameSettings.Instance.Catch) == 0)
        //{

        //}
        //else

        //    ica.AnimateNamedAction(task.TheActionName, TheCallBackAfterAnimStetends);//and when he gets there run the call backs  or void Onarrivetopos(){ state= Stae.WaitingForNexrTask;}
    }
示例#11
0
        // Concat
        public static ITaskAction Concat(this ITaskAction firstAction, ITaskAction secondAction)
        {
            #region Contracts

            if (firstAction == null)
            {
                throw new ArgumentNullException();
            }
            if (secondAction == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Return
            return(new ConcatAction(firstAction, secondAction));
        }
示例#12
0
        // Constructors
        public ConcatAction(ITaskAction firstAction, ITaskAction secondAction)
        {
            #region Contracts

            if (firstAction == null)
            {
                throw new ArgumentNullException();
            }
            if (secondAction == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Arguments
            _firstAction  = firstAction;
            _secondAction = secondAction;
        }
示例#13
0
    void HeardTaskEnded()
    {
        if (!gamestarted)
        {
            return;               //make listen to state change instead
        }
        ITaskAction task = TaskSys.RequestNextTask();

        if (task != null)
        {
            task.RunME();
        }
        else
        {//no more tasks
            if (sequencStarted)
            {
                BellHopGameEventManager.Instance.Call_CurSequenceChanged(GameSequenceType.PlayerInputs);
            }


            sequencStarted = false;
        }
    }
示例#14
0
 public void AddTask(ITaskAction task)
 {
     taskList.Add(task);
 }
    public void InitActionCTRL(GameEnums.TaskSequenceType argSequenceType, ICharacterAnim argBunny, ICharacterAnim argDweller, DeliveryItem argContextItem)
    {
        _CurSequenceType = argSequenceType;
        MyBunny          = argBunny;
        MyDweller        = argDweller;

        MyContextItem = argContextItem;
        if (_CurSequenceType == GameEnums.TaskSequenceType.Wrongfloor)
        {
            MyBunny.AnimTrigger("Actions");
            MyDweller.AnimTrigger("Actions");
            MAkeWrongFloorTAsk();
            ITaskAction task = taskSystem.RequestNextTask();
            if (task != null)
            {
                ExecuteTask(task);
            }
        }
        else
        if (_CurSequenceType == GameEnums.TaskSequenceType.CutScene)
        {
            MyDweller.AnimTrigger("MoveOn");
            //  MAkeTasks();
            // TheCallBackAfterAnimStetends();
        }
        else
        if (_CurSequenceType == GameEnums.TaskSequenceType.Dweller_toss_Bunny)
        {
            MyBunny.AnimTrigger("Actions");
            MyDweller.AnimTrigger("Actions");
            MAkeDweller_toss_Bunny();
            ITaskAction task = taskSystem.RequestNextTask();
            if (task != null)
            {
                ExecuteTask(task);
            }
        }
        else
        if (_CurSequenceType == GameEnums.TaskSequenceType.Bunny_tossDweller)
        {
            MyBunny.AnimTrigger("Actions");
            MyDweller.AnimTrigger("Actions");
            MAkeBunnyTossDweller();

            // TheCallBackAfterAnimStetends();
            ITaskAction task = taskSystem.RequestNextTask();
            if (task != null)
            {
                ExecuteTask(task);
            }
        }
        else
        if (_CurSequenceType == GameEnums.TaskSequenceType.TowWayExchange)
        {
            MyBunny.AnimTrigger("Actions");
            MyDweller.AnimTrigger("Actions");

            MakeToss2wayTAsk();
            // TheCallBackAfterAnimStetends();
            ITaskAction task = taskSystem.RequestNextTask();
            if (task != null)
            {
                ExecuteTask(task);
            }
        }
    }
示例#16
0
 void Invoke(string aName, ITaskAction taskAction)
 {
     this.waitIntervalMap[aName] = TimeSpan.Zero;
     taskAction.Invoke();
 }
 public RetryUntilCanceledActionDecorator(ITaskAction action, IExceptionHandler exceptionHandler)
     : base(action, exceptionHandler)
 {
 }
 public TaskActionServiceRunner(ITaskAction action, IExceptionHandler exceptionHandler)
 {
     _cancellationTokenSource = new CancellationTokenSource();
     _retryUntilCanceledActionDecorator = new RetryUntilCanceledActionDecorator(action, exceptionHandler);
 }
 public RetryOnExceptionActionDecorator(ITaskAction action, IExceptionHandler handler)
     : base(action, handler)
 {
 }
示例#20
0
        // Constructors
        public TaskSetting(string taskSettingId, string taskSettingName, ITaskTrigger taskTrigger, ITaskAction taskAction)
        {
            #region Contracts

            if (string.IsNullOrEmpty(taskSettingName) == true)
            {
                throw new ArgumentNullException();
            }
            if (taskTrigger == null)
            {
                throw new ArgumentNullException();
            }
            if (taskAction == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Arguments
            this.TaskSettingId   = taskSettingId;
            this.TaskSettingName = taskSettingName;
            this.TaskTrigger     = taskTrigger;
            this.TaskAction      = taskAction;
        }
示例#21
0
 public PolishLineStartActionLog(ITaskAction obj)
 {
     _obj = obj;
 }