/// <summary> /// 判断副本是否开启 /// </summary> bool IsCopyOpen(CopyGroupRef refData) { FunctionType functionType = FunctionType.None; if (refData.sort == 1)//只有单人副本由功能开启表开启 { switch (refData.id) { case 1: functionType = FunctionType.COPY; break; //这种硬编码,有时间就改掉 by邓成 case 2: functionType = FunctionType.DOUSHUAIASGARD; break; case 3: functionType = FunctionType.FIVEMANOR; break; case 5: functionType = FunctionType.TRUEORFALSEMONKEY; break; case 6: functionType = FunctionType.WHITEPURGATORY; break; default: break; } bool isOpen = refData.lv <= GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel && GameCenter.mainPlayerMng.FunctionIsOpen(functionType); return(isOpen); } else { return(refData.lv <= GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel); } }
/// <summary> /// 获取相应Vip等级和购买次数所需的元宝 /// </summary> int GetDiamoNum(int _buyNum, CopyGroupRef _data) { if (_data == null) { return(0); } VIPRef refData = ConfigMng.Instance.GetVIPRef(GameCenter.vipMng.VipData.vLev); CopyTimes times = null; if (refData != null) { for (int i = 0; i < refData.copyPurchasetimes.Count; i++) { times = refData.copyPurchasetimes[i]; if (times.copyID == _data.id && times.copyTimes > 0) { break; } } } //Debug.Log("该VIP一共有多少购买次数 :" + times.copyTimes + " 还剩几次购买 : " + _buyNum + " 当前是第几次购买 : " + (times.copyTimes - _buyNum + 1)); //times.copyTimes(该VIP一共有多少次购买次数,配表读取) //_buyNum(还剩多少次购买次数,服务端记录) //setpId(本次是第几次购买) int setpId = times.copyTimes - _buyNum + 1; StepConsumptionRef stepConsumptionRef = ConfigMng.Instance.GetStepConsumptionRef(setpId); return(stepConsumptionRef != null ? stepConsumptionRef.copyNumber[0].count : 5); }
public void SetToBuyShow(CopyGroupRef data) { curdata = data; if (curdata != null && GameCenter.duplicateMng.CopyDic.ContainsKey(curdata.id)) { totalNum = GameCenter.duplicateMng.CopyDic[curdata.id].buyNum; } CurNum = 1; name.text = data.name; UIEventListener.Get(btnOK).parameter = data; }
/// <summary> /// 排序从大到小排序 /// </summary> /// <param name="_data1"></param> /// <param name="_data2"></param> /// <returns></returns> int CopySortType(CopyGroupRef _data1, CopyGroupRef _data2) { if (_data1.id > _data2.id) { return(-1); } if (_data1.id < _data2.id) { return(1); } return(0); }
/// <summary> /// 单人副本再次挑战 /// </summary> public void AgainToCopyItem() { if (copyDic.ContainsKey(againCopyID) && copyDic[againCopyID].num > 0) { C2S_ToCopyItem(againCopyID, againSceneID); } else if (copyDic.ContainsKey(againCopyID)) { CopyInItemDataInfo _serData = copyDic[againCopyID]; CopyGroupRef refdata = ConfigMng.Instance.GetCopyGroupRef(_serData.id); if (_serData.buyNum > 0)//可购买次数大于0,弹出快捷购买次数 { //Debug.Log("快捷购买"); //CopyGroupRef copyGroupRef = int needGold = GetDiamoNum(_serData.buyNum, refdata); MessageST msg = new MessageST(); msg.messID = 530; msg.words = new string[1] { needGold.ToString() }; msg.delYes = delegate { //Debug.Log("lcopyGroupRef.id" + GameCenter.duplicateMng.lcopyGroupRef.id); //元宝是否充足 if (GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount >= (ulong)needGold) { C2S_BuyCopyInItem(refdata.id, 1); C2S_ToCopyItem(againCopyID, againSceneID); } else { MessageST mst = new MessageST(); mst.messID = 137; mst.delYes = delegate { // 跳转到充值界面 GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE); }; GameCenter.messageMng.AddClientMsg(mst); } }; GameCenter.messageMng.AddClientMsg(msg); } else { GameCenter.messageMng.AddClientMsg(167); } } else { Debug.Log("副本字典中不包含ID为:" + againCopyID + "副本数据"); } }
void OnClickToBuy(GameObject games) { CopyGroupRef data = UIEventListener.Get(games).parameter as CopyGroupRef; if (CurNum <= 0) { GameCenter.messageMng.AddClientMsg(242); return; } if (data != null) { GameCenter.duplicateMng.C2S_BuyCopyInItem(data.id, CurNum); } }
/// <summary> /// 副本进入按钮红点显示 /// </summary> void SetAllCopyRedPoint() { foreach (CopyInItemDataInfo data in copyDic.Values) { CopyGroupRef refdata = ConfigMng.Instance.GetCopyGroupRef(data.id); if (refdata != null && data.num > 0 && refdata.lv <= GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel) { if (refdata.sort == 1) { FunctionType funcType = FunctionType.None; switch (refdata.id) { case 1: funcType = FunctionType.COPY; break; case 2: funcType = FunctionType.DOUSHUAIASGARD; break; case 3: funcType = FunctionType.FIVEMANOR; break; case 5: funcType = FunctionType.TRUEORFALSEMONKEY; break; case 6: funcType = FunctionType.WHITEPURGATORY; break; } if (GameCenter.mainPlayerMng.FunctionIsOpen(funcType)) { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.COPY, true); return; } } else { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.COPY, true); return; } } } GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.COPY, false); }
/// <summary> /// 1=单人副本,2=多人副本(红点显示) /// </summary> public bool IsTipCopyTypeRedShow(int type) { foreach (CopyInItemDataInfo data in copyDic.Values) { CopyGroupRef refdata = ConfigMng.Instance.GetCopyGroupRef(data.id); if (refdata != null && refdata.sort == type && data.num > 0 && refdata.lv <= GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel) { if (refdata.sort == 1) { //int funcType = 0; FunctionType funcType = FunctionType.None; switch (refdata.id) { case 1: funcType = FunctionType.COPY; break; case 2: funcType = FunctionType.DOUSHUAIASGARD; break; case 3: funcType = FunctionType.FIVEMANOR; break; case 5: funcType = FunctionType.TRUEORFALSEMONKEY; break; case 6: funcType = FunctionType.WHITEPURGATORY; break; } if (GameCenter.mainPlayerMng.FunctionIsOpen(funcType)) { return(true); } } else { return(true); } } } return(false); }
/// <summary> /// 弹出快捷购买提示 /// </summary> public void PopTip(CopyInItemDataInfo _serData, CopyGroupRef _data, int _type, bool _isSweep, bool _isUseSweepItem) { if (_serData == null || _data == null) { return; } bool isShowTip = true; if (_serData.buyNum > 0)//可购买次数大于0,弹出快捷购买次数 { if (GameCenter.endLessTrialsMng.sweepType == EndLessTrialsMng.SweepType.COPY) { isShowTip = isShowBuyCopyTip; } if (isShowTip) { int needGold = GetDiamoNum(_serData.buyNum, _data); MessageST msg = new MessageST(); object[] pa = { 1 }; msg.pars = pa; msg.delPars = delegate(object[] ob) { if (ob.Length > 0) { bool b = (bool)ob[0]; if (b) { isShowBuyCopyTip = false; } } }; msg.messID = 499; msg.words = new string[1] { needGold.ToString() }; msg.delYes = delegate { //元宝是否充足 if (GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount >= (ulong)needGold) { if (_isSweep && _isUseSweepItem)//是否是扫荡 { ShowBuySweepItemPop(_data.id, _type); } else { GameCenter.duplicateMng.C2S_BuyCopyInItem(_data.id, 1); GameCenter.duplicateMng.C2S_ToCopyItem(_data.id, _type); } } else { MessageST mst = new MessageST(); mst.messID = 137; mst.delYes = delegate { GameCenter.uIMng.ReleaseGUI(GUIType.SWEEPCARBON); // 跳转到充值界面 GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE); }; GameCenter.messageMng.AddClientMsg(mst); } }; GameCenter.messageMng.AddClientMsg(msg); } else//不用弹购买提示 { if (_isUseSweepItem && isShowBuySweepItem) { ShowBuySweepItemPop(_data.id, _type); } else { GameCenter.duplicateMng.C2S_BuyCopyInItem(_data.id, 1); GameCenter.duplicateMng.C2S_ToCopyItem(_data.id, _type); } } } else//可购买次数小于0跳转到充值界面 { MessageST msg = new MessageST(); msg.messID = 500; msg.delYes = delegate { GameCenter.uIMng.ReleaseGUI(GUIType.SWEEPCARBON); GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE); }; GameCenter.messageMng.AddClientMsg(msg); } }
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 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()}); // } }