2021-04-21 13:12:04 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-06-28 17:52:29 +08:00
|
|
|
|
local ShowEnemyInfoPanel = Inherit(BasePanel)
|
|
|
|
|
local this = ShowEnemyInfoPanel
|
|
|
|
|
local monsterGroupId
|
|
|
|
|
local _LiveName
|
|
|
|
|
local _LiveNode
|
2020-08-19 17:18:38 +08:00
|
|
|
|
local MapPanel
|
2020-06-28 17:52:29 +08:00
|
|
|
|
|
|
|
|
|
local trailConfig = ConfigManager.GetConfig(ConfigName.TrialConfig)
|
|
|
|
|
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
|
|
|
|
local trialSetting=ConfigManager.GetConfig(ConfigName.TrialSetting)
|
|
|
|
|
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()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-06-28 17:52:29 +08:00
|
|
|
|
this.root = self.gameObject
|
|
|
|
|
this.btnBack =Util.GetGameObject(this.root,"EnemyInfo/btnBack")
|
2020-11-17 14:55:21 +08:00
|
|
|
|
this.rootLive=Util.GetGameObject(this.root,"EnemyInfo/root")
|
|
|
|
|
this.e_liveRoot=Util.GetGameObject(this.root,"EnemyInfo/root/liveRoot")
|
2020-06-28 17:52:29 +08:00
|
|
|
|
this.e_name=Util.GetGameObject(this.root,"EnemyInfo/name/text"):GetComponent("Text")
|
|
|
|
|
this.e_level=Util.GetGameObject(this.root,"EnemyInfo/name/level/Text"):GetComponent("Text")
|
|
|
|
|
this.e_cancelBtn=Util.GetGameObject(this.root,"EnemyInfo/cancelBtn")
|
|
|
|
|
this.e_fightBtn=Util.GetGameObject(this.root,"EnemyInfo/fightBtn")
|
2020-08-19 17:18:38 +08:00
|
|
|
|
this.bottomBar=Util.GetGameObject(this.root,"EnemyInfo/bottomBar")
|
2020-06-28 17:52:29 +08:00
|
|
|
|
this.heroGrid=Util.GetGameObject(this.root,"EnemyInfo/bottomBar/heroList")
|
|
|
|
|
this.iconPre=Util.GetGameObject(this.root,"EnemyInfo/bottomBar/heroList/pre")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function this:BindEvent()
|
|
|
|
|
Util.AddClick(this.e_cancelBtn,function()
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Event.PointTriggerEnd)
|
2020-08-06 15:05:33 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Map.MaskState,0)
|
2020-06-28 17:52:29 +08:00
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.btnBack,function()
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Event.PointTriggerEnd)
|
2020-08-06 15:05:33 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Map.MaskState,0)
|
2020-06-28 17:52:29 +08:00
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.e_fightBtn,function()
|
|
|
|
|
for i, v in ipairs(MapManager.trialHeroInfo) do
|
|
|
|
|
if MapTrialManager.selectHeroDid==v.heroId then
|
|
|
|
|
if v.heroHp<=0 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11260])
|
2020-06-28 17:52:29 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-08-18 10:10:49 +08:00
|
|
|
|
if MapManager.curCarbonType == CarBonTypeId.ENDLESS then
|
|
|
|
|
NetManager.QuickFightRequest(function(msg)
|
|
|
|
|
-- CarbonManager.InitQuickFightData(monsterGroupId, nil, msg)
|
2021-05-27 11:23:38 +08:00
|
|
|
|
if msg.result == 1 then
|
|
|
|
|
EndLessMapManager.EndlessDrop = msg.enventDrop
|
|
|
|
|
end
|
2020-08-18 10:10:49 +08:00
|
|
|
|
local fightData = BattleManager.GetBattleServerData(msg)
|
2021-05-27 11:23:38 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.EndlessMpaFight, function()
|
2020-08-18 10:10:49 +08:00
|
|
|
|
--更新精气值
|
2021-04-21 16:36:12 +08:00
|
|
|
|
--LogGreen("战斗后的更新精气值:"..msg.essenceValue)
|
2020-08-18 10:10:49 +08:00
|
|
|
|
MapTrialManager.powerValue = msg.essenceValue
|
|
|
|
|
|
|
|
|
|
--召唤Boss
|
|
|
|
|
if CarbonManager.difficulty == CARBON_TYPE.TRIAL and MapTrialManager.powerValue >= 100 then
|
|
|
|
|
MapTrialManager.isHaveBoss = true
|
|
|
|
|
MapTrialManager.UpdatePowerValue(0)
|
|
|
|
|
end
|
|
|
|
|
-- 延迟一秒刷新显示,避免战斗界面关闭时地图界面没有打开,无法监听删点事件,导致怪物点无法删除的问题
|
|
|
|
|
Timer.New(function()
|
|
|
|
|
-- 刷新数据
|
|
|
|
|
CarbonManager.InitQuickFightData(monsterGroupId, nil, msg)
|
|
|
|
|
end, 0.2):Start()
|
2021-09-08 18:27:20 +08:00
|
|
|
|
end):SetResult(msg.result)
|
2020-08-18 10:10:49 +08:00
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
else
|
2021-05-27 10:46:22 +08:00
|
|
|
|
--先保存编队
|
|
|
|
|
local curFormation = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_DREAMLAND)
|
|
|
|
|
local choosedList={}
|
|
|
|
|
table.insert(choosedList, {heroId = MapTrialManager.selectHeroDid, position=2})
|
2021-09-10 16:25:38 +08:00
|
|
|
|
FormationManager.SaveFormation(FormationTypeDef.FORMATION_DREAMLAND,choosedList,
|
2021-05-27 10:46:22 +08:00
|
|
|
|
FormationManager.formationList[FormationTypeDef.FORMATION_DREAMLAND].teamPokemonInfos)
|
|
|
|
|
|
|
|
|
|
--请求战斗数据
|
|
|
|
|
NetManager.QuickFightRequest(function(msg)
|
|
|
|
|
--战斗赢了 击杀小怪数量+1(包括BOSS吗)
|
|
|
|
|
if msg.result==1 then
|
|
|
|
|
MapTrialManager.SetKillCount(MapTrialManager.GetKilCount()+1)
|
2020-06-28 17:52:29 +08:00
|
|
|
|
end
|
2021-05-27 10:46:22 +08:00
|
|
|
|
--更新英雄HP
|
|
|
|
|
MapTrialManager.SetHeroHp(msg.remainHpList, MapTrialManager.selectHeroDid)
|
2020-08-18 10:10:49 +08:00
|
|
|
|
|
2021-05-27 10:46:22 +08:00
|
|
|
|
|
|
|
|
|
local fightData = BattleManager.GetBattleServerData(msg)
|
2021-11-26 10:19:29 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.TRIAL_FIGHT, function()
|
2021-05-27 10:46:22 +08:00
|
|
|
|
--更新精气值
|
|
|
|
|
--LogGreen("战斗后的更新精气值:"..msg.essenceValue)
|
|
|
|
|
MapTrialManager.powerValue = msg.essenceValue
|
|
|
|
|
--召唤Boss
|
|
|
|
|
if CarbonManager.difficulty == CARBON_TYPE.TRIAL and MapTrialManager.powerValue >= 100 then
|
|
|
|
|
MapTrialManager.isHaveBoss = true
|
|
|
|
|
MapTrialManager.UpdatePowerValue(0)
|
|
|
|
|
end
|
|
|
|
|
-- 延迟一秒刷新显示,避免战斗界面关闭时地图界面没有打开,无法监听删点事件,导致怪物点无法删除的问题
|
|
|
|
|
Timer.New(function()
|
|
|
|
|
-- 刷新数据
|
|
|
|
|
CarbonManager.InitQuickFightData(monsterGroupId, nil, msg)
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Map.RefreshHeroHp,false,nil,false)--打完刷新血量
|
|
|
|
|
end, 0.2):Start()
|
2021-09-08 18:27:20 +08:00
|
|
|
|
end):SetResult(msg.result)
|
|
|
|
|
|
2021-05-27 10:46:22 +08:00
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
2020-08-18 10:10:49 +08:00
|
|
|
|
end
|
2020-06-28 17:52:29 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function this:OnOpen(...)
|
2020-08-19 17:18:38 +08:00
|
|
|
|
MapPanel,monsterGroupId = ...
|
2020-06-28 17:52:29 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnShow()
|
2020-08-19 17:18:38 +08:00
|
|
|
|
this.bottomBar:SetActive(MapManager.curCarbonType ~= CarBonTypeId.ENDLESS)
|
2020-06-28 17:52:29 +08:00
|
|
|
|
this.SetSelectHero()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SetSelectHero()
|
2020-07-02 17:04:46 +08:00
|
|
|
|
local itemId=trialSetting[1].HealingId[1]
|
|
|
|
|
local itemNum=trialSetting[1].HealingId[2]
|
2020-06-28 17:52:29 +08:00
|
|
|
|
if _LiveName then
|
|
|
|
|
poolManager:UnLoadLive(_LiveName, _LiveNode)
|
|
|
|
|
end
|
|
|
|
|
|
2020-08-26 10:18:31 +08:00
|
|
|
|
local t= MonsterGroupConfig[monsterGroupId].Contents[1][2]
|
2020-06-28 17:52:29 +08:00
|
|
|
|
local monsterId = MonsterConfig[t].MonsterId
|
|
|
|
|
local paintingId = heroConfig[monsterId].Live
|
|
|
|
|
local pos = heroConfig[monsterId].Position
|
|
|
|
|
|
|
|
|
|
_LiveName = ArtConfig[paintingId].Name
|
2020-11-17 14:55:21 +08:00
|
|
|
|
_LiveNode = poolManager:LoadLive(_LiveName, this.e_liveRoot.transform, Vector3.one * heroConfig[monsterId].Scale, Vector3.New(pos[1], pos[2], 0))
|
|
|
|
|
this.rootLive.transform.localScale = Vector3.one*0.7
|
2021-11-29 17:53:17 +08:00
|
|
|
|
if heroConfig[monsterId].Toward==2 then
|
|
|
|
|
SetHEeroLiveToward(_LiveNode,1,pos)
|
|
|
|
|
end
|
2020-06-28 17:52:29 +08:00
|
|
|
|
this.e_level.text = "lv."..MonsterConfig[t].Level
|
2021-01-26 17:08:39 +08:00
|
|
|
|
this.e_name.text = GetLanguageStrById(MonsterConfig[t].ReadingName)
|
2020-06-28 17:52:29 +08:00
|
|
|
|
|
|
|
|
|
local d={}
|
|
|
|
|
d=MapManager.trialHeroInfo
|
|
|
|
|
for k = 1, this.heroGrid.transform.childCount do
|
|
|
|
|
this.heroGrid.transform:GetChild(k-1).gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
local closeChoosed=function() --有开着选择的全关了
|
|
|
|
|
for i, v in ipairs(herosList) do
|
|
|
|
|
local c=Util.GetGameObject(v,"choosed").gameObject
|
|
|
|
|
if c.activeSelf then
|
|
|
|
|
c:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for index, value in ipairs(d) do
|
|
|
|
|
local item = herosList[index]
|
|
|
|
|
if not item then
|
|
|
|
|
item=newObjToParent(this.iconPre,this.heroGrid)
|
|
|
|
|
item.name="pre"..index
|
|
|
|
|
herosList[index]=item
|
|
|
|
|
end
|
|
|
|
|
item.gameObject:SetActive(true)
|
|
|
|
|
|
|
|
|
|
local frame=Util.GetGameObject(item,"frame"):GetComponent("Image")
|
|
|
|
|
local icon=Util.GetGameObject(item,"icon"):GetComponent("Image")
|
|
|
|
|
local pro=Util.GetGameObject(item,"proIcon"):GetComponent("Image")
|
|
|
|
|
local lv=Util.GetGameObject(item,"lv/Text"):GetComponent("Text")
|
2021-11-05 16:19:47 +08:00
|
|
|
|
local starGrid=Util.GetGameObject(item,"star")
|
2020-06-28 17:52:29 +08:00
|
|
|
|
local choosed=Util.GetGameObject(item,"choosed")
|
|
|
|
|
local hpExp=Util.GetGameObject(item,"hpExp"):GetComponent("Slider")
|
2021-04-21 13:12:04 +08:00
|
|
|
|
frame.sprite=this.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroConfig[value.tmpId].Quality,value.star))
|
2020-11-06 09:37:27 +08:00
|
|
|
|
-- if not value.skinId or value.skinId == 0 then
|
2021-04-21 13:12:04 +08:00
|
|
|
|
-- icon.sprite= this.spLoader:LoadSprite(GetResourcePath(heroConfig[value.tmpId].Icon))
|
2020-11-06 09:37:27 +08:00
|
|
|
|
-- else
|
|
|
|
|
-- local heroSkinData = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",value.skinId)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
-- icon.sprite= this.spLoader:LoadSprite(GetResourcePath(heroSkinData.Icon))
|
2020-11-06 09:37:27 +08:00
|
|
|
|
-- end
|
2021-04-21 13:12:04 +08:00
|
|
|
|
SetHeroIcon(this.spLoader, value,icon,heroConfig[value.tmpId])
|
2022-04-01 16:01:36 +08:00
|
|
|
|
pro.sprite=this.spLoader:LoadSprite(GetProStrImageByProNum(value.propertyId))
|
2020-06-28 17:52:29 +08:00
|
|
|
|
lv.text=value.level
|
2021-11-05 16:19:47 +08:00
|
|
|
|
local star,starType = GetStarOrGodSoulLv(1,value)
|
|
|
|
|
SetHeroStars(this.spLoader, starGrid, star,starType)
|
2022-01-12 16:41:51 +08:00
|
|
|
|
SetHeroFlyEffect(item,this.spLoader,value.star,this.sortingOrder + 1,1,2)
|
2021-11-05 16:19:47 +08:00
|
|
|
|
Util.SetParticleSortLayer(starGrid,this.sortingOrder + 1)
|
2020-06-28 17:52:29 +08:00
|
|
|
|
--选择
|
2020-07-21 09:38:34 +08:00
|
|
|
|
choosed:SetActive(MapTrialManager.selectHeroDid==value.heroId)
|
2020-06-28 17:52:29 +08:00
|
|
|
|
Util.AddOnceClick(item,function()
|
2020-06-30 18:59:44 +08:00
|
|
|
|
if value.heroHp>0 then
|
|
|
|
|
closeChoosed()
|
|
|
|
|
choosed:SetActive(true)
|
|
|
|
|
MapTrialManager.selectHeroDid=value.heroId
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Map.RefreshHeroHp,false,nil,false)
|
2020-07-02 20:50:49 +08:00
|
|
|
|
else
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11260])
|
2020-06-30 18:59:44 +08:00
|
|
|
|
end
|
2020-06-28 17:52:29 +08:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
--血量相关
|
|
|
|
|
hpExp.value=value.heroHp/10000
|
|
|
|
|
Util.SetGray(item,value.heroHp<=0)--死啦
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function this:OnClose()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2020-06-28 17:52:29 +08:00
|
|
|
|
_LiveName = {}
|
|
|
|
|
_LiveNode = {}
|
|
|
|
|
herosList={}
|
|
|
|
|
end
|
2021-04-21 13:12:04 +08:00
|
|
|
|
return this
|
|
|
|
|
|