Ejemplo n.º 1
0
    public BaseRunner Run <T>(Action <T> action, T arg)
    {
        var task = new TypedTask(() => action(arg), RunType.And);

        Tasks.Add(task);
        return(this);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Schedules a delay.
    /// </summary>
    /// <param name="delay">The delay in milliseconds.</param>
    /// <returns>A <see cref="BaseRunner"/> ready to schedule tasks for execution.</returns>
    public BaseRunner Run(int delay)
    {
        var task = new TypedTask(delay);

        Tasks.Add(task);
        return(this);
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the given actions as tasks to be scheduled and run.
 /// </summary>
 /// <param name="actions"></param>
 /// <returns></returns>
 public BaseRunner Run(IEnumerable <Action> actions)
 {
     foreach (var action in actions)
     {
         var task = new TypedTask(action, RunType.And);
         Tasks.Add(task);
     }
     return(this);
 }
Ejemplo n.º 4
0
        public virtual void Init(BaseUnit selfUnit)
        {
            if (selfUnit == null)
            {
                CLog.Error("Objectiver.Init:selfUnit==null");
                return;
            }
            SelfBaseUnit = selfUnit;
            OnAddConfig();
            Enum <TEnum> .ForIndex(x =>
            {
                int enumIndex = x;
                AssignedTask.Add(enumIndex, new HashSet <Task>());
                TypedTask.Add(enumIndex, new List <Task>());
                TypeIdles.Add(enumIndex, new HashList <TUnit>());
                if (!ConfigData.ContainsKey(enumIndex))
                {
                    CLog.Error("错误!{0}:没有配置ConfigData", x.ToString());
                }
            });

            BaseUnit.Callback_OnRealDeathG += OnRealDeathG;
        }