This commit is contained in:
fatiao 2026-03-04 17:58:11 +08:00
commit f4ea1f0c11
3 changed files with 2117 additions and 31 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,32 @@
---@class LiveRoomItem__Generate_floatingHeart_item5
---@field public gameObject UnityEngine.GameObject
---@field public canvasGroup UnityEngine.CanvasGroup
---@class LiveRoomItem__Generate_floatingHeart_item4
---@field public gameObject UnityEngine.GameObject
---@field public canvasGroup UnityEngine.CanvasGroup
---@class LiveRoomItem__Generate_floatingHeart_item3
---@field public gameObject UnityEngine.GameObject
---@field public canvasGroup UnityEngine.CanvasGroup
---@class LiveRoomItem__Generate_floatingHeart_item2
---@field public gameObject UnityEngine.GameObject
---@field public canvasGroup UnityEngine.CanvasGroup
---@class LiveRoomItem__Generate_floatingHeart_item1
---@field public gameObject UnityEngine.GameObject
---@field public canvasGroup UnityEngine.CanvasGroup
---@class LiveRoomItem__Generate_floatingHeart
---@field public gameObject UnityEngine.GameObject
---@field public rectTransform UnityEngine.RectTransform
---@field public item1 LiveRoomItem__Generate_floatingHeart_item1
---@field public item2 LiveRoomItem__Generate_floatingHeart_item2
---@field public item3 LiveRoomItem__Generate_floatingHeart_item3
---@field public item4 LiveRoomItem__Generate_floatingHeart_item4
---@field public item5 LiveRoomItem__Generate_floatingHeart_item5
---@class LiveRoomItem__Generate_timer_text_time
---@field public gameObject UnityEngine.GameObject
---@field public text TMPro.TextMeshProUGUI
@ -1447,6 +1476,7 @@
---@field private items UnityEngine.GameObject
---@field private idlePad UnityEngine.GameObject
---@field private timer LiveRoomItem__Generate_timer
---@field private floatingHeart LiveRoomItem__Generate_floatingHeart
local LiveRoomItemView = class("LiveRoomItemView")
function LiveRoomItemView:ctor()
@ -1808,6 +1838,12 @@ function LiveRoomItemView:InitGenerate(Root, data)
self:InitGenerate__343(Root,data)
self:InitGenerate__344(Root,data)
self:InitGenerate__345(Root,data)
self:InitGenerate__346(Root,data)
self:InitGenerate__347(Root,data)
self:InitGenerate__348(Root,data)
self:InitGenerate__349(Root,data)
self:InitGenerate__350(Root,data)
self:InitGenerate__351(Root,data)
end
@ -6408,8 +6444,107 @@ function LiveRoomItemView:InitGenerate__345(Root, data)
tmp.text = tmp:GetComponent(Enum.TypeInfo.TextMeshProUGUI)
end
---@private
function LiveRoomItemView:InitGenerate__346(Root, data)
--[[
FloatingHeart
--]]
local tmp = Root:Find("FloatingHeart").gameObject
if tolua.getpeer(tmp) == nil then
tolua.setpeer(tmp, {})
end
self.floatingHeart = tmp
tmp.rectTransform = tmp:GetComponent(Enum.TypeInfo.RectTransform)
end
---@private
function LiveRoomItemView:InitGenerate__347(Root, data)
--[[
FloatingHeart/item1
--]]
local tmp = Root:Find("FloatingHeart/item1").gameObject
if tolua.getpeer(tmp) == nil then
tolua.setpeer(tmp, {})
end
self.floatingHeart.item1 = tmp
tmp.canvasGroup = tmp:GetComponent(Enum.TypeInfo.CanvasGroup)
end
---@private
function LiveRoomItemView:InitGenerate__348(Root, data)
--[[
FloatingHeart/item2
--]]
local tmp = Root:Find("FloatingHeart/item2").gameObject
if tolua.getpeer(tmp) == nil then
tolua.setpeer(tmp, {})
end
self.floatingHeart.item2 = tmp
tmp.canvasGroup = tmp:GetComponent(Enum.TypeInfo.CanvasGroup)
end
---@private
function LiveRoomItemView:InitGenerate__349(Root, data)
--[[
FloatingHeart/item3
--]]
local tmp = Root:Find("FloatingHeart/item3").gameObject
if tolua.getpeer(tmp) == nil then
tolua.setpeer(tmp, {})
end
self.floatingHeart.item3 = tmp
tmp.canvasGroup = tmp:GetComponent(Enum.TypeInfo.CanvasGroup)
end
---@private
function LiveRoomItemView:InitGenerate__350(Root, data)
--[[
FloatingHeart/item4
--]]
local tmp = Root:Find("FloatingHeart/item4").gameObject
if tolua.getpeer(tmp) == nil then
tolua.setpeer(tmp, {})
end
self.floatingHeart.item4 = tmp
tmp.canvasGroup = tmp:GetComponent(Enum.TypeInfo.CanvasGroup)
end
---@private
function LiveRoomItemView:InitGenerate__351(Root, data)
--[[
FloatingHeart/item5
--]]
local tmp = Root:Find("FloatingHeart/item5").gameObject
if tolua.getpeer(tmp) == nil then
tolua.setpeer(tmp, {})
end
self.floatingHeart.item5 = tmp
tmp.canvasGroup = tmp:GetComponent(Enum.TypeInfo.CanvasGroup)
end
---@private
function LiveRoomItemView:GenerateDestroy()
if tolua.getpeer(self.floatingHeart.item5) ~= nil then
tolua.setpeer(self.floatingHeart.item5, nil)
end
if tolua.getpeer(self.floatingHeart.item4) ~= nil then
tolua.setpeer(self.floatingHeart.item4, nil)
end
if tolua.getpeer(self.floatingHeart.item3) ~= nil then
tolua.setpeer(self.floatingHeart.item3, nil)
end
if tolua.getpeer(self.floatingHeart.item2) ~= nil then
tolua.setpeer(self.floatingHeart.item2, nil)
end
if tolua.getpeer(self.floatingHeart.item1) ~= nil then
tolua.setpeer(self.floatingHeart.item1, nil)
end
if tolua.getpeer(self.timer.text_time) ~= nil then
tolua.setpeer(self.timer.text_time, nil)
end
@ -7501,6 +7636,10 @@ function LiveRoomItemView:GenerateDestroy()
tolua.setpeer(self.timer, nil)
end
self.timer = nil
if tolua.getpeer(self.floatingHeart) ~= nil then
tolua.setpeer(self.floatingHeart, nil)
end
self.floatingHeart = nil
self.transform = nil
self.gameObject = nil
self.inited = false

