抽卡
This commit is contained in:
parent
66c6437612
commit
de7a7f3777
@ -640,7 +640,16 @@ local LocalizationGlobalConst =
|
|||||||
ITEM_NOT_ENOUGH_DESC = "ITEM_NOT_ENOUGH_DESC",
|
ITEM_NOT_ENOUGH_DESC = "ITEM_NOT_ENOUGH_DESC",
|
||||||
SUMMON_ONE = "SUMMON_ONE",
|
SUMMON_ONE = "SUMMON_ONE",
|
||||||
SUMMON_TEN = "SUMMON_TEN",
|
SUMMON_TEN = "SUMMON_TEN",
|
||||||
SUMMON_FREE_TIME = "SUMMON_FREE_TIME",
|
FREE_THIS_TIME_DESC = "FREE_THIS_TIME_DESC",
|
||||||
|
SUMMON_DESC_22 = "SUMMON_DESC_22",
|
||||||
|
SUMMON_WISH_OK = "SUMMON_WISH_OK",
|
||||||
|
SUMMON_WISH_TITLE = "SUMMON_WISH_TITLE",
|
||||||
|
SUMMON_WISH_UNSELECT = "SUMMON_WISH_UNSELECT",
|
||||||
|
SUMMON_WISH_TIPS = "SUMMON_WISH_TIPS",
|
||||||
|
SUMMON_WISH_TIPS_2 = "SUMMON_WISH_TIPS_2",
|
||||||
|
BATTLE_FORCE_CHOOSE_DESC_2 = "BATTLE_FORCE_CHOOSE_DESC_2",
|
||||||
|
SUMMON_WISH_LOCK = "SUMMON_WISH_LOCK",
|
||||||
|
SUMMON_FORCE_3 = "SUMMON_FORCE_3",
|
||||||
}
|
}
|
||||||
|
|
||||||
return LocalizationGlobalConst
|
return LocalizationGlobalConst
|
||||||
@ -640,7 +640,16 @@ local localization_global =
|
|||||||
["ITEM_NOT_ENOUGH_DESC"] = "是否使用<color=#c40e0e>钻石*{0}</color>补充<color=#c45f0e>魔法石*{1}</color>,进行召唤?",
|
["ITEM_NOT_ENOUGH_DESC"] = "是否使用<color=#c40e0e>钻石*{0}</color>补充<color=#c45f0e>魔法石*{1}</color>,进行召唤?",
|
||||||
["SUMMON_ONE"] = "召唤1次",
|
["SUMMON_ONE"] = "召唤1次",
|
||||||
["SUMMON_TEN"] = "召唤10次",
|
["SUMMON_TEN"] = "召唤10次",
|
||||||
["SUMMON_FREE_TIME"] = "{0}后免费",
|
["FREE_THIS_TIME_DESC"] = "本次免费",
|
||||||
|
["SUMMON_DESC_22"] = "点击广告召唤",
|
||||||
|
["SUMMON_WISH_OK"] = "确定选择",
|
||||||
|
["SUMMON_WISH_TITLE"] = "心愿英雄",
|
||||||
|
["SUMMON_WISH_UNSELECT"] = "暂未选择",
|
||||||
|
["SUMMON_WISH_TIPS"] = "每召唤<color=#ffee2c>100</color>次必得心愿大奖:<color=#ff9b59>传说英雄</color>",
|
||||||
|
["SUMMON_WISH_TIPS_2"] = "每召唤<color=#ffee2c>100</color>次必得心愿大奖:<color=#ff5d5d>神话英雄</color>",
|
||||||
|
["BATTLE_FORCE_CHOOSE_DESC_2"] = "请选择想要的奖励",
|
||||||
|
["SUMMON_WISH_LOCK"] = "未解锁心愿",
|
||||||
|
["SUMMON_FORCE_3"] = "概率",
|
||||||
}
|
}
|
||||||
|
|
||||||
return localization_global
|
return localization_global
|
||||||
@ -15,21 +15,17 @@ function SummonManager:showSummonMainUI(summonId)
|
|||||||
UIManager:showUI("app/ui/summon/summon_main_ui", {summonId = summonId})
|
UIManager:showUI("app/ui/summon/summon_main_ui", {summonId = summonId})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function SummonManager:showSummonWishUI()
|
function SummonManager:showSummonWishUI(summonId)
|
||||||
-- UIManager:showUI("app/ui/summon/summon_wish_ui")
|
UIManager:showUI("app/ui/summon/summon_wish_ui", {summonId = summonId})
|
||||||
-- end
|
end
|
||||||
|
|
||||||
function SummonManager:showSummonRewardUI(params)
|
function SummonManager:showSummonRewardUI(params)
|
||||||
UIManager:showUI("app/ui/summon/summon_reward_ui", params)
|
UIManager:showUI("app/ui/summon/summon_reward_ui", params)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function SummonManager:showSummonOddsUI()
|
function SummonManager:showSummonOddsUI(summonId)
|
||||||
-- UIManager:showUI("app/ui/summon/summon_odds_ui")
|
UIManager:showUI("app/ui/summon/summon_odds_ui", {summonId = summonId})
|
||||||
-- end
|
end
|
||||||
|
|
||||||
-- function SummonManager:showSummonOddsUI()
|
|
||||||
-- UIManager:showUI("app/ui/summon/summon_odds_ui")
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- function SummonManager:showSummonResultUI(params)
|
-- function SummonManager:showSummonResultUI(params)
|
||||||
-- UIManager:showUI("app/ui/summon/summon_result_ui", params)
|
-- UIManager:showUI("app/ui/summon/summon_result_ui", params)
|
||||||
@ -52,7 +48,7 @@ function SummonManager:onForceSummonRsp(result)
|
|||||||
if result.reqData.free then
|
if result.reqData.free then
|
||||||
time_at = Time:getServerTime()
|
time_at = Time:getServerTime()
|
||||||
end
|
end
|
||||||
DataManager.SummonData:updateSummonCount(result.reqData.times, time_at)
|
DataManager.SummonData:updateSummonCount(result.reqData.id, result.reqData.times, time_at)
|
||||||
local newForce = {}
|
local newForce = {}
|
||||||
-- for _, reward in pairs(result.rewards) do
|
-- for _, reward in pairs(result.rewards) do
|
||||||
-- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
|
-- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
|
||||||
@ -84,38 +80,38 @@ end
|
|||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
|
|
||||||
function SummonManager:reqForceSummonWishSet(heroId)
|
function SummonManager:onSummonWishSetReq(summonType, heroId)
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ForceSummonWishSetReq, { id = DataManager.SummonData:getSummonSeason(), force = heroId }, self.rspForceSummonWishSet,
|
self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishSetReq, {id = summonType, hero = heroId}, {}, self.onSummonWishSetRsp,
|
||||||
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
|
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonManager:rspForceSummonWishSet(result)
|
function SummonManager:onSummonWishSetRsp(result)
|
||||||
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
DataManager.SummonData:updateSummonWishHeroId(result.reqData.force)
|
DataManager.SummonData:updateSummonWishHeroId(result.reqData.id, result.reqData.hero)
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON_WISH_HERO_ID)
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON_WISH_HERO_ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonManager:forceSummonWishClaimReq()
|
function SummonManager:onSummonWishClaimReq(summonType)
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ForceSummonWishClaimReq, { id = DataManager.SummonData:getSummonSeason() }, self.ForceSummonWishClaimRsp,
|
self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishClaimReq, {id = summonType}, {}, self.onSummonWishClaimRsp,
|
||||||
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
|
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonManager:ForceSummonWishClaimRsp(result)
|
function SummonManager:onSummonWishClaimRsp(result)
|
||||||
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
DataManager.SummonData:summonWishClaim()
|
DataManager.SummonData:summonWishClaim()
|
||||||
local newForce = {}
|
-- local newForce = {}
|
||||||
for _, reward in pairs(result.rewards) do
|
-- for _, reward in pairs(result.rewards) do
|
||||||
local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
|
-- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
|
||||||
if isNew then
|
-- if isNew then
|
||||||
table.insert(newForce, reward.item.id)
|
-- table.insert(newForce, reward.item.id)
|
||||||
DataManager.ForceData:setForceIsNew(reward.item.id, false)
|
-- DataManager.ForceData:setForceIsNew(reward.item.id, false)
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON_WISH_CLAIM, result,newForce)
|
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON_WISH_CLAIM, result,newForce)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -148,7 +148,7 @@ function MainComp:init()
|
|||||||
ModuleManager.IdleManager:showIdleDropUI()
|
ModuleManager.IdleManager:showIdleDropUI()
|
||||||
end)
|
end)
|
||||||
self.rightBtn:addClickListener(function()
|
self.rightBtn:addClickListener(function()
|
||||||
ModuleManager.SummonManager:showSummonMainUI(DataManager.SummonData:getSummonOpenActivityId())
|
ModuleManager.SummonManager:showSummonMainUI()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,84 +0,0 @@
|
|||||||
local SummonBallCell = class("SummonBallCell", BaseCell)
|
|
||||||
|
|
||||||
local ItemCfg = ConfigManager:getConfig("item")
|
|
||||||
local ForceCfg = ConfigManager:getConfig("force")
|
|
||||||
|
|
||||||
function SummonBallCell:init()
|
|
||||||
local uiMap = self:getUIMap()
|
|
||||||
self.icon = uiMap["ball_cell.bg.icon"]
|
|
||||||
self.forceSpine = uiMap["ball_cell.bg.mask_icon.ui_spine_obj"]
|
|
||||||
self.icon1 = uiMap["ball_cell.bg.icon_1"]
|
|
||||||
self.numTx = uiMap["ball_cell.bg.num_tx"]
|
|
||||||
self.maskIcon = uiMap["ball_cell.bg.mask_icon"]
|
|
||||||
self.bg = uiMap["ball_cell.bg"]
|
|
||||||
self.sfxs = {}
|
|
||||||
for i = 1, 5 do
|
|
||||||
self.sfxs[i] = uiMap["ball_cell.vfx_b10_ui_summon_b0" .. i]
|
|
||||||
self.sfxs[i]:setActive(false)
|
|
||||||
self.sfxs[i]:stop()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonBallCell:refresh(pathInfo, parentUI)
|
|
||||||
self.baseObject:setAnchoredPosition(pathInfo.posX, pathInfo.posY)
|
|
||||||
local result = pathInfo.result
|
|
||||||
local cfg = ItemCfg[result.id]
|
|
||||||
local qlt = 1
|
|
||||||
if cfg.type == 4 then
|
|
||||||
local forceCfg = ForceCfg[result.id]
|
|
||||||
qlt = forceCfg.qlt
|
|
||||||
self.icon:setVisible(false)
|
|
||||||
self.maskIcon:setVisible(true)
|
|
||||||
self.baseObject:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_egg_" .. forceCfg.qlt .. "_2")
|
|
||||||
self.icon1:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_egg_" .. forceCfg.qlt .. "_1")
|
|
||||||
-- 加载spine头像
|
|
||||||
local spineName = DataManager.ForceData:getForceModelId(result.id)
|
|
||||||
SpineManager:loadHeroSpineAssetAsync(spineName, self.baseObject, function(spineAssets)
|
|
||||||
self.forceSpine:refreshAssets(spineAssets)
|
|
||||||
self.forceSpine:setActive(true)
|
|
||||||
|
|
||||||
self.forceSpine:setAnchoredPosition(0, forceCfg.summon_offset)
|
|
||||||
local scale = forceCfg.summon_scale or 1
|
|
||||||
self.forceSpine:setLocalScale(scale, scale, scale)
|
|
||||||
self.forceSpine:playAnim("idle", true, true, true)
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
qlt = cfg.qlt - 1
|
|
||||||
self.icon:setVisible(true)
|
|
||||||
self.maskIcon:setVisible(false)
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, tostring(cfg.icon))
|
|
||||||
self.baseObject:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_egg_" .. qlt .. "_2")
|
|
||||||
self.icon1:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_egg_" .. qlt .. "_1")
|
|
||||||
end
|
|
||||||
self.numTx:setText(result.count)
|
|
||||||
|
|
||||||
for i = 1, 5 do
|
|
||||||
self.sfxs[i]:stopAndClear()
|
|
||||||
self.sfxs[i]:clearTrail()
|
|
||||||
self.sfxs[i]:setActive(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
local canvas = self.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS)
|
|
||||||
canvas.overrideSorting = true
|
|
||||||
canvas.sortingOrder = parentUI:getUIOrder() + qlt
|
|
||||||
|
|
||||||
local canvasBg = self.bg:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS)
|
|
||||||
canvasBg.overrideSorting = true
|
|
||||||
canvasBg.sortingOrder = parentUI:getUIOrder() + qlt + 2
|
|
||||||
|
|
||||||
self.sfxs[qlt]:setActive(true)
|
|
||||||
self.sfxs[qlt]:setSortingOrder(parentUI:getUIOrder(), qlt + 1)
|
|
||||||
self.sfxs[qlt]:play()
|
|
||||||
|
|
||||||
self.baseObject:setActive(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonBallCell:setActive(visible)
|
|
||||||
self.baseObject:setActive(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonBallCell:setAnchoredPosition(posX, posY)
|
|
||||||
self.baseObject:setAnchoredPosition(posX, posY)
|
|
||||||
end
|
|
||||||
|
|
||||||
return SummonBallCell
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
local SummonBtnCell = class("SummonBtnCell", BaseCell)
|
|
||||||
|
|
||||||
local ItemCfg = ConfigManager:getConfig("item")
|
|
||||||
local ForceCfg = ConfigManager:getConfig("force")
|
|
||||||
|
|
||||||
function SummonBtnCell:init()
|
|
||||||
local uiMap = self:getUIMap()
|
|
||||||
self.txDesc = uiMap["summon_btn_cell.tx_desc"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonBtnCell:refresh(pathInfo, parentUI)
|
|
||||||
self.baseObject:setAnchoredPosition(pathInfo.posX, pathInfo.posY)
|
|
||||||
local result = pathInfo.result
|
|
||||||
local cfg = ItemCfg[result.id]
|
|
||||||
local qlt = 1
|
|
||||||
if cfg.type == 4 then
|
|
||||||
local forceCfg = ForceCfg[result.id]
|
|
||||||
qlt = forceCfg.qlt
|
|
||||||
self.icon:setVisible(false)
|
|
||||||
self.maskIcon:setVisible(true)
|
|
||||||
self.baseObject:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_egg_" .. forceCfg.qlt .. "_2")
|
|
||||||
self.icon1:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_egg_" .. forceCfg.qlt .. "_1")
|
|
||||||
-- 加载spine头像
|
|
||||||
local spineName = DataManager.ForceData:getForceModelId(result.id)
|
|
||||||
SpineManager:loadHeroSpineAssetAsync(spineName, self.baseObject, function(spineAssets)
|
|
||||||
self.forceSpine:refreshAssets(spineAssets)
|
|
||||||
self.forceSpine:setActive(true)
|
|
||||||
|
|
||||||
self.forceSpine:setAnchoredPosition(0, forceCfg.summon_offset)
|
|
||||||
local scale = forceCfg.summon_scale or 1
|
|
||||||
self.forceSpine:setLocalScale(scale, scale, scale)
|
|
||||||
self.forceSpine:playAnim("idle", true, true, true)
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
qlt = cfg.qlt - 1
|
|
||||||
self.icon:setVisible(true)
|
|
||||||
self.maskIcon:setVisible(false)
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, tostring(cfg.icon))
|
|
||||||
self.baseObject:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_egg_" .. qlt .. "_2")
|
|
||||||
self.icon1:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_egg_" .. qlt .. "_1")
|
|
||||||
end
|
|
||||||
self.numTx:setText(result.count)
|
|
||||||
|
|
||||||
for i = 1, 5 do
|
|
||||||
self.sfxs[i]:stopAndClear()
|
|
||||||
self.sfxs[i]:clearTrail()
|
|
||||||
self.sfxs[i]:setActive(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
local canvas = self.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS)
|
|
||||||
canvas.overrideSorting = true
|
|
||||||
canvas.sortingOrder = parentUI:getUIOrder() + qlt
|
|
||||||
|
|
||||||
local canvasBg = self.bg:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS)
|
|
||||||
canvasBg.overrideSorting = true
|
|
||||||
canvasBg.sortingOrder = parentUI:getUIOrder() + qlt + 2
|
|
||||||
|
|
||||||
self.sfxs[qlt]:setActive(true)
|
|
||||||
self.sfxs[qlt]:setSortingOrder(parentUI:getUIOrder(), qlt + 1)
|
|
||||||
self.sfxs[qlt]:play()
|
|
||||||
|
|
||||||
self.baseObject:setActive(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonBtnCell:setActive(visible)
|
|
||||||
self.baseObject:setActive(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonBtnCell:setAnchoredPosition(posX, posY)
|
|
||||||
self.baseObject:setAnchoredPosition(posX, posY)
|
|
||||||
end
|
|
||||||
|
|
||||||
return SummonBtnCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 5ba41e7a4f0cfcd4ca0970ced19380d6
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
88
lua/app/ui/summon/cell/summon_hero_cell.lua
Executable file
88
lua/app/ui/summon/cell/summon_hero_cell.lua
Executable file
@ -0,0 +1,88 @@
|
|||||||
|
local SummonBallCell = class("SummonBallCell", BaseCell)
|
||||||
|
|
||||||
|
function SummonBallCell:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.heroBg = uiMap["summon_hero_cell.bg"]
|
||||||
|
self.icon = uiMap["summon_hero_cell.icon"]
|
||||||
|
self.matchImg = uiMap["summon_hero_cell.match_img"]
|
||||||
|
self.heroDec = uiMap["summon_hero_cell.dec"]
|
||||||
|
self.selectImg = uiMap["summon_hero_cell.select_img"]
|
||||||
|
self.nameTx = uiMap["summon_hero_cell.name_tx"]
|
||||||
|
self.countTx = uiMap["summon_hero_cell.count_tx"]
|
||||||
|
self.descTx = uiMap["summon_hero_cell.desc_tx"]
|
||||||
|
self.infoBtn = uiMap["summon_hero_cell.info_btn"]
|
||||||
|
|
||||||
|
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_UNSELECT))
|
||||||
|
self.baseObject:addClickListener(function()
|
||||||
|
if self.callback then
|
||||||
|
self.callback(self.heroId)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
self.infoBtn:addClickListener(function()
|
||||||
|
ModuleManager.HeroManager:showHeroDetailUI(self.heroId, true)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonBallCell:refresh(wishHeroId, heroId, callback, select)
|
||||||
|
self.heroId = heroId
|
||||||
|
self.callback = callback
|
||||||
|
if not heroId or heroId == 0 then
|
||||||
|
self:refreshEmpty()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local cfg = DataManager.HeroData:getHeroConfig(heroId)
|
||||||
|
|
||||||
|
-- self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, cfg.icon)
|
||||||
|
-- self.heroBg:setSprite(GConst.ATLAS_PATH.HERO, GConst.FRAME_QLT[cfg.qlt])
|
||||||
|
self.heroBg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_card_" .. (cfg.qlt - 2))
|
||||||
|
self.heroDec:setSprite(GConst.ATLAS_PATH.HERO, GConst.HERO_DEC_QLT[cfg.qlt])
|
||||||
|
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[cfg.position])
|
||||||
|
self.nameTx:setText(ModuleManager.HeroManager:getHeroName(heroId))
|
||||||
|
|
||||||
|
if select then
|
||||||
|
self.countTx:setText("x100")
|
||||||
|
self.infoBtn:setActive(false)
|
||||||
|
self.selectImg:setVisible(false)
|
||||||
|
else
|
||||||
|
self.countTx:setText("")
|
||||||
|
self.infoBtn:setActive(true)
|
||||||
|
self.selectImg:setVisible(wishHeroId == heroId)
|
||||||
|
end
|
||||||
|
self.icon:setActive(true)
|
||||||
|
self.heroDec:setActive(true)
|
||||||
|
self.matchImg:setActive(true)
|
||||||
|
self.descTx:setActive(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonBallCell:refreshEmpty()
|
||||||
|
self.heroBg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_card_0")
|
||||||
|
self.nameTx:setText("")
|
||||||
|
self.countTx:setText("")
|
||||||
|
|
||||||
|
self.infoBtn:setActive(false)
|
||||||
|
self.icon:setActive(false)
|
||||||
|
self.selectImg:setActive(false)
|
||||||
|
self.heroDec:setActive(false)
|
||||||
|
self.matchImg:setActive(false)
|
||||||
|
self.descTx:setActive(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonBallCell:refreshInfo(heroId)
|
||||||
|
self.heroId = heroId
|
||||||
|
local cfg = DataManager.HeroData:getHeroConfig(heroId)
|
||||||
|
-- self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, cfg.icon)
|
||||||
|
self.heroBg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_card_" .. (cfg.qlt - 2))
|
||||||
|
self.heroDec:setSprite(GConst.ATLAS_PATH.HERO, GConst.HERO_DEC_QLT[cfg.qlt])
|
||||||
|
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[cfg.position])
|
||||||
|
self.nameTx:setText(ModuleManager.HeroManager:getHeroName(heroId))
|
||||||
|
|
||||||
|
self.countTx:setText("")
|
||||||
|
self.infoBtn:setActive(false)
|
||||||
|
self.selectImg:setVisible(false)
|
||||||
|
self.icon:setActive(true)
|
||||||
|
self.heroDec:setActive(true)
|
||||||
|
self.matchImg:setActive(true)
|
||||||
|
self.descTx:setActive(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
return SummonBallCell
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8b5f42f2240050b499465cee7ae15f45
|
guid: 25796065cfaf148438b1f00f7fb57d8f
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -11,7 +11,6 @@ local SummonMainUI = class("SummonMainUI", BaseUI)
|
|||||||
|
|
||||||
function SummonMainUI:ctor(params)
|
function SummonMainUI:ctor(params)
|
||||||
self.page = params.summonId or 1
|
self.page = params.summonId or 1
|
||||||
DataManager.SummonData:setSummonSeason(params.summonId or 1)
|
|
||||||
self._bgVfxMap = {}
|
self._bgVfxMap = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -23,8 +22,7 @@ function SummonMainUI:currencyParams()
|
|||||||
local ItemConst = require "app/module/item/item_const"
|
local ItemConst = require "app/module/item/item_const"
|
||||||
local params = {}
|
local params = {}
|
||||||
params.showType = GConst.CURRENCY_TYPE.HORIZONTAL
|
params.showType = GConst.CURRENCY_TYPE.HORIZONTAL
|
||||||
local selectPage = DataManager.SummonData:getSummonSeason()
|
if self.page == 1 then
|
||||||
if selectPage == 1 then
|
|
||||||
params.itemIds = {
|
params.itemIds = {
|
||||||
ItemConst.ITEM_ID_GOLD,
|
ItemConst.ITEM_ID_GOLD,
|
||||||
ItemConst.ITEM_ID_GEM,
|
ItemConst.ITEM_ID_GEM,
|
||||||
@ -69,12 +67,7 @@ function SummonMainUI:onLoadRootComplete()
|
|||||||
|
|
||||||
self.txFreeTime = uiMap["summon_main_ui.node.tx_free_time"]
|
self.txFreeTime = uiMap["summon_main_ui.node.tx_free_time"]
|
||||||
|
|
||||||
-- self.btnWish = uiMap["summon_main_ui.btn_wish"] --心愿
|
self.btnWish = uiMap["summon_main_ui.node.btn_wish"] --心愿
|
||||||
-- self.wishUnlock = uiMap["summon_main_ui.btn_wish.unlock"]
|
|
||||||
-- self.wishLock = uiMap["summon_main_ui.btn_wish.lock"]
|
|
||||||
-- self.txGuarantee = uiMap["summon_main_ui.btn_wish.unlock.tx_guarantee"]
|
|
||||||
-- self.txUnlock = uiMap["summon_main_ui.btn_wish.lock.tx_unlock"]
|
|
||||||
-- self.imgWishIcon = uiMap["summon_main_ui.btn_wish.unlock.img_wish_icon"]
|
|
||||||
|
|
||||||
-- self.toggleJump = uiMap["summon_main_ui.jump_tween"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TOGGLE)
|
-- self.toggleJump = uiMap["summon_main_ui.jump_tween"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TOGGLE)
|
||||||
-- self.isJumpTween = self.toggleJump.isOn
|
-- self.isJumpTween = self.toggleJump.isOn
|
||||||
@ -109,6 +102,9 @@ function SummonMainUI:onLoadRootComplete()
|
|||||||
self.summonBg = uiMap['summon_main_ui.bg']
|
self.summonBg = uiMap['summon_main_ui.bg']
|
||||||
uiMap["summon_main_ui.node.btn_summon_one.text_one"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_ONE))
|
uiMap["summon_main_ui.node.btn_summon_one.text_one"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_ONE))
|
||||||
uiMap["summon_main_ui.node.btn_summon_ten.text_ten"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_TEN))
|
uiMap["summon_main_ui.node.btn_summon_ten.text_ten"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_TEN))
|
||||||
|
uiMap["summon_main_ui.node.btn_summon_free.text_free"]:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_THIS_TIME_DESC))
|
||||||
|
uiMap["summon_main_ui.node.btn_summon_free.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_22))
|
||||||
|
uiMap["summon_main_ui.node.btn_info.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_3))
|
||||||
self.descBg = uiMap["summon_main_ui.node.desc_bg"]
|
self.descBg = uiMap["summon_main_ui.node.desc_bg"]
|
||||||
self.descTx = uiMap["summon_main_ui.node.desc_bg.desc_tx"]
|
self.descTx = uiMap["summon_main_ui.node.desc_bg.desc_tx"]
|
||||||
-- self.spineHero = {}
|
-- self.spineHero = {}
|
||||||
@ -140,22 +136,11 @@ function SummonMainUI:onLoadRootComplete()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.page = i
|
self.page = i
|
||||||
-- local summonList = DataManager.SummonData:getSummonAllActivities()
|
|
||||||
-- DataManager.SummonData:setSummonSeason(summonList[i])
|
|
||||||
self:onRefresh()
|
self:onRefresh()
|
||||||
UIManager:updateBarsState(self)
|
UIManager:updateBarsState(self)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:scheduleGlobal(function()
|
|
||||||
self:updateTime()
|
|
||||||
end, 1)
|
|
||||||
self:updateTime()
|
|
||||||
|
|
||||||
self:_addListeners()
|
|
||||||
self:_bind()
|
|
||||||
end
|
|
||||||
function SummonMainUI:_bind()
|
|
||||||
-------------抽奖相关---------
|
-------------抽奖相关---------
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.FORCE_SUMMON, function(result, newForce)
|
self:addEventListener(EventManager.CUSTOM_EVENT.FORCE_SUMMON, function(result, newForce)
|
||||||
self:refreshWishBtn()
|
self:refreshWishBtn()
|
||||||
@ -177,35 +162,40 @@ function SummonMainUI:_bind()
|
|||||||
end
|
end
|
||||||
self:refreshWishBtn()
|
self:refreshWishBtn()
|
||||||
end)
|
end)
|
||||||
end
|
|
||||||
function SummonMainUI:_addListeners()
|
self.btnWish:addClickListener(function()
|
||||||
-- self.btnWish:addClickListener(function()
|
if self.isUnlock then
|
||||||
-- if self.isUnlock then
|
local wishHeroId = DataManager.SummonData:getSummonWishHeroId(self.page)
|
||||||
-- local wishHeroID = DataManager.SummonData:getSummonWishHeroId()
|
local wishGuarantee = DataManager.SummonData:getSummonWishGuarantee(self.page)
|
||||||
-- local wishGuarantee = DataManager.SummonData:getSummonWishGuarantee()
|
local wishCount = DataManager.SummonData:getSummonWishCount(self.page)
|
||||||
-- local wishCount = DataManager.SummonData:getSummonWishCount()
|
if wishCount >= wishGuarantee and wishHeroId ~= 0 then
|
||||||
-- if wishCount >= wishGuarantee and wishHeroID ~= 0 then
|
--发送领取奖励的协议
|
||||||
-- --发送领取奖励的协议
|
ModuleManager.SummonManager:onSummonWishClaimReq()
|
||||||
-- ModuleManager.SummonManager:forceSummonWishClaimReq()
|
else
|
||||||
-- else
|
--打开设置心愿界面
|
||||||
-- --打开设置心愿界面
|
ModuleManager.SummonManager:showSummonWishUI(self.page)
|
||||||
-- ModuleManager.SummonManager:showSummonWishUI()
|
end
|
||||||
-- end
|
else
|
||||||
-- else
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_LOCK))
|
||||||
-- GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_LOCK))
|
end
|
||||||
-- end
|
end)
|
||||||
-- end)
|
self:bind(DataManager.SummonData, "isDirty", function()
|
||||||
-- self:bind(DataManager.SummonData, "isDirty", function()
|
self:refreshWishBtn()
|
||||||
-- self:refreshWishBtn()
|
end)
|
||||||
-- end)
|
|
||||||
-- self:bind(DataManager.ActTimeData, "isDirty", function()
|
-- self:bind(DataManager.ActTimeData, "isDirty", function()
|
||||||
-- self:onRefresh()
|
-- self:onRefresh()
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
|
self:scheduleGlobal(function()
|
||||||
|
self:updateTime()
|
||||||
|
end, 1)
|
||||||
|
self:updateTime()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--每秒刷新单抽红点
|
--每秒刷新单抽红点
|
||||||
function SummonMainUI:updateTime()
|
function SummonMainUI:updateTime()
|
||||||
local isFree = DataManager.SummonData:hasSummonFree()
|
local isFree = DataManager.SummonData:hasSummonFree(self.page)
|
||||||
if self.isFree ~= isFree then
|
if self.isFree ~= isFree then
|
||||||
self.isFree = isFree
|
self.isFree = isFree
|
||||||
self:onRefresh()
|
self:onRefresh()
|
||||||
@ -262,98 +252,6 @@ function SummonMainUI:refreshPageBtn()
|
|||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function SummonMainUI:setRecttransformAnchor(tran)
|
|
||||||
-- local rectTransform = tran:getComponent(GConst.TYPEOF_UNITY_CLASS.RECTTRANSFORM)
|
|
||||||
-- if rectTransform then
|
|
||||||
-- rectTransform.anchorMin = CS.UnityEngine.Vector2(0.5, 0.5)
|
|
||||||
-- rectTransform.anchorMax = CS.UnityEngine.Vector2(0.5, 0.5)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
--刷新UI部分
|
|
||||||
function SummonMainUI:refreshUI()
|
|
||||||
-- local spine, spine_position, bg, act_txt_key, act_txt_position = DataManager.SummonData:getSummonSpineInfo()
|
|
||||||
-- BIReportV2:postOperation(GConst.SummonConst.SUMMON_MAIN_UI_PAGE_BI[DataManager.SummonData:getSummonSeason()])
|
|
||||||
-- self.selectSpineId = DataManager.SummonData:getSummonSeason()
|
|
||||||
-- self.selectSpine = self.spineHero[1]
|
|
||||||
-- for k, v in ipairs(self.spineHero) do
|
|
||||||
-- v:setActive(k == self.selectSpineId)
|
|
||||||
-- if k == self.selectSpineId then
|
|
||||||
-- self.selectSpine = v
|
|
||||||
-- self:setRecttransformAnchor(self.selectSpine)
|
|
||||||
-- if k == 1 then
|
|
||||||
-- self.selectSpine:playAnim("idle01", true, true)
|
|
||||||
-- else
|
|
||||||
-- self.selectSpine:playAnim("idle", true, true)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- if self.selectSpineId == 1 then
|
|
||||||
-- -- self.vfx_b13_ui_chouka_bg_b01:setActive(true)
|
|
||||||
-- for k, v in pairs(self._bgVfxMap) do
|
|
||||||
-- v:setActive(false)
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- self.vfx_b13_ui_chouka_bg_b01:setActive(false)
|
|
||||||
-- if self._bgVfxMap[self.selectSpineId] then
|
|
||||||
-- for k, v in pairs(self._bgVfxMap) do
|
|
||||||
-- if k == self.selectSpineId then
|
|
||||||
-- v:setActive(true)
|
|
||||||
-- if self.selectSpineId == 2 then
|
|
||||||
-- v:setAnchoredPositionY(150)
|
|
||||||
-- elseif self.selectSpineId == 3 then
|
|
||||||
-- v:setAnchoredPositionY(250)
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- v:setActive(false)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- local selectSpineId = self.selectSpineId
|
|
||||||
-- EffectManager:loadUIEffectAsync("assets/prefabs/effects/ui/vfx_b13_ui_chouka_bg_b0"..self.selectSpineId..".prefab", self, self.selectSpine, 20,
|
|
||||||
-- function(obj)
|
|
||||||
-- if selectSpineId == self.selectSpineId then
|
|
||||||
-- if self._bgVfxMap[self.selectSpineId] then
|
|
||||||
-- self._bgVfxMap[self.selectSpineId]:destroy()
|
|
||||||
-- end
|
|
||||||
-- self._bgVfxMap[self.selectSpineId] = obj
|
|
||||||
-- if self.selectSpineId == 2 then
|
|
||||||
-- self._bgVfxMap[self.selectSpineId]:setAnchoredPositionY(150)
|
|
||||||
-- elseif self.selectSpineId == 3 then
|
|
||||||
-- self._bgVfxMap[self.selectSpineId]:setAnchoredPositionY(250)
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- if self._bgVfxMap[selectSpineId] then
|
|
||||||
-- obj:destroy()
|
|
||||||
-- else
|
|
||||||
-- self._bgVfxMap[selectSpineId] = obj
|
|
||||||
-- obj:setActive(false)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- self.selectSpine:setAnchoredPosition(spine_position[1],spine_position[2], 0)
|
|
||||||
-- self.summonBg:setTexture("assets/arts/textures/background/act_hero/".. bg ..".png")
|
|
||||||
-- for i = 1, 2 do
|
|
||||||
-- if act_txt_key and act_txt_key[i] then
|
|
||||||
-- self:setRecttransformAnchor(self.heroTips[i].tips)
|
|
||||||
-- self.heroTips[i].tips:setActive(true)
|
|
||||||
-- self.heroTips[i].tips:setAnchoredPosition(act_txt_position[i][1],act_txt_position[i][2], 0)
|
|
||||||
-- local name = DataManager.ForceData:getForceName(DataManager.SummonData:getSummonWishConfig()[i])
|
|
||||||
-- if name then
|
|
||||||
-- self.heroTips[i].txName:setText(name)
|
|
||||||
-- else
|
|
||||||
-- self.heroTips[i].txName:setText(GConst.EMPTY_STRING)
|
|
||||||
-- end
|
|
||||||
-- self.heroTips[i].txDesc:setText(I18N:getGlobalText(act_txt_key[i]))
|
|
||||||
-- else
|
|
||||||
-- self.heroTips[i].tips:setActive(false)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
--刷新抽奖按钮
|
--刷新抽奖按钮
|
||||||
function SummonMainUI:refreshSummonBtn()
|
function SummonMainUI:refreshSummonBtn()
|
||||||
local isFree = DataManager.SummonData:hasSummonFree(self.page)
|
local isFree = DataManager.SummonData:hasSummonFree(self.page)
|
||||||
@ -377,7 +275,7 @@ function SummonMainUI:refreshSummonBtn()
|
|||||||
-- self.txNumOne:setText("<color=#EC3636>1</color>")
|
-- self.txNumOne:setText("<color=#EC3636>1</color>")
|
||||||
-- self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
|
-- self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
|
||||||
-- else
|
-- else
|
||||||
local cost = DataManager.SummonData:getSummonGemCost()
|
local cost = DataManager.SummonData:getSummonGemCost(self.page)
|
||||||
if cost and hadNum == 0 and GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num, false) then
|
if cost and hadNum == 0 and GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num, false) then
|
||||||
self.txNumOne:setText(cost.num)
|
self.txNumOne:setText(cost.num)
|
||||||
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM))
|
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM))
|
||||||
@ -401,7 +299,7 @@ function SummonMainUI:refreshSummonBtn()
|
|||||||
-- self.txNumTen:setText("<color=#EC3636>10</color>")
|
-- self.txNumTen:setText("<color=#EC3636>10</color>")
|
||||||
-- self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
|
-- self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
|
||||||
-- else
|
-- else
|
||||||
local cost = DataManager.SummonData:getSummonGemCost()
|
local cost = DataManager.SummonData:getSummonGemCost(self.page)
|
||||||
if cost and hadNum == 0 and GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num * 10, false) then
|
if cost and hadNum == 0 and GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num * 10, false) then
|
||||||
self.txNumTen:setText(cost.num * 10)
|
self.txNumTen:setText(cost.num * 10)
|
||||||
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM))
|
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM))
|
||||||
@ -421,28 +319,25 @@ function SummonMainUI:refreshWishBtn()
|
|||||||
self.descBg:setActive(false)
|
self.descBg:setActive(false)
|
||||||
else
|
else
|
||||||
self.descBg:setActive(true)
|
self.descBg:setActive(true)
|
||||||
local count = guarantee1 - DataManager.SummonData:getSummonTriggerCount()
|
local count = guarantee1 - DataManager.SummonData:getSummonTriggerCount(self.page)
|
||||||
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_4, count))
|
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_4, count))
|
||||||
end
|
end
|
||||||
-- local isAddRedPoint = false
|
local love = DataManager.SummonData:getSummonWishConfig(self.page)
|
||||||
-- if DataManager.SummonData:getIsActivity() then
|
if not love then
|
||||||
-- self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_HERO_DESC_3,count,
|
self.btnWish:setActive(false)
|
||||||
-- DataManager.ForceData:getForceName(DataManager.SummonData:getSummonWishConfig()[1]),
|
return
|
||||||
-- DataManager.ForceData:getForceName(DataManager.SummonData:getSummonWishConfig()[1])
|
end
|
||||||
-- ))
|
self.btnWish:setActive(true)
|
||||||
-- else
|
local summonCount = DataManager.SummonData:getSummonCount(self.page)
|
||||||
-- self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_4, count))
|
local unlockCount = DataManager.SummonData:getSummonWishUnlock(self.page)
|
||||||
-- end
|
self.isUnlock = summonCount >= unlockCount
|
||||||
-- local summonCount = DataManager.SummonData:getSummonCount()
|
|
||||||
-- local unlockCount = DataManager.SummonData:getSummonWishUnlock()
|
|
||||||
-- self.isUnlock = summonCount >= unlockCount
|
|
||||||
-- self.wishUnlock:setActive(self.isUnlock)
|
-- self.wishUnlock:setActive(self.isUnlock)
|
||||||
-- self.wishLock:setActive(not self.isUnlock)
|
-- self.wishLock:setActive(not self.isUnlock)
|
||||||
-- if self.isUnlock then
|
-- if self.isUnlock then
|
||||||
-- local wishHeroID = DataManager.SummonData:getSummonWishHeroId()
|
-- local wishHeroId = DataManager.SummonData:getSummonWishHeroId()
|
||||||
-- if wishHeroID ~= 0 then
|
-- if wishHeroId ~= 0 then
|
||||||
-- local modelId = DataManager.ForceData:getForceModelId(wishHeroID)
|
-- local modelId = DataManager.ForceData:getForceModelId(wishHeroId)
|
||||||
-- local qlt = DataManager.ForceData:getForceQlt(wishHeroID)
|
-- local qlt = DataManager.ForceData:getForceQlt(wishHeroId)
|
||||||
-- self.wishQlt:setActive(true)
|
-- self.wishQlt:setActive(true)
|
||||||
-- self.wishQlt:setSprite(GConst.ATLAS_PATH.ICON_ITEM, DataManager.ForceData:getForceQltItem(qlt))
|
-- self.wishQlt:setSprite(GConst.ATLAS_PATH.ICON_ITEM, DataManager.ForceData:getForceQltItem(qlt))
|
||||||
-- if self.wishModelId ~= modelId then
|
-- if self.wishModelId ~= modelId then
|
||||||
@ -450,7 +345,7 @@ function SummonMainUI:refreshWishBtn()
|
|||||||
-- end
|
-- end
|
||||||
-- if self.wishModelId ~= nil then
|
-- if self.wishModelId ~= nil then
|
||||||
-- self.imgWishIcon:setActive(true)
|
-- self.imgWishIcon:setActive(true)
|
||||||
-- self.imgWishIcon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, DataManager.ForceData:getForceFightIcon(wishHeroID))
|
-- self.imgWishIcon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, DataManager.ForceData:getForceFightIcon(wishHeroId))
|
||||||
-- else
|
-- else
|
||||||
-- self.imgWishIcon:setActive(false)
|
-- self.imgWishIcon:setActive(false)
|
||||||
-- end
|
-- end
|
||||||
@ -468,7 +363,7 @@ function SummonMainUI:refreshWishBtn()
|
|||||||
-- isAddRedPoint = true
|
-- isAddRedPoint = true
|
||||||
-- self.wishMask:setActive(false)
|
-- self.wishMask:setActive(false)
|
||||||
-- else
|
-- else
|
||||||
-- if wishHeroID ~= 0 then
|
-- if wishHeroId ~= 0 then
|
||||||
-- self.wishMask:setActive(true)
|
-- self.wishMask:setActive(true)
|
||||||
-- else
|
-- else
|
||||||
-- self.wishMask:setActive(false)
|
-- self.wishMask:setActive(false)
|
||||||
@ -490,7 +385,7 @@ end
|
|||||||
|
|
||||||
--检查单抽红点
|
--检查单抽红点
|
||||||
function SummonMainUI:refreshBtnRedPoint()
|
function SummonMainUI:refreshBtnRedPoint()
|
||||||
if DataManager.SummonData:hasSummonFree() then
|
if DataManager.SummonData:hasSummonFree(self.page) then
|
||||||
self.btnSummonFree:addRedPoint(124, 33, 1)
|
self.btnSummonFree:addRedPoint(124, 33, 1)
|
||||||
else
|
else
|
||||||
self.btnSummonFree:removeRedPoint()
|
self.btnSummonFree:removeRedPoint()
|
||||||
|
|||||||
@ -1,21 +1,29 @@
|
|||||||
local UIPrefabObject = require "app/bf/unity/uiprefab_object"
|
|
||||||
local SummonOddsUI = class("SummonOddsUI", BaseUI)
|
local SummonOddsUI = class("SummonOddsUI", BaseUI)
|
||||||
|
|
||||||
|
local UIPrefabObject = require "app/bf/unity/uiprefab_object"
|
||||||
|
local SummonHeroCell = "app/ui/summon/cell/summon_hero_cell"
|
||||||
|
|
||||||
function SummonOddsUI:isFullScreen()
|
function SummonOddsUI:isFullScreen()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SummonOddsUI:ctor(params)
|
||||||
|
self.page = params.summonId or 1
|
||||||
|
end
|
||||||
|
|
||||||
function SummonOddsUI:getPrefabPath()
|
function SummonOddsUI:getPrefabPath()
|
||||||
return "assets/prefabs/ui/summon/summon_odds_ui.prefab"
|
return "assets/prefabs/ui/summon/summon_odds_ui.prefab"
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonOddsUI:onLoadRootComplete()
|
function SummonOddsUI:onLoadRootComplete()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
|
uiMap["summon_odds_ui.bg.tx_title"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_3))
|
||||||
|
uiMap["summon_odds_ui.bg.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_3))
|
||||||
|
|
||||||
self.content = uiMap["summon_odds_ui.bg.target_node.bg.scrollrect.viewport.content"]
|
self.content = uiMap["summon_odds_ui.bg.target_node.bg.scrollrect.viewport.content"]
|
||||||
self.layout_content = self.content:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
self.layout_content = self.content:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
||||||
|
|
||||||
|
|
||||||
self.title = uiMap["summon_odds_ui.bg.target_node.bg.scrollrect.viewport.content.title"]
|
self.title = uiMap["summon_odds_ui.bg.target_node.bg.scrollrect.viewport.content.title"]
|
||||||
self.force_cell_summon = uiMap["summon_odds_ui.bg.target_node.bg.scrollrect.viewport.content.force_cell_summon"]
|
self.summonHeroCell = uiMap["summon_odds_ui.bg.scrollrect.viewport.content.summon_hero_cell"]
|
||||||
self.layout = uiMap["summon_odds_ui.bg.target_node.bg.scrollrect.viewport.content.layout"]
|
self.layout = uiMap["summon_odds_ui.bg.target_node.bg.scrollrect.viewport.content.layout"]
|
||||||
|
|
||||||
uiMap["summon_odds_ui.bg.target_node.bottom_bg.btn_close"]:addClickListener(function()
|
uiMap["summon_odds_ui.bg.target_node.bottom_bg.btn_close"]:addClickListener(function()
|
||||||
@ -26,15 +34,15 @@ end
|
|||||||
--@region 主界面刷新
|
--@region 主界面刷新
|
||||||
function SummonOddsUI:onRefresh()
|
function SummonOddsUI:onRefresh()
|
||||||
local tempGrouped = {}
|
local tempGrouped = {}
|
||||||
local weights = DataManager.SummonData:getSummonWeight()
|
local weights = DataManager.SummonData:getSummonWeight(self.page)
|
||||||
for _, entry in pairs(weights) do
|
for _, entry in pairs(weights) do
|
||||||
local qlt = DataManager.ForceData:getForceQlt(entry.id)
|
local qlt = DataManager.HeroData:getHeroQlt(entry.id)
|
||||||
if not tempGrouped[qlt] then
|
if not tempGrouped[qlt] then
|
||||||
tempGrouped[qlt] = {}
|
tempGrouped[qlt] = {}
|
||||||
end
|
end
|
||||||
table.insert(tempGrouped[qlt], entry.id)
|
table.insert(tempGrouped[qlt], entry.id)
|
||||||
end
|
end
|
||||||
local shows = DataManager.SummonData:getSummonShow()
|
local shows = DataManager.SummonData:getSummonShow(self.page)
|
||||||
self.shadowObjs = {}
|
self.shadowObjs = {}
|
||||||
self.layoutObjs = {}
|
self.layoutObjs = {}
|
||||||
for i, data in pairs(shows) do
|
for i, data in pairs(shows) do
|
||||||
@ -44,44 +52,41 @@ function SummonOddsUI:onRefresh()
|
|||||||
title_item:initPrefabHelper()
|
title_item:initPrefabHelper()
|
||||||
title_item:setActive(true)
|
title_item:setActive(true)
|
||||||
title_item:setParent(self.content, false)
|
title_item:setParent(self.content, false)
|
||||||
|
title_item:setLocalScale(0.9, 0.9, 0.9)
|
||||||
local uiMap = title_item:genAllChildren()
|
local uiMap = title_item:genAllChildren()
|
||||||
table.insert(self.shadowObjs, title_item)
|
table.insert(self.shadowObjs, title_item)
|
||||||
|
|
||||||
local tx_value = uiMap["title.tx_value"]
|
local descTx = uiMap["title.desc_tx"]
|
||||||
local bg = uiMap["title.bg"]
|
-- local bg = uiMap["title.bg"]
|
||||||
local txName = uiMap["title.bg.tx_name"]
|
-- local txName = uiMap["title.bg.tx_name"]
|
||||||
bg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_bg_" .. data[1])
|
-- bg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_bg_" .. data[1])
|
||||||
if i == 1 then
|
if i == 1 then
|
||||||
txName:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_QLT_2))
|
descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_3))
|
||||||
elseif i == 2 then
|
elseif i == 2 then
|
||||||
txName:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_QLT_3))
|
descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_4))
|
||||||
else
|
else
|
||||||
txName:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_QLT_4))
|
descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_5))
|
||||||
end
|
|
||||||
if tx_value then
|
|
||||||
tx_value:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_GET_DESC_3,data[2] / 100))
|
|
||||||
end
|
end
|
||||||
|
-- descTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_GET_DESC_3, data[2] / 100))
|
||||||
local layoutObj = CS.UnityEngine.Object.Instantiate(self.layout:getGameObject())
|
local layoutObj = CS.UnityEngine.Object.Instantiate(self.layout:getGameObject())
|
||||||
local layout_item = UIPrefabObject:create()
|
local layout_item = UIPrefabObject:create()
|
||||||
layout_item:initWithPrefab(GConst.EMPTY_STRING, layoutObj)
|
layout_item:initWithPrefab(GConst.EMPTY_STRING, layoutObj)
|
||||||
layout_item:initPrefabHelper()
|
layout_item:initPrefabHelper()
|
||||||
layout_item:setActive(true)
|
layout_item:setActive(true)
|
||||||
layout_item:setParent(self.content, false)
|
layout_item:setParent(self.content, false)
|
||||||
local gridLayout = layout_item:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_GRIDLAYOUT)
|
local gridLayout = layout_item:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_GRID_LAYOUT)
|
||||||
|
gridLayout.CellSize = BF.Vector2(150, 214)
|
||||||
table.insert(self.layoutObjs, layout_item)
|
table.insert(self.layoutObjs, layout_item)
|
||||||
local temp_id = tempGrouped[data[1]]
|
local temp_id = tempGrouped[data[1]]
|
||||||
for _, id in pairs(temp_id) do
|
for _, id in pairs(temp_id) do
|
||||||
local forceObj = CS.UnityEngine.Object.Instantiate(self.force_cell_summon:getGameObject())
|
local forceObj = CS.UnityEngine.Object.Instantiate(self.summonHeroCell:getGameObject())
|
||||||
local force_item = UIPrefabObject:create()
|
local force_item = UIPrefabObject:create()
|
||||||
force_item:initWithPrefab(GConst.EMPTY_STRING, forceObj)
|
force_item:initWithPrefab(GConst.EMPTY_STRING, forceObj)
|
||||||
force_item:initPrefabHelper()
|
force_item:initPrefabHelper()
|
||||||
force_item:setActive(true)
|
force_item:setActive(true)
|
||||||
force_item:setParent(layout_item, false)
|
force_item:setParent(layout_item, false)
|
||||||
local cell = force_item:addLuaComponent(GConst.TYPEOF_LUA_CLASS.FORCECELL)
|
local cell = force_item:addLuaComponent(SummonHeroCell)
|
||||||
cell:setShowType(GConst.ForceConst.PAGE_TYPE.WISH, function(heroID)
|
cell:refreshInfo(id)
|
||||||
self:SelectHero(heroID)
|
|
||||||
end)
|
|
||||||
cell:refresh(id)
|
|
||||||
end
|
end
|
||||||
gridLayout:RefreshLayout()
|
gridLayout:RefreshLayout()
|
||||||
layout_item:setSizeDeltaY(gridLayout:GetVerticalSize())
|
layout_item:setSizeDeltaY(gridLayout:GetVerticalSize())
|
||||||
@ -89,6 +94,7 @@ function SummonOddsUI:onRefresh()
|
|||||||
self.layout_content:RefreshLayout()
|
self.layout_content:RefreshLayout()
|
||||||
self.content:setSizeDeltaY(self.layout_content:GetVerticalSize())
|
self.content:setSizeDeltaY(self.layout_content:GetVerticalSize())
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonOddsUI:onClose()
|
function SummonOddsUI:onClose()
|
||||||
for _, obj in pairs(self.shadowObjs) do
|
for _, obj in pairs(self.shadowObjs) do
|
||||||
obj:destroy()
|
obj:destroy()
|
||||||
@ -97,4 +103,5 @@ function SummonOddsUI:onClose()
|
|||||||
obj:destroy()
|
obj:destroy()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return SummonOddsUI
|
return SummonOddsUI
|
||||||
|
|||||||
@ -1,106 +1,80 @@
|
|||||||
local SummonWishUI = class("SummonWishUI", BaseUI)
|
local SummonWishUI = class("SummonWishUI", BaseUI)
|
||||||
|
|
||||||
|
local SummonHeroCell = "app/ui/summon/cell/summon_hero_cell"
|
||||||
|
|
||||||
|
function SummonWishUI:isFullScreen()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonWishUI:ctor(params)
|
||||||
|
self.page = params.summonId or 1
|
||||||
|
end
|
||||||
|
|
||||||
function SummonWishUI:getPrefabPath()
|
function SummonWishUI:getPrefabPath()
|
||||||
return "assets/prefabs/ui/summon/summon_wish_ui.prefab"
|
return "assets/prefabs/ui/summon/summon_wish_ui.prefab"
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonWishUI:onLoadRootComplete()
|
function SummonWishUI:onLoadRootComplete()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
self.force_cell_wish = uiMap["summon_wish_ui.hero.Image.force_cell_wish"]
|
self.root:addClickListener(function()
|
||||||
self.select_wish = self.force_cell_wish:addLuaComponent(GConst.TYPEOF_LUA_CLASS.FORCECELL)
|
self:closeUI()
|
||||||
self.scrollrectPrefab = uiMap["summon_wish_ui.hero.content.bg.scrollrect"]
|
end)
|
||||||
self.scrollrect = self.scrollrectPrefab:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
uiMap["summon_wish_ui.bg.btn_close"]:addClickListener(function()
|
||||||
self.curPage = GConst.ForceConst.PAGE_TYPE.WISH --阵容设置页面
|
self:closeUI()
|
||||||
self.select_wish:setShowType(self.curPage)
|
end)
|
||||||
|
local okBtn = uiMap["summon_wish_ui.bg.ok_btn"]
|
||||||
|
self.descTx = uiMap["summon_wish_ui.bg.desc_tx"]
|
||||||
|
uiMap["summon_wish_ui.bg.tx_title"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_TITLE))
|
||||||
|
uiMap["summon_wish_ui.bg.ok_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_OK))
|
||||||
|
|
||||||
self.btn_close = uiMap["summon_wish_ui.hero.btn_close"]
|
self.selHeroCell = uiMap["summon_wish_ui.bg.summon_hero_cell"]:addLuaComponent(SummonHeroCell)
|
||||||
self.btn_sure = uiMap["summon_wish_ui.hero.btns.btn_sure"]
|
self.scrollrect = uiMap["summon_wish_ui.bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
self.wishHeroList = DataManager.SummonData:getSummonWishConfig()
|
self.scrollrect:addInitCallback(function()
|
||||||
self.txWishTips = uiMap["summon_wish_ui.hero.bg_1.tx_wish_tips"]
|
return SummonHeroCell
|
||||||
self.bg = uiMap["summon_wish_ui.bg"]
|
end)
|
||||||
|
self.scrollrect:addRefreshCallback(function(index, cell)
|
||||||
|
cell:refresh(self.wishHeroId, self.list[index], function (heroId)
|
||||||
|
if heroId == self.wishHeroId then
|
||||||
|
self.wishHeroId = nil
|
||||||
|
else
|
||||||
|
self.wishHeroId = heroId
|
||||||
|
end
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
self.scrollrect:clearCells()
|
||||||
|
|
||||||
self:_addListeners()
|
self.list = DataManager.SummonData:getSummonWishConfig(self.page)
|
||||||
end
|
self.wishHeroId = DataManager.SummonData:getSummonWishHeroId(self.page)
|
||||||
|
|
||||||
function SummonWishUI:_addListeners()
|
okBtn:addClickListener(function()
|
||||||
self.btn_close:addClickListener(function()
|
self:saveWish()
|
||||||
self:closeUI()
|
end)
|
||||||
end)
|
|
||||||
self.btn_sure:addClickListener(function()
|
|
||||||
self:SaveWish()
|
|
||||||
end)
|
|
||||||
self.bg:addClickListener(function()
|
|
||||||
self:closeUI()
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonWishUI:isFullScreen()
|
self:bind(DataManager.SummonData, "isDirty", function()
|
||||||
return false
|
self:onRefresh()
|
||||||
end
|
end)
|
||||||
|
|
||||||
function SummonWishUI:setParentUI(parentUI)
|
|
||||||
self.parentUI = parentUI
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonWishUI:onRefresh()
|
function SummonWishUI:onRefresh()
|
||||||
local selectSummonId = DataManager.SummonData:getSummonSeason()
|
if self.page == 1 then
|
||||||
if selectSummonId == 1 then
|
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_TIPS))
|
||||||
self.txWishTips:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_TIPS))
|
else
|
||||||
else
|
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_TIPS_2))
|
||||||
self.txWishTips:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_TIPS_2))
|
end
|
||||||
end
|
|
||||||
|
|
||||||
self:SelectHero(DataManager.SummonData:getSummonWishHeroId())
|
self.scrollrect:refillCells(#self.list)
|
||||||
self:_refreshHeroScrollrect()
|
|
||||||
|
self.selHeroCell:refresh(self.wishHeroId, self.wishHeroId, nil, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonWishUI:SaveWish()
|
function SummonWishUI:saveWish()
|
||||||
if self.wishHeroID == 0 then
|
if not self.wishHeroId or self.wishHeroId == 0 then
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_FORCE_CHOOSE_DESC_2))
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_FORCE_CHOOSE_DESC_2))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
ModuleManager.SummonManager:reqForceSummonWishSet(self.wishHeroID)
|
ModuleManager.SummonManager:onSummonWishSetReq(self.page, self.wishHeroId)
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end
|
|
||||||
|
|
||||||
function SummonWishUI:SelectHero(heroID)
|
|
||||||
if self.wishHeroID == heroID then
|
|
||||||
self.wishHeroID = 0
|
|
||||||
else
|
|
||||||
self.wishHeroID = heroID
|
|
||||||
end
|
|
||||||
self.force_cell_wish:setActive(self.wishHeroID ~= 0)
|
|
||||||
if self.wishHeroID ~= 0 then
|
|
||||||
self.select_wish:refresh(heroID)
|
|
||||||
end
|
|
||||||
self:_refreshHeroScrollrect()
|
|
||||||
end
|
|
||||||
|
|
||||||
--刷新滑动列表
|
|
||||||
function SummonWishUI:_refreshHeroScrollrect()
|
|
||||||
if not self.initOwnScrollrect then
|
|
||||||
self.initOwnScrollrect = true
|
|
||||||
|
|
||||||
self.scrollrect:addInitCallback(function()
|
|
||||||
return GConst.TYPEOF_LUA_CLASS.FORCECELL
|
|
||||||
end)
|
|
||||||
self.scrollrect:addRefreshCallback(function(index, cell)
|
|
||||||
cell:setShowType(self.curPage, function(heroID)
|
|
||||||
self:SelectHero(heroID)
|
|
||||||
end)
|
|
||||||
cell:refresh(self.wishHeroList[index])
|
|
||||||
if self.wishHeroList[index] ~= self.wishHeroID then
|
|
||||||
cell:setIsShowFlag(false)
|
|
||||||
else
|
|
||||||
cell:setIsShowFlag(true)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.scrollrect:clearCells()
|
|
||||||
self.scrollrect:refillCells(#self.wishHeroList)
|
|
||||||
else
|
|
||||||
self.scrollrect:clearCells()
|
|
||||||
self.scrollrect:refillCells(#self.wishHeroList)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return SummonWishUI
|
return SummonWishUI
|
||||||
|
|||||||
@ -8,7 +8,7 @@ function SummonData:ctor()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function SummonData:clear()
|
function SummonData:clear()
|
||||||
self.forceSummons = nil
|
self.summonDataMap = nil
|
||||||
self.data.isDirty = false
|
self.data.isDirty = false
|
||||||
DataManager:unregisterCrossDayFunc("SummonData")
|
DataManager:unregisterCrossDayFunc("SummonData")
|
||||||
end
|
end
|
||||||
@ -23,116 +23,145 @@ function SummonData:init(data)
|
|||||||
Logger.logHighlight("抽奖数据")
|
Logger.logHighlight("抽奖数据")
|
||||||
Logger.printTable(data)
|
Logger.printTable(data)
|
||||||
end
|
end
|
||||||
self.serverData = data
|
self:initData(data)
|
||||||
-- self:InitForceSummons()
|
|
||||||
self:setSummonSeason(1)
|
|
||||||
self:setDirty()
|
self:setDirty()
|
||||||
if not self.isInit then
|
if not self.isInit then
|
||||||
self.isInit = true
|
self.isInit = true
|
||||||
-- 跨天
|
-- 跨天
|
||||||
DataManager:registerCrossDayFunc("SummonData", function()
|
-- DataManager:registerCrossDayFunc("SummonData", function()
|
||||||
self:InitForceSummons()
|
-- self:setDirty()
|
||||||
self:setDirty()
|
-- end)
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function SummonData:InitForceSummons()
|
|
||||||
if not self.serverData then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
self.forceSummons = {} -- 上次免费抽的时间戳
|
|
||||||
for id, v in pairs(self.serverData) do
|
|
||||||
-- local activityId = SummonCfg[id).activity
|
|
||||||
-- if activityId == nil or DataManager.ActTimeData:getActTimeInfoByActId(activityId) then
|
|
||||||
-- self.forceSummons[id] = v
|
|
||||||
-- end
|
|
||||||
self.forceSummons[id] = v
|
|
||||||
end
|
|
||||||
-- 处理一下兼容
|
|
||||||
end
|
|
||||||
function SummonData:getSummonAllActivities()
|
|
||||||
local list = {}
|
|
||||||
for id, v in pairs(self.forceSummons) do
|
|
||||||
if id == 1 then
|
|
||||||
table.insert(list,id)
|
|
||||||
-- elseif DataManager.SummonActData:getIsOpen() then
|
|
||||||
-- table.insert(list,id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return list
|
|
||||||
end
|
|
||||||
-- 当前抽奖id time 2025-08-12 23:59:55
|
|
||||||
function SummonData:getSummonSeason()
|
|
||||||
-- if not DataManager.SummonActData:getTimeOpen() then
|
|
||||||
self:setSummonSeason(1)
|
|
||||||
-- end
|
|
||||||
return self.selectSummonId
|
|
||||||
end
|
|
||||||
function SummonData:setSummonSeason(summonId)
|
|
||||||
self:InitForceSummons()
|
|
||||||
if not self.forceSummons[summonId] then
|
|
||||||
summonId = 1
|
|
||||||
end
|
|
||||||
self.selectSummonId = summonId
|
|
||||||
self.forceSummon = self.forceSummons[self.selectSummonId]
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonData:isSummonOpen(summonId)
|
function SummonData:initData(data)
|
||||||
-- if self.forceSummons[summonId] and DataManager.SummonActData:getTimeOpen() then
|
self.summonDataMap = {}
|
||||||
-- return true
|
for k,v in pairs(data) do
|
||||||
-- end
|
self.summonDataMap[k] = {}
|
||||||
return false
|
self.summonDataMap[k].freeAt = v.free_at
|
||||||
end
|
self.summonDataMap[k].statCount = v.stat_count
|
||||||
function SummonData:getSummonOpenActivityId()
|
self.summonDataMap[k].triggerCount = v.trigger_count
|
||||||
self:InitForceSummons()
|
self.summonDataMap[k].wishId = v.wish_id
|
||||||
for id, v in pairs(SummonCfg) do
|
self.summonDataMap[k].wishCount = v.wish_count
|
||||||
if v.activity and self:isSummonOpen(id) then
|
|
||||||
return id
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return nil
|
-- int64 free_at = 1; // 上次免费抽取时间
|
||||||
|
-- int64 stat_count = 2; // 总抽取次数
|
||||||
|
-- int64 trigger_count = 3; // 保底累计次数
|
||||||
|
-- int32 wish_id = 4; // 心愿英雄 ID
|
||||||
|
-- int64 wish_count = 5; // 心愿累计次数
|
||||||
end
|
end
|
||||||
function SummonData:isOpenActivity()
|
|
||||||
-- if not self:isOpen() then
|
function SummonData:getIsOpen(showToast)
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
-- if not DataManager.SummonActData:getTimeOpen() then
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
-- local activityId = self:getSummonOpenActivityId()
|
|
||||||
-- if activityId then
|
|
||||||
-- return true
|
|
||||||
-- end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
function SummonData:isOpen(showToast)
|
|
||||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.SUMMON_FORCE, not showToast) then
|
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.SUMMON_FORCE, not showToast) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonData:getSummonUnlock()
|
--@region 抽奖数据
|
||||||
local list = {}
|
--是否有免费抽奖
|
||||||
for k, v in pairs(self.newSummonMap or {}) do
|
function SummonData:hasSummonFree(summonType)
|
||||||
if v == true then
|
local freeCd = self:getSummonFreeCd(summonType)
|
||||||
table.insert(list, k)
|
if freeCd == nil then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local freeTime = self:getSummonFreeAT(summonType)
|
||||||
|
if freeTime == nil then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
local nowTime = Time:getServerTime()
|
||||||
|
return nowTime > freeTime + freeCd * 3600
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 心愿次数
|
||||||
|
function SummonData:getSummonWishCount(summonType)
|
||||||
|
if self.summonDataMap[summonType] then
|
||||||
|
return self.summonDataMap[summonType].wishCount or 0
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取心愿英雄id
|
||||||
|
function SummonData:getSummonWishHeroId(summonType)
|
||||||
|
if self.summonDataMap[summonType] then
|
||||||
|
return self.summonDataMap[summonType].wishId
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取上一次抽奖的时间
|
||||||
|
function SummonData:getSummonFreeAT(summonType)
|
||||||
|
if self.summonDataMap[summonType] then
|
||||||
|
return self.summonDataMap[summonType].freeAt
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 保底累计次数
|
||||||
|
function SummonData:getSummonTriggerCount(summonType)
|
||||||
|
if self.summonDataMap[summonType] then
|
||||||
|
return self.summonDataMap[summonType].triggerCount or 0
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取抽奖总次数
|
||||||
|
function SummonData:getSummonCount(summonType)
|
||||||
|
if self.summonDataMap[summonType] then
|
||||||
|
return self.summonDataMap[summonType].statCount or 0
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 重新设置英雄成功过
|
||||||
|
function SummonData:updateSummonWishHeroId(summonType, id)
|
||||||
|
if self.summonDataMap[summonType] then
|
||||||
|
if self.summonDataMap[summonType].wishId == id then
|
||||||
|
self.summonDataMap[summonType].wishId = nil
|
||||||
|
else
|
||||||
|
self.summonDataMap[summonType].wishId = id
|
||||||
|
end
|
||||||
|
self:setDirty()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonData:summonWishClaim(summonType)
|
||||||
|
if self.summonDataMap[summonType] then
|
||||||
|
self.summonDataMap[summonType].wishCount = self.summonDataMap[summonType].wishCount - 100
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 刷新抽奖次数
|
||||||
|
function SummonData:updateSummonCount(summonType, times, at)
|
||||||
|
if self.summonDataMap[summonType] then
|
||||||
|
if at ~= nil then
|
||||||
|
self.summonDataMap[summonType].freeAt = at
|
||||||
|
end
|
||||||
|
local unlockTimes = self:getSummonWishUnlock(summonType)
|
||||||
|
if unlockTimes and self.summonDataMap[summonType].statCount + times >= unlockTimes then
|
||||||
|
if self.summonDataMap[summonType].statCount < unlockTimes then
|
||||||
|
self.summonDataMap[summonType].wishCount = self.summonDataMap[summonType].wishCount + times -
|
||||||
|
(unlockTimes - self.summonDataMap[summonType].statCount)
|
||||||
|
else
|
||||||
|
self.summonDataMap[summonType].wishCount = self.summonDataMap[summonType].wishCount + times
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.summonDataMap[summonType].statCount = self.summonDataMap[summonType].statCount + times
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonData:setSummonTrigger(summonType, isReset)
|
||||||
|
if isReset then
|
||||||
|
self.summonDataMap[summonType].triggerCount = 0
|
||||||
|
else
|
||||||
|
self.summonDataMap[summonType].triggerCount = self.summonDataMap[summonType].triggerCount + 1
|
||||||
|
local max = SummonCfg[summonType].guarantee1
|
||||||
|
if self.summonDataMap[summonType].triggerCount >= max then
|
||||||
|
self.summonDataMap[summonType].triggerCount = self.summonDataMap[summonType].triggerCount - max
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.newSummonMap = {}
|
|
||||||
return list
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonData:addSummonUnlockItemCount(count)
|
|
||||||
self.newSummonCount = (self.newSummonCount or 0) + count
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonData:getSummonUnlockItemCount()
|
|
||||||
local count = self.newSummonCount or 0
|
|
||||||
self.newSummonCount = 0
|
|
||||||
return count
|
|
||||||
end
|
end
|
||||||
|
--@endregion
|
||||||
|
|
||||||
|
--@region 红点
|
||||||
function SummonData:hasSummonCostRedPoint(count)
|
function SummonData:hasSummonCostRedPoint(count)
|
||||||
if count then
|
if count then
|
||||||
local itemCost = self:getSummonItemCost()
|
local itemCost = self:getSummonItemCost()
|
||||||
@ -166,179 +195,9 @@ function SummonData:hasSummonCostRedPoint(count)
|
|||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
--@endregion
|
||||||
|
|
||||||
--是否有免费抽奖
|
--@region 获取消耗
|
||||||
function SummonData:hasSummonFree(id)
|
|
||||||
if self:getSummonFreeCD(id) == nil then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
local freeTime = self:getSummonFreeAT(id)
|
|
||||||
if freeTime == nil then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return not Time:getTimeIsToday(freeTime)
|
|
||||||
end
|
|
||||||
|
|
||||||
--region 配置
|
|
||||||
function SummonData:getSummonConfig(id)
|
|
||||||
if id then
|
|
||||||
return SummonCfg[id]
|
|
||||||
else
|
|
||||||
return SummonCfg
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonData:getSummonPageName(id)
|
|
||||||
if self:getIsActivity(id) then
|
|
||||||
return "ACT_HERO_DESC_2"
|
|
||||||
end
|
|
||||||
return "SUMMON_DESC_14"
|
|
||||||
end
|
|
||||||
function SummonData:getSummonSuitName(id)
|
|
||||||
local activityId = SummonCfg[id or self:getSummonSeason()].activity
|
|
||||||
if activityId then
|
|
||||||
local cfg = ConfigManager:getConfig("activity")[activityId]
|
|
||||||
if cfg then
|
|
||||||
return cfg.act_name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
----- 获取概率
|
|
||||||
function SummonData:getIsActivity(id)
|
|
||||||
return SummonCfg[id or self:getSummonSeason()].activity
|
|
||||||
end
|
|
||||||
----- 获取概率
|
|
||||||
function SummonData:getSummonShow()
|
|
||||||
return SummonCfg[self:getSummonSeason()].show
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取权重
|
|
||||||
function SummonData:getSummonWeight()
|
|
||||||
return SummonCfg[self:getSummonSeason()].weight
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取单抽消耗
|
|
||||||
function SummonData:getSummonItemCost(id)
|
|
||||||
return SummonCfg[id or self:getSummonSeason()].item_cost
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取单抽钻石消耗
|
|
||||||
function SummonData:getSummonGemCost()
|
|
||||||
return SummonCfg[self:getSummonSeason()].cost
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonData:getSummonWishUnlock()
|
|
||||||
return SummonCfg[self:getSummonSeason()].guarantee3
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 心愿英雄列表
|
|
||||||
function SummonData:getSummonWishConfig()
|
|
||||||
return SummonCfg[self:getSummonSeason()].love
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 心愿保底次数
|
|
||||||
function SummonData:getSummonWishGuarantee()
|
|
||||||
return SummonCfg[self:getSummonSeason()].guarantee2
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonData:getSummonFreeCD(id)
|
|
||||||
return SummonCfg[id or self:getSummonSeason()].timing
|
|
||||||
end
|
|
||||||
-- spine, spine_position, bg, act_txt_key, act_txt_position
|
|
||||||
function SummonData:getSummonSpineInfo()
|
|
||||||
local cfg = SummonCfg[self:getSummonSeason()]
|
|
||||||
if cfg then
|
|
||||||
return cfg.spine, cfg.spine_position, cfg.bg, cfg.act_txt_key, cfg.act_txt_position
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--endregion
|
|
||||||
|
|
||||||
-- 心愿次数
|
|
||||||
function SummonData:getSummonWishCount()
|
|
||||||
if self.forceSummon then
|
|
||||||
return self.forceSummon.wish_count or 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取心愿英雄id
|
|
||||||
function SummonData:getSummonWishHeroId()
|
|
||||||
if self.forceSummon then
|
|
||||||
return self.forceSummon.wish_id
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取上一次抽奖的时间
|
|
||||||
function SummonData:getSummonFreeAT(id)
|
|
||||||
if id then
|
|
||||||
local cfg = self.forceSummons[id]
|
|
||||||
if cfg then
|
|
||||||
return cfg.free_at
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if self.forceSummon then
|
|
||||||
return self.forceSummon.free_at
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 保底累计次数
|
|
||||||
function SummonData:getSummonTriggerCount()
|
|
||||||
if self.forceSummon then
|
|
||||||
return self.forceSummon.trigger_count or 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取抽奖总次数
|
|
||||||
function SummonData:getSummonCount()
|
|
||||||
if self.forceSummon then
|
|
||||||
return self.forceSummon.stat_count or 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 重新设置英雄成功过
|
|
||||||
function SummonData:updateSummonWishHeroId(id)
|
|
||||||
if self.forceSummon then
|
|
||||||
self.forceSummon.wish_id = id
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonData:summonWishClaim()
|
|
||||||
if self.forceSummon then
|
|
||||||
self.forceSummon.wish_count = self.forceSummon.wish_count - 100
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 刷新抽奖次数
|
|
||||||
function SummonData:updateSummonCount(times, at)
|
|
||||||
if self.forceSummon then
|
|
||||||
if at ~= nil then
|
|
||||||
self.forceSummon.free_at = at
|
|
||||||
end
|
|
||||||
local unlockTimes = self:getSummonWishUnlock()
|
|
||||||
if unlockTimes and self.forceSummon.stat_count + times >= unlockTimes then
|
|
||||||
if self.forceSummon.stat_count < unlockTimes then
|
|
||||||
self.forceSummon.wish_count = self.forceSummon.wish_count + times -
|
|
||||||
(unlockTimes - self.forceSummon.stat_count)
|
|
||||||
else
|
|
||||||
self.forceSummon.wish_count = self.forceSummon.wish_count + times
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.forceSummon.stat_count = self.forceSummon.stat_count + times
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonData:setSummonTrigger(isReset)
|
|
||||||
if isReset then
|
|
||||||
self.forceSummon.trigger_count = 0
|
|
||||||
else
|
|
||||||
self.forceSummon.trigger_count = self.forceSummon.trigger_count + 1
|
|
||||||
local max = SummonCfg[self:getSummonSeason()].guarantee1
|
|
||||||
if self.forceSummon.trigger_count >= max then
|
|
||||||
self.forceSummon.trigger_count = self.forceSummon.trigger_count - max
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取当前所需的抽卡消耗
|
-- 获取当前所需的抽卡消耗
|
||||||
function SummonData:getSummonCosts(summonType, count)
|
function SummonData:getSummonCosts(summonType, count)
|
||||||
local costs = {}
|
local costs = {}
|
||||||
@ -375,5 +234,57 @@ function SummonData:getSummonCosts(summonType, count)
|
|||||||
-- end
|
-- end
|
||||||
return costs
|
return costs
|
||||||
end
|
end
|
||||||
|
--@endregion
|
||||||
|
|
||||||
|
--@region 配置
|
||||||
|
function SummonData:getSummonConfig(id)
|
||||||
|
if id then
|
||||||
|
return SummonCfg[id]
|
||||||
|
else
|
||||||
|
return SummonCfg
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
----- 获取概率
|
||||||
|
function SummonData:getSummonShow(summonType)
|
||||||
|
return SummonCfg[summonType].show
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取单抽消耗
|
||||||
|
function SummonData:getSummonItemCost(summonType)
|
||||||
|
return SummonCfg[summonType].item_cost
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取单抽钻石消耗
|
||||||
|
function SummonData:getSummonGemCost(summonType)
|
||||||
|
return SummonCfg[summonType].cost
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonData:getSummonWishUnlock(summonType)
|
||||||
|
return SummonCfg[summonType].guarantee3
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 心愿英雄列表
|
||||||
|
function SummonData:getSummonWishConfig(summonType)
|
||||||
|
return SummonCfg[summonType].love
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 心愿保底次数
|
||||||
|
function SummonData:getSummonWishGuarantee(summonType)
|
||||||
|
return SummonCfg[summonType].guarantee2
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonData:getSummonFreeCd(summonType)
|
||||||
|
return SummonCfg[summonType].ad_time
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonData:getSummonFreeCd(summonType)
|
||||||
|
return SummonCfg[summonType].ad_time
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonData:getSummonWeight(summonType)
|
||||||
|
return SummonCfg[summonType].summon
|
||||||
|
end
|
||||||
|
--@endregion
|
||||||
|
|
||||||
return SummonData
|
return SummonData
|
||||||
Loading…
x
Reference in New Issue
Block a user