//------------------------------------------------------------------------- public TaskBase(TaskMgr task_mgr, Entity et, int task_id) { TaskData task_data = new TaskData(); task_data.task_id = task_id; task_data.task_state = TaskState.Init; task_data.task_data = new Dictionary<byte, string>(); _init(task_mgr, et, task_data); }
//------------------------------------------------------------------------- void _init(TaskMgr task_mgr, Entity et, TaskData task_data) { TaskMgr = task_mgr; Entity = et; TaskData = task_data; if (TaskData.task_data == null) { TaskData.task_data = new Dictionary <byte, string>(); } TbDataTask = EbDataMgr.Instance.getData <TbDataTask>(TaskData.task_id); onInit(); }
//------------------------------------------------------------------------- public override void init() { CoActor = Entity.getComponent <CellActor <DefActor> >(); CoPlayer = Entity.getComponent <CellPlayer <DefPlayer> >(); if (CoActor.Def.mPropIsBot.get()) { return; } TaskMgr = new TaskMgr(Entity, false); TaskMgr.regTaskFactory(new TaskFactoryCollectItem()); TaskMgr.regTaskFactory(new TaskFactoryDialogue()); TaskMgr.regTaskFactory(new TaskFactoryKillMonster()); TaskMgr.OnServerTaskAward = _onTaskAward; if (Def.mPropFirstRun.get()) { // 读取任务配置文件 List <int> list_taskstory_starttasyid = CellApp.Instance.Cfg.ListTaskStoryStartTaskId; List <TaskData> list_taskdata = Def.mPropListTaskData.get(); if (list_taskdata.Count == 0) { foreach (var i in list_taskstory_starttasyid) { TaskData td = new TaskData(); td.task_id = i; td.task_data = new Dictionary <byte, string>(); td.task_state = TaskState.Init; list_taskdata.Add(td); } } Def.mPropFirstRun.set(true); } TaskMgr.loadAllTask(Def.mPropListTaskData.get()); }
//------------------------------------------------------------------------- public TaskDialogue(TaskMgr task_mgr, Entity et, TaskData task_data) : base(task_mgr, et, task_data) { }
//------------------------------------------------------------------------- public override TaskBase createTask(TaskData task_data) { var task = new TaskDialogue(TaskMgr, Entity, task_data); return(task); }
//------------------------------------------------------------------------- public TaskCollectItem(TaskMgr task_mgr, Entity et, TaskData task_data) : base(task_mgr, et, task_data) { }
//------------------------------------------------------------------------- public TaskBase(TaskMgr task_mgr, Entity et, TaskData task_data) { _init(task_mgr, et, task_data); }
//------------------------------------------------------------------------- public override TaskBase createTask(TaskData task_data) { var task = new TaskDialogue(TaskMgr, Entity, task_data); return task; }
//------------------------------------------------------------------------- public void clientUpdateTask(TaskData task_data) { TaskData = task_data; }
//------------------------------------------------------------------------- public override TaskBase createTask(TaskData task_data) { var task = new TaskCollectItem(TaskMgr, Entity, task_data); return task; }
//------------------------------------------------------------------------- public TaskKillMonster(TaskMgr task_mgr, Entity et, TaskData task_data) : base(task_mgr, et, task_data) { }
//------------------------------------------------------------------------- public override TaskBase createTask(TaskData task_data) { var task = new TaskKillMonster(TaskMgr, Entity, task_data); return task; }
//------------------------------------------------------------------------- public override TaskBase createTask(TaskData task_data) { var task = new TaskKillMonster(TaskMgr, Entity, task_data); return(task); }
//------------------------------------------------------------------------- void _init(TaskMgr task_mgr, Entity et, TaskData task_data) { TaskMgr = task_mgr; Entity = et; TaskData = task_data; if (TaskData.task_data == null) TaskData.task_data = new Dictionary<byte, string>(); TbDataTask = EbDataMgr.Instance.getData<TbDataTask>(TaskData.task_id); onInit(); }
//------------------------------------------------------------------------- public abstract TaskBase createTask(TaskData task_data);
//------------------------------------------------------------------------- public override TaskBase createTask(TaskData task_data) { var task = new TaskCollectItem(TaskMgr, Entity, task_data); return(task); }