diff --git a/Assets/ManagedResources/~Lua/Modules/Player/PlayerManager.lua b/Assets/ManagedResources/~Lua/Modules/Player/PlayerManager.lua index 8e7e91f201..683791ce91 100644 --- a/Assets/ManagedResources/~Lua/Modules/Player/PlayerManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Player/PlayerManager.lua @@ -388,7 +388,7 @@ function this.GetPlayerRide() return PlayerManager.ride end function this.SetisRefreshMainPanelNpc(state) - LogBlue("isRefreshMainPanelNpc "..tostring(this.isRefreshMainPanelNpc)) + --LogBlue("isRefreshMainPanelNpc "..tostring(this.isRefreshMainPanelNpc)) this.isRefreshMainPanelNpc = state end function this.GetisRefreshMainPanelNpc() @@ -397,7 +397,7 @@ end --初始化所以激活的称号 时装 坐骑 function this.InitSkinTitleMountData(userSkinList,userTitleList,userMountList) this.userSkinList = {}--[id] = {skinId , overTime} - LogBlue("#userSkinList "..#userSkinList.." #userTitleList "..#userTitleList.." #userMountList "..#userMountList) + --LogBlue("#userSkinList "..#userSkinList.." #userTitleList "..#userTitleList.." #userMountList "..#userMountList) for i = 1, #userSkinList do local singData = {} singData.skinId = userSkinList[i].skinId @@ -678,7 +678,7 @@ function this.GetMainPlayerNPCData(fun) NetManager.RequestGetFriendInfo(1,function(msg) for i = 1, #msg.Friends do if msg.Friends[i].id ~= PlayerManager.uid then - LogBlue("msg.Friends[i] "..msg.Friends[i].userSkin.." "..msg.Friends[i].userTitle.." "..msg.Friends[i].userMount.." "..msg.Friends[i].sex) + --LogBlue("msg.Friends[i] "..msg.Friends[i].userSkin.." "..msg.Friends[i].userTitle.." "..msg.Friends[i].userMount.." "..msg.Friends[i].sex) table.insert(curfriendAllList,msg.Friends[i]) end end @@ -700,7 +700,7 @@ function this.GetMainPlayerNPCData(fun) local MyGuildMemList = MyGuildManager.GetMyGuildMemList() for i = 1, #MyGuildMemList do if MyGuildMemList[i].roleUid ~= PlayerManager.uid then - LogBlue("MyGuildMemList[i] "..MyGuildMemList[i].userSkin.." "..MyGuildMemList[i].userTitle.." "..MyGuildMemList[i].userMount.." "..MyGuildMemList[i].sex) + --LogBlue("MyGuildMemList[i] "..MyGuildMemList[i].userSkin.." "..MyGuildMemList[i].userTitle.." "..MyGuildMemList[i].userMount.." "..MyGuildMemList[i].sex) table.insert(curfriendAllList,MyGuildMemList[i]) end end @@ -739,7 +739,7 @@ function this.GetPlayerViewDataByType(index,randomList,needNum,func) --LogGreen("发送好友信息") for i = 1, #msg.Friends do if msg.Friends[i].id ~= PlayerManager.uid then - LogBlue("msg.Friends[i] "..msg.Friends[i].userSkin.." "..msg.Friends[i].userTitle.." "..msg.Friends[i].userMount.." "..msg.Friends[i].sex.." "..msg.Friends[i].userName) + --LogBlue("msg.Friends[i] "..msg.Friends[i].userSkin.." "..msg.Friends[i].userTitle.." "..msg.Friends[i].userMount.." "..msg.Friends[i].sex.." "..msg.Friends[i].userName) table.insert(friendNPCList1,msg.Friends[i]) end end @@ -755,7 +755,7 @@ function this.GetPlayerViewDataByType(index,randomList,needNum,func) local MyGuildMemList = MyGuildManager.GetMyGuildMemList() for i = 1, #MyGuildMemList do if MyGuildMemList[i].roleUid ~= PlayerManager.uid then - LogBlue("MyGuildMemList[i] "..MyGuildMemList[i].userSkin.." "..MyGuildMemList[i].userTitle.." "..MyGuildMemList[i].userMount.." "..MyGuildMemList[i].sex.." "..MyGuildMemList[i].userName) + --LogBlue("MyGuildMemList[i] "..MyGuildMemList[i].userSkin.." "..MyGuildMemList[i].userTitle.." "..MyGuildMemList[i].userMount.." "..MyGuildMemList[i].sex.." "..MyGuildMemList[i].userName) table.insert(GuildNPCList1,MyGuildMemList[i]) end end @@ -774,7 +774,7 @@ function this.GetPlayerViewDataByType(index,randomList,needNum,func) local rankAllList = RankingManager.GetRankingInfo() for i = 1, math.max(20,#rankAllList) do if rankAllList[i] and rankAllList[i].uid ~= PlayerManager.uid then - LogBlue("rankAllList[i] "..rankAllList[i].userSkin.." "..rankAllList[i].userTitle.." "..rankAllList[i].userMount.." "..rankAllList[i].sex.." "..rankAllList[i].userName) + --LogBlue("rankAllList[i] "..rankAllList[i].userSkin.." "..rankAllList[i].userTitle.." "..rankAllList[i].userMount.." "..rankAllList[i].sex.." "..rankAllList[i].userName) table.insert(rankNPCList1,rankAllList[i]) end end @@ -808,7 +808,17 @@ function this.AddPlayer(list1,randomList,needNum) end else for i = 1, #list1 do - randomList[list1[i]] = list1[i] + local uid = 0 + if list1[i].id then + uid = list1[i].id + elseif list1[i].roleUid then + uid = list1[i].roleUid + elseif list1[i].uid then + uid = list1[i].uid + end + if not randomList[uid] and uid > 0 then + randomList[uid] = list1[i] + end end end return randomList @@ -837,7 +847,7 @@ function this.GetMainPlayerNPCData2(fun) local currankAllList = {} for i = 1, 25 do if rankAllList[i] and rankAllList[i].uid ~= PlayerManager.uid then - -- LogBlue("rankAllList[i] "..rankAllList[i].userSkin.." "..rankAllList[i].userTitle.." "..rankAllList[i].userMount.." "..rankAllList[i].sex) + -- --LogBlue("rankAllList[i] "..rankAllList[i].userSkin.." "..rankAllList[i].userTitle.." "..rankAllList[i].userMount.." "..rankAllList[i].sex) table.insert(currankAllList,rankAllList[i]) end end @@ -912,11 +922,19 @@ end function this.RandomNPC(currankAllList,curlist) local playerRandomNum = math.random(1, #currankAllList) - if curlist[playerRandomNum] then + local uid = 0 + if currankAllList[playerRandomNum].id then + uid = currankAllList[playerRandomNum].id + elseif currankAllList[playerRandomNum].roleUid then + uid = currankAllList[playerRandomNum].roleUid + elseif currankAllList[playerRandomNum].uid then + uid = currankAllList[playerRandomNum].uid + end + if curlist[uid] or uid < 1 then this.RandomNPC(currankAllList,curlist) else - curlist[playerRandomNum] = {} - curlist[playerRandomNum] = currankAllList[playerRandomNum] + curlist[uid] = {} + curlist[uid] = currankAllList[playerRandomNum] end end ---------- 主城NPC 选择 end---------- diff --git a/Assets/ManagedResources/~Lua/View/SingleFightPlayerView.lua b/Assets/ManagedResources/~Lua/View/SingleFightPlayerView.lua index fc3297d21c..e0a0b6b7ad 100644 --- a/Assets/ManagedResources/~Lua/View/SingleFightPlayerView.lua +++ b/Assets/ManagedResources/~Lua/View/SingleFightPlayerView.lua @@ -171,8 +171,7 @@ function SingleFightPlayerView:SetData(u,v,isSelf,data) else self.nameDi.transform.localPosition = namePos[2].pos end - LogGreen(data.userName.." data.userName ") - self.name.text = data.userName + self.name.text = data.userName or data.name self.nameDi.gameObject:SetActive(true) end self.playerLiveView:OnOpen(GetPlayerRoleSingleConFig().Scale2)