两条协议统一数据输入

master
1076390229 2025-07-30 19:40:37 +08:00
parent 8f1ce9aca4
commit e7a320c273
4 changed files with 43 additions and 12 deletions

View File

@ -480,6 +480,14 @@ function M:FG_Data_ChatRoom(evt_data)
if evt_data.getData then
local group = DataManager.groups:get(evt_data.groupId)
for _,recode in pairs(evt_data.records) do
recode.players = json.decode(recode.totalScore)
recode.maxRound = json.decode(recode.hpData).maxRound
recode.pid = recode.groupPid
recode.groupId = tonumber(recode.groupId)
end
group.records = evt_data.records
end
@ -493,6 +501,19 @@ function M:FG_Data_NewChat(evt_data)
local messageCount = evt_data.messageCount
local group = DataManager.groups:get(gid)
group.messageCount = tonumber(messageCount)
group.records = group.records or {}
local records = group.records
local newRecord = {}
--newRecord.create_time = evt_data.datas.time
newRecord.players = evt_data.datas.datas
newRecord.room_id = evt_data.datas.roomid
newRecord.groupId = evt_data.gid
newRecord.pid = evt_data.datas.pid
newRecord.round = evt_data.datas.round
newRecord.maxRound = evt_data.datas.maxRound
newRecord.time = evt_data.datas.time
records[#records + 1] = newRecord
DispatchEvent(self._dispatcher, GroupMgrEvent.OnNewRecord, evt_data)
end

View File

@ -13,13 +13,13 @@ local function SetBigWiller(totalScore)
totalScore[winer].winer = true
end
local function list_players_Renderer(index, obj, totalScore, self)
local function list_players_Renderer(index, obj, players, self)
local tex_name = obj:GetChild("tex_name")
local loader_icon = obj:GetChild("loader_icon")
local tex_id = obj:GetChild("tex_id")
local tex_score = obj:GetChild("tex_score")
local player = totalScore[index + 1]
local player = players[index + 1]
tex_name.text = player.nick
tex_id.text = player.accId
@ -35,26 +35,28 @@ end
local function ChatItemRenderer(index, obj, self)
--local data = self.ChatRoomData.records[index + 1]
local data = self.group.records[index + 1]
local totalScore = json.decode(data.totalScore)
local hpData = json.decode(data.hpData)
SetBigWiller(totalScore)
local record = self.group.records[index + 1]
local group = DataManager.groups:get(record.groupId)
local play = group:getPlay(record.pid)
--local totalScore = json.decode(data.totalScore)
--local hpData = json.decode(record.hpData)
SetBigWiller(record.players)
local list_players = obj:GetChild("list_players")
local tex_time = obj:GetChild("tex_time")
local tex_name = obj:GetChild("tex_name")
local tex_roomIdRound = obj:GetChild("tex_roomIdRound")
tex_time.text = os.date("游戏结算:%m月%d号 %X", data.create_time) --data.create_time
tex_name.text = data.game_info.name
local roundTex = data.round .. "/" .. hpData.maxRound
tex_roomIdRound.text = data.room_id .. "\n" .. roundTex
tex_time.text = os.date("游戏结算:%m月%d号 %X", record.create_time) --data.create_time
tex_name.text = play.game_name --record.game_info.name
local roundTex = record.round .. "/" .. record.maxRound
tex_roomIdRound.text = record.room_id .. "\n" .. roundTex
list_players.itemRenderer = function(i, o)
list_players_Renderer(i, o, totalScore, self)
list_players_Renderer(i, o, record.players, self)
end
list_players.numItems = #totalScore
list_players.numItems = #record.players
end
--[[

View File

@ -5,6 +5,7 @@
"com.unity.ads": "3.4.9",
"com.unity.analytics": "3.3.5",
"com.unity.collab-proxy": "1.2.16",
"com.unity.device-simulator": "3.0.3-preview",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.1",

View File

@ -37,6 +37,13 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.device-simulator": {
"version": "3.0.3-preview",
"depth": 0,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.0",
"depth": 0,