public void SetItemLevel(UpgradeType type, ItemFielInfo itemfileInfo) { string text = ""; EquiptSlotType place = (EquiptSlotType)itemfileInfo.sSyncContainerGoods_SC.nPlace; switch (type) { case UpgradeType.Strength: text = string.Format(LanguageTextManager.GetString("IDS_I3_85"), PlayerDataManager.Instance.GetEquipmentStrengthLevel(place)); text = UI.NGUIColor.SetTxtColor(text, TextColor.yellow); break; case UpgradeType.StarUp: int level = PlayerDataManager.Instance.GetEquipmentStarLevel(place); int temp = level - 1; int par = temp / 10; int star = (temp % 10) + 1; if (level > 0) { text = string.Format(LanguageTextManager.GetString(StarLeveNameDic[par]), star); } break; case UpgradeType.Upgrade: text = string.Format(LanguageTextManager.GetString("IDS_I3_86"), itemfileInfo.LocalItemData._AllowLevel); text = UI.NGUIColor.SetTxtColor(text, TextColor.yellow); break; } lable_Level.SetText(text); }
void Awake() { BsetItem = CreatObjectToNGUI.InstantiateObj(BesetItem_prafab, Item_point).GetComponent <JewelBset_ContainerItem>(); BsetItem.CanCancel = true; buttonCallBack.SetCallBackFuntion(obj => { SoundManager.Instance.PlaySoundEffect("Sound_Button_Stone_Click"); if (fielInfo != null) { EquiptSlotType place = (EquiptSlotType)int.Parse((fielInfo.LocalItemData as EquipmentData)._vectEquipLoc); List <JewelInfo> jewelInfo = PlayerDataManager.Instance.GetJewelInfo(place); if (_holeIndex == HoleIndex.FirstHole) { if (jewelInfo[0].JewelID != 0) { if (ContainerInfomanager.Instance.PackIsFull()) { MessageBox.Instance.ShowTips(3, LanguageTextManager.GetString("IDS_I9_20"), 1); } else { NetServiceManager.Instance.EquipStrengthenService.SendRequestGoodsOperateRemoveCommand(fielInfo.sSyncContainerGoods_SC.uidGoods, 1); } //JewelBesetManager.GetInstance().ShowRemoveJewel1Effect(); //JewelBesetManager.GetInstance().RemoveQueue.Enqueue(1); } else { //Debug.Log(place); JewelBesetManager.GetInstance().UpdateChoseJewelList_Beset(fielInfo, 1); JewelBesetManager.GetInstance().ChangeSubUistate(JewelState.JewelChose_Beset); } } else { if (jewelInfo[1].JewelID != 0) { if (ContainerInfomanager.Instance.PackIsFull()) { MessageBox.Instance.ShowTips(3, LanguageTextManager.GetString("IDS_I9_20"), 1); } else { NetServiceManager.Instance.EquipStrengthenService.SendRequestGoodsOperateRemoveCommand(fielInfo.sSyncContainerGoods_SC.uidGoods, 2); } //JewelBesetManager.GetInstance().ShowRemoveJewel2Effect(); //JewelBesetManager.GetInstance().RemoveQueue.Enqueue(2); } else { JewelBesetManager.GetInstance().UpdateChoseJewelList_Beset(fielInfo, 2); JewelBesetManager.GetInstance().ChangeSubUistate(JewelState.JewelChose_Beset); } } JewelBesetManager.GetInstance().DisableAllHoleButton(); } }); buttonCallBack.SetPressCallBack(OnButtonPress); }
public int GetEquipmentStarLevel(EquiptSlotType itemType) { //int normalStrengthenLv ; int starStrengthenLv = 0; switch (itemType) { case EquiptSlotType.Weapon: // normalStrengthenLv=PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STRENGTH_VALUE; starStrengthenLv = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_START_VALUE; break; case EquiptSlotType.Heard: // normalStrengthenLv=PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STRENGTH_VALUE; starStrengthenLv = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HAT_START_VALUE; break; case EquiptSlotType.Body: // normalStrengthenLv=PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STRENGTH_VALUE; starStrengthenLv = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_CLOTH_START_VALUE; break; case EquiptSlotType.Shoes: // normalStrengthenLv=PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STRENGTH_VALUE; starStrengthenLv = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_SHOES_START_VALUE; break; case EquiptSlotType.Accessories: starStrengthenLv = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_RING_START_VALUE; break; } return(starStrengthenLv); }
public List <JewelInfo> GetJewelInfo(EquiptSlotType itemType) { List <JewelInfo> infos = new List <JewelInfo>(); JewelInfo info1 = new JewelInfo(); JewelInfo info2 = new JewelInfo(); switch (itemType) { case EquiptSlotType.Weapon: info1.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STORE_ID1_VALUE; info1.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STORE_LEVEL1_VALUE; info1.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STORE_EXP1_VALUE; info2.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STORE_ID2_VALUE; info2.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STORE_LEVEL2_VALUE; info2.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_WEAPON_STORE_EXP2_VALUE;; break; case EquiptSlotType.Heard: info1.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HAT_STORE_ID1_VALUE; info1.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HAT_STORE_LEVEL1_VALUE; info1.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HAT_STORE_EXP1_VALUE; info2.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HAT_STORE_ID2_VALUE; info2.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HAT_STORE_LEVEL2_VALUE; info2.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HAT_STORE_EXP2_VALUE;; break; case EquiptSlotType.Body: info1.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_CLOTH_STORE_ID1_VALUE; info1.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_CLOTH_STORE_LEVEL1_VALUE; info1.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_CLOTH_STORE_EXP1_VALUE; info2.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_CLOTH_STORE_ID2_VALUE; info2.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_CLOTH_STORE_LEVEL2_VALUE; info2.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_CLOTH_STORE_EXP2_VALUE; break; case EquiptSlotType.Shoes: info1.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_SHOES_STORE_ID1_VALUE; info1.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_SHOES_STORE_LEVEL1_VALUE; info1.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_SHOES_STORE_EXP1_VALUE; info2.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_SHOES_STORE_ID2_VALUE; info2.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_SHOES_STORE_LEVEL2_VALUE; info2.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_SHOES_STORE_EXP2_VALUE; break; case EquiptSlotType.Accessories: info1.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_RING_STORE_ID1_VALUE; info1.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_RING_STORE_LEVEL1_VALUE; info1.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_RING_STORE_EXP1_VALUE; info2.JewelID = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_RING_STORE_ID2_VALUE; info2.JewelLevel = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_RING_STORE_LEVEL2_VALUE; info2.jewelExp = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_RING_STORE_EXP2_VALUE;; break; } infos.Add(info1); infos.Add(info2); return(infos); }
public static ItemFielInfo GetBestItemInPlace(EquiptSlotType itemType) { ItemFielInfo bestItem = null; int place = (int)itemType; List <ItemFielInfo> myPlaceItem = ContainerInfomanager.Instance.GetPackItemList().FindAll( P => P.LocalItemData._GoodsClass == 1 && P.LocalItemData._GoodsSubClass != 2 && int.Parse((P.LocalItemData as EquipmentData)._vectEquipLoc) == place); bestItem = ContainerInfomanager.Instance.GetEquiptItemList().FirstOrDefault(P => P.sSyncContainerGoods_SC.nPlace == place); for (int i = 0; i < myPlaceItem.Count; i++) { bestItem = GetTheBestItem(bestItem, myPlaceItem[i], itemType); } return(bestItem); }
void UpdateStatus() { if (IsLock) { PackLockCallBack = CreatObjectToNGUI.InstantiateObj(PackLockPrefab, transform).GetComponent <SingleButtonCallBack>(); PackLockCallBack.transform.localScale = new Vector3(1.05f, 0.85f, 1); PackLockCallBack.transform.localPosition = Vector3.zero; PackLockCallBack.SetCallBackFuntion(OnLockBtnClick); // 计算解锁的格数 int UnlockBox = (ContainerInfomanager.Instance.GetContainerClientContsext(2).wMaxSize / 4) - 4; int tackGold = GetActiveEnergyHaveGold(UnlockBox); PackLockCallBack.SetButtonText(tackGold.ToString()); // 引导注入代码 PackLockCallBack.gameObject.RegisterBtnMappingId(UIType.Package, BtnMapId_Sub.Package_PackUnLock); } else { List <ItemFielInfo> allPackItemList = MyParent.MyPackItemList; for (int i = MyIndex * 4, iMax = (MyIndex + 1) * 4; i < iMax; i++) { //ItemFielInfo currentItemFile = allPackItemList.FirstOrDefault(P=>P.sSyncContainerGoods_SC.nPlace == i);//按后台位置排序 ItemFielInfo currentItemFile = allPackItemList.Count > i? allPackItemList[i]: null; ItemFielInfo bestItem = null; EquiptSlotType myItemType = EquiptSlotType.Null; if (currentItemFile != null) { myItemType = getEquiptType(currentItemFile); } MyParent.BestItemList.TryGetValue(myItemType, out bestItem); bool isBestItem = bestItem != null && bestItem == currentItemFile; SinglePackItemSlot newItemSlot = CreatObjectToNGUI.InstantiateObj(SinglePackItemPrefab, transform).GetComponent <SinglePackItemSlot>(); newItemSlot.gameObject.transform.localScale = new Vector3(0.85f, 0.85f, 1); newItemSlot.transform.localPosition = new Vector3(-136 + 90 * (i - MyIndex * 4), 0, 0); newItemSlot.Init(currentItemFile, isBestItem, SinglePackItemSlot.ItemStatus.PackItem, MyParent.MyParent.OnItemClick); m_SingleItemList.Add(newItemSlot); //引导注入 if (currentItemFile != null) { newItemSlot.gameObject.RegisterBtnMappingId(currentItemFile.LocalItemData._goodID, UIType.Package, BtnMapId_Sub.Package_Cell , m_dragAmountSlerpAct, m_dragAmount); } } } }
/// <summary> /// Init the specified jewel and SkillLevel. /// </summary> /// <param name="jewel">Jewel.</param> /// <param name="SkillLevel">Skill level.</param> public void Init(ItemFielInfo itemFielInfo, bool isSuit) { ItemId = itemFielInfo.LocalItemData._goodID; jewel = ItemDataManager.Instance.GetItemData(ItemId) as Jewel; if (isSuit) { Title.SetText("套装属性"); skillId = jewel._activePassiveSkill.skillID; skillLevel = jewel._activePassiveSkill.skillLevel; } else { Title.SetText("器魂属性"); skillId = jewel.PassiveSkill; if (itemFielInfo.sSyncContainerGoods_SC.uidGoods != 0) { skillLevel = itemFielInfo.materiel.ESTORE_FIELD_LEVEL; } else { EquiptSlotType type = (EquiptSlotType)JewelBesetManager.GetInstance().Sc_Container.SelectItemFileInfo.sSyncContainerGoods_SC.nPlace; List <JewelInfo> jewelInfos = PlayerDataManager.Instance.GetJewelInfo(type); foreach (var item in jewelInfos) { if (item.JewelID == jewel._goodID) { skillLevel = item.JewelLevel; } } } } SkillLevel.SetText(string.Format(LanguageTextManager.GetString("IDS_I9_29"), skillLevel)); if (skillLevel == 0) { skillLevel++; } passiveSkillData = _PassiveSkillDataBase._dataTable.First(c => (c.SkillID == skillId && c.SkillLevel == skillLevel)); SkillName.SetText(LanguageTextManager.GetString(passiveSkillData.SkillName)); AttributeContent.Init(passiveSkillData); }
EquiptSlotType getEquiptType(ItemFielInfo itemInfo) { EquiptSlotType getType = EquiptSlotType.Null; switch (itemInfo.LocalItemData._GoodsSubClass) { case 1: getType = EquiptSlotType.Weapon; break; case 2: break; case 3: getType = EquiptSlotType.Heard; break; case 4: getType = EquiptSlotType.Body; break; case 5: getType = EquiptSlotType.Shoes; break; case 6: getType = EquiptSlotType.Accessories; break; case 7: getType = EquiptSlotType.Medicine; break; default: break; } return(getType); }
static ItemFielInfo GetTheBestItem(ItemFielInfo firstItemfile, ItemFielInfo scecondItemFielInfo, EquiptSlotType itemType) { bool flag = true; EffectData selectEffectData = null; EquipmentEntity selectEquipmentEntity = scecondItemFielInfo.equipmentEntity; EffectData currentEffectData = null; // var equipItem = ContainerInfomanager.Instance.GetSSyncContainerGoods_SCList(1).FirstOrDefault(P=>P.nPlace == int.Parse((scecondItemFielInfo.LocalItemData as EquipmentData)._vectEquipLoc)&&P.uidGoods!=0); // ItemFielInfo currentItemfile = ContainerInfomanager.Instance.itemFielArrayInfo.FirstOrDefault(P => P.sSyncContainerGoods_SC.uidGoods == equipItem.uidGoods); EquipmentEntity currentEquipmentEntity = firstItemfile == null ? new EquipmentEntity() : firstItemfile.equipmentEntity; if (firstItemfile != null && firstItemfile == scecondItemFielInfo) { flag = false; } if (GetEquipItemStatus(scecondItemFielInfo) != EquipButtonType.CanEquip) { flag = false; } if (flag) { bool effect1 = false; bool effect2 = false; for (int i = 0; i < 2; i++) { selectEffectData = ItemDataManager.Instance.EffectDatas._effects.FirstOrDefault(P => P.m_IEquipmentID == (i == 0 ? selectEquipmentEntity.EQUIP_FIELD_EFFECTBASE0 : selectEquipmentEntity.EQUIP_FIELD_EFFECTBASE1)); currentEffectData = ItemDataManager.Instance.EffectDatas._effects.FirstOrDefault(P => P.m_IEquipmentID == (i == 0 ? currentEquipmentEntity.EQUIP_FIELD_EFFECTBASE0 : currentEquipmentEntity.EQUIP_FIELD_EFFECTBASE1)); int currenteffect = currentEffectData == null ? 0 : EquipMainProp(firstItemfile.LocalItemData, currentEquipmentEntity, i, true, true, itemType); int selecteffect = selectEffectData == null ? 0 : EquipMainProp(scecondItemFielInfo.LocalItemData, selectEquipmentEntity, i, true, true, itemType); if (selecteffect > currenteffect) { if (i == 0) { effect1 = true; } else { effect2 = true; } } } flag = effect1 && effect2; } return(flag?scecondItemFielInfo:firstItemfile); }
/// <summary> /// 计算装备主属性值 /// </summary> /// <param name="itemFielInfo">装备数据</param> /// <param name="index">装备主属性索引</param> /// <param name="isBefore">是否装备前的值</param> /// <param name="isNormal">是否普通强化</param> /// <returns></returns> static int EquipMainProp(ItemData itemData, EquipmentEntity equipmentEntity, int index, bool isBefore, bool isNormal, EquiptSlotType itemType) { int normalStrengthenLv = PlayerDataManager.Instance.GetEquipmentStrengthLevel(itemType); int starStrengthenLv = PlayerDataManager.Instance.GetEquipmentStarLevel(itemType); if (!isBefore) { if (isNormal) { normalStrengthenLv += 1; } else { starStrengthenLv += 1; } } var equipItemData = ItemDataManager.Instance.GetItemData(itemData._goodID) as EquipmentData; StrengthParameter strengthParameter = equipItemData._StrengthParameter[index]; StrengthParameter starStrengthParameter = equipItemData._StartStrengthParameter[index]; int normalMainProAdd = normalStrengthenLv == 0 || normalStrengthenLv > CommonDefineManager.Instance.CommonDefine.StrengthLimit?0:strengthParameter.Value[normalStrengthenLv - 1]; int normalMainProAddForStar = starStrengthenLv == 0 || starStrengthenLv > CommonDefineManager.Instance.CommonDefine.StartStrengthLimit?0:starStrengthParameter.Value[starStrengthenLv - 1]; float startAddPercent = 0; int sourceMainProValue = 0; switch (index) { case 0: sourceMainProValue = equipmentEntity.EQUIP_FIELD_EFFECTBASE0_VALUE; break; case 1: sourceMainProValue = equipmentEntity.EQUIP_FIELD_EFFECTBASE1_VALUE; break; } return(sourceMainProValue + normalMainProAdd + normalMainProAddForStar); }