源战役客户端
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

73 righe
2.2 KiB

HistoryTextItem = HistoryTextItem or BaseClass(BaseItem)
function HistoryTextItem:__init()
self.base_file = "chat"
self.layout_file = "HistoryTextItem"
-- self.use_local_view = true
self.model = ChatModel:getInstance()
self.str = false
self:Load()
end
function HistoryTextItem:Load_callback()
self.select ,
self.textObj,
self.bg
= GetChildGameObjects(self.transform,{
"Select",
"Text",
"bg"
})
self.select:SetActive(false)
self.text
= GetChildTexts(self.transform,{
"Text"
})
local function onClickBtnHandler(target)
if target == self.textObj then
if self.str then
self.model:SeletedHistoryTextItem(self)
end
-- elseif target == self.addBtn then
-- GlobalEventSystem:Fire(EventName.OPEN_CHAT_CUSTOM_TEXT_VIEW, self.index)
-- elseif target == self.delBtn then
-- local cookie = CookieWrapper.Instance:GetCookie(CookieLevelType.Account, CookieKey.CHAT_CUSTOM_TEXT)
-- if cookie and cookie[self.index] then
-- cookie[self.index] = nil
-- CookieWrapper.Instance:SaveCookie(CookieLevelType.Account, CookieTimeType.TYPE_ALWAYS, CookieKey.CHAT_CUSTOM_TEXT, cookie)
-- Message.show("删除成功")
-- self.model:Fire(ChatModel.UPDATE_INDIVID_VIEW)
-- end
end
end
AddClickEvent(self.textObj, onClickBtnHandler)
if self.need_refreshData then
self:SetData(self.str)
end
end
function HistoryTextItem:SetData(str)
self.str = str
if self.is_loaded then
SetInlineText(self.text, str)
-- self.text.text = str
self.need_refreshData = false
-- local cookie = CookieWrapper.Instance:GetCookie(CookieLevelType.Account, ChatModel.SAVE_CHAT_HISTORY_INFO)
-- if cookie and cookie[self.index] then
-- self.save_text = cookie[self.index]
-- end
else
self.need_refreshData = true
end
end
function HistoryTextItem:SetSelect(bool)
if bool then
self.select:SetActive(true)
else
self.select:SetActive(false)
end
end