Beispiel #1
0
        private TaskCombineType taskRewardsCombineType;      // 奖励获取方式

        public void InitTask(ConfigData data)
        {
            taskID     = data.TaskID;
            entityType = data.taskEntityType;
            taskType   = data.taskType;
            nextTaskID = data.nextTaskId;
            taskTitle  = data.taskTitle;
            taskDesc   = data.taskDesc;

            taskRequirements = new List <TaskRequirement>();
            for (int i = 0; i < data.requirementList.Count; i++)
            {
                TaskRequirement requirement = new TaskRequirement();
                requirement.InitRequirement(CheckIsTaskFinished, data.requirementList[i].RequirementType, data.requirementList[i].RecordType, data.requirementList[i].TargetValue);
                taskRequirements.Add(requirement);
            }

            taskRewards = new List <TaskReward>();
            for (int i = 0; i < data.rewardList.Count; i++)
            {
                TaskReward reward = new TaskReward();
                reward.InitTaskReward(i, data.rewardList[i].RequirementType, data.rewardList[i].RewardValue);
                taskRewards.Add(reward);
            }

            taskRequirementsCombineType = data.taskCombineType;
            taskRewardsCombineType      = data.rewardGetType;

            InitTaskFinish();
        }
Beispiel #2
0
        public void InitTask(int taskid, TaskEntityType entitytype, TaskType tasktype, int nextid, string tasktitle, string taskdesc)
        {
            // test
            taskID     = taskid;
            entityType = entitytype;
            taskType   = tasktype;
            nextTaskID = nextid;
            taskTitle  = tasktitle;
            taskDesc   = taskdesc;
            TaskRequirement r1 = new TaskRequirement();

            r1.InitRequirement(CheckIsTaskFinished, TaskRequirementType.Gold, TaskRecordType.UseCurrent, 3000);
            TaskRequirement r2 = new TaskRequirement();

            r2.InitRequirement(CheckIsTaskFinished, TaskRequirementType.Level, TaskRecordType.UseCurrent, 20);
            taskRequirements = new List <TaskRequirement>()
            {
                r1, r2
            };

            TaskReward re1 = new TaskReward();

            re1.InitTaskReward(0, TaskRewardType.Exp, 100);
            TaskReward re2 = new TaskReward();

            re2.InitTaskReward(1, TaskRewardType.Gold, 50);
            taskRewards = new List <TaskReward>()
            {
                re1, re2
            };

            taskRequirementsCombineType = TaskCombineType.And;
            taskRewardsCombineType      = TaskCombineType.Or;

            InitTaskFinish();
        }