【坐骑】获取新坐骑,点击前往,展示新坐骑

dev_chengFeng
gaoxin 2021-11-02 16:42:36 +08:00
parent 99fd74ec10
commit 44415cfded
5 changed files with 44 additions and 7 deletions

View File

@ -212,6 +212,8 @@ local ManagerNames = {
"GeneralPanel/GeneralTreasureMangaer",
--御剑行管理器
"YuJianXing/YuJianXingManager",
--坐骑管理
"Setting/PlayerSetTitleRideSkinManager",
--!!!!红点管理(尽量放在最后)!!!!--
"Player/RedpotManager",
}

View File

@ -871,7 +871,10 @@ function this.ShowWarPowerChange(powernum,type)
elseif type== PowerChangeJumpType.title then
str=Language[12291]
end
MsgPanel.ShowTwo(str,nil,function()
MsgPanel.ShowTwo(str,function()
-- 所有坐骑设置为旧的
PlayerSetTitleRideSkinManager.SetAllOldRide()
end,function()
UIManager.OpenPanel(UIName.SettingPanel,type)
end)
end, 1):Start()

View File

@ -208,6 +208,8 @@ function RewardItemSingleShowPopup:BindEvent()
self:ClosePanel()
PopupTipPanel.ShowTip(Language[12255])
this.WarPowerChange(oldPowerNum,PowerChangeJumpType.ride)
-- 设置新坐骑
PlayerSetTitleRideSkinManager.SetNewRide(itemConfigData.Id)
end)
end)
else
@ -216,6 +218,8 @@ function RewardItemSingleShowPopup:BindEvent()
self:ClosePanel()
PopupTipPanel.ShowTip(Language[12255])
this.WarPowerChange(oldPowerNum,PowerChangeJumpType.ride)
-- 设置新坐骑
PlayerSetTitleRideSkinManager.SetNewRide(itemConfigData.Id)
end)
end
elseif itemConfigData.ItemType == ItemType.Title then

View File

@ -2,7 +2,34 @@ PlayerSetTitleRideSkinManager = {};
local this = PlayerSetTitleRideSkinManager
function this.Initialize()
this.NewRide = {}
end
-- 设置刚刚获取到的坐骑是新的,
function this.SetNewRide(rideId)
this.NewRide[rideId] = 1
end
-- 查看后设置为旧的
function this.SetOldRide(rideId)
this.NewRide[rideId] = 0
end
-- 查看后设置为旧的
function this.SetAllOldRide()
for rideId, isNew in pairs(this.NewRide) do
this.NewRide[rideId] = 0
end
end
-- 获取一个新坐骑
function this.GetNewRide()
local newRideId = nil
for rideId, isNew in pairs(this.NewRide) do
if isNew == 1 then
if not newRideId or newRideId > rideId then
newRideId = rideId
end
end
end
return newRideId
end
return this

View File

@ -102,23 +102,24 @@ end
--显示信息
function this.ShowPanelData()
local rideList = ConfigManager.GetAllConfigsDataByKey(ConfigName.PlayerHeadIcon,"Type",PlayerHeadIconType.Ride)
-- 排序
-- 排序,已解锁的放前面
table.sort(rideList, function(a, b)
Log(a.Id.."|"..b.Id)
if PlayerManager.userMountList[a.Id] and not PlayerManager.userMountList[b.Id] then
Log("true")
return true
elseif not PlayerManager.userMountList[a.Id] and PlayerManager.userMountList[b.Id] then
Log("false")
return false
else
Log("ID:"..tostring(a.Id < b.Id))
return a.Id < b.Id
end
end)
--设置选中
local newRideId = PlayerSetTitleRideSkinManager.GetNewRide()
local curUserRideId = PlayerManager.GetPlayerRide()
if curUserRideId > 0 then
if newRideId and newRideId > 0 then
curUserRideConFig = ConfigManager.GetConfigData(ConfigName.PlayerHeadIcon,newRideId)
-- 所有坐骑设置为旧的
PlayerSetTitleRideSkinManager.SetAllOldRide()
elseif curUserRideId and curUserRideId > 0 then
curUserRideConFig = ConfigManager.GetConfigData(ConfigName.PlayerHeadIcon,curUserRideId)
else
curUserRideConFig = rideList[1]