/// <summary> /// 布局Tip /// </summary> /// <param name="view">视图</param> /// <param name="data">数据</param> protected void LayoutItemTip(GameObject view, ItemBase data, ItemBase compareData) { RectTransform root = FindComponent <RectTransform>(view.transform, "TipsScrollView/Viewport/Content/Content"); //品质部分 Transform qualityNode = FindComponent <Transform>(view.transform, "TipsScrollView/Viewport/Content/Quality"); //名称部分 TMP_Text nameField = FindComponent <TMP_Text>(root, "NameType/Label_Name"); TMP_Text tnField = FindComponent <TMP_Text>(root, "NameType/Label_T"); Transform typeNode = FindComponent <Transform>(root, "NameType/Type"); TMP_Text typeField = FindComponent <TMP_Text>(typeNode, "Label_Type"); Image typeIcon = FindComponent <Image>(typeNode, "Image_IconType"); Transform levelNode = FindComponent <Transform>(root, "NameType/Level"); TMP_Text levelField = FindComponent <TMP_Text>(levelNode, "Label_Score_Num"); //限制部分 Transform limitNode = FindComponent <Transform>(root, "Limit"); TMP_Text limitText = FindComponent <TMP_Text>(limitNode, "Label"); //材料部分 Transform materialNode = FindComponent <Transform>(root, "Materials"); //描述部分 Transform descriptionNode = FindComponent <Transform>(root, "Describe"); TMP_Text descriptionField = FindComponent <TMP_Text>(descriptionNode, "Label_Describe"); //属性部分 Transform attributeNode = FindComponent <Transform>(root, "Attribute"); //属性部分A Transform attributeANode = FindComponent <Transform>(root, "Attribute/Top"); //属性部分B Transform attributeBNode = FindComponent <Transform>(root, "Attribute/Temp"); //属性部分C Transform attributeCNode = FindComponent <Transform>(root, "Attribute/DFD"); //属性部分D Transform attributeDNode = FindComponent <Transform>(root, "Attribute/Repair"); //属性部分Nature 容器 Transform attributeNature = FindComponent <Transform>(root, "Attribute/nature"); //属性部分Extra容器 Transform attributeExtra = FindComponent <Transform>(root, "Attribute/Extra"); //属性部分Nature 单体 Transform attributeNatureSingle = FindComponent <Transform>(root, "Attribute/nature/content1"); //属性部分Extra 单体 Transform attributeExtraSingle = FindComponent <Transform>(root, "Attribute/Extra/content1"); //技能部分 Transform skillNode = FindComponent <Transform>(root, "Attribute/Skill"); //随机属性部分 Transform randomNode = FindComponent <Transform>(root, "Random"); //模组部分 Transform modNode = FindComponent <Transform>(root, "MOD"); //关掉所有 tnField.text = string.Empty; typeNode.gameObject.SetActive(false); levelNode.gameObject.SetActive(false); limitNode.gameObject.SetActive(false); materialNode.gameObject.SetActive(false); attributeNode.gameObject.SetActive(false); attributeANode.gameObject.SetActive(false); attributeBNode.gameObject.SetActive(false); attributeCNode.gameObject.SetActive(false); attributeDNode.gameObject.SetActive(false); skillNode.gameObject.SetActive(false); randomNode.gameObject.SetActive(false); modNode.gameObject.SetActive(false); attributeNature.gameObject.SetActive(false); attributeExtra.gameObject.SetActive(false); //名称 nameField.text = TableUtil.GetItemName(data.TID); //描述 descriptionField.text = TableUtil.GetItemDescribe(data.TID); //品质 int quality = data.ItemConfig.Quality; //data.ItemConfig for (int i = 0; i < qualityNode.childCount; i++) { qualityNode.GetChild(i).gameObject.SetActive((i + 1) == quality); } //蓝图 if (data.MainType == Category.Blueprint) { ItemDrawingVO blueprint = data as ItemDrawingVO; //类型 typeNode.gameObject.SetActive(true); typeField.text = TableUtil.GetLanguageString(blueprint.DrawingType); switch (blueprint.DrawingType) { case BlueprintL1.Warship: UIUtil.SetIconImage(typeIcon, 31005); break; case BlueprintL1.Weapon: UIUtil.SetIconImage(typeIcon, 31006); break; case BlueprintL1.Reformer: UIUtil.SetIconImage(typeIcon, 31007); break; case BlueprintL1.EquipmentMod: UIUtil.SetIconImage(typeIcon, 31008); break; case BlueprintL1.Equipment: UIUtil.SetIconImage(typeIcon, 31009); break; case BlueprintL1.Material: UIUtil.SetIconImage(typeIcon, 31010); break; default: typeIcon.sprite = null; break; } //材料 materialNode.gameObject.SetActive(true); LayoutBlueprintMaterial(blueprint.TID, materialNode); //飞船蓝图 if (blueprint.DrawingType == BlueprintL1.Warship) { attributeNode.gameObject.SetActive(true); attributeANode.gameObject.SetActive(true); attributeBNode.gameObject.SetActive(true); attributeCNode.gameObject.SetActive(true); attributeDNode.gameObject.SetActive(true); skillNode.gameObject.SetActive(true); modNode.gameObject.SetActive(true); LayoutBlueprintModList(blueprint.TID, modNode); } //武器蓝图 else if (blueprint.DrawingType == BlueprintL1.Weapon) { attributeNode.gameObject.SetActive(true); attributeANode.gameObject.SetActive(true); attributeBNode.gameObject.SetActive(true); randomNode.gameObject.SetActive(true); modNode.gameObject.SetActive(true); LayoutBlueprintModList(blueprint.TID, modNode); } //转化炉蓝图 else if (blueprint.DrawingType == BlueprintL1.Reformer) { attributeNode.gameObject.SetActive(true); attributeANode.gameObject.SetActive(true); attributeBNode.gameObject.SetActive(true); randomNode.gameObject.SetActive(true); } //装备蓝图 else if (blueprint.DrawingType == BlueprintL1.Equipment) { attributeNode.gameObject.SetActive(true); attributeANode.gameObject.SetActive(true); attributeBNode.gameObject.SetActive(true); randomNode.gameObject.SetActive(true); } //装备模组蓝图 else if (blueprint.DrawingType == BlueprintL1.EquipmentMod) { attributeNode.gameObject.SetActive(true); randomNode.gameObject.SetActive(true); } //材料蓝图 else if (blueprint.DrawingType == BlueprintL1.Material) { } } //飞船 else if (data.MainType == Category.Warship) { ItemWarShipVO ship = data as ItemWarShipVO; typeNode.gameObject.SetActive(true); typeField.text = TableUtil.GetLanguageString(ship.WarshipL1); UIUtil.SetIconImage(typeIcon, 31005); attributeNode.gameObject.SetActive(true); attributeANode.gameObject.SetActive(true); attributeBNode.gameObject.SetActive(true); attributeCNode.gameObject.SetActive(true); attributeDNode.gameObject.SetActive(true); skillNode.gameObject.SetActive(true); modNode.gameObject.SetActive(true); LayoutShipOrWeaponModList(ship, EquipmentModL1.WarshipMod, modNode); } //武器 else if (data.MainType == Category.Weapon) { ItemWeaponVO weapon = data as ItemWeaponVO; typeNode.gameObject.SetActive(true); typeField.text = TableUtil.GetLanguageString(weapon.WeaponType2); UIUtil.SetIconImage(typeIcon, 31006); tnField.text = "T" + weapon.ItemConfig.Grade; attributeNode.gameObject.SetActive(true); attributeANode.gameObject.SetActive(true); attributeBNode.gameObject.SetActive(true); randomNode.gameObject.SetActive(true); modNode.gameObject.SetActive(true); LayoutShipOrWeaponModList(weapon, EquipmentModL1.WeaponMod, modNode); } //转化炉 else if (data.MainType == Category.Reformer) { ItemReformerVO reformer = data as ItemReformerVO; typeNode.gameObject.SetActive(true); typeField.text = TableUtil.GetLanguageString(Category.Reformer); UIUtil.SetIconImage(typeIcon, 31007); tnField.text = "T" + reformer.ItemConfig.Grade; attributeNode.gameObject.SetActive(true); attributeANode.gameObject.SetActive(true); attributeBNode.gameObject.SetActive(true); randomNode.gameObject.SetActive(true); } //装备 else if (data.MainType == Category.Equipment) { ItemEquipmentVO equip = data as ItemEquipmentVO; typeNode.gameObject.SetActive(true); typeField.text = TableUtil.GetLanguageString(equip.EquipmentType); UIUtil.SetIconImage(typeIcon, 31009); tnField.text = "T" + equip.ItemConfig.Grade; attributeNode.gameObject.SetActive(true); attributeANode.gameObject.SetActive(true); attributeBNode.gameObject.SetActive(true); randomNode.gameObject.SetActive(true); } //MOD else if (data.MainType == Category.EquipmentMod) { ItemModVO mod = data as ItemModVO; typeNode.gameObject.SetActive(true); typeField.text = TableUtil.GetLanguageString(mod.ModType1); UIUtil.SetIconImage(typeIcon, 31008); attributeNode.gameObject.SetActive(true); randomNode.gameObject.SetActive(true); } //材料 else if (data.MainType == Category.Material) { ItemMaterialVO itemMaterial = data as ItemMaterialVO; typeNode.gameObject.SetActive(true); typeField.text = TableUtil.GetLanguageString(itemMaterial.MaterialType); UIUtil.SetIconImage(typeIcon, 31010); } //消耗品 else if (data.MainType == Category.Expendable) { ItemExpendableVO itemExpendable = data as ItemExpendableVO; typeNode.gameObject.SetActive(true); typeField.text = TableUtil.GetLanguageString(itemExpendable.ExpendableType); UIUtil.SetIconImage(typeIcon, 51027); } }