SealProTips = SealProTips or BaseClass(BaseView)
|
|
|
|
function SealProTips:__init()
|
|
self.base_file = "common"
|
|
self.layout_file = "SealProTips"
|
|
self.layer_name = "Top"
|
|
|
|
self.model = SealModel:getInstance()
|
|
self.event_list = {}
|
|
|
|
self.use_background = true
|
|
self.click_bg_toClose = true
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
end
|
|
self.open_callback = function ()
|
|
self:SetPro()
|
|
end
|
|
self.close_callback = function ()
|
|
end
|
|
self.destroy_callback = function ()
|
|
self:Remove()
|
|
end
|
|
end
|
|
|
|
function SealProTips:LoadSuccess()
|
|
self.title = self:GetChild("text"):GetComponent("Text")
|
|
self.proText = self:GetChild("itemScrollView/Viewport/Content/text"):GetComponent("Text")
|
|
self.content = self:GetChild("itemScrollView/Viewport/Content")
|
|
|
|
self:InitEvent()
|
|
end
|
|
|
|
function SealProTips:InitEvent()
|
|
local function update_func()
|
|
self:SetPro()
|
|
end
|
|
table.insert(self.event_list, self.model:Bind(SealModel.UPDATE_SOUL_PRO, update_func))
|
|
|
|
end
|
|
|
|
function SealProTips:Open(x, y)
|
|
--[[self.pos_x = x - 510
|
|
self.pos_y = y - 180
|
|
if self.pos_y < -80 then
|
|
self.pos_y = -80
|
|
end
|
|
self.position = Vector2(self.pos_x, self.pos_y)--]]
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
--加载可添加的item
|
|
function SealProTips:SetPro()
|
|
local list = self.model:GetSealPro()
|
|
local arg = {"id"}
|
|
local condition = {Array.LOWER}
|
|
SortTools.MoreKeysSorter(list, arg, condition)
|
|
local str = ""
|
|
for i, v in ipairs(list) do
|
|
str = str .. WordManager:GetProperties(v.id).."<color="..ColorUtil.GREEN.."> +"..WordManager:GetPropertyValue(v.id, v.value).."</color>\n"
|
|
end
|
|
|
|
--[[local str = ""
|
|
for i, v in ipairs(list_1) do
|
|
str = str .. WordManager:GetProperties(v.id).."<color="..ColorUtil.GREEN.."> +"..WordManager:GetPropertyValue(v.id, v.value)
|
|
if v.stren and v.stren > 0 then
|
|
str = str .. "(强化+" .. v.stren .. ")"
|
|
end
|
|
str = str .. "</color>\n"
|
|
end
|
|
for i, v in ipairs(list_2) do
|
|
str = str .. "每"..v.value.."级"..WordManager:GetProperties(v.id).."<color="..ColorUtil.GREEN.."> +"..WordManager:GetPropertyValue(v.id, v.value).."</color>\n"
|
|
end--]]
|
|
|
|
self.proText.text = str
|
|
self.proText.transform.sizeDelta = Vector2(self.proText.transform.sizeDelta.x, self.proText.preferredHeight + 15)
|
|
self.content.sizeDelta = Vector2(self.content.sizeDelta.x, self.proText.preferredHeight + 20)
|
|
end
|
|
|
|
function SealProTips:Remove()
|
|
for i, v in ipairs(self.event_list) do
|
|
self.model:UnBind(v)
|
|
v = nil
|
|
end
|
|
self.event_list = {}
|
|
end
|