Merge branch 'game' of http://127.0.0.1:3000/fatiao/ro-webgl into game
This commit is contained in:
commit
c1bba89d65
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 7097568683786880346}
|
||||
- {fileID: 3157367816311582996}
|
||||
m_Father: {fileID: 8425084074262071451}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
@ -450,139 +450,119 @@ PrefabInstance:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 1855629867517737627}
|
||||
m_Modifications:
|
||||
- target: {fileID: 5464747680246210401, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
type: 3}
|
||||
propertyPath: keys.Array.size
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5464747680246210401, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
type: 3}
|
||||
propertyPath: values.Array.size
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5464747680246210401, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
type: 3}
|
||||
propertyPath: keys.Array.data[4]
|
||||
value: UnityEngine.UI.LayoutElement
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 1080
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 1080
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985892, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
- target: {fileID: 3644884608125155436, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: LiveRoomItem
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7074419440563985892, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
value: LiveRoomChatItem
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: aa7c49bf4c737e44d88cd6654701722b, type: 3}
|
||||
--- !u!224 &7097568683786880346 stripped
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a, type: 3}
|
||||
--- !u!224 &3157367816311582996 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 7074419440563985891, guid: aa7c49bf4c737e44d88cd6654701722b,
|
||||
m_CorrespondingSourceObject: {fileID: 3135625391757224365, guid: 4db34ccb9a9d06e4fb6eb199cbb6f62a,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 23296327091935417}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
||||
@ -608,6 +608,8 @@ local UIEventNames = {
|
||||
SC_LIVE_ROOM_STAGE_NTF = id(),
|
||||
SC_LIVE_ROOM_CMD_PLAY_NTF = id(),
|
||||
SC_LIVE_ROOM_CHAT_NTF = id(),
|
||||
SC_LIVE_ROOM_SHOW_DATA_NTF = id(),
|
||||
SC_LIVE_ROOM_RESULT_NTF = id(),
|
||||
|
||||
LIVEROOM_RES_STREAMER_LOAD_OK = id(),
|
||||
}
|
||||
|
||||
@ -65,9 +65,12 @@ function LiveRoomData:RegisterNetEvents()
|
||||
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.SC_LIVE_ROOM_GET_READY_ACK, data.error)
|
||||
end)
|
||||
|
||||
|
||||
--准备时获取加入角色的数据
|
||||
ManagerContainer.NetManager:NetRegister(ProtoMsgId.SC_LIVE_ROOM_GET_READY_NTF, function(data)
|
||||
self.data["ready_player_info_list"] = data.ready_player_info_list
|
||||
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.SC_LIVE_ROOM_GET_READY_NTF)
|
||||
--LogWarning("tzy_ready data=" .. Inspect(data))
|
||||
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.SC_LIVE_ROOM_GET_READY_NTF,data)
|
||||
end)
|
||||
|
||||
ManagerContainer.NetManager:NetRegister(ProtoMsgId.SC_LIVE_ROOM_STAGE_NTF, function(data)
|
||||
@ -95,10 +98,16 @@ function LiveRoomData:RegisterNetEvents()
|
||||
ManagerContainer.NetManager:NetRegister(ProtoMsgId.SC_LIVE_ROOM_SHOW_SUBMIT_ACK, function(data)
|
||||
end)
|
||||
|
||||
--获取 进行中 数据
|
||||
ManagerContainer.NetManager:NetRegister(ProtoMsgId.SC_LIVE_ROOM_SHOW_DATA_NTF, function(data)
|
||||
LogWarning("tzy_SC_LIVE_ROOM_SHOW_DATA_NTF: " .. Inspect(data))
|
||||
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.SC_LIVE_ROOM_SHOW_DATA_NTF, data)
|
||||
end)
|
||||
|
||||
--获取 结果 数据
|
||||
ManagerContainer.NetManager:NetRegister(ProtoMsgId.SC_LIVE_ROOM_RESULT_NTF, function(data)
|
||||
LogWarning("tzy_SC_LIVE_ROOM_RESULT_NTF: " .. Inspect(data))
|
||||
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.SC_LIVE_ROOM_RESULT_NTF, data)
|
||||
end)
|
||||
end
|
||||
|
||||
@ -163,7 +172,8 @@ end
|
||||
|
||||
-- KeyValueType64Str submit_data: {key = int64, value = ""}
|
||||
function LiveRoomData:SubmitReq(room_id, submit_data)
|
||||
ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_LIVE_ROOM_SUBMIT_REQ, {room_id=room_id, submit_data=submit_data})
|
||||
ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_LIVE_ROOM_SHOW_SUBMIT_REQ,
|
||||
{ room_id = room_id, submit_data = submit_data })
|
||||
end
|
||||
|
||||
return LiveRoomData
|
||||
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,8 @@ local LIVEROOM_NUM = 5
|
||||
|
||||
local chatdata = {}
|
||||
|
||||
local uid2info = {}
|
||||
|
||||
|
||||
--region 生命周期
|
||||
|
||||
@ -57,9 +59,18 @@ function UILiveRoomView:AddEventListener()
|
||||
self:RefreshRoom()
|
||||
end)
|
||||
|
||||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.SC_LIVE_ROOM_GET_READY_NTF, function()
|
||||
self:RefreshRoom()
|
||||
end)
|
||||
--准备 数据
|
||||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.SC_LIVE_ROOM_GET_READY_NTF,
|
||||
function(data)
|
||||
for k, v in pairs(data.ready_player_info_list) do
|
||||
local info = { uid = v.uid, head_id = v.head_id, name = v.nickname, level = v.level }
|
||||
uid2info[v.uid] = info
|
||||
end
|
||||
|
||||
self:RefreshRoom()
|
||||
local itemlua = self:GetCurrPageLua()
|
||||
self:ReadyPad_Head(itemlua, data.ready_player_info_list)
|
||||
end)
|
||||
|
||||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.SC_LIVE_ROOM_CHAT_NTF,
|
||||
function(room_id)
|
||||
@ -67,12 +78,37 @@ function UILiveRoomView:AddEventListener()
|
||||
end)
|
||||
|
||||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.SC_LIVE_ROOM_STAGE_NTF, function()
|
||||
self:OnChangeStage()
|
||||
self:RefreshRoom()
|
||||
end)
|
||||
|
||||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.SC_LIVE_ROOM_CMD_PLAY_NTF, function()
|
||||
self:RefreshRoom()
|
||||
end)
|
||||
|
||||
--进行中 数据
|
||||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.SC_LIVE_ROOM_SHOW_DATA_NTF,
|
||||
function(data)
|
||||
LogWarning("tzy_show_: " .. Inspect(data))
|
||||
if data.room_id == LIVEROOM_TYPE_GAME then
|
||||
local itemlua = self:GetCurrPageLua()
|
||||
self:Show_Game_View(itemlua, data.show_data_list)
|
||||
end
|
||||
end)
|
||||
|
||||
--结算 数据
|
||||
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.SC_LIVE_ROOM_RESULT_NTF,
|
||||
function(data)
|
||||
LogWarning("tzy_result_: " .. Inspect(data))
|
||||
local itemlua = self:GetCurrPageLua()
|
||||
if data.room_id == LIVEROOM_TYPE_CARD then
|
||||
|
||||
self:Result_Card(itemlua, data)
|
||||
|
||||
elseif data.room_id == LIVEROOM_TYPE_GAME then
|
||||
self:Result_Game(itemlua, data)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function UILiveRoomView:RemoveEventListener()
|
||||
@ -171,7 +207,8 @@ function UILiveRoomView:GetLiveRoomItem(loopview, index)
|
||||
self:InitReceiveGift(itemlua, roomType)
|
||||
|
||||
self:SetReadyPad(itemlua, roomType)
|
||||
self:SetResdultPad(itemlua, roomType)
|
||||
self:SetShowPad(itemlua, roomType)
|
||||
self:SetResultPad(itemlua, roomType)
|
||||
|
||||
return item
|
||||
end
|
||||
@ -239,12 +276,12 @@ function UILiveRoomView:ConfigRoom(itemLua, roomType)
|
||||
itemLua.roomBg.bg.image.sprite = sprite
|
||||
end)
|
||||
]]
|
||||
|
||||
|
||||
self:LoadIcon_SetSprite(itemLua.roomTitleBar.streamerHead.headImg, "PlayerHeads/".. roomCfg["StreamerHead"])
|
||||
self:LoadIcon_SetSprite(itemLua.roomBg.bg, "LiveRoomBg/LiveRoomBg_".. roomType)
|
||||
|
||||
--[[
|
||||
self:LoadIcon_SetSprite(itemLua.roomTitleBar.streamerHead.headImg, "PlayerHeads/" .. roomCfg["StreamerHead"])
|
||||
self:LoadIcon_SetSprite(itemLua.roomBg.bg, "LiveRoomBg/LiveRoomBg_" .. roomType)
|
||||
|
||||
--[[
|
||||
--从文件设置rect
|
||||
local readyPadRect = itemLua.readyPad.rectTransform
|
||||
readyPadRect.sizeDelta = Vector2(readyPadRect.sizeDelta.x, roomCfg["ReadyPadHeight"])
|
||||
@ -264,7 +301,6 @@ function UILiveRoomView:ConfigRoom(itemLua, roomType)
|
||||
|
||||
--事件挂载
|
||||
self.uiBase:AddButtonUniqueEventListener(itemLua.roomTitleBar.closeBtn.button, self, self.OnCloseBtn)
|
||||
|
||||
end
|
||||
|
||||
--按钮,关闭uiliveroom
|
||||
@ -287,7 +323,35 @@ function UILiveRoomView:OnCloseBtn()
|
||||
self:UIClose()
|
||||
end
|
||||
|
||||
function UILiveRoomView:OnChangeStage()
|
||||
LogWarning("tzy_OnChangeStage")
|
||||
local data = ManagerContainer.DataMgr.LiveRoomData:GetData()
|
||||
local room_id = data["room_id"]
|
||||
local room_type = data["room_type"]
|
||||
local stage = data["stage"]
|
||||
local itemlua = self:GetCurrPageLua()
|
||||
|
||||
if stage == LIVEROOM_STAGE_IDLE then
|
||||
elseif stage == LIVEROOM_STAGE_READY then
|
||||
self:ReadyPad_Head(itemlua, nil)
|
||||
elseif stage == LIVEROOM_STAGE_SHOW then
|
||||
if room_type == LIVEROOM_TYPE_GAME then
|
||||
--循环发送游戏分数
|
||||
if not self.showpad_game_timer or self.showpad_game_timer == nil then
|
||||
self.showpad_game_timer = ManagerContainer.LuaTimerMgr:AddLuaTimer(1000, -1, function()
|
||||
--LogWarning("tzy_test_timer")
|
||||
self:Show_SendGameScore(room_id)
|
||||
end)
|
||||
end
|
||||
end
|
||||
elseif stage == LIVEROOM_STAGE_RESULT then
|
||||
--停止发送游戏分数
|
||||
if self.showpad_game_timer then
|
||||
ManagerContainer.LuaTimerMgr:RemoveTimer(self.showpad_game_timer)
|
||||
self.showpad_game_timer = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--刷新房间
|
||||
--[[
|
||||
@ -349,6 +413,14 @@ function UILiveRoomView:RefreshRoom()
|
||||
end
|
||||
elseif stage == LIVEROOM_STAGE_RESULT then
|
||||
itemLua.resultPad:SetActive(true)
|
||||
|
||||
if room_type == LIVEROOM_TYPE_GAME then
|
||||
-- 删除游戏物体
|
||||
if self.gameGos and self.gameGos[room_type] then
|
||||
CommonUtil.DestroyGO(self.gameGos[room_type])
|
||||
self.gameGos[room_type] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -389,19 +461,18 @@ end
|
||||
|
||||
|
||||
--工具 LoadIcon
|
||||
function UILiveRoomView:LoadIcon_SetSprite(go,path)
|
||||
CommonUtil.LoadIcon(self,path,function(sprite)
|
||||
go.image.sprite=sprite
|
||||
function UILiveRoomView:LoadIcon_SetSprite(go, path)
|
||||
CommonUtil.LoadIcon(self, path, function(sprite)
|
||||
go.image.sprite = sprite
|
||||
end)
|
||||
end
|
||||
|
||||
--工具 点击IconItem
|
||||
function UILiveRoomView:OnClickIconItem(btn,params)
|
||||
function UILiveRoomView:OnClickIconItem(btn, params)
|
||||
local logicData = params[0]
|
||||
ManagerContainer.LuaUIMgr:OpenTips(logicData)
|
||||
end
|
||||
|
||||
|
||||
--region 房间 顶部
|
||||
function UILiveRoomView:InitTopBar(itemlua, room_id)
|
||||
local roomname, name, sign, head, audhead1, audhead2, audhead3, audcount, notice
|
||||
@ -462,11 +533,11 @@ function UILiveRoomView:GenChatItem(loopview, index, room_id)
|
||||
local itemlua = CommonUtil.BindGridViewItem2Lua(self, "LiveRoomChatItem", item.gameObject)
|
||||
local go = item.gameObject
|
||||
go.name = "LiveRoomChatItem_" .. index
|
||||
LogWarning("InitChat2: " .. tostring(idx))
|
||||
--LogWarning("InitChat2: " .. tostring(idx))
|
||||
|
||||
if chatdata[idx] and chatdata[idx][index + 1] then
|
||||
local chat = chatdata[idx][index + 1]
|
||||
LogWarning("chat" .. Inspect(chat))
|
||||
--LogWarning("chat" .. Inspect(chat))
|
||||
local name = tostring(chat.player_info.nickname)
|
||||
local vip = tostring(chat.player_info.vip_level)
|
||||
if name == "" then name = "初心者" end
|
||||
@ -478,44 +549,31 @@ function UILiveRoomView:GenChatItem(loopview, index, room_id)
|
||||
itemlua.text_name.text.text = name .. ":" --.. ".Lv" .. level .. ":"
|
||||
|
||||
|
||||
local c_sizename=StringUtil.GetTMTextWidth(itemlua.text_name.text, name..":")
|
||||
local c_sizename = StringUtil.GetTMTextWidth(itemlua.text_name.text, name .. ":")
|
||||
|
||||
itemlua.text_name.rectTransform.sizeDelta=Vector2(c_sizename,50)
|
||||
itemlua.text_name.rectTransform.sizeDelta = Vector2(c_sizename, 50)
|
||||
itemlua.rect1.rectTransform.sizeDelta = Vector2(112 + 20 + c_sizename, 85)
|
||||
local c_sizeother = 47 +112+20+c_sizename
|
||||
|
||||
local c_sizeother = 47 + 112 + 20 + c_sizename
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local c_sizeMax=1020-c_sizeother
|
||||
local c_sizeMax = 1020 - c_sizeother
|
||||
itemlua.text_chat.text.text = content
|
||||
local c_size= StringUtil.GetTMTextWidth(itemlua.text_chat.text,content)
|
||||
local linecount=math.floor( c_size/c_sizeMax)
|
||||
local c_size = StringUtil.GetTMTextWidth(itemlua.text_chat.text, content)
|
||||
local linecount = math.floor(c_size / c_sizeMax)
|
||||
|
||||
LogWarning("c_sizeMax:"..c_sizeMax.." c_size:"..c_size.." linecount:"..linecount)
|
||||
if linecount==0 then
|
||||
|
||||
itemlua.text_chat.rectTransform.sizeDelta=Vector2(c_size,85)
|
||||
itemlua.rectTransform.sizeDelta=Vector2(c_sizeother+c_size,85)
|
||||
--LogWarning("c_sizeMax:" .. c_sizeMax .. " c_size:" .. c_size .. " linecount:" .. linecount)
|
||||
if linecount == 0 then
|
||||
itemlua.text_chat.rectTransform.sizeDelta = Vector2(c_size, 85)
|
||||
itemlua.rectTransform.sizeDelta = Vector2(c_sizeother + c_size, 85)
|
||||
end
|
||||
if linecount>0 then
|
||||
itemlua.text_chat.rectTransform.sizeDelta =Vector2(c_sizeMax,85*(linecount+1))
|
||||
if linecount > 0 then
|
||||
itemlua.text_chat.rectTransform.sizeDelta = Vector2(c_sizeMax, 85 * (linecount + 1))
|
||||
itemlua.rectTransform.sizeDelta = Vector2(1020, 85 * (linecount + 1))
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--itemlua.contentSizeFitter:SetLayoutHorizontal()
|
||||
--itemlua.contentSizeFitter:SetLayoutVertical()
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
return item
|
||||
@ -546,7 +604,7 @@ function UILiveRoomView:RefreshChatData(room_id)
|
||||
--LogWarning("聊天回调: room_id: " .. room_id .. " talk_id: " .. talk_id .. " talk_params: " .. Inspect(talk_params))
|
||||
|
||||
local data = ManagerContainer.DataMgr.LiveRoomData:GetChatData()
|
||||
LogWarning("聊天回调: " .. Inspect(data))
|
||||
--LogWarning("聊天回调: " .. Inspect(data))
|
||||
|
||||
chatdata[room_id] = data
|
||||
--LogWarning("聊天回调 RefreshChatData: " .. Inspect(data))
|
||||
@ -703,58 +761,89 @@ end
|
||||
|
||||
--region 房间 准备
|
||||
|
||||
function UILiveRoomView:SetReadyPad(itemlua,room_id)
|
||||
local room_type=room_id
|
||||
function UILiveRoomView:SetReadyPad(itemlua, room_id)
|
||||
local room_type = room_id
|
||||
local title
|
||||
local readybtn = itemlua.readyPad.readyBtn.button
|
||||
local card=itemlua.readyPad.card_bg
|
||||
local card = itemlua.readyPad.card_bg
|
||||
|
||||
|
||||
self.uiBase:AddButtonUniqueEventListener(readybtn, self, function()self:OnReadyBtn(room_id) end)
|
||||
|
||||
self.uiBase:AddButtonUniqueEventListener(readybtn, self, function() self:OnReadyBtn(room_id) end)
|
||||
card:SetActive(false)
|
||||
|
||||
if room_type == LIVEROOM_TYPE_CARD then
|
||||
title="抽卡准备中"
|
||||
card:SetActive(true)
|
||||
elseif room_type == LIVEROOM_TYPE_SELL then
|
||||
title="售卖准备中"
|
||||
elseif room_type == LIVEROOM_TYPE_ANSWER then
|
||||
title="答题准备中"
|
||||
elseif room_type == LIVEROOM_TYPE_GAME then
|
||||
title="游戏准备中"
|
||||
elseif room_type == LIVEROOM_TYPE_BID then
|
||||
title="拍卖准备中"
|
||||
end
|
||||
|
||||
itemlua.readyPad.text_title.text.text=title
|
||||
|
||||
|
||||
|
||||
|
||||
local heads={
|
||||
[1]=itemlua.readyPad.head1.head_img,
|
||||
[2]=itemlua.readyPad.head2.head_img,
|
||||
[3]=itemlua.readyPad.head3.head_img,
|
||||
[4]=itemlua.readyPad.head4.head_img,
|
||||
[5]=itemlua.readyPad.head5.head_img,
|
||||
[6]=itemlua.readyPad.head6.head_img,
|
||||
[7]=itemlua.readyPad.head7.head_img,
|
||||
[8]=itemlua.readyPad.head8.head_img,
|
||||
[9]=itemlua.readyPad.head9.head_img,
|
||||
[10]=itemlua.readyPad.head10.head_img,
|
||||
local heads = {
|
||||
[1] = itemlua.readyPad.head1,
|
||||
[2] = itemlua.readyPad.head2,
|
||||
[3] = itemlua.readyPad.head3,
|
||||
[4] = itemlua.readyPad.head4,
|
||||
[5] = itemlua.readyPad.head5,
|
||||
[6] = itemlua.readyPad.head6,
|
||||
[7] = itemlua.readyPad.head7,
|
||||
[8] = itemlua.readyPad.head8,
|
||||
[9] = itemlua.readyPad.head9,
|
||||
[10] = itemlua.readyPad.head10,
|
||||
}
|
||||
|
||||
for i=1,10 do
|
||||
self:LoadIcon_SetSprite(heads[i], "NpcHeads/npc_head_"..i)
|
||||
for i = 1, 10 do
|
||||
heads[i]:SetActive(false)
|
||||
heads[i].head_img:SetActive(false)
|
||||
--self:LoadIcon_SetSprite(heads[i], "NpcHeads/npc_head_" .. i)
|
||||
end
|
||||
|
||||
self:SetReadyItem(itemlua,room_type)
|
||||
if room_type == LIVEROOM_TYPE_CARD then
|
||||
title = "抽卡准备中"
|
||||
card:SetActive(true)
|
||||
for i = 1, 5 do heads[i]:SetActive(true) end
|
||||
elseif room_type == LIVEROOM_TYPE_SELL then
|
||||
title = "售卖准备中"
|
||||
for i = 1, 5 do heads[i]:SetActive(true) end
|
||||
elseif room_type == LIVEROOM_TYPE_ANSWER then
|
||||
title = "答题准备中"
|
||||
for i = 1, 5 do heads[i]:SetActive(true) end
|
||||
elseif room_type == LIVEROOM_TYPE_GAME then
|
||||
title = "游戏准备中"
|
||||
for i = 1, 10 do heads[i]:SetActive(true) end
|
||||
elseif room_type == LIVEROOM_TYPE_BID then
|
||||
title = "拍卖准备中"
|
||||
for i = 1, 5 do heads[i]:SetActive(true) end
|
||||
end
|
||||
|
||||
|
||||
itemlua.readyPad.text_title.text.text = title
|
||||
|
||||
self:SetReadyItem(itemlua, room_type)
|
||||
end
|
||||
|
||||
--回调事件,获取准备玩家的数据
|
||||
function UILiveRoomView:ReadyPad_Head(itemlua, data)
|
||||
local heads = {
|
||||
[1] = itemlua.readyPad.head1.head_img,
|
||||
[2] = itemlua.readyPad.head2.head_img,
|
||||
[3] = itemlua.readyPad.head3.head_img,
|
||||
[4] = itemlua.readyPad.head4.head_img,
|
||||
[5] = itemlua.readyPad.head5.head_img,
|
||||
[6] = itemlua.readyPad.head6.head_img,
|
||||
[7] = itemlua.readyPad.head7.head_img,
|
||||
[8] = itemlua.readyPad.head8.head_img,
|
||||
[9] = itemlua.readyPad.head9.head_img,
|
||||
[10] = itemlua.readyPad.head10.head_img,
|
||||
}
|
||||
|
||||
if data ~= nil then
|
||||
for i = 1, 10 do
|
||||
if i <= #data then
|
||||
local headpath = "PlayerHeads/player_head_" .. (data[i].head_id or 1)
|
||||
self:LoadIcon_SetSprite(heads[i], headpath)
|
||||
heads[i].gameObject:SetActive(true)
|
||||
else
|
||||
heads[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, 10 do
|
||||
heads[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--按钮,发送准备请求
|
||||
function UILiveRoomView:OnReadyBtn(room_id)
|
||||
@ -763,59 +852,139 @@ function UILiveRoomView:OnReadyBtn(room_id)
|
||||
ManagerContainer.DataMgr.LiveRoomData:GetReadyReq(room_id)
|
||||
end
|
||||
|
||||
|
||||
function UILiveRoomView:SetReadyItem(itemlua,room_id)
|
||||
local readyitem=itemlua.readyPad.readyitem
|
||||
function UILiveRoomView:SetReadyItem(itemlua, room_id)
|
||||
local readyitem = itemlua.readyPad.readyitem
|
||||
readyitem:SetActive(false)
|
||||
readyitem.title_bid:SetActive(false)
|
||||
readyitem.title_sell:SetActive(false)
|
||||
|
||||
local name="8小时挂机经验包"
|
||||
local name = "8小时挂机经验包"
|
||||
|
||||
local item1,item2,item3
|
||||
local item1, item2, item3
|
||||
|
||||
if room_id==LIVEROOM_TYPE_SELL then
|
||||
if room_id == LIVEROOM_TYPE_SELL then
|
||||
readyitem.bg.image.sprite = readyitem.bg.switchSprite:GetSprite("bg_sell")
|
||||
readyitem.title_sell:SetActive(true)
|
||||
|
||||
readyitem.text_name.text.text = name
|
||||
readyitem.text_info1.text.text = "原价: ".."100金币"
|
||||
readyitem.text_info2.text.text = "秒杀价: ".."80金币"
|
||||
readyitem.text_info1.text.text = "原价: " .. "100金币"
|
||||
readyitem.text_info2.text.text = "秒杀价: " .. "80金币"
|
||||
|
||||
--readyitem.img_gift.image.sprite
|
||||
elseif room_id==LIVEROOM_TYPE_BID then
|
||||
elseif room_id == LIVEROOM_TYPE_BID then
|
||||
readyitem.bg.image.sprite = readyitem.bg.switchSprite:GetSprite("bg_bid")
|
||||
|
||||
|
||||
readyitem.title_bid:SetActive(true)
|
||||
|
||||
readyitem.text_name.text.text = name
|
||||
readyitem.text_info1.text.text = "底价: ".."200金币"
|
||||
readyitem.text_info2.text.text = "每次加价: ".."≥10金币"
|
||||
readyitem.text_info1.text.text = "底价: " .. "200金币"
|
||||
readyitem.text_info2.text.text = "每次加价: " .. "≥10金币"
|
||||
|
||||
--readyitem.img_gift.image.sprite
|
||||
else return end
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
local reward = { cfgId =1, num = 2}
|
||||
local reward = { cfgId = 1, num = 2 }
|
||||
IconItemCtr:SetData(self, readyitem.item1, { cfgId = 1, num = 2 }, Enum.ItemIEnterType.Bag, self,
|
||||
self.OnClickIconItem)
|
||||
self.OnClickIconItem)
|
||||
IconItemCtr:SetData(self, readyitem.item2, { cfgId = 2, num = 3 }, Enum.ItemIEnterType.Bag, self,
|
||||
self.OnClickIconItem)
|
||||
self.OnClickIconItem)
|
||||
IconItemCtr:SetData(self, readyitem.item3, { cfgId = 3, num = 4 }, Enum.ItemIEnterType.Bag, self,
|
||||
self.OnClickIconItem)
|
||||
self.OnClickIconItem)
|
||||
|
||||
|
||||
readyitem:SetActive(true)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
--endregion 房间 准备
|
||||
|
||||
|
||||
--region 房间 进行中
|
||||
|
||||
function UILiveRoomView:SetShowPad(itemlua, room_id)
|
||||
local room_type = room_id
|
||||
itemlua.showPad.rect_card:SetActive(false)
|
||||
itemlua.showPad.rect_sell:SetActive(false)
|
||||
itemlua.showPad.rect_answer:SetActive(false)
|
||||
itemlua.showPad.rect_game:SetActive(false)
|
||||
itemlua.showPad.rect_bid:SetActive(false)
|
||||
|
||||
if room_type == LIVEROOM_TYPE_CARD then
|
||||
|
||||
elseif room_type == LIVEROOM_TYPE_SELL then
|
||||
|
||||
elseif room_type == LIVEROOM_TYPE_ANSWER then
|
||||
|
||||
elseif room_type == LIVEROOM_TYPE_GAME then
|
||||
self:Show_Game_View(itemlua, nil)
|
||||
elseif room_type == LIVEROOM_TYPE_BID then
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function UILiveRoomView:Show_SendGameScore(room_id)
|
||||
local uid = ManagerContainer.DataMgr.UserData:GetUserId()
|
||||
local score = ManagerContainer.LuaGameMgr.FunnyGameScore
|
||||
local submit_data = { { key = uid, value = tostring(score) } };
|
||||
ManagerContainer.DataMgr.LiveRoomData:SubmitReq(room_id, submit_data)
|
||||
end
|
||||
|
||||
--进行中 游戏
|
||||
function UILiveRoomView:Show_Game_View(itemlua, data)
|
||||
local r_game = itemlua.showPad.rect_game
|
||||
r_game:SetActive(true)
|
||||
local title = r_game.text_title
|
||||
title.text.text = "小游戏实时分数"
|
||||
|
||||
local view_items = {
|
||||
[1] = r_game.item1,
|
||||
[2] = r_game.item2,
|
||||
[3] = r_game.item3,
|
||||
[4] = r_game.item4,
|
||||
[5] = r_game.item5,
|
||||
[6] = r_game.item6,
|
||||
[7] = r_game.item7,
|
||||
[8] = r_game.item8,
|
||||
[9] = r_game.item9,
|
||||
}
|
||||
local scroedata
|
||||
if data ~= nil then
|
||||
scroedata = data or {}
|
||||
|
||||
--LogWarning("tzy_Show_Game_View_scroedata: " .. Inspect(scroedata))
|
||||
for i = 1, 9 do
|
||||
if i <= #scroedata then
|
||||
local info = uid2info[scroedata[i].key]
|
||||
--LogWarning("tzy_Show_Game_View_info: ".. Inspect(info))
|
||||
local headpath = "PlayerHeads/player_head_" .. (info.head_id or 1)
|
||||
self:LoadIcon_SetSprite(view_items[i].head_img, headpath)
|
||||
view_items[i].head_img:SetActive(true)
|
||||
view_items[i].text_name.text.text = info.name
|
||||
view_items[i].text_score.text.text = scroedata[i].value
|
||||
else
|
||||
view_items[i].head_img:SetActive(false)
|
||||
view_items[i].text_name.text.text = ""
|
||||
view_items[i].text_score.text.text = ""
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, 9 do
|
||||
view_items[i].head_img:SetActive(false)
|
||||
view_items[i].text_name.text.text = ""
|
||||
view_items[i].text_score.text.text = ""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--endregion 房间 进行中
|
||||
|
||||
|
||||
|
||||
--region 房间 结算
|
||||
|
||||
function UILiveRoomView:SetResdultPad(itemlua,room_id)
|
||||
local room_type=room_id
|
||||
function UILiveRoomView:SetResultPad(itemlua, room_id)
|
||||
local room_type = room_id
|
||||
itemlua.resultPad.rect_card:SetActive(false)
|
||||
itemlua.resultPad.rect_sell:SetActive(false)
|
||||
itemlua.resultPad.rect_answer:SetActive(false)
|
||||
@ -825,177 +994,217 @@ function UILiveRoomView:SetResdultPad(itemlua,room_id)
|
||||
|
||||
|
||||
|
||||
if room_type==LIVEROOM_TYPE_CARD then self:Result_Card(itemlua,room_id)
|
||||
elseif room_type==LIVEROOM_TYPE_SELL then self:Result_Sell(itemlua,room_id)
|
||||
elseif room_type==LIVEROOM_TYPE_ANSWER then self:Result_Answer(itemlua,room_id)
|
||||
elseif room_type==LIVEROOM_TYPE_GAME then self:Result_Game(itemlua,room_id)
|
||||
elseif room_type==LIVEROOM_TYPE_BID then self:Result_Bid(itemlua,room_id) end
|
||||
if room_type == LIVEROOM_TYPE_CARD then
|
||||
self:Result_Card(itemlua, nil)
|
||||
elseif room_type == LIVEROOM_TYPE_SELL then
|
||||
self:Result_Sell(itemlua, nil)
|
||||
elseif room_type == LIVEROOM_TYPE_ANSWER then
|
||||
self:Result_Answer(itemlua, nil)
|
||||
elseif room_type == LIVEROOM_TYPE_GAME then
|
||||
self:Result_Game(itemlua, nil)
|
||||
elseif room_type == LIVEROOM_TYPE_BID then
|
||||
self:Result_Bid(itemlua, nil)
|
||||
end
|
||||
end
|
||||
|
||||
--结算 抽卡
|
||||
function UILiveRoomView:Result_Card(itemlua, room_id)
|
||||
local r_card=itemlua.resultPad.rect_card
|
||||
function UILiveRoomView:Result_Card(itemlua, data)
|
||||
local r_card = itemlua.resultPad.rect_card
|
||||
r_card:SetActive(true)
|
||||
local title=r_card.text_title
|
||||
title.text.text="测试抽卡结算信息"
|
||||
self:Result_Card_SetItem(r_card.carditem1,nil,1)
|
||||
self:Result_Card_SetItem(r_card.carditem2,nil,2)
|
||||
self:Result_Card_SetItem(r_card.carditem3,nil,3)
|
||||
self:Result_Card_SetItem(r_card.carditem4,nil,4)
|
||||
self:Result_Card_SetItem(r_card.carditem5,nil,5)
|
||||
|
||||
local title = r_card.text_title
|
||||
title.text.text = "测试抽卡结算信息"
|
||||
|
||||
local items = {
|
||||
[1] = r_card.carditem1,
|
||||
[2] = r_card.carditem2,
|
||||
[3] = r_card.carditem3,
|
||||
[4] = r_card.carditem4,
|
||||
[5] = r_card.carditem5
|
||||
}
|
||||
|
||||
local result_list
|
||||
if data ~= nil then
|
||||
result_list = data.player_reward_list or {}
|
||||
for i = 1, 5 do
|
||||
if i <= #result_list then
|
||||
self:Result_Card_SetItem(items[i], result_list[i], i)
|
||||
else
|
||||
self:Result_Card_SetItem(items[i], nil, i)
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, 5 do
|
||||
self:Result_Card_SetItem(items[i], nil, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UILiveRoomView:Result_Card_SetItem(itemlua,data,index)
|
||||
local name=itemlua.text_name
|
||||
local head=itemlua.head
|
||||
local items={
|
||||
[1]=itemlua.item1,
|
||||
[2]=itemlua.item2,
|
||||
[3]=itemlua.item3,
|
||||
[4]=itemlua.item4,
|
||||
[5]=itemlua.item5,
|
||||
function UILiveRoomView:Result_Card_SetItem(itemlua, data, index)
|
||||
local name = itemlua.text_name
|
||||
local head = itemlua.head
|
||||
local items = {
|
||||
[1] = itemlua.item1,
|
||||
[2] = itemlua.item2,
|
||||
[3] = itemlua.item3,
|
||||
[4] = itemlua.item4,
|
||||
[5] = itemlua.item5,
|
||||
}
|
||||
local reward = { cfgId = 1, num = 2 }
|
||||
|
||||
|
||||
name.text.text="测试名称"..index
|
||||
self:LoadIcon_SetSprite(head, "NpcHeads/npc_head_"..index)
|
||||
|
||||
for i=1,5 do
|
||||
IconItemCtr:SetData(self, items[i], reward, Enum.ItemIEnterType.Bag, self,
|
||||
self.OnClickIconItem)
|
||||
|
||||
reward.cfgId=reward.cfgId+1
|
||||
reward.num=reward.num+1
|
||||
-- 解析字符串格式的data
|
||||
local reward_list = {}
|
||||
if data ~= nil then
|
||||
name.text.text = "测试名称" .. uid2info[data.key].name
|
||||
local headpath = "PlayerHeads/player_head_" .. (uid2info[data.key].head_id or 1)
|
||||
self:LoadIcon_SetSprite(head, headpath)
|
||||
|
||||
local reward_strs = string.split(data.str_val, ";")
|
||||
for i, reward_str in ipairs(reward_strs) do
|
||||
local cfgId, num = string.match(reward_str, "(%d+):(%d+)")
|
||||
if cfgId and num then
|
||||
reward_list[i] = {
|
||||
cfgId = tonumber(cfgId),
|
||||
num = tonumber(num)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--LogWarning("tzy_Result_Card_SetItem: " .. Inspect(reward_list))
|
||||
for i = 1, 5 do
|
||||
local reward = { cfgId = reward_list[i].cfgId, num = reward_list[i].num }
|
||||
IconItemCtr:SetData(self, items[i], reward, Enum.ItemIEnterType.Bag, self,
|
||||
self.OnClickIconItem)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--结算 出售
|
||||
function UILiveRoomView:Result_Sell(itemlua, room_id)
|
||||
local r_sell=itemlua.resultPad.rect_sell
|
||||
local r_sell = itemlua.resultPad.rect_sell
|
||||
r_sell:SetActive(true)
|
||||
local heads={
|
||||
[1]=r_sell.head1,
|
||||
[2]=r_sell.head2,
|
||||
[3]=r_sell.head3,
|
||||
[4]=r_sell.head4,
|
||||
[5]=r_sell.head5,
|
||||
[6]=r_sell.head6,
|
||||
[7]=r_sell.head7,
|
||||
[8]=r_sell.head8,
|
||||
[9]=r_sell.head9,
|
||||
[10]=r_sell.head10,
|
||||
local heads = {
|
||||
[1] = r_sell.head1,
|
||||
[2] = r_sell.head2,
|
||||
[3] = r_sell.head3,
|
||||
[4] = r_sell.head4,
|
||||
[5] = r_sell.head5,
|
||||
[6] = r_sell.head6,
|
||||
[7] = r_sell.head7,
|
||||
[8] = r_sell.head8,
|
||||
[9] = r_sell.head9,
|
||||
[10] = r_sell.head10,
|
||||
}
|
||||
|
||||
for i=1,10 do
|
||||
self:LoadIcon_SetSprite(heads[i].img_head, "NpcHeads/npc_head_"..i)
|
||||
heads[i].text_name.text.text="测试名称"..i
|
||||
|
||||
for i = 1, 10 do
|
||||
self:LoadIcon_SetSprite(heads[i].img_head, "NpcHeads/npc_head_" .. i)
|
||||
heads[i].text_name.text.text = "测试名称" .. i
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
--结算 答题
|
||||
function UILiveRoomView:Result_Answer(itemlua, room_id)
|
||||
local r_answer=itemlua.resultPad.rect_answer
|
||||
local r_answer = itemlua.resultPad.rect_answer
|
||||
r_answer:SetActive(true)
|
||||
local heads={
|
||||
[1]=r_answer.head1,
|
||||
[2]=r_answer.head2,
|
||||
[3]=r_answer.head3,
|
||||
[4]=r_answer.head4,
|
||||
[5]=r_answer.head5,
|
||||
[6]=r_answer.head6,
|
||||
[7]=r_answer.head7,
|
||||
[8]=r_answer.head8,
|
||||
[9]=r_answer.head9,
|
||||
[10]=r_answer.head10,
|
||||
local heads = {
|
||||
[1] = r_answer.head1,
|
||||
[2] = r_answer.head2,
|
||||
[3] = r_answer.head3,
|
||||
[4] = r_answer.head4,
|
||||
[5] = r_answer.head5,
|
||||
[6] = r_answer.head6,
|
||||
[7] = r_answer.head7,
|
||||
[8] = r_answer.head8,
|
||||
[9] = r_answer.head9,
|
||||
[10] = r_answer.head10,
|
||||
}
|
||||
|
||||
for i=1,10 do
|
||||
self:LoadIcon_SetSprite(heads[i].img_head, "NpcHeads/npc_head_"..i)
|
||||
heads[i].text_name.text.text="测试名称"..i
|
||||
for i = 1, 10 do
|
||||
self:LoadIcon_SetSprite(heads[i].img_head, "NpcHeads/npc_head_" .. i)
|
||||
heads[i].text_name.text.text = "测试名称" .. i
|
||||
heads[i].img_true:SetActive(false)
|
||||
heads[i].img_false:SetActive(false)
|
||||
if i%2==0 then heads[i].img_true:SetActive(true)
|
||||
else heads[i].img_false:SetActive(true) end
|
||||
if i % 2 == 0 then
|
||||
heads[i].img_true:SetActive(true)
|
||||
else
|
||||
heads[i].img_false:SetActive(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
--结算 游戏
|
||||
function UILiveRoomView:Result_Game(itemlua, room_id)
|
||||
local r_game=itemlua.resultPad.rect_game
|
||||
function UILiveRoomView:Result_Game(itemlua, data)
|
||||
local r_game = itemlua.resultPad.rect_game
|
||||
r_game:SetActive(true)
|
||||
local title = r_game.text_title
|
||||
title.text.text = "小游戏结算信息"
|
||||
local rank = r_game.rank
|
||||
|
||||
local title=r_game.text_title
|
||||
local rank_head = {
|
||||
[1] = rank.head1.head_img,
|
||||
[2] = rank.head2.head_img,
|
||||
[3] = rank.head3.head_img,
|
||||
|
||||
title.text.text="测试游戏结算信息"
|
||||
|
||||
|
||||
local rank=r_game.rank
|
||||
local view=r_game.view
|
||||
|
||||
local rank_head={
|
||||
[1]=rank.head1.head_img,
|
||||
[2]=rank.head2.head_img,
|
||||
[3]=rank.head3.head_img,
|
||||
|
||||
[4]=rank.head4.head_img,
|
||||
[5]=rank.head5.head_img,
|
||||
[6]=rank.head6.head_img,
|
||||
[4] = rank.head4.head_img,
|
||||
[5] = rank.head5.head_img,
|
||||
[6] = rank.head6.head_img,
|
||||
}
|
||||
local rank_name={
|
||||
[1]=rank.name1,
|
||||
[2]=rank.name2,
|
||||
[3]=rank.name3,
|
||||
local rank_name = {
|
||||
[1] = rank.name1,
|
||||
[2] = rank.name2,
|
||||
[3] = rank.name3,
|
||||
|
||||
[4]=rank.name4,
|
||||
[5]=rank.name5,
|
||||
[6]=rank.name6,
|
||||
[4] = rank.name4,
|
||||
[5] = rank.name5,
|
||||
[6] = rank.name6,
|
||||
}
|
||||
|
||||
for i=1,6 do
|
||||
self:LoadIcon_SetSprite(rank_head[i], "NpcHeads/npc_head_"..i)
|
||||
rank_name[i].text.text="测试名称"..i
|
||||
for i = 1, 6 do
|
||||
self:LoadIcon_SetSprite(rank_head[i], "NpcHeads/npc_head_" .. i)
|
||||
rank_name[i].text.text = "测试名称" .. i
|
||||
end
|
||||
|
||||
local view_items={
|
||||
[1]=view.item1,
|
||||
[2]=view.item2,
|
||||
[3]=view.item3,
|
||||
[4]=view.item4,
|
||||
[5]=view.item5,
|
||||
[6]=view.item6,
|
||||
[7]=view.item7,
|
||||
[8]=view.item8,
|
||||
[9]=view.item9,
|
||||
}
|
||||
for i=1,9 do
|
||||
self:LoadIcon_SetSprite(view_items[i].head_img, "NpcHeads/npc_head_"..i)
|
||||
view_items[i].text_name.text.text="测试名称"..i
|
||||
view_items[i].text_score.text.text="测试分数"..i
|
||||
local result_list, reward_list
|
||||
if data ~= nil then
|
||||
result_list = data.player_result_list or {}
|
||||
reward_list = data.player_reward_list or {}
|
||||
for i = 1, 3 do
|
||||
if i <= #result_list then
|
||||
local info = result_list[i]
|
||||
local headpath = "PlayerHeads/player_head_" .. (info.head_id or 1)
|
||||
self:LoadIcon_SetSprite(rank_head[i], headpath)
|
||||
rank_head[i]:SetActive(true)
|
||||
rank_name[i].text.text = info.nickname
|
||||
else
|
||||
rank_head[i]:SetActive(false)
|
||||
rank_name[i].text.text = ""
|
||||
end
|
||||
if i <= #reward_list then
|
||||
local info = reward_list[i]
|
||||
local headpath = "PlayerHeads/player_head_" .. (info.head_id or 1)
|
||||
self:LoadIcon_SetSprite(rank_head[i + 3], headpath)
|
||||
rank_head[i + 3]:SetActive(true)
|
||||
rank_name[i + 3].text.text = info.nickname
|
||||
else
|
||||
rank_head[i + 3]:SetActive(false)
|
||||
rank_name[i + 3].text.text = ""
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, 6 do
|
||||
rank_head[i]:SetActive(false)
|
||||
rank_name[i].text.text = ""
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
--结算 拍卖
|
||||
function UILiveRoomView:Result_Bid(itemlua, room_id)
|
||||
local r_bid=itemlua.resultPad.rect_bid
|
||||
local r_bid = itemlua.resultPad.rect_bid
|
||||
r_bid:SetActive(true)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--endregion 房间 结算
|
||||
|
||||
|
||||
@ -1024,13 +1233,13 @@ function UILiveRoomView:RefreshStageTimer(timerVal)
|
||||
local itemLua = self:GetCurrPageLua()
|
||||
local name
|
||||
if stage == LIVEROOM_STAGE_IDLE then
|
||||
name="等待中"
|
||||
name = "等待中"
|
||||
elseif stage == LIVEROOM_STAGE_READY then
|
||||
name="准备中"
|
||||
name = "准备中"
|
||||
elseif stage == LIVEROOM_STAGE_SHOW then
|
||||
name="进行中"
|
||||
name = "进行中"
|
||||
elseif stage == LIVEROOM_STAGE_RESULT then
|
||||
name="结算中"
|
||||
name = "结算中"
|
||||
end
|
||||
itemLua.timer.text_name.text.text = name
|
||||
itemLua.timer.text_time.text.text = tostring(timerVal)
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
---@class UILiveRoom__Generate_liveRoomChatItem
|
||||
---@field public gameObject UnityEngine.GameObject
|
||||
---@field public rectTransform UnityEngine.RectTransform
|
||||
|
||||
---@class UILiveRoom__Generate_sv_room
|
||||
---@field public gameObject UnityEngine.GameObject
|
||||
---@field public loopListView SuperScrollView.LoopListView
|
||||
@ -6,7 +10,7 @@
|
||||
---@field private gameObject UnityEngine.GameObject
|
||||
---@field private transform UnityEngine.Transform
|
||||
---@field private sv_room UILiveRoom__Generate_sv_room
|
||||
---@field private liveRoomItem UnityEngine.GameObject
|
||||
---@field private liveRoomChatItem UILiveRoom__Generate_liveRoomChatItem
|
||||
local UILiveRoomView = class("UILiveRoomView", require("UIViewBase"))
|
||||
|
||||
function UILiveRoomView:ctor()
|
||||
@ -49,14 +53,16 @@ end
|
||||
---@private
|
||||
function UILiveRoomView:InitGenerate__2(Root, data)
|
||||
--[[
|
||||
sv_room/Viewport/Content/LiveRoomItem
|
||||
sv_room/Viewport/Content/LiveRoomChatItem
|
||||
--]]
|
||||
local tmp = Root:Find("sv_room/Viewport/Content/LiveRoomItem").gameObject
|
||||
local tmp = Root:Find("sv_room/Viewport/Content/LiveRoomChatItem").gameObject
|
||||
if tolua.getpeer(tmp) == nil then
|
||||
tolua.setpeer(tmp, {})
|
||||
end
|
||||
self.liveRoomItem = CommonUtil.BindGridViewItem2LuaStatic("LiveRoomItem", tmp)
|
||||
self.liveRoomItem.prefabName = "LiveRoomItem"
|
||||
self.liveRoomChatItem = CommonUtil.BindGridViewItem2LuaStatic("LiveRoomChatItem", tmp)
|
||||
self.liveRoomChatItem.prefabName = "LiveRoomChatItem"
|
||||
|
||||
tmp.rectTransform = tmp:GetComponent(Enum.TypeInfo.RectTransform)
|
||||
end
|
||||
|
||||
---@private
|
||||
@ -65,13 +71,13 @@ function UILiveRoomView:GenerateDestroy()
|
||||
tolua.setpeer(self.sv_room, nil)
|
||||
end
|
||||
self.sv_room = nil
|
||||
if self.liveRoomItem.GenerateDestroy ~= nil then
|
||||
self.liveRoomItem:GenerateDestroy()
|
||||
if self.liveRoomChatItem.GenerateDestroy ~= nil then
|
||||
self.liveRoomChatItem:GenerateDestroy()
|
||||
end
|
||||
if tolua.getpeer(self.liveRoomItem) ~= nil then
|
||||
tolua.setpeer(self.liveRoomItem, nil)
|
||||
if tolua.getpeer(self.liveRoomChatItem) ~= nil then
|
||||
tolua.setpeer(self.liveRoomChatItem, nil)
|
||||
end
|
||||
self.liveRoomItem = nil
|
||||
self.liveRoomChatItem = nil
|
||||
self.transform = nil
|
||||
self.gameObject = nil
|
||||
self.inited = false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user