public void init(string id) { taskId = id; if (taskId == "random") { Dictionary <string, TaskItem> requireDic = BattleFormation.getRanTaskFishList(); foreach (string key in requireDic.Keys) { TaskItem item = requireDic[key]; requireList.Add(item.item_id, item); } } else { TaskItemSpec spec = getTaskSpec(); List <OwnedItem> specrequireList = spec.getRequireList(); foreach (OwnedItem item in specrequireList) { TaskItem item1 = new TaskItem(); item1.item_id = item.item_id; item1.finished = 0; item1.total = item.count; requireList.Add(item.item_id, item1); } } creatRewards(); setSaveData(); }
public Dictionary <string, TaskItem> getRequireList() { if (requireList.Count == 0) { requireList = new Dictionary <string, TaskItem> (); if (conditions != null) { requireList = JsonMapper.ToObject <Dictionary <string, TaskItem> > (conditions); /* string[] arr = conditions.Split (new char[1]{ '|' }); * foreach (string str in arr) { * string[] arr1 = str.Split (new char[1]{ ':' }); * TaskItem item = new TaskItem (); * item.item_id = arr1 [0]; * item.finished = int.Parse(arr1 [1]); * item.total = int.Parse(arr1 [2]); * requireList.Add (arr1 [0], item); * }*/ } else { TaskItemSpec spec = getTaskSpec(); List <OwnedItem> specrequireList = spec.getRequireList(); foreach (OwnedItem item in specrequireList) { TaskItem item1 = new TaskItem(); item1.item_id = item.item_id; item1.finished = 0; item1.total = item.count; requireList.Add(item.item_id, item1); } } } return(requireList); }