parent
0ed878daac
commit
9266d81377
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,6 @@
|
||||||
ElementDrawCardPanelNew = {}
|
ElementDrawCardPanelNew = {}
|
||||||
local isPlayAnim = true
|
local isPlayAnim = true
|
||||||
|
local isSubPlayAnim = true
|
||||||
function ElementDrawCardPanelNew:New(gameObject)
|
function ElementDrawCardPanelNew:New(gameObject)
|
||||||
local b = {}
|
local b = {}
|
||||||
b.gameObject = gameObject
|
b.gameObject = gameObject
|
||||||
|
@ -8,15 +9,24 @@ function ElementDrawCardPanelNew:New(gameObject)
|
||||||
return b
|
return b
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local Pos = {
|
||||||
|
[1] = {ori = Vector3.New(0,277,0),tar = Vector3.New(-0,-174.83,0),},
|
||||||
|
[2] = {ori = Vector3.New(0,-186.4,0),tar = Vector3.New(-0,-186.4,0),},
|
||||||
|
[3] = {ori = Vector3.New(0,-256.2,0),tar = Vector3.New(-0,-256.2,0),},
|
||||||
|
[4] = {ori = Vector3.New(0,371.8,0),tar = Vector3.New(-0,-205,0),},
|
||||||
|
}
|
||||||
|
|
||||||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||||
function ElementDrawCardPanelNew:InitComponent()
|
function ElementDrawCardPanelNew:InitComponent()
|
||||||
self.spLoader = SpriteLoader.New()
|
self.spLoader = SpriteLoader.New()
|
||||||
|
|
||||||
self.getCardPanel = Util.GetGameObject(self.transform, "getCardPanel")
|
self.getCardPanel = Util.GetGameObject(self.transform, "getCardPanel")
|
||||||
self.getCardPanel.gameObject:SetActive(false)
|
self.getCardPanel.gameObject:SetActive(false)
|
||||||
|
self.root = Util.GetGameObject(self.getCardPanel, "root")
|
||||||
|
self.content2 = Util.GetGameObject(self.getCardPanel,"content2")
|
||||||
self.buyOneBtn = Util.GetGameObject(self.getCardPanel,"content2/btn1")
|
self.buyOneBtn = Util.GetGameObject(self.getCardPanel,"content2/btn1")
|
||||||
|
self.content1 = Util.GetGameObject(self.getCardPanel,"content1")
|
||||||
self.titleImageText = Util.GetGameObject(self.getCardPanel,"content1/titleImage/Text"):GetComponent("Text")
|
self.titleImageText = Util.GetGameObject(self.getCardPanel,"content1/titleImage/Text"):GetComponent("Text")
|
||||||
self.Image1 = Util.GetGameObject(self.getCardPanel,"content1/Image/Image1"):GetComponent("Image")
|
|
||||||
self.Image2Text = Util.GetGameObject(self.getCardPanel,"content1/Image/Image2/Text"):GetComponent("Text")
|
self.Image2Text = Util.GetGameObject(self.getCardPanel,"content1/Image/Image2/Text"):GetComponent("Text")
|
||||||
self.Image3 = Util.GetGameObject(self.getCardPanel,"content1/Image/Image3"):GetComponent("Image")
|
self.Image3 = Util.GetGameObject(self.getCardPanel,"content1/Image/Image3"):GetComponent("Image")
|
||||||
self.detailText1=Util.GetGameObject(self.getCardPanel,"content1/Image2/detailText1"):GetComponent("Text")
|
self.detailText1=Util.GetGameObject(self.getCardPanel,"content1/Image2/detailText1"):GetComponent("Text")
|
||||||
|
@ -39,6 +49,7 @@ function ElementDrawCardPanelNew:InitComponent()
|
||||||
self.helpBtn = Util.GetGameObject(self.transform, "enterCardPanel/helpBtn")
|
self.helpBtn = Util.GetGameObject(self.transform, "enterCardPanel/helpBtn")
|
||||||
self.exchangeBtn = Util.GetGameObject(self.transform, "enterCardPanel/exchangeBtn")
|
self.exchangeBtn = Util.GetGameObject(self.transform, "enterCardPanel/exchangeBtn")
|
||||||
screenAdapte(self.bgImage)
|
screenAdapte(self.bgImage)
|
||||||
|
self.liveNode = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--绑定事件(用于子类重写)
|
--绑定事件(用于子类重写)
|
||||||
|
@ -49,7 +60,6 @@ function ElementDrawCardPanelNew:BindEvent()
|
||||||
local singleConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.LotterySetting,"LotteryType",TableRecruitType.Siyuanzhen,"PropertyType",self.index,"PerCount",1)
|
local singleConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.LotterySetting,"LotteryType",TableRecruitType.Siyuanzhen,"PropertyType",self.index,"PerCount",1)
|
||||||
local costnum = singleConfig.CostItem[1][2]
|
local costnum = singleConfig.CostItem[1][2]
|
||||||
local costId = singleConfig.CostItem[1][1]
|
local costId = singleConfig.CostItem[1][1]
|
||||||
LogGreen("costnum:"..costnum.." costId:"..costId)
|
|
||||||
if BagManager.GetItemCountById(costId) < costnum then
|
if BagManager.GetItemCountById(costId) < costnum then
|
||||||
PopupTipPanel.ShowTip(GetLanguageStrById(itemConfig[costId].Name)..Language[10486])
|
PopupTipPanel.ShowTip(GetLanguageStrById(itemConfig[costId].Name)..Language[10486])
|
||||||
return
|
return
|
||||||
|
@ -61,6 +71,10 @@ function ElementDrawCardPanelNew:BindEvent()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Util.AddClick(self.btnBack, function ()
|
Util.AddClick(self.btnBack, function ()
|
||||||
|
if self.liveNode then
|
||||||
|
poolManager:UnLoadLive(self.liveNode.name, self.liveNode)
|
||||||
|
self.liveNode = nil
|
||||||
|
end
|
||||||
self.getCardPanel:SetActive(false)
|
self.getCardPanel:SetActive(false)
|
||||||
self.parent.AddTrigger()
|
self.parent.AddTrigger()
|
||||||
self.qianghua:SetActive(false)
|
self.qianghua:SetActive(false)
|
||||||
|
@ -69,6 +83,7 @@ function ElementDrawCardPanelNew:BindEvent()
|
||||||
RecruitManager.recruitSubIndex = 0
|
RecruitManager.recruitSubIndex = 0
|
||||||
self.parent.tabbox.gameObject:SetActive(true)
|
self.parent.tabbox.gameObject:SetActive(true)
|
||||||
self.parent.btnBack.gameObject:SetActive(true)
|
self.parent.btnBack.gameObject:SetActive(true)
|
||||||
|
isSubPlayAnim = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Util.AddClick(self.previewBtn, function()
|
Util.AddClick(self.previewBtn, function()
|
||||||
|
@ -102,14 +117,64 @@ function ElementDrawCardPanelNew:BtnAction(index)
|
||||||
|
|
||||||
self.parent.btnBack.gameObject:SetActive(false)
|
self.parent.btnBack.gameObject:SetActive(false)
|
||||||
self.parent.tabbox.gameObject:SetActive(false)
|
self.parent.tabbox.gameObject:SetActive(false)
|
||||||
|
if self.liveNode then
|
||||||
|
poolManager:UnLoadLive(self.liveNode.name, self.liveNode)
|
||||||
|
self.liveNode = nil
|
||||||
|
end
|
||||||
|
--Vector3.one *heroConfig.Scale
|
||||||
|
self.root.gameObject:SetActive(false)
|
||||||
|
local heroConfig
|
||||||
|
local SkeletonGraphic
|
||||||
|
if self.config.ShopData[2][index] and self.config.ShopData[2][index] > 0 then
|
||||||
|
heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig,self.config.ShopData[2][index])
|
||||||
|
local name = GetResourcePath(heroConfig.Live)
|
||||||
|
self.liveNode = poolManager:LoadLive(name, self.root.transform,Vector3.one *heroConfig.Scale, Vector3.New(heroConfig.Position[1], heroConfig.Position[2], 0))
|
||||||
|
self.liveNode.name = name
|
||||||
|
SkeletonGraphic = self.liveNode:GetComponent("SkeletonGraphic")
|
||||||
|
local idle = function() SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) end
|
||||||
|
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle
|
||||||
|
poolManager:SetLiveClearCall(name, self.liveNode, function ()
|
||||||
|
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
self.getCardPanel.gameObject:SetActive(true)
|
self.getCardPanel.gameObject:SetActive(true)
|
||||||
|
if isSubPlayAnim then
|
||||||
|
self.content1.gameObject:SetActive(false)
|
||||||
|
self.content2.gameObject:SetActive(false)
|
||||||
|
LogGreen("开始播放人物动画")
|
||||||
|
self.liveNode.gameObject.transform:DOScale(Vector3.zero,0)
|
||||||
|
self.root.gameObject:SetActive(true)
|
||||||
|
self.liveNode.gameObject.transform:DOScale(Vector3.one *heroConfig.Scale, 0.3):SetEase(Ease.Linear):OnStart(function()
|
||||||
|
self.root.gameObject.transform:DOLocalMove(Pos[index].ori,0)
|
||||||
|
self.root.gameObject.transform:DOLocalMove(Pos[index].tar, 0.3,false):SetEase(Ease.Linear):OnStart(function() end):OnUpdate(function() --TODO:测试速度
|
||||||
|
end):OnComplete(function ()
|
||||||
|
end)
|
||||||
|
-- SkeletonGraphic:DOColor(Color.New(1,1,1,0),0)
|
||||||
|
-- SkeletonGraphic:DOColor(Color.New(1,1,1,1),0.5):SetEase(Ease.Linear):OnStart(function() end):OnUpdate(function() --TODO:测试速度
|
||||||
|
-- end):OnComplete(function ()
|
||||||
|
-- end)
|
||||||
|
end):OnUpdate(function() --TODO:测试速度
|
||||||
|
end):OnComplete(function ()
|
||||||
|
|
||||||
|
end)
|
||||||
|
Timer.New(function()
|
||||||
|
self.content1.gameObject:SetActive(true)
|
||||||
|
self.content2.gameObject:SetActive(true)
|
||||||
|
PlayUIAnim(self.getCardPanel)
|
||||||
|
end,0.2):Start()
|
||||||
|
|
||||||
|
isSubPlayAnim = false
|
||||||
|
else
|
||||||
|
self.root.gameObject:SetActive(true)
|
||||||
|
end
|
||||||
|
|
||||||
self.parent.RemoveTrigger()
|
self.parent.RemoveTrigger()
|
||||||
self.qianghua:SetActive(true)
|
self.qianghua:SetActive(true)
|
||||||
self.UI_effect_RecruitPanel_particle:SetActive(false)
|
self.UI_effect_RecruitPanel_particle:SetActive(false)
|
||||||
self.Image2Text.text = string.format("%s神将碎片",PropertyType[index])
|
self.Image2Text.text = string.format("%s神将碎片",PropertyType[index])
|
||||||
SetTextVerTial(self.Image2Text,Vector3.New(134.88,-5.9,0),"MiddleLeft")
|
SetTextVerTial(self.Image2Text,Vector3.New(134.88,-5.9,0),"MiddleLeft")
|
||||||
self.Image3.sprite = self.spLoader:LoadSprite(PropertyTypeImageBySiYuan[index].image3)
|
self.Image3.sprite = self.spLoader:LoadSprite(PropertyTypeImageBySiYuan[index].image3)
|
||||||
self.Image1.sprite = self.spLoader:LoadSprite(PropertyTypeImageBySiYuan[index].Image1)
|
|
||||||
self.titleImageText.text = string.format("阵营召唤·%s",PropertyTypeImageBySiYuan[index].property)
|
self.titleImageText.text = string.format("阵营召唤·%s",PropertyTypeImageBySiYuan[index].property)
|
||||||
self.detailText1.text = string.format("必得<color=#EDB54B>%s</color>神将碎片",PropertyType[index])
|
self.detailText1.text = string.format("必得<color=#EDB54B>%s</color>神将碎片",PropertyType[index])
|
||||||
end
|
end
|
||||||
|
@ -144,6 +209,7 @@ function ElementDrawCardPanelNew:OnOpen(_Config,_index, parent)
|
||||||
self.config = _Config
|
self.config = _Config
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
isPlayAnim = true
|
isPlayAnim = true
|
||||||
|
isSubPlayAnim = true
|
||||||
end
|
end
|
||||||
|
|
||||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||||
|
@ -182,7 +248,12 @@ end
|
||||||
--界面关闭时调用(用于子类重写)
|
--界面关闭时调用(用于子类重写)
|
||||||
function ElementDrawCardPanelNew:OnClose()
|
function ElementDrawCardPanelNew:OnClose()
|
||||||
isPlayAnim = true
|
isPlayAnim = true
|
||||||
|
isSubPlayAnim = true
|
||||||
self.gameObject:SetActive(false)
|
self.gameObject:SetActive(false)
|
||||||
|
if self.liveNode then
|
||||||
|
poolManager:UnLoadLive(self.liveNode.name, self.liveNode)
|
||||||
|
self.liveNode = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--界面销毁时调用(用于子类重写)
|
--界面销毁时调用(用于子类重写)
|
||||||
|
|
|
@ -489,6 +489,9 @@ end
|
||||||
|
|
||||||
--界面关闭时调用(用于子类重写)
|
--界面关闭时调用(用于子类重写)
|
||||||
function RecruitMainPanel:OnClose()
|
function RecruitMainPanel:OnClose()
|
||||||
|
for k,v in pairs(subViewList) do
|
||||||
|
v.sub:OnClose()
|
||||||
|
end
|
||||||
--清除红点
|
--清除红点
|
||||||
this.select.transform:SetParent(this.tabbox.transform)
|
this.select.transform:SetParent(this.tabbox.transform)
|
||||||
if self.thread then
|
if self.thread then
|
||||||
|
|
Loading…
Reference in New Issue