Example #1
0
    public bool InitTaskData(PCondition[] condition = null)
    {
        TaskConfig taskconfig = ConfigManager.Get <TaskConfig>(m_taskID);

        if (taskconfig == null)
        {
            Logger.LogError("The taskid:{0} configuration information does not exist on the client.", m_taskID);
            return(false);
        }
        this.taskConditionType = taskconfig.taskFinishType;
        this.taskFinished      = taskconfig.taskFinishType == EnumTaskConditionType.FinishAll ? true : false;
        this.taskTargetID      = (NpcTypeID)taskconfig.targetID;
        this.taskType          = taskconfig.taskType;
        this.taskNameID        = taskconfig.taskNameID;
        this.taskIconID        = taskconfig.taskIconID;
        this.taskPressIcon     = taskconfig.taskPressIcon;
        this.taskDescID        = taskconfig.taskDescID;
        this.taskBelongScene   = taskconfig.markSceneID;
        for (int m = 0; m < taskconfig.taskFinishConditions.Length; m++)
        {
            taskconfig.taskFinishConditions[m].progress = 0;
            this.AddCondition(taskconfig.taskFinishConditions[m]);
        }
        if (condition != null)
        {
            if (!SetConditionValue(condition))
            {
                Logger.LogError("The taskid:{0}  The client configuration Condition Not Equal Server Condition.", m_taskID);
                return(false);
            }
        }
        m_taskSM = new TaskStateManger();
        m_taskSM.Region("Begin", new BeginTaskState(m_taskSM, this));
        m_taskSM.Region("Run", new RunningTaskState(m_taskSM, this));
        m_taskSM.Region("PreFinish", new PreFinishTaskState(m_taskSM, this));
        m_taskSM.Region("Finish", new FinishTaskState(m_taskSM, this));
        return(true);
    }
Example #2
0
 public FinishTaskState(TaskStateManger sm, Task tk) : base(sm, tk)
 {
     m_taskState = EnumTaskState.Finish;
 }
Example #3
0
 public RunningTaskState(TaskStateManger sm, Task tk) : base(sm, tk)
 {
     m_taskState = EnumTaskState.Runing;
 }
Example #4
0
 public BeginTaskState(TaskStateManger sm, Task tk) : base(sm, tk)
 {
     m_taskState = EnumTaskState.Begin;
 }
Example #5
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="sm"></param>
 public TaskState(TaskStateManger sm, Task tk)
 {
     m_taskSM = sm;
     m_task   = tk;
 }