public void RunTask(TaskData taskData = null, bool checkNextStep = false, bool checkItem = false, bool clickAuto = false) { if (stopAuto) { return; } //新手指引屏蔽自动寻路任务 if (NewbieModel.getInstance().curItem != null && NewbieModel.getInstance().curItem.showing) { return; } if (taskData == null && A3_TaskModel.getInstance().main_task_id > 0) { taskData = A3_TaskModel.getInstance().GetTaskDataById(A3_TaskModel.getInstance().main_task_id); } if (taskData == null) { return; } A3_TaskModel.getInstance().curTask = taskData; executeTask = taskData; if (executeTask == null) { return; } //clickAuto为点击前往。必须执行 Execute(executeTask, checkNextStep, checkItem, clickAuto); }
//同步任务信息 private void OnSyncTaskInfo(Variant data) { A3_TaskModel.getInstance().OnSyncTask(data); if (a3_liteMinimap.instance?.transTask.FindChild("skin/view/con").childCount == 0 || a3_liteMinimap.instance?.TaskType_objs.Count == 0) //应对于服务器运作缓慢时 { a3_liteMinimap.instance.InitTaskInfo(); } }
public void StopCD(bool isFinish = false) { BtnWait.interactable = !(isWaiting = false); imgProcess.fillAmount = 0; StopCoroutine(RunCD()); if (isFinish) { A3_TaskProxy.getInstance().SendWaitEnd(A3_TaskModel.getInstance().GetEntrustTask().taskId); } }
public void onMapLoaded() { List <Variant> cacheProxy = A3_TaskModel.getInstance().cacheProxy; for (int i = 0; i < A3_TaskModel.getInstance().cacheProxy.Count; i++) { OnNpcTaskStateChange(GameEvent.Create(0, null, cacheProxy[i])); } A3_TaskModel.getInstance().cacheProxy.Clear(); }
void entrust_go(GameObject go) { InterfaceMgr.getInstance().close(InterfaceMgr.A3_WANTLVUP); TaskData entrustTask = A3_TaskModel.getInstance().GetEntrustTask(); if (entrustTask != null) { a3_task_auto.instance.RunTask(entrustTask, clickAuto: true); } }
void OnWaitBtnClick(GameObject go) { timeWaitTerminal = (int)timeCD * 1000 + NetClient.instance.CurServerTimeStampMS; BtnWait.interactable = !(isWaiting = true); A3_TaskProxy.getInstance().SendWaitStart(A3_TaskModel.getInstance().GetEntrustTask().taskId); if (timeCD > 0) { StartCoroutine(RunCD()); } }
void OnStartBtnClick(GameObject go) { if (isEntrustMonsterAlive) { return; } A3_TaskProxy.getInstance().SendCallMonster((uint)A3_TaskModel.getInstance().GetEntrustTask().taskId); //timeKillTerminal = muNetCleint.instance.CurServerTimeStamp + A3_TaskModel.getInstance().GetEntrustTask().release_tm; winKillMon.SetActive(false); }
void Update() { if (joystick.instance.moveing) { if (isWaiting) { StopCD(); } Reset(alsoHideGameObject: true); return; } if (isOnKillMon || IsOnEntrustWait) { if (IsOnEntrustWait && waitPosition != Vector3.zero) { if (Vector3.Distance(SelfRole._inst.m_curModel.position, waitPosition) < waitThresholdDistance) { tfParentWait.gameObject.SetActive(true); SelfRole._inst.m_moveAgent.Stop(); haveEnteredWaitPosition = true; } else if (haveEnteredWaitPosition) { Reset(alsoHideGameObject: true); haveEnteredWaitPosition = false; } } else if (isOnKillMon && killPosition != Vector3.zero) { if (Vector3.Distance(SelfRole._inst.m_curModel.position, killPosition) < killThresholdDistance) { isOnKillMon = false; if (!isEntrustMonsterAlive) { winKillMon.SetActive(true); } SelfRole._inst.m_moveAgent.Stop(); } } } if (isKeepingKillMon) { if (A3_TaskModel.getInstance().GetEntrustTask() != null) { if (timeKillTerminal < muNetCleint.instance.CurServerTimeStamp) { isEntrustMonsterAlive = false; } else if (LiteMinimapEntrustTaskTip != null) { LiteMinimapEntrustTaskTip.text = A3_TaskModel.getInstance().GetEntrustTask().taskName + GetSecByTime(timeKillTerminal); } } } }
private void OnNpcTaskStateChange(GameEvent e) { Variant data = e.data; int npcId = data["npcId"]; int taskId = data["taskId"]; int taskState = data["taskState"]; if (!dicNpcTaskState.ContainsKey(npcId)) { Dictionary <int, int> dicTemp = new Dictionary <int, int>(); dicTemp[taskId] = taskState; dicNpcTaskState[npcId] = dicTemp; } else { if (taskState == 0) { dicNpcTaskState[npcId].Remove(taskId); } else { dicNpcTaskState[npcId][taskId] = taskState; } } NpcRole nRole = getRole(npcId); List <int> listState = dicNpcTaskState[npcId].Values.ToList <int>(); int state = 0; if (listState.Count > 0) { state = listState.Max <int>(); } SetNpcTaskState(nRole, (NpcTaskState)state); TaskData taskData = A3_TaskModel.getInstance().GetTaskDataById(taskId); if (taskData != null) { if (taskData.topShowOnLiteminimap)//#判空处理 { a3_liteMinimap.instance?.SetTopShow(taskId); } else { a3_liteMinimap.instance?.RefreshTaskPage(taskId); } } }
public void OnWaitBtnClick(GameObject go) { SelfRole.fsm.Stop(); timeWaitTerminal = (int)timeCD * 1000 + NetClient.instance.CurServerTimeStampMS; BtnWait.interactable = !(isWaiting = true); A3_TaskProxy.getInstance().SendWaitStart(curTaskId); if (timeCD > 0) { TaskData task = A3_TaskModel.getInstance().GetTaskDataById(curTaskId); StartCoroutine(RunCD()); } }
//public void endCollectBox() //{ // Variant d = new Variant(); // d["op"] = 3; // // d["iid"] = dpid; // sendRPC(PKG_NAME.C2S_A3_ACTIVE_GETCHEST, d); // // InterfaceMgr.getInstance().close(InterfaceMgr.CD); //} public void sendStopCollectItem(bool forcestop) { Variant d = new Variant(); d["end_tp"] = forcestop ? 2 : 1; sendRPC(PKG_NAME.C2S_STOP_COLLECT, d); A3_TaskModel tkModel = A3_TaskModel.getInstance(); if (forcestop == false) { a3_task_auto.instance.RunTask(tkModel.curTask); } }
//private void AutoCollect() //{ // CollectRole role = null; // foreach (MonsterRole m in MonsterMgr._inst.m_mapMonster.Values) // { // if (m is CollectRole && A3_TaskModel.getInstance().IfCurrentCollectItem(m.monsterid)) // { // role = m as CollectRole; // break; // } // } // if (role != null) // { // } //} public void PauseAutoKill(int taskId = -1) { if (taskId <= 0) { taskId = A3_TaskModel.getInstance().main_task_id; } Dictionary <int, int> bufferTaskDic = PlayerModel.getInstance().task_monsterId; Dictionary <int, int> runningTaskDic = PlayerModel.getInstance().task_monsterIdOnAttack; if (!bufferTaskDic.ContainsKey(taskId) && runningTaskDic.ContainsKey(taskId)) { bufferTaskDic.Add(taskId, runningTaskDic[taskId]); runningTaskDic.Remove(taskId); } }
public static bool checkCurTask(string[] arr) { int taskId = int.Parse(arr[1]); int taskState = int.Parse(arr[2]); TaskData taskData = A3_TaskModel.getInstance().GetTaskDataById(A3_TaskModel.getInstance().main_task_id); if (taskState == 0) { return(taskId == A3_TaskModel.getInstance().main_task_id);// && ! taskData.isComplete; } else { return(taskId == A3_TaskModel.getInstance().main_task_id);// && taskData.isComplete; } }
public void Refresh_huoyue_infos() { Dictionary <int, huoyue_infos> dic = a3_ActiveOnlineModel.getInstance().dic_huoyue; foreach (int id in dic.Keys) { //添加功能限制 if (dic[id].type == 1) { int lv = (int)PlayerModel.getInstance().lvl; int level2 = (int)PlayerModel.getInstance().up_lvl; string lvl = dic[id].pram; string[] dj = lvl.Split(','); int a = int.Parse(dj[0]); int b = int.Parse(dj[1]); if ((level2 * 100 + lv) >= (a * 100 + b)) { huoyue_obj[id].transform.FindChild("Button").gameObject.SetActive(dic[id].receive_type == 2 ? false : true); } else { huoyue_obj[id].transform.FindChild("Button").gameObject.SetActive(false); } } else if (dic[id].type == 2) { int maintaskid = int.Parse(dic[id].pram); if (maintaskid < A3_TaskModel.getInstance().main_task_id) { huoyue_obj[id].transform.FindChild("Button").gameObject.SetActive(dic[id].receive_type == 2 ? false : true); } else { huoyue_obj[id].transform.FindChild("Button").gameObject.SetActive(false); } } huoyue_obj[id].transform.FindChild("des").GetComponent <Text>().text = dic[id].des + "(" + dic[id].have_num + "/" + dic[id].need_num + ")"; huoyue_obj[id].transform.FindChild("over").gameObject.SetActive(dic[id].receive_type == 2 ? true : false); //huoyue_obj[id].transform.FindChild("Button").gameObject.SetActive(dic[id].receive_type == 2 ? false : true); if (dic[id].receive_type == 2) { huoyue_obj[id].transform.SetAsLastSibling(); } } }
public void SendGetAward(int rate = 0) { int id = A3_TaskModel.getInstance().curTask.taskId; debug.Log("完成任务ID::" + id); Variant msg = new Variant(); msg["mis_cmd"] = GET_TASK_AWARD; msg["id"] = id; if (rate > 1) { msg["double_exp"] = true; } sendRPC(PKG_NAME.C2S_TASK, msg); }
private void RunTimer() { Dictionary <int, TaskData> dicTask = A3_TaskModel.getInstance().GetDicTaskData(); List <int> idx = new List <int>(dicTask.Keys); bool isTiming = false; for (int i = 0; i < idx.Count; i++) { if (!taskOptElement.ContainsKey(idx[i])) { continue; } TaskOptElement tempElem = taskOptElement[idx[i]]; float endTime = dicTask[idx[i]].lose_tm, curTime = muNetCleint.instance.CurServerTimeStamp, duration = dicTask[idx[i]].release_tm; TaskData task = dicTask[idx[i]]; if (taskOptElement.ContainsKey(idx[i])) { long timeSpn = task.lose_tm - muNetCleint.instance.CurServerTimeStamp; bool isCurTiming = TaskTargetType.KILL_MONSTER_GIVEN == task.targetType && !task.isComplete && timeSpn > 0 && task.release_tm > timeSpn; if (isCurTiming) { tempElem.liteMinimapTaskTimer.gameObject.SetActive(true); tempElem.liteMinimapTaskTimer.text = GetSecByTime(task.lose_tm); taskOptElement[tempElem.taskId].Set(isTaskMonsterAlive: true); } else { taskOptElement[tempElem.taskId].Set(isTaskMonsterAlive: false); tempElem.liteMinimapTaskTimer.gameObject.SetActive(false); } isTiming |= isCurTiming; } } if (waitTime < 0) { CancelInvoke("RunTimer"); waitTime = 5f; return; } if (!isTiming) { waitTime--; } }
void SetShow() { if (chapid < 0) { return; } gg.SetActive(true); var cd = A3_TaskModel.getInstance().GetChapterInfosById(chapid); //desc.text = cd.description; title.sprite = GAMEAPI.ABUI_LoadSprite("icon_chapter_no" + chapid); title.SetNativeSize(); nameI.sprite = GAMEAPI.ABUI_LoadSprite("icon_chapter_" + chapid); nameI.SetNativeSize(); List <SXML> rewardItemList = new List <SXML>(); rewardItemList.Add(XMLMgr.instance.GetSXML("task.Cha_gift", "id==" + chapid).GetNode("RewardEqp", "carr==" + PlayerModel.getInstance().profession)); rewardItemList.AddRange(XMLMgr.instance.GetSXML("task.Cha_gift", "id==" + chapid).GetNodeList("RewardItem")); for (int i = tfReward.childCount - 1; i > -1; i--) { Destroy(tfReward.GetChild(i).gameObject); } for (int i = 0; i < rewardItemList.Count; i++) { if (rewardItemList[i] == null) { continue; } uint item_id = rewardItemList[i].getUint("item_id"); if (item_id == 0) { item_id = rewardItemList[i].getUint("id"); } int num = rewardItemList[i].getInt("value"); //if (num == -1) num = 1; GameObject bg = Instantiate(tfPrefabIconBg); Transform bgImg = bg.transform.FindChild("bg"); GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(item_id, num: num, ignoreLimit: true); icon.transform.SetParent(bgImg, false); bg.transform.SetParent(tfReward, false); bgImg.GetComponent <RectTransform>().localPosition = Vector2.zero; } ii = 0; }
public override void init() { Instance = this; tfParentWait = transform.FindChild("wait"); tfParentWait.gameObject.SetActive(false); imgProcess = tfParentWait.FindChild("waitBG").GetComponent <Image>(); (BtnWait = new BaseButton(tfParentWait.FindChild("waitBG/btnDoWait"))).onClick = OnWaitBtnClick; winKillMon = transform.FindChild("killmon").gameObject; winKillMon.SetActive(false); tfSubmitItem = transform.FindChild("submitItem"); tfSubmitItemCon = tfSubmitItem.FindChild("mask/scrollview/con"); tfFocus = tfSubmitItem.FindChild("focus"); tfFocus.gameObject.SetActive(false); tfSubmitItem.gameObject.SetActive(false); Transform tfBtnStart = winKillMon.transform.FindChild("btnStart"); Transform tfBtnCancel = winKillMon.transform.FindChild("btnDontStart"); new BaseButton(tfBtnStart).onClick = OnStartBtnClick; new BaseButton(tfBtnCancel).onClick = OnCancelBtnClick; new BaseButton(transform.FindChild("submitItem/closeBtn")).onClick = (btnClose) => tfSubmitItem.gameObject.SetActive(false); new BaseButton(tfSubmitItem.FindChild("btnOK")).onClick = (go) => { if (submitItemIId != 0) { A3_TaskProxy.getInstance().SendSubmit(A3_TaskModel.getInstance().GetEntrustTask()?.taskId ?? 0, submitItemIId); } tfSubmitItem.gameObject.SetActive(false); }; transform.SetParent(skillbar.instance.transform); if (a3_liteMinimap.instance) { LiteMinimapEntrustTaskTip = a3_liteMinimap.instance.GetEntrustTaskPage()?.GetComponent <Text>(); } A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_TASK_REFRESH, OnCheck); //A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_SYNC_TASK, OnCheck); //在服务器运行较缓慢时使用 if (A3_TaskModel.getInstance().GetEntrustTask()?.lose_tm > muNetCleint.instance.CurServerTimeStamp) { isKeepingKillMon = isEntrustMonsterAlive = true; timeKillTerminal = A3_TaskModel.getInstance().GetEntrustTask().lose_tm; } Instance.name = "A3_EntrustOpt"; }
public override void onClick() { if (!A3_TaskModel.getInstance().IfCurrentCollectItem(monsterid)) { return; } cd.hide(); if (Vector3.Distance(m_curModel.transform.position, SelfRole._inst.m_curModel.transform.position) > 2) { SelfRole.moveto(m_curModel.transform.position, () => { MapProxy.getInstance().sendCollectItem(m_unIID); cd.updateHandle = onCD; cd.show(() => { m_curAni.SetBool("open", true); MapProxy.getInstance().sendStopCollectItem(false); becollected = true; }, collectTime, true, () => { MapProxy.getInstance().sendStopCollectItem(true); }); }, true, 2f); } else { MapProxy.getInstance().sendCollectItem(m_unIID); cd.updateHandle = onCD; cd.show(() => { m_curAni.SetBool("open", true); MapProxy.getInstance().sendStopCollectItem(false); becollected = true; }, collectTime, true, () => { MapProxy.getInstance().sendStopCollectItem(true); }); } }
public void onbeginCollect(Variant msg) { debug.Log("onbeginCollect:::" + msg.dump()); int res = msg["res"]; if (res < 0) { flytxt.instance.fly(ContMgr.getError(res.ToString())); InterfaceMgr.getInstance().close(InterfaceMgr.CD); A3_TaskModel tkModel = A3_TaskModel.getInstance(); if (tkModel.curTask != null) { a3_task_auto.instance.RunTask(tkModel.curTask); } } }
public override void OnInit() { headicon = this.getTransformByPath("talk/npc_head/icon").GetComponent <Image>(); bg_task = this.getTransformByPath("talk/bg_task"); tkModel = A3_TaskModel.getInstance(); //lUiPos.Add(getTransformByPath("con1")); //lUiPos.Add(getTransformByPath("con0")); conIcon = this.getTransformByPath("talk/con_icon"); conOption = this.getTransformByPath("talk/bg_taskselect/con_options"); optionTemp = this.getGameObjectByPath("talk/optionTemp"); iconTemp = this.getGameObjectByPath("talk/iconTemp"); transTalk = getTransformByPath("talk"); btnNext = new BaseButton(this.getTransformByPath("talk/bg_task/next")); btnExit = new BaseButton(this.getTransformByPath("talk/close")); btnExit.onClick = OnCloseDialog; new BaseButton(this.getTransformByPath("talk/fg")).onClick = OnCloseDialog; base.OnInit(); getComponentByPath <Text>("talk/bg_task/next/Text").text = ContMgr.getCont("ToSure_summon_2"); }
private IEnumerator RunCD() { while (!SelfRole._inst.m_curAni.GetBool(EnumAni.ANI_RUN) /*移动*/ && !SelfRole.s_bInTransmit /*传送*/) { long timeCurrent = NetClient.instance.CurServerTimeStampMS; if (timeWaitTerminal < timeCurrent) { tfParentWait.gameObject.SetActive(false); //IsOnTaskWait = false; StopCD(true); if (A3_TaskModel.getInstance().curTask.showMessage) { string msg = string.Format(A3_TaskModel.getInstance().curTask.completionStr, A3_LegionModel.getInstance().myLegion.clname); a3_chatroom._instance.SendMsg(msg); } yield break; } imgProcess.fillAmount = (timeCD * 1000 - (timeWaitTerminal - timeCurrent)) / (timeCD * 1000); yield return(null); } imgProcess.fillAmount = 0; }
private void OnCheck(GameEvent e) { if (e.data.ContainsKey("change_task")) { List <Variant> task = e.data["change_task"]._arr; if (task[0].ContainsKey("id") && A3_TaskModel.getInstance().GetTaskDataById(task[0]["id"]).taskT == TaskType.ENTRUST) { if (task[0].ContainsKey("cnt") && task[0]["cnt"] > 0) { isKeepingKillMon = false; isEntrustMonsterAlive = false; LiteMinimapEntrustTaskTip.text = A3_TaskModel.getInstance().GetEntrustTask().taskName; return; } if (task.Count > 0 && A3_TaskModel.getInstance().GetTaskDataById(task[0]["id"]).targetType == TaskTargetType.KILL_MONSTER_GIVEN) { isKeepingKillMon = true; isEntrustMonsterAlive = true; timeKillTerminal = task[0]["lose_tm"]; } } } else if (e.data.ContainsKey("emis")) { int taskId = e.data["emis"]["id"]; if (A3_TaskModel.getInstance().GetTaskDataById(taskId).targetType == TaskTargetType.KILL_MONSTER_GIVEN) { isKeepingKillMon = true; isEntrustMonsterAlive = true; timeKillTerminal = e.data["emis"]["lose_tm"]; } else if (A3_TaskModel.getInstance().GetTaskDataById(taskId).targetType == TaskTargetType.GET_ITEM_GIVEN) { entrustItemId = A3_TaskModel.getInstance().GetTaskXML().GetNode("task", "id==" + taskId).getUint("target_param2"); } } }
public NpcMgr() { A3_TaskModel.getInstance().addEventListener(A3_TaskModel.ON_NPC_TASK_STATE_CHANGE, OnNpcTaskStateChange); initNpcXml(); }
public override void Execute(float delta_time) { if (collTarget == null) { foreach (MonsterRole m in MonsterMgr._inst.m_mapMonster.Values) { if (m is CollectRole && A3_TaskModel.getInstance().IfCurrentCollectItem(m.monsterid)) { var vv = m as CollectRole; if (!vv.becollected) { collTarget = vv; break; } } } if (collTarget != null) { SelfRole._inst.TurnToPos(collTarget.m_curModel.transform.position); SelfRole._inst.SetDestPos(collTarget.m_curModel.transform.position); if (!SelfRole._inst.m_moveAgent.hasPath) { SelfRole._inst.m_moveAgent.ResetPath(); SelfRole._inst.m_moveAgent.Stop(); return; } else { SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, true); SelfRole.ChangeRideAniState(true); } } } if (SelfRole._inst.m_curModel == null) { return; //加载模型时 } if (collTarget == null) { SelfRole._inst.m_moveAgent.ResetPath(); SelfRole._inst.m_moveAgent.Stop(); SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, false); SelfRole.ChangeRideAniState(false); } else if (!collecting) { if (Vector3.Distance(collTarget.m_curModel.transform.position, SelfRole._inst.m_curModel.transform.position) <= 2) { SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, false); SelfRole.ChangeRideAniState(false); collTarget.onClick(); collecting = true; } else { SelfRole._inst.TurnToPos(collTarget.m_curModel.transform.position); SelfRole._inst.SetDestPos(collTarget.m_curModel.transform.position); SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, true); SelfRole.ChangeRideAniState(true); } } }
void OnLegion(Variant data) { int res = data["res"]; debug.Log("军团消息" + data.dump()); //if (res < 0) //{ // Globle.err_output(res); // return; //} Variant vd = new Variant(); switch (res) { case EVENT_GETINFO: //if (data.ContainsKey("direct_join_clan")) //{ //} if (data.ContainsKey("id")) { A3_LegionData d = new A3_LegionData(); d.id = data["id"]; d.lvl = data["lvl"]; d.clname = data["clname"]; d.name = data["name"]; d.notice = data["notice"]; d.gold = data["money"]; d.plycnt = data["plycnt"]; d.exp = data["clan_pt"]; if (data.ContainsKey("ol_cnt")) { d.ol_cnt = data["ol_cnt"]; } if (data.ContainsKey("combpt")) { d.combpt = data["combpt"]; } if (data.ContainsKey("rankidx")) { d.rankidx = data["rankidx"]; } if (data.ContainsKey("clanc")) { d.clanc = data["clanc"]; } d.anabasis_tm = data["anabasis_tm"]; A3_LegionModel.getInstance().myLegion = d; int b = data["direct_join"]; A3_LegionModel.getInstance().CanAutoApply = b == 1 ? true : false; A3_LegionModel.getInstance().SetMyLegion(d.lvl); A3_LegionModel.getInstance().donate = data["donate"]; // a3_legion_info.mInstance.jx_up(d.gold,d.lvl); gold = d.gold; lvl = d.lvl; } else { A3_LegionModel.getInstance().myLegion = new A3_LegionData(); } dispatchEvent(GameEvent.Create(EVENT_GETINFO, this, data)); break; case EVENT_CREATE: dispatchEvent(GameEvent.Create(EVENT_CREATE, this, data)); removeEventListener(A3_LegionProxy.EVENT_CHECKNAME, a3_legion.mInstance.SetCheckName); //a3_herohead.instance.legion_bf = true; //a3_herohead.instance.isclear = true; //if (a3_herohead.instance != null) // a3_herohead.instance.refresBuff(); break; case EVENT_APPLYFOR: int clid = data["clid"]; dispatchEvent(GameEvent.Create(EVENT_APPLYFOR, this, data)); flytxt.instance.fly(ContMgr.getCont("Legion_ok")); break; case EVENT_LVUP: A3_LegionModel.getInstance().myLegion.gold = data["money"]; A3_LegionModel.getInstance().myLegion.lvl = data["lvl"]; A3_LegionModel.getInstance().myLegion.exp = 0; A3_LegionModel.getInstance().SetMyLegion(A3_LegionModel.getInstance().myLegion.lvl); dispatchEvent(GameEvent.Create(EVENT_GETINFO, this, data)); flytxt.instance.fly(ContMgr.getCont("Legionup_ok")); break; case EVENT_GETMEMBER: //14 vd = data["pls"]; A3_LegionModel.getInstance().members.Clear(); foreach (var v in vd._arr) { A3_LegionModel.getInstance().AddMember(v); } dispatchEvent(GameEvent.Create(EVENT_GETMEMBER, this, data)); //if (a3_legion.mInstance == null) // cacheProxyData = data; break; case EVENT_APPROVEORREJECT: dispatchEvent(GameEvent.Create(EVENT_APPROVEORREJECT, this, data)); break; case EVENT_QUIT: A3_LegionModel.getInstance().myLegion = new A3_LegionData(); dispatchEvent(GameEvent.Create(EVENT_QUIT, this, data)); if (a3_task_auto.instance.executeTask?.taskT == TaskType.CLAN) { SelfRole.fsm.Stop(); flytxt.instance.fly(ContMgr.getCont("Legion_out")); } else { flytxt.instance.fly(ContMgr.getCont("Legionout_ok")); } //a3_herohead.instance.legion_bf = false; //a3_herohead.instance.isclear =true; //if (a3_herohead.instance != null) // a3_herohead.instance.refresBuff(); break; case EVENT_UPBUFF: flytxt.instance.fly(ContMgr.getCont("Legionbuff_up")); break; case EVENT_DONATE: int money = data["money"]; //flytxt.instance.fly("获得了" + money / 1000 + "点贡献度"); flytxt.instance.fly(ContMgr.getCont("Legiondonate_add", new List <string> { (money / 1000).ToString() })); SendGetInfo(); break; case EVENT_GETAPPLICANT: A3_LegionModel.getInstance().RefreshApplicant(data); dispatchEvent(GameEvent.Create(EVENT_GETAPPLICANT, this, data)); break; case EVENT_CHANGENOTICE: dispatchEvent(GameEvent.Create(EVENT_CHANGENOTICE, this, data)); break; case EVENT_INVITE: dispatchEvent(GameEvent.Create(EVENT_INVITE, this, data)); break; case EVENT_BELEADER: SendGetMember(); break; case EVENT_GETDIARY: if (data != null && data.ContainsKey("clanlog_list") && data["clanlog_list"]._arr.Count > 0) { A3_LegionModel.getInstance().AddLog(data); } dispatchEvent(GameEvent.Create(EVENT_GETDIARY, this, data)); break; case EVENT_APPLYMODE: int c = data["direct_join"]; A3_LegionModel.getInstance().CanAutoApply = c == 1 ? true : false; dispatchEvent(GameEvent.Create(EVENT_APPLYMODE, this, data)); break; case EVENT_CHECKNAME: dispatchEvent(GameEvent.Create(EVENT_CHECKNAME, this, data)); break; case EVENT_DELETECLAN: SendGetInfo(); dispatchEvent(GameEvent.Create(EVENT_DELETECLAN, this, data)); flytxt.instance.fly(ContMgr.getCont("Legion_bye")); //a3_herohead.instance.legion_bf = false; //a3_herohead.instance.isclear = true; //if (a3_herohead.instance != null) // a3_herohead.instance.refresBuff(); break; case EVENT_LOADLIST: A3_LegionModel.getInstance().list.Clear(); A3_LegionModel.getInstance().list2.Clear(); vd = data["info"]; foreach (var v in vd._arr) { A3_LegionData d = new A3_LegionData(); d.id = v["id"]; d.clname = v["clname"]; d.combpt = v["combpt"]; d.lvl = v["lvl"]; d.name = v["name"]; d.plycnt = v["plycnt"]; d.direct_join = v["direct_join"]; d.huoyue = v["last_active"]; A3_LegionModel.getInstance().list.Add(d); A3_LegionModel.getInstance().list2.Add(d); } //for (int i = 0; i < A3_LegionModel.getInstance().list.Count; i++) //{ // for (int j = 0; j < A3_LegionModel.getInstance().list.Count; j++) // { // if (A3_LegionModel.getInstance().list[i].id > A3_LegionModel.getInstance().list[j].id) // { // A3_LegionData temp = A3_LegionModel.getInstance().list[i]; // A3_LegionModel.getInstance().list[i] = A3_LegionModel.getInstance().list[j]; // A3_LegionModel.getInstance().list[j] = temp; // } // } //} dispatchEvent(GameEvent.Create(EVENT_LOADLIST, this, data)); break; case EVENT_REMOVE: int ci = data["cid"]; if (A3_LegionModel.getInstance().members.ContainsKey(ci)) { A3_LegionModel.getInstance().members.Remove(ci); } dispatchEvent(GameEvent.Create(EVENT_GETMEMBER, this, data)); break; case EVENT_REPAIR: dispatchEvent(GameEvent.Create(EVENT_REPAIR, this, data)); break; case EVENT_TASKREWARD: if (A3_LegionModel.getInstance().myLegion.id != 0) { int taskCount; if (A3_TaskModel.getInstance() == null || A3_TaskModel.getInstance().GetClanTask() == null) { taskCount = 9; } else { taskCount = A3_TaskModel.getInstance().GetClanTask().taskCount; } Dictionary <uint, int> rewardDic = A3_TaskModel.getInstance().GetClanRewardDic(taskCount); flytxt.instance.StopDelayFly(); if (data.ContainsKey("money")) { if (rewardDic.ContainsKey((uint)A3_TaskModel.REWARD_CLAN_MONEY)) { flytxt.instance.AddDelayFlytxt(ContMgr.getCont("Legion_money", new List <string> { (rewardDic[(uint)A3_TaskModel.REWARD_CLAN_MONEY]).ToString() })); } //flytxt.instance.AddDelayFlytxt("军团资金+" + rewardDic[(uint)A3_TaskModel.REWARD_CLAN_MONEY]); A3_LegionModel.getInstance().myLegion.gold = data["money"]._int; } if (data.ContainsKey("clan_pt")) { if (rewardDic.ContainsKey((uint)A3_TaskModel.REWARD_CLAN_EXP)) { flytxt.instance.AddDelayFlytxt(ContMgr.getCont("Legion_exp", new List <string> { (rewardDic[(uint)A3_TaskModel.REWARD_CLAN_EXP]).ToString() })); } //flytxt.instance.AddDelayFlytxt("军团经验+" + rewardDic[(uint)A3_TaskModel.REWARD_CLAN_EXP]); A3_LegionModel.getInstance().myLegion.clan_pt = data["clan_pt"]._int; } if (data.ContainsKey("donate")) { if (rewardDic.ContainsKey((uint)A3_TaskModel.REWARD_CLAN_DONATE)) { flytxt.instance.AddDelayFlytxt(ContMgr.getCont("Legion_gongxian", new List <string> { (rewardDic[(uint)A3_TaskModel.REWARD_CLAN_DONATE]).ToString() })); } //flytxt.instance.AddDelayFlytxt("军团贡献+" + rewardDic[(uint)A3_TaskModel.REWARD_CLAN_DONATE]); A3_LegionModel.getInstance().donate = data["donate"]._int; } if (data.ContainsKey("active")) { A3_LegionModel.getInstance().myLegion.huoyue = data["active"]._int; } flytxt.instance.StartDelayFly(); } break; case EVENT_BEINVITE: uint clanid = data["clanid"]; string name = data["name"]; string clan_name = data["clan_name"]; int clan_lvl = data["clan_lvl"]; if (a3_legion.mInstance.dic0.isOn) { SendAcceptInvite(clanid, true); flytxt.instance.fly(ContMgr.getCont("Legion_request")); a3_dartproxy.getInstance().sendDartGo(); //查看军团镖车信息 dispatchEvent(GameEvent.Create(EVENT_ACCEPTAINVITE, this, data)); } else { MsgBoxMgr.getInstance().showConfirm(name + ContMgr.getCont("add_request") + clan_lvl + ContMgr.getCont("lvLegion") + clan_name, () => { SendAcceptInvite(clanid, true); }, () => { SendAcceptInvite(clanid, false); }); } dispatchEvent(GameEvent.Create(EVENT_BEINVITE, this, data)); break; case EVENT_APPLYSUCCESSFUL: bool approved = data["approved"]; if (approved) { A3_LegionProxy.getInstance().SendGetInfo(); } a3_dartproxy.getInstance().sendDartGo(); //查看军团镖车信息 dispatchEvent(GameEvent.Create(EVENT_APPLYSUCCESSFUL, this, data)); break; case 35: A3_LegionProxy.getInstance().SendGetMember(); int cid = data["cid"]; int clanc = data["clanc"]; int oldclanc = data["oldclanc"]; string name1 = data["name"]; string dic = string.Empty; if ((uint)cid == PlayerModel.getInstance().cid) { name1 = ContMgr.getCont("u"); } if (oldclanc > clanc) { dic = ContMgr.getCont("up"); } else { dic = ContMgr.getCont("down"); } flytxt.instance.fly(name1 + dic + A3_LegionModel.getInstance().GetClancToName(clanc)); break; case 36: A3_LegionProxy.getInstance().SendGetInfo(); if (a3_buff.instance != null) { a3_buff.instance.Quited(); } break; case EVENT_GETDIN: //37 flytxt.instance.fly(ContMgr.getCont("Legionadd_ok")); a3_dartproxy.getInstance().sendDartGo(); //查看军团镖车信息 dispatchEvent(GameEvent.Create(A3_LegionProxy.EVENT_CREATE, this, data)); //a3_herohead.instance.isclear = true; //a3_herohead.instance.legion_bf = true; //if (a3_herohead.instance != null) // a3_herohead.instance.refresBuff(); break; case EVENT_FINDNAME: //27模糊搜索 if (data["info"].Count <= 0) { flytxt.instance.fly(ContMgr.getCont("nofinname")); } else { A3_LegionModel.getInstance().finfname.Clear(); A3_LegionModel.getInstance().finfname = new List <A3_LegionData>(); foreach (var v in data["info"]._arr) { A3_LegionData d = new A3_LegionData(); d.id = v["id"]; d.clname = v["clname"]; d.combpt = v["combpt"]; d.lvl = v["lvl"]; d.name = v["name"]; d.plycnt = v["plycnt"]; d.direct_join = v["direct_join"]; d.huoyue = v["last_active"]; A3_LegionModel.getInstance().finfname.Add(d); } if (a3_legion.Instance != null) { a3_legion.Instance.addpanels.SetActive(false); a3_legion.Instance.Findnames(); } } break; case EVENT_CHANGE_NAME: A3_LegionModel.getInstance().myLegion.clname = data["clname"]; dispatchEvent(GameEvent.Create(EVENT_CHANGE_NAME, this, data)); break; case EVENT_BUILD: A3_LegionModel.getInstance().build_awd[data["type"]] = data["type"]; if (a3_legion_build.instance) { a3_legion_build.instance.RefresAward(); } break; default: if (res < 0) { Globle.err_output(res); } break; } }
void refresh() { var dd = A3_TaskModel.getInstance().GetDailyTask(); if (dd != null) { cs_rotine.text = "(" + (A3_TaskModel.getInstance().GetTaskMaxCount(dd.taskId) - dd.taskCount) + "/" + A3_TaskModel.getInstance().GetTaskMaxCount(dd.taskId) + ")"; this.transform.FindChild("cells/scroll/content/routine").gameObject.SetActive(true); } else { //cs_rotine.text = "(未开启)"; this.transform.FindChild("cells/scroll/content/routine").gameObject.SetActive(false); } Variant data = SvrLevelConfig.instacne.get_level_data(101); int max_times = data["daily_cnt"] + A3_VipModel.getInstance().expFb_count; int use_times = 0; if (MapModel.getInstance().dFbDta.ContainsKey(101)) { use_times = Mathf.Min(MapModel.getInstance().dFbDta[101].cycleCount, max_times); } if (FunctionOpenMgr.instance.Check(FunctionOpenMgr.EXP_DUNGEON)) { cs_expfb.text = "(" + (max_times - use_times) + "/" + max_times + ")"; this.transform.FindChild("cells/scroll/content/expfb").gameObject.SetActive(true); } else { //cs_expfb.text = "(未开启)"; this.transform.FindChild("cells/scroll/content/expfb").gameObject.SetActive(false); } if (FunctionOpenMgr.instance.Check(FunctionOpenMgr.ENTRUST_TASK)) { TaskData entrustTask; if ((entrustTask = A3_TaskModel.getInstance().GetEntrustTask()) != null) { int curCount, maxCount; maxCount = XMLMgr.instance.GetSXML("task.emis_limit").getInt("emis_limit") * XMLMgr.instance.GetSXML("task.emis_limit").getInt("loop_limit"); curCount = maxCount - (entrustTask.taskCount + entrustTask.taskLoop * XMLMgr.instance.GetSXML("task.emis_limit").getInt("emis_limit")); curCount = curCount > 0 ? curCount : 0; this.transform.FindChild("cells/scroll/content/entrustTask").gameObject.SetActive(true); this.transform.FindChild("cells/scroll/content/entrustTask/name/dj").GetComponent <Text>().text = string.Format("{0}/{1}", curCount, maxCount); } else { this.transform.FindChild("cells/scroll/content/entrustTask").gameObject.SetActive(false); } } else { this.transform.FindChild("cells/scroll/content/entrustTask").gameObject.SetActive(false); } if (FunctionOpenMgr.instance.Check(FunctionOpenMgr.AUTO_PLAY)) { if (GeneralProxy.getInstance().active_open) { getTransformByPath("cells/scroll/content/sczghd/go").GetComponent <Button>().interactable = true; this.transform.FindChild("cells/scroll/content/sczghd").gameObject.SetActive(true); this.transform.FindChild("cells/scroll/content/guaji").gameObject.SetActive(false); //getTransformByPath("cells/scroll/content/sczghd/go/text").GetComponent<Text>().text = "(已经开启)"; } else { this.transform.FindChild("cells/scroll/content/sczghd").gameObject.SetActive(false); this.transform.FindChild("cells/scroll/content/guaji").gameObject.SetActive(true); //getTransformByPath("cells/scroll/content/sczghd/go").GetComponent<Button>().interactable = false; //getTransformByPath("cells/scroll/content/sczghd/go/text").GetComponent<Text>().text = "(等待开启)"; } } else { getTransformByPath("cells/scroll/content/sczghd/go").GetComponent <Button>().interactable = false; this.transform.FindChild("cells/scroll/content/sczghd").gameObject.SetActive(false); this.transform.FindChild("cells/scroll/content/guaji").gameObject.SetActive(false); } cs_sczghd.text = ""; want_to(); }
private void Set_Line(Transform go, SXML xml) { new BaseButton(go.transform.FindChild("go_btn/Text")).onClick = (GameObject oo) => { btn_go(xml.getInt("id")); }; // int usetime = 0; int maxtime = xml.getInt("times"); //if (MapModel.getInstance().dFbDta.ContainsKey(xml.getInt("id"))) //{ // usetime = Mathf.Min(MapModel.getInstance().dFbDta[xml.getInt("id")].cycleCount, xml.getInt("times")); //} go.transform.FindChild("active_num").GetComponent <Text>().text = ContMgr.getCont("a3_activeDegree_huoyuedu") + xml.getInt("ac_num"); if (xml.getInt("type") == 1) { int lv = (int)PlayerModel.getInstance().lvl; int level2 = (int)PlayerModel.getInstance().up_lvl; string lvl = xml.getString("pram"); string[] dj = lvl.Split(','); int a = int.Parse(dj[0]); int b = int.Parse(dj[1]); if ((level2 * 100 + lv) >= (a * 100 + b)) { go.transform.FindChild("go_btn/lock").gameObject.SetActive(false); } else { go.transform.FindChild("go_btn/lock").gameObject.SetActive(true); } } else if (xml.getInt("type") == 2) { int maintaskid = xml.getInt("pram"); if (maintaskid < A3_TaskModel.getInstance().main_task_id) { go.transform.FindChild("go_btn/lock").gameObject.SetActive(false); } else { go.transform.FindChild("go_btn/lock").gameObject.SetActive(true); } //if (FunctionOpenMgr.instance.dItem.Keys.Contains(func_id) && FunctionOpenMgr.instance.dItem[func_id].opened) //{ // Debug.LogError(FunctionOpenMgr.instance.dItem[func_id].opened+"s"+ func_id); // go.transform.FindChild("go_btn/lock").gameObject.SetActive(false); //} //else //{ // go.transform.FindChild("go_btn/lock").gameObject.SetActive(true); //} } if (a3_activeDegreeProxy.getInstance().itd.ContainsKey((uint)xml.getInt("id"))) { go.transform.FindChild("name_num").GetComponent <Text>().text = xml.getString("des") + "(" + a3_activeDegreeProxy.getInstance().itd[(uint)xml.getInt("id")].count + "/" + xml.getInt("times") + ")"; if (maxtime - a3_activeDegreeProxy.getInstance().itd[(uint)xml.getInt("id")].count <= 0) { go.transform.FindChild("finsh").gameObject.SetActive(true); go.transform.FindChild("get_reward").gameObject.SetActive(false); go.transform.FindChild("go_btn").gameObject.SetActive(false); } else { go.transform.FindChild("finsh").gameObject.SetActive(false); go.transform.FindChild("get_reward").gameObject.SetActive(false); go.transform.FindChild("go_btn").gameObject.SetActive(true); } //FunctionOpenMgr.instance.dItem.Keys.Contains(func_id) && func_id != 0 } else { go.transform.FindChild("name_num").GetComponent <Text>().text = xml.getString("des") + "(0/" + xml.getInt("times") + ")"; go.transform.FindChild("finsh").gameObject.SetActive(false); go.transform.FindChild("get_reward").gameObject.SetActive(false); go.transform.FindChild("go_btn").gameObject.SetActive(true); } //通过xml中的id。调用协议里的方法得到此项完成的状态 //new BaseButton(go.transform.FindChild("get_reward")).onClick = (GameObject oo) => //{ // go.transform.FindChild("get_reward").gameObject.SetActive(false); // go.transform.FindChild("go_btn").gameObject.SetActive(false); // go.transform.FindChild("finsh").gameObject.SetActive(true); // //a3_activeDegreeProxy.getInstance().SendGetPoint(/*xml.getInt("id")*/); // //向服务器发送请求 领取点数,并根据点数判断是否获得物品 //}; }
private bool Execute(TaskData taskData, bool checkNextStep, bool checkItems, bool clickAuto) { if (taskData.taskT == TaskType.CLAN && A3_LegionModel.getInstance().myLegion.id == 0) { flytxt.instance.fly(ContMgr.getCont("a3_task_auto_nocy")); return(false); } //这里将任务的自动改成只读配置表(待测试) bool forceMove = taskData.next_step; if (forceMove || clickAuto) { if (SelfRole.fsm.Autofighting) { SelfRole.fsm.Stop(); StateInit.Instance.Origin = Vector3.zero; } } else { return(false); } int npcId = 0; int mapId = 0; int posX = 0; int posY = 0; SXML taskXml = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId); if (taskXml == null) { debug.Log("任务Id错误::" + taskData.taskId); return(false); } if (taskData.isComplete && taskData.taskT != TaskType.DAILY) { if (taskXml.getInt("complete_way") == 3) { A3_TaskProxy.getInstance().SendGetAward(); return(true); } npcId = taskXml.getInt("complete_npc_id"); SXML npcsXml = XMLMgr.instance.GetSXML("npcs.npc", "id==" + npcId); if (npcsXml != null) { mapId = npcsXml.getInt("map_id"); } List <string> listDialog = new List <string>(); string strDialog = taskXml.getString("complete_dialog"); strDialog = GameFramework.StringUtils.formatText(strDialog); string[] listTempDia = strDialog.Split(';'); listDialog = listTempDia.ToList <string>(); tarNpcId = npcId; //if(forceMove) //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData //{ // mapId = mapId, // check_beforeShow = true, // handle_customized_afterTransmit = () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc) //}); if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID) { SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true), taskTrans: true); } else { SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true); } } else { mapId = taskXml.getInt("tasking_map_id"); posX = taskXml.getInt("target_coordinate_x"); posY = taskXml.getInt("target_coordinate_y"); float mapY = taskXml.getFloat("map_y"); mapY = (mapY == -1 ? 0 : mapY); Vector3 pos = new Vector3(posX, mapY, posY); switch (taskData.targetType) { case TaskTargetType.DODAILY: /*页面切换到每日任务*/ ArrayList arr = new ArrayList(); var tasks = A3_TaskModel.getInstance().GetDicTaskData(); bool hasDailyTask = false; int i = 0; for (List <int> idx = new List <int>(tasks.Keys); i < tasks.Count; i++) { if (hasDailyTask = tasks[idx[i]].taskT == TaskType.DAILY) { break; } } if (hasDailyTask /*tasks.Count(v => v.Value.taskT == TaskType.DAILY) > 0*/) { List <int> k = tasks.Keys.ToList(); for (i = 0; i < k.Count; i++) { if (tasks[k[i]].taskT == TaskType.DAILY) { arr.Add(tasks[k[i]].taskId); } } InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_TASK, arr); //MonsterMgr._inst.taskMonId = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId)?.getInt("target_param2") ?? 0; } break; case TaskTargetType.FRIEND: /*关闭当前页面,弹出好友页面*/ if (a3_liteMinimap.instance) { a3_liteMinimap.instance.ZidongTask = false; } arr = new ArrayList(); arr.Add(1 /* index of friend panel*/); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_SHEJIAO, arr); break; case TaskTargetType.WING: /*关闭当前页面,弹出飞翼页面*/ if (a3_liteMinimap.instance) { a3_liteMinimap.instance.ZidongTask = false; } InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_WIBG_SKIN); break; case TaskTargetType.GETEXP: /*卡级任务、转生任务*/ debug.Log("当前是转生等级任务"); StateAutoMoveToPos.Instance.stopdistance = 0.3f; int zs = int.Parse(taskXml.getString("target_param2").Split(',')[0]); int ls = int.Parse(taskXml.getString("target_param2").Split(',')[1]); int trriger_type = int.Parse(taskXml.getString("trigger")); if (trriger_type == 1) { if (a3_liteMinimap.instance) { a3_liteMinimap.instance.ZidongTask = false; } InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_WANTLVUP); } else { bool b = true; int pp = PlayerModel.getInstance().profession; uint pl = PlayerModel.getInstance().lvl; uint pz = PlayerModel.getInstance().up_lvl; uint exp = PlayerModel.getInstance().exp; uint needExp = ResetLvLModel.getInstance().getNeedExpByCurrentZhuan(pp, pz); uint needLvL = ResetLvLModel.getInstance().getNeedLvLByCurrentZhuan(pp, pz); if (pz >= 10) { break; //10转之后无法再次转生 } if (needLvL > pl) { b = false; } if (b) { npcId = XMLMgr.instance.GetSXML("task.zhuan_npc").getInt("id"); SXML npcsXml = XMLMgr.instance.GetSXML("npcs.npc", "id==" + npcId); if (npcsXml != null) { mapId = npcsXml.getInt("map_id"); } List <string> listDialog = new List <string>(); string strDialog = taskXml.getString("target_dialog"); strDialog = GameFramework.StringUtils.formatText(strDialog); string[] listTempDia = strDialog.Split(';'); listDialog = listTempDia.ToList <string>(); //if (GRMap.instance != null) //{ // InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData // { // mapId = mapId, // check_beforeShow = true, // handle_customized_afterTransmit = () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc) // }); //} if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID) { SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true), taskTrans: true); } else { SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true); } //InterfaceMgr.getInstance().open(InterfaceMgr.A3_RESETLVL); } else { if (a3_liteMinimap.instance) { a3_liteMinimap.instance.ZidongTask = false; } InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_WANTLVUP); } } break; case TaskTargetType.VISIT: /*访问(无条件)*/ { StateAutoMoveToPos.Instance.stopdistance = 2f; npcId = taskXml.getInt("target_param2"); SXML npcsXml = XMLMgr.instance.GetSXML("npcs.npc", "id==" + npcId); if (npcsXml != null) { mapId = npcsXml.getInt("map_id"); } List <string> listDialog = new List <string>(); string strDialog = taskXml.getString("target_dialog"); strDialog = GameFramework.StringUtils.formatText(strDialog); string[] listTempDia = strDialog.Split(';'); listDialog = listTempDia.ToList <string>(); tarNpcId = npcId; if (GRMap.instance != null) { //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData //{ // mapId = mapId, // check_beforeShow = true, // handle_customized_afterTransmit = () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc) //}); if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID) { SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true), taskTrans: true); } else { SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true); } } } break; case TaskTargetType.KILL: /*杀怪类*/ //StateAutoMoveToPos.Instance.stopdistance = 2.0f; SelfRole.UnderTaskAutoMove = true; onTaskSearchMon = taskData.taskT == TaskType.MAIN; int _taskId; if (PlayerModel.getInstance().task_monsterId.ContainsKey(taskData.taskId)) { if (!PlayerModel.getInstance().task_monsterIdOnAttack.ContainsKey(taskData.taskId)) { PlayerModel.getInstance().task_monsterIdOnAttack.Add( key: taskData.taskId, value: PlayerModel.getInstance().task_monsterId[taskData.taskId] ); } PlayerModel.getInstance().task_monsterId.Remove(taskData.taskId); _taskId = taskData.taskId; } else { _taskId = A3_TaskModel.getInstance().GetTaskXML().GetNode("Task", "id==" + taskData.taskId).getInt("target_param2"); PlayerModel.getInstance().task_monsterIdOnAttack.Add( key: taskData.taskId, value: _taskId ); } SXML _taskXml = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId); //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData //{ // mapId = mapId, // check_beforeShow = true, // handle_customized_afterTransmit = () => // { // Vector3 fightOrigin = pos; // StateInit.Instance.Origin = fightOrigin; // SelfRole.moveto(mapId, pos, () => // { // SelfRole.fsm.StartAutofight(); // MonsterMgr._inst.taskMonId = _taskXml.getInt("target_param2"); // }, stopDis: 2.0f); // } //}); Action afterTransmit = () => { Vector3 fightOrigin = pos; StateInit.Instance.Origin = fightOrigin; SelfRole.moveto(mapId, pos, () => { SelfRole.fsm.StartAutofight(); MonsterMgr._inst.taskMonId = _taskXml.getInt("target_param2"); }, stopDis: 2.0f, taskmove: true); }; if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID) { SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: afterTransmit, taskTrans: true); } else { SelfRole.WalkToMap(mapId, pos, afterTransmit, taskmove: true); } break; case TaskTargetType.COLLECT: //Action afterTransmit_collect = () => //{ // StateAutoMoveToPos.Instance.stopdistance = 0.3f; // SelfRole.moveto(mapId, pos, () => SelfRole.fsm.StartAutoCollect()); //}; Action afterTransmit_collect = () => SelfRole.WalkToMap(mapId, pos, SelfRole.fsm.StartAutoCollect, taskmove: true); if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID) { SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: afterTransmit_collect, taskTrans: true); } else { afterTransmit_collect(); } break; case TaskTargetType.FB: if (a3_liteMinimap.instance) { a3_liteMinimap.instance.ZidongTask = false; } int fbid = taskXml.getInt("target_param2"); //StateAutoMoveToPos.Instance.stopdistance = 0.3f; if (GRMap.instance.m_nCurMapID == mapId || GameRoomMgr.getInstance().curRoom is PlotRoom) { SelfRole.moveto(mapId, pos, () => SelfRole.fsm.StartAutofight(), stopDis: 2.0f, taskmove: true /* 副本中开始战斗的停止距离 */); } else { Variant sendData = new Variant(); sendData["npcid"] = 0; sendData["ltpid"] = fbid; sendData["diff_lvl"] = 1; int levelinfoid = taskXml.getInt("level_info"); var tainf = XMLMgr.instance.GetSXML("task.level_info", "id==" + levelinfoid); bool guide = (taskXml.getInt("guide") == 1); int type = taskXml.getInt("level_yw"); if (type == 1) { MsgBoxMgr.getInstance().showTask_fb_confirm(tainf.getString("title"), tainf.getString("desc"), guide, a3_ygyiwuModel.getInstance().GetYiWu_God(a3_ygyiwuModel.getInstance().nowGod_id).need_zdl, () => LevelProxy.getInstance().sendCreate_lvl(sendData)); } else { MsgBoxMgr.getInstance().showTask_fb_confirm(tainf.getString("title"), tainf.getString("desc"), guide, () => LevelProxy.getInstance().sendCreate_lvl(sendData)); } } break; case TaskTargetType.WAIT_POINT_GIVEN: /*在指定区域读条*/ case TaskTargetType.GET_ITEM_GIVEN: /*收集指定道具*/ case TaskTargetType.KILL_MONSTER_GIVEN: /*打指定怪物*/ DealByType(taskData, checkItems); break; } SXML _taskXML = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId); if (SelfRole.UnderTaskAutoMove = taskData.targetType == TaskTargetType.KILL) { StateAutoMoveToPos.Instance.stopdistance = 2.0f; Vector3 fightOrigin = new Vector3( x: _taskXML.getInt("target_coordinate_x"), y: 0, z: _taskXML.getInt("target_coordinate_y") ); StateInit.Instance.Origin = fightOrigin; } if (taskData.targetType == TaskTargetType.KILL || taskData.targetType == TaskTargetType.DODAILY) { int monId = _taskXML.getInt("target_param2"); if (monId != -1) { MonsterMgr._inst.taskMonId = monId; } } } return(true); }
private void DealByType(TaskData taskData, bool checkItems) { A3_TaskOpt.Instance.ResetStat(); A3_TaskOpt.Instance.Reset(alsoHideGameObject: true, resetCase: 0); TaskTargetType taskTargetType = taskData.targetType; TaskType taskType = taskData.taskT; if (A3_TaskOpt.Instance == null) { //Debug.LogError("请将A3_TaskOpt预制件默认设为Active"); return;// not init } if (!A3_TaskOpt.Instance.taskOptElement.ContainsKey(taskData.taskId)) { A3_TaskOpt.Instance.taskOptElement[taskData.taskId] = new TaskOptElement(taskData.taskId); } A3_TaskOpt.Instance.curTaskId = taskData.taskId; if (taskTargetType == TaskTargetType.WAIT_POINT_GIVEN /* || TaskTargetType.MESSAGE_GIVEN_POS == taskTargetType*/) { Vector3 waitPosition = Vector3.zero; var pointInfo = A3_TaskModel.getInstance().GetTaskXML().GetNode("Task", "id==" + taskData.taskId); //A3_TaskOpt.Instance.IsOnTaskWait = true; A3_TaskOpt.Instance.LockStat = false; if (A3_TaskOpt.Instance.isWaiting) { A3_TaskOpt.Instance.StopCD(); } A3_TaskOpt.Instance.BtnWait.interactable = true; A3_TaskOpt.Instance.waitPosition = new Vector3(pointInfo.getFloat("target_coordinate_x"), 0, pointInfo.getFloat("target_coordinate_y")); waitPosition = A3_TaskOpt.Instance.waitPosition; A3_TaskOpt.Instance.actionImage.sprite = GAMEAPI.ABUI_LoadSprite("icon_task_action_" + pointInfo.getInt("act_icon")); A3_TaskOpt.Instance.transform.FindChild("wait/action_text").GetComponent <Text>().text = pointInfo.getString("act_name"); #region PlayerModel.getInstance().task_monsterIdOnAttack[taskData.taskId] = pointInfo.getInt("target_param2"); //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData //{ // mapId = pointInfo.getInt("tasking_map_id"), // check_beforeShow = true, // handle_customized_afterTransmit = () => SelfRole.WalkToMap(pointInfo.getInt("tasking_map_id"), // waitPosition), // targetPosition = waitPosition //}); int mapId = pointInfo.getInt("tasking_map_id"); if (MapModel.getInstance().dicMappoint.ContainsKey(mapId)) { int mapPoint = MapModel.getInstance().dicMappoint[mapId]; if (GRMap.instance.m_nCurMapID != mapId && GRMap.instance.m_nCurMapID != mapPoint) { SelfRole.Transmit(mapPoint, () => SelfRole.WalkToMap(mapId, waitPosition, taskmove: true), taskTrans: true); } else { SelfRole.WalkToMap(mapId, waitPosition, taskmove: true); } } } // endif wait given point else if (taskTargetType == TaskTargetType.KILL_MONSTER_GIVEN) { A3_TaskOpt.Instance.IsOnKillMon = true; Vector3 waitPosition = Vector3.zero; SXML monInfo = A3_TaskModel.getInstance().GetTaskXML().GetNode("Task", "id==" + taskData.taskId); if (monInfo != null) { //A3_TaskOpt.Instance.IsOnKillMon = true; A3_TaskOpt.Instance.LockStat = false; PlayerModel.getInstance().task_monsterIdOnAttack.Add(taskData.taskId, monInfo.getInt("target_param2")); A3_TaskOpt.Instance.killPosition = new Vector3(monInfo.getFloat("target_coordinate_x"), 0, monInfo.getFloat("target_coordinate_y")); waitPosition = A3_TaskOpt.Instance.killPosition; } //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData //{ // mapId = monInfo.getInt("tasking_map_id"), // check_beforeShow = true, // handle_customized_afterTransmit = () => SelfRole.WalkToMap(monInfo.getInt("tasking_map_id"), // waitPosition), // targetPosition = waitPosition //}); int mapId = monInfo.getInt("tasking_map_id"); if (MapModel.getInstance().dicMappoint.ContainsKey(mapId)) { int mapPoint = MapModel.getInstance().dicMappoint[mapId]; if (GRMap.instance.m_nCurMapID != mapId && GRMap.instance.m_nCurMapID != mapPoint) { SelfRole.Transmit(mapPoint, () => SelfRole.WalkToMap(mapId, waitPosition, taskmove: true), taskTrans: true); } else { SelfRole.WalkToMap(mapId, waitPosition, taskmove: true); } } } // endif kill given monster else if (taskTargetType == TaskTargetType.GET_ITEM_GIVEN) { int holdNum = 0, needNum = 0; //A3_TaskOpt.Instance.IsOnTaskWait = true; Action uiHandle = null; NpcShopData npcShopData = null; SXML taskinfoGetItem = A3_TaskModel.getInstance().GetTaskXML().GetNode("Task", "id==" + taskData.taskId); A3_TaskOpt.Instance.taskItemId = taskinfoGetItem.getUint("target_param2"); needNum = taskData.completion - taskData.taskRate;//taskinfoGetItem.getInt("target_param1"); holdNum = a3_BagModel.getInstance().getItemNumByTpid(A3_TaskOpt.Instance.taskItemId); uiHandle = () => A3_TaskOpt.Instance?.ShowSubmitItem(); npcShopData = A3_NPCShopModel.getInstance().GetDataByItemId(A3_TaskOpt.Instance.taskItemId); if (holdNum >= needNum) { int npcId = taskinfoGetItem.getInt("complete_npc_id"); int mapId = taskinfoGetItem.getInt("tasking_map_id"); SXML npcInfo = XMLMgr.instance.GetSXML("npcs").GetNode("npc", "id==" + npcId); float mapY = npcInfo.getFloat("location_height"); if (mapY < 0) { mapY = 0; } Vector3 npcPos = new Vector3(npcInfo.getFloat("location_x") / GameConstant.GEZI_TRANS_UNITYPOS, mapY / GameConstant.GEZI_TRANS_UNITYPOS, npcInfo.getFloat("location_y") / GameConstant.GEZI_TRANS_UNITYPOS); //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData //{ // mapId = mapId, // check_beforeShow = true, // handle_customized_afterTransmit = () => // { // SelfRole.WalkToMap(mapId, npcPos, handle: () => { A3_TaskOpt.Instance.ShowSubmitItem(); }, stopDis: 2f); // } //}); if (MapModel.getInstance().dicMappoint.ContainsKey(mapId)) { int mapPoint = MapModel.getInstance().dicMappoint[mapId]; if (GRMap.instance.m_nCurMapID != mapId && GRMap.instance.m_nCurMapID != mapPoint) { SelfRole.Transmit(mapPoint, () => SelfRole.WalkToMap(mapId, npcPos, () => { A3_TaskOpt.Instance.ShowSubmitItem(); }, 2f, taskmove: true), taskTrans: true); } else { SelfRole.WalkToMap(mapId, npcPos, () => { A3_TaskOpt.Instance.ShowSubmitItem(); }, 2f, taskmove: true); } } } else if (npcShopData != null) { //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData //{ // mapId = npcShopData.mapId, // check_beforeShow = true, // handle_customized_afterTransmit = () => SelfRole.moveToNPc(npcShopData.mapId, npcShopData.npc_id) //}); int mapId = npcShopData.mapId; if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID) { SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcShopData.npc_id, taskmove: true), taskTrans: true); } else { SelfRole.moveToNPc(mapId, npcShopData.npc_id, taskmove: true); } } else { if (checkItems) { ArrayList data = new ArrayList(); data.Add(a3_BagModel.getInstance().getItemDataById(A3_TaskOpt.Instance.taskItemId)); //data.Add(null); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMLACK, data); } } } // endif get given item #endregion }