源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
1.1 KiB

HistroyItem = HistroyItem or BaseClass(BaseItem)
function HistroyItem:__init()
self.base_file = "chat"
self.layout_file = "histroyItem"
self.model = ChatModel:getInstance()
self.index = nil
self.vo = nil
self.text = nil
self:Load()
end
function HistroyItem:Load_callback()
self.select = self:GetChild("Select").gameObject
self.select:SetActive(false)
self.text = self:GetChild("Text"):GetComponent("Text")
if self.need_refreshData then
self:SetData()
end
local function onClickBtnHandler()
self.model:SeletedHistroyItem(self)
end
AddClickEvent(self.gameObject,onClickBtnHandler)
end
--获取发送人为自己的信息
function HistroyItem:SetData(index,vo)
self.index = index or self.index
self.vo = vo or self.vo
if self.is_loaded then
-- 248 -88 --242 -81
self.need_refreshData = false
self.text.text = self.vo
self.transform.localPosition = Vector3((self.index - 1) % 4 * 242 +6, math.floor((self.index - 1) / 4) * -81 -4,0)
else
self.need_refreshData = true
end
end
function HistroyItem:SetSelect(bool)
if bool then
self.select:SetActive(true)
else
self.select:SetActive(false)
end
end