public static long getAllGemAttrValue() { long num = 0L; List <int> list = new List <int>(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 4; j++) { if (GemManager.Instance.equipSlots.GetLength(0) >= i) { if (GemManager.Instance.equipSlots.GetLength(1) >= j) { GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[i, j]; if (gemEmbedInfo != null && gemEmbedInfo.typeId > 0) { list.Add(gemEmbedInfo.typeId); } } } } } for (int k = 0; k < list.get_Count(); k++) { int itemId = list.get_Item(k); List <int> attrs = GemGlobal.GetAttrs(itemId); List <int> values = GemGlobal.GetValues(itemId); num += EquipGlobal.CalculateFightingByIDAndValue(attrs, values); } return(num); }
private void NoticeGemBaseInfoNty(short state, GemBaseInfoNty msg = null) { if (state != 0) { StateManager.Instance.StateShow(state, 0); return; } if (msg != null) { List <GemEmbedInfo>[] array = new List <GemEmbedInfo> [msg.gemPartInfos.get_Count()]; for (int i = 0; i < msg.gemPartInfos.get_Count(); i++) { array[i] = msg.gemPartInfos.get_Item(i).gemEmbedInfo; } for (int j = 0; j < 10; j++) { if (j >= array.Length) { break; } List <GemEmbedInfo> list = array[j]; for (int k = 0; k < list.get_Count(); k++) { GemEmbedInfo gemEmbedInfo = list.get_Item(k); int num = gemEmbedInfo.hole - 1; this.equipSlots[j, num] = gemEmbedInfo; } } this.CheckCanShowWearingGemPromoteWay(); } }
public static int GetAllGemLv() { int num = 0; List <int> list = new List <int>(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 4; j++) { if (GemManager.Instance.equipSlots.GetLength(0) >= i) { if (GemManager.Instance.equipSlots.GetLength(1) >= j) { GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[i, j]; if (gemEmbedInfo != null && gemEmbedInfo.typeId > 0) { if (DataReader <BaoShiShengJi> .Contains(gemEmbedInfo.typeId)) { BaoShiShengJi baoShiShengJi = DataReader <BaoShiShengJi> .Get(gemEmbedInfo.typeId); num += baoShiShengJi.lv; } } } } } } return(num); }
private void UpdateEmbedGemList() { this.equipGemListPool.Clear(); EquipSimpleInfo wearingEquipSimpleInfoByPos = EquipGlobal.GetWearingEquipSimpleInfoByPos(this.EquipPos); if (wearingEquipSimpleInfoByPos != null) { List <int> gemTypeIdList = new List <int>(); for (int i = 0; i < 4; i++) { GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[this.EquipPos - EquipLibType.ELT.Weapon, i]; if (gemEmbedInfo != null && gemEmbedInfo.typeId > 0) { gemTypeIdList.Add(gemEmbedInfo.typeId); } } this.equipGemListPool.Create(gemTypeIdList.get_Count(), delegate(int index) { if (index < gemTypeIdList.get_Count() && index < this.equipGemListPool.Items.get_Count()) { RewardItem component = this.equipGemListPool.Items.get_Item(index).GetComponent <RewardItem>(); component.SetRewardItem(gemTypeIdList.get_Item(index), -1L, 0L); } }); } }
private void RecvGemSysEmbedRes(short state, GemSysEmbedRes msg = null) { if (state != 0) { StateManager.Instance.StateShow(state, 0); return; } if (msg != null) { EquipLibType.ELT type = msg.type; int hole = msg.hole; long newGemId = msg.newGemId; int newGemTypeId = msg.newGemTypeId; GemEmbedInfo gemEmbedInfo = this.equipSlots[type - EquipLibType.ELT.Weapon, hole - 1]; gemEmbedInfo.id = newGemId; gemEmbedInfo.typeId = newGemTypeId; GemUI gemUI = UIManagerControl.Instance.GetUIIfExist("GemUI") as GemUI; if (gemUI != null) { gemUI.RefreshEquipSlot(msg.hole - 1, newGemTypeId); } GemSelectUI gemSelectUI = UIManagerControl.Instance.GetUIIfExist("GemSelectUI") as GemSelectUI; if (gemSelectUI != null) { gemSelectUI.Show(false); } EventDispatcher.Broadcast <int>(EventNames.UpdateEquipPosGemData, (int)msg.type); EventDispatcher.Broadcast(EventNames.EquipDetailedShouldCheckBadge); this.CheckCanShowWearingGemPromoteWay(); } }
private void SetGemButton(int typeId) { Transform transform = base.FindTransform("btnComposeOne"); Transform transform2 = base.FindTransform("btnComposeAll"); transform.Find("texBest").get_gameObject().SetActive(true); transform.Find("texBest").GetComponent <Text>().set_text(GemGlobal.GetComposeGemTip(typeId)); if (GemGlobal.IsCanCompose(typeId)) { SpriteRenderer iconSprite = ResourceManager.GetIconSprite("button_yellow_1"); transform.GetComponent <ButtonCustom>().set_enabled(true); ResourceManager.SetSprite(transform.GetComponent <Image>(), iconSprite); transform2.GetComponent <ButtonCustom>().set_enabled(true); ResourceManager.SetSprite(transform2.GetComponent <Image>(), iconSprite); } else { SpriteRenderer iconSprite2 = ResourceManager.GetIconSprite("button_gray_1"); transform.GetComponent <ButtonCustom>().set_enabled(false); ResourceManager.SetSprite(transform.GetComponent <Image>(), iconSprite2); transform2.GetComponent <ButtonCustom>().set_enabled(false); ResourceManager.SetSprite(transform2.GetComponent <Image>(), iconSprite2); } Transform transform3 = base.FindTransform("btnWear"); GemEmbedInfo gemInfo = GemGlobal.GetGemInfo((EquipLibType.ELT) this.currEquip, this.currSlot); BaoShiShengJi baoShiShengJi = DataReader <BaoShiShengJi> .Get(this.currTypeId); }
private List <MaterialGem> GetLowerGems(int currSlot, int typeId) { List <MaterialGem> list = new List <MaterialGem>(); for (int needId = GemGlobal.GetNeedId(typeId); needId != 0; needId = GemGlobal.GetNeedId(needId)) { List <Goods> list2 = BackpackManager.Instance.OnGetGood(needId); using (List <Goods> .Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { Goods current = enumerator.get_Current(); list.Add(new MaterialGem { typeId = needId, gemId = current.GetLongId(), count = current.GetCount() }); } } } list.Reverse(); GemEmbedInfo equipSlot = this.GetEquipSlot(currSlot); if (equipSlot.typeId != 0) { list.Add(new MaterialGem { typeId = equipSlot.typeId, gemId = equipSlot.id, count = 1 }); } return(list); }
public static List <MaterialGem> GetOneKeyComposeGems(EquipLibType.ELT equipNum, int slotNum, int nextTypeId) { List <MaterialGem> list = new List <MaterialGem>(); int value = GemGlobal.GetValue(nextTypeId); int num = 0; GemEmbedInfo gemEmbedInfo = GemGlobal.GetGemInfo(equipNum, slotNum); for (int needId = GemGlobal.GetNeedId(nextTypeId); needId != 0; needId = GemGlobal.GetNeedId(needId)) { if (gemEmbedInfo != null && gemEmbedInfo.typeId == needId) { list.Add(new MaterialGem { typeId = gemEmbedInfo.typeId, gemId = gemEmbedInfo.id, count = 1 }); num += GemGlobal.GetValue(needId); if (num == value) { return(list); } gemEmbedInfo = null; } List <Goods> list2 = BackpackManager.Instance.OnGetGood(needId); for (int i = 0; i < list2.get_Count(); i++) { Goods goods = list2.get_Item(i); int num2 = 0; for (int j = 0; j < goods.GetCount(); j++) { num2++; num += GemGlobal.GetValue(needId); if (num == value) { list.Add(new MaterialGem { typeId = needId, gemId = goods.GetLongId(), count = num2 }); return(list); } } list.Add(new MaterialGem { typeId = needId, gemId = goods.GetLongId(), count = goods.GetCount() }); } } return(null); }
public static bool IsCanWearGem(int equipNum, int slotNum, int currTypeId = 0) { List <Goods> runeGoods = BackpackManager.Instance.RuneGoods; if (runeGoods.get_Count() <= 0) { return(false); } for (int i = 0; i < runeGoods.get_Count(); i++) { int itemId = runeGoods.get_Item(i).GetItemId(); BaoShiShengJi gemItemCfg = DataReader <BaoShiShengJi> .Get(itemId); if (gemItemCfg != null) { if (GemManager.Instance.equipSlots.GetLength(0) >= equipNum) { if (GemManager.Instance.equipSlots.GetLength(1) > slotNum) { GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[equipNum - 1, slotNum]; if (gemEmbedInfo != null) { BaoShiKongPeiZhi baoShiKongPeiZhi = DataReader <BaoShiKongPeiZhi> .DataList.Find((BaoShiKongPeiZhi a) => a.position == equipNum && a.slotOpen == slotNum + 1); if (baoShiKongPeiZhi != null) { if (baoShiKongPeiZhi.gemType.Find((int e) => e == gemItemCfg.type) > 0) { if (gemEmbedInfo.typeId <= 0) { return(true); } BaoShiShengJi baoShiShengJi = DataReader <BaoShiShengJi> .Get(gemEmbedInfo.typeId); if (baoShiShengJi != null) { if (baoShiShengJi.type == gemItemCfg.type && baoShiShengJi.id < gemItemCfg.id) { return(true); } } } } } } } } } return(false); }
private void SetEquipSlot() { for (int i = 0; i < 4; i++) { GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[this.equipCurr - EquipLibType.ELT.Weapon, i]; if (gemEmbedInfo != null) { this.SetOneEquipSlot(i, gemEmbedInfo.typeId); } else { this.SetOneEquipSlot(i, -1); } this.PlaySpineUnlockFx(i); } }
public void CheckBadge() { for (int i = 0; i < 4; i++) { Transform transform = this.btnEquipSlots[i].get_transform(); GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[this.equipCurr - EquipLibType.ELT.Weapon, i]; Image component = transform.FindChild("notice").GetComponent <Image>(); component.get_gameObject().SetActive(false); if (gemEmbedInfo != null) { bool flag = GemGlobal.IsCanWearGem((int)this.equipCurr, i, gemEmbedInfo.typeId); if (flag) { component.get_gameObject().SetActive(true); } } } }
public static bool CheckCanShowTip(int pos) { List <Goods> runeGoods = BackpackManager.Instance.RuneGoods; if (runeGoods == null) { return(false); } if (runeGoods.get_Count() <= 0) { return(false); } for (int i = 0; i < runeGoods.get_Count(); i++) { int itemId = runeGoods.get_Item(i).GetItemId(); BaoShiShengJi gemItemCfg = DataReader <BaoShiShengJi> .Get(itemId); if (gemItemCfg != null) { int j; for (j = 0; j < 4; j++) { GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[pos - 1, j]; if (gemEmbedInfo != null) { BaoShiKongPeiZhi baoShiKongPeiZhi = DataReader <BaoShiKongPeiZhi> .DataList.Find((BaoShiKongPeiZhi a) => a.position == pos && a.slotOpen == j + 1); if (baoShiKongPeiZhi != null) { if (baoShiKongPeiZhi.gemType.Find((int e) => e == gemItemCfg.type) > 0) { if (gemEmbedInfo.typeId <= 0) { return(true); } } } } } } } return(false); }
private static bool CheckGemSlotHasSameType(int pos, int type) { for (int i = 0; i < 4; i++) { GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[pos - 1, i]; if (gemEmbedInfo != null) { BaoShiShengJi baoShiShengJi = DataReader <BaoShiShengJi> .Get(gemEmbedInfo.typeId); if (baoShiShengJi != null) { if (baoShiShengJi.type == type) { return(true); } } } } return(false); }
public static List <int> GetAlreadyUsedGemTypes(EquipLibType.ELT equipNum, int slotNum) { int num = equipNum - EquipLibType.ELT.Weapon; int num2 = slotNum - 1; List <int> list = new List <int>(); for (int i = 0; i < 4; i++) { if (i != num2) { GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[num, i]; if (gemEmbedInfo != null && gemEmbedInfo.typeId != 0) { int type = GemGlobal.GetBSSJ(gemEmbedInfo.typeId).type; list.Add(type); } } } return(list); }
public static bool IsCanCompose(EquipLibType.ELT equipNum, int slotNum) { GemEmbedInfo gemInfo = GemGlobal.GetGemInfo(equipNum, slotNum); return(gemInfo != null && GemGlobal.IsCanCompose((int)equipNum, slotNum, gemInfo.typeId)); }
private int GetCurrTypeId(int slotNum) { GemEmbedInfo equipSlot = this.GetEquipSlot(slotNum); return((equipSlot == null) ? -1 : equipSlot.typeId); }