private void loadTaskInfo(TaskInterface task) { this.taskDesc = TaskUI.GetComponentsInChildren <Text>()[0]; taskDesc.text = task.getTaskDes(); foreach (string key in mapItems.Keys) { foreach (GameObject gb in mapItems[key]) { gb.SetActive(false); } } if (mapItems.ContainsKey(task.getTaskCode()) && mapItems[task.getTaskCode()].Count > 0) { foreach (GameObject newDi in mapItems[task.getTaskCode()]) { newDi.SetActive(true); } } else { Vector3 temPos = new Vector3(30f, 0, 0); taskItemList = new List <GameObject>(); foreach (TaskItemInterface item in task.getTaskItems()) { temPos.y -= 100; GameObject newDi = Instantiate(TaskItemPrefab) as GameObject; newDi.GetComponent <RectTransform>().SetParent(TaskUI.transform); newDi.GetComponent <RectTransform>().localPosition = temPos; Text text = newDi.GetComponent <Text>(); if (item.isCompleted()) { text.text = item.getItemDesc() + "(完成)"; } else { text.text = item.getItemDesc() + "(未完成)"; } taskItemList.Add(newDi); } mapItems.Add(task.getTaskCode(), taskItemList); } }
private void saveRegisitedTask(SaveData savaData, TaskInterface ti) { TaskInfo taskInfo = new TaskInfo(); taskInfo.TaskCode = ti.getTaskCode(); taskInfo.TaskDesc = ti.getTaskDes(); taskInfo.TaskDistrubtor = ti.getTaskDistributor(); taskInfo.TaskId = ti.getTaskId(); taskInfo.TaskName = ti.getTaskName(); taskInfo.TaskOwner = ti.getTaskOwner(); taskInfo.TaskStatus = ti.getTaskStatus(); taskInfo.TaskType = ti.getTaskType(); List <TaskItemInfo> items = new List <TaskItemInfo>(); foreach (TaskItemInterface tii in ti.getTaskItems()) { TaskItemInfo taskItemInfo = new TaskItemInfo(); taskItemInfo.ItemDesc = tii.getItemDesc(); taskItemInfo.ItemCode = tii.getItemCode(); items.Add(taskItemInfo); } taskInfo.TaskItems = items; taskInfo.AwardAttr = ti.getTaskAwards().getTaskAwardAttrInfo(); List <ItemInfo> awardsItems = new List <ItemInfo>(); if (ti.getTaskAwards().getTaskAwardItemInfo() != null && ti.getTaskAwards().getTaskAwardItemInfo().Count > 0) { foreach (Item it in ti.getTaskAwards().getTaskAwardItemInfo()) { ItemInfo ii = new ItemInfo(); ii.Code = it.getCode(); ii.Desc = it.getDesc(); ii.Durability = it.getDurability(); ii.Name = it.getName(); ii.Type = it.getType(); awardsItems.Add(ii); } } taskInfo.Items = awardsItems; savaData.Tasks.Add(taskInfo); }
public bool checkTaskDone(TaskInterface task) { if (this.regisitedTasks.Contains(task)) { List <TaskItemInterface> items = task.getTaskItems(); foreach (TaskItemInterface i in items) { if (!i.isCompleted()) { //Debug.Log("你任务没有做完!"); return(false); } } return(true); } else { // Debug.Log("你没有这个任务!"); return(false); } }
public void UpdateHistoryTask(TaskInterface task) { bool isExsit = false; foreach (TaskInfo ti in historyTaskList) { if (ti.TaskCode == task.getTaskCode()) { isExsit = true; ti.TaskStatus = task.getTaskStatus(); } } if (!isExsit) { TaskInfo ti = new TaskInfo(); ti.TaskStatus = task.getTaskStatus(); ti.TaskCode = task.getTaskCode(); this.historyTaskList.Add(ti); } }
public bool regisisterTask(TaskInterface task) { if (regisitedTasks.Count > 3) { duiHuaUImanager = FindObjectOfType <DuiHuaUImanager>(); roundController = FindObjectOfType <RoundController>(); duiHuaUImanager.showDuiHua(roundController.getPlayerChara().getLiHuiURL(), new string[] { "任务有点多了,先完成前面的吧。" }, 0); return(false); } if (this.getTaskByTaskCode(task.getTaskCode()) != null || task.getTaskStatus() == TaskConstant.STATUS_INDALID) { Debug.Log("cant regisiter task is " + task.getTaskCode()); return(false); } else { Debug.Log("regisiter task is " + task.getTaskCode()); regisitedTasks.Add(task); return(true); } }
public void regisisterStoryTask(TaskInterface task) { this.storyTask = task; }