2023-07-14 19:35:33 +00:00
|
|
|
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
|
2023-07-14 19:35:33 +00:00
|
|
|
self.CreateTime = 0
|
2024-09-01 20:49:41 +00:00
|
|
|
self.HideTime = 0
|
2023-07-14 19:35:33 +00:00
|
|
|
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)
|
2023-07-14 19:35:33 +00:00
|
|
|
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
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function XUiGuildDormTalkGrid:UpdateTransform()
|
2024-09-01 20:49:41 +00:00
|
|
|
self.CurrentRoom:SetViewPosToTransformLocalPosition(self.Transform, self.Entity:GetRLEntity():GetTransform(), self.Offset)
|
2023-07-14 19:35:33 +00:00
|
|
|
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()
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return XUiGuildDormTalkGrid
|