|
|
-
- HorseEquipInfoTips = HorseEquipInfoTips or BaseClass(EquipToolTips)
-
- HorseEquipInfoTips.ONLY_SHOW = 0 --只展示信息
- -- HorseEquipInfoTips.COMPOSE_OFF = 1 --显示熔炼按钮,点击后 熔炼坐骑装备物品
- -- HorseEquipInfoTips.OFF_AND_REPLACE = 2 --显示穿戴和脱下按钮
- HorseEquipInfoTips.OFF = 1 --穿戴状态 只显示脱下 升级
- HorseEquipInfoTips.WEAR = 2 --背包状态 只显示穿戴 熔炼
- HorseEquipInfoTips.ALL = 3 --所有的坐骑装备按钮都显示
- HorseEquipInfoTips.NONE = 4 --所有按钮都不显示
- HorseEquipInfoTips.FORGE = 5 --打造状态 只显示打造按钮
- HorseEquipInfoTips.FORGE_GET_NEW = 6 --打造获得新装备 与旧装备的对比
- HorseEquipInfoTips.UNKNOWN = 7 --打造 提前显示的打造成功的装备 显示?号
- HorseEquipInfoTips.MATERIAL = 8 --打造的材料替换和取出
-
-
- function HorseEquipInfoTips:__init()
- self.base_file = "common"
- self.layout_file = "EquipToolTips"
- self.layer_name = "Top"
-
- self.use_background = true
- self.click_bg_toClose = true
- self.close_mode = CloseMode.CloseDestroy
- self.destroy_imm = true
- self.horseModel = HorseModel:getInstance()
-
- self.goods_vo = nil
- self.cell = nil --坐骑装备特殊 需要自己通过配置找到装备可以穿戴的位置
-
- self.load_callback = function ()
- self:LoadSuccess()
- end
- self.open_callback = function ()
- self:SetData()
- end
- self.close_callback = function ()
- end
- self.destroy_callback = function ()
- self:Remove()
- end
- end
-
- --[[
- type_id 物品id
- type 打开类型 判断是需要脱下装备还是需要穿戴
- basic_attr 基本属性
- attr_list 传奇属性列表
- parm 坐骑装备的打造界面 需要的额外参数 判断是哪个材料的位置
- --]]
- function HorseEquipInfoTips:Open(type_id, x, y, goods_vo, type, basic_attr, attr_list, parm)
- if not Config.Mountequipattr[type_id] then
- print("not horse config attr",type)
- self:Close()
- return
- end
- self.type_id = type_id
- self.pos_x = x
- self.pos_y = y
- self.goods_vo = goods_vo
- self.open_type = type
- self.basic_attr = basic_attr
- self.attr_list = attr_list
- self.parm = parm
-
- if not self.cell then
- self.cell = self.horseModel:GetEquipWearPos(self.type_id)
- end
- BaseView.Open(self)
- end
-
- function HorseEquipInfoTips:LoadSuccess()
- self.gameObject:SetActive(false)
- self.layout,self.bg,self.career_conta,self.descCon,self.expired_label,
- self.icon_con,self.depot_conta,self.star_conta,self.ScrollView,
- self.ScrollViewContent,self.ScrollViewViewport,
- self.line1,self.line2,
- self.line3,self.line4,
- self.line5,self.line6,
- self.line7,self.line8,
- self.line9,self.line10,
- self.btn_conta,self.down_arrow,self.sell_conta,
- self.compare_conta,self.addNumCon,
- self.stone_conta,
- self.normal
- = GetChildTransforms(self.transform,
- {
- "layout","layout/normal/bg","layout/normal/career_conta","layout/normal/descCon","layout/normal/expired_label",
- "layout/normal/icon_con","layout/normal/depot_conta","layout/normal/star_conta","layout/normal/ScrollView",
- "layout/normal/ScrollView/Viewport/Content","layout/normal/ScrollView/Viewport",
- "layout/normal/ScrollView/Viewport/Content/line1","layout/normal/ScrollView/Viewport/Content/line2",
- "layout/normal/ScrollView/Viewport/Content/line3","layout/normal/ScrollView/Viewport/Content/line4",
- "layout/normal/ScrollView/Viewport/Content/line5","layout/normal/ScrollView/Viewport/Content/line6",
- "layout/normal/ScrollView/Viewport/Content/line7","layout/normal/ScrollView/Viewport/Content/line8",
- "layout/normal/ScrollView/Viewport/Content/line9","layout/normal/ScrollView/Viewport/Content/line10",
- "layout/normal/btn_conta","layout/normal/down_arrow","layout/normal/sell_conta",
- "layout/compare_conta","layout/normal/btn_conta/buyCon/addNumCon",
- "layout/normal/ScrollView/Viewport/Content/stone_conta",
- "layout/normal",
- })
-
- self.descLabel,self.getWayLabel,self.nameText,
- self.step_num,self.composite_score,self.equip_score,
- self.career,self.level,self.equip_pos,
- self.fight,self.depot_score,self.depot_text,
- self.base_name,self.baseName,
- self.basePro,self.strengthAdd,
- self.add_name,self.addName,
- self.addPro,self.wash_name,
- self.washName,self.washPro,
- self.spirit_name,self.spiritName,
- self.spiritPro,self.stone_name,
- self.suit_name,self.suitNameList,
- self.suitNum,self.suitName,
- self.suitPro,self.wake_base_name,
- self.wake_baseName,self.wake_basePro,
- self.wake_baseAdd,self.wake_stren_name,
- self.wake_strenName,self.wake_strenPro,
- self.wake_strenAdd,self.wake_suit_name,
- self.wake_suitNum,self.wake_suitName,
- self.wake_suitPro,self.wake_suitAdd,
- self.magic_skill_name,self.magic_skillName,
- self.magic_skillLevel,self.price_label,
- self.limitText
- = GetChildTexts(self.transform,
- {
- "layout/normal/descCon/descLabel","layout/normal/descCon/getWayLabel","layout/normal/nameText",
- "layout/normal/step_num","layout/normal/composite_score","layout/normal/equip_score",
- "layout/normal/career_conta/career","layout/normal/level","layout/normal/career_conta/equip_pos",
- "layout/normal/fight","layout/normal/depot_conta/depot_score","layout/normal/depot_conta/Text (5)",
- "layout/normal/ScrollView/Viewport/Content/line1/Text","layout/normal/ScrollView/Viewport/Content/baseName",
- "layout/normal/ScrollView/Viewport/Content/basePro","layout/normal/ScrollView/Viewport/Content/strengthAdd",
- "layout/normal/ScrollView/Viewport/Content/line2/Text","layout/normal/ScrollView/Viewport/Content/addName",
- "layout/normal/ScrollView/Viewport/Content/addPro","layout/normal/ScrollView/Viewport/Content/line5/Text",
- "layout/normal/ScrollView/Viewport/Content/washName","layout/normal/ScrollView/Viewport/Content/washPro",
- "layout/normal/ScrollView/Viewport/Content/line6/Text","layout/normal/ScrollView/Viewport/Content/spiritName",
- "layout/normal/ScrollView/Viewport/Content/spiritPro","layout/normal/ScrollView/Viewport/Content/line3/Text",
- "layout/normal/ScrollView/Viewport/Content/line4/Text","layout/normal/ScrollView/Viewport/Content/suitNameList",
- "layout/normal/ScrollView/Viewport/Content/suitNum","layout/normal/ScrollView/Viewport/Content/suitName",
- "layout/normal/ScrollView/Viewport/Content/suitPro","layout/normal/ScrollView/Viewport/Content/line7/Text",
- "layout/normal/ScrollView/Viewport/Content/wakeBaseName","layout/normal/ScrollView/Viewport/Content/wakeBasePro",
- "layout/normal/ScrollView/Viewport/Content/wakeBaseAdd","layout/normal/ScrollView/Viewport/Content/line8/Text",
- "layout/normal/ScrollView/Viewport/Content/wakeStrenName","layout/normal/ScrollView/Viewport/Content/wakeStrenPro",
- "layout/normal/ScrollView/Viewport/Content/wakeStrenAdd","layout/normal/ScrollView/Viewport/Content/line9/Text",
- "layout/normal/ScrollView/Viewport/Content/wakeSuitNum","layout/normal/ScrollView/Viewport/Content/wakeSuitName",
- "layout/normal/ScrollView/Viewport/Content/wakeSuitPro","layout/normal/ScrollView/Viewport/Content/wakeSuitAdd",
- "layout/normal/ScrollView/Viewport/Content/line10/Text","layout/normal/ScrollView/Viewport/Content/magicSkillName",
- "layout/normal/ScrollView/Viewport/Content/magicSkillLevel","layout/normal/sell_conta/price_label",
- "layout/normal/btn_conta/buyCon/limitText"
- })
-
- self.forgeBtn,
- self.upgradeBtn,self.upgradeBtn_dot,
- self.smeltBtn,self.smeltBtn_dot,
- self.strengthBtn,self.strengthBtn_dot,
- self.washBtn,self.wearBtn,
- self.insertBtn,self.insertBtn_dot,
- self.offBtn,self.decomposeBtn,
- self.composeBtn,self.sellBtn,
- self.storeBtn,self.takeBtn,
- self.exchangeBtn,self.destoryBtn,
- self.donateBtn,self.renewBtn,
- self.shelvesUpBtn,self.shelvesDownBtn,
- self.eatBtn,self.buyCon,
- self.buyBtn,self.oneKeyBuyBtn
- = GetChildGameObjects(self.transform,
- {
- "layout/normal/btn_conta/forgeBtn",
- "layout/normal/btn_conta/upgradeBtn","layout/normal/btn_conta/upgradeBtn/dot",
- "layout/normal/btn_conta/smeltBtn","layout/normal/btn_conta/smeltBtn/dot",
- "layout/normal/btn_conta/strengthBtn","layout/normal/btn_conta/strengthBtn/dot",
- "layout/normal/btn_conta/washBtn","layout/normal/btn_conta/wearBtn",
- "layout/normal/btn_conta/insertBtn","layout/normal/btn_conta/insertBtn/dot",
- "layout/normal/btn_conta/offBtn","layout/normal/btn_conta/decomposeBtn",
- "layout/normal/btn_conta/composeBtn","layout/normal/btn_conta/sellBtn",
- "layout/normal/btn_conta/storeBtn","layout/normal/btn_conta/takeBtn",
- "layout/normal/btn_conta/exchangeBtn","layout/normal/btn_conta/destoryBtn",
- "layout/normal/btn_conta/donateBtn","layout/normal/btn_conta/renewBtn",
- "layout/normal/btn_conta/shelvesUpBtn","layout/normal/btn_conta/shelvesDownBtn",
- "layout/normal/btn_conta/eatBtn","layout/normal/btn_conta/buyCon",
- "layout/normal/btn_conta/buyCon/buyBtn","layout/normal/btn_conta/oneKeyBuyBtn"
- })
- self.step_bg,self.sell_icon,self.wear_icon = GetChildImages(self.transform,
- {
- "layout/normal/setp_bg","layout/normal/sell_conta/icon","layout/normal/wear_icon",
- })
- self.career_conta_pos = self.career_conta.transform.localPosition
- self.depot_conta_pos = self.depot_conta.transform.localPosition
- self.btn_list = {self.forgeBtn,
- self.upgradeBtn, self.smeltBtn,
- self.strengthBtn, self.washBtn, self.wearBtn, self.insertBtn, self.offBtn,
- self.decomposeBtn, self.sellBtn, self.storeBtn, self.takeBtn,
- self.exchangeBtn, self.destoryBtn, self.donateBtn, self.renewBtn,
- self.shelvesUpBtn, self.shelvesDownBtn, self.composeBtn, self.eatBtn, self.buyCon,
- self.oneKeyBuyBtn}
-
- self.icon_item = HorseBagIconItem.New(self.icon_con, false, self.layer_name)
- self.icon_item:ChangeCountVisible(false)
-
- -- self.addNumComponent = AddNumberComponent.New(self.addNumCon)
- -- self.addNumComponent:SetVisibleCalcBtn(false)
-
- self:InitEvent()
- self.stageBg,
- self.step_num_obj,
- self.text1_obj,
- self.text2_obj
- = GetChildGameObjects(self.transform,
- {
- "layout/normal/stageBg",
- "layout/normal/step_num",
- "layout/normal/Text1",
- "layout/normal/Text2",
- })
-
- self.careerName,
- self.addStrengthProp
- = GetChildTexts(self.transform,
- {
- "layout/normal/career_conta/careerName",
- "layout/normal/ScrollView/Viewport/Content/addStrengthProp",
- })
- self.replace_btn_text = self:GetChildTexts({"layout/normal/btn_conta/strengthBtn/Text"})
- self.replace_btn_text.text = "替换"
- self.careerName.text = "品质:"
- self.stageBg:SetActive(false)
- self.step_num_obj:SetActive(false)
- -- self.text1_obj:SetActive(false)
- -- lua_resM:setImageSprite(self, self.offBtn.transform:GetComponent("Image"), "alphaCommon_asset", "tyui_btn_1")
- -- lua_resM:setImageSprite(self, self.smeltBtn.transform:GetComponent("Image"), "alphaCommon_asset", "tyui_btn_2")
-
- -- EquipToolTips.LoadSuccess(self)
- -- if self.open_type == HorseEquipInfoTips.OFF then --穿戴在身上的就显示升级战力 加 基础属性战力 在背包、熔炼背包、打造背包的就显示基础属性战力
- -- if not self.cell then
- -- self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
- -- end
- -- self.horseModel:Fire(HorsePetEvent.REQUEST_HORSE_UPGRADE, self.cell)
- -- else
- -- self:SetCombat(nil, 2)
- -- end
- -- self.level.gameObject:SetActive(false)
- self.text1_obj.transform:GetComponent("Text").text = "部位:"
- self.text2_obj.transform:GetComponent("Text").text = "评分:"
- -- self.equip_score.gameObject:SetActive(false)
- -- self.text2_obj:SetActive(false)
- end
-
- function HorseEquipInfoTips:InitEvent()
- local function onClickHandler(target)
- if target == self.wearBtn then
- self.horseModel:Fire(HorsePetEvent.WEAR_HORSE_EQUIP, self.goods_vo.goods_id)
- elseif target == self.upgradeBtn then
- self.horseModel:Fire(HorsePetEvent.SHOW_UPGRADE_VIEW, true, self.goods_vo)
- elseif target == self.smeltBtn then
- self:SmeltEquipFunc()
- elseif target == self.offBtn then
- self.horseModel:Fire(HorsePetEvent.OFF_HORSE_EQUIP, self.goods_vo.goods_id)
- elseif target == self.forgeBtn then
- local cfg = self.horseModel:GetHorseEquipNewMakeCfg(self.goods_vo.type_id)
- if cfg then
- self.horseModel:Fire(HorsePetEvent.SHOW_HORSE_FORGE, self.goods_vo, true)
- -- self.horseModel:ClearForgeMaterialeVoDic(2, true)
- self.horseModel.new_is_forge = false
- else
- Message.show("此装备无法继续打造")
- end
- elseif target == self.takeBtn then -- 坐骑打造界面 点击材料 取出
- if self.parm then
- if self.parm == HorseModel.MATERIAL_ITEM.MATERIAL_1_CANCLE then
- self.horseModel:ClearForgeMaterialeVoDic(1, nil, 1)
- elseif self.parm == HorseModel.MATERIAL_ITEM.MATERIAL_2_CANCLE then
- self.horseModel:ClearForgeMaterialeVoDic(1, nil, 2)
- elseif self.parm == HorseModel.EXTRA_ITEM.EXTRA_1_CANCLE then
- self.horseModel:ClearForgeMaterialeVoDic(2)
- end
- end
- elseif target == self.strengthBtn then -- 坐骑打造界面 点击材料 替换
- if self.parm then
- if self.parm == HorseModel.MATERIAL_ITEM.MATERIAL_1_CANCLE then
- self.horseModel:Fire(HorsePetEvent.SELECT_MATERIAL_VIEW, 1, true, 1)
- elseif self.parm == HorseModel.MATERIAL_ITEM.MATERIAL_2_CANCLE then
- self.horseModel:Fire(HorsePetEvent.SELECT_MATERIAL_VIEW, 1, true, 2)
- elseif self.parm == HorseModel.EXTRA_ITEM.EXTRA_1_CANCLE then
- self.horseModel:Fire(HorsePetEvent.SELECT_MATERIAL_VIEW, 2, true)
- end
- end
- end
- self:Close()
- end
- AddClickEvent(self.wearBtn, onClickHandler, 2)
- AddClickEvent(self.upgradeBtn, onClickHandler, 2)
- AddClickEvent(self.smeltBtn, onClickHandler, 2)
- AddClickEvent(self.offBtn, onClickHandler, 2)
- AddClickEvent(self.forgeBtn, onClickHandler, 2)
- AddClickEvent(self.takeBtn, onClickHandler, 2)
- AddClickEvent(self.strengthBtn, onClickHandler, 2)
-
- --更新装备的战力
- local function onUpdateCombat(vo)
- -- if vo.goods_id == self.goods_vo.goods_id then
- -- self:SetCombat(vo, 1)
- self.level_vo = vo
- self.composite_score.text = self:GetFightList(self.dynamic, self.equip_basic)
- local basic = nil
- if self.type_id then
- basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
- end
- local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
- self:SetProperty(base_pro, 0, basic.equip_type)
- self:SetAddProperty(self.dynamic)
- self:RefreshPosAndSize(self.dynamic)
- if self.open_type == HorseEquipInfoTips.OFF or self.horseModel:CheckIsWearEquipByVo(self.goods_vo) then
- if self.cell then
- self.upgradeBtn_dot:SetActive(self.horseModel:CheckEquipUpgradeRed(self.cell))
- end
- end
- -- end
- end
- self.update_equip_combat_id = self.horseModel:Bind(HorsePetEvent.SHOW_HORSE_UPGRADE, onUpdateCombat)
- end
-
- function HorseEquipInfoTips:Remove()
- if self.icon_item then
- self.icon_item:DeleteMe()
- self.icon_item = nil
- end
-
- if self.compareTips then
- self.compareTips:DeleteMe()
- self.compareTips = nil
- end
-
- self:DeleteArrowTip()
- if self.addNumComponent then
- if self.change_count_id then
- self.addNumComponent:UnBind(self.change_count_id)
- self.change_count_id = nil
- end
- self.addNumComponent:DeleteMe()
- self.addNumComponent = nil
- end
-
- if self.update_equip_combat_id then
- self.horseModel:UnBind(self.update_equip_combat_id)
- self.update_equip_combat_id = nil
- end
- end
-
- function HorseEquipInfoTips:SetData()
- if self.type_id == nil --[[or self.goods_vo == nil--]] then return end
- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- local basic = nil
- if self.type_id then
- basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
- self.equip_basic = basic
- end
-
- if basic then
- local cfg = Config.Mountequipattr[self.type_id]
- if cfg then
- self.composite_score.text = cfg.base_rating
- -- self.equip_score.text = cfg.base_rating
- self.equip_score.text = "<color=#ffffff>"..cfg.base_rating.."</color>"
- -- self.level.text = "<color=#ffffff>"..cfg.base_rating.."</color>"
- local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
- self:SetProperty(base_pro, 0, basic.equip_type)
- self:SetAddProperty()
- self:RefreshPosAndSize(self.dynamic)
- end
- end
- if self.icon_item then
- local goods_vo = self.goods_vo
- if goods_vo == nil then
- local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
- goods_vo = {type_id = self.type_id, color = basic.color, goods_num = 1, bind = basic.bind}
- end
- self.icon_item:SetData(goods_vo)
- if self.open_type == HorseEquipInfoTips.UNKNOWN and self.horseModel.forge_view then
- self.icon_item:SetLockIconActive(true)
- end
- end
- else
- if self.goods_vo.goods_id then
- local function callback(dynamic)
- self.dynamic = dynamic
- -- self.equip_score.text = dynamic.rating
- -- self.level.text = "<color=#ffffff>"..dynamic.rating.."</color>"
- self.equip_score.text = "<color=#ffffff>"..dynamic.rating.."</color>"
- if dynamic.equip_extra_attr then
- local basic = nil
- if self.type_id then
- basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
- self.equip_basic = basic
- end
-
- if basic then
- if self.open_type == HorseEquipInfoTips.OFF or self.horseModel:CheckIsWearEquipByVo(self.goods_vo) then --穿戴在身上的就显示升级战力 加 基础属性战力 在背包、熔炼背包、打造背包的就显示基础属性战力
- if not self.cell then
- self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
- end
- self.horseModel:Fire(HorsePetEvent.REQUEST_HORSE_UPGRADE, self.cell)
- else
- -- self:SetCombat(nil, 2)
- self.composite_score.text = self:GetFightList(self.dynamic, basic)
- local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
- self:SetProperty(base_pro, 0, basic.equip_type)
- self:SetAddProperty(dynamic)
- self:RefreshPosAndSize(self.dynamic)
- end
-
- -- local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
- -- self:SetProperty(base_pro, 0, basic.equip_type)
- end
- -- self:SetAddProperty(dynamic)
- -- self.dynamic = dynamic
- -- self:RefreshPosAndSize(self.dynamic)
-
- -- self:SetUnknownView(self.ScrollViewContent, self.addPro.transform, self.add_property_len, self.addStrengthProp)
- -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- -- local text_root
- -- local text_txt
- -- text_root = UiFactory.createChild(self.career_conta, UIType.Label, "expire_label")
- -- text_txt = text_root:GetComponent("Text")
- -- text_root.transform.pivot = Vector2(0,1)
- -- text_root.transform.anchorMin = Vector2(0, 1)
- -- text_root.transform.anchorMax = Vector2(0, 1)
- -- text_txt.alignment = UnityEngine.TextAnchor.UpperLeft
- -- self:SetUnknownView(self.career_conta, self.career.transform, 1, text_txt)
-
- -- text_root = UiFactory.createChild(self.normal, UIType.Label, "expire_label")
- -- text_txt = text_root:GetComponent("Text")
- -- text_root.transform.pivot = Vector2(0,1)
- -- text_root.transform.anchorMin = Vector2(0, 1)
- -- text_root.transform.anchorMax = Vector2(0, 1)
- -- text_txt.alignment = UnityEngine.TextAnchor.UpperLeft
- -- self:SetUnknownView(self.normal, self.composite_score.transform, 1, text_txt, 13)
- -- end
- end
-
- if self.icon_item then
- self.icon_item:SetData(self.goods_vo)
- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- self.icon_item:SetLockIconActive(true)
- end
- end
- end
- GoodsModel:getInstance():GetDynamic(self.goods_vo.goods_id, callback)
- end
- end
-
- if not self.cell then
- self.cell = self.horseModel:GetEquipWearPos(self.type_id)
- end
-
- local view_type = 2
- if self.open_type == HorseEquipInfoTips.FORGE and self.horseModel.new_is_forge then
- if self.horseModel:IsNewGoodsVo(self.goods_vo.goods_id) then
- lua_resM:setImageSprite(self, self.wear_icon, "uiComponent_asset", "tsui_dzh")
- end
- if self.horseModel:GetForgeOldGoodsVo() and self.horseModel:IsNewGoodsVo(self.goods_vo.goods_id) and self.horseModel.has_show_after_forge_tips == false then
- self.show_compare_tips = true
- self.have_equip_data = self.horseModel:GetForgeOldGoodsVo()
- view_type = 1
- end
- elseif self.open_type == HorseEquipInfoTips.WEAR then
- self.show_compare_tips, self.have_equip_data = self.horseModel:ShowCompareTips(self.goods_vo.goods_id, self.cell)
- view_type = 2
- end
-
- if self.show_compare_tips then
- self.compare_conta.gameObject:SetActive(true)
- self.compareTips = self.compareTips or HorseEquipCompareTips.New(self.compare_conta, nil, self.layer_name)
-
- self.compareTips:SetData(self.have_equip_data, view_type)
- else
- self.compare_conta.gameObject:SetActive(false)
- end
-
- local cfg = self.horseModel:GetHorseEquipAttrCfg(self.type_id)
- if cfg then
- local quality_cfg = Config.ConfigQualityName.HorseEquipQualityName[cfg.quality]
- if quality_cfg then
- self.career.text = quality_cfg.name
- end
- local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
- local name = nil
- if not self.goods_vo or (self.goods_vo and not self.goods_vo.goods_name) then
- name = basic.goods_name
- else
- name = self.goods_vo and self.goods_vo.goods_name or ""
- end
- self.nameText.text = "<color="..WordManager.GetGoodsColor(cfg.quality)..">"..name.."</color>"
- end
- local equip_info = self.horseModel:GetHorseEquipCfg()
- if cfg and equip_info then
- for k,v in pairs(equip_info) do
- if v and v.equip_type and cfg.pos and v.equip_type == cfg.pos then
- local str = Trim(v.pos_name)
- -- local str_arr = Split(self.goods_vo.goods_name, "·")
- -- self.level.text = str_arr[#str_arr]
- self.level.text = str
- end
- end
- end
-
- self:SetBtns()
- end
-
- function HorseEquipInfoTips:SetCombat(vo, view_type)
- if view_type then
- if view_type == 1 then --穿戴在身上的
- if vo then
- if not self.cell then
- self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
- end
- local cfg = self.horseModel:GetHorseEquipLvCfg(self.cell, vo.lv)
-
- if cfg then
- local grade = self.horseModel:GetHorseEquipAttrCfg(self.goods_vo.type_id).base_rating
- self.composite_score.text = cfg.combat + grade
- end
- end
- elseif view_type == 2 then --在背包、熔炼背包、打造背包
- self.composite_score.text = self.horseModel:GetHorseEquipAttrCfg(self.goods_vo.type_id).base_rating
- end
- end
- end
-
- function HorseEquipInfoTips:GetFightList(dynamic, basic)
- local list = {}
- if basic then
- --基础属性
- local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
- if self.open_type == HorseEquipInfoTips.OFF or self.horseModel:CheckIsWearEquipByVo(self.goods_vo) then --穿戴
- --升级
- if not self.cell then
- self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
- end
- local cfg = self.horseModel:GetHorseEquipLvCfg(self.cell, self.level_vo.lv)
- local equip_pro = ErlangParser:GetInstance():Parse(cfg.attr)
-
- for k,v in pairs(base_pro) do
- local next_attr = {}
- local next_prop = WordManager:GetPropertyValue(tonumber(v[1]),tonumber(v[2]))
- for i,j in pairs(equip_pro) do
- if tonumber(j[1]) == tonumber(v[1]) then
- next_prop = tonumber(next_prop) + tonumber(j[2])
- next_attr.attr_id = tonumber(v[1])
- next_attr.attr_val = next_prop
- local addition_list = self.horseModel.skill_to_attr_addition
- if self.cell and addition_list and addition_list[self.cell] then
- next_attr.attr_val = next_attr.attr_val + next_attr.attr_val*tonumber(addition_list[self.cell])
- end
- end
- end
- table.insert(list, next_attr)
- end
- else
- for i,v in ipairs(base_pro) do
- table.insert(list,{attr_id = v[1],attr_val = v[2]})
- end
- end
- end
-
- --极品属性
- for i,v in ipairs(dynamic.equip_extra_attr) do
- table.insert(list,{attr_id = v.attr_id,attr_val = v.attr_val})
- end
-
- local AllProList = {}
- local tempList = {}
- local mainVo = RoleManager.Instance.mainRoleInfo
- for i,v in ipairs(list) do
- local cfg = Config.ConfigAttributeAddition[v.attr_id]
- if cfg then
- local val = v.attr_val * mainVo[cfg.baseAttrVo] / 10000
- table.insert(tempList,{attr_id = cfg.baseAttr,attr_val = val})
- else
- table.insert(AllProList,v)
- end
- end
- for i,v in ipairs(tempList) do
- table.insert(AllProList,v)
- end
- local endList = {}
- for i,v in ipairs(AllProList) do
- table.insert(endList,{[1] = v.attr_id,[2] = v.attr_val})
- end
- return GetFighting(endList)
- end
-
- --设置基础属性
- function HorseEquipInfoTips:SetProperty(base_pro, stren, pos)
- local name_str = ""
- local pro_str = ""
- local stren_str = ""
- local prop
- local equip_pro
- local next_equip_pro
- if (self.open_type == HorseEquipInfoTips.OFF or self.horseModel:CheckIsWearEquipByVo(self.goods_vo)) and self.level_vo then
- if not self.cell then
- self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
- end
- local cfg = self.horseModel:GetHorseEquipLvCfg(self.cell, self.level_vo.lv)
- equip_pro = ErlangParser:GetInstance():Parse(cfg.attr)
- -- next_equip_pro = ErlangParser:GetInstance():Parse(self.horseModel:GetHorseEquipLvCfg(self.goods_vo.cell, (self.level_vo.lv+1)).attr)
- local addition_list = self.horseModel.skill_to_attr_addition
- if self.cell and addition_list[self.cell] then
- self.base_name.text = "基础属性<color=#4eae1a> [技能加成+"..(tonumber(addition_list[self.cell])*100).."%]</color>"
- end
- end
-
- for i,v in ipairs(base_pro) do
- name_str = name_str .. WordManager:GetProperties(tonumber(v[1]))
-
- prop = WordManager:GetPropertyValue(tonumber(v[1]),tonumber(v[2]))
- if equip_pro and #equip_pro > 0 then
- for x,y in pairs(equip_pro) do
- if y[1] == v[1] then
- prop = tonumber(prop) + tonumber(y[2])
- stren_str = stren_str.."(强化+"..y[2]..")"
- end
- end
- end
-
- pro_str = pro_str.."+" .. prop--WordManager:GetPropertyValue(tonumber(v[1]),tonumber(v[2]))
-
-
- if i < #base_pro then
- name_str = name_str.."\n"
- pro_str = pro_str.."\n"
- stren_str = stren_str.."\n"
- end
- end
- self.baseName.text = name_str
- self.basePro.text = pro_str
- self.strengthAdd.text = "<color="..ColorUtil.GREEN..">"..stren_str.."</color>"
- -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- -- self.strengthAdd.gameObject:SetActive(true)
- -- else
- -- self.strengthAdd.gameObject:SetActive(false)
- -- end
- local off_y = 0
- local line_y = 39
- off_y = self.basePro.preferredHeight + 15
- SetSizeDelta(self.baseName.transform, self.baseName.transform.sizeDelta.x, off_y)
- SetSizeDelta(self.basePro.transform, self.basePro.transform.sizeDelta.x, off_y)
- SetSizeDelta(self.strengthAdd.transform, self.strengthAdd.transform.sizeDelta.x, off_y)
- -- self:SetUnknownView(self.ScrollViewContent, self.basePro.transform, 2, self.strengthAdd)
- end
-
- --设置附加属性
- function HorseEquipInfoTips:SetAddProperty(dynamic)
- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- local cfg = self.horseModel:GetHorseEquipAttrCfg(self.type_id)
- local equip_extra_attr = nil
- if cfg then
- equip_extra_attr = cfg.recommend_attr
- equip_extra_attr = ErlangParser:GetInstance():Parse(equip_extra_attr)
- end
- if equip_extra_attr and #equip_extra_attr > 0 then
- local name_str = ""
- local pro_str = ""
- local recommand = ""
- local extra_attr = {}
- for k,v in pairs(equip_extra_attr) do
- local attr = {}
- attr.color = tonumber(v[2][1])
- attr.attr_id = tonumber(v[2][2])
- if #v[2] == 5 then
- attr.type_id = 1
- attr.plus_interval = tonumber(v[2][4])
- attr.plus_unit = tonumber(v[2][5])
- else
- attr.type_id = 2
- attr.attr_val = tonumber(v[2][3])
- end
- table.insert(extra_attr, attr)
- end
- if extra_attr then
- local function sort_func(vo1,vo2)
- if vo1.color ~= vo2.color then
- return vo1.color < vo2.color
- end
- return vo1.attr_id < vo2.attr_id
- end
- table.sort(extra_attr,sort_func)
-
- for i,v in ipairs(extra_attr) do
- if v.type_id == 1 then
- name_str = name_str .. "<color="..WordManager.GetGoodsColor(v.color)..">"..recommand.."每"..v.plus_interval.."级"..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
- pro_str = pro_str .."<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), tonumber(v.plus_unit)) .. "</color>"
- else
- name_str = name_str .. "<color=" .. WordManager.GetGoodsColor(v.color) .. ">" ..recommand..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
- pro_str = pro_str .. "<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), v.attr_val).."</color>"
- end
- if i < #extra_attr then
- name_str = name_str .. "\n"
- pro_str = pro_str .. "\n"
- end
- end
- end
- self.addName.text = name_str
- self.addPro.text = pro_str
- self.line2.gameObject:SetActive(true)
- self.addName.gameObject:SetActive(true)
- self.addPro.gameObject:SetActive(true)
- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
- SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
- SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
- else
- self.line2.gameObject:SetActive(false)
- self.addName.gameObject:SetActive(false)
- self.addPro.gameObject:SetActive(false)
- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
- SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
- SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
- end
- else
- if dynamic and dynamic.equip_extra_attr then
- local equip_extra_attr = nil
- equip_extra_attr = self.horseModel:SortEquipAttr(dynamic.equip_extra_attr)
- local name_str = ""
- local pro_str = ""
- local recommand = ""
- -- self.add_property_len = #equip_extra_attr
-
- if equip_extra_attr then
- for i,v in ipairs(equip_extra_attr) do
- if v.type_id == 1 then
- name_str = name_str .. "<color="..WordManager.GetGoodsColor(v.color)..">"..recommand.."每"..v.plus_interval.."级"..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
- pro_str = pro_str .."<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), tonumber(v.plus_unit)) .. "</color>"
- else
- name_str = name_str .. "<color=" .. WordManager.GetGoodsColor(v.color) .. ">" ..recommand..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
- pro_str = pro_str .. "<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), v.attr_val).."</color>"
- end
- if i < #equip_extra_attr then
- name_str = name_str .. "\n"
- pro_str = pro_str .. "\n"
- end
- end
- self.addName.text = name_str
- self.addPro.text = pro_str
- self.line2.gameObject:SetActive(true)
- self.addName.gameObject:SetActive(true)
- self.addPro.gameObject:SetActive(true)
- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
- SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
- SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
- end
- else
- self.line2.gameObject:SetActive(false)
- self.addName.gameObject:SetActive(false)
- self.addPro.gameObject:SetActive(false)
- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
- SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
- SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
- end
- end
- -- local cfg = self.horseModel:GetHorseEquipAttrCfg(self.goods_vo.type_id)
- -- local equip_extra_attr = nil
- -- if cfg then
- -- equip_extra_attr = cfg.recommend_attr
- -- equip_extra_attr = ErlangParser:GetInstance():Parse(equip_extra_attr)
- -- end
- -- if equip_extra_attr and #equip_extra_attr > 0 then
- -- -- if dynamic and dynamic.equip_extra_attr then
- -- -- local equip_extra_attr = nil
- -- -- equip_extra_attr = self.horseModel:SortEquipAttr(dynamic.equip_extra_attr)
- -- local name_str = ""
- -- local pro_str = ""
- -- local recommand = ""
- -- -- self.add_property_len = #equip_extra_attr
-
- -- -- if equip_extra_attr then
- -- -- for i,v in ipairs(equip_extra_attr) do
- -- -- if v.type_id == 1 then
- -- -- name_str = name_str .. "<color="..WordManager.GetGoodsColor(v.color)..">"..recommand.."每"..v.plus_interval.."级"..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
- -- -- pro_str = pro_str .."<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), tonumber(v.plus_unit)) .. "</color>"
- -- -- else
- -- -- name_str = name_str .. "<color=" .. WordManager.GetGoodsColor(v.color) .. ">" ..recommand..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
- -- -- pro_str = pro_str .. "<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), v.attr_val).."</color>"
- -- -- end
- -- -- if i < #equip_extra_attr then
- -- -- name_str = name_str .. "\n"
- -- -- pro_str = pro_str .. "\n"
- -- -- end
- -- -- end
- -- -- end
- -- -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- -- -- name_str = name_str.."\n?????????"
- -- -- end
- -- local extra_attr = {}
- -- for k,v in pairs(equip_extra_attr) do
- -- local attr = {}
- -- attr.color = tonumber(v[2][1])
- -- attr.attr_id = tonumber(v[2][2])
- -- if #v[2] == 5 then
- -- attr.type_id = 1
- -- attr.plus_interval = tonumber(v[2][4])
- -- attr.plus_unit = tonumber(v[2][5])
- -- else
- -- attr.type_id = 2
- -- attr.attr_val = tonumber(v[2][3])
- -- end
- -- table.insert(extra_attr, attr)
- -- end
- -- if extra_attr then
- -- local function sort_func(vo1,vo2)
- -- if vo1.color ~= vo2.color then
- -- return vo1.color < vo2.color
- -- end
- -- return vo1.attr_id < vo2.attr_id
- -- end
- -- table.sort(extra_attr,sort_func)
-
- -- for i,v in ipairs(extra_attr) do
- -- if v.type_id == 1 then
- -- name_str = name_str .. "<color="..WordManager.GetGoodsColor(v.color)..">"..recommand.."每"..v.plus_interval.."级"..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
- -- pro_str = pro_str .."<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), tonumber(v.plus_unit)) .. "</color>"
- -- else
- -- name_str = name_str .. "<color=" .. WordManager.GetGoodsColor(v.color) .. ">" ..recommand..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
- -- pro_str = pro_str .. "<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), v.attr_val).."</color>"
- -- end
- -- if i < #extra_attr then
- -- name_str = name_str .. "\n"
- -- pro_str = pro_str .. "\n"
- -- end
- -- end
- -- end
- -- self.addName.text = name_str
- -- self.addPro.text = pro_str
- -- self.line2.gameObject:SetActive(true)
- -- self.addName.gameObject:SetActive(true)
- -- self.addPro.gameObject:SetActive(true)
- -- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
- -- SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
- -- SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
- -- else
- -- self.line2.gameObject:SetActive(false)
- -- self.addName.gameObject:SetActive(false)
- -- self.addPro.gameObject:SetActive(false)
- -- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
- -- SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
- -- SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
- -- end
- -- -- end
- end
-
- -- create_trans 创建物体的节点
- -- last_trans 前面的文本位置 后面的文本以前面的位置为齐
- -- mask_num 箭头的多少个 和 问号的多少个
- -- next_txt 下一个需要设置位置或者大小的物体 这个为text
- -- add_trans_y 当需要对last_trans的y轴做增加数值时 可以加
- -- function HorseEquipInfoTips:SetUnknownView(create_trans, last_trans, mask_num, next_txt, add_trans_y)
- -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- -- if not last_trans or not create_trans then return end
- -- local last_trans_pos_x = last_trans.anchoredPosition.x
- -- local last_trans_pos_y = last_trans.anchoredPosition.y
- -- local last_trans_size_x = last_trans.sizeDelta.x
- -- if add_trans_y then
- -- last_trans_pos_y = last_trans_pos_y + add_trans_y
- -- end
-
- -- local count = mask_num
- -- if count >= 1 then
- -- local image_root
- -- local image_icon
- -- for i = 1, count do
- -- image_root = UiFactory.createChild(create_trans, UIType.ImageExtend)
- -- image_icon = image_root:GetComponent("ImageExtend")
- -- image_root.transform.pivot = Vector2(0,1)
- -- image_root.transform.anchorMin = Vector2(0, 1)
- -- image_root.transform.anchorMax = Vector2(0, 1)
- -- SetSizeDelta(image_root.transform, 33, 21)
- -- SetAnchoredPosition(image_root.transform, last_trans_pos_x + last_trans_size_x, last_trans_pos_y - ((i - 1) * 21))
- -- lua_resM:setImageSprite(self, image_icon, "common_asset", "tyui_jt")
- -- end
- -- end
-
- -- if next_txt then
- -- SetAnchoredPosition(next_txt.transform, last_trans_pos_x + last_trans_size_x + 33, last_trans_pos_y)
- -- local mask_txt = "???"
- -- if mask_num then
- -- while mask_num > 0 do
- -- mask_txt = mask_txt.."\n"..mask_txt
- -- mask_num = mask_num - 1
- -- end
- -- end
- -- next_txt.text = "<color=#835741>"..mask_txt.."</color>"
- -- end
- -- end
- -- end
-
- --按钮显示
- function HorseEquipInfoTips:SetBtns()
- for i,v in ipairs(self.btn_list) do
- v:SetActive(false)
- end
-
- if self.open_type == HorseEquipInfoTips.OFF then
- self.offBtn:SetActive(true)
- self.upgradeBtn:SetActive(true)
- elseif self.open_type == HorseEquipInfoTips.WEAR then
- self.wearBtn:SetActive(true)
- self.smeltBtn:SetActive(true)
- elseif self.open_type == HorseEquipInfoTips.FORGE then
- self.forgeBtn:SetActive(true)
- elseif self.open_type == HorseEquipInfoTips.ONLY_SHOW then
-
- elseif self.open_type == HorseEquipInfoTips.UNKNOWN then
-
- elseif self.open_type == HorseEquipInfoTips.MATERIAL then
- self.takeBtn:SetActive(true)
- self.strengthBtn:SetActive(true)
- end
-
-
- self.line3.gameObject:SetActive(false)
- self.line4.gameObject:SetActive(false)
- self.line5.gameObject:SetActive(false)
- self.line6.gameObject:SetActive(false)
- self.line7.gameObject:SetActive(false)
- self.line8.gameObject:SetActive(false)
- self.line9.gameObject:SetActive(false)
- self.line10.gameObject:SetActive(false)
-
- self.washName.gameObject:SetActive(false)
- self.washPro.gameObject:SetActive(false)
-
- self.spiritName.gameObject:SetActive(false)
- self.spiritPro.gameObject:SetActive(false)
-
- self.stone_conta.gameObject:SetActive(false)
-
- self.suitNum.gameObject:SetActive(false)
- self.suitName.gameObject:SetActive(false)
- self.suitPro.gameObject:SetActive(false)
- self.suitNameList.gameObject:SetActive(false)
-
- self.wake_baseName.gameObject:SetActive(false)
- self.wake_basePro.gameObject:SetActive(false)
- self.wake_baseAdd.gameObject:SetActive(false)
-
- self.wake_strenName.gameObject:SetActive(false)
- self.wake_strenPro.gameObject:SetActive(false)
- self.wake_strenAdd.gameObject:SetActive(false)
-
- self.wake_suitNum.gameObject:SetActive(false)
- self.wake_suitName.gameObject:SetActive(false)
- self.wake_suitPro.gameObject:SetActive(false)
- self.wake_suitAdd.gameObject:SetActive(false)
-
- self.magic_skillName.gameObject:SetActive(false)
- self.magic_skillLevel.gameObject:SetActive(false)
-
- self.expired_label.gameObject:SetActive(false)
- self.descCon.gameObject:SetActive(false)
- end
-
- function HorseEquipInfoTips:SmeltEquipFunc()
- -- if self.goods_vo then
- -- local vo = {goods_id = self.goods_vo.goods_id, num = 1}
- -- local goods_list = {}
- -- table.insert(goods_list, vo)
- -- self.horseModel:Fire(HorsePetEvent.HORSE_EQUIP_SMELT, goods_list)
- -- end
- local list = {}
- table.insert(list, self.goods_vo)
- self.horseModel:Fire(HorsePetEvent.OPEN_HORSE_SPLIT_TIPS, list)
- end
-
- -- function HorseEquipInfoTips:AdjustLayoutPos()
- -- if self.pos_x and self.pos_y then
- -- local layout_width = self.bg.sizeDelta.x + self.btn_conta.sizeDelta.x
- -- local layout_height = self.bg.sizeDelta.y
- -- local x,y = ScreenToViewportPoint(self.pos_x,self.pos_y)
- -- local iphone_x_offset = math.max(ClientConfig.iphone_x_offset_left,ClientConfig.iphone_x_offset_right)
- -- if x + layout_width + 50 + iphone_x_offset * 2 > SrcScreenWidth then
- -- x = SrcScreenWidth - layout_width - 90 - iphone_x_offset * 2
- -- end
- -- if y < layout_height + 50 then
- -- y = layout_height + 50
- -- end
- -- self.layout.anchoredPosition = Vector2(x,y - ScreenHeight)
- -- end
- -- end
-
- --计算父物体大小
- function HorseEquipInfoTips:CalculateSize(dynamic)
- local off_y = 0
- local line_y = 39
- off_y = self.basePro.preferredHeight + 15
- off_y = off_y + line_y
- local show_add = false
- -- if dynamic and dynamic.equip_extra_attr and #dynamic.equip_extra_attr > 0 then
- -- show_add = true
- -- end
- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- local cfg = self.horseModel:GetHorseEquipAttrCfg(self.type_id)
- local equip_extra_attr = nil
- if cfg then
- equip_extra_attr = cfg.recommend_attr
- equip_extra_attr = ErlangParser:GetInstance():Parse(equip_extra_attr)
- end
- if equip_extra_attr and #equip_extra_attr > 0 then
- show_add = true
- end
- else
- if dynamic and dynamic.equip_extra_attr and #dynamic.equip_extra_attr > 0 then
- show_add = true
- end
- end
- if show_add then
- off_y = off_y + line_y
- off_y = off_y + self.addPro.preferredHeight + 10
- -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- -- off_y = off_y + 27
- -- end
- end
- SetSizeDelta(self.ScrollViewContent.transform, self.ScrollViewContent.sizeDelta.x, off_y)
- end
-
- --更新各个控件的位置
- function HorseEquipInfoTips:RefreshPosAndSize(dynamic)
- self.gameObject:SetActive(true)
- self:CalculateSize(dynamic)
- local off_y = 0
- local line_y = 39
- off_y = self.basePro.preferredHeight + 15
- SetSizeDelta(self.baseName.transform, self.baseName.transform.sizeDelta.x, off_y)
- SetSizeDelta(self.basePro.transform, self.basePro.transform.sizeDelta.x, off_y)
- SetSizeDelta(self.strengthAdd.transform, self.strengthAdd.transform.sizeDelta.x, off_y)
- off_y = off_y + line_y
-
- local show_add = false
- -- if dynamic and dynamic.equip_extra_attr and #dynamic.equip_extra_attr > 0 then
- -- show_add = true
- -- end
- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- local cfg = self.horseModel:GetHorseEquipAttrCfg(self.type_id)
- local equip_extra_attr = nil
- if cfg then
- equip_extra_attr = cfg.recommend_attr
- equip_extra_attr = ErlangParser:GetInstance():Parse(equip_extra_attr)
- end
- if equip_extra_attr and #equip_extra_attr > 0 then
- show_add = true
- end
- else
- if dynamic and dynamic.equip_extra_attr and #dynamic.equip_extra_attr > 0 then
- show_add = true
- end
- end
- if show_add then
- self.line2.gameObject:SetActive(true)
- self.addName.gameObject:SetActive(true)
- self.addPro.gameObject:SetActive(true)
-
- self.line2.localPosition = Vector3(0, -off_y, 0)
- off_y = off_y + line_y
-
- --显示推荐属性
- -- if self.type and self.type == EquipShowTips.EQUIP_RECOMMAND_TARGET then
- -- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
- -- SetSizeDelta(self.addPro.transform, self.addPro.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
- -- SetLocalPosition(self.addName.transform,self.addName.transform.localPosition.x, -off_y)
- -- SetLocalPosition(self.addPro.transform, 160, -off_y)
- -- else
- SetSizeDelta(self.addName.transform, self.addName.transform.sizeDelta.x, self.addName.preferredHeight + 15)
- SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
- SetLocalPosition(self.addName.transform, self.addName.transform.localPosition.x, -off_y)
- SetLocalPosition(self.addPro.transform, self.addPro.transform.localPosition.x, -off_y)
- -- end
- off_y = off_y + self.addPro.preferredHeight + 10
- -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
- -- off_y = off_y + 27
- -- end
- else
- self.line2.gameObject:SetActive(false)
- self.addName.gameObject:SetActive(false)
- self.addPro.gameObject:SetActive(false)
- end
-
- SetSizeDelta(self.ScrollViewContent.transform, self.ScrollViewContent.sizeDelta.x, off_y)
-
- SetSizeDelta(self.ScrollView.transform, self.ScrollView.sizeDelta.x, off_y)
- SetSizeDelta(self.ScrollViewViewport.transform, self.ScrollViewViewport.sizeDelta.x, off_y)
-
- SetSizeDelta(self.bg.transform, self.bg.sizeDelta.x, off_y - self.ScrollView.localPosition.y + 15 + (self.depot_conta.gameObject.activeSelf and 30 or 0))
-
- self.btn_conta.anchoredPosition = Vector2(self.btn_conta.anchoredPosition.x, -(self.bg.sizeDelta.y - 100 - 15))
- self.gameObject:SetActive(true)
- end
|