boss 和 转盘数据 提交
parent
ba75aab424
commit
5bf0f64989
File diff suppressed because it is too large
Load Diff
|
|
@ -1,21 +1,20 @@
|
|||
require("Base/BasePanel")
|
||||
local XiaoYaoLuckyBossPopup = Inherit(BasePanel)
|
||||
local this = XiaoYaoLuckyBossPopup
|
||||
local monsterGroup = {}
|
||||
local curMonsterGroup
|
||||
|
||||
local monsterGroupId
|
||||
local _LiveName
|
||||
local _LiveNode
|
||||
local MapPanel
|
||||
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
||||
|
||||
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
||||
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
local MonsterConfig=ConfigManager.GetConfig(ConfigName.MonsterConfig)
|
||||
local MonsterGroupConfig = ConfigManager.GetConfig(ConfigName.MonsterGroup)
|
||||
local ArtConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
||||
|
||||
local herosList={}
|
||||
|
||||
function this:InitComponent()
|
||||
local monsterGroupPrefabs = {}
|
||||
local rewardPrefabs = {}
|
||||
function XiaoYaoLuckyBossPopup:InitComponent()
|
||||
this.root = self.gameObject
|
||||
this.btnBack =Util.GetGameObject(this.root,"Panel/bg/btnBack")
|
||||
this.title =Util.GetGameObject(this.root,"Panel/bg/title"):GetComponent("Text")
|
||||
|
|
@ -26,11 +25,12 @@ function this:InitComponent()
|
|||
|
||||
this.e_fightBtn=Util.GetGameObject(this.root,"Panel/EnemyInfo/fight")
|
||||
this.heroList=Util.GetGameObject(this.root,"Panel/EnemyInfo/Scroll/heroList")
|
||||
this.rewardList=Util.GetGameObject(this.root,"Panel/EnemyInfo/rewardScroll/rewardList")
|
||||
this.iconPre=Util.GetGameObject(this.root,"Panel/EnemyInfo/Scroll/pre")
|
||||
end
|
||||
|
||||
|
||||
function this:BindEvent()
|
||||
function XiaoYaoLuckyBossPopup:BindEvent()
|
||||
Util.AddClick(this.btnBack,function()
|
||||
self:ClosePanel()
|
||||
end)
|
||||
|
|
@ -41,16 +41,47 @@ function this:BindEvent()
|
|||
end
|
||||
|
||||
|
||||
function this:OnOpen(...)
|
||||
function XiaoYaoLuckyBossPopup:OnOpen()
|
||||
|
||||
end
|
||||
|
||||
function this:OnShow()
|
||||
monsterGroupId = 0
|
||||
this.SetSelectHero()
|
||||
function XiaoYaoLuckyBossPopup:OnShow()
|
||||
monsterGroup = XiaoYaoManager.GetMonsterDatas()
|
||||
curMonsterGroup = monsterGroup[1]
|
||||
this:RefreshMonsterList()
|
||||
this:SetSelectHero()
|
||||
end
|
||||
|
||||
function this.SetSelectHero()
|
||||
function this:InitMonsterList()
|
||||
for i = 1 ,#monsterGroupPrefabs do
|
||||
monsterGroupPrefabs[i].gameObject:SetActive(false)
|
||||
end
|
||||
for i = 1 , monsterGroup do
|
||||
if not monsterGroupPrefabs[i] then
|
||||
monsterGroupPrefabs[i] = newObjToParent(this.iconPre,this.heroList)
|
||||
end
|
||||
monsterGroupPrefabs[i].gameObject:SetActive(true)
|
||||
this:SetSingleMonster(monsterGroupPrefabs[i],monsterGroup[1])
|
||||
end
|
||||
end
|
||||
function XiaoYaoLuckyBossPopup:SetSingleMonster(go,data)
|
||||
local frame = Util.GetGameObject(go,"frame"):GetComponent("Image")
|
||||
local icon = Util.GetGameObject(go,"icon"):GetComponent("Image")
|
||||
local lv = Util.GetGameObject(go,"lv/Text"):GetComponent("Text")
|
||||
local choosed = Util.GetGameObject(go,"choosed")
|
||||
local _data = monsterGroup[data.monsterId]
|
||||
frame.sprite = Util.LoadSprite("")
|
||||
icon.sprite = Util.LoadSprite("")
|
||||
lv.text = _data.Level
|
||||
Util.AddOnceClick(go,function()
|
||||
if curMonsterGroup.monsterId == data.monsterId then
|
||||
else
|
||||
this:SetSelectHero()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function XiaoYaoLuckyBossPopup:SetSelectHero()
|
||||
local itemId = 10001
|
||||
local itemNum = 1
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@ XiaoYaoManager = {}
|
|||
local this = XiaoYaoManager
|
||||
this.curMapId=0;
|
||||
this.curMapData={}
|
||||
|
||||
this.MonsterData={}
|
||||
|
||||
this.luckyTurnTableRewards={}
|
||||
this.luckyluckyTurnTableTimes = 0
|
||||
this.luckyluckyTurnTableRemainTime = 0
|
||||
--打开逍遥游地图列表界面
|
||||
function this.OpenMapList()
|
||||
Log("点击打开逍遥游地图列表界面")
|
||||
|
|
@ -11,7 +17,7 @@ function this.OpenMapList()
|
|||
for i = 1, #msg.infos do
|
||||
Log("mapId:"..msg.infos[i].mapId..",process:"..msg.infos[i].process)
|
||||
_data[msg.infos[i].mapId]=msg.infos[i].process
|
||||
end
|
||||
end
|
||||
Log("打开逍遥游地图列表界面")
|
||||
UIManager.OpenPanel(UIName.XiaoYaoYouPanel,_data)
|
||||
end)
|
||||
|
|
@ -33,7 +39,8 @@ function this.OpenXiaoYaoMap(mapId)
|
|||
return a.cellIndex < b.cellIndex
|
||||
end)
|
||||
end
|
||||
|
||||
-- this.InitLuckyTurnTables(msg)
|
||||
-- this.InitMonsterData(msg.monsterInfo,1)
|
||||
Log("打开逍遥游地图列表界面")
|
||||
UIManager.OpenPanel(UIName.XiaoYaoMapPanel)
|
||||
end)
|
||||
|
|
@ -45,8 +52,82 @@ function this.StartXiaoYao()
|
|||
for i = 1, #msg.pointes do
|
||||
this.curMapData.location=this.curMapData.location+msg.pointes[i]
|
||||
end
|
||||
--0、普通节点 1、奖励节点 2、双倍节点 3、额外骰子节点 4、招募英雄节点 5、怪物节点 6,转盘
|
||||
if msg.pathType == 5 then
|
||||
this.InitMonsterData(msg.monsterInfo,2)
|
||||
elseif msg.pathType == 6 then
|
||||
this.InitLuckyTurnTables(msg)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function this.InitLuckyTurnTables(msg)
|
||||
this.luckyTurnTableRewards = {}
|
||||
for i = 1, #msg.randomItem do
|
||||
table.insert(this.luckyTurnTableRewards,msg.randomItem[i])
|
||||
end
|
||||
this.luckyluckyTurnTableTimes = msg.randomNum
|
||||
if msg.randomTime and msg.randomTime > 0 then
|
||||
this.luckyluckyTurnTableRemainTime = msg.randomTime
|
||||
elseif msg.overTime and msg.overTime > 0 then
|
||||
this.luckyluckyTurnTableRemainTime = msg.overTime
|
||||
end
|
||||
end
|
||||
|
||||
-- type 1初始化 2添加
|
||||
function this.InitMonsterData(BackMonsterDatas,type)
|
||||
if type == 1 then
|
||||
this.MonsterData = {}
|
||||
end
|
||||
for i= 1, #BackMonsterDatas do
|
||||
local monster = {}
|
||||
monster.monsterId = BackMonsterDatas[i].monsterId
|
||||
monster.monsterIndex = BackMonsterDatas[i].monsterIndex
|
||||
monster.monsterHp = BackMonsterDatas[i].monsterHp
|
||||
monster.remainTime = BackMonsterDatas[i].remainTime
|
||||
monster.attackNum = BackMonsterDatas[i].attackNum
|
||||
monster.reward = BackMonsterDatas[i].reward
|
||||
table.insert(this.MonsterData,monster)
|
||||
end
|
||||
this.SortMonster(this.MonsterData)
|
||||
end
|
||||
|
||||
function this.GetMonsterDatas()
|
||||
if not this.MonsterData or #this.MonsterData < 1 then
|
||||
return nil
|
||||
end
|
||||
for i = 1 , #this.MonsterData do
|
||||
if this.MonsterData[i].remainTime - PlayerManager.serverTime() < 1 then
|
||||
table.remove(this.MonsterData,i)
|
||||
end
|
||||
end
|
||||
table.sort(this.MonsterData,function(a,b)
|
||||
return a.monsterIndex > b.monsterIndex
|
||||
end)
|
||||
return this.MonsterData
|
||||
end
|
||||
|
||||
function this.SortMonster(MonsterData)
|
||||
table.sort(MonsterData,function(a,b)
|
||||
if a.remainTime <= b.remainTime then
|
||||
return a.monsterIndex > b.monsterIndex
|
||||
else
|
||||
return a.remainTime > b.remainTime
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function this.GetMonsterDataReMainTimesAndTime()
|
||||
if not this.MonsterData or #this.MonsterData < 1 then
|
||||
return nil
|
||||
end
|
||||
local removeData = {}
|
||||
for i = 1 , #this.MonsterData do
|
||||
if this.MonsterData[i].remainTime - PlayerManager.serverTime() < 1 then
|
||||
table.remove(this.MonsterData,i)
|
||||
end
|
||||
end
|
||||
return #this.MonsterData,this.MonsterData[#this.MonsterData].remainTime
|
||||
end
|
||||
|
||||
return XiaoYaoManager
|
||||
Loading…
Reference in New Issue