public static void Show(ItemDataEx data, GUIMultiUsePopUp.UseItemCallBack cb) { if (data == null || data.GetCount() <= 0) { return; } GameUIPopupManager.GetInstance().PushState(GameUIPopupManager.eSTATE.GUIMultiUsePopUp, false, null, null); GameUIPopupManager.GetInstance().GetCurrentPopup().InitPopUp(data, cb); }
public int SortByQuality(ItemDataEx aItem, ItemDataEx bItem) { if (aItem == null || bItem == null) { return 0; } if (aItem.Info.Quality > bItem.Info.Quality) { return -1; } if (aItem.Info.Quality < bItem.Info.Quality) { return 1; } if (aItem.Info.SubQuality > bItem.Info.SubQuality) { return -1; } if (aItem.Info.SubQuality < bItem.Info.SubQuality) { return 1; } if (aItem.GetCount() > bItem.GetCount()) { return -1; } if (aItem.GetCount() < bItem.GetCount()) { return 1; } if (aItem.Info.ID < bItem.Info.ID) { return -1; } if (aItem.Info.ID > bItem.Info.ID) { return 1; } return 0; }
public void AddExp(ItemDataEx data, bool refine = false) { if (data == null && refine) { this.Refine(); return; } this.mCurExpItem = data; this.count++; this.exp += data.Info.Value1; this.PlayUISliderEffect(data.Info.Value1); if (refine || this.exp >= this.mBaseScene.mEquipData.GetEquipRefineExp2Upgrade() || data.GetCount() <= this.count) { this.Refine(); } }
public static void Show(ItemDataEx data, GUIMultiUsePopUp.UseItemCallBack cb) { if (data == null || data.GetCount() <= 0) { return; } if (data.Info.Type != 2 || data.Info.SubType != 7) { global::Debug.LogErrorFormat("Data info type or subtype error , type : {0} , subtype : {1} ", new object[] { data.Info.Type, data.Info.SubType }); return; } if (GUISelectBoxPopUp.mInstance == null) { GUISelectBoxPopUp.CreateInstance(); } GUISelectBoxPopUp.mInstance.Init(data, cb); }
public override void InitPopUp(ItemDataEx data, GUIMultiUsePopUp.UseItemCallBack cb) { if (data == null || data.GetCount() < 0) { return; } this.mData = data; this.UseItemEvent = cb; this.mIcon.Refresh(this.mData.Info, false, false, false); this.mName.text = this.mData.Info.Name; this.mName.color = Tools.GetItemQualityColor(this.mData.Info.Quality); this.mNum.text = this.mData.GetCount().ToString(); this.mSliderInput.SetValue(1f); this.mSliderInput.Max = this.mData.GetCount(); switch (this.mData.Info.Type) { case 2: { this.mTitle.text = Singleton<StringManager>.Instance.GetString("useitem"); this.mUseLabel.text = Singleton<StringManager>.Instance.GetString("useitem"); this.mTipsValue.transform.parent.gameObject.SetActive(false); ESubTypeConsumable subType = (ESubTypeConsumable)this.mData.Info.SubType; if (subType == ESubTypeConsumable.EConsumable_TrinketExpBox) { if (this.mSliderInput.Max > 5) { this.mSliderInput.Max = 5; } } break; } case 5: this.mTitle.text = Singleton<StringManager>.Instance.GetString("PetFurther3") + Singleton<StringManager>.Instance.GetString("itemLb"); this.mUseLabel.text = Singleton<StringManager>.Instance.GetString("PetFurther3"); this.mTipsIcon.spriteName = Tools.GetRewardTypeIcon(ERewardType.EReward_StarSoul); break; } this.RefreshTips(); }
public void UseItem(ItemDataEx data) { if (data.Info.Type == 2) { switch (data.Info.SubType) { case 3: case 5: this.UseItem(data, 1); return; case 7: GUISelectBoxPopUp.Show(data, new GUIMultiUsePopUp.UseItemCallBack(this.UseItem)); return; } } if (data.GetCount() > 1 || (data.Info.Type == 5 && data.Info.Quality >= 2)) { GUIMultiUsePopUp.Show(data, new GUIMultiUsePopUp.UseItemCallBack(this.UseItem)); } else { this.UseItem(data, 1); } }
public void Init(ItemDataEx data, GUIMultiUsePopUp.UseItemCallBack cb) { if (data == null || data.GetCount() < 0) { return; } this.mData = data; this.UseItemEvent = cb; List<int> list = new List<int>(); if (data.Info.Value1 != 0) { list.Add(data.Info.Value1); } if (data.Info.Value2 != 0) { list.Add(data.Info.Value2); } if (data.Info.Value3 != 0) { list.Add(data.Info.Value3); } if (data.Info.Value4 != 0) { list.Add(data.Info.Value4); } if (list.Count <= 1 || list.Count > 4) { global::Debug.LogErrorFormat("selectbox itemIDs count error , count : {0} , InfoID : {1} ", new object[] { list.Count, data.Info.ID }); this.Close(); return; } Transform transform = GameUITools.FindGameObject("Items", this.mWindow).transform; for (int i = 0; i < transform.childCount; i++) { this.mItems.Add(transform.GetChild(i).gameObject.AddComponent<GUISelectBoxPopUp.SelectItem>()); } if (this.mItems.Count <= 1 || this.mItems.Count > 4) { global::Debug.LogErrorFormat("selectbox items count error , count : {0}", new object[] { this.mItems.Count }); this.Close(); return; } switch (list.Count) { case 2: this.mItems[0].SetPos(-58); this.mItems[1].SetPos(58); break; case 3: this.mItems[0].SetPos(-130); this.mItems[1].SetPos(0); this.mItems[2].SetPos(130); break; case 4: this.mItems[0].SetPos(-168); this.mItems[1].SetPos(-58); this.mItems[2].SetPos(58); this.mItems[3].SetPos(168); break; } int j = 0; while (j < list.Count && j < this.mItems.Count && j < 4) { this.mItems[j].Init(this, list[j], j); j++; } while (j < this.mItems.Count) { this.mItems[j].gameObject.SetActive(false); j++; } GameUITools.PlayOpenWindowAnim(this.mWindow.transform, null, true); }