void SetAddValue(ItemFielInfo itemfileInfo, bool isNormal) { string value1 = EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop1Add, isNormal); if (value1 == "+0") { Lable_nxtValue1.gameObject.SetActive(false); } else { Lable_nxtValue1.gameObject.SetActive(true); Lable_nxtValue1.SetText(value1); } string value2 = EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop2Add, isNormal); if (value2 == "+0") { Lable_nxtValue2.gameObject.SetActive(false); } else { Lable_nxtValue2.gameObject.SetActive(true); Lable_nxtValue2.SetText(value2); } }
public void SetUpgradeAddValue(ItemFielInfo itemfileInfo) { ItemFielInfo NextLevelItem = new ItemFielInfo((itemfileInfo.LocalItemData as EquipmentData).UpgradeID); if (NextLevelItem != null) { int nextValue1 = Convert.ToInt32(EquipItem.GetItemInfoDetail(NextLevelItem, EquipInfoType.Prop1Value)); int CurrentValue1 = Convert.ToInt32(EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop1Value)); if (nextValue1 > CurrentValue1) { Lable_nxtValue1.gameObject.SetActive(true); Lable_nxtValue1.SetText("+" + (nextValue1 - CurrentValue1)); } else { Lable_nxtValue1.gameObject.SetActive(false); } int nextValue2 = Convert.ToInt32(EquipItem.GetItemInfoDetail(NextLevelItem, EquipInfoType.Prop2Value)); int CurrentValue2 = Convert.ToInt32(EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop2Value)); if (nextValue2 > CurrentValue2) { Lable_nxtValue2.gameObject.SetActive(true); Lable_nxtValue2.SetText("+" + (nextValue2 - CurrentValue2)); } else { Lable_nxtValue2.gameObject.SetActive(false); } } else { Lable_nxtValue2.gameObject.SetActive(false); } }
public void SetBaseValue(ItemFielInfo itemfileInfo) { SP_EffIcon1.spriteName = EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop1IconName); Lable_EffName1.SetText(EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop1Name)); Lable_CurrentValue1.SetText(EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop1Value)); SP_EffIcon2.spriteName = EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop2IconName); Lable_EffName2.SetText(EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop2Name)); Lable_CurrentValue2.SetText(EquipItem.GetItemInfoDetail(itemfileInfo, EquipInfoType.Prop2Value)); }
public void InitItemData(ItemFielInfo itemFielInfo) { if (itemFielInfo != null) { HideOrShowIcon(false); ItemFielInfo = itemFielInfo; //装备图标 SetEquipIcon(); EquipBg.ChangeSprite(itemFielInfo.LocalItemData._ColorLevel + 1); if (itemFielInfo.LocalItemData._GoodsClass == 1) { //已装备提示 if (EquipedIcon != null) { long equipId = itemFielInfo.equipmentEntity.SMsg_Header.uidEntity; bool isEquipEd = ContainerInfomanager.Instance.sSyncHeroContainerGoods_SCs.Exists(item => item.uidGoods == equipId); EquipedIcon.gameObject.SetActive(isEquipEd); } //等级及星级 var equipLevel = EquipItem.GetItemInfoDetail(this.ItemFielInfo, EquipInfoType.EquipStrenLevel); if (equipLevel != "+0") { LevelInfo.SetActive(true); EquipLevel.text = equipLevel; } else { LevelInfo.SetActive(false); } var equipStarIndex = EquipItem.GetItemInfoDetail(this.ItemFielInfo, EquipInfoType.EquipStarColorIndex); EquipStar.ChangeSprite(int.Parse(equipStarIndex)); } } else { HideOrShowIcon(false); EquipBg.ChangeSprite(5); StopAllCoroutines(); EquipIconPoint.ClearChild(); TraceUtil.Log(SystemModel.Rocky, TraceLevel.Error, "装备为空-- EquipItem->InitItemData"); } }
/// <summary> /// 初始化属性, /// </summary> /// <param name="itemFielInfo">装备信息</param> /// <param name="isNormal">是否普通强化<c>true</c> is normal.</param> public void Init(ItemFielInfo itemFielInfo, bool isNormal) { m_isNormal = isNormal; CurrItemFielInfo = itemFielInfo; if (CurrItemFielInfo == null) { Prop1Name.text = string.Empty; Prop2Name.text = string.Empty; Prop1Value.text = string.Empty; Prop1TotalAdd.text = string.Empty; Prop2Value.text = string.Empty; Prop2TotalAdd.text = string.Empty; Prop1Up.text = string.Empty; Prop2Up.text = string.Empty; StrenConsumeValue.text = string.Empty; StrenRateValue.text = string.Empty; StarConsumeValue.text = string.Empty; StarRateValue.text = string.Empty; StarMatName.text = string.Empty; UpgradeEff.ApplyAllItem(P => P.SetActive(false)); return; } UpgradeEff.ApplyAllItem(P => P.SetActive(true)); //初始化其他属性(名称,其他属性.....) Prop1Name.text = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1Name); Prop2Name.text = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2Name); Prop1Value.text = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1Value, isNormal); Prop1TotalAdd.text = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1TotalAdd, isNormal); Prop2Value.text = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2Value, isNormal); Prop2TotalAdd.text = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2TotalAdd, isNormal); Prop1IconSprite.spriteName = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1IconName); Prop2IconSprite.spriteName = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2IconName); Prop1Up.text = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1Add); Prop2Up.text = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2Add); SwitchNormalOtStar(isNormal); }
/// <summary> /// 获取与装备上的装备对比属性值 /// </summary> /// <param name="itemFielInfo">Item fiel info.</param> /// <param name="effectType">Effect type.</param> int GetCompairNum(ItemFielInfo itemfileInfo, EquipInfoType equipInfoType) { string numStr = EquipItem.GetItemInfoDetail(itemfileInfo, equipInfoType).Replace("+", ""); if (string.IsNullOrEmpty(numStr)) { numStr = "0"; } int getNum = int.Parse(numStr); var equipItemList = ContainerInfomanager.Instance.GetEquiptItemList(); ItemFielInfo equipItem = equipItemList.FirstOrDefault(P => (P.LocalItemData as EquipmentData)._vectEquipLoc == (itemfileInfo.LocalItemData as EquipmentData)._vectEquipLoc); if (equipItem != null) { string numStr1 = EquipItem.GetItemInfoDetail(equipItem, equipInfoType).Replace("+", ""); if (string.IsNullOrEmpty(numStr1)) { numStr1 = "0"; } getNum = getNum - int.Parse(numStr1); } return(getNum); }
/// <summary> /// 初始化装备信息 /// </summary> /// <param name="itemFielInfo">Item fiel info.</param> public void InitItemData(ItemFielInfo itemFielInfo) { if (itemFielInfo != null) { ItemFielInfo = itemFielInfo; //装备图标 SetEquipIcon(); //已装备提示 if (EquipedIcon != null) { long equipId = itemFielInfo.equipmentEntity.SMsg_Header.uidEntity; bool isEquipEd = ContainerInfomanager.Instance.sSyncHeroContainerGoods_SCs.Exists(item => item.uidGoods == equipId); EquipedIcon.gameObject.SetActive(isEquipEd); } //等级及星级 var equipLevel = GetItemInfoDetail(this.ItemFielInfo, EquipInfoType.EquipStrenLevel); if (equipLevel != "+0") { LevelInfo.SetActive(true); EquipLevel.text = equipLevel; } else { LevelInfo.SetActive(false); } var equipStarIndex = EquipItem.GetItemInfoDetail(this.ItemFielInfo, EquipInfoType.EquipStarColorIndex); EquipStar.ChangeSprite(int.Parse(equipStarIndex)); //引导 // gameObject.RegisterBtnMappingId(itemFielInfo.LocalItemData._goodID, UIType.EquipStrengthen, BtnMapId_Sub.EquipStrengthen_Item); } else { TraceUtil.Log(SystemModel.Rocky, TraceLevel.Error, "装备为空-- EquipItem->InitItemData"); } }
/// <summary> /// 普通装备属性显示 /// </summary> /// <param name="itemFielInfo">Item fiel info.</param> /// <param name="effectType">Effect type.</param> public void Init(ItemFielInfo itemFielInfo, EffectType effectType) { Effect1Icon.spriteName = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1IconName); Effect2Icon.spriteName = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2IconName); string effect1Name = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1Name); string effect2Name = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2Name); string effect1AddNum = string.Empty; string effect2AddNum = string.Empty; switch (effectType) { case EffectType.MainAttribute: { TitleLabel.SetText(LanguageTextManager.GetString("IDS_I3_25")); Effect1NameLabel.SetText(effect1Name); Effect2NameLabel.SetText(effect2Name); string TatalValue = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1Value); if (string.IsNullOrEmpty(TatalValue)) { TatalValue = "0"; } string AddValue = (int.Parse(TatalValue) - itemFielInfo.equipmentEntity.EQUIP_FIELD_EFFECTBASE0_VALUE).ToString(); if (AddValue == "0") { AddValue = ""; } else { AddValue = "(+" + AddValue + ")"; } effect1AddNum = string.Format("{0} {1}", TatalValue, GetEffectYellowText(AddValue)); string TatalValue1 = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2Value); if (string.IsNullOrEmpty(TatalValue1)) { TatalValue1 = "0"; } string AddValue1 = (int.Parse(TatalValue1) - itemFielInfo.equipmentEntity.EQUIP_FIELD_EFFECTBASE1_VALUE).ToString(); if (AddValue1 == "0") { AddValue1 = ""; } else { AddValue1 = "(+" + AddValue1 + ")"; } effect2AddNum = string.Format("{0} {1}", TatalValue1, GetEffectYellowText(AddValue1)); } break; case EffectType.MainAttributeCompair: { TitleLabel.SetText(LanguageTextManager.GetString("IDS_I3_25")); Effect1NameLabel.SetText(effect1Name); Effect2NameLabel.SetText(effect2Name); string TatalValue = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1Value); if (string.IsNullOrEmpty(TatalValue)) { TatalValue = "0"; } string AddValue = (int.Parse(TatalValue) - itemFielInfo.equipmentEntity.EQUIP_FIELD_EFFECTBASE0_VALUE).ToString(); if (AddValue == "0") { AddValue = ""; } else { AddValue = "(+" + AddValue + ")"; } effect1AddNum = string.Format("{0} {1}", TatalValue, GetEffectYellowText(AddValue)); string TatalValue1 = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2Value); if (string.IsNullOrEmpty(TatalValue1)) { TatalValue1 = "0"; } string AddValue1 = (int.Parse(TatalValue1) - itemFielInfo.equipmentEntity.EQUIP_FIELD_EFFECTBASE1_VALUE).ToString(); if (AddValue1 == "0") { AddValue1 = ""; } else { AddValue1 = "(+" + AddValue1 + ")"; } effect2AddNum = string.Format("{0} {1}", TatalValue1, GetEffectYellowText(AddValue1)); int effect1CompairNum = GetCompairNum(itemFielInfo, EquipInfoType.Prop1Value); int effect2CompairNum = GetCompairNum(itemFielInfo, EquipInfoType.Prop2Value); Effect1CompairNumLabel.SetText(effect1CompairNum > 0?GetEffectYellowText(effect1CompairNum.ToString()):GetEffectRedText(effect1CompairNum.ToString())); Effect2CompairNumLabel.SetText(effect2CompairNum > 0?GetEffectYellowText(effect2CompairNum.ToString()):GetEffectRedText(effect2CompairNum.ToString())); if (effect1CompairNum == 0) { Effect1CompairNumLabel.gameObject.SetActive(false); } else { Effect1CompairNumLabel.gameObject.SetActive(true); } if (effect2CompairNum == 0) { Effect2CompairNumLabel.gameObject.SetActive(false); } else { Effect2CompairNumLabel.gameObject.SetActive(true); } GenerateCompairIcon(effect1CompairNum, Effet1CompairIconPos); GenerateCompairIcon(effect2CompairNum, Effet2CompairIconPos); } break; case EffectType.MainProAdd: TitleLabel.SetText(LanguageTextManager.GetString("IDS_I3_59")); Effect1NameLabel.SetText(GetEffectBlueText(string.Format("{0} {1}", LanguageTextManager.GetString("IDS_I3_27"), effect1Name))); Effect2NameLabel.SetText(GetEffectBlueText(string.Format("{0} {1}", LanguageTextManager.GetString("IDS_I3_27"), effect2Name))); effect1AddNum = GetEffectYellowText(EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1MainAdd)); effect2AddNum = GetEffectYellowText(EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2MainAdd)); break; case EffectType.MainProAddForStar: TitleLabel.SetText(LanguageTextManager.GetString("IDS_I3_60")); Effect1NameLabel.SetText(GetEffectGreenText(string.Format("{0} {1}", LanguageTextManager.GetString("IDS_I3_28"), effect1Name))); Effect2NameLabel.SetText(GetEffectGreenText(string.Format("{0} {1}", LanguageTextManager.GetString("IDS_I3_28"), effect2Name))); effect1AddNum = GetEffectYellowText(EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1StarAdd)); effect2AddNum = GetEffectYellowText(EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop2StarAdd)); break; } Effect1NumLabel.SetText(effect1AddNum); Effect2NumLabel.SetText(effect2AddNum); }
/// <summary> /// 初始装备信息栏,添加信息prefab /// </summary> /// <param name="itemFielInfo">Item fiel info.</param> public override void Init(ItemFielInfo itemFielInfo, bool isLeftPos, bool Cansale) { List <JewelInfo> jewelInfos = PlayerDataManager.Instance.GetJewelInfo((EquiptSlotType)int.Parse((itemFielInfo.LocalItemData as EquipmentData)._vectEquipLoc)); m_AutoAddDragTool.ClearAll(); EquipItemMainProperty mainPropertyObj = (Instantiate(MainPropertyPrefab) as GameObject).GetComponent <EquipItemMainProperty>(); mainPropertyObj.gameObject.AddComponent <BoxCollider>().size = new Vector3(300, 200, 1); //EquipItemMainProperty mainPropertyObj = CreatObjectToNGUI.InstantiateObj(MainPropertyPrefab,Grid).GetComponent<EquipItemMainProperty>(); //mainPropertyObj.transform.localPosition = Vector3.zero; mainPropertyObj.Init(itemFielInfo); AddObj(mainPropertyObj.gameObject); SingleItemTipsEffect mainAtbObj = (Instantiate(IsShowEquiptItem?MainAttribute_NormalPrefab:MainAttribute_CompairPrefab) as GameObject).GetComponent <SingleItemTipsEffect>(); //SingleItemTipsEffect mainAtbObj = CreatObjectToNGUI.InstantiateObj(IsShowEquiptItem?MainAttribute_CompairPrefab:MainAttribute_NormalPrefab ,Grid).GetComponent<SingleItemTipsEffect>(); mainAtbObj.Init(itemFielInfo, IsShowEquiptItem?SingleItemTipsEffect.EffectType.MainAttribute:SingleItemTipsEffect.EffectType.MainAttributeCompair); AddObj(mainAtbObj.gameObject); if (EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1MainAdd) != "+0") { SingleItemTipsEffect normalAdd = (Instantiate(MainAttribute_NormalPrefab) as GameObject).GetComponent <SingleItemTipsEffect>(); //SingleItemTipsEffect normalAdd = CreatObjectToNGUI.InstantiateObj(MainAttribute_NormalPrefab ,Grid).GetComponent<SingleItemTipsEffect>(); normalAdd.Init(itemFielInfo, SingleItemTipsEffect.EffectType.MainProAdd); AddObj(normalAdd.gameObject); } if (EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.Prop1StarAdd) != "+0") { SingleItemTipsEffect normalAdd = (Instantiate(MainAttribute_NormalPrefab) as GameObject).GetComponent <SingleItemTipsEffect>(); //SingleItemTipsEffect normalAdd = CreatObjectToNGUI.InstantiateObj(MainAttribute_NormalPrefab ,Grid).GetComponent<SingleItemTipsEffect>(); normalAdd.Init(itemFielInfo, SingleItemTipsEffect.EffectType.MainProAddForStar); AddObj(normalAdd.gameObject); } if (Cansale) { if (jewelInfos[0].JewelID != 0) //1号孔已镶嵌 { jewel1 = ItemDataManager.Instance.GetItemData(jewelInfos[0].JewelID) as Jewel; skill = _PassiveSkillDataBase._dataTable.First(c => c.SkillID == jewel1.PassiveSkill && c.SkillLevel == jewelInfos[0].JewelLevel); EquipmentAtt_Jewel att = (Instantiate(MainAttribute_jewelPrefab) as GameObject).GetComponent <EquipmentAtt_Jewel>(); att.init(jewel1, skill, false, jewel1._ColorLevel); AddObj(att.gameObject); } if (jewelInfos[1].JewelID != 0) //2号孔已镶嵌 { jewel2 = ItemDataManager.Instance.GetItemData(jewelInfos[1].JewelID) as Jewel; skill = _PassiveSkillDataBase._dataTable.First(c => c.SkillID == jewel2.PassiveSkill && c.SkillLevel == jewelInfos[1].JewelLevel); EquipmentAtt_Jewel att = (Instantiate(MainAttribute_jewelPrefab) as GameObject).GetComponent <EquipmentAtt_Jewel>(); att.init(jewel2, skill, false, jewel2._ColorLevel); AddObj(att.gameObject); } if (jewelInfos[0].JewelID != 0 && jewelInfos[1].JewelID != 0 && jewelInfos[0].JewelID != jewelInfos[1].JewelID) { if (jewel1.StoneGrop != 0 && jewel1.StoneGrop == jewel2.StoneGrop) { skill = _PassiveSkillDataBase._dataTable.First(c => c.SkillID == jewel1._activePassiveSkill.skillID && c.SkillLevel == jewel1._activePassiveSkill.skillLevel); EquipmentAtt_Jewel att = (Instantiate(MainAttribute_jewelPrefab) as GameObject).GetComponent <EquipmentAtt_Jewel>(); att.init(jewel2, skill, true, jewel2._ColorLevel); AddObj(att.gameObject); } } } GameObject desLabel = (Instantiate(DesPanelPrefab) as GameObject); desLabel.GetComponent <SingleButtonCallBack>().SetButtonText(LanguageTextManager.GetString(itemFielInfo.LocalItemData._szDesc)); AddObj(desLabel); if (Cansale) { GameObject PriceLabel = (Instantiate(PricePanelPrefab) as GameObject); PriceLabel.GetComponent <ItemPricePanel>().SetPrice(itemFielInfo.LocalItemData._SaleCost + itemFielInfo.equipmentEntity.ITEM_FIELD_VISIBLE_COMM); AddObj(PriceLabel); } base.Init(itemFielInfo, isLeftPos, Cansale); }
public void Init(ItemFielInfo itemFielInfo) { CurrItemFielInfo = itemFielInfo; if (CurrItemFielInfo == null) { EquipName.text = string.Empty; EquipAllowLev.text = string.Empty; VactionBg.SetActive(false); Occupations.ApplyAllItem(P => P.ChangeSprite(0)); Part.text = string.Empty; StarLev.text = string.Empty; StarName.text = string.Empty; StarDesc.text = string.Empty; StarProcess.sliderValue = 0; return; } //初始化图标 if (m_equipItem == null) { Transform attachPoint; transform.RecursiveFindObject("ItemAttachPoint", out attachPoint); m_equipItem = NGUITools.AddChild(attachPoint.gameObject, EquipItemPrefab).GetComponent <EquipItem>(); } if (CurrItemFielInfo == null) { return; } m_equipItem.InitItemData(itemFielInfo); //初始化其他属性(名称,其他属性.....) EquipName.text = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.EquipName); var playerLev = PlayerManager.Instance.FindHeroDataModel().UnitValues.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_LEVEL; var allowLevel = itemFielInfo.LocalItemData._AllowLevel; //玩家等级不足时,等级数字显示为红色 EquipAllowLev.text = allowLevel.ToString().SetColor(allowLevel > playerLev?TextColorType.Red:TextColorType.EquipProperty); //玩家职业处理 string[] ItemVocation = itemFielInfo.LocalItemData._AllowProfession.Split('+'); VactionBg.SetActive(false); Occupations.ApplyAllItem(P => P.ChangeSprite(0)); if (ItemVocation.Length > 0) { var vos = ItemVocation.ToList(); vos.Sort((a, b) => a.CompareTo(b)); for (int i = 0; i < vos.Count; i++) { Occupations[i].ChangeSprite(int.Parse(vos[i])); } if (ItemVocation.Length == 1) { var vo = int.Parse(ItemVocation[0]); if (vo != PlayerManager.Instance.FindHeroDataModel().PlayerValues.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION) { VactionBg.SetActive(true); } } } Part.text = ((GoodsSubClass)itemFielInfo.LocalItemData._GoodsSubClass).GetGoodsSubClassName(); //扩展方法计算物品类型的IDS string s = EquipItem.GetItemInfoDetail(itemFielInfo, EquipInfoType.EquipStarLevel); int starLev = 0; if (!string.IsNullOrEmpty(s)) { starLev = Convert.ToInt32(s); } StarLev.SetText(starLev); int Starclass = (starLev - 1) / 10; int spriteId = starLev == 0?1:Starclass + 2; Star.ChangeSprite(spriteId); StarName.text = LanguageTextManager.GetString(string.Format("{0}{1}", "IDS_I36_", Starclass + 1));//1=明珠 2=夏炉 桐琴 御盾 玉麟 周鼎 //分母固定为10,分子为:求余数(星阶等级/10)。进度条进度长度显示星阶(等级/10)百分比长度 //int starLevel=itemFielInfo.equipmentEntity.EQUIP_FIELD_START_LEVEL; int currProcess = ((starLev - 1) % 10) + 1; //currProcess=(currProcess==0&&starLevel!=0)?10:currProcess; StarDesc.text = string.Format("{0}/{1}", currProcess, 10); m_starProcessFore.ChangeSprite(spriteId - 1); StarProcess.sliderValue = currProcess / 10f; }