2021-12-06 15:07:34 +08:00
|
|
|
|
local Gem = quick_class("Gem", BasePanel)
|
2021-12-07 11:50:03 +08:00
|
|
|
|
local itemData = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local gemConfig = ConfigManager.GetConfig(ConfigName.GemConfig)
|
2021-12-06 14:06:23 +08:00
|
|
|
|
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:InitComponent()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
self.spLoader = SpriteLoader.New()
|
|
|
|
|
if not self.playerInfoView then
|
|
|
|
|
self.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, self.transform)
|
|
|
|
|
end
|
2021-12-06 15:07:34 +08:00
|
|
|
|
self.BtView = SubUIManager.Open(SubUIConfig.BtView, self.transform)
|
|
|
|
|
self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)
|
2021-12-06 14:06:23 +08:00
|
|
|
|
--MidPart
|
|
|
|
|
self.mid = Util.GetGameObject(self.gameObject, "Mid")
|
|
|
|
|
self.img = Util.GetGameObject(self.mid, "Man"):GetComponent("Image")
|
|
|
|
|
self.ManCanvas = Util.GetGameObject(self.mid, "Man"):GetComponent("Canvas")
|
2021-12-06 15:31:29 +08:00
|
|
|
|
self.fx_ui_xiuxingshengxin_cangzhu = Util.GetGameObject(self.gameObject, "Bg/fx_ui_xiuxingshengxin_cangzhu")
|
2021-12-07 11:50:03 +08:00
|
|
|
|
--Gems
|
|
|
|
|
self.gems = Util.GetGameObject(self.gameObject, "Gems")
|
2021-12-06 14:06:23 +08:00
|
|
|
|
|
|
|
|
|
--页签
|
|
|
|
|
self.btnPractice = Util.GetGameObject(self.gameObject, "Tab/tab1")
|
2021-12-07 15:40:36 +08:00
|
|
|
|
self.onekey = Util.GetGameObject(self.gameObject, "onekey")
|
|
|
|
|
self.fast = Util.GetGameObject(self.gameObject, "fast")
|
|
|
|
|
self.more = Util.GetGameObject(self.gameObject, "more")
|
2021-12-06 14:06:23 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:BindEvent()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
--帮助按钮
|
|
|
|
|
Util.AddClick(self.helpBtn, function()
|
|
|
|
|
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Practice, self.helpPosition.x,self.helpPosition.y)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
Util.AddClick(self.btnPractice, function()
|
2021-12-07 16:27:55 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.PracticePanel)
|
|
|
|
|
self:ClosePanel()
|
2021-12-07 15:40:36 +08:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
Util.AddClick(self.onekey, function()
|
|
|
|
|
NetManager.LifeStoneUpRequest(2)
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(self.fast, function()
|
2021-12-07 15:57:33 +08:00
|
|
|
|
NetManager.LifeStoneUpRequest(4,nil,nil,45079)
|
2021-12-07 15:40:36 +08:00
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(self.more, function()
|
2021-12-07 15:57:33 +08:00
|
|
|
|
NetManager.LifeStoneUpRequest(2,nil,nil,45071,6)
|
2021-12-06 14:06:23 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:AddListener()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:RemoveListener()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--待功能扩展(试图打开某个状态)
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:OnOpen()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
self.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.XiuXing })
|
|
|
|
|
self.BtView:OnOpen(self,{ sortOrder = self.sortingOrder, panelType = PanelTypeView.Practice })
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:OnSortingOrderChange()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
self.ManCanvas.sortingOrder = self.sortingOrder + 2
|
2021-12-06 15:31:29 +08:00
|
|
|
|
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_cangzhu, self.sortingOrder + 1)
|
2021-12-06 14:06:23 +08:00
|
|
|
|
-- 头像层级
|
|
|
|
|
if self.playerInfoView then
|
|
|
|
|
self.playerInfoView:SetLayer(self.sortingOrder)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:OnShow()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
self.playerInfoView:OnShow()
|
2021-12-06 15:31:29 +08:00
|
|
|
|
Util.SetParticleSortLayer(self.fx_ui_xiuxingshengxin_cangzhu, self.sortingOrder + 1)
|
|
|
|
|
self:Refresh()
|
|
|
|
|
end
|
|
|
|
|
function Gem:Refresh()
|
|
|
|
|
local oldWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
2021-12-06 14:06:23 +08:00
|
|
|
|
self:RefreshMid()
|
2021-12-07 11:50:03 +08:00
|
|
|
|
self:SetGems()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--刷新中部人物
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:RefreshMid()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
local playerImg = NameManager.roleSex == 0 and "x_xiuxing_liangongren_nan" or "x_xiuxing_liangongren_nv"
|
|
|
|
|
self.img.sprite = self.spLoader:LoadSprite(playerImg)
|
|
|
|
|
self.ManCanvas.sortingOrder = self.sortingOrder + 2
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-07 11:50:03 +08:00
|
|
|
|
--设置中部宝石数据
|
|
|
|
|
function Gem:SetGems()
|
|
|
|
|
local gemData = GemManager.myGemList
|
|
|
|
|
for i = 1, 8 do
|
|
|
|
|
local itemGo = Util.GetGameObject(self.gems,"item ("..i..")")
|
|
|
|
|
if gemData[i] then
|
|
|
|
|
for j = 1, 3 do
|
|
|
|
|
local stoneGo = Util.GetGameObject(itemGo,"stone ("..j..")")
|
|
|
|
|
local level = Util.GetGameObject(stoneGo,"Text"):GetComponent("Text")
|
|
|
|
|
local name = "r_RareItem_Specail_0222"
|
|
|
|
|
level.text = ""
|
|
|
|
|
if gemData[i][j] then
|
|
|
|
|
name = GetSpriteNameByItemId(gemData[i][j])
|
|
|
|
|
level.text = gemConfig[gemData[i][j]].Level
|
|
|
|
|
end
|
|
|
|
|
stoneGo:GetComponent("Image").sprite = self.spLoader:LoadSprite(name)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
Util.AddOnceClick(itemGo,function ()
|
|
|
|
|
self:SetStones(gemData[i])
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function Gem:SetStones(_data)
|
|
|
|
|
LogWarn("[1]:"..tostring(_data[1]).." [2]:"..tostring(_data[2]).." [3]:"..tostring(_data[3]))
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:OnClose()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-12-06 15:07:34 +08:00
|
|
|
|
function Gem:OnDestroy()
|
2021-12-06 14:06:23 +08:00
|
|
|
|
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
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-06 15:07:34 +08:00
|
|
|
|
return Gem
|