559 lines
25 KiB
Lua
559 lines
25 KiB
Lua
local Practice = quick_class("Practice", BasePanel)
|
||
local orginLayer
|
||
local XinXianConfig = ConfigManager.GetConfig(ConfigName.XiuXianConfig)
|
||
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||
local oldPower = 0
|
||
local newPower = 0
|
||
local oldBigLevel = 0
|
||
local globalSystemConfig = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,FUNCTION_OPEN_TYPE.FOURQUADRANT)
|
||
local skillSystemConfig = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,FUNCTION_OPEN_TYPE.PLAYER_SKILL)
|
||
local xiuWeiSystemConfig = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,FUNCTION_OPEN_TYPE.XIUWEI)
|
||
local SkillBaseConfig= ConfigManager.GetConfig(ConfigName.PlayerSkillBasicTable)
|
||
function Practice:InitComponent()
|
||
self.spLoader = SpriteLoader.New()
|
||
orginLayer = 0
|
||
if not self.playerInfoView then
|
||
self.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, self.transform)
|
||
end
|
||
self.BtView = SubUIManager.Open(SubUIConfig.BtView, self.transform)
|
||
self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)
|
||
self.Practice = Util.GetGameObject(self.gameObject, "Prectice")
|
||
--Btns
|
||
self.Btns = Util.GetGameObject(self.Practice, "Btns")
|
||
self.helpBtn = Util.GetGameObject(self.Btns, "helpBtn")
|
||
self.starBtn = Util.GetGameObject(self.Btns, "starBtn")
|
||
self.helpPosition=self.helpBtn:GetComponent("RectTransform").localPosition
|
||
self.previewBtn = Util.GetGameObject(self.Btns, "leftGrid/previewBtn")
|
||
self.additionBtn = Util.GetGameObject(self.Btns, "leftGrid/additionBtn")
|
||
self.cultivationBtn = Util.GetGameObject(self.Btns, "leftGrid/cultivationBtn")
|
||
self.cultivationRed = Util.GetGameObject(self.cultivationBtn, "redPoint")
|
||
|
||
self.imprintBtn = Util.GetGameObject(self.Btns, "rightGrid/imprintBtn")
|
||
self.imprintRedPoint = Util.GetGameObject(self.imprintBtn, "redPoint")
|
||
|
||
self.gemBtn = Util.GetGameObject(self.Btns, "rightGrid/gemBtn")
|
||
self.gemRedPoint = Util.GetGameObject(self.gemBtn, "redPoint")
|
||
Util.GetGameObject(self.Btns, "rightGrid/gemBtn"):GetComponent("Image").sprite=self.spLoader:LoadSprite("x_xiuxing_mingge_zh")
|
||
|
||
self.giftBtn = Util.GetGameObject(self.Btns, "rightGrid/giftBtn")
|
||
self.giftRedPoint = Util.GetGameObject(self.giftBtn, "redPoint")
|
||
self.giftRedPoint:SetActive(false)
|
||
Util.GetGameObject(self.Btns, "rightGrid/giftBtn"):GetComponent("Image").sprite=self.spLoader:LoadSprite("s_gift_player_zh")
|
||
self.fourQuadrantBtn = Util.GetGameObject(self.Btns, "rightGrid/yushenBtn")
|
||
self.fourQuadrantRedPoint = Util.GetGameObject(self.fourQuadrantBtn, "redPoint")
|
||
self.starNum = Util.GetGameObject(self.starBtn, "starNum"):GetComponent("Text")
|
||
self.treeBtn = Util.GetGameObject(self.Btns, "rightGrid/treeBtn")
|
||
self.treeRed = Util.GetGameObject(self.treeBtn, "redPoint")
|
||
self.talsmanSoulBtn = Util.GetGameObject(self.Btns, "rightGrid/talsmanSoulBtm")
|
||
self.talsmanSoulBtnRed = Util.GetGameObject(self.talsmanSoulBtn, "redPoint")
|
||
self.incarnationBtn = Util.GetGameObject(self.Btns, "leftGrid/incarnationBtn")
|
||
self.incarnationBtnRed = Util.GetGameObject(self.incarnationBtn, "redPoint")
|
||
|
||
--MidPart
|
||
self.mid = Util.GetGameObject(self.gameObject, "Mid")
|
||
self.levelName = Util.GetGameObject(self.mid, "LevelName"):GetComponent("Image")
|
||
self.levelTxt = Util.GetGameObject(self.mid, "LevelTxt"):GetComponent("Text")
|
||
self.img = Util.GetGameObject(self.mid, "Man"):GetComponent("Image")
|
||
self.ManCanvas = Util.GetGameObject(self.mid, "Man"):GetComponent("Canvas")
|
||
--BottomPart
|
||
self.bottom = Util.GetGameObject(self.Practice, "Bottom")
|
||
self.items = Util.GetGameObject(self.bottom, "Items")
|
||
self.PointPre = Util.GetGameObject(self.items, "PointPre")
|
||
self.lines = Util.GetGameObject(self.bottom, "Lines")
|
||
self.LinePre = Util.GetGameObject(self.lines, "LinePre")
|
||
self.needs = Util.GetGameObject(self.bottom, "Needs")
|
||
self.needPre = Util.GetGameObject(self.needs, "pre")
|
||
self.button = Util.GetGameObject(self.bottom, "Button")
|
||
self.buttonText = Util.GetGameObject(self.button, "Text"):GetComponent("Text")
|
||
self.redPoint = Util.GetGameObject(self.button, "redPoint")
|
||
self.content = Util.GetGameObject(self.bottom, "Content")
|
||
self.textBtn = Util.GetGameObject(self.content, "Text")
|
||
self.needStar = Util.GetGameObject(self.content, "num"):GetComponent("Text")
|
||
self.noOpenTip = Util.GetGameObject(self.bottom, "noOpenTip")
|
||
self.effect = Util.GetGameObject(self.mid, "Man/fx_ui_xiuxingshengxin")
|
||
self.effect:SetActive(false)
|
||
|
||
self.fx_ui_xiuxingshengxin_01 = Util.GetGameObject(self.gameObject, "Bg/fx_ui_xiuxingshengxin_01")
|
||
self.fx_ui_xiuxingshengxin_02 = Util.GetGameObject(self.gameObject, "Bg/fx_ui_xiuxingshengxin_02")
|
||
self.fx_ui_xiuxingshengxin_03 = Util.GetGameObject(self.gameObject, "Bg/fx_ui_xiuxingshengxin_03")
|
||
self.fx_ui_xiuxingshengxin_cangzhu = Util.GetGameObject(self.gameObject, "Bg/fx_ui_xiuxingshengxin_cangzhu")
|
||
self.fx_ui_xiuxingshengxin_01:SetActive(false)
|
||
self.fx_ui_xiuxingshengxin_02:SetActive(false)
|
||
self.fx_ui_xiuxingshengxin_03:SetActive(false)
|
||
self.itemList = {}
|
||
self.pointList = {}
|
||
self.lineList = {}
|
||
self.effectUpgradeList = {}
|
||
self.effectPointsList = {}
|
||
self.mask = Util.GetGameObject(self.gameObject, "mask")
|
||
|
||
--主角技能
|
||
self.skillObj=Util.GetGameObject(self.Practice, "SkillObj")
|
||
self.skillList={}
|
||
for i = 1, 4 do
|
||
table.insert(self.skillList,Util.GetGameObject(self.Practice, "SkillObj/skill"..i))
|
||
BindRedPointObject(5000+i*100,Util.GetGameObject(self.Practice, "SkillObj/skill"..i.."/red"))
|
||
end
|
||
--页签
|
||
self.tab = Util.GetGameObject(self.gameObject, "Tab")
|
||
self.tab:SetActive(false)
|
||
self.btnGem = Util.GetGameObject(self.tab, "tab2")
|
||
self.practice_tab = Util.GetGameObject(self.tab, "tab1/Redpot")
|
||
self.gem_tab = Util.GetGameObject(self.tab, "tab2/Redpot")
|
||
|
||
end
|
||
|
||
function Practice:BindEvent()
|
||
--帮助按钮
|
||
Util.AddClick(self.helpBtn, function()
|
||
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Practice, self.helpPosition.x,self.helpPosition.y)
|
||
end)
|
||
|
||
Util.AddClick(self.previewBtn, function()
|
||
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.PracticeStatePreview)
|
||
end)
|
||
Util.AddClick(self.additionBtn, function()
|
||
UIManager.OpenPanel(UIName.RoleProInfoPopup,PracticeManager.GetCurAllGetAddForShow(),nil,false,nil)
|
||
end)
|
||
|
||
Util.AddClick(self.giftBtn, function()
|
||
UIManager.OpenPanel(UIName.PlayerGiftPanel)
|
||
end)
|
||
Util.AddClick(self.gemBtn, function()
|
||
local isOpen= CheckFunctionOpen(FUNCTION_OPEN_TYPE.GemNew)
|
||
if isOpen then
|
||
UIManager.OpenPanel(UIName.GemPanel,1)
|
||
else
|
||
local tip=GetFunctionOpenTip(FUNCTION_OPEN_TYPE.GemNew)
|
||
PopupTipPanel.ShowTip(tip)
|
||
end
|
||
|
||
end)
|
||
Util.AddClick(self.imprintBtn, function()
|
||
if PracticeManager.PracticeBigLevel > 1 then
|
||
UIManager.OpenPanel(UIName.PracticeImprintPanel)
|
||
else
|
||
PopupTipPanel.ShowTip("到达筑基期后解锁!")
|
||
end
|
||
end)
|
||
--四象心法按钮
|
||
Util.AddClick(self.fourQuadrantBtn, function()
|
||
if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.FOURQUADRANT) then
|
||
local tip = ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.FOURQUADRANT)
|
||
PopupTipPanel.ShowTip(tip)
|
||
else
|
||
UIManager.OpenPanel(UIName.FourQuadrantPopup)
|
||
end
|
||
end)
|
||
Util.AddClick(self.textBtn, function()
|
||
UIManager.OpenPanel(UIName.FightLevelChapterPanel)
|
||
end)
|
||
Util.AddClick(self.starBtn, function()
|
||
UIManager.OpenPanel(UIName.FightLevelChapterPanel)
|
||
end)
|
||
Util.AddClick(self.button, function()
|
||
if self:UpgradeCheck() then return end
|
||
if not self.curLevelConfig.LevelUpCost then--如果是破镜阶段
|
||
self.mask:SetActive(true)
|
||
self.fx_ui_xiuxingshengxin_01:SetActive(true)
|
||
if self.pointList and #self.pointList > 0 then
|
||
for i = 1, #self.pointList do
|
||
Util.GetGameObject(self.pointList[i],"looping"):SetActive(false)
|
||
end
|
||
end
|
||
Timer.New(function ()
|
||
self.fx_ui_xiuxingshengxin_02:SetActive(true)
|
||
Timer.New(function ()
|
||
self.fx_ui_xiuxingshengxin_03:SetActive(true)
|
||
Timer.New(function ()
|
||
self.fx_ui_xiuxingshengxin_02:SetActive(false)
|
||
self.fx_ui_xiuxingshengxin_01:SetActive(false)
|
||
self.fx_ui_xiuxingshengxin_03:SetActive(false)
|
||
self:BtnClickEvent()
|
||
self.mask:SetActive(false)
|
||
end,2):Start()
|
||
end,1.5):Start()
|
||
end,1):Start()
|
||
else
|
||
self:BtnClickEvent()
|
||
end
|
||
end)
|
||
|
||
Util.AddClick(self.treeBtn, function()
|
||
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.SACREDTREE) then
|
||
UIManager.OpenPanel(UIName.SacredTreePanel)
|
||
end
|
||
end)
|
||
|
||
Util.AddClick(self.cultivationBtn, function()
|
||
UIManager.OpenPanel(UIName.CultivationPanel)
|
||
end)
|
||
|
||
Util.AddClick(self.talsmanSoulBtn, function()
|
||
UIManager.OpenPanel(UIName.TailsManSouPanel)
|
||
end)
|
||
Util.AddClick(self.incarnationBtn, function()
|
||
UIManager.OpenPanel(UIName.IncarnationPanel)
|
||
end)
|
||
Util.AddClick(self.btnGem, function()
|
||
JumpManager.GoJump(40056)
|
||
--self:ClosePanel()
|
||
end)
|
||
BindRedPointObject(RedPointType.tailsmanSoul,self.talsmanSoulBtnRed)
|
||
BindRedPointObject(RedPointType.Practice_Cultivation,self.cultivationRed)
|
||
BindRedPointObject(RedPointType.Practice_upgrade,self.redPoint)
|
||
BindRedPointObject(RedPointType.Practice_imprint,self.imprintRedPoint)
|
||
BindRedPointObject(RedPointType.Practice_fourQua,self.fourQuadrantRedPoint)
|
||
BindRedPointObject(RedPointType.Sacred_roleInfo,self.treeRed)
|
||
BindRedPointObject(RedPointType.incarnation,self.incarnationBtnRed)
|
||
BindRedPointObject(RedPointType.Practice,self.practice_tab)
|
||
BindRedPointObject(RedPointType.Gem,self.gemRedPoint)
|
||
end
|
||
function Practice:BtnClickEvent()
|
||
NetManager.UpPracticeLevelRequest(function ()
|
||
newPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
||
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPower,newValue = newPower})
|
||
oldPower = newPower
|
||
--名字颜色
|
||
Game.GlobalEvent:DispatchEvent(GameEvent.Player.OnChangeName)
|
||
local curNum = XinXianConfig[PracticeManager.PracticeLevel].RealmLevel
|
||
if curNum ~= 0 then
|
||
for i = 1, #self.effectUpgradeList do
|
||
self.effectUpgradeList[i]:SetActive(false)
|
||
end
|
||
self.effectUpgradeList[curNum]:SetActive(true)
|
||
else
|
||
for i = 1, #self.effectUpgradeList do
|
||
self.effectUpgradeList[i]:SetActive(false)
|
||
end
|
||
end
|
||
--战力更改请求
|
||
Practice:SetSkillInfo()
|
||
PracticeManager.ShowTipsOnUpgrade()
|
||
NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL)
|
||
if PracticeManager.PracticeBigLevel - oldBigLevel == 1 then
|
||
UIManager.OpenPanel(UIName.CongratulationPopup,CONGRATULATION_TYPE.Practice,XinXianConfig[PracticeManager.PracticeLevel])
|
||
if PracticeManager.PracticeBigLevel == 2 then
|
||
Game.GlobalEvent:DispatchEvent(GameEvent.Practice.PracticeGuide)
|
||
end
|
||
end
|
||
self:OnShow()
|
||
end)
|
||
end
|
||
--Check
|
||
function Practice:UpgradeCheck()
|
||
if PracticeManager.StarNum < self.curLevelConfig.NeedStarNum then
|
||
PopupTipPanel.ShowTip("无法破境,请前往山河社稷图获取更多星星!")
|
||
return true
|
||
end
|
||
if self.curLevelConfig.LevelUpCost then
|
||
for i = 1, #self.curLevelConfig.LevelUpCost do
|
||
local data = self.curLevelConfig.LevelUpCost[i]
|
||
if BagManager.GetTotalItemNum(data[1]) < data[2] then
|
||
PopupTipPanel.ShowTip(string.format("%s不足!",ItemConfig[data[1]].Name))
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
function Practice:AddListener()
|
||
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, self.OnShow,self)
|
||
end
|
||
|
||
function Practice:RemoveListener()
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, self.OnShow,self)
|
||
end
|
||
|
||
--待功能扩展(试图打开某个状态)
|
||
function Practice:OnOpen()
|
||
self.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.XiuXing })
|
||
self.BtView:OnOpen(self,{ sortOrder = self.sortingOrder, panelType = PanelTypeView.Practice })
|
||
self.mask:SetActive(false)
|
||
|
||
self.skillObj:SetActive(skillSystemConfig.IsOpen==1)
|
||
self.cultivationBtn:SetActive(xiuWeiSystemConfig.IsOpen==1)
|
||
Practice:SetSkillInfo()
|
||
|
||
end
|
||
--设置技能信息显示
|
||
function Practice:SetSkillInfo()
|
||
if skillSystemConfig.IsOpen==1 then
|
||
CheckRedPointStatus(RedPointType.playerSkill1)
|
||
CheckRedPointStatus(RedPointType.playerSkill2)
|
||
CheckRedPointStatus(RedPointType.playerSkill3)
|
||
CheckRedPointStatus(RedPointType.playerSkill4)
|
||
end
|
||
|
||
local list=PracticeManager.GetSkillInfo()
|
||
local index=1
|
||
for i = 100, 400,100 do
|
||
local item=self.skillList[index]
|
||
Util.GetGameObject(item, "icon"):GetComponent("Image").sprite=self.spLoader:LoadSprite(GetResourcePath(tonumber(SkillBaseConfig[i].Icon)))
|
||
--Util.GetGameObject(item, "red"):SetActive(false)
|
||
if list[i] and list[i]~=0 then
|
||
Util.GetGameObject(item, "mask"):SetActive(false)
|
||
Util.GetGameObject(item, "Text"):SetActive(true)
|
||
Util.GetGameObject(item, "Image"):SetActive(true)
|
||
Util.GetGameObject(item, "Text"):GetComponent("Text").text=list[i]
|
||
else
|
||
Util.GetGameObject(item, "mask"):SetActive(true)
|
||
Util.GetGameObject(item, "Image"):SetActive(false)
|
||
Util.GetGameObject(item, "Text"):SetActive(false)
|
||
end
|
||
Util.AddOnceClick(item,function()
|
||
UIManager.OpenPanel(UIName.PracticeSkillInfoPanel,i,list[i])
|
||
end)
|
||
index=index+1
|
||
end
|
||
end
|
||
function Practice:OnFocus()
|
||
Practice:SetSkillInfo()
|
||
-- 设置蓝点层级
|
||
self.items:GetComponent("Canvas").sortingOrder = self.sortingOrder + 1
|
||
end
|
||
|
||
function Practice:OnSortingOrderChange()
|
||
orginLayer = self.sortingOrder
|
||
self.BtView:OnOpen(self,{ sortOrder = self.sortingOrder, panelType = PanelTypeView.Practice })
|
||
Util.SetParticleSortLayer(self.effect, self.sortingOrder+1)
|
||
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_01, self.sortingOrder+1)
|
||
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_02, self.sortingOrder+1)
|
||
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_03, self.sortingOrder+1)
|
||
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_cangzhu, self.sortingOrder+1)
|
||
self.ManCanvas.sortingOrder = self.sortingOrder + 2
|
||
if self.effectPointsList then
|
||
for i = 1, #self.effectPointsList do
|
||
Util.SetParticleSortLayer(self.effectPointsList[i], self.sortingOrder+2)
|
||
end
|
||
end
|
||
-- 头像层级
|
||
if self.playerInfoView then
|
||
self.playerInfoView:SetLayer(self.sortingOrder)
|
||
end
|
||
-- 设置蓝点层级
|
||
self.items:GetComponent("Canvas").sortingOrder = self.sortingOrder + 1
|
||
|
||
end
|
||
|
||
function Practice:OnShow()
|
||
self.treeBtn:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.SACREDTREE))
|
||
self.treeBtn:SetActive(false)
|
||
self.playerInfoView:OnShow()
|
||
|
||
CheckRedPointStatus(RedPointType.Practice_imprint)
|
||
CheckRedPointStatus(RedPointType.Practice_upgrade)
|
||
CheckRedPointStatus(RedPointType.Practice_fourQua)
|
||
CheckRedPointStatus(RedPointType.Practice_Cultivation)
|
||
CheckRedPointStatus(RedPointType.Gem)
|
||
CheckRedPointStatus(RedPointType.Gem_1)
|
||
CheckRedPointStatus(RedPointType.Gem_2)
|
||
FormationManager.RefreshMainFormationPower()
|
||
self.curLevelConfig = PracticeManager.GetCurConfigData()
|
||
oldPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
||
oldBigLevel = PracticeManager.PracticeBigLevel
|
||
self.pointData = PracticeManager.GetPointsData()
|
||
self.lineData = PracticeManager.GetLinesData()
|
||
self:RefreshMid()
|
||
self:RefreshPoints()
|
||
self:RefreshLines()
|
||
self:RefreshBtn()
|
||
self:RefreshTabs()
|
||
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_01, self.sortingOrder+1)
|
||
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_02, self.sortingOrder+1)
|
||
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_03, self.sortingOrder+1)
|
||
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_cangzhu, self.sortingOrder+1)
|
||
self.ManCanvas.sortingOrder = self.sortingOrder + 2
|
||
end
|
||
|
||
function Practice:RefreshTabs()
|
||
local funcType = {
|
||
[1] = FUNCTION_OPEN_TYPE.PRACTICE,
|
||
[2] = FUNCTION_OPEN_TYPE.Gem,
|
||
}
|
||
local num = 0
|
||
for i = 1,self.tab.transform.childCount do
|
||
self.tab.transform:GetChild(i-1).gameObject:SetActive(false)
|
||
if ActTimeCtrlManager.SingleFuncState(funcType[i]) then
|
||
self.tab.transform:GetChild(i-1).gameObject:SetActive(true)
|
||
num = num + 1
|
||
end
|
||
end
|
||
self.tab:SetActive(false)
|
||
end
|
||
|
||
function Practice:RefreshMid()
|
||
self.levelName.sprite = self.spLoader:LoadSprite(self.curLevelConfig.NamePic1)
|
||
self.levelTxt.text="-"..self.curLevelConfig.Name.."-"
|
||
self.starNum.text = PracticeManager.StarNum
|
||
local playerImg = NameManager.roleSex == 0 and "x_xiuxing_liangongren_nan" or "x_xiuxing_liangongren_nv"
|
||
self.img.sprite = self.spLoader:LoadSprite(playerImg)
|
||
-- Util.SetParticleSortLayer(self.effect, self.sortingOrder+1)
|
||
end
|
||
|
||
--刷新点
|
||
function Practice:RefreshPoints()
|
||
if not self.pointList then
|
||
self.pointList = {}
|
||
end
|
||
for k,v in ipairs(self.pointList) do
|
||
v.gameObject:SetActive(false)
|
||
end
|
||
for i = 1, #self.pointData do
|
||
local data = self.pointData[i]
|
||
if not self.pointList[i] then
|
||
self.pointList[i] = newObject(self.PointPre)
|
||
self.pointList[i].transform:SetParent(self.items.transform)
|
||
self.pointList[i].transform.localScale = Vector3.one
|
||
self.pointList[i].transform.localPosition = Vector3.zero
|
||
end
|
||
self.pointList[i]:SetActive(true)
|
||
self.pointList[i]:GetComponent("Image").sprite = self.spLoader:LoadSprite(data.Img)
|
||
self.pointList[i]:GetComponent("RectTransform").localPosition = data.Pos
|
||
self.effectPointsList[i] = Util.GetGameObject(self.pointList[i],"looping")
|
||
self.effectPointsList[i]:SetActive(data.State == 1)
|
||
self.effectUpgradeList[i] = Util.GetGameObject(self.pointList[i],"Fx_xiuxing_qiu_brust")
|
||
-- LogGreen("self.sortingOrder:"..tostring(self.sortingOrder))
|
||
Util.SetParticleSortLayer(self.effectPointsList[i], self.sortingOrder+2)
|
||
Util.SetParticleSortLayer(self.effectUpgradeList[i], self.sortingOrder+2)
|
||
-- self.effectUpgradeList[i]:SetActive(false)
|
||
Util.AddOnceClick(self.pointList[i],function ()
|
||
UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.PracticeLevel,data)
|
||
-- 设置蓝点层级
|
||
self.items:GetComponent("Canvas").sortingOrder = self.sortingOrder + 101
|
||
end)
|
||
end
|
||
end
|
||
|
||
--刷新 点间的线
|
||
function Practice:RefreshLines()
|
||
if not self.lineList then
|
||
self.lineList = {}
|
||
end
|
||
for k,v in ipairs(self.lineList) do
|
||
v.gameObject:SetActive(false)
|
||
end
|
||
for i = 1, #self.lineData do
|
||
local data = self.lineData[i]
|
||
if not self.lineList[i] then
|
||
self.lineList[i] = newObject(self.LinePre)
|
||
self.lineList[i].transform:SetParent(self.lines.transform)
|
||
self.lineList[i].transform.localScale = Vector3.one
|
||
self.lineList[i].transform.localPosition = Vector3.zero
|
||
end
|
||
self.lineList[i]:SetActive(true)
|
||
local imgName = data.State == 1 and "x_xiuxing_xian_01" or "x_xiuxing_xian_02"
|
||
self.lineList[i]:GetComponent("Image").sprite = self.spLoader:LoadSprite(imgName)
|
||
self.lineList[i]:GetComponent("RectTransform").localPosition = data.Pos
|
||
self.lineList[i]:GetComponent("RectTransform").rotation = Quaternion.Euler(data.Rota)
|
||
end
|
||
end
|
||
|
||
function Practice:RefreshBtn()
|
||
--神印按钮筑基期后开启
|
||
Util.SetGray(self.imprintBtn,PracticeManager.PracticeBigLevel < 2)
|
||
--屏蔽紫府神印入口
|
||
self.imprintBtn:SetActive(false)
|
||
Util.SetGray(self.fourQuadrantBtn,not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.FOURQUADRANT))
|
||
self.fourQuadrantBtn:SetActive(globalSystemConfig.IsOpen==1)
|
||
self.talsmanSoulBtn:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.TailsmanSoul))
|
||
self.incarnationBtn:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.Incarnation))
|
||
self.giftBtn:SetActive(CheckFunctionOpen(FUNCTION_OPEN_TYPE.Gift))
|
||
self.noOpenTip:SetActive(false)
|
||
if XinXianConfig[PracticeManager.PracticeLevel + 1] then
|
||
self.button:SetActive(true)
|
||
if self.curLevelConfig.LevelUpCost then--如果下级消耗不为空则为突破阶段
|
||
if not self.itemList then
|
||
self.itemList = {}
|
||
end
|
||
for k,v in ipairs(self.itemList) do
|
||
v.gameObject:SetActive(false)
|
||
end
|
||
for i = 1, #self.curLevelConfig.LevelUpCost do
|
||
local data = self.curLevelConfig.LevelUpCost[i]
|
||
if not self.itemList[i] then
|
||
self.itemList[i] = newObject(self.needPre)
|
||
self.itemList[i].transform:SetParent(self.needs.transform)
|
||
self.itemList[i].transform.localScale = Vector3.one
|
||
self.itemList[i].transform.localPosition = Vector3.zero
|
||
end
|
||
local icon = Util.GetGameObject(self.itemList[i],"icon"):GetComponent("Image")
|
||
local num = Util.GetGameObject(self.itemList[i],"num"):GetComponent("Text")
|
||
icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(data[1]))
|
||
num.text = data[2]
|
||
if BagManager.GetTotalItemNum(data[1]) < data[2] then
|
||
num.text = string.format("<color=red>%s</color>",data[2])
|
||
end
|
||
self.itemList[i]:SetActive(true)
|
||
end
|
||
|
||
self.needs:SetActive(true)
|
||
self.content:SetActive(false)
|
||
self.buttonText.text = Language[11805]
|
||
else
|
||
self.needs:SetActive(false)
|
||
self.needStar.text = self.curLevelConfig.NeedStarNum
|
||
if self.curLevelConfig.NeedStarNum > PracticeManager.StarNum then
|
||
self.needStar.text = string.format("<color=red>%s</color>",self.curLevelConfig.NeedStarNum)
|
||
end
|
||
self.buttonText.text = "破 境"
|
||
local nextConFig = XinXianConfig[PracticeManager.PracticeLevel + 1]
|
||
LogYellow("self.curLevelConfig "..nextConFig.Id)
|
||
if nextConFig.IsOpen == 0 then--未开启
|
||
self.noOpenTip:GetComponent("Text").text = string.format("【<color=#%s>%s期</color>】暂未开放,请等待后续更新",nextConFig.NameFontColor,nextConFig.RealmName)
|
||
Util.SetGray(self.button,true)
|
||
self.button:GetComponent("Button").enabled = false
|
||
self.noOpenTip:SetActive(true)
|
||
elseif nextConFig.IsOpen == 1 then--开启
|
||
Util.SetGray(self.button,false)
|
||
self.content:SetActive(true)
|
||
self.button:GetComponent("Button").enabled = true
|
||
end
|
||
end
|
||
else
|
||
self.button:SetActive(false)
|
||
self.needs:SetActive(false)
|
||
self.content:SetActive(true)
|
||
Util.GetGameObject(self.content,"Text"):SetActive(false)
|
||
Util.GetGameObject(self.content,"Image"):SetActive(false)
|
||
self.needStar.text = "恭喜你已修行至世间巅峰"
|
||
end
|
||
end
|
||
|
||
function Practice:OnClose()
|
||
for i = 1, #self.effectUpgradeList do
|
||
self.effectUpgradeList[i]:SetActive(false)
|
||
end
|
||
end
|
||
|
||
function Practice:OnDestroy()
|
||
self.spLoader:Destroy()
|
||
SubUIManager.Close(self.UpView)
|
||
SubUIManager.Close(self.BtView)
|
||
self.UpView = nil
|
||
self.BtView = nil
|
||
if self.playerInfoView then
|
||
SubUIManager.Close(self.playerInfoView)
|
||
self.playerInfoView = nil
|
||
end
|
||
ClearRedPointObject(RedPointType.Sacred_roleInfo,self.treeRed)
|
||
ClearRedPointObject(RedPointType.Practice_upgrade,self.redPoint)
|
||
ClearRedPointObject(RedPointType.Practice_imprint,self.imprintRedPoint)
|
||
ClearRedPointObject(RedPointType.Practice_fourQua,self.fourQuadrantRedPoint)
|
||
ClearRedPointObject(RedPointType.Practice_Cultivation,self.cultivationRed)
|
||
ClearRedPointObject(RedPointType.tailsmanSoul,self.talsmanSoulBtnRed)
|
||
ClearRedPointObject(RedPointType.incarnation,self.incarnationBtnRed)
|
||
ClearRedPointObject(RedPointType.Practice,self.practice_tab)
|
||
ClearRedPointObject(RedPointType.Gem,self.gemRedPoint)
|
||
for i = 1, 4 do
|
||
ClearRedPointObject(500+i*100,Util.GetGameObject(self.Practice, "SkillObj/skill"..i.."/red"))
|
||
end
|
||
self.itemList = {}
|
||
self.skillList={}
|
||
self.pointList = {}
|
||
self.lineList = {}
|
||
self.effectUpgradeList = {}
|
||
end
|
||
|
||
return Practice |