/// <summary> /// 激活翅膀弹出展示模型UI /// </summary> /// <param name="_wingId"></param> void OnShowWingModel(WingInfo _wingInfo) { if (Time.time - GameCenter.mainPlayerMng.MainPlayerInfo.loginTime < 10) { return; //在创建主角之后十秒内 不做任何操作 } GameCenter.wingMng.modelType = ModelType.WING; GameCenter.wingMng.needShowWingInfo = _wingInfo; GameCenter.wingMng.isNotShowTrialWingModel = true; GameCenter.uIMng.SwitchToUI(GUIType.NONE); GameCenter.uIMng.GenGUI(GUIType.SHOWMODELUI, true); }
/// <summary> /// 注销 /// </summary> void UnRegist() { MsgHander.UnRegist(0xD417, S2C_GetWingData); MsgHander.UnRegist(0xD420, S2C_GetWingUpData); MsgHander.UnRegist(0xD443, S2C_GetWingState); wingDic.Clear(); curWingID = 0; curUseWingInfo = null; needShowWingInfo = null; needShowMountInfo = null; needShowPetInfo = null; modelType = ModelType.NONE; isNotShowTrialWingModel = false; }
private void OnWingInfoPush(short state, WingInfoPush msg = null) { if (state != 0) { StateManager.Instance.StateShow(state, 0); return; } WingManager.firstGetWingDetail = msg.firstGetWingDetail; using (List <WingInfo> .Enumerator enumerator = msg.wingInfos.GetEnumerator()) { while (enumerator.MoveNext()) { WingInfo current = enumerator.get_Current(); WingManager.wingInfoDict.set_Item(current.cfgId, current); } } }
/// <summary> /// 切换翅膀 /// </summary> void OnChangeToggle(GameObject go) { for (int i = 0; i < listGame.Count; i++) { if (listGame[i] != null && listGame[i].GetComponent <UIToggle>().value) { //刷新激活界面 WingItemUI wingItemUI = listGame[i].GetComponent <WingItemUI>(); WingRef info = null; if (wingItemUI != null) { info = wingItemUI.Info; } if (info != null && WingDicton.ContainsKey(info.id)) { wingActive.SetWingActiveUI(WingDicton[info.id] as WingInfo); if (notActiveGo != null) { notActiveGo.SetActive(false); } if (ActiveGo != null) { ActiveGo.SetActive(true); } curWingInfo = WingDicton[info.id] as WingInfo; RefreshModel(activeWing); } //刷新未激活界面 else if (info != null) { wingNotActive.SetWingNotActiveUI(info); if (notActiveGo != null) { notActiveGo.SetActive(true); } if (ActiveGo != null) { ActiveGo.SetActive(false); } curWingInfo = new WingInfo(info); RefreshModel(notActiveWing); } } } }
/// <summary> /// 返回翅膀列表 /// </summary> /// <param name="_msg"></param> protected void S2C_GetWingData(Pt _msg) { pt_wing_list_info_d417 msg = _msg as pt_wing_list_info_d417; if (msg != null) { for (int i = 0; i < msg.wing_list.Count; i++) { wing_base_info data = msg.wing_list[i]; if (wingDic.ContainsKey((int)data.wing_id)) { WingInfo info = wingDic[(int)data.wing_id] as WingInfo; if (info != null) { info.Update(data); } } else { WingInfo info = new WingInfo(data); if (info.WingType != 2) { wingDic[info.WingId] = info; } if (info.WingState) { if (OnShowWingModel != null) { OnShowWingModel(info); } CurUseWingInfo = info; } } } SetWingRedPoint(); } //抛出升级后变化事件 if (OnWingAdd != null) { OnWingAdd(null); } }
/// <summary> /// 淬炼后刷新 /// </summary> void OnWingUpdate() { for (int i = 0; i < listGame.Count; i++) { if (listGame[i] != null && listGame[i].GetComponent <UIToggle>().value) { WingRef info = listGame[i].GetComponent <WingItemUI>().Info; if (info != null && WingDicton.ContainsKey(info.id)) { wingActive.SetWingActiveUI(WingDicton[info.id] as WingInfo); curWingInfo = WingDicton[info.id] as WingInfo; if (GameCenter.wingMng.isRefreshEffect) { GameCenter.wingMng.isRefreshEffect = false; RefreshModel(activeWing); } } } } }
/// <summary> /// 设置翅膀红点 /// </summary> public void SetWingRedPoint() { bool isRedPoint = false; if (wingDic.Count == 0) { WingRef data = ConfigMng.Instance.GetWingRef(1, 1); if (data != null) { WingInfo wingInfo = new WingInfo(data); if (wingInfo.WingActiveEnough) { isRedPoint = true; } else { isRedPoint = false; } } } else { foreach (WingInfo info in wingDic.Values) { if (info.WingConsumeEnough && info.WingLev < ConfigMng.Instance.GetWingMaxLev(info.WingId))//满级不显示红点 { isRedPoint = true; break; } else { isRedPoint = false; } } } GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.FAIRYFEATHER, isRedPoint); }
/// <summary> /// 翅膀穿戴返回协议 /// </summary> /// <param name="_msg"></param> public void S2C_GetWingState(Pt _msg) { pt_update_wing_state_d443 msg = _msg as pt_update_wing_state_d443; if (msg != null) { if (wingDic.ContainsKey(msg.wing_id)) { WingInfo info = wingDic[msg.wing_id] as WingInfo; info.Update(msg); if (info.WingState) { CurUseWingInfo = info; } else { CurUseWingInfo = null; } } else { WingInfo info = new WingInfo(ConfigMng.Instance.GetWingRef(msg.wing_id, 1)); if (msg.state == 1) { CurUseWingInfo = info; } else { CurUseWingInfo = null; } } } if (OnWingUpdate != null) { OnWingUpdate(); } }
/// <summary> /// 翅膀升级后返回协议 /// </summary> protected void S2C_GetWingUpData(Pt _msg) { pt_update_wing_lev_d420 msg = _msg as pt_update_wing_lev_d420; if (msg != null) { if (wingDic.ContainsKey(msg.wing_id)) { WingInfo info = wingDic[msg.wing_id] as WingInfo; info.Update(msg); if (info.WingItemId != info.WingNextItemId) { curWingID = info.WingNextItemId; } if (info.WingItemId == curWingID) { isRefreshEffect = true; if (info.WingState) { CurUseWingInfo = info; } curWingID = 0; } } SetWingRedPoint(); } //抛出升级后变化事件 if (OnWingUpdate != null) { OnWingUpdate(); } if (OnGetWingChange != null) { OnGetWingChange(); } }
/// <summary> /// 关闭窗口延时2秒 /// </summary> void CloseWnd() { if (okBtn != null) { UIEventListener.Get(okBtn.gameObject).onClick = delegate { GameCenter.uIMng.ReleaseGUI(GUIType.SHOWMODELUI); } } ; } /// <summary> /// 试用翅膀模型 /// </summary> void ShowTrialWingModel() { if (GameCenter.wingMng.isNotShowTrialWingModel) { return; } if (GameCenter.wingMng.WingDic.Count != 0) { GameCenter.uIMng.ReleaseGUI(GUIType.SHOWMODELUI); GameCenter.uIMng.SwitchToUI(GUIType.NONE); return; } if (attGo != null) { attGo.SetActive(true); } GameCenter.wingMng.C2S_RequestChangeWing(WingRef.id, true); if (nameLabel != null) { nameLabel.text = "[b]" + WingRef.name; } for (int i = 0; i < attriLabel.Count; i++) { AttributeTypeRef attributeRef = ConfigMng.Instance.GetAttributeTypeRef((ActorPropertyTag)Enum.ToObject(typeof(ActorPropertyTag), WingRef.property_list[i].eid)); if (attriLabel[i] != null) { attriLabel[i].text = attributeRef == null ? string.Empty : attributeRef.stats; } if (attriNum[i] != null) { attriNum[i].text = WingRef.property_list[i].count.ToString(); } } if (modelTex != null) { GameCenter.previewManager.TryPreviewSingleEquipment(new EquipmentInfo(WingRef.itemui, EquipmentBelongTo.PREVIEW), modelTex); } //展示翅膀模型的时候直接开启一次固定的锁屏引导 //Debug.Log("展示翅膀模型开启引导"); //Debug.Log("当前玩家的Vip等级:"+ GameCenter.vipMng.VipData.vLev); if (GameCenter.vipMng.VipData.vLev < 1) { Invoke("DelayShow", 2.0f); } } /// <summary> /// 展示模型 /// </summary> void ShowModel() { switch (GameCenter.wingMng.modelType) { case ModelType.WING: WingInfo _wingInfo = GameCenter.wingMng.needShowWingInfo; if (_wingInfo != null) //刷新通用翅膀模型 { GameCenter.previewManager.TryPreviewSingleEquipment(new EquipmentInfo(_wingInfo.refData.itemui, EquipmentBelongTo.PREVIEW), modelTex); if (nameLabel != null) { nameLabel.text = "[b]" + _wingInfo.WingName; } } break; case ModelType.ILLUSION: case ModelType.MOUNT: MountInfo _mountInfo = GameCenter.wingMng.needShowMountInfo; if (_mountInfo != null) { GameCenter.previewManager.TryPreviewSingelMount(_mountInfo, modelTex); if (nameLabel != null) { nameLabel.text = "[b]" + _mountInfo.MountName; } } break; case ModelType.PET: MercenaryInfo _petInfo = GameCenter.wingMng.needShowPetInfo; if (_petInfo != null) { GameCenter.previewManager.TryPreviewSingelEntourage(_petInfo, modelTex); if (nameLabel != null) { nameLabel.text = "[b]" + _petInfo.PetName; } } break; } } /// <summary> /// 延迟翅膀引导 /// </summary> void DelayShow() { GameCenter.noviceGuideMng.OpenGuide(100041, 1); } }
public void SetWingActiveUI(WingInfo _data) { data = _data; wingHaveSkillLev = ConfigMng.Instance.GetWingHaveSkillLev(data.WingId); maxWingLev = ConfigMng.Instance.GetWingMaxLev(data.WingId); if (nameLabel != null) { nameLabel.text = data.WingName; } if (levLabel != null) { levLabel.text = data.WingLev.ToString(); } for (int i = 0; i < attributeName.Count; i++) { if (attributeName[i] != null) { attributeName[i].text = data.WingAttributeName[i] + ":"; } if (attributeNum[i] != null) { attributeNum[i].text = data.WingAttributeNum[i]; } if (nextAttributeNum[i] != null) { nextAttributeNum[i].text = data.WingNextAttributeNum[i]; } } //技能图片 if (skillIcon != null) { skillIcon.spriteName = data.WingSkillIcon; } if (skillUIDes != null) { skillUIDes.text = data.WingUIDes; } if (data.WingLev < wingHaveSkillLev) { if (skillDes != null) { skillDes.text = data.WingSkillNotActiveDes; } if (skillIcon != null) { skillIcon.IsGray = UISpriteEx.ColorGray.Gray; } } else { //根据技能ID去显示技能描述 SkillLvDataRef skill = ConfigMng.Instance.GetSkillLvDataRef(data.skillId, data.skillLev); //技能描述值(所有翅膀第一个值都读skillLarge这个字段;第一个翅膀第二个值读powerOne,第二个翅膀第二个值powerOne/100,第三个翅膀第二个值powerOne/100,第四个翅膀第二个值powerTwo,第五个翅膀第二个值powerOne/100,第六个翅膀写死的) if (skill != null && skillDes != null) { skillDes.text = UIUtil.Str2Str(data.WingSkillDes, new string[2] { "[00ff00]" + data.skillLarge / 100 + "[-]", data.WingId != 4 ? "[00ff00]" + (data.WingId != 1 ? skill.powerOne / 100 : skill.powerOne) + "[-]" : "[00ff00]" + skill.powerTwo + "[-]" }); } if (skillIcon != null) { skillIcon.IsGray = UISpriteEx.ColorGray.normal; } } if (data.WingLev == maxWingLev) { if (expLabel != null) { expLabel.text = data.WingNeedExp + "/" + data.WingNeedExp; } if (expSlider != null) { expSlider.value = 1; } } else { if (expLabel != null) { expLabel.text = data.WingExp + "/" + data.WingNeedExp; } if (expSlider != null) { expSlider.value = (float)data.WingExp / data.WingNeedExp; } } //消耗材料 if (consumeName != null) { consumeName.text = "[u][b]" + data.WingPromoteName[0]; } num = GameCenter.inventoryMng.GetNumberByType(data.WingPromoteList[0].eid); if (data.WingPromoteNum.Count != 0 && data.WingPromoteNum[0] > num) { if (needConsume != null) { needConsume.text = "[b]" + data.WingPromoteNum[0] + "/[ff0000]" + num; } } else { if (needConsume != null) { needConsume.text = data.WingPromoteNum[0] + "/[ffffff]" + num; } } //绑铜 goldNum = GameCenter.mainPlayerMng.MainPlayerInfo.TotalCoinCount; if (data.WingPromoteNum.Count != 0 && (ulong)data.WingPromoteNum[1] > goldNum) { if (needConsumGold != null) { needConsumGold.text = "[b]" + data.WingPromoteNum[1] + "/[ff0000]" + goldNum; } } else { if (needConsumGold != null) { needConsumGold.text = data.WingPromoteNum[1] + "/[ffffff]" + goldNum; } } //消耗元宝 if (consumeAcer != null) { if ((ulong)data.ConsumeYb > GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount) { consumeAcer.text = data.ConsumeYb + "/[ff0000]" + GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount.ToString(); } else { consumeAcer.text = data.ConsumeYb + "/[ffffff]" + GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount.ToString(); } } //穿戴脱下按钮 if (!data.WingState) { if (selectSkill != null) { selectSkill.gameObject.SetActive(false); } if (equBtn != null) { equBtn.gameObject.SetActive(true); } if (unlodBtn != null) { unlodBtn.gameObject.SetActive(false); } } else if (data.WingState) { if (selectSkill != null) { selectSkill.gameObject.SetActive(false); } if (equBtn != null) { equBtn.gameObject.SetActive(false); } if (unlodBtn != null) { unlodBtn.gameObject.SetActive(true); } if (data.WingLev >= wingHaveSkillLev) { selectSkill.gameObject.SetActive(true); } } //进度条 if (progressBar != null) { progressBar.value = data.CurTotalExp; } //翅膀等阶item for (int i = 0; i < wingItem.Length; i++) { wingItem[i].FillInfo(new EquipmentInfo(data.WingItemList[i], EquipmentBelongTo.PREVIEW)); if (data.WingLev < data.AllWingItemLev[1]) { if (wingIcon[0] != null) { wingIcon[0].IsGray = UISpriteEx.ColorGray.normal; } if (wingIcon[1] != null) { wingIcon[1].IsGray = UISpriteEx.ColorGray.Gray; } if (wingIcon[2] != null) { wingIcon[2].IsGray = UISpriteEx.ColorGray.Gray; } } else if (data.WingLev >= data.AllWingItemLev[1] && data.WingLev < data.AllWingItemLev[2]) { if (wingIcon[1] != null) { wingIcon[1].IsGray = UISpriteEx.ColorGray.normal; } if (wingIcon[2] != null) { wingIcon[2].IsGray = UISpriteEx.ColorGray.Gray; } } else if (data.WingLev >= data.AllWingItemLev[2]) { if (wingIcon[1] != null) { wingIcon[1].IsGray = UISpriteEx.ColorGray.normal; } if (wingIcon[2] != null) { wingIcon[2].IsGray = UISpriteEx.ColorGray.normal; } } } }