2021-04-21 13:12:04 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
ExpeditionSelectHalidomPanel = Inherit(BasePanel)
|
|
|
|
|
local fun
|
|
|
|
|
local curSelectHalidom
|
|
|
|
|
local _HalidomQualityConfig = {
|
2021-01-26 17:08:39 +08:00
|
|
|
|
[3] = {bg = "l_lieyaozhilu_chuanshuo_zh", selectImg = "l_lieyaozhilu_chuanshuo1"},
|
|
|
|
|
[2] = {bg = "l_lieyaozhilu_shishi_zh", selectImg = "l_lieyaozhilu_shishi1"},
|
|
|
|
|
[1] = {bg = "l_lieyaozhilu_xiyou_zh", selectImg = "l_lieyaozhilu_xiyou1"},
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
|
2021-01-26 17:08:39 +08:00
|
|
|
|
[7] = {bg = "l_lieyaozhilu_chuanshuo_zh", selectImg = "l_lieyaozhilu_chuanshuo1"},
|
|
|
|
|
[6] = {bg = "l_lieyaozhilu_shishi_zh", selectImg = "l_lieyaozhilu_shishi1"},
|
|
|
|
|
[5] = {bg = "l_lieyaozhilu_xiyou_zh", selectImg = "l_lieyaozhilu_xiyou1"},
|
2020-05-09 13:31:21 +08:00
|
|
|
|
}
|
|
|
|
|
local isOpenPanel = false
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local curSelectNodeData = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function ExpeditionSelectHalidomPanel:InitComponent()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
self.spLoader = SpriteLoader.New()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
self.BtnBack = Util.GetGameObject(self.transform, "maskBtn")
|
|
|
|
|
self.BtnSure = Util.GetGameObject(self.transform, "btnSure")
|
|
|
|
|
self.cardPre = Util.GetGameObject(self.gameObject, "cardPre")
|
|
|
|
|
self.grid = Util.GetGameObject(self.gameObject, "RewardRect")
|
|
|
|
|
self.noOneImage = Util.GetGameObject(self.gameObject, "noOneImage")
|
|
|
|
|
self.selectImage = Util.GetGameObject(self.gameObject, "selectImage")
|
|
|
|
|
|
|
|
|
|
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.grid.transform,
|
|
|
|
|
self.cardPre, nil, Vector2.New(902.6, 726.3), 1, 1, Vector2.New(19.32,0))
|
|
|
|
|
self.ScrollView.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, 0)
|
|
|
|
|
self.ScrollView.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5)
|
|
|
|
|
self.ScrollView.gameObject:GetComponent("RectTransform").anchorMax = Vector2.New(0.5, 0.5)
|
|
|
|
|
self.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
self.ScrollView.moveTween.Strength = 1
|
|
|
|
|
self.ScrollView.elastic = false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function ExpeditionSelectHalidomPanel:BindEvent()
|
|
|
|
|
|
|
|
|
|
Util.AddClick(self.BtnBack, function()
|
|
|
|
|
self:ClosePanel()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshMainPanel)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(self.BtnSure, function()
|
|
|
|
|
if curSelectHalidom then
|
|
|
|
|
--Log(" ExpeditionManager.GetCurNodeInfo().sortId,curSelectHalidom "..ExpeditionManager.GetCurNodeInfo().sortId.." "..curSelectHalidom)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
NetManager.TakeHolyEquipRequest(curSelectNodeData.sortId,curSelectHalidom, function(msg)
|
2021-07-01 21:07:53 +08:00
|
|
|
|
-- Log("msg.equipId "..msg.equipId)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
--UIManager.OpenPanel(UIName.ExpeditionMainPanel)
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Expedition.RefreshPlayAniMainPanel)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
else
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10554])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function ExpeditionSelectHalidomPanel:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function ExpeditionSelectHalidomPanel:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function ExpeditionSelectHalidomPanel:OnOpen(_isOpenPanel,_fun)
|
|
|
|
|
|
|
|
|
|
isOpenPanel = _isOpenPanel
|
|
|
|
|
fun = _fun
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
|
|
|
function ExpeditionSelectHalidomPanel:OnShow()
|
|
|
|
|
curSelectHalidom = nil
|
|
|
|
|
self:OnshowPanelData()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ExpeditionSelectHalidomPanel:OnshowPanelData()
|
|
|
|
|
local allHoly = {}
|
|
|
|
|
self.selectImage:SetActive(false)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
curSelectNodeData = ExpeditionManager.curAttackNodeInfo
|
|
|
|
|
allHoly = curSelectNodeData.holyEquipID
|
2020-05-09 13:31:21 +08:00
|
|
|
|
self.noOneImage:SetActive(#allHoly <= 0)
|
|
|
|
|
self.ScrollView:SetData(allHoly, function(index, go)
|
|
|
|
|
self:OnShowSingleHolyData(go, allHoly[index])
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ExpeditionSelectHalidomPanel:OnShowSingleHolyData(go,singleHoly)
|
|
|
|
|
local configData
|
|
|
|
|
configData = ConfigManager.GetConfigData(ConfigName.ExpeditionHolyConfig,singleHoly)
|
|
|
|
|
--Log(configData.Icon)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(go, "bg"):GetComponent("Image").sprite = self.spLoader:LoadSprite(_HalidomQualityConfig[configData.type].bg)
|
|
|
|
|
Util.GetGameObject(go, "quaImage"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetHeroQuantityImageByquality(configData.type + 3))
|
|
|
|
|
Util.GetGameObject(go, "iconImage"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetResourcePath(configData.Icon))-- 报错,资源表里找不到:self.spLoader:LoadSprite(GetResourcePath(configData.Icon))
|
2021-01-26 17:08:39 +08:00
|
|
|
|
Util.GetGameObject(go, "nameText"):GetComponent("Text").text = GetLanguageStrById(configData.Name)
|
2021-03-04 14:58:41 +08:00
|
|
|
|
Util.GetGameObject(go, "infoRect/infoText"):GetComponent("Text").text = GetLanguageStrById(configData.Describe)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local posImage = Util.GetGameObject(go, "posImage")
|
|
|
|
|
local proImage = Util.GetGameObject(go, "proImage")
|
2020-06-18 20:39:29 +08:00
|
|
|
|
local heroImage = Util.GetGameObject(go, "Hero")
|
2020-11-05 17:04:38 +08:00
|
|
|
|
local newImage = Util.GetGameObject(go, "newImage")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
posImage:SetActive(false)
|
|
|
|
|
proImage:SetActive(false)
|
2020-06-18 20:39:29 +08:00
|
|
|
|
heroImage:SetActive(false)
|
2020-11-05 17:04:38 +08:00
|
|
|
|
newImage:SetActive(not ExpeditionManager.allSHoly[configData.Id])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if configData.SpecialIcon then
|
2020-06-28 17:48:49 +08:00
|
|
|
|
if configData.SpecialIcon[1] == 1 then--属性
|
2020-06-19 20:19:35 +08:00
|
|
|
|
proImage:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
proImage:GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(configData.SpecialIcon[2]))
|
2020-06-28 17:48:49 +08:00
|
|
|
|
elseif configData.SpecialIcon[1] == 2 then--职业
|
|
|
|
|
posImage:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(go, "posImage/posImage"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(configData.SpecialIcon[2]))
|
2020-06-18 20:39:29 +08:00
|
|
|
|
elseif configData.SpecialIcon[1] == 3 then--英雄
|
|
|
|
|
heroImage:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(heroImage, "Icon"):GetComponent("Image").sprite=self.spLoader:LoadSprite(GetResourcePath(ConfigManager.GetConfigData(HeroManager,configData.SpecialIcon[2]).Icon))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local click = Util.GetGameObject(go, "click")
|
|
|
|
|
click:GetComponent("Button").enabled = true
|
|
|
|
|
Util.AddOnceClick(click, function()
|
|
|
|
|
self:SelectImageSetParent(Util.GetGameObject(go, "selectRoot"), configData)
|
|
|
|
|
curSelectHalidom = singleHoly
|
|
|
|
|
end)
|
2021-03-04 14:58:41 +08:00
|
|
|
|
Util.AddOnceClick(Util.GetGameObject(go, "infoRect/infoText"), function()
|
|
|
|
|
self:SelectImageSetParent(Util.GetGameObject(go, "selectRoot"), configData)
|
|
|
|
|
curSelectHalidom = singleHoly
|
|
|
|
|
end)
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--选择图片设置父级
|
|
|
|
|
function ExpeditionSelectHalidomPanel:SelectImageSetParent(_objPoint, configData)
|
|
|
|
|
self.selectImage:SetActive(true)
|
|
|
|
|
self.selectImage.transform:SetParent(_objPoint.transform)
|
|
|
|
|
self.selectImage.transform.localScale = Vector3.one
|
|
|
|
|
self.selectImage.transform.localPosition = Vector3.zero
|
2021-04-21 13:12:04 +08:00
|
|
|
|
self.selectImage:GetComponent("Image").sprite = self.spLoader:LoadSprite(_HalidomQualityConfig[configData.type].selectImg)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function ExpeditionSelectHalidomPanel:OnClose()
|
|
|
|
|
|
|
|
|
|
if fun then
|
|
|
|
|
fun()
|
|
|
|
|
fun = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function ExpeditionSelectHalidomPanel:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
self.spLoader:Destroy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
end
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return ExpeditionSelectHalidomPanel
|