View File

@ -758,13 +758,20 @@ function UILiveRoomView:InitChat(itemlua, room_id)
end, nil)
itemlua.inputBar.sv_gift.loopGridView:SetListItemCount(#giftCfg)
--爱心
self:Init_FloatingHeart(itemlua)
self.uiBase:AddButtonUniqueEventListener(itemlua.inputBar.btn_send_emoji.button, self,
function() self:Btn_Send_Emoji(itemlua) end)
self.uiBase:AddButtonUniqueEventListener(itemlua.inputBar.btn_send_gift.button, self,
function() self:Btn_Send_Gift(itemlua) end)
self.uiBase:AddButtonUniqueEventListener(itemlua.inputBar.btn_send_like.button, self,
function() ManagerContainer.DataMgr.LiveRoomData:AddHeart() end)
function()
ManagerContainer.DataMgr.LiveRoomData:AddHeart()
--点击爱心
self:Gen_FloatingHeart(itemlua)
end)
itemlua.inputBar.sv_emoji:SetActive(false)
itemlua.inputBar.sv_gift:SetActive(false)
end
@ -2040,6 +2047,8 @@ end
local istimerhide=false
local timerhidetime=0.6
function UILiveRoomView:ResetStageTimer(timerVal)
self.currStageTimerVal = timerVal
if self.currStageTimer then
@ -2072,12 +2081,99 @@ function UILiveRoomView:RefreshStageTimer(timerVal)
end
itemLua.timer.text_name.text.text = name
itemLua.timer.text_time.text.text = tostring(timerVal)
if timerVal <= (timerhidetime + 1) then
self:OnTimerHide()
end
if timerVal>(2+timerhidetime) and istimerhide then
self:OnTimerShow()
end
end
--endregion 计时器相关
function UILiveRoomView:OnTimerHide()
if istimerhide==true then return end
local timer = self:GetCurrPageLua().timer
local seq=DG.Tweening.DOTween.Sequence()
seq:Append(timer.transform:DOAnchorPosX( 300, timerhidetime))
seq:OnComplete(function()
istimerhide = true
end)
end
function UILiveRoomView:OnTimerShow()
if istimerhide==false then return end
local timer = self:GetCurrPageLua().timer
local seq=DG.Tweening.DOTween.Sequence()
seq:Append(timer.transform:DOAnchorPosX(0, timerhidetime))
seq:OnComplete(function()
istimerhide = false
end)
end
function UILiveRoomView:Init_FloatingHeart(itemlua)
self.FloatingHeart = {
[1] = itemlua.floatingHeart.item1,
[2] = itemlua.floatingHeart.item2,
[3] = itemlua.floatingHeart.item3,
[4] = itemlua.floatingHeart.item4,
[5] = itemlua.floatingHeart.item5
}
for k, v in pairs(self.FloatingHeart) do
v.active = false
v.canvasGroup.alpha = 0
end
end
function UILiveRoomView:Gen_FloatingHeart(itemlua)
self.FloatingHeart = {
[1] = itemlua.floatingHeart.item1,
[2] = itemlua.floatingHeart.item2,
[3] = itemlua.floatingHeart.item3,
[4] = itemlua.floatingHeart.item4,
[5] = itemlua.floatingHeart.item5
}
local id;
for k, v in pairs(self.FloatingHeart) do
if not v.active then
id = k
v.active = true
break
end
end
if id then
local center = itemlua.floatingHeart.rectTransform.anchoredPosition
LogWarning("center:"..center.x..","..center.y)
--center.x = center.x + math.random(-30, 30)
--center.y = center.y + math.random(-30, 30)
local screenWidth = UnityEngine.Screen.width
local screenHeight = UnityEngine.Screen.height
local endPos = Vector2(-screenWidth+145-center.x, screenHeight-100-center.y)
local item = self.FloatingHeart[id]
item.transform.localPosition = Vector2(0,0)
local time1 = 0.5
local seq = DG.Tweening.DOTween.Sequence()
seq:Append(item.transform:DOLocalMoveY(70, time1))
seq:Join(item.canvasGroup:DOFade(1, time1 * 0.6))
--seq:AppendInterval(0.3)
seq:Append(item.transform:DOLocalMove(endPos,2))
seq:Append(item.canvasGroup:DOFade(0, time1))
seq:OnComplete(function()
item.active = false
end)
end
end