2025.12.17 sv_chat

This commit is contained in:
kongweiqiang 2025-12-17 18:23:44 +08:00
parent e4f587905a
commit 1011852d81
6 changed files with 363 additions and 21 deletions

View File

@ -193,8 +193,8 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4292795884
m_fontColor: {r: 0.9254902, g: 0.8666667, b: 0.87058824, a: 1}
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
@ -486,8 +486,8 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4292795884
m_fontColor: {r: 0.9245283, g: 0.8678355, b: 0.8708194, a: 1}
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:

View File

@ -29,7 +29,8 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 3201201484035025765}
m_Father: {fileID: 2662489945147460395}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -58,7 +59,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 1, b: 0.97912884, a: 1}
m_Color: {r: 0, g: 1, b: 0.9803922, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@ -682,6 +683,132 @@ MonoBehaviour:
depObjs:
- {fileID: 2830964789618581863}
activeType: 0
--- !u!1 &1628985824324817442
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3201201484035025765}
- component: {fileID: 3604280266862984110}
- component: {fileID: 3615607875199285716}
- component: {fileID: 7999045804410284436}
- component: {fileID: 8450527459659436397}
m_Layer: 5
m_Name: sv_chat
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3201201484035025765
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1628985824324817442}
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:
- {fileID: 6674994991621922765}
m_Father: {fileID: 7344605125539058028}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3604280266862984110
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1628985824324817442}
m_CullTransparentMesh: 1
--- !u!114 &3615607875199285716
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1628985824324817442}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Content: {fileID: 1225952057472156321}
m_Horizontal: 1
m_Vertical: 1
m_MovementType: 1
m_Elasticity: 0.1
m_Inertia: 1
m_DecelerationRate: 0.135
m_ScrollSensitivity: 1
m_Viewport: {fileID: 6674994991621922765}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 0}
m_HorizontalScrollbarVisibility: 2
m_VerticalScrollbarVisibility: 2
m_HorizontalScrollbarSpacing: -3
m_VerticalScrollbarSpacing: -3
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!114 &7999045804410284436
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1628985824324817442}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e190d043ef387ee4fad4acea6146931e, type: 3}
m_Name:
m_EditorClassIdentifier:
mItemPrefabDataList:
- mItemPrefab: {fileID: 3644884608125155436, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
type: 3}
mPadding: 0
mInitCreateCount: 0
mStartPosOffset: 0
mArrangeType: 1
mSupportScrollBar: 1
mItemSnapEnable: 0
mViewPortSnapPivot: {x: 0, y: 0}
mItemSnapPivot: {x: 0, y: 0}
mAutoAdapterSize: 0
mStartPadding: 0
mEndPadding: 0
--- !u!114 &8450527459659436397
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1628985824324817442}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8759edc0b8b4b3d4aa8ffef2482e17ee, type: 3}
m_Name:
m_EditorClassIdentifier:
UIName:
keys:
- UnityEngine.RectTransform
- UnityEngine.CanvasRenderer
- UnityEngine.UI.ScrollRect
- SuperScrollView.LoopListView
- UINode
values: 0000000100
depObjs: []
activeType: 0
--- !u!1 &2002181845793716252
GameObject:
m_ObjectHideFlags: 0
@ -1335,7 +1462,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &903115546714470270
RectTransform:
m_ObjectHideFlags: 0
@ -1665,6 +1792,96 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!1 &3688346549023485146
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6674994991621922765}
- component: {fileID: 530984709409464330}
- component: {fileID: 7470182427125095641}
- component: {fileID: 5547445511080461929}
m_Layer: 5
m_Name: Viewport
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6674994991621922765
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3688346549023485146}
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:
- {fileID: 1225952057472156321}
m_Father: {fileID: 3201201484035025765}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: -17}
m_Pivot: {x: 0, y: 1}
--- !u!222 &530984709409464330
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3688346549023485146}
m_CullTransparentMesh: 1
--- !u!114 &7470182427125095641
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3688346549023485146}
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: 10917, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
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!114 &5547445511080461929
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3688346549023485146}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 0
--- !u!1 &3921156375010074109
GameObject:
m_ObjectHideFlags: 0
@ -1799,6 +2016,41 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5081313538366136672
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1225952057472156321}
m_Layer: 5
m_Name: Content
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1225952057472156321
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5081313538366136672}
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: 1
m_Children: []
m_Father: {fileID: 6674994991621922765}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 300}
m_Pivot: {x: 0.5, y: 1}
--- !u!1 &5152305015668557867
GameObject:
m_ObjectHideFlags: 0
@ -3106,7 +3358,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &7074419440563985891
RectTransform:
m_ObjectHideFlags: 0
@ -3653,7 +3905,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &2662489945147460395
RectTransform:
m_ObjectHideFlags: 0
@ -3782,7 +4034,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &6499749577306562931
RectTransform:
m_ObjectHideFlags: 0

