Example #1
0
        public void UpdateTaskInfo(TaskProtoData data)
        {
            id       = data.id;
            taskData = TaskData.GetTaskDataByID(id);
            if (taskData == null)
            {
                Debugger.LogError("taskData is null ,task ID :" + id);
            }

            isFinished            = data.completed;
            isGetReward           = data.getReward;
            taskConditionDataList = new List <TaskConditionInfo>();

            List <TaskConditionProtoData> dataList = data.conditions;
            TaskConditionProtoData        conditionProtoData;

            for (int i = 0, count = dataList.Count; i < count; i++)
            {
                conditionProtoData = dataList[i];
                TaskConditionInfo taskConditionData = new TaskConditionInfo();
                taskConditionData.id         = conditionProtoData.id;
                taskConditionData.taskDataId = data.id;
                taskConditionData.value      = conditionProtoData.value < 0 ? 0 : conditionProtoData.value;
                taskConditionDataList.Add(taskConditionData);
            }
        }
Example #2
0
        public override string ToString()
        {
            TaskConditionInfo condition = GetFirstCondition();
            string            value     = "null";
            string            maxCount  = "null";

            if (condition != null)
            {
                value    = condition.value.ToString();
                maxCount = condition.maxCount.ToString();
            }
            return(string.Format("[任务]id:{0},title:{1},isFinished:{2},isGetReward:{3},condition[value:{4},MaxCount:{5},task:{6}]", id, Localization.Get(taskData.description), isFinished, isGetReward, value, maxCount, taskData.task));
        }