PGRData/Script/matrix/xui/xuiguilddorm/XUiGuildDormTalkGrid.lua

51 lines
1.6 KiB
Lua
Raw Normal View History

local Time = CS.UnityEngine.Time
local XUiGuildDormTalkGrid = XClass(nil, "XUiGuildDormTalkGrid")
function XUiGuildDormTalkGrid:Ctor(ui)
XUiHelper.InitUiClass(self, ui)
self.CurrentRoom = XDataCenter.GuildDormManager.GetCurrentRoom()
2024-09-01 20:49:41 +00:00
self.Entity = nil
self.CreateTime = 0
2024-09-01 20:49:41 +00:00
self.HideTime = 0
end
2024-09-01 20:49:41 +00:00
function XUiGuildDormTalkGrid:SetData(entity, content, isEmoji, hideTime)
if hideTime == nil or hideTime <= 0 then hideTime = XGuildDormConfig.GetTalkHideTime() end
self.HideTime = hideTime
self.Entity = entity
self.Offset = CS.UnityEngine.Vector3(0, entity:GetTalkHeightOffset(), 0)
self.PanelText.gameObject:SetActiveEx(not isEmoji)
self.PanelEmoji.gameObject:SetActiveEx(isEmoji)
if isEmoji then
self.RImgEmoji:SetRawImage(XDataCenter.ChatManager.GetEmojiIcon(content))
else
self.TxtDesc.text = content
end
self.CreateTime = Time.realtimeSinceStartup
end
function XUiGuildDormTalkGrid:GetIsArriveHideTime()
2024-09-01 20:49:41 +00:00
return Time.realtimeSinceStartup - self.CreateTime >= self.HideTime / 1000
end
function XUiGuildDormTalkGrid:UpdateTransform()
2024-09-01 20:49:41 +00:00
self.CurrentRoom:SetViewPosToTransformLocalPosition(self.Transform, self.Entity:GetRLEntity():GetTransform(), self.Offset)
end
function XUiGuildDormTalkGrid:Hide()
self.GameObject:SetActiveEx(false)
end
function XUiGuildDormTalkGrid:Show(parent)
self.GameObject:SetActiveEx(true)
if parent then
self.Transform:SetParent(parent, false)
end
end
2024-09-01 20:49:41 +00:00
function XUiGuildDormTalkGrid:GetEntityId()
return self.Entity:GetEntityId()
end
return XUiGuildDormTalkGrid