源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

44 行
1.2 KiB

PropItem = PropItem or BaseClass(BaseItem)
function PropItem:__init()
self.base_file = "common"
self.layout_file = "PropItem"
self.is_delay_callback = true
--self.use_local_view = true
self:Load()
end
function PropItem:Load_callback()
self.title = self:GetChild("title"):GetComponent("Text")
self.value = self:GetChild("value"):GetComponent("Text")
self.up = self:GetChild("up").gameObject
self.up_value = self:GetChild("up/value"):GetComponent("Text")
if self.need_refreshData then
self:SetData(self.now_attr,self.next_attr,self.module_id)
end
end
function PropItem:SetData(now_attr,next_attr,module_id)
self.now_attr = now_attr
self.next_attr = next_attr
self.module_id = module_id
if self.is_loaded then
if now_attr == nil then return end
self.title.text = WordManager:GetProperties(tonumber(now_attr[1]),module_id)..""
self.value.text = WordManager:GetPropertyValue(tonumber(now_attr[1]),tonumber(now_attr[2]))
local up_val = 0
if next_attr ~= nil then
up_val = tonumber(next_attr[2]) - tonumber(now_attr[2])
up_val = up_val > 0 and up_val or 0
end
self.up:SetActive(up_val > 0)
self.up_value.text = up_val
else
self.need_refreshData = true
end
end
function PropItem:__delete()
end