/// <summary> /// 获得可用物品时,创建提示 /// </summary> void CreateEquipTip(EquipmentInfo _info) { if (GameCenter.openServerRewardMng.isRotate) { return; } if (GameCenter.uIMng.CurOpenType == GUIType.SPRITEANIMAL)//使用宠物蛋融合的时候不提示 { if (_info.ActionType == EquipActionType.activate_animal) { return; } } if (prefab == null) { prefab = exResources.GetResource(ResourceType.GUI, "mainUI/Main_ItemTips") as GameObject; } if (prefab == null) { Debug.Log("找不到相关预制!"); return; } MainPlayerInfo info = GameCenter.mainPlayerMng.MainPlayerInfo; if (_info.OldSort >= 1 && _info.OldSort <= 12) { isEquip = _info.IsBetterSlot(_info); } else { isEquip = true; } if (_info.AttentionType == GoodsAttentionType.YES && (_info.NeedProf == info.Prof || _info.NeedProf == 0) && _info.UseReqLevel <= info.CurLevel && isEquip) { depath++; GameObject go = Instantiate(prefab) as GameObject; go.transform.parent = this.gameObject.transform; go.transform.localPosition = prefab.transform.localPosition; go.transform.localScale = Vector3.one; UIPanel uiPanel = go.GetComponent <UIPanel>(); if (uiPanel != null) { uiPanel.depth = depath; } go.SetActive(true); equipTipList.Add(go); EquipTipUI equipTipUI = go.GetComponent <EquipTipUI>(); if (equipTipUI != null) { equipTipUI.SetEquipTipInfo(_info, depath, equipTipList); } if (!EquipTip.Contains(_info)) { EquipTip.Add(_info); } CancelInvoke("HideEquipTip"); Invoke("HideEquipTip", 30.0f); } prefab = null; }
protected void Refresh() { if (this == null) { return; } if (equipmentInfo == null) { CleanData(); RefreshNewState(); return; } if (equipmentInfo.CurEmptyType != EquipmentInfo.EmptyType.NONE) { switch (equipmentInfo.CurEmptyType) { case EquipmentInfo.EmptyType.EMPTY: FillEmptyItem(); return; case EquipmentInfo.EmptyType.LOCK: FillLockItem(); return; case EquipmentInfo.EmptyType.CANUNLOCK: FillCanUnLockItem(); return; case EquipmentInfo.EmptyType.CDLOCK: FillCdItem(); return; } } else { if (lockEmptyItem != null) { lockEmptyItem.SetActive(false); } if (canUnlockItem != null) { canUnlockItem.SetActive(false); } if (lockCdItem != null) { lockCdItem.SetActive(false); } } //加上物品命名,新手引导需要用到,之前是UIItemWidget_+Icon 避免配置的修改 by邓成 if (this != null && gameObject != null) { gameObject.name = new System.Text.StringBuilder().Append("UIItemWidget_").Append(equipmentInfo.IconName).ToString(); } if (itemIcon != null) { itemIcon.spriteName = equipmentInfo.IconName; itemIcon.gameObject.SetActive(true); //itemIcon.IsGray = equipmentInfo.IsGray ? UISpriteEx.ColorGray.Gray : UISpriteEx.ColorGray.normal; } else { GameSys.LogError(ConfigMng.Instance.GetUItext(195)); } RefreshNewState(); RefreshCanUse(); //RefreshBetter(); RefreshNotBind(); ShowRedMask(); // 用于坐骑幻化显示 by 易睿 if (mountChange != null) { if (equipmentInfo.Family == EquipmentFamily.MOUNT) { mountChange.gameObject.SetActive(equipmentInfo.IsChangeMount); } else { mountChange.gameObject.SetActive(false); } } if (itemCount != null) { ////物品的可叠加数大于1,并且数量大于0时才显示数量标记 if ((equipmentInfo.StackMaxCount > 1 && equipmentInfo.StackCurCount > 0) || equipmentInfo.StackCurCount > 1) { itemCount.text = equipmentInfo.StackCurCount >= 100000 ? (equipmentInfo.StackCurCount / 10000).ToString() + "万" : equipmentInfo.StackCurCount.ToString(); itemCount.gameObject.SetActive(true); } else if (equipmentInfo.StackCurCount == 0 && showZeroCount) { itemCount.text = ""; itemCount.gameObject.SetActive(true); if (cantUse != null) { cantUse.SetActive(true); } } else { itemCount.text = string.Empty; itemCount.gameObject.SetActive(false); } } if (strengthenLv != null) { if (equipmentInfo.UpgradeLv > 0 && equipmentInfo.Family != EquipmentFamily.MOUNTEQUIP) { strengthenLv.text = "+" + equipmentInfo.UpgradeLv.ToString(); strengthenLv.gameObject.SetActive(true); } else { strengthenLv.text = string.Empty; strengthenLv.gameObject.SetActive(false); } } if (strengthPurpleFx != null && strengthOrangeFx != null) { strengthPurpleFx.SetActive(equipmentInfo.UpgradeLv >= 8 && equipmentInfo.Quality == 4); strengthOrangeFx.SetActive(equipmentInfo.UpgradeLv >= 8 && equipmentInfo.Quality == 5); } if (betterFlag != null) { if (equipmentInfo.Slot != EquipSlot.None && equipmentInfo.Family != EquipmentFamily.GEM && equipmentInfo.NeedProf == GameCenter.mainPlayerMng.MainPlayerInfo.Prof) { betterFlag.enabled = equipmentInfo.IsBetterSlot(equipmentInfo); } else { betterFlag.enabled = false; } } if (qualitybox != null) { qualitybox.enabled = equipmentInfo.QualityBox != string.Empty; qualitybox.color = equipmentInfo.ItemColor; } if (profMask != null) { bool profNo = equipmentInfo.IsEquip && !equipmentInfo.CheckClass(GameCenter.mainPlayerMng.MainPlayerInfo.Prof); bool levelNo = equipmentInfo.IsEquip && equipmentInfo.UseReqLevel > GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel; profMask.enabled = profNo || levelNo; } if (lightFlagEnable) //稀有道具获得时显示闪光效果 by邓成 { ShowLightFlag(); } if (gameObject.GetComponent <BoxCollider>() != null) { gameObject.GetComponent <BoxCollider>().enabled = true; } gameObject.SetActive(true); if (batchObj != null)//by黄洪兴 是否显示批量选中 { if (showBatch && equipmentInfo.CanSell) { batchObj.SetActive(true); } else { batchObj.SetActive(false); } } if (showUIType == ItemShowUIType.MARKETBAG) { if (equipmentInfo.IsBind) { if (cantUse != null) { cantUse.SetActive(true); } } } if (showUIType == ItemShowUIType.TRADEBAG) { if (tradeFlag != null && GameCenter.tradeMng != null) { tradeFlag.SetActive(GameCenter.tradeMng.IsInTradeBox(equipmentInfo.InstanceID)); } } if (luckyGo != null) { if (equipmentInfo.LuckyLv >= 1) { luckyGo.SetActive(true); luckyGo.GetComponentInChildren <UILabel>().text = equipmentInfo.LuckyLv.ToString(); } else { luckyGo.SetActive(false); } } ShowName(); ShowPutMat(); }