View File

@ -37,6 +37,10 @@
---@field public rectTransform UnityEngine.RectTransform
---@field public timer LiveRoomItem__Generate_readyPad_timer
---@class LiveRoomItem__Generate_sv_chat
---@field public gameObject UnityEngine.GameObject
---@field public loopListView SuperScrollView.LoopListView
---@class LiveRoomItem__Generate_roomTitleBar_closeBtn
---@field public gameObject UnityEngine.GameObject
---@field public button UnityEngine.UI.Button
@ -79,6 +83,7 @@
---@field private roomBg LiveRoomItem__Generate_roomBg
---@field private liveStreamer UnityEngine.GameObject
---@field private roomTitleBar LiveRoomItem__Generate_roomTitleBar
---@field private sv_chat LiveRoomItem__Generate_sv_chat
---@field private readyPad LiveRoomItem__Generate_readyPad
---@field private readyBtn LiveRoomItem__Generate_readyBtn
---@field private showPad LiveRoomItem__Generate_showPad
@ -120,6 +125,7 @@ function LiveRoomItemView:InitGenerate(Root, data)
self:InitGenerate__18(Root,data)
self:InitGenerate__19(Root,data)
self:InitGenerate__20(Root,data)
self:InitGenerate__21(Root,data)
end
@ -263,6 +269,20 @@ end
---@private
function LiveRoomItemView:InitGenerate__12(Root, data)
--[[
BottomSafe/ChatPad/sv_chat
--]]
local tmp = Root:Find("BottomSafe/ChatPad/sv_chat").gameObject
if tolua.getpeer(tmp) == nil then
tolua.setpeer(tmp, {})
end
self.sv_chat = tmp
tmp.loopListView = tmp:GetComponent(Enum.TypeInfo.LoopListView)
end
---@private
function LiveRoomItemView:InitGenerate__13(Root, data)
--[[
BottomSafe/ReadyPad
--]]
@ -276,7 +296,7 @@ function LiveRoomItemView:InitGenerate__12(Root, data)
end
---@private
function LiveRoomItemView:InitGenerate__13(Root, data)
function LiveRoomItemView:InitGenerate__14(Root, data)
--[[
BottomSafe/ReadyPad/ReadyBtn
--]]
@ -290,7 +310,7 @@ function LiveRoomItemView:InitGenerate__13(Root, data)
end
---@private
function LiveRoomItemView:InitGenerate__14(Root, data)
function LiveRoomItemView:InitGenerate__15(Root, data)
--[[
BottomSafe/ReadyPad/Timer
--]]
@ -304,7 +324,7 @@ function LiveRoomItemView:InitGenerate__14(Root, data)
end
---@private
function LiveRoomItemView:InitGenerate__15(Root, data)
function LiveRoomItemView:InitGenerate__16(Root, data)
--[[
BottomSafe/ShowPad
--]]
@ -318,7 +338,7 @@ function LiveRoomItemView:InitGenerate__15(Root, data)
end
---@private
function LiveRoomItemView:InitGenerate__16(Root, data)
function LiveRoomItemView:InitGenerate__17(Root, data)
--[[
BottomSafe/ShowPad/Timer
--]]
@ -332,7 +352,7 @@ function LiveRoomItemView:InitGenerate__16(Root, data)
end
---@private
function LiveRoomItemView:InitGenerate__17(Root, data)
function LiveRoomItemView:InitGenerate__18(Root, data)
--[[
BottomSafe/ResultPad
--]]
@ -346,7 +366,7 @@ function LiveRoomItemView:InitGenerate__17(Root, data)
end
---@private
function LiveRoomItemView:InitGenerate__18(Root, data)
function LiveRoomItemView:InitGenerate__19(Root, data)
--[[
BottomSafe/ResultPad/Timer
--]]
@ -360,7 +380,7 @@ function LiveRoomItemView:InitGenerate__18(Root, data)
end
---@private
function LiveRoomItemView:InitGenerate__19(Root, data)
function LiveRoomItemView:InitGenerate__20(Root, data)
--[[
BottomSafe/IdlePad
--]]
@ -372,7 +392,7 @@ function LiveRoomItemView:InitGenerate__19(Root, data)
end
---@private
function LiveRoomItemView:InitGenerate__20(Root, data)
function LiveRoomItemView:InitGenerate__21(Root, data)
--[[
BottomSafe/IdlePad/Timer
--]]
@ -432,6 +452,10 @@ function LiveRoomItemView:GenerateDestroy()
tolua.setpeer(self.roomTitleBar, nil)
end
self.roomTitleBar = nil
if tolua.getpeer(self.sv_chat) ~= nil then
tolua.setpeer(self.sv_chat, nil)
end
self.sv_chat = nil
if tolua.getpeer(self.readyPad) ~= nil then
tolua.setpeer(self.readyPad, nil)
end

