【NPC】优化
parent
f1f9c5e118
commit
a0a2ac324a
|
@ -468,19 +468,25 @@ function this.GetMainPlayerNPCData(fun)
|
||||||
rankNPCList = {}
|
rankNPCList = {}
|
||||||
friendNPCList = {}
|
friendNPCList = {}
|
||||||
local friendRandomNum = math.random(1, 2)
|
local friendRandomNum = math.random(1, 2)
|
||||||
-- LogGreen("friendRandomNum "..friendRandomNum)
|
|
||||||
if friendRandomNum == 2 and PlayerManager.familyId == 0 then
|
if friendRandomNum == 2 and PlayerManager.familyId == 0 then
|
||||||
friendRandomNum = 1
|
friendRandomNum = 1
|
||||||
end
|
end
|
||||||
|
-- LogGreen("friendRandomNum "..friendRandomNum)
|
||||||
|
local curfriendAllList = {}
|
||||||
if friendRandomNum == 1 then
|
if friendRandomNum == 1 then
|
||||||
NetManager.RequestGetFriendInfo(1,function(msg)
|
NetManager.RequestGetFriendInfo(1,function(msg)
|
||||||
if #msg.Friends > needNum then
|
for i = 1, #msg.Friends do
|
||||||
|
if msg.Friends[i].id ~= PlayerManager.uid then
|
||||||
|
table.insert(curfriendAllList,msg.Friends[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #curfriendAllList > needNum then
|
||||||
for i = 1, needNum do
|
for i = 1, needNum do
|
||||||
this.RandomFirendNPC(msg.Friends)
|
this.RandomFirendNPC(curfriendAllList)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for i = 1, #msg.Friends do
|
for i = 1, #curfriendAllList do
|
||||||
friendNPCList[i] = msg.Friends[i]
|
friendNPCList[i] = curfriendAllList[i]
|
||||||
-- LogGreen("friend "..msg.Friends[i].name)
|
-- LogGreen("friend "..msg.Friends[i].name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -490,13 +496,18 @@ function this.GetMainPlayerNPCData(fun)
|
||||||
else
|
else
|
||||||
MyGuildManager.RequestMyGuildMembers(function()
|
MyGuildManager.RequestMyGuildMembers(function()
|
||||||
local MyGuildMemList = MyGuildManager.GetMyGuildMemList()
|
local MyGuildMemList = MyGuildManager.GetMyGuildMemList()
|
||||||
if #MyGuildMemList > needNum then
|
for i = 1, #MyGuildMemList do
|
||||||
|
if MyGuildMemList[i].roleUid ~= PlayerManager.uid then
|
||||||
|
table.insert(curfriendAllList,MyGuildMemList[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #curfriendAllList > needNum then
|
||||||
for i = 1, needNum do
|
for i = 1, needNum do
|
||||||
this.RandomFirendNPC(MyGuildMemList)
|
this.RandomFirendNPC(curfriendAllList)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for i = 1, #MyGuildMemList do
|
for i = 1, #curfriendAllList do
|
||||||
friendNPCList[i] = MyGuildMemList[i]
|
friendNPCList[i] = curfriendAllList[i]
|
||||||
-- LogGreen("MyGuildMemList "..MyGuildMemList[i].userName)
|
-- LogGreen("MyGuildMemList "..MyGuildMemList[i].userName)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue