2188 lines
96 KiB
Lua
2188 lines
96 KiB
Lua
require("Base/BasePanel")
|
|
FightPointPassMainPanel = Inherit(BasePanel)
|
|
local this = FightPointPassMainPanel
|
|
-- 外地入侵模块
|
|
local invadeMonster = require("Modules/Fight/View/InvadeMonsterView")
|
|
-- 小人行动
|
|
--local roleWalkView = require("Modules/Fight/View/RoleShowView")
|
|
-- 小地图
|
|
--local fightMap = require("Modules/Fight/View/FightPointMapView")
|
|
local fightLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig)
|
|
local fightLevelSetConfig = ConfigManager.GetConfig(ConfigName.MainLevelSettingConfig)
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
local aaa=ConfigManager.GetConfigData(ConfigName.SpecialConfig,180).Value
|
|
local soliderSettingConfig=ConfigManager.GetConfig(ConfigName.SoldiersSetting)
|
|
local soldierStageConfig=ConfigManager.GetConfig(ConfigName.SoldierStageConfig)
|
|
local propertyConfig=ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|
local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig)
|
|
local curSoliderStageConfig
|
|
local cost=string.split(aaa,"#")
|
|
local points = {}
|
|
local isCounting = false
|
|
local orginLayer=0
|
|
local hasLoad = false
|
|
local hasMap = false
|
|
this.funcBtnList = {}
|
|
local curMianTaskData = {}
|
|
local timePressStarted
|
|
local callBack
|
|
this.thread=nil --协程
|
|
local count = 1
|
|
local autoTimer=nil
|
|
local maxKillNum=10
|
|
local curKillNum=0
|
|
local timeImg = {
|
|
[1] = "r_guanka_daojishi_01",
|
|
[2] = "r_guanka_daojishi_02",
|
|
[3] = "r_guanka_daojishi_03",
|
|
[4] = "r_guanka_daojishi_04",
|
|
[5] = "r_guanka_daojishi_05",
|
|
}
|
|
|
|
-- 关卡颜色文字
|
|
local textColor = {
|
|
[FightDifficultyState.SimpleLevel] = "F1E1C0FF",
|
|
[FightDifficultyState.NrmalLevel] = "F1E1C0FF",
|
|
[FightDifficultyState.DifficultyLevel] = "F1E1C0FF",
|
|
[FightDifficultyState.HellLevel] = "F1E1C0FF",
|
|
[FightDifficultyState.NightmareLevel] = "F1E1C0FF",
|
|
}
|
|
|
|
-- 是否激活了动画
|
|
local isAnimActive = false
|
|
local chooseAnim = 0
|
|
-- 转场动画
|
|
local fightAnimRes = "live2d_guaji_yuguai"
|
|
-- local fightSkeleton
|
|
local fightAnim = {
|
|
[2] = "diban",
|
|
[3] = "xiaoguai",
|
|
[4] = "bnoss",
|
|
[1] = "idle",
|
|
}
|
|
|
|
local heroSpineList={}
|
|
local timeStamp=4
|
|
local specialConfig=ConfigManager.GetConfigData(ConfigName.SpecialConfig,179)
|
|
if specialConfig and specialConfig.Value then
|
|
timeStamp=tonumber(specialConfig.Value)
|
|
end
|
|
|
|
--初始化组件(用于子类重写)
|
|
function FightPointPassMainPanel:InitComponent()
|
|
|
|
invadeMonster:InitComponent(self.gameObject, this)
|
|
this.spLoader = SpriteLoader.New()
|
|
isAnimActive = false
|
|
--fightMap:InitComponent(self.gameObject, this)
|
|
-- 通关豪礼入口
|
|
this.pgBtn=Util.GetGameObject(self.gameObject,"LeftUp/box/passGift")
|
|
this.pgFrame=Util.GetGameObject(this.pgBtn,"frame"):GetComponent("Image")
|
|
this.pgHead=Util.GetGameObject(this.pgBtn,"head"):GetComponent("Image")
|
|
this.pgGive=Util.GetGameObject(this.pgBtn,"give"):GetComponent("Text")
|
|
this.pgName=Util.GetGameObject(this.pgBtn,"name"):GetComponent("Text")
|
|
this.pgInfo=Util.GetGameObject(this.pgBtn,"info"):GetComponent("Text")
|
|
this.pgEffect=Util.GetGameObject(this.pgBtn,"effect")
|
|
|
|
-- 四个小按钮
|
|
this.btnDailyMission = Util.GetGameObject(self.gameObject, "Bg/btnGroup/btnDailyMission")
|
|
this.btnDailyMission:GetComponent("Image").sprite=this.spLoader:LoadSprite("g_guanka_richangrenwu_zh")
|
|
this.btnRank = Util.GetGameObject(self.gameObject, "Bg/btnGroup/btnRank")
|
|
this.btnRank:GetComponent("Image").sprite=this.spLoader:LoadSprite("g_guanka_guankapaihang_zh")
|
|
|
|
-- 关卡小地图
|
|
this.btnMap = Util.GetGameObject(self.gameObject, "Bg/btnArea")
|
|
this.btnMapRadarBG = Util.GetGameObject(self.gameObject, "Bg/btnArea/RadarBG/RadarBG"):GetComponent("Image")
|
|
this.RadarBGText = Util.GetGameObject(self.gameObject, "Bg/btnArea/RadarBGTextBg/RadarBGText"):GetComponent("Text")
|
|
this.areaName = Util. GetGameObject(this.btnMap, "areaName"):GetComponent("Text")
|
|
this.chapterName = Util.GetGameObject(this.btnMap, "chapterName"):GetComponent("Text")
|
|
SetEnglishActive(this.chapterName)
|
|
|
|
this.map=Util.GetGameObject(self.gameObject, "Bg/btnArea/MapMask/Map"):GetComponent("RectTransform")
|
|
this.mapImage=Util.GetGameObject(self.gameObject,"Bg/btnArea/MapMask/Map"):GetComponent("Image")
|
|
for i = 1, 20 do
|
|
points[i]=Util.GetGameObject(self.gameObject, "Bg/btnArea/MapMask/Map/mapAreaPre (".. i ..")")
|
|
end
|
|
|
|
-- 挂机奖励
|
|
this.rewardList = {}
|
|
this.rewardItemPre = Util.GetGameObject(self.gameObject, "Bg/rewardContent/item")
|
|
this.rewardGrid = Util.GetGameObject(self.gameObject, "Bg/rewardContent")
|
|
|
|
|
|
this.btnrewardDetail = Util.GetGameObject(self.gameObject, "Bg/btnRdDetail/click")
|
|
|
|
this.btnFight = Util.GetGameObject(self.gameObject, "Bg/btnDown/btnFight")
|
|
this.fightText = Util.GetGameObject(this.btnFight, "Text"):GetComponent("Text")
|
|
this.fightSaoGuang = Util.GetGameObject(this.btnFight, "saoguang")
|
|
LanguageFontSizeFilter(this.fightText, 50)
|
|
-- 你要变强
|
|
this.btnGetForce = Util.GetGameObject(self.gameObject, "Bg/btnDown/btnIWantMilk")
|
|
Util.GetGameObject(self.gameObject, "Bg/btnDown/btnIWantMilk/Text"):GetComponent("Text").text="推荐阵容"
|
|
this.milkRed=Util.GetGameObject(self.gameObject, "Bg/btnDown/btnIWantMilk/redPoint")
|
|
this.hookKill = Util.GetGameObject(self.gameObject, "Bg/btnDown/hookKill")
|
|
this.hookKillText = Util.GetGameObject(self.gameObject, "Bg/btnDown/hookKill/Text"):GetComponent("Text")
|
|
this.red_light = Util.GetGameObject(self.gameObject, "Bg/red_light")
|
|
this.red_light:SetActive(false)
|
|
this.red_wei = Util.GetGameObject(self.gameObject, "Bg/red_light/wei")
|
|
this.hookSkillBtn=Util.GetGameObject(self.gameObject, "Bg/red_light/skillBtn")
|
|
|
|
|
|
if not this.playerInfoView then
|
|
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
|
|
end
|
|
this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform)
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
|
|
|
-- 红点
|
|
this.dailyRedPoint = Util.GetGameObject(this.btnDailyMission, "redPoint")
|
|
this.dailyRedPoint:SetActive(false)
|
|
--this.rankRedPoint = Util.GetGameObject(this.btnRank, "redPoint")
|
|
|
|
--this.funcBtnList[16] = invadeMonster.btnRewardOnline
|
|
--this.funcBtnList[19] = invadeMonster.btnRewrdChapter
|
|
--this.funcBtnList[12] = this.btnDailyMission
|
|
this.btnDailyMission:SetActive(false)
|
|
-- 主线任务显示
|
|
this.mainTask = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask")
|
|
this.goVipButton = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/progressLayout")
|
|
this.titleText = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/progressLayout/titleText"):GetComponent("Text")
|
|
this.progressText = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/progressLayout/progressText"):GetComponent("Text")
|
|
this.getRewardButton = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/getRewardButton")
|
|
this.mainTaskGRewardImage = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/getRewardButton/getRewardImage")
|
|
this.mainTaskJumpImage = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/getRewardButton/jumpImage")
|
|
-- 解锁提示
|
|
this.OpenTips = Util.GetGameObject(self.gameObject, "Bg/RightDown/OpenTips")
|
|
this.OpenTipsTxt = Util.GetGameObject(self.gameObject, "Bg/RightDown/OpenTips/Image/Text"):GetComponent("Text")
|
|
|
|
this.GuideEffectGo = poolManager:LoadAsset("GuideEffect", PoolManager.AssetType.GameObject)
|
|
this.GuideEffectGo.transform:SetParent(this.mainTaskGRewardImage.transform)
|
|
this.GuideEffectGo.transform.localPosition = Vector3.zero
|
|
this.GuideEffectGo.transform.localScale = Vector3.one
|
|
Util.GetGameObject(this.GuideEffectGo, "GameObject"):SetActive(false)
|
|
this.GuideJumpEffectGo = poolManager:LoadAsset("GuideEffect", PoolManager.AssetType.GameObject)
|
|
this.GuideJumpEffectGo.transform:SetParent(this.mainTaskJumpImage.transform)
|
|
this.GuideJumpEffectGo.transform.localPosition = Vector3.zero
|
|
this.GuideJumpEffectGo.transform.localScale = Vector3.one
|
|
Util.GetGameObject(this.GuideJumpEffectGo, "GameObject"):SetActive(false)
|
|
this.GuideJumpEffectGo:SetActive(false)
|
|
|
|
this.fightRP = Util.GetGameObject(this.btnFight, "redPoint")
|
|
-- 按钮
|
|
this.fightLock = Util.GetGameObject(this.btnFight, "lock")
|
|
this.lockText = Util.GetGameObject(this.fightLock, "Text"):GetComponent("Text")
|
|
|
|
--倒计时5秒
|
|
this.timeRoot = Util.GetGameObject(this.btnFight, "countRoot")
|
|
this.timeImg = Util.GetGameObject(this.timeRoot, "time"):GetComponent("Image")
|
|
this.timeRoot:SetActive(false)
|
|
|
|
FightPointPassManager.GetLastFightID()
|
|
--寻宝入口
|
|
this.btnFindTreasure = Util.GetGameObject(self.gameObject, "Bg/btnFindTreasure/Button")
|
|
this.btnFindTreasure:GetComponent("Image").sprite=this.spLoader:LoadSprite("x_xb_quan_01_zh")
|
|
this.btnFindTreasureImage = Util.GetGameObject(self.gameObject, "Bg/btnFindTreasure/Button/RadarBG"):GetComponent("Image")
|
|
this.btnFindTreasureText = Util.GetGameObject(self.gameObject, "Bg/btnFindTreasure/Image/num"):GetComponent("Text")
|
|
this.btnFindTreasureredPoint = Util.GetGameObject(self.gameObject, "Bg/btnFindTreasure/redPoint")
|
|
--逍遥游入口
|
|
this.btnXiaoYao=Util.GetGameObject(self.gameObject,"Bg/RightUpVertical/xiaoyaoBtn")
|
|
this.btnXiaoYao:GetComponent("Image").sprite=this.spLoader:LoadSprite("x_xiaoyaoyou_daanniu_zh")
|
|
this.xiaoyaoRedPoint=Util.GetGameObject(self.gameObject,"Bg/RightUpVertical/xiaoyaoBtn/redPoint")
|
|
this.funcBtnList[FUNCTION_OPEN_TYPE.XiaoYaoYou] = this.btnXiaoYao
|
|
--数字游戏按钮
|
|
this.numberGameBtn=Util.GetGameObject(self.gameObject,"Bg/RightUpVertical/numberGameBtn")
|
|
this.numberGameBtn:SetActive(false)
|
|
this.numberGameRed=Util.GetGameObject(self.gameObject,"Bg/RightUpVertical/numberGameBtn/redPoint")
|
|
--this.funcBtnList[FUNCTION_OPEN_TYPE.Number_Game] = this.numberGameBtn
|
|
--解锁功能
|
|
this.openFun = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/openFun")
|
|
this.openFunNeedInfo = Util.GetGameObject(self.gameObject, "Bg/btnDown/btnFight/needInfo"):GetComponent("Text")
|
|
this.openFunFunInfo = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/openFun/funInfo"):GetComponent("Text")
|
|
--世界等级
|
|
Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/worldLv/Text"):GetComponent("Text").text = "世界等级:"
|
|
this.worldLv = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/worldLv/lv"):GetComponent("Text")
|
|
-- 开服福利
|
|
this.UI_Effect_MuBiaoJiangLi = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnOpenSeverWelfare/UI_Effect_MuBiaoJiangLi")
|
|
this.btnOpenSeverWelfare = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnOpenSeverWelfare")
|
|
this.btnFirstRechar = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnFirstRecharge")
|
|
Util.GetGameObject(this.btnFirstRechar, "Image"):GetComponent("Image").sprite=this.spLoader:LoadSprite("r_zjm_huodongicon-shunwukongshouchong_zh")
|
|
this.firstRedPoint=Util.GetGameObject(this.btnFirstRechar, "redPoint")
|
|
this.OpenSeverWelfare = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnOpenSeverWelfare/bg")
|
|
this.OpenSeverWelfareicon = Util.GetGameObject(this.UI_Effect_MuBiaoJiangLi, "UI_MuBiaoJiangLi_Import_05"):GetComponent("Image")
|
|
this.OpenSeverWelfareiconText = Util.GetGameObject(this.OpenSeverWelfare, "iconText"):GetComponent("Image")
|
|
this.OpenSeverWelfareProgressBg = Util.GetGameObject(this.OpenSeverWelfare, "progressBg")
|
|
this.OpenSeverWelfareProgressText = Util.GetGameObject(this.OpenSeverWelfare, "progressBg/progress"):GetComponent("Text")
|
|
this.OpenSeverWelfareProgressImage = Util.GetGameObject(this.OpenSeverWelfare, "progressBg/progressImage"):GetComponent("Image")
|
|
this.OpenSeverWelfareTimeText = Util.GetGameObject(this.OpenSeverWelfare, "time"):GetComponent("Text")
|
|
this.OpenSeverWelfareTimeText.gameObject:SetActive(false)
|
|
this.OpenSeverWelfareInfoText = Util.GetGameObject(this.OpenSeverWelfare, "info"):GetComponent("Text")
|
|
this.OpenSeverWelfareRed = Util.GetGameObject(this.OpenSeverWelfare, "redpot")
|
|
this.battleUpLvTip = Util.GetGameObject(self.gameObject, "Bg/btnDown/battleUpLvTip")
|
|
this.battleUpLvTipImg = this.battleUpLvTip:GetComponent("Image")
|
|
this.battleUpLvTipTxt = Util.GetGameObject(self.gameObject, "Bg/btnDown/battleUpLvTip/Text"):GetComponent("Text")
|
|
this.battleLockGo = Util.GetGameObject(self.gameObject, "Bg/btnDown/battleUpLvTip/Image")
|
|
--山河社稷图
|
|
this.btnFightLevel = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnFightLevel")
|
|
this.btnFightLevel:SetActive(false)
|
|
-- this.funcBtnList[FUNCTION_OPEN_TYPE.FIGHTLEVEL] = this.btnFightLevel
|
|
-- this.btnFightLevelRedPoint = Util.GetGameObject(this.btnFightLevel, "redPoint")
|
|
|
|
--小兵系统
|
|
this.btn_lv=Util.GetGameObject(self.gameObject, "soldierObj/btn_lv")
|
|
this.btnlvRed=Util.GetGameObject(self.gameObject, "soldierObj/btn_lv/redPoint")
|
|
this.lvTxt=Util.GetGameObject(self.gameObject, "soldierObj/btn_lv/Text"):GetComponent("Text")
|
|
this.lvBar=Util.GetGameObject(self.gameObject, "soldierObj/Slide/Image"):GetComponent("Image")
|
|
this.lvBarTxt=Util.GetGameObject(self.gameObject, "soldierObj/Slide/Text"):GetComponent("Text")
|
|
this.btn_draw=Util.GetGameObject(self.gameObject, "soldierObj/btn_draw")
|
|
this.btn_change=Util.GetGameObject(self.gameObject, "soldierObj/btn_change")
|
|
this.chouRed=Util.GetGameObject(self.gameObject, "soldierObj/chouRed")
|
|
this.fightGuideEffect = Util.GetGameObject(self.gameObject, "soldierObj/GuideEffect")
|
|
this.changeBtnImg=Util.GetGameObject(self.gameObject, "soldierObj/btn_change"):GetComponent("Image")
|
|
this.costImg=Util.GetGameObject(self.gameObject, "soldierObj/costImg"):GetComponent("Image")
|
|
this.costTxt=Util.GetGameObject(self.gameObject, "soldierObj/Text"):GetComponent("Text")
|
|
this.costImg.sprite=SetIcon(this.spLoader,tonumber(cost[1]))
|
|
|
|
--兵种信息
|
|
this.soliderList={}
|
|
for i=1,12 do
|
|
local go=Util.GetGameObject(self.gameObject, "soldierObj/grid/pre (".. i..")")
|
|
this.soliderList[i]={}
|
|
this.soliderList[i].go=go
|
|
this.soliderList[i].bg=Util.GetGameObject(go, "bg"):GetComponent("Image")
|
|
this.soliderList[i].icon=Util.GetGameObject(go, "icon"):GetComponent("Image")
|
|
this.soliderList[i].lv=Util.GetGameObject(go, "lv"):GetComponent("Text")
|
|
this.soliderList[i].type=Util.GetGameObject(go, "type"):GetComponent("Text")
|
|
this.soliderList[i].lock=Util.GetGameObject(go, "Image")
|
|
this.soliderList[i].effect=Util.GetGameObject(go, "effect")
|
|
this.soliderList[i].stateImg=Util.GetGameObject(go, "changeImg"):GetComponent("Image")
|
|
end
|
|
--战斗部分
|
|
this.battlePanel=Util.GetGameObject(self.gameObject, "Bg/battlePanel")
|
|
this.btn_help=Util.GetGameObject(self.gameObject, "btn_faq")
|
|
this.enemyPos=Util.GetGameObject(self.gameObject, "battlePanel/enemyPos/pos")
|
|
local aaa={}
|
|
aaa.role={}
|
|
aaa.role.camp=1
|
|
this.Floater = FloatNode.New(aaa, this.enemyPos, this.enemyPos)
|
|
this.heroList={}
|
|
for i=1,6 do
|
|
this.heroList[i]={}
|
|
local obj=Util.GetGameObject(self.gameObject, "battlePanel/heroPos/hero1 (".. i ..")")
|
|
this.heroList[i].go=obj
|
|
this.heroList[i].pos=Util.GetGameObject(this.heroList[i].go, "pos")
|
|
this.heroList[i].effect = poolManager:LoadAsset("c_xy_0012_skeff_slidesk_ballistic", PoolManager.AssetType.GameObject)
|
|
this.heroList[i].effect.transform:SetParent(this.heroList[i].pos.transform)
|
|
this.heroList[i].effect.transform.localScale = Vector3.one
|
|
this.heroList[i].effect.transform.localPosition = Vector3.New(0, 0, 0)
|
|
this.heroList[i].effect:SetActive(false)
|
|
end
|
|
this.soliderGrid=Util.GetGameObject(self.gameObject, "battlePanel/soliderPos")
|
|
this.soliderPre=Util.GetGameObject(self.gameObject, "battlePanel/soliderPre")
|
|
this.timeTxt=Util.GetGameObject(self.gameObject, "battlePanel/timeTxt"):GetComponent("Text")
|
|
this.hpTxt=Util.GetGameObject(self.gameObject, "battlePanel/hpTxt"):GetComponent("Text")
|
|
this.openTip = Util.GetGameObject(self.gameObject, "battlePanel/openTip"):GetComponent("Text")
|
|
this.floorTxt=Util.GetGameObject(self.gameObject, "battlePanel/floorTxt"):GetComponent("Text")
|
|
this.bossObj=Util.GetGameObject(self.gameObject, "Bg/btnDown/bossObj")
|
|
this.bossImg=Util.GetGameObject(self.gameObject, "Bg/btnDown/bossObj/icon"):GetComponent("Image")
|
|
this.bossNum=Util.GetGameObject(self.gameObject, "Bg/btnDown/bossObj/num"):GetComponent("Text")
|
|
this.hpBar=Util.GetGameObject(self.gameObject, "battlePanel/hpBar/Image"):GetComponent("Image")
|
|
this.hpBar2=Util.GetGameObject(self.gameObject, "battlePanel/hpBar/Image1"):GetComponent("Image")
|
|
this.numTxt=Util.GetGameObject(self.gameObject, "battlePanel/hpBar/numTxt"):GetComponent("Text")
|
|
this.onHookObj= Util.GetGameObject(self.gameObject, "Bg/getBoxReward/Button")
|
|
this.btn_hookReward=Util.GetGameObject(self.gameObject, "Bg/getBoxReward/Button")
|
|
this.btnAutoObj=Util.GetGameObject(self.gameObject, "soldierObj/btn_auto")
|
|
this.btn_auto=Util.GetGameObject(self.gameObject, "soldierObj/btn_auto/Image")
|
|
this.autoTxt=Util.GetGameObject(self.gameObject, "soldierObj/btn_auto/Text"):GetComponent("Text")
|
|
this.drawTipObj=Util.GetGameObject(self.gameObject, "soldierObj/drawOpenTip")
|
|
this.drawTipTxt=Util.GetGameObject(self.gameObject, "soldierObj/drawOpenTip/Text"):GetComponent("Text")
|
|
this.autoTxt.text="自动"
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function FightPointPassMainPanel:BindEvent()
|
|
|
|
invadeMonster:BindEvent()
|
|
Util.AddClick(this.btn_auto,function ()
|
|
if OperatingManager.IsBuyGift(2202)==false and CheckFunctionOpen(FUNCTION_OPEN_TYPE.AutoSoliderDraw)==false then
|
|
local tip=GetFunctionOpenTip(FUNCTION_OPEN_TYPE.AutoSoliderDraw)
|
|
PopupTipPanel.ShowTip(string.format("%s或未开通超级特权",tip))
|
|
return
|
|
end
|
|
|
|
|
|
if SmallSoldierManager.changeSolider then
|
|
PopupTipPanel.ShowTip("有未操作的神兵,请操作后再进行自动抽取")
|
|
return
|
|
end
|
|
if BagManager.GetItemCountById(tonumber(cost[1]))<tonumber(cost[2]) then
|
|
PopupTipPanel.ShowTip("道具不足")
|
|
SmallSoldierManager.isAuto=false
|
|
return
|
|
end
|
|
SmallSoldierManager.isAuto=true
|
|
if autoTimer then
|
|
autoTimer:Stop()
|
|
autoTimer=nil
|
|
end
|
|
UIManager.OpenPanel(UIName.SmallSoldierAutoPanel)
|
|
this.thread=coroutine.start(function()
|
|
|
|
while SmallSoldierManager.isAuto do
|
|
if SmallSoldierManager.isAuto==false then
|
|
if autoTimer then
|
|
autoTimer:Stop()
|
|
autoTimer=nil
|
|
|
|
end
|
|
return
|
|
end
|
|
if BagManager.GetItemCountById(tonumber(cost[1]))<tonumber(cost[2]) then
|
|
PopupTipPanel.ShowTip("道具不足")
|
|
SmallSoldierManager.isAuto=false
|
|
if autoTimer then
|
|
autoTimer:Stop()
|
|
autoTimer=nil
|
|
end
|
|
UIManager.ClosePanel(UIName.SmallSoldierAutoPanel)
|
|
return
|
|
end
|
|
coroutine.wait(3)
|
|
if SmallSoldierManager.changeSolider==nil then
|
|
NetManager.RecruitSoldierRequest(function ()
|
|
this.RefreshSoliderInfo()
|
|
end)
|
|
end
|
|
end
|
|
-- autoTimer=Timer.New(function ()
|
|
|
|
|
|
-- end,4,-1,true):Start()
|
|
end)
|
|
|
|
UIManager.OpenPanel(UIName.SmallSoldierAutoPanel)
|
|
end)
|
|
Util.AddClick(this.costImg.gameObject,function ()
|
|
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,tonumber(cost[1]))
|
|
end)
|
|
Util.AddClick(this.btn_help,function ()
|
|
UIManager.OpenPanel(UIName.HelpPopup,148,0,0)
|
|
end)
|
|
Util.AddClick(this.btn_change, function ()
|
|
--如果有可以替换的或可以上阵的
|
|
if SmallSoldierManager.changeSolider~=false then
|
|
UIManager.OpenPanel(UIName.SmallSoldierInfoPanel,1,SmallSoldierManager.changeSolider)
|
|
end
|
|
end)
|
|
Util.AddClick(this.btn_draw, function ()
|
|
local isOpen=CheckFunctionOpen(FUNCTION_OPEN_TYPE.SoliderDraw)
|
|
if isOpen==false then
|
|
PopupTipPanel.ShowTip(GetFunctionOpenTip(FUNCTION_OPEN_TYPE.SoliderDraw))
|
|
return
|
|
end
|
|
if BagManager.GetItemCountById(tonumber(cost[1]))<tonumber(cost[2]) then
|
|
PopupTipPanel.ShowTip("道具不足")
|
|
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,126)
|
|
return
|
|
end
|
|
NetManager.RecruitSoldierRequest(function ()
|
|
this.RefreshSoliderInfo()
|
|
end)
|
|
end)
|
|
Util.AddClick(this.btn_lv, function ()
|
|
UIManager.OpenPanel(UIName.SmallSoldierLvInfoPanel)
|
|
end)
|
|
|
|
|
|
|
|
-- 日常任务
|
|
Util.AddClick(this.btnDailyMission, function ()
|
|
FightPointPassManager.isBeginFight = true
|
|
UIManager.OpenPanel(UIName.MissionDailyPanel)
|
|
end)
|
|
|
|
-- 关卡排行
|
|
Util.AddClick(this.btnRank, function ()
|
|
--PopupTipPanel.ShowTip("关卡排行!")
|
|
FightPointPassManager.isBeginFight = true
|
|
--UIManager.OpenPanel(UIName.FightPointPassRankPopup)
|
|
UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[38])
|
|
end)
|
|
|
|
-- 挂机奖励
|
|
Util.AddClick(this.btnrewardDetail, function ()
|
|
UIManager.OpenPanel(UIName.FightAreaRewardPopup)
|
|
end)
|
|
-- 挂机奖励
|
|
Util.AddClick(this.btn_hookReward, function ()
|
|
UIManager.OpenPanel(UIName.FightAreaRewardPopup)
|
|
end)
|
|
|
|
-- 我要喝牛奶变强
|
|
Util.AddClick(this.btnGetForce, function ()
|
|
--UIManager.OpenPanel(UIName.GiveMePowerPanel)
|
|
UIManager.OpenPanel(UIName.FormationExamplePopup)
|
|
end)
|
|
|
|
Util.AddClick(this.btnFight, function ()
|
|
this.ExcuteBattle()
|
|
end)
|
|
|
|
Util.AddClick(this.hookSkillBtn, function ()
|
|
this:PlayerKillAllSkill()
|
|
end)
|
|
|
|
Util.AddClick(this.btnMap, function ()
|
|
if not FightPointPassManager.IsChapterClossState() then
|
|
UIManager.OpenPanel(UIName.FightSmallChoosePanel, FightPointPassManager.lastPassFightId)
|
|
else
|
|
UIManager.OpenPanel(UIName.FightSmallChoosePanel, FightPointPassManager.curOpenFight)
|
|
end
|
|
end)
|
|
|
|
--通关豪礼
|
|
Util.AddClick(this.pgBtn,function()
|
|
FightPointPassManager.isBeginFight = true
|
|
UIManager.OpenPanel(UIName.PassGiftPopup)
|
|
end)
|
|
--寻宝
|
|
Util.AddClick(this.btnFindTreasure,function()
|
|
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.FINDTREASURE) then
|
|
UIManager.OpenPanel(UIName.FindTreasureMainPanel)
|
|
else
|
|
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.FINDTREASURE))
|
|
end
|
|
end)
|
|
--逍遥游
|
|
Util.AddClick(this.btnXiaoYao,function()
|
|
XiaoYaoManager.OpenMapList()
|
|
end)
|
|
--数字游戏
|
|
Util.AddClick(this.numberGameBtn,function()
|
|
NetManager.GetComparenumInfoRequest(function()
|
|
UIManager.OpenPanel(UIName.RatioNumberLevelPanel)
|
|
end)
|
|
--RatioNumberManager.SelectInit()
|
|
|
|
end)
|
|
Util.AddClick(this.btnOpenSeverWelfare, function()
|
|
UIManager.OpenPanel(UIName.OpenSeverWelfarePanel)
|
|
end)
|
|
|
|
-- Util.AddClick(this.btnFightLevel, function()
|
|
-- UIManager.OpenPanel(UIName.FightLevelChapterPanel)
|
|
-- end)
|
|
|
|
Util.AddClick(this.goVipButton, function()
|
|
UIManager.OpenPanel(UIName.VipPanelV2)
|
|
end)
|
|
Util.AddClick(this.btnFirstRechar, function()
|
|
UIManager.OpenPanel(UIName.FirstRechargePanel)
|
|
end)
|
|
|
|
Util.AddClick(this.getRewardButton, function()
|
|
local t, task = VipManager.GetVipTaskShowInFight()
|
|
if t == 1 and task.state == VipTaskStatusDef.NotFinished then
|
|
local taskConfigInfo = ConfigManager.GetConfigData(ConfigName.TaskConfig, task.missionId)
|
|
JumpManager.GoJump(taskConfigInfo.Jump[1])
|
|
else
|
|
UIManager.OpenPanel(UIName.VipPanelV2)
|
|
end
|
|
end)
|
|
|
|
--BindRedPointObject(RedPointType.DailyTaskMain, this.dailyRedPoint)
|
|
--BindRedPointObject(RedPointType.SecretTer_IsCanFight, this.fightRP)
|
|
BindRedPointObject(RedPointType.XiaoYaoYouRedPoint, this.xiaoyaoRedPoint)
|
|
BindRedPointObject(RedPointType.FirstRecharge, this.firstRedPoint)
|
|
--BindRedPointObject(RedPointType.numberGame, this.numberGameRed)
|
|
BindRedPointObject(RedPointType.tuijianzhenrong, this.milkRed)
|
|
-- BindRedPointObject(RedPointType.FightLevel, this.btnFightLevelRedPoint)
|
|
end
|
|
|
|
function this.RefreshLvInfo()
|
|
|
|
end
|
|
local levelList={}
|
|
local name=""
|
|
local nextLv=0
|
|
--刷新boss信息显示
|
|
function this.RefreshBossInfo()
|
|
levelList={}
|
|
local nextBossLv=0
|
|
local curFight=FightPointPassManager.curOpenFight
|
|
name=""
|
|
nextLv=0
|
|
--LogError("刷星boss显示 curfight==========================================================="..curFight)
|
|
-- for k,v in ConfigPairs(fightLevelConfig) do
|
|
-- local aa=v
|
|
-- if k>=curFight then
|
|
-- if aa.OpenRule and (aa.OpenRule[1][1]==9 or aa.OpenRule[1][1]==0 ) and FightPointPassManager.soldierLayerId>=aa.OpenRule[1][2] then
|
|
-- --LogError("k==================================="..k)
|
|
-- if name=="" then
|
|
-- name=aa.Name
|
|
-- nextLv=v.NextLevel
|
|
-- end
|
|
-- table.insert(levelList,k)
|
|
-- end
|
|
-- end
|
|
-- end
|
|
--this.GetLevelInfo(curFight)
|
|
if nextLv==0 then
|
|
nextLv=curFight
|
|
end
|
|
local nextConfig=ConfigManager.GetConfigData(ConfigName.MainLevelConfig,nextLv)
|
|
if nextConfig then
|
|
nextBossLv=nextConfig.OpenRule[1][2]
|
|
if name=="" then
|
|
name=nextConfig.Name
|
|
end
|
|
end
|
|
LogError("nextBossLv====================="..nextBossLv)
|
|
-- if #levelList>0 then
|
|
-- this.bossObj:SetActive(true)
|
|
-- this.bossNum.text=#levelList
|
|
-- this.fightLock:SetActive(false)
|
|
-- this.fightSaoGuang:SetActive(true)
|
|
-- --this.fightGuideEffect:SetActive(true)
|
|
-- this.fightRP:SetActive(true)
|
|
-- else
|
|
-- this.bossObj:SetActive(false)
|
|
-- this.fightLock:SetActive(true)
|
|
-- this.fightRP:SetActive(false)
|
|
-- this.fightSaoGuang:SetActive(false)
|
|
-- --this.fightGuideEffect:SetActive(false)
|
|
-- --this.lockText.text=string.format("再推%s关后开启",nextBossLv-FightPointPassManager.soldierLayerId)
|
|
-- local isOk, tip, btnTxt, lockState = FightPointPassManager.CheckFightOpenRule(nextLv)
|
|
-- LogError("tip======================="..tip)
|
|
-- LogError("btntxt============================="..btnTxt)
|
|
-- this.lockText.text=tip
|
|
-- end
|
|
local isOk, tip, btnTxt, lockState = FightPointPassManager.CheckFightOpenRule(nextLv)
|
|
if isOk then
|
|
this.bossObj:SetActive(false)
|
|
this.bossNum.text=#levelList
|
|
this.fightLock:SetActive(false)
|
|
this.fightSaoGuang:SetActive(true)
|
|
--this.fightGuideEffect:SetActive(true)
|
|
this.fightRP:SetActive(true)
|
|
else
|
|
this.bossObj:SetActive(false)
|
|
this.fightLock:SetActive(true)
|
|
this.fightRP:SetActive(false)
|
|
this.fightSaoGuang:SetActive(false)
|
|
--this.fightGuideEffect:SetActive(false)
|
|
--this.lockText.text=string.format("再推%s关后开启",nextBossLv-FightPointPassManager.soldierLayerId)
|
|
this.lockText.text=tip
|
|
end
|
|
|
|
this.openFun:SetActive(true)
|
|
this.openFunNeedInfo.text=name
|
|
this.fightText.text = "挑战Boss"
|
|
|
|
end
|
|
|
|
function this.GetLevelInfo(_id)
|
|
--LogError("_id==========================".._id)
|
|
local aa=fightLevelConfig[_id]
|
|
if aa and aa.OpenRule then
|
|
local isOk, tip, btnTxt, lockState = FightPointPassManager.CheckFightOpenRule(_id)
|
|
if isOk then
|
|
if name=="" then
|
|
name=aa.Name
|
|
nextLv=aa.NextLevel
|
|
end
|
|
table.insert(levelList,aa.Id)
|
|
this.GetLevelInfo(aa.NextLevel)
|
|
else
|
|
--break
|
|
return
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--刷新小兵信息
|
|
function this.RefreshSoliderInfo()
|
|
this.RefreshBossInfo()
|
|
this.lvTxt.text=SmallSoldierManager.level
|
|
LogError("SmallSoldierManager.level===="..SmallSoldierManager.level)
|
|
local lotteryConfig=ConfigManager.GetConfigData(ConfigName.SoldiersLotteryConfig,SmallSoldierManager.level)
|
|
|
|
if lotteryConfig.Soldiers[1] and lotteryConfig.Soldiers[2] then
|
|
this.btnlvRed:SetActive(BagManager.GetItemCountById(lotteryConfig.Soldiers[1])>lotteryConfig.Soldiers[2])
|
|
this.lvBar.fillAmount = BagManager.GetItemCountById(lotteryConfig.Soldiers[1])/lotteryConfig.Soldiers[2]
|
|
this.lvBarTxt.text=string.format("兵力:%s/%s",BagManager.GetItemCountById(lotteryConfig.Soldiers[1]),lotteryConfig.Soldiers[2])
|
|
else
|
|
this.btnlvRed:SetActive(false)
|
|
this.lvBar.fillAmount = 1
|
|
this.lvBarTxt.text=string.format("兵力:%s/%s",BagManager.GetItemCountById(lotteryConfig.Soldiers[1]),0)
|
|
end
|
|
|
|
this.btn_change:SetActive(SmallSoldierManager.changeSolider~=nil)
|
|
if SmallSoldierManager.changeSolider then
|
|
local changeConfig=ConfigManager.GetConfigData(ConfigName.SoldiersSetting,SmallSoldierManager.changeSolider.id)
|
|
this.changeBtnImg.sprite=this.spLoader:LoadSprite(GetResourcePath(changeConfig.ResourceID))
|
|
end
|
|
local haveNum=BagManager.GetItemCountById(tonumber(cost[1]))
|
|
local isOpen=CheckFunctionOpen(FUNCTION_OPEN_TYPE.SoliderDraw)
|
|
if isOpen then
|
|
this.drawTipObj:SetActive(false)
|
|
Util.SetGray(this.btn_draw,false)
|
|
this.btnAutoObj:SetActive(true)
|
|
else
|
|
this.drawTipObj:SetActive(true)
|
|
this.drawTipTxt.text=GetFunctionOpenTipClient(FUNCTION_OPEN_TYPE.SoliderDraw)
|
|
Util.SetGray(this.btn_draw,true)
|
|
this.btnAutoObj:SetActive(false)
|
|
end
|
|
this.costTxt.text=haveNum
|
|
this.chouRed:SetActive(haveNum>0 and CheckFunctionOpen(FUNCTION_OPEN_TYPE.SoliderDraw))
|
|
this.fightGuideEffect:SetActive(haveNum>0 and not GuideManager.IsInMainGuide() and CheckFunctionOpen(FUNCTION_OPEN_TYPE.SoliderDraw) )
|
|
local openList=lotteryConfig.SoldierType
|
|
local dataList=SmallSoldierManager.soldierList
|
|
LogError("dataList=========================================================="..#dataList)
|
|
for i=1,#this.soliderList do
|
|
--如果这个位置有小兵
|
|
if dataList[i] then
|
|
this.soliderList[i].icon.gameObject:SetActive(true)
|
|
this.soliderList[i].lv.gameObject:SetActive(true)
|
|
this.soliderList[i].type.gameObject:SetActive(false)
|
|
|
|
--this.soliderList[i].lock:SetActive(false)
|
|
local data=dataList[i]
|
|
this.soliderList[i].bg.sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(data.quality))
|
|
local config=ConfigManager.GetConfigData(ConfigName.SoldiersSetting,data.id)
|
|
this.soliderList[i].icon.sprite=this.spLoader:LoadSprite(GetResourcePath(config.ResourceID))
|
|
Util.AddClick(this.soliderList[i].icon.gameObject,function ()
|
|
UIManager.OpenPanel(UIName.SmallSoldierUpFigthInfoPanel,data.type)
|
|
end)
|
|
this.soliderList[i].lv.text=data.level
|
|
else
|
|
this.soliderList[i].bg.sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(1))
|
|
this.soliderList[i].icon.gameObject:SetActive(false)
|
|
this.soliderList[i].lv.gameObject:SetActive(false)
|
|
this.soliderList[i].type.gameObject:SetActive(true)
|
|
local config=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SoldiersSetting,"Position",i,"Library",1)
|
|
this.soliderList[i].type.text=config.Name
|
|
--this.soliderList[i].lock:SetActive(true)
|
|
end
|
|
--
|
|
this.soliderList[i].effect:SetActive(false)
|
|
Util.SetParticleSortLayer(this.soliderList[i].effect,orginLayer)
|
|
this.soliderList[i].stateImg.gameObject:SetActive(false)
|
|
this.soliderList[i].lock:SetActive(CheckListIsContainValue1(openList,i)==false)
|
|
end
|
|
this.ShowBattleInfo()
|
|
end
|
|
|
|
|
|
|
|
function this.ShowSoliderChange(_pos,_isUp)
|
|
--LogError("_pos======================".._pos.." _isup==="..tostring(_isUp))
|
|
this.soliderList[_pos].effect:SetActive(true)
|
|
local str=""
|
|
if _isUp then
|
|
str="r_hero_zhanlishangsheng_png"
|
|
else
|
|
str="r_hero_zhanlixiajiang_png"
|
|
end
|
|
this.soliderList[_pos].stateImg.gameObject:SetActive(true)
|
|
this.soliderList[_pos].stateImg.sprite=this.spLoader:LoadSprite(str)
|
|
Timer.New(function()
|
|
this.soliderList[_pos].stateImg.gameObject:SetActive(false)
|
|
this.soliderList[_pos].effect:SetActive(false)
|
|
end, 5, 1, true):Start()
|
|
end
|
|
|
|
|
|
|
|
|
|
local soliderPreList={}
|
|
local bossSpine
|
|
function this.ShowBattleInfo()
|
|
--显示boss
|
|
curSoliderStageConfig=ConfigManager.GetConfigData(ConfigName.SoldierStageConfig,FightPointPassManager.soldierLayerId)
|
|
local heroData = ConfigManager.GetConfigData(ConfigName.HeroConfig,curSoliderStageConfig.Hero)
|
|
local bossName=GetResourcePath(heroData.Live)
|
|
local tipString
|
|
|
|
LogError("GetOpenServerDayNum()================"..GetOpenServerDayNum())
|
|
for _, config in ConfigPairs(soldierStageConfig) do
|
|
if config.OpenRule and #config.OpenRule>0 and config.OpenRule[1][2]==GetOpenServerDayNum() then
|
|
tipString=config.OpenTips
|
|
end
|
|
end
|
|
this.openTip.text=tipString
|
|
|
|
if bossName~=this.bossLiveName then
|
|
poolManager:UnLoadLive(this.bossLiveName, this.bossLiveGO, PoolManager.AssetType.GameObject)
|
|
this.bossLiveName=bossName
|
|
this.bossLiveGO= poolManager:LoadLive(this.bossLiveName,this.enemyPos.transform, Vector3.one, Vector3.zero)
|
|
this.bossLiveGO.transform:SetParent(this.enemyPos.transform)
|
|
this.bossLiveGO.transform.localPosition = Vector2.New(0, 0)
|
|
this.bossLiveGO.transform.localScale=Vector3.one * roleConfig[curSoliderStageConfig.Hero].enemy_liveScale*0.5
|
|
bossSpine=this.bossLiveGO:GetComponent("SkeletonGraphic")
|
|
|
|
end
|
|
if this.bossLiveGOEffect==nil then
|
|
this.bossLiveGOEffect = poolManager:LoadAsset("c_xy_0012_skeff_slidesk_ballistic", PoolManager.AssetType.GameObject)
|
|
this.bossLiveGOEffect.transform:SetParent(this.enemyPos.transform)
|
|
this.bossLiveGOEffect.transform.localScale = Vector3.one
|
|
this.bossLiveGOEffect.transform.localPosition = Vector3.New(0, 0, 0)
|
|
this.bossLiveGOEffect:SetActive(false)
|
|
end
|
|
Util.SetParticleSortLayer(this.bossLiveGOEffect, orginLayer+1)
|
|
|
|
local team=FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
|
|
for i=1,6 do
|
|
--如果这个位置有英雄
|
|
if team.teamHeroInfos[i] then
|
|
|
|
local heroData = HeroManager.GetSingleHeroData(team.teamHeroInfos[i].heroId)
|
|
local sId=heroData.id
|
|
local roleLiveGO=nil
|
|
if heroSpineList[heroData.live]==nil then
|
|
roleLiveGO= poolManager:LoadLive(heroData.live,this.heroList[i].pos.transform, Vector3.one, Vector3.zero)
|
|
else
|
|
roleLiveGO=heroSpineList[heroData.live]
|
|
end
|
|
roleLiveGO.transform:SetParent(this.heroList[i].pos.transform)
|
|
roleLiveGO.transform.localPosition = Vector2.New(0, 0)
|
|
roleLiveGO.transform.localScale=Vector3.one * roleConfig[sId].enemy_liveScale*0.2 -- * 0.75--* 1.5
|
|
if i<=3 then
|
|
if heroData.heroConfig.Toward==1 then
|
|
SetHEeroLiveToward(roleLiveGO,1)
|
|
end
|
|
else
|
|
if heroData.heroConfig.Toward==2 then
|
|
SetHEeroLiveToward(roleLiveGO,1)
|
|
end
|
|
end
|
|
this.heroList[i].spine=roleLiveGO:GetComponent("SkeletonGraphic")
|
|
this.heroList[i].data=heroData
|
|
heroSpineList[heroData.live]=roleLiveGO
|
|
end
|
|
end
|
|
--小兵显示
|
|
local aaa=SmallSoldierManager.soldierList
|
|
LogError("dataList=======len==========="..#SmallSoldierManager.soldierList)
|
|
local index=0
|
|
for k, v in pairs(aaa) do
|
|
index=index+1
|
|
LogError("id=============== v.id=============================="..v.id)
|
|
if not soliderPreList[index] then
|
|
local obj=newObjToParent(this.soliderPre,this.soliderGrid)
|
|
soliderPreList[index]={}
|
|
soliderPreList[index].go=obj
|
|
soliderPreList[index].pos=Util.GetGameObject(obj, "pos")
|
|
soliderPreList[index].effect = poolManager:LoadAsset("c_xy_0012_skeff_slidesk_ballistic", PoolManager.AssetType.GameObject)
|
|
soliderPreList[index].effect.transform:SetParent(soliderPreList[index].pos.transform)
|
|
soliderPreList[index].effect.transform.localScale = Vector3.one
|
|
soliderPreList[index].effect.transform.localPosition = Vector3.New(0, 0, 0)
|
|
soliderPreList[index].data=v
|
|
soliderPreList[index].effect:SetActive(false)
|
|
Util.SetParticleSortLayer(soliderPreList[index].effect, orginLayer+2)
|
|
else
|
|
soliderPreList[index].data=v
|
|
end
|
|
local spineName=""
|
|
if soliderSettingConfig[v.id] then
|
|
spineName=GetResourcePath(soliderSettingConfig[v.id].Live)
|
|
end
|
|
if soliderPreList[index].spine and spineName~="" and soliderPreList[index].spineName~=spineName then
|
|
poolManager:UnLoadLive(soliderPreList[index].spineName, soliderPreList[index].spine, PoolManager.AssetType.GameObject)
|
|
soliderPreList[index].spine=nil
|
|
end
|
|
if soliderPreList[index].spine==nil then
|
|
local spineObj
|
|
spineObj= poolManager:LoadLive(spineName,soliderPreList[index].pos.transform, Vector3.one, Vector3.zero)
|
|
spineObj.transform:SetParent(soliderPreList[index].pos.transform)
|
|
spineObj.transform.localPosition = Vector2.New(0, -20)
|
|
spineObj.transform.localScale=Vector3.one * 0.15
|
|
soliderPreList[index].spine=spineObj
|
|
soliderPreList[index].spineName=spineName
|
|
end
|
|
--LogError("soliderSettingConfig[v.id].Position=="..soliderSettingConfig[v.id].Position)
|
|
soliderPreList[index].go.transform.localPosition=Vector2.New(soliderSettingConfig[v.id].FightPosition[1],soliderSettingConfig[v.id].FightPosition[2])
|
|
soliderPreList[index].spineAni=soliderPreList[index].spine:GetComponent("SkeletonGraphic")
|
|
soliderPreList[index].spineAni.AnimationState:SetAnimation(0, "move3",true)
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
local battleTime=0
|
|
local bossHp=0
|
|
local curAttack=0
|
|
local allAttacck=0
|
|
local timer2=nil
|
|
local timer1=nil
|
|
function this.BattleLogic()
|
|
if this.battleTimer then
|
|
this.battleTimer:Stop()
|
|
this.battleTimer = nil
|
|
end
|
|
local cd=0
|
|
this.floorTxt.text=string.format("第%s关",FightPointPassManager.soldierLayerId)
|
|
local isHit=false
|
|
--如果切回这个界面还在打这个boss
|
|
local bossInfo=SmallSoldierManager.bossInfo
|
|
if bossInfo then
|
|
local curTime=GetTimeStamp()
|
|
local cha=math.floor(curTime - bossInfo.leaveTime)
|
|
--LogError("cha==============="..cha.." ")
|
|
cha=cha%curSoliderStageConfig.Time
|
|
--LogError("cha==============================================="..cha)
|
|
battleTime=battleTime-cha
|
|
--LogError("battletime==============="..battleTime)
|
|
battleTime=math.abs(battleTime)
|
|
if battleTime>0 then
|
|
bossHp=bossHp-math.floor(cha/timeStamp)*bossInfo.attack
|
|
else
|
|
battleTime=curSoliderStageConfig.Time
|
|
bossHp=curSoliderStageConfig.Hp
|
|
end
|
|
else
|
|
battleTime=curSoliderStageConfig.Time
|
|
bossHp=curSoliderStageConfig.Hp
|
|
end
|
|
--this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
|
|
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
|
|
this.timeTxt.text=string.format("限时:%ss",battleTime)
|
|
this.hpTxt.text=bossHp
|
|
LogError("curSoliderStageConfig.Time===="..curSoliderStageConfig.Time.." curSoliderStageConfig.Hp=="..curSoliderStageConfig.Hp)
|
|
local bossPos=Vector3.New(this.enemyPos.transform.position.x,this.enemyPos.transform.position.y+1,0)
|
|
this.battleTimer = Timer.New(function()
|
|
cd=cd+1
|
|
--每隔三秒攻击一次
|
|
if cd==timeStamp then
|
|
--英雄攻击
|
|
allAttacck=0
|
|
for i=1,6 do
|
|
if this.heroList[i].spine then
|
|
this.heroList[i].effect.transform.position =this.heroList[i].pos.transform.position
|
|
local seed= math.random(0,100)/150
|
|
timer1 = Timer.New(function()
|
|
if this.heroList[i] and this.heroList[i].spine and this.heroList[i].effect then
|
|
this.heroList[i].spine.AnimationState:SetAnimation(0, "touch", true)
|
|
Util.ClearTrailRender(this.heroList[i].effect)
|
|
this.heroList[i].effect:SetActive(true)
|
|
this.heroList[i].effect:GetComponent("RectTransform"):DOMove(bossPos, 0.6, false):OnComplete(function ()
|
|
if this.heroList[i].effect then
|
|
this.heroList[i].effect:SetActive(false)
|
|
end
|
|
this.heroList[i].spine.AnimationState:SetAnimation(0, "idle", true)
|
|
--LogError("this.heroList[i].data.attack=="..this.heroList[i].data.attack)
|
|
--local proList=HeroPropManager.GetHeroProp(this.heroList[i].data.dynamicId, FormationTypeDef.FORMATION_NORMAL)
|
|
--LogError("prolist[2]==============="..proList[2])
|
|
--for i=1,5 do
|
|
local power=HeroPowerManager.GetHeroPower(this.heroList[i].data.dynamicId, FormationTypeDef.FORMATION_NORMAL)
|
|
--LogError("power===================================================="..power)
|
|
local heroPower=math.floor(power*(1+SmallSoldierManager.soliderAdd/100)+0.5)
|
|
bossHp=bossHp - heroPower
|
|
allAttacck=allAttacck+heroPower
|
|
|
|
this.Floater:ArtFloatingOnHook(ArtFloatingType.Damage,ArtFloatingColor.White,heroPower,orginLayer)
|
|
|
|
--end
|
|
isHit=true
|
|
if isHit then
|
|
--LogError("boss被攻击======================================")
|
|
bossSpine.AnimationState:SetAnimation(0, "hit",false)
|
|
|
|
isHit=false
|
|
end
|
|
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
|
|
end)
|
|
end
|
|
|
|
end, seed, 1, true)
|
|
timer1:Start()
|
|
|
|
|
|
end
|
|
end
|
|
local lotteryConfig=ConfigManager.GetConfigData(ConfigName.SoldiersLotteryConfig,SmallSoldierManager.level)
|
|
local add=lotteryConfig.SoldiersUP/10000
|
|
--小兵攻击
|
|
for i=1,#soliderPreList do
|
|
local aaa=soliderPreList[i]
|
|
--if aaa.spine then
|
|
aaa.effect.transform.position =aaa.pos.transform.position
|
|
--aaa.spine.AnimationState:SetAnimation(0, "touch", true)
|
|
local seed1 = math.random(0,100)/150
|
|
timer2=Timer.New(function()
|
|
if aaa.effect and aaa.spineAni then
|
|
Util.ClearTrailRender(aaa.effect)
|
|
if aaa.effect and aaa.spineAni then
|
|
aaa.effect:SetActive(true)
|
|
aaa.spineAni.AnimationState:SetAnimation(0, "attack3",false)
|
|
aaa.effect:GetComponent("RectTransform"):DOMove(bossPos, 0.6, false):OnComplete(function ()
|
|
if aaa.effect then
|
|
aaa.effect:SetActive(false)
|
|
end
|
|
local power=0
|
|
for p=1,4 do
|
|
power= power+ aaa.data.attributes[p].value*propertyConfig[p].Score
|
|
end
|
|
power=math.floor(power)
|
|
local attack=math.floor(math.floor(power*(1+add)+0.5)*(1+SmallSoldierManager.soliderAdd/100)+0.5)
|
|
--LogError("attack============================================="..power)
|
|
bossHp=bossHp-attack
|
|
allAttacck=allAttacck+attack
|
|
this.Floater:ArtFloatingOnHook(ArtFloatingType.Damage,ArtFloatingColor.White,attack,orginLayer)
|
|
aaa.spineAni.AnimationState:SetAnimation(0, "move3",true)
|
|
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
|
|
end)
|
|
end
|
|
|
|
end
|
|
|
|
end,seed1, 1, true)
|
|
timer2:Start()
|
|
--end
|
|
end
|
|
curAttack=allAttacck
|
|
--LogError("curAttack======================================="..allAttacck)
|
|
--this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
|
|
--this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
|
|
cd=0
|
|
end
|
|
bossSpine.AnimationState:SetAnimation(0, "idle", true)
|
|
this.timeTxt.text=string.format("限时:%ss",battleTime)
|
|
if bossHp<0 then
|
|
bossHp=0
|
|
end
|
|
this.hpTxt.text=bossHp
|
|
--战斗时间到了,重头开始打
|
|
if battleTime<=0 then
|
|
LogError("战斗结束")
|
|
this.battleTimer:Stop()
|
|
cd=0
|
|
battleTime=curSoliderStageConfig.Time
|
|
bossHp=curSoliderStageConfig.Hp
|
|
--this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
|
|
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
|
|
this.battleTimer:Start()
|
|
if PlayerPrefs.GetInt("SmallSoldierFailed"..PlayerManager.uid)~=FightPointPassManager.soldierLayerId then
|
|
if not GuideManager.IsInMainGuide() then
|
|
--UIManager.OpenPanel(UIName.SmallSoldierFailPop)
|
|
end
|
|
PlayerPrefs.SetInt("SmallSoldierFailed"..PlayerManager.uid,FightPointPassManager.soldierLayerId)
|
|
end
|
|
|
|
end
|
|
if bossHp<=0 then
|
|
LogError("boss被击败")
|
|
this.battleTimer:Stop()
|
|
--判断当前开服天数是否开启当前关卡
|
|
if curSoliderStageConfig.OpenRule[1][2]<=GetOpenServerDayNum() then
|
|
--NetManager.SoldierFightCheckRequest(1,function(msg)
|
|
--战斗成功
|
|
--if msg.result==1 then
|
|
if curSoliderStageConfig.NextId~=0 then
|
|
FightPointPassManager.soldierLayerId=curSoliderStageConfig.NextId
|
|
this.floorTxt.text=string.format("第%s关",FightPointPassManager.soldierLayerId)
|
|
end
|
|
curSoliderStageConfig=ConfigManager.GetConfigData(ConfigName.SoldierStageConfig,FightPointPassManager.soldierLayerId)
|
|
local heroData = ConfigManager.GetConfigData(ConfigName.HeroConfig,curSoliderStageConfig.Hero)
|
|
local name=GetResourcePath(heroData.Live)
|
|
this.bossLiveGOEffect:SetActive(true)
|
|
this.bossLiveGOEffect:GetComponent("RectTransform"):DOMove(this.onHookObj.transform.position, 1, false):OnComplete(function ()
|
|
this.bossLiveGOEffect:SetActive(false)
|
|
this.bossLiveGOEffect.transform.position=this.enemyPos.transform.position
|
|
end)
|
|
--换boss了
|
|
if name~=this.bossLiveName then
|
|
poolManager:UnLoadLive(this.bossLiveName, this.bossLiveGO, PoolManager.AssetType.GameObject)
|
|
this.bossLiveName=name
|
|
this.bossLiveGO= poolManager:LoadLive(this.bossLiveName,this.enemyPos.transform, Vector3.one, Vector3.zero)
|
|
this.bossLiveGO.transform:SetParent(this.enemyPos.transform)
|
|
this.bossLiveGO.transform.localPosition = Vector2.New(0, 0)
|
|
this.bossLiveGO.transform.localScale=Vector3.one * roleConfig[curSoliderStageConfig.Hero].enemy_liveScale*0.5
|
|
bossSpine=this.bossLiveGO:GetComponent("SkeletonGraphic")
|
|
end
|
|
PlayerPrefs.SetInt("SmallSoldierLevel"..PlayerManager.uid,FightPointPassManager.soldierLayerId)
|
|
--刷新挂机奖励
|
|
--this.IntiReward()
|
|
--this.UpdateOpenSeverWelfare()
|
|
-- else
|
|
-- --PopupTipPanel.ShowTip("服务器战斗验证失败")
|
|
-- if PlayerPrefs.GetInt("SmallSoldierFailed"..PlayerManager.uid)~=FightPointPassManager.soldierLayerId then
|
|
-- if not GuideManager.IsInMainGuide() then
|
|
-- --UIManager.OpenPanel(UIName.SmallSoldierFailPop)
|
|
-- end
|
|
-- PlayerPrefs.SetInt("SmallSoldierFailed"..PlayerManager.uid,FightPointPassManager.soldierLayerId)
|
|
-- end
|
|
-- end
|
|
if this.battleTimer then
|
|
this.battleTimer:Start()
|
|
end
|
|
cd=0
|
|
battleTime=curSoliderStageConfig.Time
|
|
bossHp=curSoliderStageConfig.Hp
|
|
--this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
|
|
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
|
|
this.RefreshBossInfo()
|
|
--end)
|
|
else
|
|
if this.battleTimer then
|
|
this.battleTimer:Start()
|
|
end
|
|
cd=0
|
|
battleTime=curSoliderStageConfig.Time
|
|
bossHp=curSoliderStageConfig.Hp
|
|
--this.hpBar.fillAmount=bossHp/curSoliderStageConfig.Hp
|
|
this.SetHp(curSoliderStageConfig.Hp,bossHp,curSoliderStageConfig.HpNumber)
|
|
this.RefreshBossInfo()
|
|
end
|
|
|
|
|
|
end
|
|
battleTime=battleTime-1
|
|
end, 1, -1, true)
|
|
this.battleTimer:Start()
|
|
end
|
|
|
|
|
|
local maxHp=0
|
|
local everyHp=0
|
|
function this.SetHp(_maxHp,_curHp,_Num)
|
|
if _maxHp==_curHp then
|
|
maxHp=_maxHp
|
|
everyHp=maxHp/_Num
|
|
this.numTxt.text="x".._Num
|
|
this.hpBar2.fillAmount=1
|
|
this.hpBar.fillAmount=1
|
|
if _Num==1 then
|
|
this.hpBar2.fillAmount=0
|
|
end
|
|
else
|
|
this.UpdateHp(_curHp)
|
|
end
|
|
end
|
|
|
|
function this.UpdateHp(_curHp)
|
|
if _curHp==maxHp then
|
|
return
|
|
end
|
|
if _curHp<=0 then
|
|
this.hpBar2.fillAmount=0
|
|
this.hpBar.fillAmount=0
|
|
end
|
|
this.numTxt.text="x"..math.floor(_curHp/everyHp)+1
|
|
|
|
if math.floor(_curHp/everyHp)==0 then
|
|
this.hpBar2.fillAmount=0
|
|
this.hpBar.fillAmount=_curHp/everyHp
|
|
return
|
|
end
|
|
if math.floor(_curHp/everyHp)%2==0 then
|
|
this.hpBar2.transform:SetAsFirstSibling()
|
|
this.hpBar2.fillAmount=1
|
|
this.hpBar.fillAmount=_curHp % everyHp/everyHp
|
|
else
|
|
this.hpBar.transform:SetAsFirstSibling()
|
|
this.hpBar.fillAmount=1
|
|
this.hpBar2.fillAmount=_curHp % everyHp/everyHp
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SetInitAnim()
|
|
-- 隐藏界面特效
|
|
-- count = 1
|
|
-- this.GuideEffectGo:SetActive(false)
|
|
-- this.GuideJumpEffectGo:SetActive(false)
|
|
-- this.swicthPanel:SetActive(true)
|
|
-- this.SetAnimPanelState(true)
|
|
-- fightSkeleton.AnimationState:SetAnimation(0, fightAnim[2], false)
|
|
-- isAnimActive = true
|
|
-- chooseAnim = FightPointPassManager.IsFightBoss() and 4 or 3
|
|
--fightMap.StopAction()
|
|
UIManager.OpenPanel(UIName.FightLevelSwitchPopup, true)
|
|
end
|
|
|
|
function this:PlayerKillAllSkill()
|
|
local offset = Vector3.zero
|
|
local go = BattleManager.LoadAsset("Effect_c_jw_0003_attack_01", 10)
|
|
go.transform:SetParent(self.gameObject.transform)
|
|
go.transform.localScale = Vector3.one
|
|
go.transform.localPosition =offset
|
|
go:SetActive(true)
|
|
-- this.skillTimer = Timer.New(function ()
|
|
-- fightMap.AllBattleEnd()
|
|
-- end,3)
|
|
this.skillTimer:Start()
|
|
Timer.New(function ()
|
|
destroy(go)
|
|
end,5):Start()
|
|
|
|
end
|
|
-- 隐藏显示面板
|
|
-- function this.SetAnimPanelState(isShow)
|
|
-- local offset = isShow and 0 or 2000
|
|
-- this.swicthPanel.transform.localPosition = Vector3.New(offset, 0, 0 )
|
|
-- end
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function FightPointPassMainPanel:AddListener()
|
|
|
|
invadeMonster:AddListener()
|
|
--fightMap:AddListener()
|
|
Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.BtnsIsOpen)
|
|
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.UpdateFindTreasureMaterialNum)
|
|
Game.GlobalEvent:AddEvent(GameEvent.FindTreasure.RefreshFindTreasureRedPot, this.RefreshFindTreasureRedPoint)
|
|
Game.GlobalEvent:AddEvent(GameEvent.Mission.GetOpenServerRewardRefreshFightPoint, this.UpdateOpenSeverWelfare)
|
|
Game.GlobalEvent:AddEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip)
|
|
--Game.GlobalEvent:AddEvent(GameEvent.Player.OnPlayerLvChange, this.SetFightBtnText)
|
|
Game.GlobalEvent:AddEvent(GameEvent.Player.OnPlayerLvChange, this.RefreshOpenTips)
|
|
Game.GlobalEvent:AddEvent(GameEvent.DynamicTask.OnMissionChange, this.refreshVipTask)
|
|
Game.GlobalEvent:AddEvent(GameEvent.JumpServerHeightLadder.UpdateWordLv, this.UpdateWordLv)
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, this.OnUIOpen)
|
|
Game.GlobalEvent:AddEvent(GameEvent.Guide.FuncGuideDone, this.OnFuncGuideDone)
|
|
Game.GlobalEvent:AddEvent(GameEvent.Solider.RefreshSoliderInfoWindow, this.RefreshSoliderInfo)
|
|
Game.GlobalEvent:AddEvent(GameEvent.Solider.RefreshLvInfo, this.RefreshLvInfo)
|
|
Game.GlobalEvent:AddEvent(GameEvent.Mission.OnOpenFight, this.RefreshBossInfo)
|
|
Game.GlobalEvent:AddEvent(GameEvent.Solider.ShowSoliderChangeInfo, this.ShowSoliderChange)
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function FightPointPassMainPanel:RemoveListener()
|
|
|
|
invadeMonster:RemoveListener()
|
|
--fightMap:RemoveListener()
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.BtnsIsOpen)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.UpdateFindTreasureMaterialNum)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.FindTreasure.RefreshFindTreasureRedPot, this.RefreshFindTre3asureRedPoint)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Mission.GetOpenServerRewardRefreshFightPoint, this.UpdateOpenSeverWelfare)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip)
|
|
--Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayerLvChange, this.SetFightBtnText)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayerLvChange, this.RefreshOpenTips)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.DynamicTask.OnMissionChange, this.refreshVipTask)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.JumpServerHeightLadder.UpdateWordLv, this.UpdateWordLv)
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, this.OnUIOpen)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Guide.FuncGuideDone, this.OnFuncGuideDone)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Solider.RefreshSoliderInfoWindow, this.RefreshSoliderInfo)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Solider.RefreshLvInfo, this.RefreshLvInfo)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Mission.OnOpenFight, this.RefreshBossInfo)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Solider.ShowSoliderChangeInfo, this.ShowSoliderChange)
|
|
end
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function FightPointPassMainPanel:OnOpen(func)
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.FightPointPass })
|
|
this.BtView:OnOpen(self, { sortOrder = self.sortingOrder, panelType = PanelTypeView.JieLing })
|
|
callBack = nil
|
|
if func then
|
|
callBack = func
|
|
end
|
|
end
|
|
function FightPointPassMainPanel:OnFocus()
|
|
GuideManager.CheckOpenServerGuide()
|
|
GuideManager.CheckFuncGuide()
|
|
local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FirstRecharge)
|
|
if activityId and activityId~=0 and ActTimeCtrlManager.SingleFuncState(1) then
|
|
this.btnFirstRechar:SetActive(true)
|
|
else
|
|
this.btnFirstRechar:SetActive(false)
|
|
end
|
|
|
|
end
|
|
|
|
|
|
-- 从战斗出来会加载两次
|
|
function FightPointPassMainPanel:OnShow()
|
|
local dayNum=GetOpenServerDayNum()
|
|
LogError("daynum============================="..dayNum)
|
|
GuideManager.CheckFuncGuide()
|
|
--LogError("SmallSoldierManager.changeSolider.type=========="..SmallSoldierManager.changeSolider.type)
|
|
this.RefreshSoliderInfo()
|
|
this.BattleLogic()
|
|
CheckRedPointStatus(RedPointType.XiaoYaoYouRedPoint)
|
|
CheckRedPointStatus(RedPointType.numberGame)
|
|
local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FirstRecharge)
|
|
if activityId and activityId~=0 and ActTimeCtrlManager.SingleFuncState(1) then
|
|
this.btnFirstRechar:SetActive(true)
|
|
else
|
|
this.btnFirstRechar:SetActive(false)
|
|
end
|
|
local curFightId = FightPointPassManager.curOpenFight
|
|
-- 功能引导存在时不再显示成长界面
|
|
if FightPointPassManager.GetIsOpenRewardUpTip() and not GuideManager.IsFunctionGuideExist() then
|
|
local oldLevelId = FightPointPassManager.lastPassFightId
|
|
local curLevelId = curFightId
|
|
local oldLevelConFig = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,oldLevelId)
|
|
local curLevelConFig = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,curLevelId)
|
|
local data = {}
|
|
data.title = "g_guanka_jianglitishen_zh"
|
|
data.itemList = {}
|
|
data.type = 1
|
|
for i = 1, #curLevelConFig.RewardShowMin do
|
|
local oldsinglePro = oldLevelConFig.RewardShowMin[i]
|
|
local cursinglePro = curLevelConFig.RewardShowMin[i]
|
|
local singleItem = {}
|
|
singleItem.icon = cursinglePro[1]
|
|
singleItem.proName = GetLanguageStrById(itemConfig[cursinglePro[1]].Name)
|
|
singleItem.proValue = oldsinglePro[2]
|
|
if cursinglePro[2] - oldsinglePro[2] > 0 then
|
|
singleItem.proValue1 = "<color=#529864>"..cursinglePro[2].."</color>"..Language[11567]
|
|
else
|
|
singleItem.proValue1 = "<color=#C8AD83>"..cursinglePro[2]..Language[11568]
|
|
end
|
|
table.insert(data.itemList,singleItem)
|
|
end
|
|
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.Onhook,data)
|
|
end
|
|
this.RefreshLittleMap()
|
|
this.RefreshPassGiftShow()
|
|
SoundManager.PlayMusic(SoundConfig.BGM_Main)
|
|
-- 调用onshow
|
|
invadeMonster:OnShow()
|
|
|
|
local curName = GetLanguageStrById(fightLevelConfig[curFightId].Name)
|
|
local curDifficulty = fightLevelConfig[curFightId].Difficulty
|
|
local chapterId = 0
|
|
local str = ""
|
|
if not FightPointPassManager.IsChapterClossState() then
|
|
chapterId = math.floor(FightPointPassManager.lastPassFightId / 1000)
|
|
str = GetLanguageStrById(fightLevelConfig[FightPointPassManager.lastPassFightId].Name)
|
|
else
|
|
str = string.format("<color=#%s>%s</color> ", textColor[curDifficulty], curName)
|
|
chapterId = FightPointPassManager.GetCurChapterIndex()
|
|
end
|
|
this.areaName.text = str
|
|
if GetCurLanguage() ~= 0 then
|
|
this.areaName.gameObject.transform.localPosition = Vector2.New(0,0)
|
|
end
|
|
this.chapterName.text = GetLanguageStrById(fightLevelSetConfig[chapterId].Name)
|
|
|
|
-- 奖励预览
|
|
--this.IntiReward()
|
|
-- 刷新关卡按钮状态
|
|
--this.SetFightBtnText()
|
|
|
|
|
|
if not hasLoad then
|
|
timePressStarted = Time.realtimeSinceStartup
|
|
isAnimActive = false
|
|
|
|
isCounting = false
|
|
-- 加载地图数据
|
|
coroutine.start(function()
|
|
-- coroutine.wait(0.01)
|
|
if UIManager.IsOpen(UIName.FightPointPassMainPanel) then
|
|
--fightMap:Init()
|
|
hasMap = true
|
|
end
|
|
end)
|
|
|
|
FightPointPassManager.isBattleBack = false
|
|
hasLoad = true
|
|
|
|
this:Update()
|
|
|
|
if callBack then
|
|
callBack()
|
|
callBack = nils
|
|
end
|
|
end
|
|
this.BtnsIsOpen()
|
|
--寻宝显示
|
|
this.UpdateFindTreasureMaterialNum()
|
|
this.worldLv.text = PlayerManager.worldLeve
|
|
-- local openFunConFig = this.GetNextFightOpenFun()
|
|
-- if openFunConFig then
|
|
-- this.openFun:SetActive(true)
|
|
-- this.openFunNeedInfo.text = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,openFunConFig.OpenRules[2]).Name
|
|
-- this.openFunFunInfo.text = Language[12163]..openFunConFig.Name
|
|
-- else
|
|
-- this.openFun:SetActive(false)
|
|
-- end --开服福利显示
|
|
this.UpdateOpenSeverWelfare()
|
|
|
|
PlayerManager.StarBattleUpLvTipTime(2)
|
|
Util.GetGameObject(this.btnXiaoYao,"curValue/num"):GetComponent("Text").text=string.format("%d/%d",BagManager.GetItemCountById(UpViewRechargeType.YunYouVle),PrivilegeManager.GetPrivilegeNumber(39))
|
|
|
|
-- 刷新一次编队战斗力
|
|
FormationManager.RefreshMainFormationPower()
|
|
PatFaceManager.RefreshPatface()
|
|
|
|
-- 刷新任务显示
|
|
this.refreshVipTask()
|
|
-- 刷新解锁信息显示
|
|
this.RefreshOpenTips()
|
|
--
|
|
this.battleUpLvTip:SetActive(false)
|
|
this.RefreshBattleUpLvTip(true)
|
|
this.hookSkillBtn.gameObject:SetActive(false)
|
|
local hangArr= fightLevelConfig[curFightId].Hang
|
|
if hangArr and hangArr[1]>0 then
|
|
maxKillNum=hangArr[2]
|
|
this.btnFight.gameObject:SetActive(false)
|
|
this.hookKill.gameObject:SetActive(true)
|
|
curKillNum=0
|
|
this.hookKillText.text=string.format("%s/%s",curKillNum,maxKillNum)
|
|
this.red_light:SetActive(true)
|
|
this.red_light:GetComponent("Image"):DOFade(1, 0)
|
|
this.red_light:GetComponent("Image"):DOFade(0, 1):SetEase(Ease.Linear):SetLoops(-1,1)
|
|
else
|
|
this.btnFight.gameObject:SetActive(true)
|
|
this.hookKill.gameObject:SetActive(false)
|
|
end
|
|
|
|
end
|
|
---播放“危”动画
|
|
function this.PlayWeiAnim()
|
|
this.red_wei:SetActive(true)
|
|
this.red_wei:GetComponent("Image"):DOFade(0, 0.5):SetEase(Ease.Linear):SetLoops(4,1):OnComplete(function()
|
|
this.red_wei:SetActive(false)
|
|
this.hookSkillBtn.gameObject:SetActive(true)
|
|
end)
|
|
end
|
|
-- 刷新任务显示
|
|
function this.refreshVipTask()
|
|
local t, task = VipManager.GetVipTaskShowInFight()
|
|
-- 满级后不再显示
|
|
--this.mainTask:SetActive(t ~= -1)
|
|
this.mainTask:SetActive(false)
|
|
if t == 0 then
|
|
-- 能激活时显示激活特权
|
|
this.titleText.text = "前往升级特权"
|
|
this.progressText.text = ""
|
|
elseif t == 1 then
|
|
-- 不能激活时显示任务
|
|
local taskConfigInfo = ConfigManager.GetConfigData(ConfigName.TaskConfig, task.missionId)
|
|
local color = task.state == VipTaskStatusDef.CanReceive and UIColorStr.GREEN or UIColorStr.YELLOW
|
|
this.titleText.text = GetLanguageStrById(taskConfigInfo.Desc)
|
|
-- 避免显示的太长
|
|
if tonumber(taskConfigInfo.TaskValue[2][1]) < 10000 then
|
|
this.titleText.text = this.titleText.text .. string.format("<color=%s>(%s/%s)</color>", color, task.progress, taskConfigInfo.TaskValue[2][1])
|
|
end
|
|
this.progressText.text = ""
|
|
this.mainTaskGRewardImage:SetActive(task.state ~= VipTaskStatusDef.NotFinished)
|
|
this.mainTaskJumpImage:SetActive(task.state == VipTaskStatusDef.NotFinished)
|
|
end
|
|
end
|
|
|
|
-- 刷新提示文字显示
|
|
function this.RefreshOpenTips()
|
|
local tips = FightPointPassManager.GetCurLevelTips()
|
|
if tips then
|
|
---不显示该提示
|
|
this.OpenTips:SetActive(false)
|
|
this.OpenTipsTxt.text = tips
|
|
else
|
|
this.OpenTips:SetActive(false)
|
|
end
|
|
this.RefreshSoliderInfo()
|
|
end
|
|
|
|
--寻宝显示
|
|
function this.UpdateFindTreasureMaterialNum()
|
|
local mazeTreasureMax = ConfigManager.GetConfigData(ConfigName.PlayerLevelConfig,PlayerManager.level).MazeTreasureMax
|
|
this.btnFindTreasureImage.fillAmount = BagManager.GetItemCountById(FindTreasureManager.materialItemId) / mazeTreasureMax
|
|
this.btnFindTreasureText.text = BagManager.GetItemCountById(FindTreasureManager.materialItemId)
|
|
this.RefreshFindTreasureRedPoint()
|
|
end
|
|
function this.RefreshFindTreasureRedPoint()
|
|
this.btnFindTreasureredPoint:SetActive(FindTreasureManager.RefreshFindTreasureRedPoint())
|
|
end
|
|
-- -- 小怪 258 boss 570
|
|
-- -- 播放那个动画
|
|
-- function this.PlayInfoAnim(isInit, isBoss)
|
|
-- if isInit then
|
|
-- this.imgInfo.transform.localPosition = Vector3.New(0, -187, 0)
|
|
-- this.imgInfo:SetActive(false)
|
|
-- else
|
|
-- this.imgInfo:SetActive(true)
|
|
-- local targetPos = Vector3.zero
|
|
-- targetPos = isBoss and Vector3.New(0, 570, 0) or Vector3.New(0, 288, 0)
|
|
-- this.imgInfo:GetComponent("RectTransform"):DOAnchorPos(targetPos, 0.3, false):OnComplete(function ()
|
|
-- --this.imgInfo:SetActive(false)
|
|
-- end)
|
|
|
|
-- this.imgInfo:GetComponent("Image"):DOFade(1, 0.3):OnComplete(function ()
|
|
|
|
-- end)
|
|
-- end
|
|
-- end
|
|
|
|
local isCanShowMainTaskJumpEffect = true
|
|
function this:Update()
|
|
if curMianTaskData and curMianTaskData.state == 0 then
|
|
if isCanShowMainTaskJumpEffect then
|
|
if Time.realtimeSinceStartup - timePressStarted > 5 then
|
|
isCanShowMainTaskJumpEffect = false
|
|
this.GuideJumpEffectGo:SetActive(true)
|
|
end
|
|
end
|
|
if Input.GetMouseButtonDown(0) then
|
|
timePressStarted = Time.realtimeSinceStartup
|
|
isCanShowMainTaskJumpEffect = true
|
|
this.GuideJumpEffectGo:SetActive(false)
|
|
end
|
|
end
|
|
end
|
|
|
|
--按钮开启限制
|
|
function this.BtnsIsOpen()
|
|
for i, v in pairs(this.funcBtnList) do
|
|
--LogError("i==="..i)
|
|
local isOpen = ActTimeCtrlManager.SingleFuncState(i)
|
|
v:SetActive(isOpen)
|
|
end
|
|
--this.btnRank.gameObject:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING))
|
|
this.btnRank.gameObject:SetActive(false)
|
|
end
|
|
|
|
function this.IntiReward()
|
|
local rewardData
|
|
rewardData = ConfigManager.GetConfigData(ConfigName.SoldierStageConfig,FightPointPassManager.soldierLayerId).RewardShowMin
|
|
-- if FightPointPassManager.isOpenNewChapter then
|
|
-- rewardData = fightLevelConfig[FightPointPassManager.curOpenFight].RewardShowMin
|
|
-- else
|
|
-- rewardData = fightLevelConfig[FightPointPassManager.lastPassFightId].RewardShowMin
|
|
-- end
|
|
if rewardData then
|
|
for i = 1, #rewardData do
|
|
if not this.rewardList[i] then
|
|
local go = {}
|
|
go.item = newObjToParent(this.rewardItemPre, this.rewardGrid)
|
|
go.icon = Util.GetGameObject(go.item, "iconBg/icon"):GetComponent("Image")
|
|
go.text = Util.GetGameObject(go.item, "rewardbg/context"):GetComponent("Text")
|
|
this.rewardList[i] = go
|
|
end
|
|
|
|
this.rewardList[i].icon.sprite = SetIcon(this.spLoader, rewardData[i][1])
|
|
|
|
local addValue = FightPointPassManager.GetItemVipValue(rewardData[i][1])
|
|
-- local totalCurNum,totalLv,totalNum = LikabilityManager.GetTotalHeroLikeLv(-1)
|
|
-- local prolist = {}
|
|
-- if totalLv > 0 then
|
|
-- prolist = LikabilityManager.GetPrivilageProData(1,-1,totalLv)
|
|
-- local priId = _ItemIdToVipPrivilege[rewardData[i][1]]
|
|
-- if prolist[priId] then
|
|
-- addValue = addValue + (prolist[priId]/10000)
|
|
-- end
|
|
-- end
|
|
local baseValue = rewardData[i][2]
|
|
|
|
if addValue - 1 <= 0 then
|
|
this.rewardList[i].text.text = "+"..rewardData[i][2]
|
|
else
|
|
local valueShow = math.round((addValue - 1) * baseValue)
|
|
this.rewardList[i].text.text = string.format("+%s\n<color=#1CC853>(+%s)</color>",baseValue,valueShow)
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
--刷新通关豪礼主界面显示
|
|
function this.RefreshPassGiftShow()
|
|
local mainLevelEndId=ConfigManager.TryGetConfigDataByKey(ConfigName.MainLevelConfig,"NextLevel",-1).Id--最高关卡
|
|
if FightPointPassManager.curOpenFight==mainLevelEndId then
|
|
this.pgBtn:SetActive(false)
|
|
return
|
|
end
|
|
if ActTimeCtrlManager.IsQualifiled(56) then
|
|
this.pgBtn:SetActive(true)
|
|
else
|
|
this.pgBtn:SetActive(false)
|
|
return
|
|
end
|
|
|
|
local liveId,tarPointId=ActivityGiftManager.GetNextHeroInfo()
|
|
if liveId==0 or tarPointId==0 then
|
|
this.pgBtn:SetActive(false)
|
|
return
|
|
end
|
|
--通过立绘id在itemconfig表中读出herostar 已确定该id在heroconfig中的唯一值
|
|
local heroStar=ConfigManager.GetConfigData(ConfigName.ItemConfig,liveId).HeroStar[1]
|
|
local heroData=ConfigManager.GetConfigData(ConfigName.HeroConfig,heroStar)
|
|
|
|
this.pgHead.sprite=this.spLoader:LoadSprite(GetResourcePath(heroData.Icon))
|
|
this.pgFrame.sprite=SetFrame(this.spLoader, liveId)
|
|
if heroData.Natural==13 or heroData.Natural==14 then
|
|
this.pgGive.text=Language[10613]
|
|
elseif heroData.Natural==11 or heroData.Natural==12 then
|
|
this.pgGive.text=Language[10614]
|
|
end
|
|
this.pgName.text=GetLanguageStrById(heroData.ReadingName)
|
|
|
|
this.pgInfo.text= Language[10309]..GetLanguageStrById(ActivityGiftManager.mainLevelConfig[tarPointId].Name)
|
|
end
|
|
|
|
|
|
-- 打开引导界面时关闭小手提示
|
|
function this.OnUIOpen(id)
|
|
if id == UIName.GuidePanel then
|
|
this.fightGuideEffect:SetActive(false)
|
|
end
|
|
end
|
|
-- 引导结束再显示小手
|
|
function this.OnFuncGuideDone()
|
|
--this.fightGuideEffect:SetActive(not GuideManager.IsInMainGuide() and not GuideManager.IsFunctionGuideExist())
|
|
end
|
|
-- 设置挑战按钮文字
|
|
function this.SetFightBtnText()
|
|
this.fightLock:SetActive(false)
|
|
this.fightSaoGuang:SetActive(true)
|
|
-- 没在主线引导种就显示小手
|
|
--this.fightGuideEffect:SetActive(not GuideManager.IsInMainGuide() and not GuideManager.IsFunctionGuideExist())
|
|
local isPass = FightPointPassManager.IsCanFight(FightPointPassManager.curOpenFight)
|
|
if not isCounting then
|
|
if not isPass then
|
|
this.fightLock:SetActive(true)
|
|
this.fightSaoGuang:SetActive(false)
|
|
this.fightGuideEffect:SetActive(false)
|
|
this.lockText.text = FightPointPassManager.GetBtnText()
|
|
else
|
|
this.fightText.text = FightPointPassManager.GetBtnText()
|
|
end
|
|
end
|
|
--this.fightText.text="挑战Boss"
|
|
|
|
end
|
|
|
|
-- 执行关卡战斗
|
|
function this.ExcuteBattle()
|
|
if not FightPointPassManager.IsChapterClossState() then
|
|
--fightMap.StopAction()
|
|
-- if hasMap then
|
|
-- LogGreen("关闭挂机")
|
|
-- fightMap:OnClose()
|
|
-- hasMap = false
|
|
-- end
|
|
-- UIManager.OpenPanel(UIName.FightMiddleChoosePanel, FightPointPassManager.curOpenFight, true,function ()
|
|
-- --- 临时代码
|
|
-- --FightPointPassManager.SetChapterOpenState(false)
|
|
-- end)
|
|
-- 章节解锁时添加对话
|
|
FightPointPassManager.SetChapterOpenState(false)
|
|
LogError("FightPointPassManager.lastPassFightId=="..FightPointPassManager.lastPassFightId)
|
|
LogError("FightPointPassManager.GetCurFightId()"..FightPointPassManager.GetCurFightId())
|
|
local chapterId = math.floor(FightPointPassManager.lastPassFightId / 1000)
|
|
LogError("chapterid==================="..chapterId)
|
|
local curChapterId = fightLevelSetConfig[chapterId].EventId
|
|
if curChapterId>0 then
|
|
StoryManager.EventTrigger(curChapterId, function()
|
|
LogGreen("打开挂机界面")
|
|
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
|
|
end)
|
|
else
|
|
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
|
|
end
|
|
|
|
return
|
|
end
|
|
|
|
if isCounting then PopupTipPanel.ShowTip(Language[10615]) return end
|
|
local curFightId = FightPointPassManager.curOpenFight
|
|
local state, tip = FightPointPassManager.IsCanFight(curFightId)
|
|
if state == -1 then
|
|
PopupTipPanel.ShowTip(tip)
|
|
return
|
|
end
|
|
|
|
if not state then
|
|
PopupTipPanel.ShowTip(tip)
|
|
return
|
|
end
|
|
-- 判断是否是剧情节点
|
|
if fightLevelConfig[curFightId].StoryId > 0 then
|
|
StoryManager.EventTrigger(fightLevelConfig[curFightId].StoryId, function()
|
|
FightPointPassManager.ExecuteFightStory(curFightId, function(drop)
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1, function()
|
|
this:OnShow()
|
|
end,1)
|
|
end)
|
|
end)
|
|
else
|
|
-- 检测是否有前置引导
|
|
GuideManager.BeforeFightCheck(curFightId, function()
|
|
-- if #levelList<=0 then
|
|
-- LogError("没有要打的boss关卡")
|
|
-- return
|
|
-- end
|
|
--屏蔽弹怪追认的动画
|
|
--this.SetInitAnim()
|
|
local isBoss = FightPointPassManager.IsFightBoss()
|
|
local sound = isBoss and SoundConfig.Sound_FightArea_Boss or SoundConfig.Sound_FightArea_Monster
|
|
SoundManager.PlaySound(sound, AUDIO_FADE_TYPE.FADE_OUT_NOT_IN, AUDIO_RUN_TYPE.CONC, nil, 20)
|
|
--LogError("levelList[1]=================================="..levelList[1])
|
|
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.STORY, curFightId)
|
|
end)
|
|
end
|
|
end
|
|
|
|
function this.RefreshFightBtnShow()
|
|
local curFightId = FightPointPassManager.curOpenFight
|
|
local hangArr=fightLevelConfig[curFightId].Hang
|
|
if hangArr and hangArr[1]> 0 then
|
|
curKillNum=curKillNum+1
|
|
this.hookKillText.text=string.format("%s/%s",curKillNum,maxKillNum)
|
|
if curKillNum>=maxKillNum then
|
|
this.btnFight.gameObject:SetActive(true)
|
|
this.hookKill.gameObject:SetActive(false)
|
|
this.red_light:SetActive(false)
|
|
curKillNum=0
|
|
FightPointPassManager.ExecuteFightStory(curFightId, function(drop)
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1, function()
|
|
this:OnShow()
|
|
end,1)
|
|
end)
|
|
end
|
|
end
|
|
end
|
|
|
|
function FightPointPassMainPanel:OnSortingOrderChange()
|
|
invadeMonster:OnSortingOrderChange()
|
|
Util.AddParticleSortLayer(this.GuideEffectGo, self.sortingOrder - orginLayer)
|
|
Util.AddParticleSortLayer(this.GuideJumpEffectGo, self.sortingOrder - orginLayer)
|
|
Util.AddParticleSortLayer(this.pgEffect, self.sortingOrder - orginLayer)
|
|
Util.AddParticleSortLayer(this.UI_Effect_MuBiaoJiangLi, self.sortingOrder - orginLayer)
|
|
Util.SetParticleSortLayer(this.fightSaoGuang, self.sortingOrder + 1)
|
|
Util.SetParticleSortLayer(this.fightGuideEffect, self.sortingOrder + 2)
|
|
--fightMap:OnSortingOrderChange(self.sortingOrder)
|
|
|
|
orginLayer = self.sortingOrder
|
|
|
|
this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder })
|
|
-- 头像层级
|
|
if this.playerInfoView then
|
|
this.playerInfoView:SetLayer(self.sortingOrder)
|
|
end
|
|
|
|
|
|
for i=1,6 do
|
|
if this.heroList[i] then
|
|
Util.SetParticleSortLayer(this.heroList[i].effect, self.sortingOrder+2)
|
|
end
|
|
end
|
|
for i=1, #soliderPreList do
|
|
Util.SetParticleSortLayer(soliderPreList[i].effect, orginLayer+2)
|
|
end
|
|
|
|
local haveNum=BagManager.GetItemCountById(tonumber(cost[1]))
|
|
this.costTxt.text=haveNum
|
|
this.chouRed:SetActive(haveNum>0 and CheckFunctionOpen(FUNCTION_OPEN_TYPE.SoliderDraw))
|
|
this.fightGuideEffect:SetActive(haveNum>0 and not GuideManager.IsInMainGuide() and CheckFunctionOpen(FUNCTION_OPEN_TYPE.SoliderDraw) )
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function FightPointPassMainPanel:OnClose()
|
|
PatFaceManager.isLogin = false
|
|
PlayerManager.StopBattleUpLvTipTime()
|
|
hasLoad = false
|
|
curAttack=0
|
|
allAttacck=0
|
|
invadeMonster:OnClose()
|
|
-- if hasMap then
|
|
-- fightMap:OnClose()
|
|
-- hasMap = false
|
|
-- end
|
|
if this.thread then
|
|
coroutine.stop(this.thread)
|
|
this.thread=nil
|
|
end
|
|
if timer1 then
|
|
timer1:Stop()
|
|
end
|
|
if timer2 then
|
|
timer2:Stop()
|
|
end
|
|
if this.battleTimer then
|
|
this.battleTimer:Stop()
|
|
LogError("停止战斗---------------------------------")
|
|
|
|
this.battleTimer=nil
|
|
end
|
|
timer1=nil
|
|
timer2=nil
|
|
if this.animTimer then
|
|
this.animTimer:Stop()
|
|
end
|
|
|
|
this.animTimer = nil
|
|
if this.liveNode then
|
|
this.liveNode:OnClose()
|
|
end
|
|
if this.liveNode then
|
|
this.liveNode:OnClose()
|
|
end
|
|
if this.timer then
|
|
this.timer:Stop()
|
|
this.timer = nil
|
|
end
|
|
|
|
if this.skillTimer then
|
|
this.skillTimer:Stop()
|
|
this.skillTimer = nil
|
|
end
|
|
|
|
local bossInfo={}
|
|
bossInfo.hp=bossHp
|
|
bossInfo.id=FightPointPassManager.soldierLayerId
|
|
bossInfo.attack=curAttack
|
|
bossInfo.time=battleTime
|
|
bossInfo.leaveTime=GetTimeStamp()
|
|
SmallSoldierManager.bossInfo=bossInfo
|
|
SmallSoldierManager.isFirst=true
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function FightPointPassMainPanel:OnDestroy()
|
|
|
|
orginLayer=0
|
|
invadeMonster:OnDestroy()
|
|
this.spLoader:Destroy()
|
|
|
|
-- poolManager:UnLoadAsset("GuideEffect", this.GuideEffectGo, PoolManager.AssetType.GameObject)
|
|
-- poolManager:UnLoadAsset("GuideEffect", this.GuideJumpEffectGo, PoolManager.AssetType.GameObject)
|
|
poolManager:UnLoadLive(fightAnimRes, this.animGo, PoolManager.AssetType.GameObject)
|
|
poolManager:UnLoadLive("c_xy_0012_skeff_slidesk_ballistic", this.bossLiveGOEffect, PoolManager.AssetType.GameObject)
|
|
this.bossLiveGOEffect=nil
|
|
SubUIManager.Close(this.UpView)
|
|
SubUIManager.Close(this.BtView)
|
|
--ClearRedPointObject(RedPointType.DailyTaskMain, this.dailyRedPoint)
|
|
--ClearRedPointObject(RedPointType.SecretTer_IsCanFight, this.fightRP)
|
|
ClearRedPointObject(RedPointType.XiaoYaoYouRedPoint, this.xiaoyaoRedPoint)
|
|
--ClearRedPointObject(RedPointType.numberGame,this.numberGameBtn)
|
|
ClearRedPointObject(RedPointType.FirstRecharge, this.firstRedPoint)
|
|
ClearRedPointObject(RedPointType.tuijianzhenrong, this.milkRed)
|
|
-- ClearRedPointObject(RedPointType.FightLevel, this.btnFightLevelRedPoint)
|
|
-- 头像层级
|
|
if this.playerInfoView then
|
|
SubUIManager.Close(this.playerInfoView)
|
|
this.playerInfoView = nil
|
|
end
|
|
points = {}
|
|
for k, v in pairs(heroSpineList) do
|
|
poolManager:UnLoadAsset(k,v,poolManager.AssetType.GameObject)
|
|
end
|
|
soliderPreList={}
|
|
poolManager:UnLoadLive(this.bossLiveName, this.bossLiveGO, PoolManager.AssetType.GameObject)
|
|
poolManager:UnLoadLive("c_xy_0012_skeff_slidesk_ballistic", this.bossLiveGOEffect, PoolManager.AssetType.GameObject)
|
|
this.bossLiveGOEffect=nil
|
|
heroSpineList={}
|
|
this.heroList={}
|
|
soliderPreList={}
|
|
this.bossLiveGO=nil
|
|
this.bossLiveName=nil
|
|
|
|
this.Floater:Dispose()
|
|
this.Floater=nil
|
|
|
|
end
|
|
--跳转显示新手提示圈
|
|
function FightPointPassMainPanel.ShowGuideGo(btnIndex)
|
|
if btnIndex == 1 then--关卡
|
|
if this.btnFight then
|
|
JumpManager.ShowGuide(UIName.FightPointPassMainPanel, this.btnFight)
|
|
end
|
|
elseif btnIndex == 6 then--在线
|
|
if invadeMonster.btnRewardOnline then
|
|
JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.btnRewardOnline)
|
|
end
|
|
elseif btnIndex == 5 then--章节奖励
|
|
if invadeMonster.btnRewrdChapter then
|
|
JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.btnRewrdChapter)
|
|
end
|
|
elseif btnIndex == 2 then--极速探索
|
|
if invadeMonster.btnFastExplore then
|
|
JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.btnFastExplore)
|
|
end
|
|
elseif btnIndex == 3 then--召唤外敌
|
|
if invadeMonster.callMonsterBtn then
|
|
JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.callMonsterBtn)
|
|
end
|
|
elseif btnIndex == 4 then--挂机宝箱
|
|
if invadeMonster.rewardBox then
|
|
JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.rewardBox)
|
|
end
|
|
end
|
|
end
|
|
|
|
--刷新小地图
|
|
function this.RefreshLittleMap()
|
|
--获取数据
|
|
if not FightPointPassManager.IsChapterClossState() then
|
|
this.integer, this.decimal = math.modf(FightPointPassManager.lastPassFightId/1000)--确定区域id
|
|
else
|
|
this.integer, this.decimal = math.modf(FightPointPassManager.curOpenFight/1000)
|
|
end
|
|
local data=ConfigManager.GetConfigData(ConfigName.MainLevelSettingConfig,this.integer)--获取这一区域所有数据
|
|
local difficulty=FightPointPassManager.curOpenFight%10 --确定当前区域难度
|
|
local curAllLevelNum = 0
|
|
--根据当前难度 检查对应区域数据
|
|
if difficulty==1 then
|
|
this.CheckMapPointsData(data.SimpleLevel)
|
|
curAllLevelNum = #data.SimpleLevel
|
|
elseif difficulty==2 then
|
|
this.CheckMapPointsData(data.NormalLevel)
|
|
curAllLevelNum = #data.NormalLevel
|
|
elseif difficulty==3 then
|
|
this.CheckMapPointsData(data.DifficultyLevel)
|
|
curAllLevelNum = #data.DifficultyLevel
|
|
elseif difficulty==4 then
|
|
this.CheckMapPointsData(data.HellLevel)
|
|
curAllLevelNum = #data.HellLevel
|
|
elseif difficulty==5 then
|
|
this.CheckMapPointsData(data.NightmareLevel)
|
|
curAllLevelNum = #data.NightmareLevel
|
|
end
|
|
|
|
--计算小地图当前点位 更换地图
|
|
local sonPoint = FightPointPassManager.GetLevelPointPosition()
|
|
local parentPosX,parentPosY=FightPointPassManager.CalculateMapPointPos(this.map.transform,sonPoint)
|
|
this.map.transform.anchoredPosition3D=Vector3(parentPosX,parentPosY-52.4,0) --52.4是策划的选择!!
|
|
this.mapImage.sprite=this.spLoader:LoadSprite(data.ChapterBg)
|
|
|
|
--加载立绘
|
|
-- if this.liveNode then
|
|
-- return
|
|
-- end
|
|
-- npc = NameManager.roleSex == ROLE_SEX.BOY and mapNpc or mapNpc2
|
|
-- scale = NameManager.roleSex == ROLE_SEX.BOY and Vector3.one * 0.14 or Vector3.one * 0.07
|
|
local curLevel = 0
|
|
if not FightPointPassManager.IsChapterClossState() then
|
|
curLevel = math.floor(FightPointPassManager.lastPassFightId/10)%100
|
|
else
|
|
curLevel = math.floor(FightPointPassManager.curOpenFight/10)%100
|
|
end
|
|
this.btnMapRadarBG.fillAmount = curLevel / curAllLevelNum
|
|
this.RadarBGText.text = curLevel .."/".. curAllLevelNum
|
|
-- this.liveNode = poolManager:LoadLive(npc, this.btnMap.transform, scale, Vector3.New(0,-52.4,0))
|
|
-- local SkeletonGraphic = this.liveNode:GetComponent("SkeletonGraphic")
|
|
-- if SkeletonGraphic then
|
|
-- SkeletonGraphic.AnimationState:SetAnimation(0, "move2", true)
|
|
-- if FightPointPassManager.GetRoleDirection()==1 then
|
|
-- SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 180, 0)
|
|
-- else
|
|
-- SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 0, 0)
|
|
-- end
|
|
-- end
|
|
if this.liveNode then
|
|
this.liveNode:OnClose()
|
|
end
|
|
this.liveNode = PlayerLiveView:New(this.btnMap.transform,1,nil,orginLayer,NPCPosType.smallMap)
|
|
this.liveNode:OnOpen(GetPlayerRoleSingleConFig().Scale3,Vector3.New(0,-40,0))
|
|
if FightPointPassManager.GetRoleDirection()==1 then
|
|
this.liveNode:SetWalkDir(WALK_DIR.RUN_LEFT)
|
|
else
|
|
this.liveNode:SetWalkDir(WALK_DIR.RUN_RIGHT)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
--
|
|
function this.PlayEffect()
|
|
this.moneyEffect.transform.position =this.TT.transform.position
|
|
Util.ClearTrailRender(this.moneyEffect)
|
|
this.moneyEffect:SetActive(true)
|
|
this.moneyEffect:GetComponent("RectTransform"):DOMove(targetBtn.transform.position, 0.6, false):OnComplete(function ()
|
|
-- 这些该死的延迟动画
|
|
if isPlayMove==1 then return end
|
|
if this.moneyEffect then
|
|
this.moneyEffect:SetActive(false)
|
|
end
|
|
this.RefreshEventBtn()
|
|
end)
|
|
SoundManager.PlaySound(SoundConfig.Sound_FightArea_Gold)
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--检查地图点数据
|
|
function this.CheckMapPointsData(pointsData)
|
|
for i = 1, math.max(#pointsData, #points)do
|
|
local go = points[i]
|
|
if not go then
|
|
go=newObject(points[1])
|
|
go.transform:SetParent(Util.GetGameObject(this.btnMap,"MapMask/Map").transform)
|
|
go.transform.localScale = Vector3.one
|
|
go.transform.localPosition=Vector3.zero;
|
|
go.gameObject.name = "mapAreaPre (".. i ..")"
|
|
points[i] = go
|
|
end
|
|
go.gameObject:SetActive(false)
|
|
end
|
|
--位置赋值
|
|
for i = 1, #pointsData do
|
|
local data=ConfigManager.GetConfigData(ConfigName.MainLevelConfig, pointsData[i])
|
|
points[i].transform.anchoredPosition3D=Vector3(data.LevelPointPosition[1],data.LevelPointPosition[2],0)
|
|
|
|
Util.GetGameObject(points[i].transform, "icon"):SetActive((math.floor((data.Id%100)/10))%5 ~= 0)
|
|
Util.GetGameObject(points[i].transform, "icon2"):SetActive((math.floor((data.Id%100)/10))%5 == 0)
|
|
end
|
|
--显示位置点
|
|
for i = 1, #pointsData do
|
|
points[i]:SetActive(true)
|
|
end
|
|
end
|
|
--预先显示玩家等级 解锁的功能list
|
|
function this.GetNextFightOpenFun()
|
|
local nextFightId = 0
|
|
local nextFightSortId = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,FightPointPassManager.curOpenFight).SortId - 1
|
|
for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.GlobalSystemConfig)) do
|
|
if v.OpenRules then
|
|
if v.OpenRules[1] == 1 then--1关卡开启
|
|
local OpenRulesSortId = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,v.OpenRules[2]).SortId
|
|
if OpenRulesSortId > nextFightSortId and v.IsOpen == 1 and v.IsShow == 1 then
|
|
if nextFightId == 0 then
|
|
nextFightId = v.OpenRules[2]
|
|
else
|
|
if ConfigManager.GetConfigData(ConfigName.MainLevelConfig,nextFightId).SortId > OpenRulesSortId then
|
|
nextFightId = v.OpenRules[2]
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.GlobalSystemConfig)) do
|
|
if v.OpenRules then
|
|
if v.OpenRules[1] == 1 then--1关卡开启
|
|
if v.OpenRules[2] == nextFightId and v.IsOpen == 1 and v.IsShow == 1 then
|
|
return v
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return nil
|
|
end
|
|
--开服福利显示 开始
|
|
local OpenSeverWelfareRewardShow = {
|
|
[16] = {image1 = "r_guanka_guankajiangliyaojin",image2 = "r_guanka_guankajiangli01_zh"},
|
|
[19] = {image1 = "r_guanka_guankajianglishenfu",image2 = "r_guanka_guankajiangli02_zh"},
|
|
[81128] = {image1 = "r_guanka_guankajianglibaoxiang",image2 = "r_guanka_guankajiangli03_zh"},
|
|
[11023] = {image1 = "r_guanka_guankajianglishunwukong",image2 = "r_guanka_guankajiangli04_zh"},
|
|
[11014] = {image1 = "c_nz_00029_t1",image2 = "r_guanka_guankajiangli03_zh"},
|
|
[11033] = {image1 = "c_h_0007_t1",image2 = "r_guanka_guankajiangli03_zh"},
|
|
[87] = {image1 = "r_Material_Mineral_0003",image2 = ""},
|
|
}
|
|
function this.UpdateOpenSeverWelfare()
|
|
local mainLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig)
|
|
local activityRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig)
|
|
local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SongWuXianChou)
|
|
local activityData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.SongWuXianChou)
|
|
--LogGreen("#activityData.mission "..#activityData.mission)
|
|
if activityId and activityId > 0 and activityData and #activityData.mission > 0 then
|
|
--ActivityGiftManager.OpenSeverWelfareRewardTabsSort(activityData.mission)
|
|
local curMissionConfig = nil
|
|
local maxConfig=nil
|
|
local isShowRed = false
|
|
for i = 1, #activityData.mission do
|
|
local id=activityData.mission[i].missionId
|
|
if activityData.mission[i].state == 0 and not curMissionConfig then
|
|
curMissionConfig = activityRewardConfig[id]
|
|
--LogError("activityData.mission[i].missionId=="..activityData.mission[i].missionId)
|
|
-- local value = curMissionConfig.Values[2][1]
|
|
-- local isPass = FightPointPassManager.IsFightPointPass2(value)
|
|
-- if isPass then
|
|
-- isShowRed=true
|
|
-- end
|
|
end
|
|
if activityData.mission[i].state == 1 then
|
|
isShowRed = true
|
|
end
|
|
if activityRewardConfig[id].Values and activityRewardConfig[id].Values[1][1]==1 then
|
|
maxConfig=activityRewardConfig[id]
|
|
end
|
|
end
|
|
local isAll=false
|
|
if not curMissionConfig then
|
|
isAll=true
|
|
curMissionConfig = maxConfig
|
|
end
|
|
if activityData and activityData.mission then
|
|
this.btnOpenSeverWelfare:SetActive(true)
|
|
else
|
|
this.btnOpenSeverWelfare:SetActive(false)
|
|
end
|
|
|
|
|
|
-- 奖励图
|
|
this.OpenSeverWelfareicon.sprite = this.spLoader:LoadSprite(OpenSeverWelfareRewardShow[curMissionConfig.Reward[1][1]].image1)
|
|
this.OpenSeverWelfareicon:SetNativeSize()
|
|
-- 文字
|
|
local imgName2 = OpenSeverWelfareRewardShow[curMissionConfig.Reward[1][1]].image2
|
|
if imgName2 and imgName2 ~= "" then
|
|
this.OpenSeverWelfareiconText.sprite = this.spLoader:LoadSprite(imgName2)
|
|
this.OpenSeverWelfareiconText.gameObject:SetActive(true)
|
|
this.OpenSeverWelfareiconText:SetNativeSize()
|
|
else
|
|
this.OpenSeverWelfareiconText.gameObject:SetActive(false)
|
|
end
|
|
LogError("FightPointPassManager.lastPassFightId=="..FightPointPassManager.lastPassFightId.." FightPointPassManager.curOpenFight=="..FightPointPassManager.curOpenFight)
|
|
local curPassLevelSortId = FightPointPassManager.lastPassFightId ~= FightPointPassManager.curOpenFight and mainLevelConfig[FightPointPassManager.lastPassFightId].SortId or 0
|
|
LogError("curMissionConfig.Values[2][1]==============="..curMissionConfig.Values[2][1])
|
|
local getRewardLevelSortId = mainLevelConfig[curMissionConfig.Values[2][1]].SortId
|
|
this.OpenSeverWelfareRed:SetActive(isShowRed)
|
|
if isAll then
|
|
this.OpenSeverWelfareProgressText.gameObject:SetActive(false)
|
|
this.OpenSeverWelfareProgressBg:SetActive(false)
|
|
this.OpenSeverWelfareInfoText.gameObject:SetActive(false)
|
|
else
|
|
this.OpenSeverWelfareProgressText.gameObject:SetActive(true)
|
|
this.OpenSeverWelfareProgressBg:SetActive(true)
|
|
this.OpenSeverWelfareInfoText.gameObject:SetActive(true)
|
|
end
|
|
curPassLevelSortId = curPassLevelSortId >= getRewardLevelSortId and getRewardLevelSortId or curPassLevelSortId
|
|
this.OpenSeverWelfareProgressText.text = curPassLevelSortId .. "/" .. getRewardLevelSortId
|
|
this.OpenSeverWelfareProgressImage.fillAmount =curPassLevelSortId/ getRewardLevelSortId
|
|
this.OpenSeverWelfareInfoText.text = GetLanguageStrById(curMissionConfig.ContentsShow)
|
|
--this.RemainTimeDown(this.btnOpenSeverWelfare,this.OpenSeverWelfareTimeText,activityData.endTime - GetTimeStamp())
|
|
else
|
|
this.btnOpenSeverWelfare:SetActive(false)
|
|
end
|
|
end
|
|
this.timer = Timer.New()
|
|
--刷新倒计时显示
|
|
function this.RemainTimeDown(_timeTextExpertgo,_timeTextExpert,timeDown)
|
|
if timeDown > 0 then
|
|
if _timeTextExpertgo then
|
|
_timeTextExpertgo:SetActive(true)
|
|
end
|
|
if _timeTextExpert then
|
|
_timeTextExpert.text = GetLeftTimeStrByDeltaTime2(timeDown)
|
|
end
|
|
if this.timer then
|
|
this.timer:Stop()
|
|
this.timer = nil
|
|
end
|
|
this.timer = Timer.New(function()
|
|
if _timeTextExpert then
|
|
_timeTextExpert.text = GetLeftTimeStrByDeltaTime2(timeDown)
|
|
end
|
|
if timeDown < 0 then
|
|
if _timeTextExpertgo then
|
|
_timeTextExpertgo:SetActive(false)
|
|
end
|
|
this.timer:Stop()
|
|
this.timer = nil
|
|
end
|
|
timeDown = timeDown - 1
|
|
end, 1, -1, true)
|
|
this.timer:Start()
|
|
else
|
|
if _timeTextExpertgo then
|
|
_timeTextExpertgo:SetActive(false)
|
|
end
|
|
end
|
|
end
|
|
function this.RefreshBattleUpLvTip(isShowUIOpen)
|
|
--
|
|
Util.AddOnceClick(this.battleUpLvTip, function() end)
|
|
this.battleUpLvTip:SetActive(false)
|
|
this.battleUpLvTipImg.enabled = false
|
|
this.battleUpLvTipTxt.gameObject:SetActive(false)
|
|
this.battleLockGo:SetActive(false)
|
|
-- 么解锁章节不显示
|
|
if not FightPointPassManager.IsChapterClossState() then
|
|
return
|
|
end
|
|
|
|
-- 判断状态
|
|
local curFightId = FightPointPassManager.GetCurFightId()
|
|
local isOk, tip, btnTxt, lockState = FightPointPassManager.CheckFightOpenRule(curFightId)
|
|
|
|
-- 可以挑战显示 挑战关卡快速升级
|
|
-- if not isShowUIOpen and isOk then
|
|
-- this.battleUpLvTip:SetActive(true)
|
|
-- this.battleUpLvTipImg.enabled = true
|
|
-- this.battleUpLvTipTxt.gameObject:SetActive(true)
|
|
-- this.battleLockGo:SetActive(false)
|
|
|
|
-- this.battleUpLvTipTxt.text = Language[10610]
|
|
-- return
|
|
-- end
|
|
|
|
-- 没有解锁条件不显示
|
|
-- local openRule = fightLevelConfig[curFightId].OpenRule
|
|
-- if not openRule then
|
|
-- return
|
|
-- end
|
|
|
|
-- -- 没有数据不显示
|
|
-- if not lockState then
|
|
-- return
|
|
-- end
|
|
|
|
-- --
|
|
-- for index, state in ipairs(lockState) do
|
|
-- if not state and openRule[index] then
|
|
-- local ruleType = openRule[index][1]
|
|
-- if ruleType then
|
|
-- if ruleType == 1 then
|
|
-- -- 山河社稷图
|
|
-- this.battleUpLvTip:SetActive(true)
|
|
-- this.battleUpLvTipImg.enabled = false
|
|
-- this.battleUpLvTipTxt.gameObject:SetActive(false)
|
|
-- this.battleLockGo:SetActive(true)
|
|
-- Util.AddOnceClick(this.battleUpLvTip, function()
|
|
-- JumpManager.GoJump(36023)
|
|
-- end)
|
|
-- elseif ruleType == 2 then
|
|
-- -- 心魔试炼
|
|
-- this.battleUpLvTip:SetActive(true)
|
|
-- this.battleUpLvTipImg.enabled = false
|
|
-- this.battleUpLvTipTxt.gameObject:SetActive(false)
|
|
-- this.battleLockGo:SetActive(true)
|
|
-- Util.AddOnceClick(this.battleUpLvTip, function()
|
|
-- JumpManager.GoJump(1011)
|
|
-- end)
|
|
-- elseif ruleType == 4 then
|
|
-- -- 背包 装备
|
|
-- this.battleUpLvTip:SetActive(true)
|
|
-- this.battleUpLvTipImg.enabled = false
|
|
-- this.battleUpLvTipTxt.gameObject:SetActive(false)
|
|
-- this.battleLockGo:SetActive(true)
|
|
-- Util.AddOnceClick(this.battleUpLvTip, function()
|
|
-- JumpManager.GoJump(1007)
|
|
-- end)
|
|
-- elseif ruleType == 5 then
|
|
-- -- 好感度
|
|
-- this.battleUpLvTip:SetActive(true)
|
|
-- this.battleUpLvTipImg.enabled = false
|
|
-- this.battleUpLvTipTxt.gameObject:SetActive(false)
|
|
-- this.battleLockGo:SetActive(true)
|
|
-- Util.AddOnceClick(this.battleUpLvTip, function()
|
|
-- JumpManager.GoJump(40033)
|
|
-- end)
|
|
-- elseif ruleType == 7 then
|
|
-- -- 获取神将
|
|
-- this.battleUpLvTip:SetActive(true)
|
|
-- this.battleUpLvTipImg.enabled = false
|
|
-- this.battleUpLvTipTxt.gameObject:SetActive(false)
|
|
-- this.battleLockGo:SetActive(true)
|
|
-- Util.AddOnceClick(this.battleUpLvTip, function()
|
|
-- JumpManager.GoJump(22001)
|
|
-- end)
|
|
-- end
|
|
-- end
|
|
-- end
|
|
-- end
|
|
end
|
|
|
|
function this.UpdateWordLv()
|
|
this.worldLv.text = PlayerManager.worldLeve
|
|
end
|
|
--开服福利显示 结束
|
|
return FightPointPassMainPanel
|
|
|