public void onAddTask(SocketModel module) { TaskMessage.MsgAddNewTaskRep msg = MsgSerializer.Deserialize<TaskMessage.MsgAddNewTaskRep>(module); int templateID = msg.task.taskId; int type = StaticMission.Instance().getInt(templateID, "type"); TaskItem item = new TaskItem(); item.parseData(msg.task); if(type == (int)GlobalDef.TaskType.T_ONECE) { MonoInstancePool.getInstance<TaskManager>().getMainthreadTask().addTask(item); MonoInstancePool.getInstance<TaskManager>().getMainthreadTask().isDirty = true; } else if(type == (int)GlobalDef.TaskType.T_EVERTYDAY) { MonoInstancePool.getInstance<TaskManager>().getEveryDayTask().addTask(item); MonoInstancePool.getInstance<TaskManager>().getEveryDayTask().isDirty = true; } }
public void onGetTaskList(SocketModel module) { TaskMessage.MsgGetTaskListRep msg = MsgSerializer.Deserialize<TaskMessage.MsgGetTaskListRep>(module); for(int i = 0; i < msg.mainTaskList.Count; i++) { TaskItem item = new TaskItem(); TaskMessage.Task data = msg.mainTaskList[i]; item.parseData(data); // Debug.Log("---------------id: " + msg.mainTaskList[i].param1_value + " " + msg.mainTaskList[i].param2_value + " " + item.param1_value + " " + item.param2_value); MonoInstancePool.getInstance<TaskManager>().getMainthreadTask().addTask(item); MonoInstancePool.getInstance<TaskManager>().getMainthreadTask().isDirty = true; } for(int i = 0; i < msg.dailyTaskList.Count; i++) { TaskItem item = new TaskItem(); TaskMessage.Task data = msg.mainTaskList[i]; item.parseData(data); MonoInstancePool.getInstance<TaskManager>().getEveryDayTask().addTask(item); MonoInstancePool.getInstance<TaskManager>().getEveryDayTask().isDirty = true; } }