【称号坐骑皮肤-----------】开始
parent
4b8f5cd535
commit
d9dcba2574
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@ local this = SettingInfo
|
|||
|
||||
local languageGroup = {Language[11854],Language[11855]}
|
||||
|
||||
function SettingInfo:ctor(rootPanel, gameObject)
|
||||
function SettingInfo:ctor( gameObject,rootPanel)
|
||||
self.gameObject = gameObject
|
||||
self:InitComponent(gameObject, rootPanel)
|
||||
end
|
||||
|
|
|
@ -2,32 +2,45 @@
|
|||
local SettingPanel = Inherit(BasePanel)
|
||||
local this = SettingPanel
|
||||
local funIndex = 1
|
||||
local tabBtns = {}
|
||||
--Tab
|
||||
local TabBox = require("Modules/Common/TabBox")
|
||||
local _TabData={
|
||||
[1] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "信息" },
|
||||
[2] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "称号" },
|
||||
[3] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "时装" },
|
||||
[4] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "皮肤" },
|
||||
}
|
||||
local _TabFontColor = { default = Color.New(130 / 255, 128 / 255, 120 / 255, 1),
|
||||
select = Color.New(243 / 255, 235 / 255, 202 / 255, 1)}
|
||||
--子模块脚本
|
||||
this.contents = {
|
||||
--信息
|
||||
[1] = {view = require("Modules/Setting/SettingInfo"), panelName = "settingInfo"},
|
||||
--称号
|
||||
[2] = {view = require("Modules/Setting/SettingPlayerTitle"), panelName = "settingPlayerTitle"},
|
||||
--时装
|
||||
[3] = {view = require("Modules/Setting/SettingPlayerRide"), panelName = "settingPlayerRide"},
|
||||
--坐骑
|
||||
[4] = {view = require("Modules/Setting/SettingPlayerSkin"), panelName = "settingPlayerSkin"},
|
||||
}
|
||||
--子模块预设
|
||||
this.prefabs={}
|
||||
|
||||
|
||||
local SettingInfo = require("Modules/Setting/SettingInfo")
|
||||
local SettingPlayerTitle = require("Modules/Setting/SettingPlayerTitle")
|
||||
local SettingPlayerRide = require("Modules/Setting/SettingPlayerRide")
|
||||
local SettingPlayerSkin = require("Modules/Setting/SettingPlayerSkin")
|
||||
--初始化组件(用于子类重写)
|
||||
function SettingPanel:InitComponent()
|
||||
for i = 1, 4 do
|
||||
tabBtns[i] = Util.GetGameObject(this.transform, "btnList/btn"..i)
|
||||
end
|
||||
this.selectBtn = Util.GetGameObject(this.transform, "selectBtn")
|
||||
this.btnBack = Util.GetGameObject(this.transform, "btnBack")
|
||||
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft })
|
||||
|
||||
this.settingInfo = SettingInfo.new(self, Util.GetGameObject(self.transform, "layout/settingInfo"))
|
||||
this.settingPlayerBg = Util.GetGameObject(self.transform, "layout/settingPlayerBgImage")
|
||||
this.settingPlayerTitle = SettingPlayerTitle.new(self, Util.GetGameObject(self.transform, "layout/settingPlayerTitle"))
|
||||
this.settingPlayerRide = SettingPlayerRide.new(self, Util.GetGameObject(self.transform, "layout/settingPlayerRide"))
|
||||
this.settingPlayerSkin = SettingPlayerSkin.new(self, Util.GetGameObject(self.transform, "layout/settingPlayerSkin"))
|
||||
|
||||
this.settingInfoGo = Util.GetGameObject(this.gameObject, "layout/settingInfo")
|
||||
this.settingPlayerTitleGo = Util.GetGameObject(this.gameObject, "layout/settingPlayerTitle")
|
||||
this.settingPlayerRideGo = Util.GetGameObject(this.gameObject, "layout/settingPlayerRide")
|
||||
this.settingPlayerSkinGo = Util.GetGameObject(this.gameObject, "layout/settingPlayerSkin")
|
||||
this.settingPlayerBg:SetActive(true)
|
||||
--预设赋值
|
||||
this.layout = Util.GetGameObject(self.transform, "layout")
|
||||
for i=1,#this.contents do
|
||||
this.prefabs[i]=Util.GetGameObject(this.layout,this.contents[i].panelName)
|
||||
end
|
||||
for i = 1, #this.contents do
|
||||
this.contents[i].view:InitComponent(Util.GetGameObject(this.transform, "layout/"..this.contents[i].panelName),self)
|
||||
end
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
|
@ -36,38 +49,23 @@ function SettingPanel:BindEvent()
|
|||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
||||
self:ClosePanel()
|
||||
end)
|
||||
for i = 1, 4 do
|
||||
if i == 1 then
|
||||
Util.AddClick(tabBtns[i], function()
|
||||
this.OnShowPanelData(i)
|
||||
end)
|
||||
else
|
||||
tabBtns[i]:SetActive(false)
|
||||
-- Util.AddClick(tabBtns[i], function()
|
||||
-- PopupTipPanel.ShowTip("敬请期待!")
|
||||
-- end)
|
||||
end
|
||||
for i = 1, #this.contents do
|
||||
this.contents[i].view:BindEvent()
|
||||
end
|
||||
this.settingInfo.BindEvent()
|
||||
this.settingPlayerTitle.BindEvent()
|
||||
this.settingPlayerRide.BindEvent()
|
||||
this.settingPlayerSkin.BindEvent()
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function SettingPanel:AddListener()
|
||||
this.settingInfo.AddListener()
|
||||
this.settingPlayerTitle.AddListener()
|
||||
this.settingPlayerRide.AddListener()
|
||||
this.settingPlayerSkin.AddListener()
|
||||
for i = 1, #this.contents do
|
||||
this.contents[i].view:AddListener()
|
||||
end
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function SettingPanel:RemoveListener()
|
||||
this.settingInfo.RemoveListener()
|
||||
this.settingPlayerTitle.RemoveListener()
|
||||
this.settingPlayerRide.RemoveListener()
|
||||
this.settingPlayerSkin.RemoveListener()
|
||||
for i = 1, #this.contents do
|
||||
this.contents[i].view:RemoveListener()
|
||||
end
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
|
@ -77,56 +75,57 @@ end
|
|||
|
||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||
function SettingPanel:OnShow()
|
||||
this.OnShowPanelData(funIndex)
|
||||
this.tabBox = Util.GetGameObject(this.transform, "TabBox")
|
||||
this.TabCtrl = TabBox.New()
|
||||
this.TabCtrl:SetTabAdapter(this.TabAdapter)
|
||||
this.TabCtrl:SetChangeTabCallBack(this.SwitchView)
|
||||
this.TabCtrl:Init(this.tabBox, _TabData,funIndex)
|
||||
end
|
||||
function this.OnShowPanelData(_funIndex)
|
||||
funIndex = _funIndex
|
||||
this.settingInfoGo:SetActive(false)
|
||||
this.settingPlayerTitleGo:SetActive(false)
|
||||
this.settingPlayerRideGo:SetActive(false)
|
||||
this.settingPlayerSkinGo:SetActive(false)
|
||||
this.settingPlayerBg:SetActive(true)
|
||||
this.SetSelectBtn(funIndex)
|
||||
if funIndex == 1 then--信息
|
||||
this.settingPlayerBg:SetActive(false)
|
||||
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
|
||||
this.settingInfoGo:SetActive(true)
|
||||
this.settingInfo.OnShow()
|
||||
elseif funIndex == 2 then--称号
|
||||
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
|
||||
this.settingPlayerTitleGo:SetActive(true)
|
||||
this.settingPlayerTitle.OnShow()
|
||||
elseif funIndex == 3 then--坐骑
|
||||
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
|
||||
this.settingPlayerRideGo:SetActive(true)
|
||||
this.settingPlayerRide.OnShow()
|
||||
elseif funIndex == 4 then--皮肤
|
||||
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
|
||||
this.settingPlayerSkinGo:SetActive(true)
|
||||
this.settingPlayerSkin.OnShow()
|
||||
|
||||
-- tab节点显示自定义
|
||||
function this.TabAdapter(tab, index, status)
|
||||
local tabLab = Util.GetGameObject(tab, "Text")
|
||||
Util.GetGameObject(tab,"Image"):GetComponent("Image").sprite = Util.LoadSprite(_TabData[index][status])
|
||||
tabLab:GetComponent("Text").text = GetCurLanguage() ~= 2 and _TabData[index].name or "<size=30>".._TabData[index].name.."</size>"
|
||||
tabLab:GetComponent("Text").color = _TabFontColor[status]
|
||||
end
|
||||
--切换视图
|
||||
function this.SwitchView(index,isNotTop,isNotAni)
|
||||
--先执行上一面板关闭逻辑
|
||||
local oldSelect
|
||||
oldSelect, funIndex = funIndex, index
|
||||
|
||||
for i = 1, #this.contents do
|
||||
if oldSelect~=0 then this.contents[oldSelect].view:OnClose() break end
|
||||
end
|
||||
end
|
||||
function this.SetSelectBtn(index)
|
||||
this.selectBtn.transform:SetParent(tabBtns[index].transform)
|
||||
this.selectBtn.transform.localScale = Vector3.one
|
||||
this.selectBtn.transform.localPosition = Vector3.zero;
|
||||
Util.GetGameObject(this.selectBtn.transform, "Text"):GetComponent("Text").text = Util.GetGameObject(tabBtns[index].transform, "Text"):GetComponent("Text").text
|
||||
--切换预设显隐
|
||||
for i = 1, #this.prefabs do
|
||||
this.prefabs[i].gameObject:SetActive(i == index)--切换子模块预设显隐
|
||||
end
|
||||
--区分显示
|
||||
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
|
||||
this.settingPlayerBg.gameObject:SetActive(index == 2 or index == 3 or index == 4)
|
||||
if index==1 then
|
||||
elseif index==2 then
|
||||
elseif index==3 then
|
||||
elseif index==4 then
|
||||
end
|
||||
--执行子模块初始化
|
||||
this.contents[index].view:OnShow(this.sortingOrder,this.itemListRoot,isNotTop,isNotAni)
|
||||
end
|
||||
--界面关闭时调用(用于子类重写)
|
||||
function SettingPanel:OnClose()
|
||||
this.settingInfo.OnClose()
|
||||
this.settingPlayerTitle.OnClose()
|
||||
this.settingPlayerRide.OnClose()
|
||||
this.settingPlayerSkin.OnClose()
|
||||
for i = 1, #this.contents do
|
||||
this.contents[i].view:OnClose()
|
||||
end
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
function SettingPanel:OnDestroy()
|
||||
SubUIManager.Close(this.UpView)
|
||||
this.settingInfo.OnDestroy()
|
||||
this.settingPlayerTitle.OnDestroy()
|
||||
this.settingPlayerRide.OnDestroy()
|
||||
this.settingPlayerSkin.OnDestroy()
|
||||
for i = 1, #this.contents do
|
||||
this.contents[i].view:OnDestroy()
|
||||
end
|
||||
end
|
||||
|
||||
return SettingPanel
|
|
@ -1,23 +1,7 @@
|
|||
local SettingPlayerRide = quick_class("SettingPlayerRide")
|
||||
--坐骑
|
||||
local SettingPlayerRide = quick_class("SettingPlayerRide")
|
||||
local this = SettingPlayerRide
|
||||
local playerRideConFig --= ConfigManager.GetAllConfigsDataByKey(ConfigName.ItemConfig, "ItemType", ItemType.Ride)
|
||||
local proList = {}
|
||||
local lvMaterialsList = {}
|
||||
local rideList = {}
|
||||
local curRideId = 0
|
||||
local curRideLv = 0
|
||||
local curRideItemConFig = {}--ItemConfig
|
||||
local curRideConFig = {}--PlayerAppearance
|
||||
local parentGo = nil
|
||||
local rideLive
|
||||
local rideLiveStr
|
||||
local playerLiveView
|
||||
local posAddIndex = 0
|
||||
local posJianIndex = 0
|
||||
local curIndex = 0
|
||||
local curDataIndex = 0
|
||||
local isLicckBtn = false
|
||||
local isMaterial
|
||||
|
||||
function SettingPlayerRide:ctor(mainPanel, gameObject)
|
||||
self.mainPanel = mainPanel
|
||||
self.gameObject = gameObject
|
||||
|
@ -26,90 +10,11 @@ function SettingPlayerRide:ctor(mainPanel, gameObject)
|
|||
end
|
||||
--初始化组件(用于子类重写)
|
||||
function SettingPlayerRide:InitComponent(gameObject)
|
||||
|
||||
parentGo = gameObject
|
||||
this.live2dRootParent = Util.GetGameObject(gameObject, "live2dRootParent")
|
||||
this.live2dRootParent2 = Util.GetGameObject(gameObject, "live2dRootParent2")
|
||||
this.name = Util.GetGameObject(gameObject, "name/Text"):GetComponent("Text")
|
||||
--this.lv = Util.GetGameObject(gameObject, "rideProInfo/Lv"):GetComponent("Text")
|
||||
this.getInfo = Util.GetGameObject(gameObject, "rideProInfo/getInfo"):GetComponent("Text")
|
||||
this.InfoEndInfo = Util.GetGameObject(gameObject, "rideProInfo/InfoEndInfo/Text"):GetComponent("Text")
|
||||
this.proListParent = Util.GetGameObject(gameObject, "rideProInfo/pro")
|
||||
proList = {}
|
||||
for i = 1, 3 do
|
||||
proList[i] = Util.GetGameObject(gameObject, "rideProInfo/pro/pro ("..i..")")
|
||||
end
|
||||
|
||||
this.rightBtn = Util.GetGameObject(gameObject, "rightBtn")
|
||||
this.leftBtn = Util.GetGameObject(gameObject, "leftBtn")
|
||||
this.upLv = Util.GetGameObject(gameObject, "rideProInfo/upLv")
|
||||
this.upLvBtn = Util.GetGameObject(gameObject, "rideProInfo/upLvBtn")
|
||||
this.lvUpGo = Util.GetGameObject(gameObject, "rideProInfo/lvUpGo")
|
||||
this.noUpLvText = Util.GetGameObject(gameObject, "rideProInfo/noUpLvText")
|
||||
this.lvMaterialsListParent = Util.GetGameObject(gameObject, "rideProInfo/upLv/itemGrid")
|
||||
for i = 1, 2 do
|
||||
lvMaterialsList[i] = Util.GetGameObject(gameObject, "rideProInfo/upLv/itemGrid/itemPre ("..i..")")
|
||||
end
|
||||
|
||||
this.setImage = Util.GetGameObject(gameObject, "setImage")
|
||||
this.grid = Util.GetGameObject(gameObject, "rect/grid")
|
||||
--rideList = {}
|
||||
--for i = 1, 5 do
|
||||
-- rideList[i] = Util.GetGameObject(gameObject, "rect/grid/itemPre ("..i..")")
|
||||
--end
|
||||
this.goToBtn = Util.GetGameObject(gameObject, "goToBtn")
|
||||
this.goToBtnText = Util.GetGameObject(gameObject, "goToBtn/Text"):GetComponent("Text")
|
||||
|
||||
this.itemPre = Util.GetGameObject(self.gameObject, "itemPre")
|
||||
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
function SettingPlayerRide:BindEvent()
|
||||
|
||||
Util.AddOnceClick(this.upLvBtn, function()
|
||||
this.UpLvFun()
|
||||
end)
|
||||
Util.AddOnceClick(this.rightBtn, function()
|
||||
if not isLicckBtn then
|
||||
isLicckBtn = true
|
||||
curIndex = curIndex - 1
|
||||
curDataIndex = curDataIndex + 1
|
||||
this.grid.transform:DOLocalMove(Vector3.New(curIndex*440,0,0), 0.3, false):OnComplete(function ()
|
||||
Log("移动完成")
|
||||
if curDataIndex > #playerRideConFig then
|
||||
curDataIndex = 1
|
||||
end
|
||||
this.OnShowCurRideProData(playerRideConFig[curDataIndex].Id)
|
||||
local curGo = this.grid.transform:GetChild(0).transform
|
||||
curGo.transform:SetAsLastSibling()
|
||||
posAddIndex = posAddIndex + 1
|
||||
posJianIndex = posJianIndex + 1
|
||||
curGo.transform.localPosition=Vector3.New(posAddIndex*440,0,0)
|
||||
isLicckBtn = false
|
||||
end):SetEase(Ease.Linear)
|
||||
end
|
||||
end)
|
||||
Util.AddOnceClick(this.leftBtn, function()
|
||||
if not isLicckBtn then
|
||||
isLicckBtn = true
|
||||
curIndex = curIndex + 1
|
||||
curDataIndex = curDataIndex - 1
|
||||
this.grid.transform:DOLocalMove(Vector3.New(curIndex*440,0,0), 0.3, false):OnComplete(function ()
|
||||
Log("移动完成")
|
||||
if curDataIndex < 1 then
|
||||
curDataIndex = #playerRideConFig
|
||||
end
|
||||
this.OnShowCurRideProData(playerRideConFig[curDataIndex].Id)
|
||||
posAddIndex = posAddIndex - 1
|
||||
posJianIndex = posJianIndex - 1
|
||||
local curGo = this.grid.transform:GetChild(#playerRideConFig - 1).transform
|
||||
curGo.transform:SetAsFirstSibling()
|
||||
curGo.transform.localPosition=Vector3.New(posJianIndex*440,0,0)
|
||||
isLicckBtn = false
|
||||
end):SetEase(Ease.Linear)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
|
@ -123,292 +28,20 @@ function SettingPlayerRide:RemoveListener()
|
|||
end
|
||||
--界面打开时调用(用于子类重写)
|
||||
function SettingPlayerRide:OnOpen()
|
||||
playerRideConFig = ConfigManager.GetAllConfigsDataByKey(ConfigName.ItemConfig, "ItemType", ItemType.Ride)
|
||||
end
|
||||
|
||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||
function SettingPlayerRide:OnShow()
|
||||
|
||||
Util.ClearChild(this.grid.transform)
|
||||
rideList = {}
|
||||
if #playerRideConFig < 5 then
|
||||
for i = 1, #playerRideConFig do
|
||||
table.insert(playerRideConFig,playerRideConFig[i])
|
||||
end
|
||||
end
|
||||
this.OnShowCurRideProData(PlayerManager.ride > 0 and PlayerManager.ride or playerRideConFig[1].Id)
|
||||
this.OnShowAllRideGrid()
|
||||
|
||||
posAddIndex = #playerRideConFig
|
||||
posJianIndex = 1
|
||||
|
||||
if playerLiveView == nil then
|
||||
playerLiveView = SubUIManager.Open(SubUIConfig.PlayerLiveView, this.live2dRootParent.transform)
|
||||
end
|
||||
playerLiveView:OnOpen()
|
||||
end
|
||||
--坐骑属性展示
|
||||
function this.OnShowCurRideProData(rideId)
|
||||
curRideId = rideId
|
||||
curRideLv = PlayerManager.rideLevel > 0 and PlayerManager.rideLevel or 1
|
||||
curRideItemConFig = ConfigManager.GetConfigData(ConfigName.ItemConfig,curRideId)
|
||||
curRideConFig = ConfigManager.GetConfigData(ConfigName.PlayerAppearance,curRideId)
|
||||
if curRideConFig == nil then return end
|
||||
--this.live2dRootParent = Util.GetGameObject(gameObject, "live2dRootParent")--:GetComponent("Text")
|
||||
this.name.text = GetLanguageStrById(curRideItemConFig.Name)
|
||||
--this.lv.text = curRideLv
|
||||
this.getInfo.text = GetLanguageStrById(curRideConFig.Description)
|
||||
local keys = GameDataBase.SheetBase.GetKeys(ConfigManager.GetConfig(ConfigName.PlayerMountLevelUp))
|
||||
this.InfoEndInfo.text = Language[11864]..PlayerManager.rideLevel.."/"..LengthOfTable(keys).."]"
|
||||
local curproInfoList = this.GetCurRideAllPro(curRideLv)
|
||||
local nextproInfoList = this.GetCurRideAllPro(curRideLv + 1)
|
||||
if rideLive then
|
||||
poolManager:UnLoadLive(rideLiveStr, rideLive, PoolManager.AssetType.GameObject)
|
||||
rideLive = nil
|
||||
end
|
||||
rideLiveStr = GetResourcePath(ConfigManager.GetConfigData(ConfigName.PlayerAppearance,curRideId).Live)
|
||||
rideLive = poolManager:LoadLive(rideLiveStr, this.live2dRootParent2.transform, Vector3.one, Vector3.zero)
|
||||
--属性展示
|
||||
for i = 1, math.max(#proList, #curproInfoList) do
|
||||
local go = proList[i]
|
||||
if not go then
|
||||
go=newObject(proList[1])
|
||||
go.transform:SetParent(this.proListParent.transform)
|
||||
go.transform.localScale = Vector3.one
|
||||
go.transform.localPosition=Vector3.zero;
|
||||
go.gameObject.name = "pro (".. i ..")"
|
||||
proList[i] = go
|
||||
end
|
||||
go.gameObject:SetActive(false)
|
||||
end
|
||||
for i = 1, #curproInfoList do
|
||||
if curproInfoList[i].vale ~= nextproInfoList[i].vale then
|
||||
proList[i]:SetActive(true)
|
||||
Util.GetGameObject(proList[i], "proName"):GetComponent("Text").text = curproInfoList[i].name
|
||||
Util.GetGameObject(proList[i], "proValue"):GetComponent("Text").text = curproInfoList[i].vale
|
||||
if nextproInfoList and #nextproInfoList > 0 then
|
||||
Util.GetGameObject(proList[i], "nextProValue"):GetComponent("Text").text = nextproInfoList[i].vale
|
||||
else
|
||||
Util.GetGameObject(proList[i], "nextProValue"):GetComponent("Text").text = ""
|
||||
end
|
||||
end
|
||||
end
|
||||
--材料展示
|
||||
isMaterial = true
|
||||
local curPlayerMountLevelUp = ConfigManager.GetConfigData(ConfigName.PlayerMountLevelUp,curRideLv)
|
||||
for i = 1, math.max(#lvMaterialsList, #curPlayerMountLevelUp.Consume) do
|
||||
local go = lvMaterialsList[i]
|
||||
if not go then
|
||||
go=newObject(lvMaterialsList[1])
|
||||
go.transform:SetParent(this.lvMaterialsListParent.transform)
|
||||
go.transform.localScale = Vector3.one
|
||||
go.transform.localPosition=Vector3.zero;
|
||||
go.gameObject.name = "itemPre (".. i ..")"
|
||||
lvMaterialsList[i] = go
|
||||
end
|
||||
go.gameObject:SetActive(false)
|
||||
end
|
||||
for i = 1, #curPlayerMountLevelUp.Consume do
|
||||
lvMaterialsList[i]:SetActive(true)
|
||||
local itemId = curPlayerMountLevelUp.Consume[i][1]
|
||||
local itemNeedVale = curPlayerMountLevelUp.Consume[i][2]
|
||||
local itemBagVale = BagManager.GetItemCountById(itemId)
|
||||
Util.GetGameObject(lvMaterialsList[i], "icon"):GetComponent("Image").sprite =
|
||||
Util.LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.ItemConfig,itemId).ResourceID))
|
||||
if itemBagVale >= itemNeedVale then
|
||||
Util.GetGameObject(lvMaterialsList[i], "Text"):GetComponent("Text").text = "<color=#FFFFFF>"..PrintWanNum(itemBagVale).."/"..itemNeedVale.."</color>"
|
||||
else
|
||||
isMaterial = false
|
||||
Util.GetGameObject(lvMaterialsList[i], "Text"):GetComponent("Text").text = "<color=#FF0000>"..PrintWanNum(itemBagVale).."/"..itemNeedVale.."</color>"
|
||||
end
|
||||
end
|
||||
--满级显隐
|
||||
this.noUpLvText:SetActive( #nextproInfoList <= 0)
|
||||
this.upLvBtn:SetActive( #nextproInfoList > 0)
|
||||
this.upLv:SetActive( #nextproInfoList > 0)
|
||||
this.GoToBtnFun()
|
||||
end
|
||||
--当前级属所有性获取
|
||||
function this.GetCurRideAllPro(lv)
|
||||
local proList = {}
|
||||
local curPlayerMountLevelUp = ConfigManager.GetConfigData(ConfigName.PlayerMountLevelUp,lv)
|
||||
if curPlayerMountLevelUp == nil then return {} end
|
||||
if curPlayerMountLevelUp.Property then
|
||||
for i = 1, #curPlayerMountLevelUp.Property do
|
||||
table.insert(proList,{name = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig,curPlayerMountLevelUp.Property[i][1]).Info),
|
||||
vale = curPlayerMountLevelUp.Property[i][2]})
|
||||
end
|
||||
end
|
||||
if curPlayerMountLevelUp.MapSpeed > 0 then
|
||||
table.insert(proList,{name = Language[11865],
|
||||
vale = curPlayerMountLevelUp.MapSpeed})
|
||||
end
|
||||
if curPlayerMountLevelUp.MapView > 0 then
|
||||
table.insert(proList,{name = Language[11866],
|
||||
vale = curPlayerMountLevelUp.MapView})
|
||||
end
|
||||
return proList
|
||||
end
|
||||
--所有坐骑展示
|
||||
function this.OnShowAllRideGrid()
|
||||
for i = 1, math.max(#rideList, #playerRideConFig) do
|
||||
local go = rideList[i]
|
||||
if not go then
|
||||
go=newObject(this.itemPre)
|
||||
go.transform:SetParent(this.grid.transform)
|
||||
go.transform.localScale = Vector3.one
|
||||
go.transform.localPosition=Vector3.zero;
|
||||
go.gameObject.name = "itemPre (".. i ..")"
|
||||
rideList[i] = go
|
||||
--440 = 362 + 80
|
||||
rideList[i].transform.localPosition=Vector3.New(i*440,0,0)
|
||||
end
|
||||
go.gameObject:SetActive(false)
|
||||
end
|
||||
this.RefreshAllRideData()
|
||||
curIndex = -3
|
||||
this.grid.transform.localPosition=Vector3.New(curIndex*440)
|
||||
this.FirstSetGridPos(curIndex,curDataIndex)
|
||||
end
|
||||
function this.UpLvFun()
|
||||
--材料不够
|
||||
if not isMaterial then
|
||||
PopupTipPanel.ShowTip(Language[11814])
|
||||
return
|
||||
end
|
||||
--未穿
|
||||
NetManager.RequestRideLvUp(function ()
|
||||
PopupTipPanel.ShowTip(Language[11867])
|
||||
PlayerManager.SetPlayerRideLv(PlayerManager.rideLevel + 1)
|
||||
this.OnShowCurRideProData(curRideId)
|
||||
this.RefreshAllRideData()
|
||||
FormationManager.UserPowerChanged()
|
||||
this.GoToBtnFun()
|
||||
end)
|
||||
end
|
||||
function this.GoToBtnFun()
|
||||
local btnState = 0
|
||||
if BagManager.GetItemCountById(curRideId) > 0 then--获得
|
||||
this.goToBtnText.text = Language[10202]
|
||||
btnState = 1
|
||||
if curRideId == PlayerManager.ride then--获得并使用
|
||||
this.goToBtnText.text = Language[11868]
|
||||
btnState = 2
|
||||
end
|
||||
else--未获得
|
||||
this.goToBtnText.text = Language[11869]
|
||||
end
|
||||
Util.AddOnceClick(this.goToBtn, function()
|
||||
if btnState == 0 then
|
||||
JumpManager.GoJump(ConfigManager.GetConfigData(ConfigName.ItemConfig,curRideId).Jump[1])
|
||||
elseif btnState == 1 then
|
||||
NetManager.RequestChangeModifyDecoration(3, curRideId, function ()
|
||||
PopupTipPanel.ShowTip(Language[11850])
|
||||
PlayerManager.SetPlayerRide(curRideId)
|
||||
this.RefreshAllRideData()
|
||||
FormationManager.UserPowerChanged()
|
||||
this.GoToBtnFun()
|
||||
if playerLiveView then
|
||||
playerLiveView:OnOpen()
|
||||
end
|
||||
end)
|
||||
elseif btnState == 2 then
|
||||
NetManager.RequestChangeModifyDecoration(3, 0, function ()
|
||||
PopupTipPanel.ShowTip(Language[11870])
|
||||
PlayerManager.SetPlayerRide(0)
|
||||
this.RefreshAllRideData()
|
||||
FormationManager.UserPowerChanged()
|
||||
this.GoToBtnFun()
|
||||
if playerLiveView then
|
||||
playerLiveView:OnOpen()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
function this.RefreshAllRideData()
|
||||
|
||||
for i = 1, #playerRideConFig do
|
||||
if curRideId == playerRideConFig[i].Id then
|
||||
curDataIndex = i
|
||||
end
|
||||
rideList[i]:SetActive(true)
|
||||
Util.GetGameObject(rideList[i], "iconMask/icon"):GetComponent("Image").sprite =
|
||||
Util.LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.PlayerAppearance,playerRideConFig[i].Id).Painting))
|
||||
Util.GetGameObject(rideList[i], "lv/Text"):GetComponent("Text").text = curRideLv
|
||||
--Util.SetGray(rideList[i], not (BagManager.GetItemCountById(playerRideConFig[i].Id) > 0))
|
||||
Util.GetGameObject(rideList[i], "noGetImage"):SetActive(BagManager.GetItemCountById(curRideId) <= 0)
|
||||
Util.GetGameObject(rideList[i], "GetImage"):SetActive(playerRideConFig[i].Id == PlayerManager.ride)
|
||||
Log("playerRideConFig[i].Id == PlayerManager.ride "..playerRideConFig[i].Id.." "..PlayerManager.ride)
|
||||
end
|
||||
end
|
||||
function this.FirstSetGridPos(_curIndex,curSelectIndex)
|
||||
Log("FirstSetGridPos ".._curIndex .." "..curSelectIndex)
|
||||
local num = math.abs(curSelectIndex) - math.abs(_curIndex)
|
||||
Log("FirstSetGridPos "..num)
|
||||
if num < 0 then
|
||||
num = math.abs(num)
|
||||
for i = _curIndex+1, _curIndex+num do
|
||||
curIndex = i
|
||||
this.grid.transform:DOLocalMove(Vector3.New(curIndex*440,0,0), 0.01, false):OnComplete(function ()
|
||||
Log("移动完成")
|
||||
local dataIndex = math.abs(curIndex)
|
||||
if dataIndex > #playerRideConFig then
|
||||
dataIndex = dataIndex % #playerRideConFig
|
||||
end
|
||||
if dataIndex == 0 then
|
||||
dataIndex = #playerRideConFig
|
||||
end
|
||||
this.OnShowCurRideProData(playerRideConFig[dataIndex].Id)
|
||||
posAddIndex = posAddIndex - 1
|
||||
posJianIndex = posJianIndex - 1
|
||||
local curGo = this.grid.transform:GetChild(#playerRideConFig - 1).transform
|
||||
curGo.transform:SetAsFirstSibling()
|
||||
curGo.transform.localPosition=Vector3.New(posJianIndex*440,0,0)
|
||||
end):SetEase(Ease.Linear)
|
||||
end
|
||||
elseif num > 0 then
|
||||
num = math.abs(num)
|
||||
for i = _curIndex-1, _curIndex-num,-1 do
|
||||
curIndex = i
|
||||
this.grid.transform:DOLocalMove(Vector3.New(curIndex*440,0,0), 0.01 , false):OnComplete(function ()
|
||||
Log("移动完成")
|
||||
local dataIndex = math.abs(curIndex)
|
||||
if dataIndex > #playerRideConFig then
|
||||
dataIndex = dataIndex % #playerRideConFig
|
||||
end
|
||||
if dataIndex == 0 then
|
||||
dataIndex = #playerRideConFig
|
||||
end
|
||||
this.OnShowCurRideProData(playerRideConFig[dataIndex].Id)
|
||||
local curGo = this.grid.transform:GetChild(0).transform
|
||||
curGo.transform:SetAsLastSibling()
|
||||
posAddIndex = posAddIndex + 1
|
||||
posJianIndex = posJianIndex + 1
|
||||
curGo.transform.localPosition=Vector3.New(posAddIndex*440,0,0)
|
||||
end):SetEase(Ease.Linear)
|
||||
end
|
||||
end
|
||||
end
|
||||
--界面关闭时调用(用于子类重写)
|
||||
function SettingPlayerRide:OnClose()
|
||||
|
||||
parentGo = nil
|
||||
if rideLive then
|
||||
poolManager:UnLoadLive(rideLiveStr, rideLive, PoolManager.AssetType.GameObject)
|
||||
rideLive = nil
|
||||
end
|
||||
Util.ClearChild(this.grid.transform)
|
||||
rideList = {}
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
function SettingPlayerRide:OnDestroy()
|
||||
|
||||
if playerLiveView then
|
||||
SubUIManager.Close(playerLiveView)
|
||||
playerLiveView = nil
|
||||
end
|
||||
end
|
||||
|
||||
return SettingPlayerRide
|
|
@ -1,4 +1,5 @@
|
|||
local SettingPlayerSkin = quick_class("SettingPlayerSkin")
|
||||
--时装
|
||||
local SettingPlayerSkin = quick_class("SettingPlayerSkin")
|
||||
local this = SettingPlayerSkin
|
||||
local playerSkinConFig --= ConfigManager.GetAllConfigsDataByKey(ConfigName.ItemConfig, "ItemType", ItemType.Skin)
|
||||
local proList = {}
|
||||
|
@ -109,27 +110,27 @@ function SettingPlayerSkin:RemoveListener()
|
|||
end
|
||||
--界面打开时调用(用于子类重写)
|
||||
function SettingPlayerSkin:OnOpen()
|
||||
playerSkinConFig = ConfigManager.GetAllConfigsDataByKey(ConfigName.ItemConfig, "ItemType", ItemType.Skin)
|
||||
-- playerSkinConFig = ConfigManager.GetAllConfigsDataByKey(ConfigName.ItemConfig, "ItemType", ItemType.Skin)
|
||||
end
|
||||
|
||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||
function SettingPlayerSkin:OnShow()
|
||||
|
||||
Util.ClearChild(this.grid.transform)
|
||||
skinList = {}
|
||||
if #playerSkinConFig < 5 then
|
||||
for i = 1, #playerSkinConFig do
|
||||
table.insert(playerSkinConFig,playerSkinConFig[i])
|
||||
end
|
||||
end
|
||||
this.OnShowCurSkinProData(PlayerManager.skin > 0 and PlayerManager.skin or playerSkinConFig[1].Id)
|
||||
this.OnShowAllSkinGrid()
|
||||
posAddIndex = #playerSkinConFig
|
||||
posJianIndex = 1
|
||||
if playerLiveView == nil then
|
||||
playerLiveView = SubUIManager.Open(SubUIConfig.PlayerLiveView, this.live2dRootParent.transform)
|
||||
end
|
||||
playerLiveView:OnOpen()
|
||||
-- Util.ClearChild(this.grid.transform)
|
||||
-- skinList = {}
|
||||
-- if #playerSkinConFig < 5 then
|
||||
-- for i = 1, #playerSkinConFig do
|
||||
-- table.insert(playerSkinConFig,playerSkinConFig[i])
|
||||
-- end
|
||||
-- end
|
||||
-- this.OnShowCurSkinProData(PlayerManager.skin > 0 and PlayerManager.skin or playerSkinConFig[1].Id)
|
||||
-- this.OnShowAllSkinGrid()
|
||||
-- posAddIndex = #playerSkinConFig
|
||||
-- posJianIndex = 1
|
||||
-- if playerLiveView == nil then
|
||||
-- playerLiveView = SubUIManager.Open(SubUIConfig.PlayerLiveView, this.live2dRootParent.transform)
|
||||
-- end
|
||||
-- playerLiveView:OnOpen()
|
||||
end
|
||||
--坐骑属性展示
|
||||
function this.OnShowCurSkinProData(skinId)
|
||||
|
|
|
@ -1,20 +1,6 @@
|
|||
local SettingPlayerTitle = quick_class("SettingPlayerTitle")
|
||||
--称号
|
||||
local SettingPlayerTitle = quick_class("SettingPlayerTitle")
|
||||
local this = SettingPlayerTitle
|
||||
local playerTitleConFig --= ConfigManager.GetAllConfigsDataByKey(ConfigName.ItemConfig, "ItemType", ItemType.Title)
|
||||
local proList = {}
|
||||
local titleList = {}
|
||||
local curTitleId = 0
|
||||
local curTitleItemConFig = {}--ItemConfig
|
||||
local curTitleConFig = {}--PlayerAppearance
|
||||
local parentGo = nil
|
||||
local titleLive
|
||||
local titleLiveStr
|
||||
local playerLiveView--view
|
||||
local posAddIndex = 0
|
||||
local posJianIndex = 0
|
||||
local curIndex = 0
|
||||
local curDataIndex = 0
|
||||
local isLicckBtn = false
|
||||
function SettingPlayerTitle:ctor(mainPanel, gameObject)
|
||||
self.mainPanel = mainPanel
|
||||
self.gameObject = gameObject
|
||||
|
@ -23,78 +9,9 @@ function SettingPlayerTitle:ctor(mainPanel, gameObject)
|
|||
end
|
||||
--初始化组件(用于子类重写)
|
||||
function SettingPlayerTitle:InitComponent(gameObject)
|
||||
|
||||
parentGo = gameObject
|
||||
this.live2dRootParent = Util.GetGameObject(gameObject, "live2dRootParent")
|
||||
this.live2dRootParent2 = Util.GetGameObject(gameObject, "live2dRootParent2")
|
||||
this.name = Util.GetGameObject(gameObject, "name/Text"):GetComponent("Text")
|
||||
this.getInfo = Util.GetGameObject(gameObject, "titleProInfo/getInfo"):GetComponent("Text")
|
||||
this.proListParent = Util.GetGameObject(gameObject, "titleProInfo/pro")
|
||||
proList = {}
|
||||
for i = 1, 3 do
|
||||
proList[i] = Util.GetGameObject(gameObject, "titleProInfo/pro/pro ("..i..")")
|
||||
end
|
||||
|
||||
this.setImage = Util.GetGameObject(gameObject, "setImage")
|
||||
this.grid = Util.GetGameObject(gameObject, "rect/grid")
|
||||
this.rect = Util.GetGameObject(gameObject, "rect")
|
||||
titleList = {}
|
||||
--for i = 1, #playerTitleConFig do
|
||||
-- titleList[i] = Util.GetGameObject(gameObject, "rect/grid/itemPre ("..i..")")
|
||||
--end
|
||||
this.goToBtn = Util.GetGameObject(gameObject, "goToBtn")
|
||||
this.goToBtnText = Util.GetGameObject(gameObject, "goToBtn/Text"):GetComponent("Text")
|
||||
this.Info = Util.GetGameObject(gameObject, "titleProInfo/Info"):GetComponent("Text")
|
||||
this.InfoText = Util.GetGameObject(gameObject, "titleProInfo/InfoImage/Text"):GetComponent("Text")
|
||||
this.rightBtn = Util.GetGameObject(gameObject, "rightBtn")
|
||||
this.leftBtn = Util.GetGameObject(gameObject, "leftBtn")
|
||||
|
||||
|
||||
this.ItemView = Util.GetGameObject(self.gameObject, "itemPre")
|
||||
end
|
||||
--绑定事件(用于子类重写)
|
||||
function SettingPlayerTitle:BindEvent()
|
||||
|
||||
Util.AddOnceClick(this.rightBtn, function()
|
||||
if not isLicckBtn then
|
||||
isLicckBtn = true
|
||||
curIndex = curIndex - 1
|
||||
curDataIndex = curDataIndex + 1
|
||||
this.grid.transform:DOLocalMove(Vector3.New(curIndex*440,0,0), 0.3, false):OnComplete(function ()
|
||||
Log("移动完成")
|
||||
if curDataIndex > #playerTitleConFig then
|
||||
curDataIndex = 1
|
||||
end
|
||||
this.OnShowCurTitleProData(playerTitleConFig[curDataIndex].Id)
|
||||
local curGo = this.grid.transform:GetChild(0).transform
|
||||
curGo.transform:SetAsLastSibling()
|
||||
posAddIndex = posAddIndex + 1
|
||||
posJianIndex = posJianIndex + 1
|
||||
curGo.transform.localPosition=Vector3.New(posAddIndex*440,0,0)
|
||||
isLicckBtn = false
|
||||
end):SetEase(Ease.Linear)
|
||||
end
|
||||
end)
|
||||
Util.AddOnceClick(this.leftBtn, function()
|
||||
if not isLicckBtn then
|
||||
isLicckBtn = true
|
||||
curIndex = curIndex + 1
|
||||
curDataIndex = curDataIndex - 1
|
||||
this.grid.transform:DOLocalMove(Vector3.New(curIndex*440,0,0), 0.3, false):OnComplete(function ()
|
||||
Log("移动完成")
|
||||
if curDataIndex < 1 then
|
||||
curDataIndex = #playerTitleConFig
|
||||
end
|
||||
this.OnShowCurTitleProData(playerTitleConFig[curDataIndex].Id)
|
||||
posAddIndex = posAddIndex - 1
|
||||
posJianIndex = posJianIndex - 1
|
||||
local curGo = this.grid.transform:GetChild(#playerTitleConFig - 1).transform
|
||||
curGo.transform:SetAsFirstSibling()
|
||||
curGo.transform.localPosition=Vector3.New(posJianIndex*440,0,0)
|
||||
isLicckBtn = false
|
||||
end):SetEase(Ease.Linear)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
|
@ -108,219 +25,17 @@ function SettingPlayerTitle:RemoveListener()
|
|||
end
|
||||
--界面打开时调用(用于子类重写)
|
||||
function SettingPlayerTitle:OnOpen()
|
||||
playerTitleConFig = ConfigManager.GetAllConfigsDataByKey(ConfigName.ItemConfig, "ItemType", ItemType.Title)
|
||||
end
|
||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||
function SettingPlayerTitle:OnShow()
|
||||
|
||||
|
||||
Util.ClearChild(this.grid.transform)
|
||||
titleList = {}
|
||||
if #playerTitleConFig < 5 then
|
||||
for i = 1, #playerTitleConFig do
|
||||
table.insert(playerTitleConFig,playerTitleConFig[i])
|
||||
end
|
||||
end
|
||||
this.OnShowCurTitleProData(PlayerManager.designation > 0 and PlayerManager.designation or playerTitleConFig[1].Id)
|
||||
this.OnShowAllTitleGrid()
|
||||
posAddIndex = #playerTitleConFig
|
||||
posJianIndex = 1
|
||||
if playerLiveView == nil then
|
||||
playerLiveView = SubUIManager.Open(SubUIConfig.PlayerLiveView, this.live2dRootParent.transform)
|
||||
end
|
||||
playerLiveView:OnOpen()
|
||||
end
|
||||
--坐骑属性展示
|
||||
function this.OnShowCurTitleProData(titleId)
|
||||
curTitleId = titleId
|
||||
curTitleItemConFig = ConfigManager.GetConfigData(ConfigName.ItemConfig,curTitleId)
|
||||
curTitleConFig = ConfigManager.GetConfigData(ConfigName.PlayerAppearance,curTitleId)
|
||||
if curTitleConFig == nil then return end
|
||||
this.name.text = GetLanguageStrById(curTitleItemConFig.Name)
|
||||
this.getInfo.text = GetLanguageStrById(curTitleConFig.Description)
|
||||
this.Info.text = GetLanguageStrById(curTitleItemConFig.ItemDescribe)
|
||||
this.InfoText.text = GetLanguageStrById(curTitleItemConFig.Name)
|
||||
local curproInfoList = this.GetCurTitleAllPro()
|
||||
--属性展示
|
||||
for i = 1, math.max(#proList, #curproInfoList) do
|
||||
local go = proList[i]
|
||||
if not go then
|
||||
go=newObject(proList[1])
|
||||
go.transform:SetParent(this.proListParent.transform)
|
||||
go.transform.localScale = Vector3.one
|
||||
go.transform.localPosition=Vector3.zero;
|
||||
go.gameObject.name = "pro (".. i ..")"
|
||||
proList[i] = go
|
||||
end
|
||||
go.gameObject:SetActive(false)
|
||||
end
|
||||
for i = 1, #curproInfoList do
|
||||
proList[i]:SetActive(true)
|
||||
Util.GetGameObject(proList[i], "proName"):GetComponent("Text").text = curproInfoList[i].name..":"
|
||||
Util.GetGameObject(proList[i], "proValue"):GetComponent("Text").text = "+"..curproInfoList[i].vale
|
||||
end
|
||||
if titleLive then
|
||||
poolManager:UnLoadLive(titleLiveStr, titleLive, PoolManager.AssetType.GameObject)
|
||||
titleLive = nil
|
||||
end
|
||||
titleLiveStr = GetResourcePath(ConfigManager.GetConfigData(ConfigName.PlayerAppearance,curTitleId).Live)
|
||||
titleLive = poolManager:LoadLive(titleLiveStr, this.live2dRootParent2.transform, Vector3.one, Vector3.zero)
|
||||
--满级显隐
|
||||
this.GoToBtnFun()
|
||||
end
|
||||
--当前级属所有性获取
|
||||
function this.GetCurTitleAllPro()
|
||||
local proList = {}
|
||||
local curPlayerMountLevelUp = curTitleConFig.Property
|
||||
if curPlayerMountLevelUp then
|
||||
for i = 1, #curPlayerMountLevelUp do
|
||||
table.insert(proList,{name = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig,curPlayerMountLevelUp[i][1]).Info),
|
||||
vale = curPlayerMountLevelUp[i][2]})
|
||||
end
|
||||
end
|
||||
return proList
|
||||
end
|
||||
--所有坐骑展示
|
||||
function this.OnShowAllTitleGrid()
|
||||
for i = 1, math.max(#titleList, #playerTitleConFig) do
|
||||
local go = titleList[i]
|
||||
if not go then
|
||||
go=newObject(this.ItemView)
|
||||
go.transform:SetParent(this.grid.transform)
|
||||
go.transform.localScale = Vector3.one
|
||||
go.gameObject.name = "itemPre (".. i ..")"
|
||||
titleList[i] = go
|
||||
--440 = 362 + 80
|
||||
titleList[i].transform.localPosition=Vector3.New(i*440,0,0)
|
||||
end
|
||||
go.gameObject:SetActive(false)
|
||||
end
|
||||
this.RefreshAllTitleData()
|
||||
curIndex = -3
|
||||
this.grid.transform.localPosition=Vector3.New(curIndex*440)
|
||||
this.FirstSetGridPos(curIndex,curDataIndex)
|
||||
end
|
||||
function this.GoToBtnFun()
|
||||
local btnState = 0
|
||||
if BagManager.GetItemCountById(curTitleId) > 0 then--获得
|
||||
this.goToBtnText.text = Language[10202]
|
||||
btnState = 1
|
||||
if curTitleId == PlayerManager.designation then--获得并使用
|
||||
this.goToBtnText.text = Language[11868]
|
||||
btnState = 2
|
||||
end
|
||||
else--未获得
|
||||
this.goToBtnText.text = Language[11869]
|
||||
end
|
||||
Util.AddOnceClick(this.goToBtn, function()
|
||||
if btnState == 0 then
|
||||
JumpManager.GoJump(ConfigManager.GetConfigData(ConfigName.ItemConfig,curTitleId).Jump[1])
|
||||
elseif btnState == 1 then
|
||||
NetManager.RequestChangeModifyDecoration(2, curTitleId, function ()
|
||||
PopupTipPanel.ShowTip(Language[11850])
|
||||
PlayerManager.SetPlayerDesignation(curTitleId)
|
||||
this.RefreshAllTitleData()
|
||||
FormationManager.UserPowerChanged()
|
||||
this.GoToBtnFun()
|
||||
if playerLiveView then
|
||||
playerLiveView:OnOpen()
|
||||
end
|
||||
end)
|
||||
elseif btnState == 2 then
|
||||
NetManager.RequestChangeModifyDecoration(2, 0, function ()
|
||||
PopupTipPanel.ShowTip(Language[11870])
|
||||
PlayerManager.SetPlayerDesignation(0)
|
||||
this.RefreshAllTitleData()
|
||||
FormationManager.UserPowerChanged()
|
||||
this.GoToBtnFun()
|
||||
if playerLiveView then
|
||||
playerLiveView:OnOpen()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
function this.RefreshAllTitleData()
|
||||
for i = 1, #playerTitleConFig do
|
||||
if curTitleId == playerTitleConFig[i].Id then
|
||||
curDataIndex = i
|
||||
end
|
||||
--titleList[i].transform.localPosition=Vector3.New(i*440,0,0)
|
||||
titleList[i]:SetActive(true)
|
||||
Util.GetGameObject( titleList[i], "name"):GetComponent("Text").text = GetLanguageStrById(playerTitleConFig[i].Name)
|
||||
Util.GetGameObject( titleList[i], "iconMask/icon"):GetComponent("Image").sprite =
|
||||
Util.LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.PlayerAppearance,playerTitleConFig[i].Id).Painting))
|
||||
Util.GetGameObject( titleList[i], "noGetImage"):SetActive(BagManager.GetItemCountById(playerTitleConFig[i].Id) <= 0)
|
||||
Util.GetGameObject( titleList[i], "GetImage"):SetActive(playerTitleConFig[i].Id == PlayerManager.designation)
|
||||
end
|
||||
end
|
||||
function this.FirstSetGridPos(_curIndex,curSelectIndex)
|
||||
Log("FirstSetGridPos ".._curIndex .." "..curSelectIndex)
|
||||
local num = math.abs(curSelectIndex) - math.abs(_curIndex)
|
||||
Log("FirstSetGridPos "..num)
|
||||
if num < 0 then
|
||||
num = math.abs(num)
|
||||
for i = _curIndex+1, _curIndex+num do
|
||||
curIndex = i
|
||||
this.grid.transform:DOLocalMove(Vector3.New(curIndex*440,0,0), 0.01, false):OnComplete(function ()
|
||||
Log("移动完成")
|
||||
local dataIndex = math.abs(curIndex)
|
||||
if dataIndex > #playerTitleConFig then
|
||||
dataIndex = dataIndex % #playerTitleConFig
|
||||
end
|
||||
if dataIndex == 0 then
|
||||
dataIndex = #playerTitleConFig
|
||||
end
|
||||
this.OnShowCurTitleProData(playerTitleConFig[dataIndex].Id)
|
||||
posAddIndex = posAddIndex - 1
|
||||
posJianIndex = posJianIndex - 1
|
||||
local curGo = this.grid.transform:GetChild(#playerTitleConFig - 1).transform
|
||||
curGo.transform:SetAsFirstSibling()
|
||||
curGo.transform.localPosition=Vector3.New(posJianIndex*440,0,0)
|
||||
end):SetEase(Ease.Linear)
|
||||
end
|
||||
elseif num > 0 then
|
||||
num = math.abs(num)
|
||||
for i = _curIndex-1, _curIndex-num,-1 do
|
||||
curIndex = i
|
||||
this.grid.transform:DOLocalMove(Vector3.New(curIndex*440,0,0), 0.01 , false):OnComplete(function ()
|
||||
Log("移动完成")
|
||||
local dataIndex = math.abs(curIndex)
|
||||
if dataIndex > #playerTitleConFig then
|
||||
dataIndex = dataIndex % #playerTitleConFig
|
||||
end
|
||||
if dataIndex == 0 then
|
||||
dataIndex = #playerTitleConFig
|
||||
end
|
||||
this.OnShowCurTitleProData(playerTitleConFig[dataIndex].Id)
|
||||
local curGo = this.grid.transform:GetChild(0).transform
|
||||
curGo.transform:SetAsLastSibling()
|
||||
posAddIndex = posAddIndex + 1
|
||||
posJianIndex = posJianIndex + 1
|
||||
curGo.transform.localPosition=Vector3.New(posAddIndex*440,0,0)
|
||||
end):SetEase(Ease.Linear)
|
||||
end
|
||||
end
|
||||
end
|
||||
--界面关闭时调用(用于子类重写)
|
||||
function SettingPlayerTitle:OnClose()
|
||||
|
||||
parentGo = nil
|
||||
if titleLive then
|
||||
poolManager:UnLoadLive(titleLiveStr, titleLive, PoolManager.AssetType.GameObject)
|
||||
titleLive = nil
|
||||
end
|
||||
Util.ClearChild(this.grid.transform)
|
||||
titleList = {}
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
function SettingPlayerTitle:OnDestroy()
|
||||
|
||||
if playerLiveView then
|
||||
SubUIManager.Close(playerLiveView)
|
||||
playerLiveView = nil
|
||||
end
|
||||
end
|
||||
|
||||
return SettingPlayerTitle
|
Loading…
Reference in New Issue