View File

@ -10,10 +10,15 @@ local LIVEROOM_TYPE_CARD = 1
local LIVEROOM_TYPE_SELL = 2
local LIVEROOM_TYPE_ANSWER = 3
local LIVEROOM_TYPE_GAME = 4
local LIVEROOM_TYPE_BID = 4
local LIVEROOM_TYPE_BID = 5
local LIVEROOM_NUM = 5
local chatloopview={}
local chatdata={}
--region 生命周期
function UILiveRoomView:OnAwake(data)
@ -161,6 +166,7 @@ function UILiveRoomView:GetLiveRoomItem(loopview, index)
self:ConfigRoom(itemlua, roomType)
self:SwitchRoom(itemlua)
self:InitChat(itemlua, roomType)
return item
end
@ -263,6 +269,12 @@ function UILiveRoomView:OnCloseBtn()
if self.sv_room.loopListView.ListViewInited then
self.sv_room.loopListView:Dispose()
end
--销毁所有房间的聊天loopview
for loopview in ipairs(chatloopview) do
loopview.loopListView:Dispose()
end
self:UIClose()
end
@ -347,6 +359,59 @@ end
--endregion 房间 配置相关
--region 房间 聊天相关
function UILiveRoomView:InitChat(itemlua,roomType)
LogWarning("InitChat1: "..tostring(roomType))
if not chatdata[roomType] then
self:GenRandomChatContent(roomType)
end
itemlua.sv_chat.loopListView:InitListView(0,
function(loopview, Index) return self:GenChatItem(itemlua.sv_chat.loopListView, Index, roomType) end)
LogWarning("InitChat: " .. Inspect(chatdata[roomType]))
itemlua.sv_chat.loopListView:SetListItemCount(#chatdata[roomType])
itemlua.sv_chat.loopListView:RefreshAllShownItem()
end
function UILiveRoomView:GenChatItem(loopview,index,roomType)
local item=loopview:NewListViewItem("LiveRoomChatItem")
local itemlua=CommonUtil.BindGridViewItem2Lua(self,"LiveRoomChatItem",item.gameObject)
local go=item.gameObject
go.name="LiveRoomChatItem_"..index
LogWarning("InitChat2: " .. tostring(roomType))
if chatdata[roomType] then
itemlua.text_chat.text.text=chatdata[roomType][index+1]
end
return item
end
function UILiveRoomView:GenRandomChatContent(roomType)
--local size=math.random(2,10)
local data={}
for i = 1, roomType do
data[i]="测试消息 随机数: "..tostring(roomType).." "..tostring(i).." "..tostring(math.random(1,100))
end
chatdata[roomType]=data
end
--region 房间 聊天相关
--region 计时器相关
function UILiveRoomView:ResetStageTimer(timerVal)

View File

@ -127,7 +127,7 @@ function UIMailBoxView:RewardMail()
end
--region 事件订阅
--endregion 事件订阅
--region loopview

View File

@ -10,6 +10,7 @@ local MailIdEnum = {
}
--region 生命周期
function UIMailView:OnAwake(data)
self.controller = require("UIMailBox/UIMailCtr"):new()
self.controller:Init(self)