private void OnDragonLineClick(GameObject go) { if (!A3_SlayDragonModel.getInstance().dicDragonData.ContainsKey(go.name)) { return; } for (int i = 0; i < rootDragonList.childCount; i++) { rootDragonList.GetChild(i).FindChild("select").gameObject.SetActive(false); } currentSelectedDragonName = go.name; bool isUnlocked = A3_SlayDragonModel.getInstance().dicDragonData[currentSelectedDragonName].isUnlcoked; go.transform.FindChild("select").gameObject.SetActive(true); if (isUnlocked) { go.transform.FindChild("select/unlocked").gameObject.SetActive(true); go.transform.FindChild("select/locked").gameObject.SetActive(false); } else { go.transform.FindChild("select/unlocked").gameObject.SetActive(false); go.transform.FindChild("select/locked").gameObject.SetActive(true); } RefreshDragonInfo(currentSelectedDragonName); }
private void OnRefresh(GameEvent e) { if (!e.data.ContainsKey("tulong_lvl_ary")) { return; } A3_SlayDragonModel.getInstance().SyncData(e.data); if (Instance != null && currentSelectedDragonName == null) { OnDragonLineClick(rootDragonList.GetChild(0).gameObject); } List <Variant> listDragonData = e.data["tulong_lvl_ary"]._arr; uint dragonId = A3_SlayDragonModel.getInstance().GetIdByName(currentSelectedDragonName); for (int i = 0; i < listDragonData.Count; i++) { uint curDrgnId = listDragonData[i]["lvl_id"]; bool isUnlocked = listDragonData[i]["zhaohuan"]; if (dragonId != 0 && curDrgnId == dragonId && isUnlocked) { RefreshDragonInfo(currentSelectedDragonName); } string drgnName = A3_SlayDragonModel.getInstance().GetNameById(curDrgnId); Transform curDragLn = rootDragonList.FindChild(drgnName); bool isDead = listDragonData[i]["death"], isOpened = listDragonData[i]["open"], isCreated = listDragonData[i]["create_tm"]; curDragLn.FindChild("state/killed").gameObject.SetActive(isDead); curDragLn.FindChild("state/unlocked").gameObject.SetActive(isUnlocked && !isDead); curDragLn.FindChild("state/locked").gameObject.SetActive(!isUnlocked && !isDead); } if (!isFrstdrgnInit && InterfaceMgr.getInstance().checkWinOpened(InterfaceMgr.A3_SLAY_DRAGON)) { ShowFirstDragon(); } }
private void OnCreateDragon(GameObject go) { uint drgnId = A3_SlayDragonModel.getInstance().dicDragonData[currentSelectedDragonName].dragonId; int diff_lvl = A3_SlayDragonModel.getInstance().GetUnlockedDiffLv(); A3_SlayDragonProxy.getInstance().SendCreate(drgnId, diff_lvl); }
private void OnRefreshTime(GameEvent e) { if (!e.data.ContainsKey("end_time") || e.data["end_time"] == 0) { return; } else { A3_SlayDragonModel.getInstance().GetUnlockedDragonData().endTimeStamp = e.data["end_time"]; if (!IsInvoking("RunTimer")) { InvokeRepeating("RunTimer", 0f, 1f); } } }
private void OnGoToSlayDragon(GameObject go) { if (A3_LegionModel.getInstance().myLegion.clanc < 3 && !A3_SlayDragonModel.getInstance().GetUnlockedDragonData().isOpened) { flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_noopen")); return; } if (0 != A3_SlayDragonModel.getInstance().GetUnlockedDragonId()) { isOnMoveOpt = true; A3_SlayDragonProxy.getInstance().SendGo(); } else { flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_jf")); } }
private void RunTimer() { DragonData unlockedDrgnData = A3_SlayDragonModel.getInstance()?.GetUnlockedDragonData(); if (goTimer.activeSelf && unlockedDrgnData != null && unlockedDrgnData.endTimeStamp != 0) { long currentTime = muNetCleint.instance.CurServerTimeStamp; long span = unlockedDrgnData.endTimeStamp - currentTime; if (span > 0) { txtTimer.text = string.Format("{0:D2}:{1:D2}", span % 3600 / 60, span % 60); } else { txtTimer.text = "00:00"; } } }
private void OnGive(GameObject go) { uint unlockedDragonId = 0; DragonData curDrgnData = A3_SlayDragonModel.getInstance().dicDragonData[currentSelectedDragonName]; if (0 != (unlockedDragonId = A3_SlayDragonModel.getInstance().GetUnlockedDragonId()) && unlockedDragonId == curDrgnData.dragonId) { uint itemId = A3_SlayDragonModel.getInstance().GetDragonKeyId(); if (0 != itemId) { if (0 < a3_BagModel.getInstance().getItemNumByTpid(itemId)) { if (curDrgnData.proc < A3_SlayDragonModel.getInstance().GetCost()) { A3_SlayDragonProxy.getInstance().SendGive(); } else { flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_can")); } } else { ArrayList data = new ArrayList(); data.Add(a3_BagModel.getInstance().getItemDataById(itemId)); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMLACK, data); } } } else { if (A3_LegionModel.getInstance().myLegion.clanc < 3) { flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_jf")); } else { flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_please")); } } }
private void OnUnlockDragon(GameObject go) { if (A3_LegionModel.getInstance().myLegion.clanc >= 3) { if (currentSelectedDragonName != null) { DragonData dragonData = A3_SlayDragonModel.getInstance().dicDragonData[currentSelectedDragonName]; if (!dragonData.isUnlcoked && 0 == A3_SlayDragonModel.getInstance().GetUnlockedDragonId()) { A3_SlayDragonProxy.getInstance().SendUnlock(dragonData.dragonId); } else { flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_nomany")); } } } else { flytxt.instance.fly(ContMgr.getCont("A3_SlayDragon_kustllx")); } }
private void RefreshDragonInfo(string dragonName) { DragonData dragonData = A3_SlayDragonModel.getInstance().dicDragonData[dragonName]; int cost = A3_SlayDragonModel.getInstance().GetCost(); uint dragonId = dragonData.dragonId; uint proc = dragonData.proc; bool isUnlocked = dragonData.isUnlcoked, isOpened = dragonData.isOpened, isDead = dragonData.isDead, isCreated = dragonData.isCreated && !isDead; if (isCreated || isDead) { goTimer.SetActive(isCreated); rootDragonOpt.FindChild("proc_unlock").gameObject.SetActive(false); } else { goTimer.SetActive(false); rootDragonOpt.FindChild("proc_unlock").gameObject.SetActive(true); rootDragonOpt.FindChild("proc_unlock/proc_text").GetComponent <Text>().text = string.Format("{0}/{1}", proc, cost); rootDragonOpt.FindChild("proc_unlock/Slider").GetComponent <Slider>().value = proc / (float)cost; } string strDragonId = dragonId.ToString(); Transform tfDesc = rootDragonOpt.FindChild("descBg/desc"); for (int i = 0; i < tfDesc.childCount; i++) { GameObject goDesc = tfDesc.GetChild(i).gameObject; if (!goDesc.name.Equals(strDragonId)) { goDesc.SetActive(false); } else { goDesc.SetActive(true); } } if (isDead) { rootDragonOpt.FindChild("btn_do/Create").gameObject.SetActive(false); rootDragonOpt.FindChild("btn_do/Unlock").gameObject.SetActive(false); rootDragonOpt.FindChild("btn_do/Go").GetComponent <Button>().interactable = false; } else { if (A3_LegionModel.getInstance().myLegion.clanc < 3) { rootDragonOpt.FindChild("btn_do/Create").gameObject.SetActive(false); } rootDragonOpt.FindChild("btn_do/Go").GetComponent <Button>().interactable = true; if (isUnlocked) { if (!isOpened) { rootDragonOpt.FindChild("btn_do/Unlock").gameObject.SetActive(false); rootDragonOpt.FindChild("btn_do/Create").gameObject.SetActive(!isCreated); rootDragonOpt.FindChild("btn_do/Create").GetComponent <Button>().interactable = proc >= cost; } else { rootDragonOpt.FindChild("btn_do/Create").gameObject.SetActive(false); rootDragonOpt.FindChild("btn_do/Unlock").gameObject.SetActive(false); rootDragonOpt.FindChild("btn_do/Go").gameObject.SetActive(isCreated); } } else { if (!isCreated) { rootDragonOpt.FindChild("btn_do/Unlock").gameObject.SetActive(true); rootDragonOpt.FindChild("btn_do/Unlock").GetComponent <Button>().interactable = A3_SlayDragonModel.getInstance().IsAbleToUnlock(); rootDragonOpt.FindChild("btn_do/Go").gameObject.SetActive(false); } } } }
public override void init() { #region 初始化汉字 getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1201").text = ContMgr.getCont("A3_SlayDragon_0"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1201/title_text").text = ContMgr.getCont("A3_SlayDragon_1"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1202").text = ContMgr.getCont("A3_SlayDragon_2"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1202/title_text").text = ContMgr.getCont("A3_SlayDragon_3"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1203").text = ContMgr.getCont("A3_SlayDragon_4"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1203/title_text").text = ContMgr.getCont("A3_SlayDragon_5"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1204").text = ContMgr.getCont("A3_SlayDragon_6"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1204/title_text").text = ContMgr.getCont("A3_SlayDragon_7"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1205").text = ContMgr.getCont("A3_SlayDragon_8"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1205/title_text").text = ContMgr.getCont("A3_SlayDragon_9"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1206").text = ContMgr.getCont("A3_SlayDragon_10"); getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1206/title_text").text = ContMgr.getCont("A3_SlayDragon_11"); getComponentByPath <Text>("bg/dragon_opt/proc_unlock/proc_desc").text = ContMgr.getCont("A3_SlayDragon_12"); getComponentByPath <Text>("bg/dragon_opt/timer/desc").text = ContMgr.getCont("A3_SlayDragon_13"); getComponentByPath <Text>("bg/dragon_opt/reward/text").text = ContMgr.getCont("A3_SlayDragon_14"); getComponentByPath <Text>("bg/dragon_opt/btn_do/Go/text_img/Text").text = ContMgr.getCont("A3_SlayDragon_15"); getComponentByPath <Text>("bg/dragon_opt/btn_do/Create/text_img/Text").text = ContMgr.getCont("A3_SlayDragon_15"); getComponentByPath <Text>("bg/dragon_opt/btn_do/Unlock/text_img/Text").text = ContMgr.getCont("A3_SlayDragon_16"); getComponentByPath <Text>("hp/help_txt/desc/title").text = ContMgr.getCont("A3_SlayDragon_17"); getComponentByPath <Text>("hp/help_txt/desc/dc").text = ContMgr.getCont("A3_SlayDragon_18"); #endregion Instance = this; rootDragonList = transform.FindChild("bg/dragon_list/rect_mask/rect_scroll"); for (int i = 0; i < rootDragonList.childCount; i++) { Transform tfDragonLine = rootDragonList.GetChild(i); A3_SlayDragonModel.getInstance().dicDragonName[i] = tfDragonLine.name; new BaseButton(tfDragonLine).onClick = OnDragonLineClick; } goDragonHelpTxt = transform.FindChild("hp/help_txt").gameObject; goTimer = transform.FindChild("bg/dragon_opt/timer").gameObject; txtTimer = goTimer.transform.FindChild("time").GetComponent <Text>(); new BaseButton(transform.FindChild("bg/dragon_opt/btn_do/Go")).onClick = OnGoToSlayDragon; new BaseButton(transform.FindChild("bg/dragon_opt/btn_do/Unlock")).onClick = OnUnlockDragon; new BaseButton(transform.FindChild("bg/dragon_opt/btn_do/Create")).onClick = (go) => { OnCreateDragon(go); OnGoToSlayDragon(go); }; new BaseButton(transform.FindChild("bg/dragon_opt/proc_unlock/btn_give")).onClick = OnGive; new BaseButton(transform.FindChild("close")).onClick = (go) => InterfaceMgr.getInstance().close(InterfaceMgr.A3_SLAY_DRAGON); new BaseButton(transform.FindChild("hp")).onClick = (go) => goDragonHelpTxt.SetActive(true); new BaseButton(goDragonHelpTxt.transform.FindChild("close_area")).onClick = (go) => goDragonHelpTxt.SetActive(false); rootDragonOpt = transform.FindChild("bg/dragon_opt"); new BaseButton(rootDragonOpt.FindChild("reward/reward_icon")).onClick = (go) => { uint dragonId = A3_SlayDragonModel.getInstance().dicDragonData[currentSelectedDragonName].dragonId; uint itemId = A3_SlayDragonModel.getInstance().GetRewardIdByDragonId(dragonId); if (itemId == 0) { return; } ArrayList arr = new ArrayList(); arr.Add(itemId); arr.Add(1); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_MINITIP, arr); }; A3_SlayDragonProxy.getInstance().addEventListener(A3_SlayDragonProxy.REFRESH, OnRefresh); A3_SlayDragonProxy.getInstance().addEventListener(A3_SlayDragonProxy.OPEN_LVL, OnOpenLvl); }
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; actionImage = tfParentWait.FindChild("waitBG/btnDoWait").GetComponent <Image>(); winKillMon = transform.FindChild("killmon").gameObject; winKillMon.SetActive(false); winKillDragon = transform.FindChild("killDragon").gameObject; winKillDragon.SetActive(false); tfSubmitItem = transform.FindChild("submitItem"); tfSubmitItemMainCon = tfSubmitItem.FindChild("mask/scrollview/rect"); tfSubmitItemCon = tfSubmitItem.FindChild("mask/scrollview/rect/con"); tfFocus = tfSubmitItem.FindChild("focus"); tfFocus.gameObject.SetActive(false); tfSubmitItem.gameObject.SetActive(false); 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(transform.FindChild("killmon/closeArea")).onClick = (go) => go.transform.parent.gameObject.SetActive(false); new BaseButton(tfSubmitItem.FindChild("btnOK")).onClick = (go) => { if (submitItemIId != 0 && curTaskId != 0) { A3_TaskProxy.getInstance().SendSubmit(curTaskId, submitItemIId); } tfSubmitItem.gameObject.SetActive(false); }; //transform.SetParent(skillbar.instance.transform); A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_TASK_REFRESH, OnCheck); A3_TaskProxy.getInstance().addEventListener(A3_TaskProxy.ON_GET_NEW_TASK, OnCheck); taskOptElement = new Dictionary <int, TaskOptElement>(); Dictionary <int, TaskData> listTask = A3_TaskModel.getInstance().GetDicTaskData(); List <int> idx = new List <int>(listTask.Keys); for (int i = 0; i < idx.Count; i++) { int taskId = idx[i]; if (listTask[taskId].release_tm > 0) { if (listTask[taskId].lose_tm > muNetCleint.instance.CurServerTimeStamp) { taskOptElement[taskId] = new TaskOptElement(taskId, isKeepingKillMon: true, isTaskMonsterAlive: true //, //timeKillTerminal: A3_TaskModel.getInstance().GetTaskDataById(taskId).lose_tm ); taskOptElement[taskId].InitUi( liteMinimapTaskTimer: a3_liteMinimap.instance.GetTaskPage(taskId)?.transform.FindChild("name/timer").GetComponent <Text>() ); } } } Instance.name = "A3_TaskOpt"; waitThresholdDistance = XMLMgr.instance.GetSXML("task.range").getFloat("action_range") / GameConstant.PIXEL_TRANS_UNITYPOS; scaleIcon = transform.FindChild("submitItem/iconConfig")?.localScale ?? Vector3.zero; new BaseButton(winKillDragon.transform.FindChild("btnStart")).onClick = (go) => { uint dragonId = A3_SlayDragonModel.getInstance().GetUnlockedDragonId(); int diffLv = A3_SlayDragonModel.getInstance().GetUnlockedDiffLv(); A3_SlayDragonProxy.getInstance().SendGo(); }; new BaseButton(winKillDragon.transform.FindChild("btnNope")).onClick = (go) => winKillDragon.SetActive(false); if (!IsInvoking("RunTimer")) { InvokeRepeating("RunTimer", 0f, 1.0f); } getComponentByPath <Text>("killmon/bg/desc").text = ContMgr.getCont("A3_TaskOpt_0"); getComponentByPath <Text>("killmon/btncreatteam/Text").text = ContMgr.getCont("A3_TaskOpt_1"); getComponentByPath <Text>("killmon/btnDontStart/Text").text = ContMgr.getCont("A3_TaskOpt_2"); getComponentByPath <Text>("killmon/btnStart/Text").text = ContMgr.getCont("A3_TaskOpt_3"); getComponentByPath <Text>("wait/action_text").text = ContMgr.getCont("A3_TaskOpt_4"); getComponentByPath <Text>("submitItem/title/Text").text = ContMgr.getCont("A3_TaskOpt_5"); getComponentByPath <Text>("submitItem/btnOK/text").text = ContMgr.getCont("A3_TaskOpt_6"); getComponentByPath <Text>("killDragon/bg/desc").text = ContMgr.getCont("A3_TaskOpt_7"); getComponentByPath <Text>("killDragon/btnStart/Text").text = ContMgr.getCont("A3_TaskOpt_8"); getComponentByPath <Text>("killDragon/btnNope/Text").text = ContMgr.getCont("A3_TaskOpt_2"); }