直播间点赞功能

This commit is contained in:
fatiao 2026-03-04 12:40:57 +08:00
parent 6ee23c01cb
commit 14723b482d
4 changed files with 140 additions and 42 deletions

View File

@ -4325,8 +4325,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 130, y: -30}
m_SizeDelta: {x: 200, y: 30}
m_AnchoredPosition: {x: 165, y: -30}
m_SizeDelta: {x: 155, y: 40}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &7925542868766603261
CanvasRenderer:
@ -4356,7 +4356,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "1\u4E07\u672C\u573A\u70B9\u8D5E"
m_text: 10000
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: ff9a33292f9ee2e4bb6b5beaa43eb505, type: 2}
m_sharedMaterial: {fileID: 21889736603187208, guid: ff9a33292f9ee2e4bb6b5beaa43eb505,
@ -4384,15 +4384,15 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 24.65
m_fontSizeBase: 36
m_fontSize: 30
m_fontSizeBase: 30
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontSizeMax: 30
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
@ -7280,9 +7280,9 @@ RectTransform:
- {fileID: 2264348959941013774}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 572.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7123559852210247449
@ -16328,9 +16328,9 @@ RectTransform:
- {fileID: 9098074536275429445}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 362.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7242641719228348083
@ -17527,9 +17527,9 @@ RectTransform:
- {fileID: 8960957652178141439}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 992.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4863064043221393967
@ -17740,9 +17740,9 @@ RectTransform:
- {fileID: 2263461288545407719}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 47.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6286738948952423829
@ -25599,9 +25599,9 @@ RectTransform:
- {fileID: 3252053939958040628}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 677.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6847939996159611283
@ -25809,6 +25809,7 @@ RectTransform:
m_Children:
- {fileID: 2808773462096919275}
- {fileID: 7057486274064682888}
- {fileID: 1234101773523678049}
- {fileID: 4528909271926664940}
m_Father: {fileID: 7428115698804564096}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -29528,9 +29529,9 @@ RectTransform:
- {fileID: 4335789157840758689}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 887.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7312909129957150248
@ -33518,9 +33519,9 @@ RectTransform:
- {fileID: 7507344249561322973}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 152.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4373079736099867411
@ -34986,9 +34987,9 @@ RectTransform:
- {fileID: 3685485050247075530}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 467.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7034374317899172211
@ -35342,9 +35343,9 @@ RectTransform:
- {fileID: 201288052656005517}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 782.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3729285574982894415
@ -41788,8 +41789,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 130, y: 27}
m_SizeDelta: {x: 150, y: 60}
m_AnchoredPosition: {x: 120, y: 27}
m_SizeDelta: {x: 180, y: 60}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &3762694675831197056
CanvasRenderer:
@ -47215,6 +47216,81 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &7291366096014836520
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1234101773523678049}
- component: {fileID: 2867763060406993757}
- component: {fileID: 2409976052883394247}
m_Layer: 5
m_Name: HeartIcon
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1234101773523678049
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7291366096014836520}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3050849959323490982}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 120, y: -30}
m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &2867763060406993757
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7291366096014836520}
m_CullTransparentMesh: 1
--- !u!114 &2409976052883394247
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7291366096014836520}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 349b101b1728ce24ab3f882aeeb36045, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &7303524022131245271
GameObject:
m_ObjectHideFlags: 0
@ -47531,9 +47607,9 @@ RectTransform:
- {fileID: 1558870460956258642}
m_Father: {fileID: 7025420972156680222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 257.5, y: -94}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2896725619175466137

View File

@ -612,7 +612,7 @@ local UIEventNames = {
SC_LIVE_ROOM_RESULT_NTF = id(),
SC_LIVE_ROOM_SEND_GIFT_NTF = id(),
SC_LIVE_ROOM_SHOW_SUBMIT_ACK=id(),
SC_LIVE_ROOM_ADD_HEART_ACK=id(),
LIVEROOM_RES_STREAMER_LOAD_OK = id(),

View File

@ -11,6 +11,7 @@ function LiveRoomData:RegisterNetEvents()
if data.error == Enum.NetErrorCode.ERROR_OK then
self.data["room_type"] = data.room_type
self.data["room_id"] = data.room_id
self.data["heart"] = data.heart
self.data["stage"] = data.stage
self.data["stage_timer_sec"] = data.stage_timer_sec
self.data["stage_sec"] = data.stage_sec
@ -19,7 +20,6 @@ function LiveRoomData:RegisterNetEvents()
self.data["chat_records"]=data.chat_datas
self.data["room_user_num"] = data.room_user_num
self.data["room_user_heads"] = data.room_user_heads
LogWarning("tzy_join_ack: " .. Inspect(data))
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.SC_LIVE_ROOM_JOIN_ACK,data)
LogError("SC_LIVE_ROOM_JOIN_ACK: join room_id=" .. data.room_id)
end
@ -115,6 +115,8 @@ function LiveRoomData:RegisterNetEvents()
end)
ManagerContainer.NetManager:NetRegister(ProtoMsgId.SC_LIVE_ROOM_ADD_HEART_ACK, function(data)
self.data["heart"] = data.heart
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.SC_LIVE_ROOM_ADD_HEART_ACK, data)
end)
--获取 进行中 数据
@ -182,6 +184,11 @@ function LiveRoomData:ChatReq(room_id, chat_content)
{ room_id = room_id, chat_content = chat_content })
end
function LiveRoomData:AddHeart()
local room_id = self.data["room_id"]
ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_LIVE_ROOM_ADD_HEART_REQ, {room_id = room_id})
end
function LiveRoomData:SendGiftReq(room_id, gift_id)
ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_LIVE_ROOM_SEND_GIFT_REQ, { room_id = room_id, gift_id = gift_id })
end

View File

@ -216,6 +216,13 @@ function UILiveRoomView:AddEventListener()
end
end
end)
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.SC_LIVE_ROOM_ADD_HEART_ACK,
function(data)
local heart = data.heart
local itemlua = self:GetCurrPageLua()
self:RefreshHeart(itemlua)
end)
end
function UILiveRoomView:RemoveEventListener()
@ -573,6 +580,13 @@ function UILiveRoomView:RefreshRoom()
end
end
end
self:RefreshHeart(itemLua)
end
function UILiveRoomView:RefreshHeart(itemlua)
local liveRoomData = ManagerContainer.DataMgr.LiveRoomData:GetData()
itemlua.roomTitleBar.text_sign.text.text = liveRoomData.heart
end
--加载模型
@ -745,7 +759,8 @@ function UILiveRoomView:InitChat(itemlua, room_id)
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)
itemlua.inputBar.sv_emoji:SetActive(false)
itemlua.inputBar.sv_gift:SetActive(false)
end