diff --git a/lua/app/config/localization/localization_global_const.lua b/lua/app/config/localization/localization_global_const.lua
index 54480157..1bfcbc5a 100644
--- a/lua/app/config/localization/localization_global_const.lua
+++ b/lua/app/config/localization/localization_global_const.lua
@@ -640,7 +640,16 @@ local LocalizationGlobalConst =
ITEM_NOT_ENOUGH_DESC = "ITEM_NOT_ENOUGH_DESC",
SUMMON_ONE = "SUMMON_ONE",
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
\ No newline at end of file
diff --git a/lua/app/config/strings/cn/global.lua b/lua/app/config/strings/cn/global.lua
index 232a3504..f735c66f 100644
--- a/lua/app/config/strings/cn/global.lua
+++ b/lua/app/config/strings/cn/global.lua
@@ -640,7 +640,16 @@ local localization_global =
["ITEM_NOT_ENOUGH_DESC"] = "是否使用钻石*{0}补充魔法石*{1},进行召唤?",
["SUMMON_ONE"] = "召唤1次",
["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"] = "每召唤100次必得心愿大奖:传说英雄",
+ ["SUMMON_WISH_TIPS_2"] = "每召唤100次必得心愿大奖:神话英雄",
+ ["BATTLE_FORCE_CHOOSE_DESC_2"] = "请选择想要的奖励",
+ ["SUMMON_WISH_LOCK"] = "未解锁心愿",
+ ["SUMMON_FORCE_3"] = "概率",
}
return localization_global
\ No newline at end of file
diff --git a/lua/app/module/summon/summon_manager.lua b/lua/app/module/summon/summon_manager.lua
index b83698a8..546682e0 100644
--- a/lua/app/module/summon/summon_manager.lua
+++ b/lua/app/module/summon/summon_manager.lua
@@ -15,21 +15,17 @@ function SummonManager:showSummonMainUI(summonId)
UIManager:showUI("app/ui/summon/summon_main_ui", {summonId = summonId})
end
--- function SummonManager:showSummonWishUI()
--- UIManager:showUI("app/ui/summon/summon_wish_ui")
--- end
+function SummonManager:showSummonWishUI(summonId)
+ UIManager:showUI("app/ui/summon/summon_wish_ui", {summonId = summonId})
+end
function SummonManager:showSummonRewardUI(params)
UIManager:showUI("app/ui/summon/summon_reward_ui", params)
end
--- function SummonManager:showSummonOddsUI()
--- UIManager:showUI("app/ui/summon/summon_odds_ui")
--- end
-
--- function SummonManager:showSummonOddsUI()
--- UIManager:showUI("app/ui/summon/summon_odds_ui")
--- end
+function SummonManager:showSummonOddsUI(summonId)
+ UIManager:showUI("app/ui/summon/summon_odds_ui", {summonId = summonId})
+end
-- function SummonManager:showSummonResultUI(params)
-- UIManager:showUI("app/ui/summon/summon_result_ui", params)
@@ -52,7 +48,7 @@ function SummonManager:onForceSummonRsp(result)
if result.reqData.free then
time_at = Time:getServerTime()
end
- DataManager.SummonData:updateSummonCount(result.reqData.times, time_at)
+ DataManager.SummonData:updateSummonCount(result.reqData.id, result.reqData.times, time_at)
local newForce = {}
-- for _, reward in pairs(result.rewards) do
-- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
@@ -84,38 +80,38 @@ end
--@endregion
-function SummonManager:reqForceSummonWishSet(heroId)
- self:sendMessage(ProtoMsgType.FromMsgEnum.ForceSummonWishSetReq, { id = DataManager.SummonData:getSummonSeason(), force = heroId }, self.rspForceSummonWishSet,
+function SummonManager:onSummonWishSetReq(summonType, heroId)
+ self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishSetReq, {id = summonType, hero = heroId}, {}, self.onSummonWishSetRsp,
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
end
-function SummonManager:rspForceSummonWishSet(result)
+function SummonManager:onSummonWishSetRsp(result)
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
return
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)
end
-function SummonManager:forceSummonWishClaimReq()
- self:sendMessage(ProtoMsgType.FromMsgEnum.ForceSummonWishClaimReq, { id = DataManager.SummonData:getSummonSeason() }, self.ForceSummonWishClaimRsp,
+function SummonManager:onSummonWishClaimReq(summonType)
+ self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishClaimReq, {id = summonType}, {}, self.onSummonWishClaimRsp,
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
end
-function SummonManager:ForceSummonWishClaimRsp(result)
+function SummonManager:onSummonWishClaimRsp(result)
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
return
end
DataManager.SummonData:summonWishClaim()
- local newForce = {}
- for _, reward in pairs(result.rewards) do
- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
- if isNew then
- table.insert(newForce, reward.item.id)
- DataManager.ForceData:setForceIsNew(reward.item.id, false)
- end
- end
- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON_WISH_CLAIM, result,newForce)
+ -- local newForce = {}
+ -- for _, reward in pairs(result.rewards) do
+ -- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
+ -- if isNew then
+ -- table.insert(newForce, reward.item.id)
+ -- DataManager.ForceData:setForceIsNew(reward.item.id, false)
+ -- end
+ -- end
+ -- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON_WISH_CLAIM, result,newForce)
end
diff --git a/lua/app/ui/main_city/component/main_comp.lua b/lua/app/ui/main_city/component/main_comp.lua
index 4f607731..bf272072 100644
--- a/lua/app/ui/main_city/component/main_comp.lua
+++ b/lua/app/ui/main_city/component/main_comp.lua
@@ -148,7 +148,7 @@ function MainComp:init()
ModuleManager.IdleManager:showIdleDropUI()
end)
self.rightBtn:addClickListener(function()
- ModuleManager.SummonManager:showSummonMainUI(DataManager.SummonData:getSummonOpenActivityId())
+ ModuleManager.SummonManager:showSummonMainUI()
end)
end
diff --git a/lua/app/ui/summon/cell/summon_ball_cell.lua b/lua/app/ui/summon/cell/summon_ball_cell.lua
deleted file mode 100755
index 9f2b0ff5..00000000
--- a/lua/app/ui/summon/cell/summon_ball_cell.lua
+++ /dev/null
@@ -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
\ No newline at end of file
diff --git a/lua/app/ui/summon/cell/summon_btn_cell.lua b/lua/app/ui/summon/cell/summon_btn_cell.lua
deleted file mode 100755
index 09e620c8..00000000
--- a/lua/app/ui/summon/cell/summon_btn_cell.lua
+++ /dev/null
@@ -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
\ No newline at end of file
diff --git a/lua/app/ui/summon/cell/summon_btn_cell.lua.meta b/lua/app/ui/summon/cell/summon_btn_cell.lua.meta
deleted file mode 100644
index 19f001c4..00000000
--- a/lua/app/ui/summon/cell/summon_btn_cell.lua.meta
+++ /dev/null
@@ -1,10 +0,0 @@
-fileFormatVersion: 2
-guid: 5ba41e7a4f0cfcd4ca0970ced19380d6
-ScriptedImporter:
- internalIDToNameTable: []
- externalObjects: {}
- serializedVersion: 2
- userData:
- assetBundleName:
- assetBundleVariant:
- script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/summon/cell/summon_hero_cell.lua b/lua/app/ui/summon/cell/summon_hero_cell.lua
new file mode 100755
index 00000000..08f6151e
--- /dev/null
+++ b/lua/app/ui/summon/cell/summon_hero_cell.lua
@@ -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
\ No newline at end of file
diff --git a/lua/app/ui/summon/cell/summon_ball_cell.lua.meta b/lua/app/ui/summon/cell/summon_hero_cell.lua.meta
similarity index 86%
rename from lua/app/ui/summon/cell/summon_ball_cell.lua.meta
rename to lua/app/ui/summon/cell/summon_hero_cell.lua.meta
index b64ad4e8..a7e18df5 100644
--- a/lua/app/ui/summon/cell/summon_ball_cell.lua.meta
+++ b/lua/app/ui/summon/cell/summon_hero_cell.lua.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 8b5f42f2240050b499465cee7ae15f45
+guid: 25796065cfaf148438b1f00f7fb57d8f
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
diff --git a/lua/app/ui/summon/summon_main_ui.lua b/lua/app/ui/summon/summon_main_ui.lua
index 7b02b7f5..88c107fb 100755
--- a/lua/app/ui/summon/summon_main_ui.lua
+++ b/lua/app/ui/summon/summon_main_ui.lua
@@ -11,7 +11,6 @@ local SummonMainUI = class("SummonMainUI", BaseUI)
function SummonMainUI:ctor(params)
self.page = params.summonId or 1
- DataManager.SummonData:setSummonSeason(params.summonId or 1)
self._bgVfxMap = {}
end
@@ -23,8 +22,7 @@ function SummonMainUI:currencyParams()
local ItemConst = require "app/module/item/item_const"
local params = {}
params.showType = GConst.CURRENCY_TYPE.HORIZONTAL
- local selectPage = DataManager.SummonData:getSummonSeason()
- if selectPage == 1 then
+ if self.page == 1 then
params.itemIds = {
ItemConst.ITEM_ID_GOLD,
ItemConst.ITEM_ID_GEM,
@@ -69,12 +67,7 @@ function SummonMainUI:onLoadRootComplete()
self.txFreeTime = uiMap["summon_main_ui.node.tx_free_time"]
- -- self.btnWish = uiMap["summon_main_ui.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.btnWish = uiMap["summon_main_ui.node.btn_wish"] --心愿
-- self.toggleJump = uiMap["summon_main_ui.jump_tween"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TOGGLE)
-- self.isJumpTween = self.toggleJump.isOn
@@ -109,6 +102,9 @@ function SummonMainUI:onLoadRootComplete()
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_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.descTx = uiMap["summon_main_ui.node.desc_bg.desc_tx"]
-- self.spineHero = {}
@@ -140,22 +136,11 @@ function SummonMainUI:onLoadRootComplete()
return
end
self.page = i
- -- local summonList = DataManager.SummonData:getSummonAllActivities()
- -- DataManager.SummonData:setSummonSeason(summonList[i])
self:onRefresh()
UIManager:updateBarsState(self)
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:refreshWishBtn()
@@ -177,35 +162,40 @@ function SummonMainUI:_bind()
end
self:refreshWishBtn()
end)
-end
-function SummonMainUI:_addListeners()
- -- self.btnWish:addClickListener(function()
- -- if self.isUnlock then
- -- local wishHeroID = DataManager.SummonData:getSummonWishHeroId()
- -- local wishGuarantee = DataManager.SummonData:getSummonWishGuarantee()
- -- local wishCount = DataManager.SummonData:getSummonWishCount()
- -- if wishCount >= wishGuarantee and wishHeroID ~= 0 then
- -- --发送领取奖励的协议
- -- ModuleManager.SummonManager:forceSummonWishClaimReq()
- -- else
- -- --打开设置心愿界面
- -- ModuleManager.SummonManager:showSummonWishUI()
- -- end
- -- else
- -- GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_LOCK))
- -- end
- -- end)
- -- self:bind(DataManager.SummonData, "isDirty", function()
- -- self:refreshWishBtn()
- -- end)
+
+ self.btnWish:addClickListener(function()
+ if self.isUnlock then
+ local wishHeroId = DataManager.SummonData:getSummonWishHeroId(self.page)
+ local wishGuarantee = DataManager.SummonData:getSummonWishGuarantee(self.page)
+ local wishCount = DataManager.SummonData:getSummonWishCount(self.page)
+ if wishCount >= wishGuarantee and wishHeroId ~= 0 then
+ --发送领取奖励的协议
+ ModuleManager.SummonManager:onSummonWishClaimReq()
+ else
+ --打开设置心愿界面
+ ModuleManager.SummonManager:showSummonWishUI(self.page)
+ end
+ else
+ GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_LOCK))
+ end
+ end)
+ self:bind(DataManager.SummonData, "isDirty", function()
+ self:refreshWishBtn()
+ end)
-- self:bind(DataManager.ActTimeData, "isDirty", function()
-- self:onRefresh()
-- end)
+
+ self:scheduleGlobal(function()
+ self:updateTime()
+ end, 1)
+ self:updateTime()
+
end
--每秒刷新单抽红点
function SummonMainUI:updateTime()
- local isFree = DataManager.SummonData:hasSummonFree()
+ local isFree = DataManager.SummonData:hasSummonFree(self.page)
if self.isFree ~= isFree then
self.isFree = isFree
self:onRefresh()
@@ -262,98 +252,6 @@ function SummonMainUI:refreshPageBtn()
-- 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()
local isFree = DataManager.SummonData:hasSummonFree(self.page)
@@ -377,7 +275,7 @@ function SummonMainUI:refreshSummonBtn()
-- self.txNumOne:setText("1")
-- self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
-- 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
self.txNumOne:setText(cost.num)
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM))
@@ -401,7 +299,7 @@ function SummonMainUI:refreshSummonBtn()
-- self.txNumTen:setText("10")
-- self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
-- 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
self.txNumTen:setText(cost.num * 10)
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM))
@@ -421,28 +319,25 @@ function SummonMainUI:refreshWishBtn()
self.descBg:setActive(false)
else
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))
end
- -- local isAddRedPoint = false
- -- if DataManager.SummonData:getIsActivity() then
- -- self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_HERO_DESC_3,count,
- -- DataManager.ForceData:getForceName(DataManager.SummonData:getSummonWishConfig()[1]),
- -- DataManager.ForceData:getForceName(DataManager.SummonData:getSummonWishConfig()[1])
- -- ))
- -- else
- -- self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_4, count))
- -- end
- -- local summonCount = DataManager.SummonData:getSummonCount()
- -- local unlockCount = DataManager.SummonData:getSummonWishUnlock()
- -- self.isUnlock = summonCount >= unlockCount
+ local love = DataManager.SummonData:getSummonWishConfig(self.page)
+ if not love then
+ self.btnWish:setActive(false)
+ return
+ end
+ self.btnWish:setActive(true)
+ local summonCount = DataManager.SummonData:getSummonCount(self.page)
+ local unlockCount = DataManager.SummonData:getSummonWishUnlock(self.page)
+ self.isUnlock = summonCount >= unlockCount
-- self.wishUnlock:setActive(self.isUnlock)
-- self.wishLock:setActive(not self.isUnlock)
-- if self.isUnlock then
- -- local wishHeroID = DataManager.SummonData:getSummonWishHeroId()
- -- if wishHeroID ~= 0 then
- -- local modelId = DataManager.ForceData:getForceModelId(wishHeroID)
- -- local qlt = DataManager.ForceData:getForceQlt(wishHeroID)
+ -- local wishHeroId = DataManager.SummonData:getSummonWishHeroId()
+ -- if wishHeroId ~= 0 then
+ -- local modelId = DataManager.ForceData:getForceModelId(wishHeroId)
+ -- local qlt = DataManager.ForceData:getForceQlt(wishHeroId)
-- self.wishQlt:setActive(true)
-- self.wishQlt:setSprite(GConst.ATLAS_PATH.ICON_ITEM, DataManager.ForceData:getForceQltItem(qlt))
-- if self.wishModelId ~= modelId then
@@ -450,7 +345,7 @@ function SummonMainUI:refreshWishBtn()
-- end
-- if self.wishModelId ~= nil then
-- 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
-- self.imgWishIcon:setActive(false)
-- end
@@ -468,7 +363,7 @@ function SummonMainUI:refreshWishBtn()
-- isAddRedPoint = true
-- self.wishMask:setActive(false)
-- else
- -- if wishHeroID ~= 0 then
+ -- if wishHeroId ~= 0 then
-- self.wishMask:setActive(true)
-- else
-- self.wishMask:setActive(false)
@@ -490,7 +385,7 @@ end
--检查单抽红点
function SummonMainUI:refreshBtnRedPoint()
- if DataManager.SummonData:hasSummonFree() then
+ if DataManager.SummonData:hasSummonFree(self.page) then
self.btnSummonFree:addRedPoint(124, 33, 1)
else
self.btnSummonFree:removeRedPoint()
diff --git a/lua/app/ui/summon/summon_odds_ui.lua b/lua/app/ui/summon/summon_odds_ui.lua
index 0374fe8f..25076380 100755
--- a/lua/app/ui/summon/summon_odds_ui.lua
+++ b/lua/app/ui/summon/summon_odds_ui.lua
@@ -1,21 +1,29 @@
-local UIPrefabObject = require "app/bf/unity/uiprefab_object"
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()
return false
end
+function SummonOddsUI:ctor(params)
+ self.page = params.summonId or 1
+end
+
function SummonOddsUI:getPrefabPath()
return "assets/prefabs/ui/summon/summon_odds_ui.prefab"
end
function SummonOddsUI:onLoadRootComplete()
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.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.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"]
uiMap["summon_odds_ui.bg.target_node.bottom_bg.btn_close"]:addClickListener(function()
@@ -26,15 +34,15 @@ end
--@region 主界面刷新
function SummonOddsUI:onRefresh()
local tempGrouped = {}
- local weights = DataManager.SummonData:getSummonWeight()
+ local weights = DataManager.SummonData:getSummonWeight(self.page)
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
tempGrouped[qlt] = {}
end
table.insert(tempGrouped[qlt], entry.id)
end
- local shows = DataManager.SummonData:getSummonShow()
+ local shows = DataManager.SummonData:getSummonShow(self.page)
self.shadowObjs = {}
self.layoutObjs = {}
for i, data in pairs(shows) do
@@ -44,44 +52,41 @@ function SummonOddsUI:onRefresh()
title_item:initPrefabHelper()
title_item:setActive(true)
title_item:setParent(self.content, false)
+ title_item:setLocalScale(0.9, 0.9, 0.9)
local uiMap = title_item:genAllChildren()
table.insert(self.shadowObjs, title_item)
- local tx_value = uiMap["title.tx_value"]
- local bg = uiMap["title.bg"]
- local txName = uiMap["title.bg.tx_name"]
- bg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_bg_" .. data[1])
+ local descTx = uiMap["title.desc_tx"]
+ -- local bg = uiMap["title.bg"]
+ -- local txName = uiMap["title.bg.tx_name"]
+ -- bg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_bg_" .. data[1])
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
- txName:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_QLT_3))
+ descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_4))
else
- txName:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_QLT_4))
- end
- if tx_value then
- tx_value:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_GET_DESC_3,data[2] / 100))
+ descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_5))
end
+ -- descTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_GET_DESC_3, data[2] / 100))
local layoutObj = CS.UnityEngine.Object.Instantiate(self.layout:getGameObject())
local layout_item = UIPrefabObject:create()
layout_item:initWithPrefab(GConst.EMPTY_STRING, layoutObj)
layout_item:initPrefabHelper()
layout_item:setActive(true)
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)
local temp_id = tempGrouped[data[1]]
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()
force_item:initWithPrefab(GConst.EMPTY_STRING, forceObj)
force_item:initPrefabHelper()
force_item:setActive(true)
force_item:setParent(layout_item, false)
- local cell = force_item:addLuaComponent(GConst.TYPEOF_LUA_CLASS.FORCECELL)
- cell:setShowType(GConst.ForceConst.PAGE_TYPE.WISH, function(heroID)
- self:SelectHero(heroID)
- end)
- cell:refresh(id)
+ local cell = force_item:addLuaComponent(SummonHeroCell)
+ cell:refreshInfo(id)
end
gridLayout:RefreshLayout()
layout_item:setSizeDeltaY(gridLayout:GetVerticalSize())
@@ -89,6 +94,7 @@ function SummonOddsUI:onRefresh()
self.layout_content:RefreshLayout()
self.content:setSizeDeltaY(self.layout_content:GetVerticalSize())
end
+
function SummonOddsUI:onClose()
for _, obj in pairs(self.shadowObjs) do
obj:destroy()
@@ -97,4 +103,5 @@ function SummonOddsUI:onClose()
obj:destroy()
end
end
+
return SummonOddsUI
diff --git a/lua/app/ui/summon/summon_wish_ui.lua b/lua/app/ui/summon/summon_wish_ui.lua
index 22ec50de..5b33dcb8 100755
--- a/lua/app/ui/summon/summon_wish_ui.lua
+++ b/lua/app/ui/summon/summon_wish_ui.lua
@@ -1,106 +1,80 @@
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()
- return "assets/prefabs/ui/summon/summon_wish_ui.prefab"
+ return "assets/prefabs/ui/summon/summon_wish_ui.prefab"
end
function SummonWishUI:onLoadRootComplete()
- local uiMap = self.root:genAllChildren()
- self.force_cell_wish = uiMap["summon_wish_ui.hero.Image.force_cell_wish"]
- self.select_wish = self.force_cell_wish:addLuaComponent(GConst.TYPEOF_LUA_CLASS.FORCECELL)
- self.scrollrectPrefab = uiMap["summon_wish_ui.hero.content.bg.scrollrect"]
- self.scrollrect = self.scrollrectPrefab:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
- self.curPage = GConst.ForceConst.PAGE_TYPE.WISH --阵容设置页面
- self.select_wish:setShowType(self.curPage)
+ local uiMap = self.root:genAllChildren()
+ self.root:addClickListener(function()
+ self:closeUI()
+ end)
+ uiMap["summon_wish_ui.bg.btn_close"]:addClickListener(function()
+ self:closeUI()
+ 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.btn_sure = uiMap["summon_wish_ui.hero.btns.btn_sure"]
- self.wishHeroList = DataManager.SummonData:getSummonWishConfig()
- self.txWishTips = uiMap["summon_wish_ui.hero.bg_1.tx_wish_tips"]
- self.bg = uiMap["summon_wish_ui.bg"]
-
- self:_addListeners()
-end
+ self.selHeroCell = uiMap["summon_wish_ui.bg.summon_hero_cell"]:addLuaComponent(SummonHeroCell)
+ self.scrollrect = uiMap["summon_wish_ui.bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
+ self.scrollrect:addInitCallback(function()
+ return SummonHeroCell
+ 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()
-function SummonWishUI:_addListeners()
- self.btn_close:addClickListener(function()
- self:closeUI()
- end)
- self.btn_sure:addClickListener(function()
- self:SaveWish()
- end)
- self.bg:addClickListener(function()
- self:closeUI()
- end)
-end
+ self.list = DataManager.SummonData:getSummonWishConfig(self.page)
+ self.wishHeroId = DataManager.SummonData:getSummonWishHeroId(self.page)
-function SummonWishUI:isFullScreen()
- return false
-end
+ okBtn:addClickListener(function()
+ self:saveWish()
+ end)
-function SummonWishUI:setParentUI(parentUI)
- self.parentUI = parentUI
+ self:bind(DataManager.SummonData, "isDirty", function()
+ self:onRefresh()
+ end)
end
function SummonWishUI:onRefresh()
- local selectSummonId = DataManager.SummonData:getSummonSeason()
- if selectSummonId == 1 then
- self.txWishTips:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_TIPS))
- else
- self.txWishTips:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_TIPS_2))
- end
-
- self:SelectHero(DataManager.SummonData:getSummonWishHeroId())
- self:_refreshHeroScrollrect()
+ if self.page == 1 then
+ self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_TIPS))
+ else
+ self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_WISH_TIPS_2))
+ end
+
+ self.scrollrect:refillCells(#self.list)
+
+ self.selHeroCell:refresh(self.wishHeroId, self.wishHeroId, nil, true)
end
-function SummonWishUI:SaveWish()
- if self.wishHeroID == 0 then
+function SummonWishUI:saveWish()
+ if not self.wishHeroId or self.wishHeroId == 0 then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_FORCE_CHOOSE_DESC_2))
- return
- end
- ModuleManager.SummonManager:reqForceSummonWishSet(self.wishHeroID)
- 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
+ return
+ end
+ ModuleManager.SummonManager:onSummonWishSetReq(self.page, self.wishHeroId)
+ self:closeUI()
end
return SummonWishUI
diff --git a/lua/app/userdata/summon/summon_data.lua b/lua/app/userdata/summon/summon_data.lua
index 95be5667..cfc43a4a 100644
--- a/lua/app/userdata/summon/summon_data.lua
+++ b/lua/app/userdata/summon/summon_data.lua
@@ -8,7 +8,7 @@ function SummonData:ctor()
end
function SummonData:clear()
- self.forceSummons = nil
+ self.summonDataMap = nil
self.data.isDirty = false
DataManager:unregisterCrossDayFunc("SummonData")
end
@@ -23,116 +23,145 @@ function SummonData:init(data)
Logger.logHighlight("抽奖数据")
Logger.printTable(data)
end
- self.serverData = data
- -- self:InitForceSummons()
- self:setSummonSeason(1)
+ self:initData(data)
self:setDirty()
if not self.isInit then
self.isInit = true
-- 跨天
- DataManager:registerCrossDayFunc("SummonData", function()
- self:InitForceSummons()
- self:setDirty()
- end)
+ -- DataManager:registerCrossDayFunc("SummonData", function()
+ -- self:setDirty()
+ -- 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)
- -- if self.forceSummons[summonId] and DataManager.SummonActData:getTimeOpen() then
- -- return true
- -- end
- return false
-end
-function SummonData:getSummonOpenActivityId()
- self:InitForceSummons()
- for id, v in pairs(SummonCfg) do
- if v.activity and self:isSummonOpen(id) then
- return id
- end
+function SummonData:initData(data)
+ self.summonDataMap = {}
+ for k,v in pairs(data) do
+ self.summonDataMap[k] = {}
+ self.summonDataMap[k].freeAt = v.free_at
+ self.summonDataMap[k].statCount = v.stat_count
+ self.summonDataMap[k].triggerCount = v.trigger_count
+ self.summonDataMap[k].wishId = v.wish_id
+ self.summonDataMap[k].wishCount = v.wish_count
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
-function SummonData:isOpenActivity()
- -- if not self:isOpen() then
- -- 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)
+
+function SummonData:getIsOpen(showToast)
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.SUMMON_FORCE, not showToast) then
return false
end
return true
end
-function SummonData:getSummonUnlock()
- local list = {}
- for k, v in pairs(self.newSummonMap or {}) do
- if v == true then
- table.insert(list, k)
+--@region 抽奖数据
+--是否有免费抽奖
+function SummonData:hasSummonFree(summonType)
+ local freeCd = self:getSummonFreeCd(summonType)
+ 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
- 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
+--@endregion
+--@region 红点
function SummonData:hasSummonCostRedPoint(count)
if count then
local itemCost = self:getSummonItemCost()
@@ -166,179 +195,9 @@ function SummonData:hasSummonCostRedPoint(count)
end
return false
end
+--@endregion
---是否有免费抽奖
-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
-
+--@region 获取消耗
-- 获取当前所需的抽卡消耗
function SummonData:getSummonCosts(summonType, count)
local costs = {}
@@ -375,5 +234,57 @@ function SummonData:getSummonCosts(summonType, count)
-- end
return costs
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
\ No newline at end of file