public void loadTask() { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TaskPanelScript_hotfix", "loadTask")) { ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TaskPanelScript_hotfix", "loadTask", null, null); return; } m_ListViewScript.clear(); for (int i = 0; i < TaskDataScript.getInstance().getTaskDataList().Count; i++) { GameObject prefab = Resources.Load("Prefabs/UI/Item/Item_Task_List") as GameObject; GameObject obj = MonoBehaviour.Instantiate(prefab); obj.GetComponent <Item_Task_List_Script>().m_parentScript = this; obj.GetComponent <Item_Task_List_Script>().setTaskData(TaskDataScript.getInstance().getTaskDataList()[i]); obj.transform.name = TaskDataScript.getInstance().getTaskDataList()[i].task_id.ToString(); m_ListViewScript.addItem(obj); } m_ListViewScript.addItemEnd(); }
public void onReceive_CompleteTask(string data) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("Item_Task_List_Script_hotfix", "onReceive_CompleteTask")) { ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.Item_Task_List_Script_hotfix", "onReceive_CompleteTask", null, data); return; } NetLoading.getInstance().Close(); JsonData jd = JsonMapper.ToObject(data); int code = (int)jd["code"]; int task_id = (int)jd["task_id"]; if (code == (int)TLJCommon.Consts.Code.Code_OK) { ToastScript.createToast("领取成功"); m_parentScript.setTaskOver(task_id); if (OtherData.s_mainScript != null) { OtherData.s_mainScript.checkRedPoint(); } string reward = TaskDataScript.getInstance().getTaskDataById(task_id).reward; // 增加奖励 if (!string.IsNullOrEmpty(reward)) { List <string> list = new List <string>(); CommonUtil.splitStr(reward, list, ';'); for (int i = 0; i < list.Count; i++) { List <string> tempList = new List <string>(); CommonUtil.splitStr(list[i], tempList, ':'); GameUtil.changeData(int.Parse(tempList[0]), int.Parse(tempList[1])); } //ShowRewardPanelScript.create().GetComponent<ShowRewardPanelScript>().setData(TaskDataScript.getInstance().getTaskDataById(task_id).reward); ShowRewardPanelScript.Show(reward, false); } } else { ToastScript.createToast("领取失败"); } }
public void onReceive_GetTask(string data) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TaskPanelScript_hotfix", "onReceive_GetTask")) { ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TaskPanelScript_hotfix", "onReceive_GetTask", null, data); return; } TaskDataScript.getInstance().initJson(data); //loadTask(); m_hasGetData = true; if (m_isScaleEnd) { loadTask(); NetLoading.getInstance().Close(); } }
public void setTaskOver(int task_id) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("TaskPanelScript_hotfix", "setTaskOver")) { ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.TaskPanelScript_hotfix", "setTaskOver", null, task_id); return; } TaskDataScript.getInstance().setTaskIsOver(task_id); for (int i = 0; i < m_ListViewScript.getItemList().Count; i++) { if (m_ListViewScript.getItemList()[i].GetComponent <Item_Task_List_Script>().getTaskData().task_id == task_id) { m_ListViewScript.getItemList()[i].GetComponent <Item_Task_List_Script>().setTaskIsOver(); break; } } loadTask(); }
public override void OnResponse(string data) { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("GetTaskRequest_hotfix", "OnResponse")) { ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.GetTaskRequest_hotfix", "OnResponse", null, data); return; } JsonData jsonData = JsonMapper.ToObject(data); var code = (int)jsonData["code"]; if (code == (int)Consts.Code.Code_OK) { result = data; flag = true; TaskDataScript.getInstance().initJson(data); } else { LogUtil.Log("返回任务数据错误:" + code); } }