void ShowChild() { if (curData == null) { return; } CopyRef refd = ConfigMng.Instance.GetCopyRef(curData.copy[Index]); if (refd == null) { return; } if (curName != null) { curName.spriteName = refd.Icon; } if (childCurName != null) { childCurName.spriteName = refd.Icon; } for (int i = 0; i < uifx.Length; i++) { if (uifx[i] == null) { continue; } if (i == Index) { uifx[i].SetActive(true); } else { uifx[i].SetActive(false); } } AttributeRef attributeRef = ConfigMng.Instance.GetAttributeRef(refd.lvId > 0 ? refd.lvId : 1); if (attributeRef.reborn > 0) { if (lev != null) { lev.text = ConfigMng.Instance.GetUItext(12, new string[2] { attributeRef.reborn.ToString(), attributeRef.display_level.ToString() }); } } else { if (lev != null) { lev.text = ConfigMng.Instance.GetUItext(13, new string[1] { attributeRef.display_level.ToString() }); } } if (fight != null) { fight.text = refd.fighting.ToString(); } }
//void ShowInvitationPlayer() //{ // toInvitation.gameObject.SetActive(true); //} void OpenInvitationPlayer() { if (toInvitation == null) { return; } toInvitation.ListPlayer = GameCenter.duplicateMng.OpenInvitationPlayerData; CopyRef copy = ConfigMng.Instance.GetCopyRef(CurData.curCopyScene); int count = 0; foreach (CopySceneTeamPlayerInfo data in GameCenter.duplicateMng.CopyTeams.Values) { if (!data.isAvatar) { ++count; } } if (copy != null) { if (reward1 != null) { reward1.SetData(copy.reward1, count >= 2); } if (reward2 != null) { reward2.SetData(copy.reward2, count >= 3); } } else { Debug.Log("副本表中找不到id为:" + CurData.curCopyScene + "的数据"); } }
bool ISInCopyChlid(int _id) { CopyRef refd = ConfigMng.Instance.GetCopyRef(_id); if (refd == null) { return(false); } return(refd.lvId <= GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel); }
public void SeleteCopyScene() { int curCopyRefID = InCopy(); UIToggle toggle = copyChilds[curCopyRefID].GetComponent <UIToggle>(); if (toggle != null) { toggle.value = true; } CopyRef copy = ConfigMng.Instance.GetCopyRef(data.copy[curCopyRefID]); if (fight != null && copy != null) { fight.text = copy.fighting.ToString(); } }
void OnEnable() { myToggle = GetComponent <UIToggle>(); CopyRef refd = ConfigMng.Instance.GetCopyRef(CopyRefID); if (refd == null) { return; } bool isShow = refd.lvId <= GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel; if (name != null) { name.text = refd.difficulty; name.color = isShow ? color : Color.gray; } if (bgSp != null) { bgSp.IsGray = isShow ? UISpriteEx.ColorGray.normal : UISpriteEx.ColorGray.Gray; } gameObject.GetComponent <BoxCollider>().enabled = isShow; AttributeRef attributeRef = ConfigMng.Instance.GetAttributeRef(refd.lvId); if (attributeRef.reborn > 0) { if (lev != null) { lev.text = ConfigMng.Instance.GetUItext(10, new string[2] { attributeRef.reborn.ToString(), attributeRef.display_level.ToString() }); } } else { if (lev != null) { lev.text = ConfigMng.Instance.GetUItext(11, new string[1] { attributeRef.display_level.ToString() }); } } if (lev != null) { lev.color = isShow ? color : Color.gray; } }
void OnCopyChilds() { int copyid = 0; for (int i = 0, len = copyChilds.Length; i < len; i++) { if (copyChilds[i] == null) { continue; } if (copyChilds[i].GetComponent <UIToggle>().value) { copyid = copyChilds[i].CopyRefID; } } if (copyid > 0) { CopyRef copy = ConfigMng.Instance.GetCopyRef(copyid); if (fight != null && copy != null) { fight.text = copy.fighting.ToString(); } } }
void Init() { if (data == null) { return; } int curCopyRefID = InCopy(); UIToggle tog = null; tog = copyChilds[curCopyRefID].GetComponent <UIToggle>(); //if(tog != null)tog.startsActive = true;注释掉解决选中难度的BUG CopyRef copy = ConfigMng.Instance.GetCopyRef(data.copy[curCopyRefID]); if (fight != null && copy != null) { fight.text = copy.fighting.ToString(); } if (GameCenter.duplicateMng.CopyType == DuplicateMng.CopysType.ONESCOPY) { if (btnOK != null) { UIEventListener.Get(btnOK).onClick = delegate { for (int i = 0, len = copyChilds.Length; i < len; i++) { tog = copyChilds[i].GetComponent <UIToggle>(); if (copyChilds[i] != null && tog != null && tog.value) { CopyInItemDataInfo serData = null; // Debug.logger.Log("data.id = " + data.id + " , " + GameCenter.endLessTrialsMng.CopyDic.Count); if (GameCenter.duplicateMng.CopyDic.TryGetValue(data.id, out serData)) { if (serData.num > 0) { GameCenter.duplicateMng.C2S_ToCopyItem(data.id, copyChilds[i].CopyRefID); } else { GameCenter.duplicateMng.PopTip(serData, data, copyChilds[i].CopyRefID, false, false); } return; } else { Debug.LogError("升级后没有服务端数据过来,找小唔知!"); } } } } } ; } if (btnSweep != null) { UIEventListener.Get(btnSweep).onClick = OnClickSweep; } if (btnInNumUI != null) { UIEventListener.Get(btnInNum).onClick = delegate { CopyInNumBuyUI numbuy = btnInNumUI.GetComponent <CopyInNumBuyUI>(); if (numbuy != null) { numbuy.SetToBuyShow(data); } if (!diamoInNum.text.Equals("0")) { btnInNumUI.SetActive(true); } else { GameCenter.messageMng.AddClientMsg(242); } } } ; bool isAtk = data.id == GameCenter.duplicateMng.copyGroupID; if (GameCenter.duplicateMng.CopyType == DuplicateMng.CopysType.TWOSCOPY) { if (btnToTeam != null) { UIEventListener.Get(btnToTeam).onClick = delegate { if (!GameCenter.teamMng.isInTeam) { for (int i = 0, len = copyChilds.Length; i < len; i++) { if (copyChilds[i] == null) { continue; } tog = copyChilds[i].GetComponent <UIToggle>(); if (tog != null && tog.value) { GameCenter.duplicateMng.C2S_ReqCopyInTeamData(data.id, copyChilds[i].CopyRefID); return; } } } else { if (GameCenter.teamMng.isLeader) { for (int i = 0, len = copyChilds.Length; i < len; i++) { if (copyChilds[i] == null) { continue; } tog = copyChilds[i].GetComponent <UIToggle>(); if (tog != null && tog.value) { GameCenter.duplicateMng.C2S_ReqCopyInTeamData(data.id, copyChilds[i].CopyRefID); return; } } } else { //新加个判断解决多人组队进入一次后,队员可以开启多人副本开启界面 //(一旦多人副本组队挑战次数大于一次,此判断失效,正确做法应清空GameCenter.endLessTrialsMng.copyGroupID这个数据) if (GameCenter.duplicateMng.CopyTeams.Count > 0 && isAtk && twoCoppyNum > 0) { GameCenter.uIMng.SwitchToUI(GUIType.COPYMULTIPLEWND, GUIType.COPYINWND); return; } GameCenter.messageMng.AddClientMsg(165); } } } } ; } if (GameCenter.duplicateMng.copyGroupID > 0 && isAtk) { tog = gameObject.GetComponent <UIToggle>(); if (tog != null) { tog.startsActive = true; } if (!GameCenter.teamMng.isInTeam) { GameCenter.duplicateMng.copyGroupID = 0; } } else { tog = gameObject.GetComponent <UIToggle>(); if (tog != null) { tog.startsActive = false; } } } void OnDisable() { UIToggle tog = null; GameCenter.duplicateMng.OnCopyItemChange -= ShowCopyItem; for (int i = 0, len = copyChilds.Length; i < len; i++) { if (copyChilds[i] == null) { continue; } tog = copyChilds[i].GetComponent <UIToggle>(); if (tog != null) { EventDelegate.Remove(tog.onChange, OnCopyChilds); } } ConfigMng.Instance.RemoveBigUIIcon(data.icon); twoCoppyNum = 0; } /// <summary> /// 点击扫荡副本 /// </summary> void OnClickSweep(GameObject go) { if (GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel < 51 && GameCenter.vipMng.VipData != null && GameCenter.vipMng.VipData.vLev < 2) { GameCenter.messageMng.AddClientMsg(396);//1转45以上或VIP2以上 return; } for (int i = 0, len = copyChilds.Length; i < len; i++) { CopyInItemChildUI copyInItemChildUI = copyChilds[i]; if (copyInItemChildUI != null && copyInItemChildUI.TogValue) { CopyInItemDataInfo CopyInItemDataInfo = null; if (GameCenter.duplicateMng.CopyDic.TryGetValue(data.id, out CopyInItemDataInfo)) { // GameCenter.endLessTrialsMng.CopyDic[data.id]; if (CopyInItemDataInfo != null) { int curStar = CopyInItemDataInfo.copyScenes.ContainsKey(copyInItemChildUI.CopyRefID) ? CopyInItemDataInfo.copyScenes[copyInItemChildUI.CopyRefID].star : 0; //if (curStar >= 3)//改为只需通关即可无需3星 if (curStar > 0) { GameCenter.duplicateMng.lcopyGroupRef = data; if (CopyInItemDataInfo.num <= 0) { //GameCenter.messageMng.AddClientMsg(244); GameCenter.duplicateMng.PopTip(CopyInItemDataInfo, data, copyInItemChildUI.CopyRefID, true, true); } else { if (GameCenter.duplicateMng.isShowBuySweepItem) { if (GameCenter.inventoryMng.GetNumberByType(2210001) > 0)//新增扫荡卷轴消耗 { GameCenter.endLessTrialsMng.C2S_SweepReward(1, copyInItemChildUI.CopyRefID); } else { EquipmentInfo eqinfo = new EquipmentInfo(2210001, EquipmentBelongTo.PREVIEW); MessageST mst = new MessageST(); object[] pa = { 1 }; mst.pars = pa; mst.delPars = delegate(object[] ob) { if (ob.Length > 0) { bool b = (bool)ob[0]; if (b) { GameCenter.duplicateMng.isShowBuySweepItem = false; } } }; mst.messID = 543; mst.words = new string[1] { eqinfo.DiamondPrice.ToString() }; mst.delYes = delegate { if (GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount >= eqinfo.DiamondPrice) { //GameCenter.inventoryMng.C2S_AskBlessWeapon(2210001);//暂用祝福油的快捷购买协议 GameCenter.endLessTrialsMng.C2S_SweepReward(1, copyInItemChildUI.CopyRefID);//点击确定进入扫荡后台判断是否购买 } else { MessageST mst1 = new MessageST(); mst1.messID = 137; mst1.delYes = delegate { GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE); }; GameCenter.messageMng.AddClientMsg(mst1); } }; GameCenter.messageMng.AddClientMsg(mst); } } else { GameCenter.endLessTrialsMng.C2S_SweepReward(1, copyInItemChildUI.CopyRefID); } } } else { GameCenter.messageMng.AddClientMsg(127);//243提示改为127 } } } else { Debug.LogError("升级后没有服务端数据过来,找小唔知!"); } } } } }
void Awake() { GameCenter.duplicateMng.C2S_GetTowerChallengeNum(); mutualExclusion = true; Layer = GUIZLayer.TOPWINDOW; GameCenter.duplicateMng.CopyType = (DuplicateMng.CopysType)CurCopyWndType; List <CopyGroupRef> dataList = ConfigMng.Instance.GetCopyGroupRefTable(CurCopyWndType); if (dataList.Count > 0) { curData = dataList[0]; } if (btnX != null) { UIEventListener.Get(btnX).onClick = delegate { GameCenter.uIMng.SwitchToUI(GUIType.NONE); } } ; //UIEventListener.Get(btnL).onClick = delegate { // Index--; //}; //UIEventListener.Get(btnR).onClick = delegate { // Index++; //}; if (btnReward != null) { UIEventListener.Get(btnReward).onClick = delegate { GameCenter.shopMng.OpenWndByType(ShopItemType.SCORES); } } ; for (int i = 0, max = diffcuiltyTog.Length; i < max; i++) { UIEventListener.Get(diffcuiltyTog[i].gameObject).onClick = OnTogChange; UIEventListener.Get(diffcuiltyTog[i].gameObject).parameter = i; } if (btnOK != null) { UIEventListener.Get(btnOK).onClick = delegate { if (GameCenter.duplicateMng.isChallengeMagicTower) { GameCenter.messageMng.AddClientMsg(559); return; } //DateTime date = DateTime.Now; DateTime date = GameCenter.instance.CurServerTime; if (date.Hour >= 12) { CopyRef refd = ConfigMng.Instance.GetCopyRef(curData.copy[Index]); bool isShow = refd.lvId <= GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel; if (!isShow) { GameCenter.messageMng.AddClientMsg(341); return; } if (GameCenter.teamMng.isInTeam && !GameCenter.teamMng.isLeader) { if (GameCenter.duplicateMng.CopyTeams.Count <= 0 || curData.id != GameCenter.duplicateMng.copyGroupID) { GameCenter.messageMng.AddClientMsg(165); return; } GameCenter.uIMng.SwitchToUI(GUIType.COPYMULTIPLEWND, GUIType.MagicTowerWnd); } GameCenter.duplicateMng.C2S_ReqCopyInTeamData(curData.id, curData.copy[Index]); } else { GameCenter.messageMng.AddClientMsg(173); } } } ; } void OnTogChange(GameObject go) { Index = (int)UIEventListener.Get(go).parameter; }
void SetTogValue() { if (CurData == null) { return; } int index = RefData.copy.IndexOf(CurData.curCopyScene); //for (int i = 0, max = difficulty.Length; i < max; i++) //{ // if (i == index) difficulty[index].gameObject.SetActive(true); // else difficulty[i].gameObject.SetActive(false); //} CopyRef copy = ConfigMng.Instance.GetCopyRef(CurData.curCopyScene); //if (reward1 != null) reward1.SetGetState(GameCenter.teamMng.TeammateCount >= 2); //if (reward2 != null) reward2.SetGetState(GameCenter.teamMng.TeammateCount >= 3); if (copy != null) { string str; switch (index) { case 0: str = "[44D11EFF]" + copy.difficulty; break; case 1: str = "[40AFBEFF]" + copy.difficulty; break; case 2: str = "[BD54FFFF]" + copy.difficulty; break; case 3: str = "[FF2929FF]" + copy.difficulty; break; default: str = copy.difficulty; break; } if (diffcultyName != null) { diffcultyName.text = str; } int count = 0; foreach (CopySceneTeamPlayerInfo data in GameCenter.duplicateMng.CopyTeams.Values) { if (!data.isAvatar) { ++count; } } if (reward1 != null) { reward1.SetData(copy.reward1, count >= 2); } if (reward2 != null) { reward2.SetData(copy.reward2, count >= 3); } } else { Debug.Log("副本表中找不到id为:" + CurData.curCopyScene + "的数据"); } ShowCopyPerpare(); }
void ShowSettlement() { switch (GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneUiType) { case SceneUiType.ENDLESS: if (star != null) { star.SetActive(false); } break; default: if (star != null) { star.SetActive(true); } break; } bool isMultyple = false; bool isBossCoppy = (GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneUiType == SceneUiType.BOSSCOPPY); if (data.coppyId > 0) { CopyRef copyRef = ConfigMng.Instance.GetCopyRef(data.coppyId); if (copyRef != null) { CopyGroupRef copyGrop = ConfigMng.Instance.GetCopyGroupRef(copyRef.copyGroup); if (copyGrop != null) { isMultyple = copyGrop.sort == 2; } } } if (muiltiple != null) { muiltiple.SetActive(isMultyple && !isBossCoppy); } if (single != null) { single.SetActive(!isMultyple && !isBossCoppy); } if (bossCoppy != null) { bossCoppy.SetActive(isBossCoppy); } if (timeGo != null) { timeGo.SetActive(!isBossCoppy); } if (labBossNum != null) { labBossNum.text = data.bossCount.ToString(); } if (time != null) { time.text = GameCenter.duplicateMng.ItemTime(data.time); } for (int i = 0, len = stars.Length; i < len; i++) { if (stars[i] == null) { continue; } if (data.star > i) { stars[i].gameObject.SetActive(GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneUiType != SceneUiType.SEALBOSS); } else { stars[i].gameObject.SetActive(false); } } for (int i = 0, len = data.items.Count; i < len; i++) { if (data.items[i].EID == 3) { exp.text = data.items[i].StackCurCount.ToString(); } else if (data.items[i].EID == 5) { coin.text = data.items[i].StackCurCount.ToString(); } else { ItemUI item = UIUtil.CreateItemUIGame(table.gameObject).GetComponent <ItemUI>(); item.transform.localPosition = Vector3.zero; item.transform.localScale = Vector3.one; item.FillInfo(data.items[i]); item.gameObject.SetActive(true); } } if (table != null) { table.repositionNow = true; } if (isMultyple) { ShowMuiltypleReward(); } else { ShowSimpleReward(); } Invoke("SetDragAmount", 0.2f); // if(GameCenter.mainPlayerMng.MainPlayerInfo.reinNum > 0){ // if(mLev != null)mLev.text = ConfigMng.Instance.GetUItext(12, // new string[2]{GameCenter.mainPlayerMng.MainPlayerInfo.reinNum.ToString(),GameCenter.mainPlayerMng.MainPlayerInfo.Level.ToString()}); // }else{ // if(mLev != null)mLev.text = ConfigMng.Instance.GetUItext(13,new string[1]{GameCenter.mainPlayerMng.MainPlayerInfo.Level.ToString()}); // } }