public bool CheckMaterialById(int id) { if (this.mTypeLevelDict == null || this.mGodList == null) { return(false); } GodWeaponInfo godWeaponInfo = this.mGodList.Find((GodWeaponInfo e) => e.Type == id); if (godWeaponInfo == null) { return(false); } if (!this.mTypeLevelDict.ContainsKey(godWeaponInfo.Type) || this.mTypeLevelDict.get_Item(godWeaponInfo.Type).get_Count() <= godWeaponInfo.gLevel) { return(false); } SShenBingPeiZhi sShenBingPeiZhi = DataReader <SShenBingPeiZhi> .Get(id); if (sShenBingPeiZhi == null) { return(false); } for (int i = 0; i < sShenBingPeiZhi.material.get_Count(); i++) { if (BackpackManager.Instance.OnGetGoodCount(sShenBingPeiZhi.material.get_Item(i)) > 0L) { return(true); } } return(false); }
private void RefreshMaterial(GodWeaponInfo info, bool isSwitch) { this.mSelectData = DataReader <SShenBingPeiZhi> .Get(this.mCurGodType); if (this.mSelectData != null) { if (isSwitch) { this.OnClickItem(null); this.ClearItem(); int itemId; for (int i = 0; i < this.mSelectData.material.get_Count(); i++) { itemId = this.mSelectData.material.get_Item(i); long num = BackpackManager.Instance.OnGetGoodCount(itemId); if (this.mLastSelectItem == null && num > 0L) { this.OnClickItem(this.CreateItem(itemId, num)); } else { this.CreateItem(itemId, num); } } if (this.mLastSelectItem == null) { this.OnClickItem(this.mItemList.get_Item(0)); } } else if (this.mLastSelectItem != null) { long num = BackpackManager.Instance.OnGetGoodCount(this.mLastSelectItem.ItemId); this.mLastSelectItem.Number = num.ToString(); if (num <= 0L) { int itemId; for (int j = 0; j < this.mSelectData.material.get_Count(); j++) { itemId = this.mSelectData.material.get_Item(j); if (BackpackManager.Instance.OnGetGoodCount(itemId) > 0L) { this.OnClickItem(this.mItemList.Find((GodSoldierItem e) => e.ItemId == itemId)); break; } } } } } }
private void CreateToggle(GodWeaponInfo data) { SShenBingPeiZhi sShenBingPeiZhi = DataReader <SShenBingPeiZhi> .Get(data.Type); if (sShenBingPeiZhi != null) { GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab("GodSoldierToggle"); UGUITools.SetParent(this.mToggleGrid, instantiate2Prefab, false); instantiate2Prefab.set_name(sShenBingPeiZhi.id.ToString()); instantiate2Prefab.SetActive(true); GodSoldierToggle component = instantiate2Prefab.GetComponent <GodSoldierToggle>(); component.SetData(data, GameDataUtils.GetChineseContent(sShenBingPeiZhi.name, false)); component.EventHandler = new Action <GodSoldierToggle>(this.OnClickMenu); this.mToggleList.Add(component); } }