【优化】主城假人改为NPC或者排行榜角色 2
parent
bae3ec50cd
commit
122ccb94e2
|
@ -531,7 +531,7 @@ function this:BindEvent()
|
|||
-- end
|
||||
PlayerManager.GetMainPlayerNPCData(function(NPCList)
|
||||
for i = 1, #NPCList do
|
||||
local view = MainPlayerView.New(false, this.btnClickMove, rect, Vector2.New(math.random(rect.xMin, rect.xMax), math.random(rect.yMin, rect.yMax)))
|
||||
local view = MainPlayerView.New(false, this.btnClickMove, rect, Vector2.New(math.random(rect.xMin, rect.xMax), math.random(rect.yMin, rect.yMax)),NPCList[i].sex)
|
||||
view.NameText.text = NPCList[i].userName or NPCList[i].name
|
||||
view:SetAutoMove()
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
MainPlayerView.__index = MainPlayerView
|
||||
|
||||
local mapNpcOp = "UI_MainPlayer"
|
||||
function MainPlayerView.New(isSelf, root, rect, pos)
|
||||
function MainPlayerView.New(isSelf, root, rect, pos,_sex)
|
||||
local instance = {}
|
||||
setmetatable(instance, MainPlayerView)
|
||||
|
||||
|
@ -25,7 +25,7 @@ function MainPlayerView.New(isSelf, root, rect, pos)
|
|||
instance.NameText = Util.GetGameObject(instance.leader, "name/text2"):GetComponent("Text")
|
||||
Util.GetGameObject(instance.leader, "name/text"):SetActive(false)
|
||||
Util.GetGameObject(instance.leader, "name/text2"):SetActive(true)
|
||||
sex = math.random(0,1)
|
||||
sex = _sex or math.random(0,1)
|
||||
end
|
||||
instance.NameText.text = PlayerManager.nickName
|
||||
|
||||
|
|
|
@ -460,6 +460,8 @@ function this.StopBattleUpLvTipTime()
|
|||
end
|
||||
|
||||
------- 主城NPC 选择star ----------
|
||||
local needNum = 7
|
||||
local needAllNum = 14
|
||||
local rankNPCList = {}
|
||||
local friendNPCList = {}
|
||||
function this.GetMainPlayerNPCData(fun)
|
||||
|
@ -472,8 +474,8 @@ function this.GetMainPlayerNPCData(fun)
|
|||
end
|
||||
if friendRandomNum == 1 then
|
||||
NetManager.RequestGetFriendInfo(1,function(msg)
|
||||
if #msg.Friends > 9 then
|
||||
for i = 1, 9 do
|
||||
if #msg.Friends > needNum then
|
||||
for i = 1, needNum do
|
||||
this.RandomFirendNPC(msg.Friends)
|
||||
end
|
||||
else
|
||||
|
@ -488,8 +490,8 @@ function this.GetMainPlayerNPCData(fun)
|
|||
else
|
||||
MyGuildManager.RequestMyGuildMembers(function()
|
||||
local MyGuildMemList = MyGuildManager.GetMyGuildMemList()
|
||||
if #MyGuildMemList > 9 then
|
||||
for i = 1, 9 do
|
||||
if #MyGuildMemList > needNum then
|
||||
for i = 1, needNum do
|
||||
this.RandomFirendNPC(MyGuildMemList)
|
||||
end
|
||||
else
|
||||
|
@ -505,8 +507,8 @@ function this.GetMainPlayerNPCData(fun)
|
|||
end
|
||||
function this.GetMainPlayerNPCData2(fun)
|
||||
local rankRandomNum = math.random(1, 4)
|
||||
local needNum = 9 - LengthOfTable(friendNPCList)
|
||||
needNum = 9 + needNum
|
||||
local curAddNum = needNum - LengthOfTable(friendNPCList)
|
||||
curAddNum = needNum + curAddNum
|
||||
-- LogGreen("rankRandomNum "..rankRandomNum)
|
||||
RankingManager.InitData(rankKingList[rankRandomNum].rankType, function()
|
||||
local rankAllList = RankingManager.GetRankingInfo()
|
||||
|
@ -516,8 +518,8 @@ function this.GetMainPlayerNPCData2(fun)
|
|||
table.insert(currankAllList,rankAllList[i])
|
||||
end
|
||||
end
|
||||
if #currankAllList > needNum then
|
||||
for i = 1, needNum do
|
||||
if #currankAllList > curAddNum then
|
||||
for i = 1, curAddNum do
|
||||
this.RandomRankNPC(currankAllList)
|
||||
end
|
||||
else
|
||||
|
@ -538,11 +540,11 @@ function this.GetMainPlayerNPCData3(fun)
|
|||
for key,val in pairs(rankNPCList) do
|
||||
table.insert(upList,val)
|
||||
end
|
||||
if #upList < 18 then
|
||||
for i = 1, 18 - #upList do
|
||||
if #upList < needAllNum then
|
||||
for i = 1, needAllNum - #upList do
|
||||
local singleUserData = {}
|
||||
singleUserData.userName = NameManager.GetLocalRandomName()
|
||||
singleUserData.sex = math.random(1, 2)
|
||||
singleUserData.sex = math.random(0,1)
|
||||
singleUserData.uid = 1000 + i
|
||||
table.insert(upList,singleUserData)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue