源战役客户端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 

151 行
6.4 KiB

PsionicToolTipsItem = PsionicToolTipsItem or BaseClass(BaseItem)
local PsionicToolTipsItem = PsionicToolTipsItem
local string_format = string.format
function PsionicToolTipsItem:__init(parent_wnd,prefab_asset,layer_name)
self.base_file = "common"
self.layout_file = "PsionicToolTipsItem"
self.parent_wnd = parent_wnd
self.layer_name = layer_name
self.model = PsionicModel:getInstance()
self.awake_pro_imgs = {} -- 圣物觉醒进度表现
self:Load()
end
function PsionicToolTipsItem:Load_callback()
local nodes = {
-- 标题
"title:obj", "title/title_lb:tmp",
"title/title_extra", "title/title_extra/title_extra_lb:tmp",
-- 配置属性描述
"attr_basic:obj",
"attr_basic/attr_basic_lb:tmp",
"attr_basic/attr_arrow:obj:img", "attr_basic/attr_basic_dif:tmp",
-- 洗练属性描述
"attr_wash:obj", "attr_wash/wash_icon:imgex",
"attr_wash/attr_wash_lb:tmp",
-- 装备技能描述
"attr_break:obj",
"attr_break/attr_break_lb:tmp",
}
self:GetChildren(nodes)
self:AddEvents()
if self.need_refreshData then
self:UpdateView()
end
end
function PsionicToolTipsItem:AddEvents( )
end
function PsionicToolTipsItem:UpdateView( )
local height = 0
-- 初始化节点
self:InitCons()
if self.data.title then -- 标题
self.title_obj:SetActive(true)
self.title_lb_tmp.text = self.data.title
local ex_data = self.data.title_extra
if ex_data then -- 有标题额外参数
local awake_req = PsionicConst.RequireEquipColor[PsionicConst.TabId.PSkill] -- 品质需求前端配置
self.title_extra_lb_tmp.text = ex_data.equip_color < awake_req.color
and string_format("<color=%s>橙品圣物可激活</color>", ColorUtil.RED_DARK)
or (ex_data.has_weared and ex_data.has_weared.color >= awake_req.color
and string_format("<color=#fdffc2>%s段</color>", ChineseNumber(ex_data.awake_lv))
or string_format("<color=%s>穿戴可激活</color>", ColorUtil.RED_DARK))
-- 觉醒需要有进度表现
if ex_data.equip_color >= awake_req.color and ex_data.has_weared and ex_data.has_weared.color >= awake_req.color then
for i = 1, 6 do
self.awake_pro_imgs[i] = self.awake_pro_imgs[i] or UiFactory.createChild(self.title_extra, UIType.Image, "pro" .. i)
SetAnchoredPosition(self.awake_pro_imgs[i].transform, (i-3) * 12 + 25, 0)
lua_resM:setImageSprite(self, self.awake_pro_imgs[i]:GetComponent("Image"), "common_asset",
i <= ex_data.awake_lv and "ps_skill_pro1" or "ps_skill_pro0", true)
end
end
else
self.title_extra_lb_tmp.text = ""
end
height = 28
elseif self.data.attr_basic then -- 基础属性
self.attr_basic_obj:SetActive(true)
local attr_type = WordManager:GetProperties(self.data.attr_basic[1])
-- 属性值要加上槽位等级带来的等级提升属性量
local attr_val = WordManager:GetPropertyValue(self.data.attr_basic[1], self.data.attr_basic[2] + self.data.add_attr * self.data.slot_lv)
self.attr_basic_lb_tmp.text = attr_type .. " " .. string_format("<color=%s>+%s</color>", ColorUtil.GREEN_DARK, attr_val)
if self.data.show_diff then -- 有展示属性差距的要求,传入的内容是对比的属性值
self.attr_basic_dif_tmp.text = self.data.show_diff ~= 0 and
string_format("<color=%s>%s</color>",
self.data.show_diff > 0 and ColorUtil.GREEN_DARK or ColorUtil.RED_DARK,
WordManager:GetPropertyValue(self.data.attr_basic[1], math.abs(self.data.show_diff)))
or ""
lua_resM:setImageSprite(self, self.attr_arrow_img, "common_asset", self.data.show_diff > 0 and "tyui_Arrow_3" or "tyui_Arrow_4")
self.attr_arrow_obj:SetActive(self.data.show_diff ~= 0)
-- 移动箭头位置
if self.data.show_diff ~= 0 then
SetAnchoredPositionX(self.attr_arrow, self.attr_basic_lb.anchoredPosition.x + self.attr_basic_lb_tmp.preferredWidth + 8)
SetAnchoredPositionX(self.attr_basic_dif, self.attr_arrow.anchoredPosition.x + 25)
end
else
self.attr_basic_dif_tmp.text = ""
self.attr_arrow_obj:SetActive(false)
end
height = 24 + (self.data.is_last and 7 or 0)
elseif self.data.attr_wash then -- 洗练属性
self.attr_wash_obj:SetActive(true)
local attr_type = self.data.attr_wash[1]
local attr_max_val = self.data.attr_wash[2]
self.attr_wash_lb_tmp.text = string_format("%s <color=%s>+%s</color> / %s",
WordManager:GetProperties(attr_type),
ColorUtil.GREEN_DARK,
self.data.cur_val,
WordManager:GetPropertyValue(attr_type, attr_max_val))
-- 洗练属性满了才显示左侧小点
self.wash_icon_imgex.enabled = self.data.cur_val >= attr_max_val
height = 24 + (self.data.is_last and 7 or 0)
elseif self.data.skill_data then -- 技能数据
self.attr_break_obj:SetActive(true)
local attr_type = self.data.skill_data[1]
local attr_val = self.data.skill_data[2]
self.attr_break_lb_tmp.text = string_format("%s <color=%s>+%s</color>",
WordManager:GetProperties(attr_type),
ColorUtil.GREEN_DARK,
WordManager:GetPropertyValue(attr_type, attr_val))
height = 24 + (self.data.is_last and 7 or 0)
end
return height
end
-- 初始化界面显示
function PsionicToolTipsItem:InitCons( )
if self.title_obj.activeSelf then
self.title_obj:SetActive(false)
end
if self.attr_basic_obj.activeSelf then
self.attr_basic_obj:SetActive(false)
end
if self.attr_wash_obj.activeSelf then
self.attr_wash_obj:SetActive(false)
end
if self.attr_break_obj.activeSelf then
self.attr_break_obj:SetActive(false)
end
end
function PsionicToolTipsItem:SetData( data )
local height = 0
self.data = data
if self.is_loaded then
self.need_refreshData = false
height = self:UpdateView()
else
self.need_refreshData = true
end
return height
end
function PsionicToolTipsItem:__delete( )
end