2021-05-25 14:51:26 +08:00
|
|
|
|
----- 远征怪节点弹窗 -----
|
|
|
|
|
local this = {}
|
|
|
|
|
--传入父脚本模块
|
|
|
|
|
local parent
|
|
|
|
|
--传入特效层级
|
|
|
|
|
local sortingOrder=0
|
|
|
|
|
|
|
|
|
|
--item容器
|
|
|
|
|
local itemList = {}
|
|
|
|
|
local heroListGo = {}
|
|
|
|
|
|
|
|
|
|
local waveId = 0 --当前层
|
|
|
|
|
local curType = 1 --当前试炼类型
|
|
|
|
|
local configData = {} --当前层的数据表
|
|
|
|
|
local data = {} --当前试炼的数据
|
|
|
|
|
local rewardData = {} --当前层的奖励
|
|
|
|
|
|
|
|
|
|
local freeTime = 0
|
|
|
|
|
local buyTime = 0
|
|
|
|
|
|
|
|
|
|
local itemId = 0
|
|
|
|
|
local costNum = 0
|
|
|
|
|
local storeDataId = 0
|
|
|
|
|
|
|
|
|
|
local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig)
|
|
|
|
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
function this:InitComponent(gameObject)
|
2021-05-28 14:18:41 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2021-05-25 14:51:26 +08:00
|
|
|
|
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
|
|
|
|
|
this.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text")
|
|
|
|
|
|
|
|
|
|
--滚动条根节点
|
|
|
|
|
this.root = Util.GetGameObject(gameObject, "Root")
|
|
|
|
|
for i = 1, 6 do
|
|
|
|
|
heroListGo[i] = Util.GetGameObject(gameObject, "RoleGrid/Bg"..i.."/Hero"..i)
|
2021-05-28 14:18:41 +08:00
|
|
|
|
Util.GetGameObject(gameObject, "RoleGrid/Bg"..i):GetComponent("Image").sprite = this.spLoader:LoadSprite(CardPosImageName[i])
|
2021-05-25 14:51:26 +08:00
|
|
|
|
end
|
|
|
|
|
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
|
|
|
|
|
this.sureBtn=Util.GetGameObject(gameObject,"sureBtn")
|
|
|
|
|
this.fightBtn=Util.GetGameObject(gameObject,"sureBtn/fightBtn")
|
|
|
|
|
this.fightBtnText=Util.GetGameObject(this.fightBtn,"Text"):GetComponent("Text")
|
|
|
|
|
this.fightBtnIcon=Util.GetGameObject(this.fightBtn,"Icon"):GetComponent("Image")
|
|
|
|
|
this.fightBtnNum=Util.GetGameObject(this.fightBtn,"IconNum"):GetComponent("Text")
|
|
|
|
|
this.fightBtn.gameObject:SetActive(true)
|
|
|
|
|
this.returnLook=Util.GetGameObject(gameObject,"returnLook")
|
2021-05-25 20:50:23 +08:00
|
|
|
|
this.returnLook.gameObject:SetActive(false)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
this.tip = Util.GetGameObject(gameObject,"tip"):GetComponent("Text")
|
2021-05-28 15:01:18 +08:00
|
|
|
|
Util.GetGameObject(gameObject, "RoleGrid/FrontImage"):GetComponent("Image").sprite = this.spLoader:LoadSprite("bd_xinqianpai_zh")
|
|
|
|
|
Util.GetGameObject(gameObject, "RoleGrid/BehindImage"):GetComponent("Image").sprite = this.spLoader:LoadSprite("bd_xinhoupai_zh")
|
|
|
|
|
this.returnLook:GetComponent("Image").sprite = this.spLoader:LoadSprite("s_silingshilian_huifanganniu_zh")
|
|
|
|
|
Util.GetGameObject(gameObject, "Power"):GetComponent("Image").sprite = this.spLoader:LoadSprite("t_tongyong-zhanli_zh")
|
2021-05-25 14:51:26 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:BindEvent()
|
|
|
|
|
Util.AddClick(this.sureBtn, function()
|
|
|
|
|
this:BtnClickEvent()
|
|
|
|
|
end)
|
2021-05-25 20:50:23 +08:00
|
|
|
|
-- Util.AddClick(this.returnLook, function()
|
|
|
|
|
-- --faxieyi
|
|
|
|
|
-- local tempData = {}
|
|
|
|
|
-- NetManager.GetRePlayData(curType,waveId,function(msg)
|
|
|
|
|
-- tempData = msg.userRank
|
|
|
|
|
-- if not tempData or #tempData < 1 then
|
|
|
|
|
-- PopupTipPanel.ShowTip("无通关记录!")
|
|
|
|
|
-- else
|
|
|
|
|
-- UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.FourElementReturnLook,waveId,curType,tempData)
|
|
|
|
|
-- end
|
|
|
|
|
-- end)
|
|
|
|
|
-- end)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
Util.AddClick(this.backBtn, function()
|
|
|
|
|
parent:ClosePanel()
|
2021-05-27 11:07:32 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.MonsterCamp.UpdatePanel)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
function this:BtnClickEvent()
|
|
|
|
|
local x = function()
|
2021-05-26 11:48:44 +08:00
|
|
|
|
NetManager.SweepDemonRequest(waveId,false,function(msg)
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,msg.Drop,1,function()
|
|
|
|
|
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.MONSTERCAMP_BATTLENUM, 1)
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.MonsterCamp.UpdatePri)
|
|
|
|
|
this:SetIcon()
|
|
|
|
|
CheckRedPointStatus(RedPointType.EpicExplore_MoppingUp)
|
|
|
|
|
end)
|
2021-05-25 20:50:23 +08:00
|
|
|
|
end)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
end
|
2021-05-25 20:50:23 +08:00
|
|
|
|
if waveId == MonsterCampManager.monsterWave - 1 then
|
2021-05-25 14:51:26 +08:00
|
|
|
|
LogGreen(freeTime..buyTime)
|
|
|
|
|
if freeTime <=0 and buyTime <= 0 then
|
|
|
|
|
PopupTipPanel.ShowTip("今日已无扫荡次数!")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if freeTime <= 0 then
|
|
|
|
|
if BagManager.GetItemCountById(itemId) < costNum then
|
2021-05-26 11:48:44 +08:00
|
|
|
|
PopupTipPanel.ShowTip(string.format(Language[10298], itemConfig[itemId].Name))
|
2021-05-25 14:51:26 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
MsgPanel.ShowTwo(string.format("是否花费%s%s购买一次扫荡次数?",costNum,itemConfig[itemId].Name),function() end,function()
|
|
|
|
|
ShopManager.RequestBuyShopItem(SHOP_TYPE.FUNCTION_SHOP,storeDataId,1,function()
|
2021-05-26 11:48:44 +08:00
|
|
|
|
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.MONSTERCAMP_BUY_BATTLENUM, 1)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
x()
|
|
|
|
|
end)
|
|
|
|
|
end,"取消","确定")
|
|
|
|
|
else
|
|
|
|
|
x()
|
|
|
|
|
end
|
2021-05-25 20:50:23 +08:00
|
|
|
|
elseif (waveId == MonsterCampManager.monsterWave) then
|
|
|
|
|
-- if data.canFightTime > 0 then
|
|
|
|
|
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.MONSTER_CAMP)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
parent:ClosePanel()
|
2021-05-25 20:50:23 +08:00
|
|
|
|
-- else
|
|
|
|
|
-- PopupTipPanel.ShowTip("今日已无可挑战层数!")
|
|
|
|
|
-- end
|
2021-05-25 14:51:26 +08:00
|
|
|
|
else
|
|
|
|
|
parent:ClosePanel()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:SetIcon()
|
2021-05-25 20:50:23 +08:00
|
|
|
|
freeTime = MonsterCampManager.GetCanBattleCount()
|
|
|
|
|
buyTime = MonsterCampManager.GetCanBuyBattleCount()
|
|
|
|
|
storeDataId,itemId,costNum = MonsterCampManager.MonsterCampGetCost()
|
2021-05-26 11:48:44 +08:00
|
|
|
|
Util.SetGray(this.sureBtn,false)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
this.fightBtnIcon.gameObject:SetActive(false)
|
|
|
|
|
this.fightBtnNum.gameObject:SetActive(false)
|
2021-05-28 15:01:18 +08:00
|
|
|
|
this.sureBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_button_002")
|
2021-05-26 10:00:30 +08:00
|
|
|
|
this.tip.text = "奖励"
|
2021-05-25 20:50:23 +08:00
|
|
|
|
if waveId == MonsterCampManager.monsterWave - 1 then
|
2021-05-25 14:51:26 +08:00
|
|
|
|
if freeTime > 0 then
|
|
|
|
|
this.fightBtnText.text = string.format("<color=#%s>%s</color>","17232A","免费扫荡")
|
|
|
|
|
else
|
|
|
|
|
this.fightBtnIcon.gameObject:SetActive(true)
|
|
|
|
|
this.fightBtnNum.gameObject:SetActive(true)
|
2021-05-28 15:01:18 +08:00
|
|
|
|
this.fightBtnIcon.sprite = this.spLoader:LoadSprite(GetResourcePath(itemConfig[itemId].ResourceID))
|
2021-05-25 14:51:26 +08:00
|
|
|
|
local color = 0
|
|
|
|
|
if BagManager.GetItemCountById(itemId) < costNum then
|
|
|
|
|
color = "E71515"
|
|
|
|
|
else
|
|
|
|
|
color = "17232A"
|
|
|
|
|
end
|
|
|
|
|
this.fightBtnNum.text =string.format("<color=#%s>%s</color>",color,costNum)
|
|
|
|
|
this.fightBtnText.text = string.format("<color=#%s>%s</color>",color,"扫荡")
|
|
|
|
|
if buyTime < 1 then
|
2021-05-26 11:48:44 +08:00
|
|
|
|
Util.SetGray(this.sureBtn,true)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-05-25 20:50:23 +08:00
|
|
|
|
elseif (waveId == MonsterCampManager.monsterWave) then
|
2021-05-28 15:01:18 +08:00
|
|
|
|
this.sureBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_button_001")
|
2021-05-25 14:51:26 +08:00
|
|
|
|
this.fightBtnText.text = string.format("<color=#%s>%s</color>","17232A","挑 战")
|
|
|
|
|
else
|
|
|
|
|
this.fightBtnText.text =string.format("<color=#%s>%s</color>","17232A","确定")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnShow(_parent,...)
|
|
|
|
|
parent=_parent
|
|
|
|
|
sortingOrder = _parent.sortingOrder
|
|
|
|
|
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
|
|
|
|
|
local args = {...}
|
2021-05-25 20:50:23 +08:00
|
|
|
|
waveId = args[1]
|
|
|
|
|
configData = ConfigManager.GetConfigData(ConfigName.FloodConfig,waveId)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
this:SetIcon()
|
2021-05-25 20:50:23 +08:00
|
|
|
|
rewardData = configData.RewardShow
|
2021-05-25 14:51:26 +08:00
|
|
|
|
this:FormationAdapter()
|
|
|
|
|
end
|
|
|
|
|
-- 编队数据匹配
|
|
|
|
|
function this:FormationAdapter()
|
2021-05-25 20:50:23 +08:00
|
|
|
|
this.titleText.text = string.format("%s层",configData.Id)
|
|
|
|
|
this.power.text = configData.Force
|
|
|
|
|
local bossTeaminfo = ConfigManager.GetConfigData(ConfigName.MonsterGroup,configData.Monster).Contents[1]
|
2021-05-25 14:51:26 +08:00
|
|
|
|
for i = 1, #heroListGo do
|
|
|
|
|
if (bossTeaminfo[i]) and bossTeaminfo[i] > 0 then
|
2021-05-28 15:01:18 +08:00
|
|
|
|
heroListGo[i].transform.parent:GetComponent("Image").sprite= this.spLoader:LoadSprite("t_chengyuankuang_kuang")
|
2021-05-25 14:51:26 +08:00
|
|
|
|
this.SetCardSingleData(heroListGo[i],bossTeaminfo[i],i)
|
|
|
|
|
heroListGo[i]:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
heroListGo[i]:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-11-26 14:27:24 +08:00
|
|
|
|
ResetItemView(this.root,this.root.transform,itemList,5,1,sortingOrder,false,rewardData)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.OnSortingOrderChange()
|
|
|
|
|
for i = 1, #heroListGo do
|
|
|
|
|
Util.AddParticleSortLayer(heroListGo[i], self.sortingOrder - sortingOrder)
|
|
|
|
|
end
|
|
|
|
|
sortingOrder = self.sortingOrder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置单个上阵英雄信息
|
|
|
|
|
function this.SetCardSingleData(o,monsterId, _pos)
|
|
|
|
|
local yuanImage=Util.GetGameObject(o,"yuanImage")
|
|
|
|
|
yuanImage:SetActive(false)
|
|
|
|
|
local hp = Util.GetGameObject(o,"hpProgress")
|
|
|
|
|
hp:SetActive(false)
|
|
|
|
|
local rage = Util.GetGameObject(o,"rageProgress")
|
|
|
|
|
rage:SetActive(false)
|
|
|
|
|
|
|
|
|
|
local monsterconfig = ConfigManager.GetConfigData(ConfigName.MonsterConfig, monsterId)
|
|
|
|
|
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, monsterconfig.MonsterId)
|
|
|
|
|
|
|
|
|
|
local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image")
|
2023-11-10 15:49:20 +08:00
|
|
|
|
-- bg.sprite = this.spLoader:LoadSprite(GetHeroCardStarBg[monsterconfig.Star])
|
2021-05-25 14:51:26 +08:00
|
|
|
|
local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image")
|
2023-11-10 15:49:20 +08:00
|
|
|
|
-- fg.sprite = this.spLoader:LoadSprite(GetHeroCardStarFg[monsterconfig.Star])
|
2021-05-25 14:51:26 +08:00
|
|
|
|
|
|
|
|
|
-- local live=Util.GetGameObject(o,"Mask/Live")
|
|
|
|
|
local lv=Util.GetGameObject(o,"lv/Text"):GetComponent("Text")
|
|
|
|
|
lv.text=monsterconfig.Level
|
|
|
|
|
|
|
|
|
|
local pro=Util.GetGameObject(o,"Pro/Image"):GetComponent("Image")
|
2021-05-28 15:01:18 +08:00
|
|
|
|
pro.sprite= this.spLoader:LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
|
2021-05-25 14:51:26 +08:00
|
|
|
|
local starGrid=Util.GetGameObject(o,"StarGrid")
|
2021-09-02 11:19:29 +08:00
|
|
|
|
SetCardStars(starGrid,monsterconfig.Star)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
local name=Util.GetGameObject(o,"Name/Text"):GetComponent("Text")
|
|
|
|
|
name.text=heroConfig.ReadingName
|
|
|
|
|
|
|
|
|
|
local live = Util.GetGameObject(o, "Mask/icon"):GetComponent("RawImage")
|
2021-11-29 17:07:28 +08:00
|
|
|
|
live.transform.rotation=Vector3.New(0,0,0)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
local liveName = GetResourcePath(heroConfig.Live)
|
|
|
|
|
local roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroConfig.Id)
|
|
|
|
|
local scale = roleConfig.play_liveScale
|
2023-11-10 16:07:52 +08:00
|
|
|
|
local livePos = Vector3.New(roleConfig.offset[1], roleConfig.offset[2]+300, 0)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
live.texture = CardRendererManager.GetSpineTexture(_pos, liveName, Vector3.one * scale, livePos, true)
|
|
|
|
|
live.transform.localScale = Vector3.one
|
|
|
|
|
live.transform.localPosition = Vector3.zero
|
2021-11-29 17:07:28 +08:00
|
|
|
|
if heroConfig.Toward==2 then
|
|
|
|
|
SetHEeroLiveToward(live,1)
|
|
|
|
|
end
|
2021-05-25 14:51:26 +08:00
|
|
|
|
local zs = Util.GetGameObject(o, "zs")
|
2021-09-02 11:19:29 +08:00
|
|
|
|
local zsName = GetHeroCardStarZs[monsterconfig.Star]
|
2021-05-25 14:51:26 +08:00
|
|
|
|
if zsName == "" then
|
|
|
|
|
zs:SetActive(false)
|
|
|
|
|
else
|
|
|
|
|
zs:SetActive(true)
|
2021-05-28 15:01:18 +08:00
|
|
|
|
zs:GetComponent("Image").sprite = this.spLoader:LoadSprite(zsName)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
end
|
2021-09-02 11:19:29 +08:00
|
|
|
|
local effect = Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai")
|
|
|
|
|
effect.gameObject:SetActive(monsterconfig.Star > 9)
|
2022-01-05 18:17:44 +08:00
|
|
|
|
SetHeroFormationFlyEffect(o,this.spLoader,effect,monsterconfig.Star,sortingOrder + 1)
|
2021-09-02 11:19:29 +08:00
|
|
|
|
Util.SetParticleSortLayer(effect.gameObject, sortingOrder + 1)
|
2021-05-25 14:51:26 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnClose()
|
2021-09-02 11:19:29 +08:00
|
|
|
|
sortingOrder = 0
|
2021-05-25 14:51:26 +08:00
|
|
|
|
rewardData = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnDestroy()
|
2021-09-02 11:19:29 +08:00
|
|
|
|
sortingOrder = 0
|
2021-05-28 14:18:41 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2021-05-25 14:51:26 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return this
|