商店
This commit is contained in:
parent
49e6651345
commit
56936f582b
@ -193,6 +193,20 @@ BIReport.ITEM_GET_TYPE = {
|
|||||||
FORCE_SUMMON = "force_summon",
|
FORCE_SUMMON = "force_summon",
|
||||||
FORCE_SUMMON_WISH_HREO_ID = "force_summon_wish_hero_id",
|
FORCE_SUMMON_WISH_HREO_ID = "force_summon_wish_hero_id",
|
||||||
ACT_SUMMON_HERO_GIFT = "act_summon_hero_gift",
|
ACT_SUMMON_HERO_GIFT = "act_summon_hero_gift",
|
||||||
|
|
||||||
|
-- 等级弹窗礼包
|
||||||
|
-- GIFT_POP_LV = "gift_pop_lv",
|
||||||
|
-- GIFT_POP_HERO_LV = "gift_pop_hero_lv",
|
||||||
|
GIFT_POP_CHAPTER = "gift_pop_chapter",
|
||||||
|
|
||||||
|
-- 商城相关
|
||||||
|
SHOP_CHAPTER = "shop_chapter",
|
||||||
|
-- SHOP_CORE_SOUL = "shop_core_soul",
|
||||||
|
SHOP_DAILY = "shop_daily",
|
||||||
|
SHOP_DAILY_REFRESH = "shop_daily_refresh",
|
||||||
|
SHOP_GEM = "shop_gem",
|
||||||
|
SHOP_GOLD = "shop_gold",
|
||||||
|
-- SHOP_EMBLEM = "shop_emblem",
|
||||||
}
|
}
|
||||||
|
|
||||||
BIReport.ADS_CLICK_TYPE = {
|
BIReport.ADS_CLICK_TYPE = {
|
||||||
@ -280,6 +294,20 @@ BIReport.GIFT_TYPE = {
|
|||||||
RUNES_GIFT = "RunesGift",
|
RUNES_GIFT = "RunesGift",
|
||||||
TOURN_WAVE_GIFT = "TournWaveGift",
|
TOURN_WAVE_GIFT = "TournWaveGift",
|
||||||
TOURN_ARENA_GIFT = "TournArenaGift",
|
TOURN_ARENA_GIFT = "TournArenaGift",
|
||||||
|
|
||||||
|
-- 等级弹窗礼包
|
||||||
|
-- GIFT_POP_LV = "gift_pop_lv",
|
||||||
|
-- GIFT_POP_HERO_LV = "gift_pop_hero_lv",
|
||||||
|
GIFT_POP_CHAPTER = "gift_pop_chapter",
|
||||||
|
|
||||||
|
-- 商城相关
|
||||||
|
SHOP_CHAPTER = "shop_chapter",
|
||||||
|
-- SHOP_CORE_SOUL = "shop_core_soul",
|
||||||
|
SHOP_DAILY = "shop_daily",
|
||||||
|
SHOP_DAILY_REFRESH = "shop_daily_refresh",
|
||||||
|
SHOP_GEM = "shop_gem",
|
||||||
|
SHOP_GOLD = "shop_gold",
|
||||||
|
-- SHOP_EMBLEM = "shop_emblem",
|
||||||
}
|
}
|
||||||
|
|
||||||
BIReport.COIN_TYPE = {
|
BIReport.COIN_TYPE = {
|
||||||
@ -359,6 +387,11 @@ BIReport.RUNES_FORMATION = {
|
|||||||
CHAPTER = "chapter",
|
CHAPTER = "chapter",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIReport.PAY_DOUBLE = {
|
||||||
|
NORMAL = "Normal",
|
||||||
|
DOUBLED = "Doubled",
|
||||||
|
}
|
||||||
|
|
||||||
-- b6
|
-- b6
|
||||||
local EVENT_NAME_EXIT = "client_exit"
|
local EVENT_NAME_EXIT = "client_exit"
|
||||||
local EVENT_NAME_FIGHT = "client_fight"
|
local EVENT_NAME_FIGHT = "client_fight"
|
||||||
|
|||||||
@ -42,6 +42,8 @@ function DataManager:init()
|
|||||||
self:initManager("FourteenDayData", "app/userdata/activity/fourteen_day/fourteen_day_data")
|
self:initManager("FourteenDayData", "app/userdata/activity/fourteen_day/fourteen_day_data")
|
||||||
self:initManager("ActPvpData", "app/userdata/activity/act_pvp/act_pvp_data")
|
self:initManager("ActPvpData", "app/userdata/activity/act_pvp/act_pvp_data")
|
||||||
self:initManager("TalentData", "app/userdata/talent/talent_data")
|
self:initManager("TalentData", "app/userdata/talent/talent_data")
|
||||||
|
self:initManager("GiftPopData", "app/userdata/gift_pop/gift_pop_data")
|
||||||
|
self:initManager("PaymentData", "app/userdata/payment/payment_data")
|
||||||
end
|
end
|
||||||
|
|
||||||
function DataManager:initManager(name, path)
|
function DataManager:initManager(name, path)
|
||||||
@ -179,25 +181,29 @@ function DataManager:initWithServerData(data)
|
|||||||
self.DailyTaskData:init(data.task_daily, data.task_achievement)
|
self.DailyTaskData:init(data.task_daily, data.task_achievement)
|
||||||
self.IdleData:init(data.idle)
|
self.IdleData:init(data.idle)
|
||||||
self.SevenDayData:init(data.seven_day)
|
self.SevenDayData:init(data.seven_day)
|
||||||
self.ShopData:initBase()
|
self.ShopData:init()
|
||||||
self.ShopData:initActGift(data.act) -- 礼包购买信息
|
-- self.ShopData:refreshChapterShop(data.mall_chapter)
|
||||||
self.ShopData:initMallDaily(data.mall_daily_store) -- 每日特惠
|
-- self.ShopData:refreshCoreSoulShop(data.soul)
|
||||||
self.ShopData:initCommonDailyGoldGift(data.mall_idle and data.mall_idle.ad_count) -- 常驻金币礼包
|
self.ShopData:refreshDailyShop(data.mall_daily_store)
|
||||||
self.ShopData:initGrowUpGift(data.act_grow_up_gift2) -- 成长礼包
|
-- self.ShopData:refreshGoldShop(data.mall_gold)
|
||||||
self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力/金币礼包
|
-- self.ShopData:refreshEmblemShop(data.mall_mythic_store)
|
||||||
self.ShopData:initIntroductGift(data.act_introductory_gift) -- 入门礼包
|
-- self.ShopData:initVit(data.energy_limit)
|
||||||
|
-- self.ShopData:initThirdPayOrder(data.third_pay)
|
||||||
|
-- self.ShopData:initThirdPayGiftOrder(data.third_pay)
|
||||||
|
-- self.ShopData:initBase()
|
||||||
|
-- self.ShopData:initActGift(data.act) -- 礼包购买信息
|
||||||
|
-- self.ShopData:initMallDaily(data.mall_daily_store) -- 每日特惠
|
||||||
|
-- self.ShopData:initCommonDailyGoldGift(data.mall_idle and data.mall_idle.ad_count) -- 常驻金币礼包
|
||||||
|
-- self.ShopData:initGrowUpGift(data.act_grow_up_gift2) -- 成长礼包
|
||||||
|
-- self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力/金币礼包
|
||||||
|
-- self.ShopData:initIntroductGift(data.act_introductory_gift) -- 入门礼包
|
||||||
-- 活动要在礼包后初始化
|
-- 活动要在礼包后初始化
|
||||||
self.ActivityData:init()
|
self.ActivityData:init()
|
||||||
-- 商店礼包都初始化完了后检查一下每日红点
|
-- 商店礼包都初始化完了后检查一下每日红点
|
||||||
self.ShopData:checkShopDiscountRedPoint()
|
-- self.ShopData:checkShopDiscountRedPoint()
|
||||||
self.ShopData:checkLoginPopInfo() -- 需要写在shopdata所有初始化之后
|
-- self.ShopData:checkLoginPopInfo() -- 需要写在shopdata所有初始化之后
|
||||||
self.SummonData:init(data.summon_data.summons)
|
self.SummonData:init(data.summon_data.summons)
|
||||||
self.AIHelperData:init(nil, true)
|
self.AIHelperData:init(nil, true)
|
||||||
-- 成长基金要在ShopData和PlayerDataBagData还有之后初始化,依赖这些数据
|
|
||||||
if data.fund then
|
|
||||||
self.GrowthFundData:init(data.fund.funds)
|
|
||||||
end
|
|
||||||
self.HeroFundData:init(data.hero_fund)
|
|
||||||
self.FourteenDayData:init(data.fourteen_bounty)
|
self.FourteenDayData:init(data.fourteen_bounty)
|
||||||
|
|
||||||
-- 任务数据最后初始化,依赖其他模块的数据
|
-- 任务数据最后初始化,依赖其他模块的数据
|
||||||
|
|||||||
@ -2,112 +2,106 @@ local PayManager = class("PayManager", BaseModule)
|
|||||||
|
|
||||||
PayManager.PURCHARSE_TYPE = {
|
PayManager.PURCHARSE_TYPE = {
|
||||||
ACT_GIFT = 1,
|
ACT_GIFT = 1,
|
||||||
ACT_GOLD_PIG = 2,
|
SHOP_GEM = 2,
|
||||||
CHAPTER_GIFT = 3,
|
-- GIFT_ROUTINE = 3,
|
||||||
GROW_UP_GIFT = 4,-- 已废弃
|
-- GIFT_JOLLYMAX = 4,
|
||||||
MALL_TREASURE = 5,
|
|
||||||
GROW_UP_GIFT_NEW = 6,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PayManager.PURCHARSE_ACT_TYPE = {
|
PayManager.PURCHARSE_ACT_TYPE = {
|
||||||
FIRST_RECHARGE = 1,
|
-- FIRST_RECHARGE = 1,
|
||||||
COIN_GIFT = 2,
|
-- COIN_GIFT = 2,
|
||||||
INTRODUCTORY_GIFT = 3,
|
-- INTRODUCTORY_GIFT = 3,
|
||||||
BEGINNER_GIFT = 4,
|
-- BEGINNER_GIFT = 4,
|
||||||
LEVEL_UP_GIFT = 5,
|
-- LEVEL_UP_GIFT = 5,
|
||||||
GROWTH_FUND = 6,
|
-- GROWTH_FUND = 6,
|
||||||
BOUNTY = 7,
|
-- BOUNTY = 7,
|
||||||
ARENA_BOUNTY = 8,
|
-- ARENA_BOUNTY = 8,
|
||||||
ARENA_GIFT = 9,
|
-- ARENA_GIFT = 9,
|
||||||
ARMOR_FUND = 10,
|
-- ARMOR_FUND = 10,
|
||||||
WEAPON_GIFT = 11,
|
-- WEAPON_GIFT = 11,
|
||||||
ARMOR_GIFT = 12,
|
-- ARMOR_GIFT = 12,
|
||||||
ACT_SUMMER = 13,
|
-- ACT_SUMMER = 13,
|
||||||
ACT_HERO_FUND = 14,
|
-- ACT_HERO_FUND = 14,
|
||||||
WEAPON_UPGRADE_GIFT = 15,
|
-- WEAPON_UPGRADE_GIFT = 15,
|
||||||
ARMOR_UPGRADE_GIFT = 16,
|
-- ARMOR_UPGRADE_GIFT = 16,
|
||||||
FOURTEEN_DAY_GIFT = 17,
|
-- FOURTEEN_DAY_GIFT = 17,
|
||||||
ACT_PVP_BOUNTY = 22,
|
-- ACT_PVP_BOUNTY = 22,
|
||||||
FULL_MOON_HERO_GIFT = 18,
|
-- FULL_MOON_HERO_GIFT = 18,
|
||||||
FULL_MOON_NEW_HERO_GIFT = 19,
|
-- FULL_MOON_NEW_HERO_GIFT = 19,
|
||||||
FULL_MOON_SKIN_GIFT = 20,
|
-- FULL_MOON_SKIN_GIFT = 20,
|
||||||
RUNES_GIFT = 21,
|
-- RUNES_GIFT = 21,
|
||||||
TOURN_WAVE_GIFT = 23,
|
-- TOURN_WAVE_GIFT = 23,
|
||||||
TOURN_ARENA_GIFT = 24,
|
-- TOURN_ARENA_GIFT = 24,
|
||||||
|
GIFT_POP_CHAPTER = 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
PayManager.PURCHARSE_TYPE_CONFIG = {
|
PayManager.PURCHARSE_TYPE_CONFIG = {
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = "act_gift",
|
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = "act_gift",
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = "act_gold_pig",
|
[PayManager.PURCHARSE_TYPE.SHOP_GEM] = "mall_treasure",
|
||||||
[PayManager.PURCHARSE_TYPE.MALL_TREASURE] = "mall_treasure",
|
-- [PayManager.PURCHARSE_TYPE.GIFT_ROUTINE] = "gift_routine",
|
||||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "act_chapter_store",
|
-- [PayManager.PURCHARSE_TYPE.GIFT_JOLLYMAX] = "gift_jollymax",
|
||||||
[PayManager.PURCHARSE_TYPE.GROW_UP_GIFT_NEW] = "act_growup_gift_new",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PayManager.BI_ITEM_GET_TYPE = {
|
PayManager.BI_ITEM_GET_TYPE = {
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.ITEM_GET_TYPE.FIRST_RECHARGE,
|
[PayManager.PURCHARSE_ACT_TYPE.GIFT_POP_CHAPTER] = BIReport.ITEM_GET_TYPE.GIFT_POP_CHAPTER,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.ITEM_GET_TYPE.COIN_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.ITEM_GET_TYPE.FIRST_RECHARGE,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.INTRODUCTORY_GIFT] = BIReport.ITEM_GET_TYPE.INTRODUCTORY_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.ITEM_GET_TYPE.COIN_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.ITEM_GET_TYPE.BEGINNER_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.INTRODUCTORY_GIFT] = BIReport.ITEM_GET_TYPE.INTRODUCTORY_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.ITEM_GET_TYPE.LEVEL_UP_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.ITEM_GET_TYPE.BEGINNER_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.ITEM_GET_TYPE.GROWTH_FUND,
|
-- [PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.ITEM_GET_TYPE.LEVEL_UP_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.ITEM_GET_TYPE.BOUNTY,
|
-- [PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.ITEM_GET_TYPE.GROWTH_FUND,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARENA_BOUNTY] = BIReport.ITEM_GET_TYPE.ARENA_BOUNTY,
|
-- [PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.ITEM_GET_TYPE.BOUNTY,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARENA_GIFT] = BIReport.ITEM_GET_TYPE.ARENA_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARENA_BOUNTY] = BIReport.ITEM_GET_TYPE.ARENA_BOUNTY,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARMOR_FUND] = BIReport.ITEM_GET_TYPE.ARMOR_FUND,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARENA_GIFT] = BIReport.ITEM_GET_TYPE.ARENA_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.WEAPON_GIFT] = BIReport.ITEM_GET_TYPE.WEAPON_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARMOR_FUND] = BIReport.ITEM_GET_TYPE.ARMOR_FUND,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARMOR_GIFT] = BIReport.ITEM_GET_TYPE.ARMOR_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.WEAPON_GIFT] = BIReport.ITEM_GET_TYPE.WEAPON_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ACT_SUMMER] = BIReport.ITEM_GET_TYPE.ACT_SUMMER,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARMOR_GIFT] = BIReport.ITEM_GET_TYPE.ARMOR_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ACT_HERO_FUND] = BIReport.ITEM_GET_TYPE.ACT_HERO_FUND,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ACT_SUMMER] = BIReport.ITEM_GET_TYPE.ACT_SUMMER,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.WEAPON_UPGRADE_GIFT] = BIReport.ITEM_GET_TYPE.WEAPON_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ACT_HERO_FUND] = BIReport.ITEM_GET_TYPE.ACT_HERO_FUND,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARMOR_UPGRADE_GIFT] = BIReport.ITEM_GET_TYPE.ARMOR_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.WEAPON_UPGRADE_GIFT] = BIReport.ITEM_GET_TYPE.WEAPON_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FOURTEEN_DAY_GIFT] = BIReport.ITEM_GET_TYPE.FOURTEEN_DAY_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARMOR_UPGRADE_GIFT] = BIReport.ITEM_GET_TYPE.ARMOR_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ACT_PVP_BOUNTY] = BIReport.ITEM_GET_TYPE.ACT_PVP_BOUNTY_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FOURTEEN_DAY_GIFT] = BIReport.ITEM_GET_TYPE.FOURTEEN_DAY_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_HERO_GIFT] = BIReport.ITEM_GET_TYPE.FULL_MOON_HERO_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ACT_PVP_BOUNTY] = BIReport.ITEM_GET_TYPE.ACT_PVP_BOUNTY_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_NEW_HERO_GIFT] = BIReport.ITEM_GET_TYPE.FULL_MOON_NEW_HERO_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_HERO_GIFT] = BIReport.ITEM_GET_TYPE.FULL_MOON_HERO_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_SKIN_GIFT] = BIReport.ITEM_GET_TYPE.FULL_MOON_SKIN_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_NEW_HERO_GIFT] = BIReport.ITEM_GET_TYPE.FULL_MOON_NEW_HERO_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.RUNES_GIFT] = BIReport.ITEM_GET_TYPE.RUNES_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_SKIN_GIFT] = BIReport.ITEM_GET_TYPE.FULL_MOON_SKIN_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.TOURN_WAVE_GIFT] = BIReport.ITEM_GET_TYPE.TOURN_WAVE_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.RUNES_GIFT] = BIReport.ITEM_GET_TYPE.RUNES_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.TOURN_ARENA_GIFT] = BIReport.ITEM_GET_TYPE.TOURN_ARENA_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.TOURN_WAVE_GIFT] = BIReport.ITEM_GET_TYPE.TOURN_WAVE_GIFT,
|
||||||
|
-- [PayManager.PURCHARSE_ACT_TYPE.TOURN_ARENA_GIFT] = BIReport.ITEM_GET_TYPE.TOURN_ARENA_GIFT,
|
||||||
},
|
},
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.ITEM_GET_TYPE.GOLD_PIG,
|
[PayManager.PURCHARSE_TYPE.SHOP_GEM] = BIReport.ITEM_GET_TYPE.SHOP_GEM,
|
||||||
[PayManager.PURCHARSE_TYPE.MALL_TREASURE] = BIReport.ITEM_GET_TYPE.MALL_TREASURE,
|
|
||||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = BIReport.ITEM_GET_TYPE.ACT_CHAPTER_STORE,
|
|
||||||
[PayManager.PURCHARSE_TYPE.GROW_UP_GIFT_NEW] = BIReport.ITEM_GET_TYPE.GROW_UP_GIFT_NEW,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PayManager.BI_GIFT_TYPE = {
|
PayManager.BI_GIFT_TYPE = {
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.GIFT_TYPE.FIRST_RECHARGE,
|
[PayManager.PURCHARSE_ACT_TYPE.GIFT_POP_CHAPTER] = BIReport.GIFT_TYPE.GIFT_POP_CHAPTER,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.GIFT_TYPE.COIN_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.GIFT_TYPE.FIRST_RECHARGE,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.INTRODUCTORY_GIFT] = BIReport.GIFT_TYPE.INTRODUCTORY_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.GIFT_TYPE.COIN_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.GIFT_TYPE.BEGINNER_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.INTRODUCTORY_GIFT] = BIReport.GIFT_TYPE.INTRODUCTORY_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.GIFT_TYPE.LEVEL_UP_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.GIFT_TYPE.BEGINNER_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.GIFT_TYPE.GROWTH_FUND,
|
-- [PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.GIFT_TYPE.LEVEL_UP_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.GIFT_TYPE.BOUNTY,
|
-- [PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.GIFT_TYPE.GROWTH_FUND,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARENA_BOUNTY] = BIReport.GIFT_TYPE.ARENA_BOUNTY,
|
-- [PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.GIFT_TYPE.BOUNTY,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARENA_GIFT] = BIReport.GIFT_TYPE.ARENA_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARENA_BOUNTY] = BIReport.GIFT_TYPE.ARENA_BOUNTY,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARMOR_FUND] = BIReport.GIFT_TYPE.ARMOR_FUND,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARENA_GIFT] = BIReport.GIFT_TYPE.ARENA_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.WEAPON_GIFT] = BIReport.GIFT_TYPE.WEAPON_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARMOR_FUND] = BIReport.GIFT_TYPE.ARMOR_FUND,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARMOR_GIFT] = BIReport.GIFT_TYPE.ARMOR_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.WEAPON_GIFT] = BIReport.GIFT_TYPE.WEAPON_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ACT_SUMMER] = BIReport.GIFT_TYPE.ACT_SUMMER,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARMOR_GIFT] = BIReport.GIFT_TYPE.ARMOR_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ACT_HERO_FUND] = BIReport.GIFT_TYPE.ACT_HERO_FUND,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ACT_SUMMER] = BIReport.GIFT_TYPE.ACT_SUMMER,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.WEAPON_UPGRADE_GIFT] = BIReport.GIFT_TYPE.WEAPON_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ACT_HERO_FUND] = BIReport.GIFT_TYPE.ACT_HERO_FUND,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ARMOR_UPGRADE_GIFT] = BIReport.GIFT_TYPE.ARMOR_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.WEAPON_UPGRADE_GIFT] = BIReport.GIFT_TYPE.WEAPON_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FOURTEEN_DAY_GIFT] = BIReport.GIFT_TYPE.FOURTEEN_DAY_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ARMOR_UPGRADE_GIFT] = BIReport.GIFT_TYPE.ARMOR_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.ACT_PVP_BOUNTY] = BIReport.GIFT_TYPE.ACT_PVP_BOUNTY_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FOURTEEN_DAY_GIFT] = BIReport.GIFT_TYPE.FOURTEEN_DAY_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_HERO_GIFT] = BIReport.GIFT_TYPE.FULL_MOON_HERO_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.ACT_PVP_BOUNTY] = BIReport.GIFT_TYPE.ACT_PVP_BOUNTY_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_NEW_HERO_GIFT] = BIReport.GIFT_TYPE.FULL_MOON_NEW_HERO_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_HERO_GIFT] = BIReport.GIFT_TYPE.FULL_MOON_HERO_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_SKIN_GIFT] = BIReport.GIFT_TYPE.FULL_MOON_SKIN_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_NEW_HERO_GIFT] = BIReport.GIFT_TYPE.FULL_MOON_NEW_HERO_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.RUNES_GIFT] = BIReport.GIFT_TYPE.RUNES_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.FULL_MOON_SKIN_GIFT] = BIReport.GIFT_TYPE.FULL_MOON_SKIN_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.TOURN_WAVE_GIFT] = BIReport.GIFT_TYPE.TOURN_WAVE_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.RUNES_GIFT] = BIReport.GIFT_TYPE.RUNES_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.TOURN_ARENA_GIFT] = BIReport.GIFT_TYPE.TOURN_ARENA_GIFT,
|
-- [PayManager.PURCHARSE_ACT_TYPE.TOURN_WAVE_GIFT] = BIReport.GIFT_TYPE.TOURN_WAVE_GIFT,
|
||||||
|
-- [PayManager.PURCHARSE_ACT_TYPE.TOURN_ARENA_GIFT] = BIReport.GIFT_TYPE.TOURN_ARENA_GIFT,
|
||||||
},
|
},
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.GIFT_TYPE.GOLD_PIG,
|
[PayManager.PURCHARSE_TYPE.SHOP_GEM] = BIReport.GIFT_TYPE.SHOP_GEM,
|
||||||
[PayManager.PURCHARSE_TYPE.MALL_TREASURE] = BIReport.GIFT_TYPE.MALL_TREASURE,
|
|
||||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = BIReport.GIFT_TYPE.ACT_CHAPTER_STORE,
|
|
||||||
[PayManager.PURCHARSE_TYPE.GROW_UP_GIFT_NEW] = BIReport.GIFT_TYPE.GROW_UP_GIFT_NEW,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function PayManager:getItemGetType(purchaseType, id)
|
function PayManager:getItemGetType(purchaseType, id)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -44,6 +44,30 @@ local const = {
|
|||||||
["act_gold_pig_full_cd"]={
|
["act_gold_pig_full_cd"]={
|
||||||
["value"]=12
|
["value"]=12
|
||||||
},
|
},
|
||||||
|
["summon_core_adtimes_1"]={
|
||||||
|
["value"]=3.0
|
||||||
|
},
|
||||||
|
["mall_daily_free_refresh"]={
|
||||||
|
["value"]=1.0
|
||||||
|
},
|
||||||
|
["mall_daily_ad_refresh"]={
|
||||||
|
["value"]=2.0
|
||||||
|
},
|
||||||
|
["mall_daily_refresh"]={
|
||||||
|
["value"]=2.0
|
||||||
|
},
|
||||||
|
["mall_daily_refresh_cost"]={
|
||||||
|
["cost"]={
|
||||||
|
{
|
||||||
|
["type"]=1,
|
||||||
|
["type_for_nothing"]="Vw==",
|
||||||
|
["id"]=1,
|
||||||
|
["id_for_nothing"]="Vw==",
|
||||||
|
["num"]=1000,
|
||||||
|
["num_for_nothing"]="VwhcAw=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
["bounty_buy_cost"]={
|
["bounty_buy_cost"]={
|
||||||
["reward"]={
|
["reward"]={
|
||||||
{
|
{
|
||||||
@ -122,9 +146,6 @@ local const = {
|
|||||||
["diamond_refresh_skill"]={
|
["diamond_refresh_skill"]={
|
||||||
["value"]=1
|
["value"]=1
|
||||||
},
|
},
|
||||||
["mall_daily_ad_refresh"]={
|
|
||||||
["value"]=1
|
|
||||||
},
|
|
||||||
["mall_daily_diamond_refresh"]={
|
["mall_daily_diamond_refresh"]={
|
||||||
["value"]=2
|
["value"]=2
|
||||||
},
|
},
|
||||||
|
|||||||
@ -28,7 +28,7 @@ local func_open = {
|
|||||||
["pop_ups"]=1
|
["pop_ups"]=1
|
||||||
},
|
},
|
||||||
["mall_daily"]={
|
["mall_daily"]={
|
||||||
["stage"]=999,
|
["stage"]=1,
|
||||||
["icon"]="module_unlock_dailyshop"
|
["icon"]="module_unlock_dailyshop"
|
||||||
},
|
},
|
||||||
["store_box_open"]={
|
["store_box_open"]={
|
||||||
|
|||||||
15
lua/app/config/strings/cn/mall_gold.lua
Executable file
15
lua/app/config/strings/cn/mall_gold.lua
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
local mall_gold = {
|
||||||
|
[1]={
|
||||||
|
["name"]="一点金币"
|
||||||
|
},
|
||||||
|
[2]={
|
||||||
|
["name"]="一些金币"
|
||||||
|
},
|
||||||
|
[3]={
|
||||||
|
["name"]="成堆的金币"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
local config = {
|
||||||
|
data=mall_gold,count=3
|
||||||
|
}
|
||||||
|
return config
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5a975799c3c9cc14fafc8e2c8d9cf4a7
|
guid: d79d3aa4c247049d7b0b03346072bbbd
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -701,6 +701,13 @@ GConst.REWARD_TYPE = {
|
|||||||
RUNES = 5,
|
RUNES = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GConst.REWARD_TYPE_NUM = {
|
||||||
|
ITEM = 1,
|
||||||
|
EQUIP = 2,
|
||||||
|
SOUL = 3,
|
||||||
|
COLLECTION = 4,
|
||||||
|
}
|
||||||
|
|
||||||
GConst.INT_TO_STRING = {
|
GConst.INT_TO_STRING = {
|
||||||
[0] = "0",
|
[0] = "0",
|
||||||
[1] = "1",
|
[1] = "1",
|
||||||
|
|||||||
@ -1039,6 +1039,14 @@ function GFunc.getQuality(type, id)
|
|||||||
return qlt
|
return qlt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function GFunc.getIconResByReward(reward)
|
||||||
|
if reward.type == GConst.REWARD_TYPE_NUM.ITEM then
|
||||||
|
return GFunc.getIconRes(reward.id)
|
||||||
|
elseif reward.type == GConst.REWARD_TYPE_NUM.EQUIP then
|
||||||
|
return GFunc.getEquipIconRes(reward.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---得到展示奖励的图集名称,图片资源id
|
---得到展示奖励的图集名称,图片资源id
|
||||||
function GFunc.getRewardIconRes(type, id)
|
function GFunc.getRewardIconRes(type, id)
|
||||||
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
||||||
|
|||||||
@ -1,61 +1,140 @@
|
|||||||
local ShopConst = {}
|
local ShopConst = {}
|
||||||
|
|
||||||
ShopConst.FIRST_RECHARGE_ID = 10102 -- 首充礼包ID
|
ShopConst.PRIVILEGE_CARD_ID = {
|
||||||
ShopConst.BEGINNER_GIFT_ID = 40102 -- 新手礼包ID
|
AD_CARD = 20102,
|
||||||
ShopConst.INTRODUCT_GIFT_ID = 30102 -- 入门礼包ID
|
MONTHLY_CARD = 20202,
|
||||||
ShopConst.INTRODUCTORY_GIFT_TRIGGER_CHAPTER_ID = 2 -- 入门礼包触发的章节ID
|
LIFETIME_CARD = 20302,
|
||||||
ShopConst.MAIN_UI_POP_TYPE = { -- 当触发弹窗时,相关联的类型礼包也要触发
|
CHALLEGE_CARD = 20402,
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = true,
|
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = true,
|
|
||||||
},
|
|
||||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShopConst.BOX_REWARD_TYPE = {
|
ShopConst.PRIVILEGE_CARD_ID_MAP = {
|
||||||
SUMMON = 1,
|
[ShopConst.PRIVILEGE_CARD_ID.AD_CARD] = 1,
|
||||||
BOUNTY = 2,
|
[ShopConst.PRIVILEGE_CARD_ID.MONTHLY_CARD] = 1,
|
||||||
ARENA_BOUNTY = 3,
|
[ShopConst.PRIVILEGE_CARD_ID.LIFETIME_CARD] = 1,
|
||||||
ARENA_AD_BOX = 4,
|
[ShopConst.PRIVILEGE_CARD_ID.CHALLEGE_CARD] = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
ShopConst.PAGE_TYPE = {
|
--首充档位
|
||||||
DISCOUNT = 1,
|
ShopConst.FIRST_RECHARGE_GEARS = {
|
||||||
MAIN = 2
|
GEAR_1 = 1,
|
||||||
}
|
GEAR_2 = 2,
|
||||||
-- 商店主要商品页面的类型
|
GEAR_3 = 3
|
||||||
ShopConst.MAIN_PAGE_TYPE = {
|
|
||||||
HOT = 1,
|
|
||||||
GEM = 2,
|
|
||||||
GOLD = 3
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShopConst.GEM_ICON_NAME = {
|
-- 首充id
|
||||||
[1] = "shop_diamond_1",
|
ShopConst.FIRST_RECHARGE_ID = {
|
||||||
[2] = "shop_diamond_2",
|
[ShopConst.FIRST_RECHARGE_GEARS.GEAR_1] = {10102, 10202, 10302},-- 第一档首充
|
||||||
[3] = "shop_diamond_3",
|
[ShopConst.FIRST_RECHARGE_GEARS.GEAR_2] = {10402, 10502, 10602},-- 第二档首充
|
||||||
[4] = "shop_diamond_4",
|
[ShopConst.FIRST_RECHARGE_GEARS.GEAR_3] = {10702, 10802, 10902},-- 第三档首充
|
||||||
[5] = "shop_diamond_5",
|
|
||||||
[6] = "shop_diamond_6",
|
|
||||||
[7] = "shop_diamond_7",
|
|
||||||
[8] = "shop_diamond_8",
|
|
||||||
[9] = "shop_diamond_9",
|
|
||||||
[10] = "shop_diamond_9",
|
|
||||||
[11] = "shop_diamond_9",
|
|
||||||
[12] = "shop_diamond_9",
|
|
||||||
[13] = "shop_diamond_9",
|
|
||||||
[14] = "shop_diamond_9",
|
|
||||||
[15] = "shop_diamond_9",
|
|
||||||
[16] = "shop_diamond_9",
|
|
||||||
[17] = "shop_diamond_9",
|
|
||||||
[18] = "shop_diamond_9",
|
|
||||||
[19] = "shop_diamond_9",
|
|
||||||
[20] = "shop_diamond_9",
|
|
||||||
}
|
}
|
||||||
ShopConst.COIN_ICON_NAME = {
|
|
||||||
[1] = "shop_species_1",
|
-- 新首充id
|
||||||
[2] = "shop_species_2",
|
-- ShopConst.FIRST_RECHARGE_ID_2 = {
|
||||||
[3] = "shop_species_3",
|
-- [ShopConst.FIRST_RECHARGE_GEARS.GEAR_1] = {11002, 11102, 11202},-- 第一档首充
|
||||||
|
-- [ShopConst.FIRST_RECHARGE_GEARS.GEAR_2] = {11302, 11402, 11502},-- 第二档首充
|
||||||
|
-- [ShopConst.FIRST_RECHARGE_GEARS.GEAR_3] = {11602, 11702, 11802},-- 第三档首充
|
||||||
|
-- }
|
||||||
|
ShopConst.PRIVILEGE_SHOW_PAGE = {
|
||||||
|
FREE_DAILY_REWARDS = 1,
|
||||||
|
AD_CARD = 2,
|
||||||
|
MONTHLY_CARD = 3,
|
||||||
|
LIFETIME_CARD = 4,
|
||||||
|
CHALLEGE_CARD = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- 脚本路径
|
||||||
|
ShopConst.PRIVILEGE_COMP = {
|
||||||
|
FREE_DAILY_REWARDS = "app/ui/privilege/comp/free_daily_rewards_comp",
|
||||||
|
AD_CARD = "app/ui/privilege/comp/ad_card_comp",
|
||||||
|
MONTHLY_CARD = "app/ui/privilege/comp/monthly_card_comp",
|
||||||
|
LIFETIME_CARD = "app/ui/privilege/comp/lifetime_card_comp",
|
||||||
|
CHALLEGE_CARD = "app/ui/privilege/comp/challege_card_comp",
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopConst.PRIVILEGE_PAGE_BTN_ICON_ATLAS = {
|
||||||
|
[ShopConst.PRIVILEGE_SHOW_PAGE.MONTHLY_CARD] = GConst.ATLAS_PATH.UI_ACT_COMMON,
|
||||||
|
}
|
||||||
|
ShopConst.PRIVILEGE_PAGE_BTN_ICON_1 = {
|
||||||
|
[ShopConst.PRIVILEGE_SHOW_PAGE.MONTHLY_CARD] = "bounty_btn_1_1",
|
||||||
|
}
|
||||||
|
ShopConst.PRIVILEGE_PAGE_BTN_ICON_2 = {
|
||||||
|
[ShopConst.PRIVILEGE_SHOW_PAGE.MONTHLY_CARD] = "bounty_btn_1_2",
|
||||||
|
}
|
||||||
|
ShopConst.PRIVILEGE_PAGE_BTN_DESC = {
|
||||||
|
[ShopConst.PRIVILEGE_SHOW_PAGE.MONTHLY_CARD] = "MONTHLY_CARD_1",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- fund 活动
|
||||||
|
ShopConst.FUND_SHOW_PAGE = {
|
||||||
|
FUND = 1,
|
||||||
|
CHAPTER_FUND = 2,
|
||||||
|
BOUNTY = 3,
|
||||||
|
BOUNTY_COLLECTION = 4,
|
||||||
|
TOWER_BOUNTY = 5,
|
||||||
|
BOUNTY_GROWTH = 6,
|
||||||
|
}
|
||||||
|
-- 脚本路径
|
||||||
|
ShopConst.FUND_COMP = {
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.FUND] = "app/ui/fund/fund_level_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND] = "app/ui/fund/fund_chapter_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY] = "app/ui/fund/bounty_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_COLLECTION] = "app/ui/fund/bounty_collection_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.TOWER_BOUNTY] = "app/ui/fund/tower_bounty_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_GROWTH] = "app/ui/bounty/bounty_growth_comp",
|
||||||
|
}
|
||||||
|
-- 预制体挂载的组件
|
||||||
|
ShopConst.FUND_COMP_NAME = {
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.FUND] = "fund_main_ui.fund_level_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND] = "fund_main_ui.fund_chapter_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY] = "fund_main_ui.bounty_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_COLLECTION] = "fund_main_ui.bounty_collection_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.TOWER_BOUNTY] = "fund_main_ui.tower_bounty_comp",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_GROWTH] = "fund_main_ui.bounty_growth_comp",
|
||||||
|
}
|
||||||
|
-- 动态加载的组件
|
||||||
|
ShopConst.FUND_COMP_PATH = {
|
||||||
|
-- [ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND] = "assets/prefabs/ui/privilege/fund_chapter_comp.prefab",
|
||||||
|
-- [ShopConst.FUND_SHOW_PAGE.TOWER_BOUNTY] = "assets/prefabs/ui/privilege/tower_bounty_comp.prefab",
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopConst.FUND_PAGE_BTN_ICON_ATLAS = {
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.FUND] = GConst.ATLAS_PATH.UI_ACT_COMMON,
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND] = GConst.ATLAS_PATH.UI_ACT_COMMON,
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY] = GConst.ATLAS_PATH.UI_ACT_COMMON,
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_COLLECTION] = GConst.ATLAS_PATH.UI_ACT_COMMON,
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.TOWER_BOUNTY] = GConst.ATLAS_PATH.UI_ACT_COMMON,
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_GROWTH] = GConst.ATLAS_PATH.UI_ACT_COMMON,
|
||||||
|
}
|
||||||
|
ShopConst.FUND_PAGE_BTN_ICON_1 = {
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.FUND] = "act_common_btn_11_1",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND] = "act_common_btn_10_1",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY] = "act_common_btn_5_1",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_COLLECTION] = "act_common_btn_6_1",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.TOWER_BOUNTY] = "act_common_btn_5_1",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_GROWTH] = "act_common_btn_18_1",
|
||||||
|
}
|
||||||
|
ShopConst.FUND_PAGE_BTN_ICON_2 = {
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.FUND] = "act_common_btn_11_2",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND] = "act_common_btn_10_2",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY] = "act_common_btn_5_2",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_COLLECTION] = "act_common_btn_6_2",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.TOWER_BOUNTY] = "act_common_btn_5_2",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_GROWTH] = "act_common_btn_18_2",
|
||||||
|
}
|
||||||
|
ShopConst.FUND_PAGE_BTN_DESC = {
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.FUND] = "FUND_DESC_1",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND] = "FUND_CHAPTER_DESC_1",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY] = "BOUNTY_DESC_8",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_COLLECTION] = "COLLECTION_DESC_1",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.TOWER_BOUNTY] = "TOWER_DESC_1",
|
||||||
|
[ShopConst.FUND_SHOW_PAGE.BOUNTY_GROWTH] = "FUND_GROWTH_TAG_DESC_1",
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopConst.CORE_SOUL_TYPE = {
|
||||||
|
NORMAL = 1,
|
||||||
|
ELITE = 2
|
||||||
|
}
|
||||||
|
ShopConst.CORE_SOUL_NORMAL_MAX_COUNT = 10 -- 魂芯普通宝箱自适应抽取数量限制
|
||||||
|
ShopConst.CORE_SOUL_ELITE_MULTI_COUNT = 10 -- 史诗宝箱多抽的次数
|
||||||
|
|
||||||
return ShopConst
|
return ShopConst
|
||||||
@ -1,25 +1,49 @@
|
|||||||
local ShopManager = class("ShopManager", BaseModule)
|
local ShopManager = class("ShopManager", BaseModule)
|
||||||
|
|
||||||
-- 展示商城宝箱
|
ShopManager.COMMERCE_TYPE = {
|
||||||
function ShopManager:showBoxHeroUI(type)
|
CHAPTER_GIFT = 1,
|
||||||
UIManager:showUI("app/ui/shop/box_hero_ui", {type = type})
|
SUMMON = 2,
|
||||||
|
DAILY_STORE = 3,
|
||||||
|
EMBLEM = 4,
|
||||||
|
GEM_STORE = 5,
|
||||||
|
GOLD_STORE = 6,
|
||||||
|
FORCE_SKIN = 7,
|
||||||
|
CORE_SOUL_STORE = 8,
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopManager.SUMMON_ID = {
|
||||||
|
NORMAL = 1,
|
||||||
|
EPIC = 2,
|
||||||
|
SSR = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShopManager:showBuyGemUI()
|
||||||
|
UIManager:showUI("app/ui/shop/buy_gem_ui")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 展示竞技场ad宝箱
|
function ShopManager:showFirstRechargeUI()
|
||||||
function ShopManager:showArenaAdBoxUI(isWin)
|
UIManager:showUI("app/ui/shop/first_recharge_ui")
|
||||||
local params = {
|
|
||||||
isWin = isWin
|
|
||||||
}
|
|
||||||
UIManager:showUI("app/ui/shop/box_hero_ui", {arena = params})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShopManager:showBoxLevelUI()
|
function ShopManager:showFundUI(showPage)
|
||||||
UIManager:showUI("app/ui/shop/box_level_ui")
|
UIManager:showUI("app/ui/fund/fund_main_ui", {showPage = showPage})
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:showFundRewardUI(params)
|
||||||
|
UIManager:showUI("app/ui/fund/fund_reward_ui", params)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:showThirdGiftPopUI()
|
||||||
|
UIManager:showUI("app/ui/shop/third_gift_pop_ui")
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:showVoucherReceiveUI()
|
||||||
|
UIManager:showUI("app/ui/shop/voucher_receive_ui")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 宝箱奖励开箱界面 type,params,rewards
|
-- 宝箱奖励开箱界面 type,params,rewards
|
||||||
function ShopManager:showBoxOpenUI(params)
|
function ShopManager:showBoxOpenUI(params)
|
||||||
UIManager:showUI("app/ui/shop/box_open_ui", params)
|
return UIManager:showUI("app/ui/shop/open_box_ui", params)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 宝箱奖励展示界面
|
-- 宝箱奖励展示界面
|
||||||
@ -27,217 +51,290 @@ function ShopManager:showBoxRewardUI(params)
|
|||||||
UIManager:showUI("app/ui/shop/box_reward_ui", params)
|
UIManager:showUI("app/ui/shop/box_reward_ui", params)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShopManager:showBoxLevelUpUI(params)
|
-- 章节礼包
|
||||||
UIManager:showUI("app/ui/shop/box_level_up_ui", params)
|
function ShopManager:reqBuyChapterGift(id)
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.MallChapterBuyReq, {id = id}, self.rspBuyChapterGift, BIReport.ITEM_GET_TYPE.SHOP_CHAPTER)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 触发弹窗礼包
|
function ShopManager:rspBuyChapterGift(result)
|
||||||
function ShopManager:triggerGiftPopUI(actType, actId, showType)
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
-- 入门礼包不在通用触发条件内
|
|
||||||
if (actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and actId == GConst.ShopConst.INTRODUCT_GIFT_ID) then
|
|
||||||
self:showGiftPopUI(actType, actId, false, showType)
|
|
||||||
DataManager.ShopData:removePopUpGift(actType, actId)
|
|
||||||
else
|
|
||||||
if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACT_GIFT_SHOW_OPEN, true) then
|
|
||||||
self:showGiftPopUI(actType, actId, false, showType)
|
|
||||||
DataManager.ShopData:removePopUpGift(actType, actId)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShopManager:showGiftPopUI(actType, actId, onlySelf, showType)
|
|
||||||
if GFunc.isShenhe() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and actId == GConst.ShopConst.FIRST_RECHARGE_ID then
|
|
||||||
UIManager:showUI("app/ui/shop/first_recharge_pop_ui", {showType = showType})
|
|
||||||
elseif actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and actId == GConst.ShopConst.INTRODUCT_GIFT_ID then
|
|
||||||
UIManager:showUI("app/ui/shop/introduct_pop_ui", {showType = showType})
|
|
||||||
elseif actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and (actId == GConst.ActivityConst.SKIN_GIFT_ID_1 or actId == GConst.ActivityConst.SKIN_GIFT_ID_2) then
|
|
||||||
ModuleManager.ActivityManager:showActivityUI(GConst.ActivityConst.PANEL_TYPE.SKIN)
|
|
||||||
elseif actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and actId == GConst.ActivityConst.HERO_GIFT_ID_1 then
|
|
||||||
ModuleManager.ActivityManager:showActivityUI(GConst.ActivityConst.PANEL_TYPE.HERO)
|
|
||||||
elseif actType == PayManager.PURCHARSE_TYPE.CHAPTER_GIFT then
|
|
||||||
UIManager:showUI("app/ui/shop/gift_pop_chapter_ui", {type = actType, id = actId, onlySelf = onlySelf, showType = showType})
|
|
||||||
elseif actType == PayManager.PURCHARSE_TYPE.GROW_UP_GIFT_NEW then
|
|
||||||
UIManager:showUI("app/ui/shop/gift_pop_grow_up_ui", {type = actType, id = actId, onlySelf = onlySelf, showType = showType})
|
|
||||||
else
|
|
||||||
UIManager:showUI("app/ui/shop/gift_pop_ui", {type = actType, id = actId, onlySelf = onlySelf, showType = showType})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 触发金币弹窗礼包
|
|
||||||
function ShopManager:triggerCoinGiftPopUI(actId)
|
|
||||||
self:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, actId, BIReport.PAY_UI_SHOW_TYPE.TRIGGER_POP)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 触发成长礼包
|
|
||||||
function ShopManager:triggerGrowUpGiftPopUI(actId)
|
|
||||||
self:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT_NEW, actId, BIReport.PAY_UI_SHOW_TYPE.TRIGGER_POP)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 购买每日特惠商品
|
|
||||||
function ShopManager:buyMallDailyGift(id, isAd)
|
|
||||||
if not DataManager.ShopData:getMallDailyIsOpen() then
|
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACTIVITY_OVER_DESC))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local params = {id = id}
|
|
||||||
local rewards, costs = DataManager.ShopData:getMallDailyRewardAndCost(id)
|
|
||||||
|
|
||||||
if costs then
|
|
||||||
if not GFunc.checkCost(costs.id, costs.num, true) then
|
|
||||||
-- 尝试触发金币礼包
|
|
||||||
if costs.id == GConst.ItemConst.ITEM_ID_GOLD then
|
|
||||||
self:tryTriggerCoinGift()
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 二次弹窗确认
|
|
||||||
if costs then
|
|
||||||
local isCoin = costs.id == GConst.ItemConst.ITEM_ID_GOLD
|
|
||||||
local params ={
|
|
||||||
titleTx = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_31),
|
|
||||||
content = isCoin and I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_32) or I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_33),
|
|
||||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
|
||||||
showToday = GConst.MESSAGE_BOX_SHOW_TODAY.HOT_SELL_BUY,
|
|
||||||
costId = costs.id,
|
|
||||||
costNum = costs.num,
|
|
||||||
okFunc = function()
|
|
||||||
local responseData = {
|
|
||||||
rewards = rewards,
|
|
||||||
costs = costs
|
|
||||||
}
|
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyMallDailyReq, params, responseData, self.buyMallDailyGiftFinish, BIReport.ITEM_GET_TYPE.MALL_DAILY)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
GFunc.showMessageBox(params)
|
|
||||||
else
|
|
||||||
local responseData = {
|
|
||||||
rewards = rewards,
|
|
||||||
costs = costs
|
|
||||||
}
|
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyMallDailyReq, params, responseData, self.buyMallDailyGiftFinish, BIReport.ITEM_GET_TYPE.MALL_DAILY)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShopManager:buyMallDailyGiftFinish(result)
|
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
|
||||||
GFunc.showRewardBox(result.rewards)
|
GFunc.showRewardBox(result.rewards)
|
||||||
DataManager.ShopData:updateMallDailyGoods(result.good_info)
|
DataManager.ShopData:onBuyChapterGiftSuccess(result.reqData.id)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 重置每日特惠商品(type 1广告 2钻石)
|
-- 魂芯商店
|
||||||
function ShopManager:resetMallDailyGift(type)
|
function ShopManager:reqBuyCoreSoulBox(id, free, times)
|
||||||
if not DataManager.ShopData:getMallDailyIsOpen() then
|
self:sendMessage(ProtoMsgType.FromMsgEnum.SoulSummonReq, {id = id, free = free, times = times}, self.rspBuyCoreSoulBox, BIReport.ITEM_GET_TYPE.SHOP_CORE_SOUL)
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACTIVITY_OVER_DESC))
|
end
|
||||||
|
|
||||||
|
function ShopManager:rspBuyCoreSoulBox(result)
|
||||||
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if type == 2 then -- 钻石刷新
|
DataManager.ShopData:onBuyCoreSoulBoxSuccess(result.reqData.id, result.reqData.free, result.reqData.times, result.trigger_count)
|
||||||
if not GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, DataManager.ShopData:getMallDailyDiamondResetCost(), true) then
|
local rewards = {}
|
||||||
|
for _, reward in ipairs(result.rewards) do
|
||||||
|
if reward.type == GConst.REWARD_TYPE.SOUL then
|
||||||
|
table.insert(rewards, reward)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(rewards, function(a, b)
|
||||||
|
return a.soul.uid < b.soul.uid
|
||||||
|
end)
|
||||||
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CLOSE_BOX_REWARD_UI)
|
||||||
|
local goldKeyCost = 0
|
||||||
|
if result.reqData.id == GConst.ShopConst.CORE_SOUL_TYPE.ELITE then
|
||||||
|
if result.costs then
|
||||||
|
for _, cost in ipairs(result.costs) do
|
||||||
|
if cost.item and cost.item.id == GConst.ItemConst.GOLD_KEY then
|
||||||
|
goldKeyCost = cost.item.count
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.OPEN_CORE_SOUL_BOX, result.reqData, goldKeyCost)
|
||||||
|
if result.reqData.id then
|
||||||
|
local uiObj = self:showBoxOpenUI({type = GConst.BOX_REWARD_TYPE.SUMMON, openType = result.reqData.id, count = result.reqData.times, rewards = rewards})
|
||||||
|
uiObj:addEnterAniCompleteListener(function()
|
||||||
|
DataManager.ShopData:setDirty()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
-- bi
|
||||||
|
if result.reqData.id == GConst.ShopConst.CORE_SOUL_TYPE.NORMAL then
|
||||||
|
BIReport:postBoxReward(BIReport.BOX_TYPE.NORMAL_BOX, result.rewards, nil, result.reqData.free, result.reqData.times)
|
||||||
|
elseif result.reqData.id == GConst.ShopConst.CORE_SOUL_TYPE.ELITE then
|
||||||
|
BIReport:postBoxReward(BIReport.BOX_TYPE.EPIC_BOX, result.rewards, nil, result.reqData.free, result.reqData.times)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 每日商店
|
||||||
|
function ShopManager:reqBuyDailyGift(id)
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.MallDailyBuyReq, {id = id}, self.rspBuyDailyGift, BIReport.ITEM_GET_TYPE.SHOP_DAILY)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:rspBuyDailyGift(result)
|
||||||
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local params = {reset_type = type}
|
|
||||||
local responseData = {}
|
|
||||||
if type == 2 then
|
|
||||||
local costs = {type = GConst.REWARD_TYPE.ITEM, id = GConst.ITEM_ID_GEM, num = DataManager.ShopData:getMallDailyDiamondResetCost()}
|
|
||||||
responseData.costs = costs
|
|
||||||
end
|
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.MallDailyResetReq, params, responseData, self.resetMallDailyGiftFinish, BIReport.ITEM_GET_TYPE.MALL_DAILY_RESET)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShopManager:resetMallDailyGiftFinish(result)
|
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
|
||||||
local resetType = result.reqData and result.reqData.reset_type
|
|
||||||
if resetType == 1 then -- 免费的
|
|
||||||
DataManager.ShopData:addMallDailyAdResetCount()
|
|
||||||
else
|
|
||||||
DataManager.ShopData:addMallDailyDiamondResetCount()
|
|
||||||
end
|
|
||||||
DataManager.ShopData:initMallDaily(result.mall_daily_info)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 跨天刷新每日商店数据
|
|
||||||
function ShopManager:mallDailyGiftOverDay()
|
|
||||||
local params = {}
|
|
||||||
local responseData = {}
|
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.MallDailyOverDayReq, params, responseData, self.mallDailyGiftOverDayFinish)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShopManager:mallDailyGiftOverDayFinish(result)
|
|
||||||
-- 消息无用 仅为了触发推送
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShopManager:onMallDailyReset(result)
|
|
||||||
if result.status == 0 then
|
|
||||||
DataManager.ShopData:initMallDaily(result.mall_daily_info)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 常规金币
|
|
||||||
function ShopManager:buyMallIdleCoin(id, isAd)
|
|
||||||
local params = {id = id, ad = isAd}
|
|
||||||
local rewardNum, costs = DataManager.ShopData:getCommonDailyCoinDataById(id)
|
|
||||||
|
|
||||||
local responseData = {
|
|
||||||
rewards = {type = GConst.REWARD_TYPE.ITEM, id = GConst.ITEM_ID_GOLD, num = rewardNum},
|
|
||||||
costs = costs
|
|
||||||
}
|
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyMallIdleReq, params, responseData, self.buyMallIdleCoinFinish, BIReport.ITEM_GET_TYPE.MALL_IDLE)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShopManager:buyMallIdleCoinFinish(result)
|
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
|
||||||
GFunc.showRewardBox(result.rewards)
|
GFunc.showRewardBox(result.rewards)
|
||||||
DataManager.ShopData:initCommonDailyGoldGift(result.ad_count)
|
DataManager.ShopData:refreshDailyShop(result.store)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 每日商店刷新
|
||||||
|
function ShopManager:reqRefreshDailyGift(isAd)
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.MallDailyRefreshReq, {Ad = isAd}, self.rspRefreshDailyGift, BIReport.ITEM_GET_TYPE.SHOP_DAILY_REFRESH)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:rspRefreshDailyGift(result)
|
||||||
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
DataManager.ShopData:refreshDailyShop(result.store)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:reqBuyEmblemGift(id)
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.MallMythicBuyReq, {id = id}, self.rspBuyEmblemGift, BIReport.ITEM_GET_TYPE.SHOP_EMBLEM)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:rspBuyEmblemGift(result)
|
||||||
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
GFunc.showRewardBox(result.rewards)
|
||||||
|
DataManager.ShopData:onBuyEmblemGiftSuccess(result.reqData.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:reqBuyEmblemGift(id)
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.MallMythicBuyReq, {id = id}, self.rspBuyEmblemGift, BIReport.ITEM_GET_TYPE.SHOP_EMBLEM)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:rspBuyEmblemGift(result)
|
||||||
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
GFunc.showRewardBox(result.rewards)
|
||||||
|
DataManager.ShopData:onBuyEmblemGiftSuccess(result.reqData.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 金币商店
|
||||||
|
function ShopManager:reqBuyGoldGift(id)
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.MallGoldBuyReq, {id = id}, self.rspBuyGoldGift, BIReport.ITEM_GET_TYPE.SHOP_GOLD)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:rspBuyGoldGift(result)
|
||||||
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
GFunc.showRewardBox(result.rewards)
|
||||||
|
DataManager.ShopData:onBuyGoldGiftSuccess(result.reqData.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 钻石商店
|
||||||
|
function ShopManager:onBuyGemGift(id, doubleType)
|
||||||
|
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.SHOP_GEM, nil, doubleType)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 首冲礼包购买
|
||||||
|
function ShopManager:onBuyFirstRecharge(gear, day)
|
||||||
|
PayManager:purchasePackage(DataManager.ShopData:getFirstRechargeGiftId(gear, day), PayManager.PURCHARSE_TYPE.ACT_GIFT, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 购买体力
|
||||||
|
function ShopManager:reqBuyVit(buyType)
|
||||||
|
if buyType == GConst.VIT_BUY_TYPE.AD then
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.EnergyByADReq, {}, self.rspBuyVit, BIReport.ITEM_GET_TYPE.BUY_VIT)
|
||||||
|
else
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.EnergyByDiamondReq, {}, self.rspBuyVit, BIReport.ITEM_GET_TYPE.BUY_VIT)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 推送助力礼包
|
function ShopManager:rspBuyVit(result)
|
||||||
function ShopManager:onTriggerLevelUpGift(result)
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
DataManager.ShopData:onTriggerLevelUpGift(result.current_level_up_gift)
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
GFunc.showRewardBox(result.rewards)
|
||||||
|
DataManager.ShopData:onVitBuySuccess(result.energy_limit)
|
||||||
|
-- 累计购买体力X次
|
||||||
|
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.BUY_VIT_NUM)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 尝试触发金币礼包
|
function ShopManager:checkWebPurchaseGift()
|
||||||
function ShopManager:tryTriggerCoinGift()
|
if DataManager.TutorialData:getIsInTutorial() then
|
||||||
local triggerId = DataManager.ShopData:checkAndGetCoinGiftTriggerId()
|
return false
|
||||||
if triggerId then
|
end
|
||||||
local params = {gold_gift_id = triggerId}
|
if DataManager.ShopData:getNeedShowGiftReceiveUI() then
|
||||||
local responseData = {}
|
ModuleManager.ShopManager:showThirdGiftPopUI()
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.TriggerGoldGiftReq, params, responseData, self.tryTriggerCoinGiftFinish)
|
|
||||||
return true
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
--@region 领取三方支付礼包
|
||||||
|
function ShopManager:receiveWebPurchaseGiftRewards()
|
||||||
|
local orders = DataManager.ShopData:getThirdPayGiftOrders()
|
||||||
|
local orderIds = {}
|
||||||
|
for k, v in ipairs(orders) do
|
||||||
|
table.insert(orderIds, v.order_id)
|
||||||
|
end
|
||||||
|
local parmas = {
|
||||||
|
order_ids = orderIds
|
||||||
|
}
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.ThirdPayGiftReq, parmas, self.onReceiveWebPurchaseGiftRewards, BIReport.ITEM_GET_TYPE.WEB_PAY_GIFT)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopManager:onReceiveWebPurchaseGiftRewards(result)
|
||||||
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if result.rewards then
|
||||||
|
GFunc.showRewardBox(result.rewards)
|
||||||
|
end
|
||||||
|
local isJollyMax = false
|
||||||
|
for k, v in ipairs(result.reqData.order_ids) do
|
||||||
|
local orderInfo = DataManager.ShopData:getThirdPayGiftOrderInfo(v)
|
||||||
|
if orderInfo then
|
||||||
|
local cfg
|
||||||
|
local rewards
|
||||||
|
local giftId = orderInfo.gift_id
|
||||||
|
if orderInfo.gift_type == PayManager.PURCHARSE_TYPE.ACT_GIFT then
|
||||||
|
cfg = ConfigManager:getConfig("act_gift")[giftId]
|
||||||
|
rewards = cfg.reward
|
||||||
|
elseif orderInfo.gift_type == PayManager.PURCHARSE_TYPE.GIFT_ROUTINE then
|
||||||
|
cfg = ConfigManager:getConfig("gift_routine")[giftId]
|
||||||
|
rewards = cfg.reward
|
||||||
|
elseif orderInfo.gift_type == PayManager.PURCHARSE_TYPE.SHOP_GEM then
|
||||||
|
cfg = ConfigManager:getConfig("mall_treasure")[giftId]
|
||||||
|
rewards = {}
|
||||||
|
if cfg.reward then
|
||||||
|
for i,v in ipairs(cfg.reward) do
|
||||||
|
table.insert(rewards, v)
|
||||||
|
end
|
||||||
|
if DataManager.PaymentData:isGemStoreDouble(giftId) then
|
||||||
|
for i,v in ipairs(cfg.reward) do
|
||||||
|
table.insert(rewards, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif orderInfo.gift_type == PayManager.PURCHARSE_TYPE.GIFT_JOLLYMAX then
|
||||||
|
cfg = ConfigManager:getConfig("gift_jollymax")[giftId]
|
||||||
|
rewards = cfg.reward
|
||||||
|
isJollyMax = true
|
||||||
|
end
|
||||||
|
if isJollyMax or VersionCompatible:getIsRUPackage() then
|
||||||
|
-- local rCfg = ConfigManager:getConfig("recharge")[cfg.recharge_id]
|
||||||
|
-- local productId = rCfg[VersionCompatible:getRechargePayId()]
|
||||||
|
local productId = cfg.goods_id
|
||||||
|
BIReport:postReceiveThirdPayJollyMaxGiftRewards(orderInfo.order_id, productId, orderInfo.gift_id, orderInfo.revenue, rewards, cfg.price)
|
||||||
|
BIReport:postJollyMaxPurchase(orderInfo.revenue, productId, orderInfo.order_id)
|
||||||
else
|
else
|
||||||
-- 不满足触发条件
|
local rCfg = ConfigManager:getConfig("recharge")[cfg.recharge_id]
|
||||||
if EDITOR_MODE then
|
local productId = rCfg[VersionCompatible:getRechargePayId()]
|
||||||
Logger.log("不满足金币礼包触发条件")
|
BIReport:postReceiveThirdPayGiftRewars(orderInfo.order_id, productId, orderInfo.gift_id, orderInfo.revenue, rewards, rCfg.price)
|
||||||
|
BIReport:postVTCPurchase(orderInfo.revenue, productId, orderInfo.order_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
-- 购买礼包后续处理
|
||||||
|
if isJollyMax or VersionCompatible:getIsRUPackage() then
|
||||||
|
PayManager:requestThirdJollyMaxGiftRewards(result.gifts or {})
|
||||||
|
else
|
||||||
|
PayManager:requestThirdGiftRewards(result.gifts or {})
|
||||||
|
end
|
||||||
|
DataManager.ShopData:deleteThirdPayGiftOrders(result.reqData.order_ids)
|
||||||
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.RECEIVE_WEB_PURCHASE_REWARDS_SUCCESS)
|
||||||
|
end
|
||||||
|
--@endregion
|
||||||
|
|
||||||
|
function ShopManager:checkWebPurchase()
|
||||||
|
if DataManager.TutorialData:getIsInTutorial() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if DataManager.ShopData:getNeedShowVoucherReceiveUI() then
|
||||||
|
self:showVoucherReceiveUI()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShopManager:tryTriggerCoinGiftFinish(result)
|
function ShopManager:receiveWebPurchaseRewards()
|
||||||
if result.status == 0 then
|
local orders = DataManager.ShopData:getThirdPayOrders()
|
||||||
DataManager.ShopData:onTriggerCoinGift(result.reqData.gold_gift_id)
|
local orderIds = {}
|
||||||
-- 立即触发金币弹窗
|
for k, v in ipairs(orders) do
|
||||||
self:triggerCoinGiftPopUI(result.reqData.gold_gift_id)
|
table.insert(orderIds, v.order_id)
|
||||||
end
|
end
|
||||||
|
local parmas = {
|
||||||
|
order_ids = orderIds
|
||||||
|
}
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.ThirdPayClaimReq, parmas, self.onReceiveWebPurchaseRewards, BIReport.ITEM_GET_TYPE.WEB_PAY)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 推送成长礼包
|
function ShopManager:onReceiveWebPurchaseRewards(result)
|
||||||
function ShopManager:onTriggerGrowUpGift(result)
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
DataManager.ShopData:initGrowUpGift(result.group_up_gift)
|
return
|
||||||
|
|
||||||
-- 有2种情况 1.处于英雄升级/解锁界面 立即触发弹窗 2.购买了成长礼包,此时仅标记,在奖励弹窗结束后再弹
|
|
||||||
if UIManager:getTopUIObj() == UIManager.UI_PATH.HERO_DETAIL_UI then
|
|
||||||
self:triggerGrowUpGiftPopUI(result.group_up_gift.current_grow_up_id)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
GFunc.showRewardBox(result.rewards)
|
||||||
|
for k, v in ipairs(result.reqData.order_ids) do
|
||||||
|
local orderInfo = DataManager.ShopData:getThirdPayOrderInfo(v)
|
||||||
|
if orderInfo then
|
||||||
|
BIReport:postReceiveThirdPayRewars(orderInfo.order_id, orderInfo.voucher, orderInfo.product_id, orderInfo.revenue, orderInfo.price)
|
||||||
|
BIReport:postWebPurchase(orderInfo.revenue, orderInfo.product_id, orderInfo.order_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DataManager.ShopData:deleteThirdPayOrders(result.reqData.order_ids)
|
||||||
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.RECEIVE_WEB_PURCHASE_REWARDS_SUCCESS)
|
||||||
end
|
end
|
||||||
|
|
||||||
return ShopManager
|
return ShopManager
|
||||||
198
lua/app/ui/fund/bounty_collection_comp.lua
Executable file
198
lua/app/ui/fund/bounty_collection_comp.lua
Executable file
@ -0,0 +1,198 @@
|
|||||||
|
local BountyCollectionComp = class("BountyCollectionComp", LuaComponent)
|
||||||
|
|
||||||
|
local CELL = "app/ui/privilege/cell/bounty_collection_cell"
|
||||||
|
|
||||||
|
function BountyCollectionComp:onClose()
|
||||||
|
end
|
||||||
|
|
||||||
|
function BountyCollectionComp:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.btnHelp = uiMap["bounty_collection_comp.top.tx_title.btn_help"]
|
||||||
|
self.timeBg = uiMap["bounty_collection_comp.top.time"]
|
||||||
|
self.txTime = uiMap["bounty_collection_comp.top.time.tx_time"]
|
||||||
|
self.txPro = uiMap["bounty_collection_comp.top.img_prog.tx_pro"]
|
||||||
|
self.txLv = uiMap["bounty_collection_comp.level_node.content.level.tx_lv"]
|
||||||
|
self.imgProg = uiMap["bounty_collection_comp.level_node.content.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||||
|
self.txProg = uiMap["bounty_collection_comp.level_node.content.prog.tx_prog"]
|
||||||
|
self.scrollrect = uiMap["bounty_collection_comp.scrollrect"]
|
||||||
|
self.btnGet = uiMap["bounty_collection_comp.btns.btn_get"]
|
||||||
|
self.txGet = uiMap["bounty_collection_comp.btns.btn_get.tx_desc"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
self.btnBuy1 = uiMap["bounty_collection_comp.btns.btn_buy_1"]
|
||||||
|
self.txBuy1 = uiMap["bounty_collection_comp.btns.btn_buy_1.tx_desc"]
|
||||||
|
self.pro1_Items = {}
|
||||||
|
self.pro1_TxCount = {}
|
||||||
|
self.pro1_ImgIcon = {}
|
||||||
|
for i = 1, 4 do
|
||||||
|
local item = uiMap["bounty_collection_comp.top.tips_1.groud.item_" .. i]
|
||||||
|
local txCount = uiMap["bounty_collection_comp.top.tips_1.groud.item_" .. i .. ".tx_count"]
|
||||||
|
local imgProg = uiMap["bounty_collection_comp.top.tips_1.groud.item_" .. i .. ".img_prog"]
|
||||||
|
table.insert(self.pro1_Items, item)
|
||||||
|
table.insert(self.pro1_TxCount, txCount)
|
||||||
|
table.insert(self.pro1_ImgIcon, imgProg)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.btnBuy2 = uiMap["bounty_collection_comp.btns.btn_buy_2"]
|
||||||
|
self.txBuy2 = uiMap["bounty_collection_comp.btns.btn_buy_2.tx_desc"]
|
||||||
|
self.pro2_Items = {}
|
||||||
|
self.pro2_TxCount = {}
|
||||||
|
self.pro2_ImgIcon = {}
|
||||||
|
for i = 1, 4 do
|
||||||
|
local item = uiMap["bounty_collection_comp.top.tips_2.groud.item_" .. i]
|
||||||
|
local txCount = uiMap["bounty_collection_comp.top.tips_2.groud.item_" .. i .. ".tx_count"]
|
||||||
|
local imgProg = uiMap["bounty_collection_comp.top.tips_2.groud.item_" .. i .. ".img_prog"]
|
||||||
|
table.insert(self.pro2_Items, item)
|
||||||
|
table.insert(self.pro2_TxCount, txCount)
|
||||||
|
table.insert(self.pro2_ImgIcon, imgProg)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.txTitle = uiMap["bounty_collection_comp.top.tx_title"]
|
||||||
|
self.txLevelTips = uiMap["bounty_collection_comp.top.level_node.content.tx_level_tips"]
|
||||||
|
self.txLevel = uiMap["bounty_collection_comp.scrollrect.title.tx_level"]
|
||||||
|
self.txCommon = uiMap["bounty_collection_comp.scrollrect.title.tx_common"]
|
||||||
|
self.txPro1 = uiMap["bounty_collection_comp.scrollrect.title.tx_pro_1"]
|
||||||
|
self.txPro2 = uiMap["bounty_collection_comp.scrollrect.title.tx_pro_2"]
|
||||||
|
self.txTips1 = uiMap["bounty_collection_comp.top.tips.tx_tips1"]
|
||||||
|
self.txTips2 = uiMap["bounty_collection_comp.top.btn_buy_2.tips_2.tx_tips"]
|
||||||
|
self.txDescInfo1 = uiMap["bounty_collection_comp.top.btn_buy_1.img.tx_desc_info"]
|
||||||
|
self.txDescInfo2 = uiMap["bounty_collection_comp.top.btn_buy_2.img.tx_desc_info"]
|
||||||
|
|
||||||
|
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_26))
|
||||||
|
self.txLevelTips:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_28))
|
||||||
|
self.txLevel:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_5))
|
||||||
|
self.txCommon:setText(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_5))
|
||||||
|
self.txPro1:setText(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_6))
|
||||||
|
self.txPro2:setText(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_7))
|
||||||
|
self.txTips1:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_29))
|
||||||
|
self.txTips2:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_29))
|
||||||
|
self.txDescInfo1:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_30))
|
||||||
|
self.txDescInfo2:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_31))
|
||||||
|
|
||||||
|
local cfg = DataManager.BagData:getRecoveryCfg(GConst.ItemConst.ITEM_ID_CHALLENGE_TEAM)
|
||||||
|
local add = cfg and cfg.bounty or 0
|
||||||
|
|
||||||
|
self.btnBuy1:addClickListener(function()
|
||||||
|
ModuleManager.ShopManager:showFundRewardUI({
|
||||||
|
txTitle = "提升等级,领取超值豪礼",
|
||||||
|
giftIds = DataManager.BountyCollectionData:getProRewardGiftId(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1),
|
||||||
|
rewards = DataManager.BountyCollectionData:getAllRewards(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1),
|
||||||
|
func = function()
|
||||||
|
ModuleManager.CollectionManager:onUnlockPro(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
self.btnBuy2:addClickListener(function()
|
||||||
|
ModuleManager.ShopManager:showFundRewardUI({
|
||||||
|
txTitle = "提升等级,领取超值豪礼",
|
||||||
|
giftIds = DataManager.BountyCollectionData:getProRewardGiftId(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2),
|
||||||
|
rewards = DataManager.BountyCollectionData:getAllRewards(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2),
|
||||||
|
func = function()
|
||||||
|
ModuleManager.CollectionManager:onUnlockPro(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
self.btnGet:addClickListener(function()
|
||||||
|
ModuleManager.CollectionManager:reqGetAllRewards()
|
||||||
|
end)
|
||||||
|
self.btnHelp:addClickListener(function()
|
||||||
|
-- ModuleManager.TipsManager:showDescTips(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_9), self.btnHelp)
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.BountyCollectionData, "isDirty", function()
|
||||||
|
self:refresh()
|
||||||
|
end)
|
||||||
|
|
||||||
|
self:updateTime()
|
||||||
|
local meshProComp = self.txTime:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
|
||||||
|
self.timeBg:setSizeDeltaX(meshProComp + 55)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BountyCollectionComp:updateTime()
|
||||||
|
self.txTime:setText(I18N:getGlobalText(I18N.GlobalConst.NEXT_REFRESH_DESC, Time:formatNumTimeStr(DataManager.BountyCollectionData:getRemainTime())))
|
||||||
|
end
|
||||||
|
|
||||||
|
function BountyCollectionComp:refresh()
|
||||||
|
local lv = DataManager.BountyCollectionData:getLevel()
|
||||||
|
local exp = DataManager.BountyCollectionData:getExp()
|
||||||
|
local maxLv = DataManager.BountyCollectionData:getMaxLv()
|
||||||
|
if lv >= maxLv then
|
||||||
|
exp = 0
|
||||||
|
lv = maxLv
|
||||||
|
end
|
||||||
|
self.txLv:setText(lv)
|
||||||
|
local curExp = exp
|
||||||
|
local fullExp = DataManager.BountyCollectionData:getLvUpExp()
|
||||||
|
self.txProg:setText(curExp .. "/" .. fullExp)
|
||||||
|
self.imgProg.value = curExp / fullExp
|
||||||
|
|
||||||
|
local gift1 = ConfigManager:getConfig("act_gift")[DataManager.BountyCollectionData:getProRewardGiftId(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1)]
|
||||||
|
local gift2 = ConfigManager:getConfig("act_gift")[DataManager.BountyCollectionData:getProRewardGiftId(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2)]
|
||||||
|
self.txBuy1:setText(GFunc.getFormatPrice(gift1.recharge_id))
|
||||||
|
self.txBuy2:setText(GFunc.getFormatPrice(gift2.recharge_id))
|
||||||
|
self.txPro:setText(gift2.value .. "%")
|
||||||
|
|
||||||
|
self.btnGet:setActive(DataManager.BountyCollectionData:canGetRewards())
|
||||||
|
self.btnBuy1:setActive(not DataManager.BountyCollectionData:isUnlockReward(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1))
|
||||||
|
self.btnBuy2:setActive(not DataManager.BountyCollectionData:isUnlockReward(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2))
|
||||||
|
|
||||||
|
if self.scrollRect == nil then
|
||||||
|
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
|
self.scrollRect:addInitCallback(function()
|
||||||
|
return CELL
|
||||||
|
end)
|
||||||
|
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||||
|
cell:refresh(index)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
local count = DataManager.BountyCollectionData:getMaxLv()
|
||||||
|
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
|
||||||
|
self.scrollRect:refillCells(count)
|
||||||
|
elseif self.scrollRect:getTotalCount() ~= count then
|
||||||
|
self.scrollRect:clearCells()
|
||||||
|
self.scrollRect:refillCells(count)
|
||||||
|
else
|
||||||
|
self.scrollRect:updateAllCell()
|
||||||
|
end
|
||||||
|
|
||||||
|
self.scrollRect:moveToIndex(DataManager.BountyCollectionData:getMoveIdx())
|
||||||
|
|
||||||
|
-- local rewards = DataManager.BountyCollectionData:getAllRewards(GConst.BountyCollectionConst.REWARD_GEAR.PRO_1)
|
||||||
|
-- for i,v in ipairs(self.pro1_Items) do
|
||||||
|
-- v:setActive(false)
|
||||||
|
-- end
|
||||||
|
-- local index = 0
|
||||||
|
-- for id, reward in pairs(rewards) do
|
||||||
|
-- index = index + 1
|
||||||
|
-- local item = self.pro1_Items[index]
|
||||||
|
-- local txCount = self.pro1_TxCount[index]
|
||||||
|
-- local imgProg = self.pro1_ImgIcon[index]
|
||||||
|
-- if reward then
|
||||||
|
-- item:setActive(true)
|
||||||
|
-- local itemNum = reward.num or 0
|
||||||
|
-- imgProg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, ModuleManager.ItemManager:getItemIcon(id))
|
||||||
|
-- txCount:setText(itemNum)
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- rewards = DataManager.BountyCollectionData:getAllRewards(GConst.BountyCollectionConst.REWARD_GEAR.PRO_2)
|
||||||
|
-- for i,v in ipairs(self.pro2_Items) do
|
||||||
|
-- v:setActive(false)
|
||||||
|
-- end
|
||||||
|
-- index = 0
|
||||||
|
-- for id, reward in pairs(rewards) do
|
||||||
|
-- index = index + 1
|
||||||
|
-- local item = self.pro2_Items[index]
|
||||||
|
-- local txCount = self.pro2_TxCount[index]
|
||||||
|
-- local imgProg = self.pro2_ImgIcon[index]
|
||||||
|
-- if reward then
|
||||||
|
-- item:setActive(true)
|
||||||
|
-- local itemNum = reward.num or 0
|
||||||
|
-- imgProg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, ModuleManager.ItemManager:getItemIcon(id))
|
||||||
|
-- txCount:setText(itemNum)
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.BOUNTY_COLLECTION)
|
||||||
|
end
|
||||||
|
|
||||||
|
return BountyCollectionComp
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 2bc37d625f652654b83c5cedaaa8c2f1
|
guid: 3927d7c172ad64a9c9a46ac6422b78de
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
168
lua/app/ui/fund/bounty_comp.lua
Executable file
168
lua/app/ui/fund/bounty_comp.lua
Executable file
@ -0,0 +1,168 @@
|
|||||||
|
local BountyComp = class("BountyComp", LuaComponent)
|
||||||
|
|
||||||
|
local CELL = "app/ui/privilege/cell/bounty_cell"
|
||||||
|
|
||||||
|
function BountyComp:onClose()
|
||||||
|
end
|
||||||
|
|
||||||
|
function BountyComp:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.txTitle = uiMap["bounty_comp.top.tx_title"]
|
||||||
|
self.btnHelp = uiMap["bounty_comp.top.tx_title.btn_help"]
|
||||||
|
self.txTime = uiMap["bounty_comp.top.time.tx_time"]
|
||||||
|
self.txTips = uiMap["bounty_comp.top.tx_tips"]
|
||||||
|
self.txTips1 = uiMap["bounty_comp.top.img_prog.tx_tips1"]
|
||||||
|
self.levelNode = uiMap["bounty_comp.level_node"]
|
||||||
|
self.txLv = uiMap["bounty_comp.top.level_node.content.level.tx_lv"]
|
||||||
|
self.imgProg = uiMap["bounty_comp.top.level_node.content.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||||
|
self.txProg = uiMap["bounty_comp.top.level_node.content.prog.tx_prog"]
|
||||||
|
self.txLvTips = uiMap["bounty_comp.level_node.content.tx_tips"]
|
||||||
|
self.txToday = uiMap["bounty_comp.level_node.content.tx_today"]
|
||||||
|
self.scrollrect = uiMap["bounty_comp.scrollrect"]
|
||||||
|
self.txLevel = uiMap["bounty_comp.scrollrect.title.tx_level"]
|
||||||
|
self.txCommon = uiMap["bounty_comp.scrollrect.title.tx_common"]
|
||||||
|
self.txPro1 = uiMap["bounty_comp.scrollrect.title.tx_pro_1"]
|
||||||
|
self.txPro2 = uiMap["bounty_comp.scrollrect.title.tx_pro_2"]
|
||||||
|
self.btnGet = uiMap["bounty_comp.btns.btn_get"]
|
||||||
|
self.txGet = uiMap["bounty_comp.btns.btn_get.tx_desc"]
|
||||||
|
self.btnBuy1 = uiMap["bounty_comp.top.btn_buy_1"]
|
||||||
|
self.txBuy1 = uiMap["bounty_comp.top.btn_buy_1.tx_desc"]
|
||||||
|
self.btnBuy2 = uiMap["bounty_comp.top.btn_buy_2"]
|
||||||
|
self.txBuy2 = uiMap["bounty_comp.top.btn_buy_2.tx_desc"]
|
||||||
|
|
||||||
|
|
||||||
|
self.pro1_Items = {}
|
||||||
|
self.pro1_TxCount = {}
|
||||||
|
self.pro1_ImgIcon = {}
|
||||||
|
for i = 1, 4 do
|
||||||
|
local item = uiMap["bounty_comp.top.btn_buy_1.tips_1.groud.item_" .. i]
|
||||||
|
local txCount = uiMap["bounty_comp.top.btn_buy_1.tips_1.groud.item_" .. i .. ".tx_count"]
|
||||||
|
local imgProg = uiMap["bounty_comp.top.btn_buy_1.tips_1.groud.item_" .. i .. ".img_prog"]
|
||||||
|
table.insert(self.pro1_Items, item)
|
||||||
|
table.insert(self.pro1_TxCount, txCount)
|
||||||
|
table.insert(self.pro1_ImgIcon, imgProg)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.pro2_Items = {}
|
||||||
|
self.pro2_TxCount = {}
|
||||||
|
self.pro2_ImgIcon = {}
|
||||||
|
for i = 1, 4 do
|
||||||
|
local item = uiMap["bounty_comp.top.btn_buy_2.tips_2.groud.item_" .. i]
|
||||||
|
local txCount = uiMap["bounty_comp.top.btn_buy_2.tips_2.groud.item_" .. i .. ".tx_count"]
|
||||||
|
local imgProg = uiMap["bounty_comp.top.btn_buy_2.tips_2.groud.item_" .. i .. ".img_prog"]
|
||||||
|
table.insert(self.pro2_Items, item)
|
||||||
|
table.insert(self.pro2_TxCount, txCount)
|
||||||
|
table.insert(self.pro2_ImgIcon, imgProg)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.btnBuy1:addClickListener(function()
|
||||||
|
ModuleManager.BountyManager:onUnlockPro(GConst.BountyConst.REWARD_GEAR.PRO_1)
|
||||||
|
end)
|
||||||
|
self.btnBuy2:addClickListener(function()
|
||||||
|
ModuleManager.BountyManager:onUnlockPro(GConst.BountyConst.REWARD_GEAR.PRO_2)
|
||||||
|
end)
|
||||||
|
self.btnGet:addClickListener(function()
|
||||||
|
ModuleManager.BountyManager:reqGetAllRewards()
|
||||||
|
end)
|
||||||
|
self.btnHelp:addClickListener(function()
|
||||||
|
-- ModuleManager.TipsManager:showDescTips(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_9), self.btnHelp)
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.BountyData, "isDirty", function()
|
||||||
|
self:refresh(true)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- self.txTitle:setSizeDeltaX(400)
|
||||||
|
-- local width = self.txTitle:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
|
||||||
|
-- width = math.min(400, width)
|
||||||
|
-- self.txTitle:setSizeDeltaX(width)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BountyComp:updateTime()
|
||||||
|
self.txTime:setText(I18N:getGlobalText(I18N.GlobalConst.NEXT_REFRESH_DESC, Time:formatNumTimeStr(DataManager.BountyData:getRemainTime())))
|
||||||
|
end
|
||||||
|
|
||||||
|
function BountyComp:refresh(notFirst)
|
||||||
|
local lv = DataManager.BountyData:getLevel()
|
||||||
|
local exp = DataManager.BountyData:getExp()
|
||||||
|
local maxLv = DataManager.BountyData:getMaxLv()
|
||||||
|
if lv >= maxLv then
|
||||||
|
exp = 0
|
||||||
|
lv = maxLv
|
||||||
|
end
|
||||||
|
self.txLv:setText(lv)
|
||||||
|
local curExp = exp
|
||||||
|
local fullExp = DataManager.BountyData:getLvUpExp()
|
||||||
|
self.txProg:setText(curExp .. "/" .. fullExp)
|
||||||
|
self.imgProg.value = curExp / fullExp
|
||||||
|
|
||||||
|
local gift1 = ConfigManager:getConfig("act_gift")[DataManager.BountyData:getProRewardGiftId(GConst.BountyConst.REWARD_GEAR.PRO_1)]
|
||||||
|
local gift2 = ConfigManager:getConfig("act_gift")[DataManager.BountyData:getProRewardGiftId(GConst.BountyConst.REWARD_GEAR.PRO_2)]
|
||||||
|
self.txBuy1:setText(GFunc.getFormatPrice(gift1.recharge_id))
|
||||||
|
self.txBuy2:setText(GFunc.getFormatPrice(gift2.recharge_id))
|
||||||
|
self.txTips1:setText(gift2.value .. "%")
|
||||||
|
|
||||||
|
self.btnGet:setActive(DataManager.BountyData:canGetRewards())
|
||||||
|
self.btnBuy1:setActive(not DataManager.BountyData:isUnlockReward(GConst.BountyConst.REWARD_GEAR.PRO_1))
|
||||||
|
self.btnBuy2:setActive(not DataManager.BountyData:isUnlockReward(GConst.BountyConst.REWARD_GEAR.PRO_2))
|
||||||
|
|
||||||
|
if self.scrollRect == nil then
|
||||||
|
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
|
self.scrollRect:addInitCallback(function()
|
||||||
|
return CELL
|
||||||
|
end)
|
||||||
|
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||||
|
cell:refresh(index)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
local count = DataManager.BountyData:getMaxLv()
|
||||||
|
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
|
||||||
|
self.scrollRect:refillCells(count)
|
||||||
|
elseif self.scrollRect:getTotalCount() ~= count then
|
||||||
|
self.scrollRect:clearCells()
|
||||||
|
self.scrollRect:refillCells(count)
|
||||||
|
else
|
||||||
|
self.scrollRect:updateAllCell()
|
||||||
|
end
|
||||||
|
|
||||||
|
if not notFirst then
|
||||||
|
self.scrollRect:moveToIndex(DataManager.BountyData:getMoveIdx())
|
||||||
|
end
|
||||||
|
|
||||||
|
local rewards = DataManager.BountyData:getAllRewards(GConst.BountyConst.REWARD_GEAR.PRO_1)
|
||||||
|
for i,v in ipairs(self.pro1_Items) do
|
||||||
|
v:setActive(false)
|
||||||
|
end
|
||||||
|
for i,v in ipairs(self.pro2_Items) do
|
||||||
|
v:setActive(false)
|
||||||
|
end
|
||||||
|
local index = 0
|
||||||
|
for id, reward in pairs(rewards) do
|
||||||
|
index = index + 1
|
||||||
|
local item = self.pro1_Items[index]
|
||||||
|
local txCount = self.pro1_TxCount[index]
|
||||||
|
local imgProg = self.pro1_ImgIcon[index]
|
||||||
|
if reward then
|
||||||
|
item:setActive(true)
|
||||||
|
local itemNum = reward.num or 0
|
||||||
|
imgProg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, ModuleManager.ItemManager:getItemIcon(id))
|
||||||
|
txCount:setText(itemNum)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rewards = DataManager.BountyData:getAllRewards(GConst.BountyConst.REWARD_GEAR.PRO_2)
|
||||||
|
index = 0
|
||||||
|
for id, reward in pairs(rewards) do
|
||||||
|
index = index + 1
|
||||||
|
local item = self.pro2_Items[index]
|
||||||
|
local txCount = self.pro2_TxCount[index]
|
||||||
|
local imgProg = self.pro2_ImgIcon[index]
|
||||||
|
if reward then
|
||||||
|
item:setActive(true)
|
||||||
|
local itemNum = reward.num or 0
|
||||||
|
imgProg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, ModuleManager.ItemManager:getItemIcon(id))
|
||||||
|
txCount:setText(itemNum)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return BountyComp
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 25ac045a469b3854c9a8b5ff90fce9e6
|
guid: 70f6846bac89e41f5b7f7cf47f9800f2
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
95
lua/app/ui/fund/cell/fund_tower_cell.lua
Executable file
95
lua/app/ui/fund/cell/fund_tower_cell.lua
Executable file
@ -0,0 +1,95 @@
|
|||||||
|
local FundTowerCell = class("FundTowerCell", BaseCell)
|
||||||
|
|
||||||
|
function FundTowerCell:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.progNode = uiMap["fund_tower_cell.prog"]
|
||||||
|
self.imgProg = uiMap["fund_tower_cell.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||||
|
self.lvNode = uiMap["fund_tower_cell.level"]
|
||||||
|
self.txLv = uiMap["fund_tower_cell.level.tx_lv"]
|
||||||
|
self.freeRewardCells = {}
|
||||||
|
for i = 1, 2 do
|
||||||
|
table.insert(self.freeRewardCells, uiMap["fund_tower_cell.rewards_free.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
|
||||||
|
end
|
||||||
|
self.proRewardCells = {}
|
||||||
|
for i = 1, 2 do
|
||||||
|
table.insert(self.proRewardCells, uiMap["fund_tower_cell.rewards_pro.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
|
||||||
|
end
|
||||||
|
|
||||||
|
self.colorLight = BF.Color(0.6235294, 0.3137255, 0.1764706, 1)
|
||||||
|
self.colorGray = BF.Color(0.3568628, 0.3568628, 0.3568628, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundTowerCell:refresh(index, id, isLast)
|
||||||
|
-- 刷新进度
|
||||||
|
local helf = self:getBaseObject():getSizeDeltaY() / 2
|
||||||
|
if self:getIndex() == 1 then
|
||||||
|
self.progNode:setAnchoredPositionY(-helf / 2)
|
||||||
|
self.progNode:setSizeDeltaY(helf)
|
||||||
|
elseif isLast then
|
||||||
|
self.progNode:setAnchoredPositionY(helf / 2)
|
||||||
|
self.progNode:setSizeDeltaY(helf)
|
||||||
|
else
|
||||||
|
self.progNode:setAnchoredPositionY(0)
|
||||||
|
self.progNode:setSizeDeltaY(self:getBaseObject():getSizeDeltaY())
|
||||||
|
end
|
||||||
|
|
||||||
|
local needChapter = DataManager.TowerFundData:getNeedChapter(id)
|
||||||
|
|
||||||
|
local stage = DataManager.TowerFundData:getStageById(id)
|
||||||
|
local curLayer = DataManager.TowerData:getCurMaxLayer()
|
||||||
|
|
||||||
|
self.txLv:setText(needChapter)
|
||||||
|
if curLayer >= needChapter then
|
||||||
|
self.imgProg.value = 1
|
||||||
|
self.lvNode:setSprite(GConst.ATLAS_PATH.UI_TOUWE, "tower_dec_2")
|
||||||
|
-- self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).color = self.colorLight
|
||||||
|
else
|
||||||
|
self.imgProg.value = 0
|
||||||
|
self.lvNode:setSprite(GConst.ATLAS_PATH.UI_TOUWE, "tower_dec_3")
|
||||||
|
-- self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).color = self.colorGray
|
||||||
|
end
|
||||||
|
|
||||||
|
local freeRewards = DataManager.TowerFundData:getFreeRewards(id)
|
||||||
|
local freeReceived = DataManager.TowerFundData:getFreeGot(id)
|
||||||
|
local canGet = DataManager.TowerFundData:getFreeCanGet(id)
|
||||||
|
for i, cell in ipairs(self.freeRewardCells) do
|
||||||
|
if freeRewards and freeRewards[i] then
|
||||||
|
cell:showCell()
|
||||||
|
cell:refreshByConfig(freeRewards[i], freeReceived, freeReceived)
|
||||||
|
if canGet then
|
||||||
|
cell:addClickListener(function()
|
||||||
|
ModuleManager.FundTowerManager:getReward(stage)
|
||||||
|
end)
|
||||||
|
cell:showFrameAnimation()
|
||||||
|
else
|
||||||
|
cell:hideFrameAnimation()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
cell:hideCell()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local proRewards = DataManager.TowerFundData:getProRewards(id)
|
||||||
|
local proReceived = DataManager.TowerFundData:getProGot(id)
|
||||||
|
local locked = not DataManager.TowerFundData:getProBought(stage)
|
||||||
|
local canGet = DataManager.TowerFundData:getProCanGet(id)
|
||||||
|
for i, cell in ipairs(self.proRewardCells) do
|
||||||
|
if proRewards and proRewards[i] then
|
||||||
|
cell:showCell()
|
||||||
|
cell:refreshByConfig(proRewards[i], proReceived, proReceived)
|
||||||
|
cell:showLock(locked)
|
||||||
|
if canGet then
|
||||||
|
cell:addClickListener(function()
|
||||||
|
ModuleManager.FundTowerManager:getReward(stage)
|
||||||
|
end)
|
||||||
|
cell:showFrameAnimation()
|
||||||
|
else
|
||||||
|
cell:hideFrameAnimation()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
cell:hideCell()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return FundTowerCell
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 3e3a08bdfecbd8b49ada85fa70fe5c8b
|
guid: cb54eb5ca6d0d4fcdbd53a0bd5f8abac
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -1,89 +0,0 @@
|
|||||||
local GrowthFundCell = class("GrowthFundCell", BaseCell)
|
|
||||||
|
|
||||||
local Fund_REWARD_CELL = "app/ui/fund/cell/growth_fund_reward_cell"
|
|
||||||
|
|
||||||
function GrowthFundCell:init()
|
|
||||||
local uiMap = self:getUIMap()
|
|
||||||
local width = GConst.UI_SCREEN_WIDTH
|
|
||||||
|
|
||||||
self.fundRewardCell1 = uiMap["growth_fund_cell.fund_reward_cell_1"]:addLuaComponent(Fund_REWARD_CELL)
|
|
||||||
self.fundRewardCell1:setAnchoredPositionX(-width/3)
|
|
||||||
self.fundRewardCell1:addClickListener(function()
|
|
||||||
if self.fundId == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local iCslaimed = DataManager.GrowthFundData:getIsClaimedBase(self.fundId)
|
|
||||||
local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId)
|
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
|
||||||
if not iCslaimed and playerLevel >= needLevel then
|
|
||||||
ModuleManager.FundManager:claimFundRewards()
|
|
||||||
else
|
|
||||||
local freeReward = DataManager.GrowthFundData:getFreeFundRewards(self.fundId)
|
|
||||||
local reward = freeReward and freeReward[1]
|
|
||||||
if reward then
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell1:getBaseObject())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.fundRewardCell2 = uiMap["growth_fund_cell.fund_reward_cell_2"]:addLuaComponent(Fund_REWARD_CELL)
|
|
||||||
self.fundRewardCell2:addClickListener(function()
|
|
||||||
if self.fundId == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local iCslaimed = DataManager.GrowthFundData:getIsClaimedBase(self.fundId)
|
|
||||||
local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId)
|
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
|
||||||
if not iCslaimed and playerLevel >= needLevel and DataManager.GrowthFundData:getIsBoughtBase(self.fundId) then
|
|
||||||
ModuleManager.FundManager:claimFundRewards()
|
|
||||||
else
|
|
||||||
local baseReward = DataManager.GrowthFundData:getBaseFundRewards(self.fundId)
|
|
||||||
local reward = baseReward and baseReward[1]
|
|
||||||
if reward then
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell2:getBaseObject())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.fundRewardCell3 = uiMap["growth_fund_cell.fund_reward_cell_3"]:addLuaComponent(Fund_REWARD_CELL)
|
|
||||||
self.fundRewardCell3:addClickListener(function()
|
|
||||||
if self.fundId == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local iCslaimed = DataManager.GrowthFundData:getIsClaimedAdvance(self.fundId)
|
|
||||||
local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId)
|
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
|
||||||
if not iCslaimed and playerLevel >= needLevel and DataManager.GrowthFundData:getIsBoughtAdvance(self.fundId) then
|
|
||||||
ModuleManager.FundManager:claimFundRewards()
|
|
||||||
else
|
|
||||||
local advanceReward = DataManager.GrowthFundData:getAdvanceFundRewards(self.fundId)
|
|
||||||
local reward = advanceReward and advanceReward[1]
|
|
||||||
if reward then
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell3:getBaseObject())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.fundRewardCell3:setAnchoredPositionX(width/3)
|
|
||||||
self.levelBg = uiMap["growth_fund_cell.lv_bg"]
|
|
||||||
self.levelBg:setAnchoredPositionX(-width/6)
|
|
||||||
self.levelGrayImg = uiMap["growth_fund_cell.lv_bg.gray"]
|
|
||||||
self.levelTx = uiMap["growth_fund_cell.lv_bg.tx"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundCell:refresh(id)
|
|
||||||
self.fundId = id
|
|
||||||
local GrowthFundData = DataManager.GrowthFundData
|
|
||||||
local needLevel = DataManager.GrowthFundData:getNeedLevel(id)
|
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
|
||||||
local isActive = playerLevel >= needLevel
|
|
||||||
self.levelGrayImg:setVisible(not isActive)
|
|
||||||
self.levelTx:setText(GFunc.intToString(needLevel))
|
|
||||||
local freeReward, baseReward, advanceReward = GrowthFundData:getAllStepFundRewards(id)
|
|
||||||
self.fundRewardCell1:refresh(freeReward[1], isActive and 1 or 0, false, GrowthFundData:getIsClaimedFree(id))
|
|
||||||
self.fundRewardCell2:refresh(baseReward[1], isActive and 2 or 0, not GrowthFundData:getIsBoughtBase(id), GrowthFundData:getIsClaimedBase(id))
|
|
||||||
self.fundRewardCell3:refresh(advanceReward[1], isActive and 3 or 0, not GrowthFundData:getIsBoughtAdvance(id), GrowthFundData:getIsClaimedAdvance(id))
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
return GrowthFundCell
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
local GrowthFundRewardCell = class("GrowthFundRewardCell", BaseCell)
|
|
||||||
|
|
||||||
function GrowthFundRewardCell:init()
|
|
||||||
local uiMap = self:getUIMap()
|
|
||||||
self.bg = uiMap["fund_reward_cell.bg"]
|
|
||||||
self.icon = uiMap["fund_reward_cell.icon"]
|
|
||||||
self.numTx = uiMap["fund_reward_cell.num"]
|
|
||||||
self.check = uiMap["fund_reward_cell.check"]
|
|
||||||
self.fragment = uiMap["fund_reward_cell.fragment"]
|
|
||||||
self.light = uiMap["fund_reward_cell.light"]
|
|
||||||
self.lock = uiMap["fund_reward_cell.lock"]
|
|
||||||
self.baseObject:addClickListener(function()
|
|
||||||
if self.clickCallback then
|
|
||||||
self.clickCallback()
|
|
||||||
elseif self.rewardId ~= nil then
|
|
||||||
ModuleManager.TipsManager:showRewardTips(self.rewardId, self.rewardType, self.baseObject)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundRewardCell:refresh(reward, step, isLock, showCheck)
|
|
||||||
if step == 0 then
|
|
||||||
self.bg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_5")
|
|
||||||
elseif step == 1 then
|
|
||||||
self.bg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_2")
|
|
||||||
elseif step == 2 then
|
|
||||||
self.bg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_3")
|
|
||||||
else
|
|
||||||
self.bg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_4")
|
|
||||||
end
|
|
||||||
if isLock then
|
|
||||||
self.lock:setVisible(true)
|
|
||||||
self.light:setVisible(false)
|
|
||||||
else
|
|
||||||
self.lock:setVisible(false)
|
|
||||||
if step == 0 or showCheck then
|
|
||||||
self.light:setVisible(false)
|
|
||||||
else
|
|
||||||
self.light:setVisible(true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.check:setVisible(showCheck == true)
|
|
||||||
if reward.type == GConst.REWARD_TYPE.ITEM then
|
|
||||||
self:_refreshItem(reward)
|
|
||||||
self.rewardId = reward.id
|
|
||||||
self.rewardType = reward.type
|
|
||||||
else
|
|
||||||
self.rewardId = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundRewardCell:_refreshItem(item)
|
|
||||||
local info = ConfigManager:getConfig("item")[item.id]
|
|
||||||
if info == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
self.numTx:setText(item.count or item.num)
|
|
||||||
if info.type == GConst.ItemConst.ITEM_TYPE.HERO_FRAGMENT then
|
|
||||||
local heroInfo = ConfigManager:getConfig("hero")[info.parameter]
|
|
||||||
if heroInfo then
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, heroInfo.icon)
|
|
||||||
else
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.COMMON, "common_alpha")
|
|
||||||
end
|
|
||||||
self.fragment:setVisible(true)
|
|
||||||
else
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon)
|
|
||||||
self.fragment:setVisible(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundRewardCell:setVisible(visible)
|
|
||||||
self.baseObject:setActive(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundRewardCell:setAnchoredPositionX(x)
|
|
||||||
self.baseObject:setAnchoredPositionX(x)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundRewardCell:setTouchEnable(enable)
|
|
||||||
self.baseObject:setTouchEnable(enable)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundRewardCell:addClickListener(callback)
|
|
||||||
self.clickCallback = callback
|
|
||||||
end
|
|
||||||
|
|
||||||
return GrowthFundRewardCell
|
|
||||||
191
lua/app/ui/fund/fund_chapter_comp.lua
Executable file
191
lua/app/ui/fund/fund_chapter_comp.lua
Executable file
@ -0,0 +1,191 @@
|
|||||||
|
local FundChapterComp = class("FundChapterComp", LuaComponent)
|
||||||
|
|
||||||
|
local CELL = "app/ui/privilege/cell/fund_chapter_cell"
|
||||||
|
|
||||||
|
local TAG_COMMON_TOTAL_SIZE = 640
|
||||||
|
local TAG_SIZE = 178
|
||||||
|
|
||||||
|
function FundChapterComp:onClose()
|
||||||
|
self.curStage = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundChapterComp:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.banner = uiMap["fund_chapter_comp.bg.banner"]
|
||||||
|
self.txTitle = uiMap["fund_chapter_comp.top.tx_title"]
|
||||||
|
self.bg = uiMap["fund_chapter_comp.top.bg"]
|
||||||
|
self.txDesc = uiMap["fund_chapter_comp.top.bg.desc_1"]
|
||||||
|
self.txDesc2 = uiMap["fund_chapter_comp.top.bg.desc_2"]
|
||||||
|
self.btnHelp = uiMap["fund_chapter_comp.top.tx_title.btn_help"]
|
||||||
|
self.scrollrect = uiMap["fund_chapter_comp.scrollrect"]
|
||||||
|
self.txLevel = uiMap["fund_chapter_comp.scrollrect.title.tx_level"]
|
||||||
|
self.txCommon = uiMap["fund_chapter_comp.scrollrect.title.tx_common"]
|
||||||
|
self.txPro = uiMap["fund_chapter_comp.scrollrect.title.tx_pro"]
|
||||||
|
self.btnGet = uiMap["fund_chapter_comp.btns.btn_get"]
|
||||||
|
self.txGet = uiMap["fund_chapter_comp.btns.btn_get.tx_desc"]
|
||||||
|
self.btnBuy = uiMap["fund_chapter_comp.btns.btn_buy"]
|
||||||
|
self.txCost = uiMap["fund_chapter_comp.btns.btn_buy.tx_cost"]
|
||||||
|
self.tagsNode = uiMap["fund_chapter_comp.tags"]
|
||||||
|
self.tagsViewport = uiMap["fund_chapter_comp.tags.viewport"]
|
||||||
|
self.tagsContent = uiMap["fund_chapter_comp.tags.viewport.content"]
|
||||||
|
self.tags = {}
|
||||||
|
self.tagImgs = {}
|
||||||
|
self.tagDescs = {}
|
||||||
|
for i = 1, 20 do
|
||||||
|
table.insert(self.tags, uiMap["fund_chapter_comp.tags.viewport.content.tag_" .. i])
|
||||||
|
table.insert(self.tagImgs, uiMap["fund_chapter_comp.tags.viewport.content.tag_" .. i .. ".img"])
|
||||||
|
table.insert(self.tagDescs, uiMap["fund_chapter_comp.tags.viewport.content.tag_" .. i .. ".img.tx_desc"])
|
||||||
|
end
|
||||||
|
|
||||||
|
self.btnBuy:addClickListener(function()
|
||||||
|
local giftId = DataManager.ChapterFundData:getProGiftId(self.curStage)
|
||||||
|
ModuleManager.FundChapterManager:onBuyLevelGift(giftId)
|
||||||
|
end)
|
||||||
|
self.btnGet:addClickListener(function()
|
||||||
|
ModuleManager.FundChapterManager:getReward(self.curStage)
|
||||||
|
end)
|
||||||
|
self.btnHelp:addClickListener(function()
|
||||||
|
ModuleManager.TipsManager:showDescTips(I18N:getGlobalText(I18N.GlobalConst.FUND_CHAPTER_DESC_2), self.btnHelp)
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.ChapterFundData, "isDirty", function()
|
||||||
|
if not DataManager.ChapterFundData:getIsOpen() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not DataManager.ChapterFundData:isStageUnlock(self.curStage) then
|
||||||
|
self.curStage = DataManager.ChapterFundData:getCurStage()
|
||||||
|
end
|
||||||
|
if self.curStage == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not DataManager.ChapterFundData:canGetRewards(self.curStage) then
|
||||||
|
local claimedStage = DataManager.ChapterFundData:getMinUnclaimedStage()
|
||||||
|
if claimedStage ~= nil then
|
||||||
|
self.curStage = claimedStage
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:refresh(true)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundChapterComp:refresh(isAuto)
|
||||||
|
if self.curStage == nil then
|
||||||
|
self.curStage = DataManager.ChapterFundData:getMinUnclaimedStage() or DataManager.ChapterFundData:getMaxUnclaimedStage()
|
||||||
|
isAuto = true
|
||||||
|
end
|
||||||
|
|
||||||
|
self:updateData(self.curStage)
|
||||||
|
self:refreshStageTags()
|
||||||
|
if isAuto then
|
||||||
|
local stageList = DataManager.ChapterFundData:getUnlockStageList()
|
||||||
|
local index
|
||||||
|
for k, v in pairs(stageList) do
|
||||||
|
if self.curStage == v then
|
||||||
|
index = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if index then
|
||||||
|
self.tagsContent:setAnchoredPositionX(-self.tags[index]:getAnchoredPositionX())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not DataManager.ChapterFundData:getProBought(self.curStage) then
|
||||||
|
local giftId = DataManager.ChapterFundData:getProGiftId(self.curStage)
|
||||||
|
local cfg = ConfigManager:getConfig("act_gift")[giftId]
|
||||||
|
self.txCost:setText(GFunc.getFormatPrice(cfg.recharge_id))
|
||||||
|
self.btnBuy:setActive(true)
|
||||||
|
else
|
||||||
|
self.btnBuy:setActive(false)
|
||||||
|
end
|
||||||
|
self.btnGet:setActive(DataManager.ChapterFundData:canGetRewards(self.curStage))
|
||||||
|
|
||||||
|
if self.curStage == 1 then
|
||||||
|
self.banner:setTexture("assets/arts/textures/background/fund/fund_banner_1.png")
|
||||||
|
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.FUND_CHAPTER_DESC_1))
|
||||||
|
else
|
||||||
|
self.banner:setTexture("assets/arts/textures/background/fund/fund_banner_1.png")
|
||||||
|
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst["FUND_CHAPTER_TAG_DESC_" .. self.curStage]))
|
||||||
|
end
|
||||||
|
local w = self.txTitle:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
|
||||||
|
if w > 300 then
|
||||||
|
self.txTitle:setSizeDeltaX(310)
|
||||||
|
else
|
||||||
|
self.txTitle:setSizeDeltaX(w + 10)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.maxIndex = #self.cfgList
|
||||||
|
self.minIndex = DataManager.ChapterFundData:getMinUnclaimedRewardIndex(self.curStage)
|
||||||
|
if self.scrollRect == nil then
|
||||||
|
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
|
self.scrollRect:addInitCallback(function()
|
||||||
|
return CELL
|
||||||
|
end)
|
||||||
|
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||||
|
cell:refresh(self.cfgList[index], index == self.maxIndex)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
|
||||||
|
self.scrollRect:refillCells(self.maxIndex)
|
||||||
|
elseif self.scrollRect:getTotalCount() ~= self.maxIndex then
|
||||||
|
self.scrollRect:clearCells()
|
||||||
|
self.scrollRect:refillCells(self.maxIndex)
|
||||||
|
else
|
||||||
|
self.scrollRect:updateAllCell()
|
||||||
|
end
|
||||||
|
self.scrollRect:moveToIndex(self.minIndex)
|
||||||
|
if self.curStage then
|
||||||
|
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.FUND_LEVEL .. self.curStage)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundChapterComp:updateData(stage)
|
||||||
|
stage = stage or DataManager.ChapterFundData:getCurStage()
|
||||||
|
if DataManager.ChapterFundData:getIsOpen(stage) then
|
||||||
|
self.cfgList = DataManager.ChapterFundData:getListByStage(stage)
|
||||||
|
else
|
||||||
|
self.cfgList = {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundChapterComp:onClickStageTag(stage)
|
||||||
|
self.curStage = stage
|
||||||
|
self:refresh()
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundChapterComp:refreshStageTags()
|
||||||
|
local stageList = DataManager.ChapterFundData:getUnlockStageList()
|
||||||
|
if #stageList <= 1 then
|
||||||
|
self.tagsNode:setActive(false)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.tagsNode:setActive(true)
|
||||||
|
local totalWidth = #stageList * TAG_SIZE + (#stageList - 1) * 5
|
||||||
|
self.tagsContent:setSizeDeltaX(totalWidth)
|
||||||
|
self.tagsViewport:setSizeDeltaX(totalWidth < TAG_COMMON_TOTAL_SIZE and totalWidth or TAG_COMMON_TOTAL_SIZE)
|
||||||
|
|
||||||
|
for i, tag in ipairs(self.tags) do
|
||||||
|
local stage = stageList[i]
|
||||||
|
if stage then
|
||||||
|
tag:setActive(true)
|
||||||
|
local isSelect = self.curStage == stage
|
||||||
|
self.tagImgs[i]:setSprite(GConst.ATLAS_PATH.COMMON, isSelect and "common_menu_4" or "common_menu_5")
|
||||||
|
self.tagImgs[i]:setAnchoredPositionY(isSelect and 5 or 0)
|
||||||
|
self.tagDescs[i]:setText(I18N:getGlobalText(I18N.GlobalConst["FUND_CHAPTER_TAG_DESC_" .. stage]))
|
||||||
|
|
||||||
|
if DataManager.ChapterFundData:canGetRewards(stage) then
|
||||||
|
tag:addRedPoint(80, 33, 0.9)
|
||||||
|
else
|
||||||
|
tag:removeRedPoint()
|
||||||
|
end
|
||||||
|
|
||||||
|
tag:addClickListener(function()
|
||||||
|
if isSelect then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:onClickStageTag(stage)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
tag:setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return FundChapterComp
|
||||||
10
lua/app/ui/fund/fund_chapter_comp.lua.meta
Normal file
10
lua/app/ui/fund/fund_chapter_comp.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 83a20fb24b94e4aec8813262035e4230
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
219
lua/app/ui/fund/fund_level_comp.lua
Executable file
219
lua/app/ui/fund/fund_level_comp.lua
Executable file
@ -0,0 +1,219 @@
|
|||||||
|
local FundLevelComp = class("FundLevelComp", LuaComponent)
|
||||||
|
|
||||||
|
local CELL = "app/ui/privilege/cell/fund_level_cell"
|
||||||
|
|
||||||
|
local TAG_COMMON_TOTAL_SIZE = 640
|
||||||
|
local TAG_SIZE = 178
|
||||||
|
|
||||||
|
function FundLevelComp:onClose()
|
||||||
|
self.curStage = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundLevelComp:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.banner = uiMap["fund_level_comp.bg.banner"]
|
||||||
|
self.txTitle = uiMap["fund_level_comp.top.tx_title"]
|
||||||
|
self.bg = uiMap["fund_level_comp.top.bg"]
|
||||||
|
self.txDesc = uiMap["fund_level_comp.top.bg.desc_1"]
|
||||||
|
self.txDesc2 = uiMap["fund_level_comp.top.bg.desc_2"]
|
||||||
|
self.btnHelp = uiMap["fund_level_comp.top.tx_title.btn_help"]
|
||||||
|
self.scrollrect = uiMap["fund_level_comp.scrollrect"]
|
||||||
|
self.txLevel = uiMap["fund_level_comp.scrollrect.title.tx_level"]
|
||||||
|
self.txCommon = uiMap["fund_level_comp.scrollrect.title.tx_common"]
|
||||||
|
self.txPro = uiMap["fund_level_comp.scrollrect.title.tx_pro"]
|
||||||
|
self.btnGet = uiMap["fund_level_comp.btns.btn_get"]
|
||||||
|
self.txGet = uiMap["fund_level_comp.btns.btn_get.tx_desc"]
|
||||||
|
self.btnBuy = uiMap["fund_level_comp.btns.btn_buy"]
|
||||||
|
self.txCost = uiMap["fund_level_comp.btns.btn_buy.tx_cost"]
|
||||||
|
self.tagsNode = uiMap["fund_level_comp.tags"]
|
||||||
|
self.tagsViewport = uiMap["fund_level_comp.tags.viewport"]
|
||||||
|
self.tagsContent = uiMap["fund_level_comp.tags.viewport.content"]
|
||||||
|
self.tags = {}
|
||||||
|
self.tagImgs = {}
|
||||||
|
self.tagDescs = {}
|
||||||
|
for i = 1, 20 do
|
||||||
|
table.insert(self.tags, uiMap["fund_level_comp.tags.viewport.content.tag_" .. i])
|
||||||
|
table.insert(self.tagImgs, uiMap["fund_level_comp.tags.viewport.content.tag_" .. i .. ".img"])
|
||||||
|
table.insert(self.tagDescs, uiMap["fund_level_comp.tags.viewport.content.tag_" .. i .. ".img.tx_desc"])
|
||||||
|
end
|
||||||
|
self.imgProgress = uiMap["fund_level_comp.top.img_prog"]
|
||||||
|
self.txProg = uiMap["fund_level_comp.top.img_prog.tx_prog"]
|
||||||
|
self.txGetAll = uiMap["fund_level_comp.top.bg.desc_2.img_reward.tx_get_all"]
|
||||||
|
|
||||||
|
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.FUND_DESC_4))
|
||||||
|
self.txDesc2:setText(I18N:getGlobalText(I18N.GlobalConst.FORCE_DESC_29))
|
||||||
|
self.txLevel:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_5))
|
||||||
|
self.txCommon:setText(I18N:getGlobalText(I18N.GlobalConst.FUND_DESC_5))
|
||||||
|
self.txPro:setText(I18N:getGlobalText(I18N.GlobalConst.FUND_DESC_6))
|
||||||
|
self.txGet:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CLAIMALL))
|
||||||
|
|
||||||
|
self.btnBuy:addClickListener(function()
|
||||||
|
local giftId = DataManager.FundLevelData:getProActId(self.curStage)
|
||||||
|
ModuleManager.FundLevelManager:onBuyLevelGift(giftId)
|
||||||
|
end)
|
||||||
|
self.btnGet:addClickListener(function()
|
||||||
|
ModuleManager.FundLevelManager:getReward(self.curStage)
|
||||||
|
end)
|
||||||
|
self.btnHelp:addClickListener(function()
|
||||||
|
ModuleManager.TipsManager:showDescTips(I18N:getGlobalText(I18N.GlobalConst.FUND_DESC_2), self.btnHelp)
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.FundLevelData, "isDirty", function()
|
||||||
|
if not DataManager.FundLevelData:getIsOpen() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not DataManager.FundLevelData:isStageUnlock(self.curStage) then
|
||||||
|
self.curStage = DataManager.FundLevelData:getCurStage()
|
||||||
|
end
|
||||||
|
if self.curStage == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not DataManager.FundLevelData:canGetRewards(self.curStage) then
|
||||||
|
local claimedStage = DataManager.FundLevelData:getMinUnclaimedStage()
|
||||||
|
if claimedStage ~= nil then
|
||||||
|
self.curStage = claimedStage
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:refresh(true)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundLevelComp:refresh(isAuto)
|
||||||
|
if self.curStage == nil then
|
||||||
|
self.curStage = DataManager.FundLevelData:getMinUnclaimedStage() or DataManager.FundLevelData:getMaxUnclaimedStage()
|
||||||
|
isAuto = true
|
||||||
|
end
|
||||||
|
|
||||||
|
self:updateData(self.curStage)
|
||||||
|
self:refreshStageTags()
|
||||||
|
if isAuto then
|
||||||
|
local stageList = DataManager.FundLevelData:getUnlockStageList()
|
||||||
|
local index
|
||||||
|
for k, v in pairs(stageList) do
|
||||||
|
if self.curStage == v then
|
||||||
|
index = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if index then
|
||||||
|
self.tagsContent:setAnchoredPositionX(-self.tags[index]:getAnchoredPositionX())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not DataManager.FundLevelData:getProBought(self.curStage) then
|
||||||
|
local giftId = DataManager.FundLevelData:getProActId(self.curStage)
|
||||||
|
local cfg = ConfigManager:getConfig("act_gift")[giftId]
|
||||||
|
self.txCost:setText(GFunc.getFormatPrice(cfg.recharge_id))
|
||||||
|
self.txProg:setText(cfg.value .. "%")
|
||||||
|
self.btnBuy:setActive(true)
|
||||||
|
else
|
||||||
|
self.btnBuy:setActive(false)
|
||||||
|
end
|
||||||
|
self.btnGet:setActive(DataManager.FundLevelData:canGetRewards(self.curStage))
|
||||||
|
|
||||||
|
if self.curStage == 1 then
|
||||||
|
self.banner:setTexture("assets/arts/textures/background/fund/fund_banner_2.png")
|
||||||
|
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.FUND_DESC_1))
|
||||||
|
else
|
||||||
|
self.banner:setTexture("assets/arts/textures/background/fund/fund_banner_2.png")
|
||||||
|
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst["FUND_TAG_DESC_" .. self.curStage]))
|
||||||
|
end
|
||||||
|
local w = self.txTitle:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
|
||||||
|
if w > 600 then
|
||||||
|
self.txTitle:setSizeDeltaX(610)
|
||||||
|
else
|
||||||
|
self.txTitle:setSizeDeltaX(w + 10)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.maxIndex = #self.cfgList
|
||||||
|
self.minIndex = DataManager.FundLevelData:getMinUnclaimedRewardIndex(self.curStage)
|
||||||
|
if self.scrollRect == nil then
|
||||||
|
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
|
self.scrollRect:addInitCallback(function()
|
||||||
|
return CELL
|
||||||
|
end)
|
||||||
|
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||||
|
cell:refresh(self.cfgList[index], index == self.maxIndex)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
|
||||||
|
self.scrollRect:refillCells(self.maxIndex)
|
||||||
|
elseif self.scrollRect:getTotalCount() ~= self.maxIndex then
|
||||||
|
self.scrollRect:clearCells()
|
||||||
|
self.scrollRect:refillCells(self.maxIndex)
|
||||||
|
else
|
||||||
|
self.scrollRect:updateAllCell()
|
||||||
|
end
|
||||||
|
self.scrollRect:moveToIndex(self.minIndex)
|
||||||
|
|
||||||
|
if self.curStage then
|
||||||
|
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.FUND_CHAPTER .. self.curStage)
|
||||||
|
end
|
||||||
|
local count = 0
|
||||||
|
for i,id in ipairs(self.cfgList) do
|
||||||
|
local cfgFree = DataManager.FundLevelData:getFreeRewards(id)
|
||||||
|
local cfgPro = DataManager.FundLevelData:getProRewards(id)
|
||||||
|
if cfgFree then
|
||||||
|
for _,v in ipairs(cfgFree) do
|
||||||
|
count = count + v.num
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if cfgPro then
|
||||||
|
for _,v in ipairs(cfgPro) do
|
||||||
|
count = count + v.num
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.txGetAll:setText(count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundLevelComp:updateData(stage)
|
||||||
|
stage = stage or DataManager.FundLevelData:getCurStage()
|
||||||
|
if DataManager.FundLevelData:getIsOpen(stage) then
|
||||||
|
self.cfgList = DataManager.FundLevelData:getListByStage(stage)
|
||||||
|
else
|
||||||
|
self.cfgList = {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundLevelComp:onClickStageTag(stage)
|
||||||
|
self.curStage = stage
|
||||||
|
self:refresh()
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundLevelComp:refreshStageTags()
|
||||||
|
local stageList = DataManager.FundLevelData:getUnlockStageList()
|
||||||
|
if #stageList <= 1 then
|
||||||
|
self.tagsNode:setActive(false)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.tagsNode:setActive(true)
|
||||||
|
local totalWidth = #stageList * TAG_SIZE + (#stageList - 1) * 5
|
||||||
|
self.tagsContent:setSizeDeltaX(totalWidth)
|
||||||
|
self.tagsViewport:setSizeDeltaX(totalWidth < TAG_COMMON_TOTAL_SIZE and totalWidth or TAG_COMMON_TOTAL_SIZE)
|
||||||
|
|
||||||
|
for i, tag in ipairs(self.tags) do
|
||||||
|
local stage = stageList[i]
|
||||||
|
if stage then
|
||||||
|
tag:setActive(true)
|
||||||
|
local isSelect = self.curStage == stage
|
||||||
|
self.tagImgs[i]:setSprite(GConst.ATLAS_PATH.COMMON, isSelect and "common_menu_4" or "common_menu_5")
|
||||||
|
self.tagImgs[i]:setAnchoredPositionY(isSelect and 5 or 0)
|
||||||
|
self.tagDescs[i]:setText(I18N:getGlobalText(I18N.GlobalConst["FUND_TAG_DESC_" .. stage]))
|
||||||
|
|
||||||
|
if DataManager.FundLevelData:canGetRewards(stage) then
|
||||||
|
tag:addRedPoint(80, 33, 0.9)
|
||||||
|
else
|
||||||
|
tag:removeRedPoint()
|
||||||
|
end
|
||||||
|
|
||||||
|
tag:addClickListener(function()
|
||||||
|
if isSelect then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:onClickStageTag(stage)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
tag:setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return FundLevelComp
|
||||||
10
lua/app/ui/fund/fund_level_comp.lua.meta
Normal file
10
lua/app/ui/fund/fund_level_comp.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 919c89f0eec9b4ba3b0d387882b59bf1
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
290
lua/app/ui/fund/fund_main_ui.lua
Executable file
290
lua/app/ui/fund/fund_main_ui.lua
Executable file
@ -0,0 +1,290 @@
|
|||||||
|
local FundMainUI = class("FundMainUI", BaseUI)
|
||||||
|
-- FundMainUI
|
||||||
|
local BTN_WIDTH = 82
|
||||||
|
local BTN_RIGHT = 20
|
||||||
|
local BTN_SPACING = 26
|
||||||
|
|
||||||
|
function FundMainUI:showCommonBG()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:onPressBackspace()
|
||||||
|
self:closeUI()
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/fund/fund_main_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:onClose()
|
||||||
|
if self.subComps then
|
||||||
|
for _, comp in pairs(self.subComps) do
|
||||||
|
if comp.onClose then
|
||||||
|
comp:onClose()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP)
|
||||||
|
|
||||||
|
local callback = self.callback
|
||||||
|
self.callback = nil
|
||||||
|
if callback then
|
||||||
|
callback()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:ctor(param)
|
||||||
|
if param and param.showPage then
|
||||||
|
self.curPage = param.showPage
|
||||||
|
self.onlyShowPage = param.onlyShowPage
|
||||||
|
self.callback = param.callback
|
||||||
|
else
|
||||||
|
self:switchOtherPage()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:onLoadRootComplete()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
self.btnClose = uiMap["fund_main_ui.bottom.btn_close"]
|
||||||
|
self.btnNode = uiMap["fund_main_ui.bottom.btns"]
|
||||||
|
self.btnContent = uiMap["fund_main_ui.bottom.btns.viewport.content"]
|
||||||
|
self.btns = {}
|
||||||
|
self.txBtns = {}
|
||||||
|
for i = 1, table.nums(GConst.ShopConst.FUND_SHOW_PAGE) do
|
||||||
|
table.insert(self.btns, uiMap["fund_main_ui.bottom.btns.viewport.content.btn_" .. i])
|
||||||
|
table.insert(self.txBtns, uiMap["fund_main_ui.bottom.btns.viewport.content.btn_" .. i .. ".tx_desc"])
|
||||||
|
end
|
||||||
|
self.compsRoot = uiMap["fund_main_ui.comps"]
|
||||||
|
for i, btn in ipairs(self.btns) do
|
||||||
|
self.txBtns[i]:setText(I18N:getGlobalText(I18N.GlobalConst[GConst.ShopConst.FUND_PAGE_BTN_DESC[i]]))
|
||||||
|
btn:addClickListener(function()
|
||||||
|
self:onChangePage(i)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
self:initComps()
|
||||||
|
self:scheduleGlobal(function()
|
||||||
|
self:updateTime()
|
||||||
|
end, 1)
|
||||||
|
self:updateTime()
|
||||||
|
|
||||||
|
self.btnClose:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.FundLevelData, "isDirty", function()
|
||||||
|
self:refreshRedPoint()
|
||||||
|
if self.curPage ~= GConst.ShopConst.FUND_SHOW_PAGE.FUND then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.ChapterFundData, "isDirty", function()
|
||||||
|
self:refreshRedPoint()
|
||||||
|
if self.curPage ~= GConst.ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.BountyData, "isDirty", function()
|
||||||
|
self:refreshRedPoint()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.BountyCollectionData, "isDirty", function()
|
||||||
|
self:refreshRedPoint()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.TowerData, "isDirty", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.TowerFundData, "isDirty", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.BountyGrowthData, "isDirty", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.PaymentData, "isDirty", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:initComps()
|
||||||
|
if self.subComps then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
self.subComps = {}
|
||||||
|
|
||||||
|
for k, id in pairs(GConst.ShopConst.FUND_SHOW_PAGE) do
|
||||||
|
if GConst.ShopConst.FUND_COMP_NAME[id] then
|
||||||
|
-- 预制体挂载
|
||||||
|
local obj = uiMap[GConst.ShopConst.FUND_COMP_NAME[id]]
|
||||||
|
self:initGlobalHelp(obj)
|
||||||
|
obj:initPrefabHelper()
|
||||||
|
obj:genAllChildren()
|
||||||
|
local comp = obj:addLuaComponent(GConst.ShopConst.FUND_COMP[id])
|
||||||
|
self.subComps[id] = comp
|
||||||
|
elseif GConst.ShopConst.FUND_COMP_PATH[id] then
|
||||||
|
-- 动态加载
|
||||||
|
self:loadModule(GConst.ShopConst.FUND_COMP_PATH[id], self.compsRoot, GConst.ShopConst.FUND_COMP[id], function(comp)
|
||||||
|
comp:getBaseObject():setActive(false)
|
||||||
|
self.subComps[id] = comp
|
||||||
|
|
||||||
|
-- 判断当前需要展示界面是否是刚加载完的界面,是的话刷新一下界面
|
||||||
|
if self.curPage == id then
|
||||||
|
self:onRefresh()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:updateTime()
|
||||||
|
if self.subComps then
|
||||||
|
for _, comp in pairs(self.subComps) do
|
||||||
|
if comp.updateTime then
|
||||||
|
comp:updateTime()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:onChangePage(page)
|
||||||
|
if self.curPage == page then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for i, comp in pairs(self.subComps) do
|
||||||
|
if page ~= i and self.curPage == i and comp.onClose then
|
||||||
|
comp:onClose()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.curPage = page
|
||||||
|
self:onRefresh()
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:switchOtherPage()
|
||||||
|
if DataManager.BountyData:showRedPoint() then
|
||||||
|
self.curPage = GConst.ShopConst.FUND_SHOW_PAGE.BOUNTY
|
||||||
|
elseif DataManager.BountyCollectionData:showRedPoint() then
|
||||||
|
self.curPage = GConst.ShopConst.FUND_SHOW_PAGE.BOUNTY_COLLECTION
|
||||||
|
elseif DataManager.FundLevelData:getRedPoint() then
|
||||||
|
self.curPage = GConst.ShopConst.FUND_SHOW_PAGE.FUND
|
||||||
|
elseif DataManager.ChapterFundData:getRedPoint() then
|
||||||
|
self.curPage = GConst.ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND
|
||||||
|
-- elseif DataManager.MonthlyCardData:getIsOpen() then
|
||||||
|
-- self.curPage = GConst.ShopConst.FUND_SHOW_PAGE.MONTHLY_CARD
|
||||||
|
elseif DataManager.BountyGrowthData:getIsOpen() then
|
||||||
|
self.curPage = GConst.ShopConst.FUND_SHOW_PAGE.BOUNTY_GROWTH
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.curPage ~= nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for page = 1, table.nums(GConst.ShopConst.FUND_SHOW_PAGE) do
|
||||||
|
if self:isOpen(page) then
|
||||||
|
self.curPage = page
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:onRefresh()
|
||||||
|
if self.curPage == GConst.ShopConst.FUND_SHOW_PAGE.FUND then
|
||||||
|
if DataManager.FundLevelData:getIsAllClaimed() then
|
||||||
|
local page = self.curPage
|
||||||
|
self:switchOtherPage()
|
||||||
|
if page == self.curPage then
|
||||||
|
return self:closeUI()
|
||||||
|
else
|
||||||
|
return self:onRefresh()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.curPage == GConst.ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND then
|
||||||
|
if DataManager.ChapterFundData:getIsAllClaimed() then
|
||||||
|
local page = self.curPage
|
||||||
|
self:switchOtherPage()
|
||||||
|
if page == self.curPage then
|
||||||
|
return self:closeUI()
|
||||||
|
else
|
||||||
|
return self:onRefresh()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local openCount = 0
|
||||||
|
for i, btn in ipairs(self.btns) do
|
||||||
|
if self:isOpen(i) then
|
||||||
|
btn:setActive(true)
|
||||||
|
openCount = openCount + 1
|
||||||
|
if self.curPage == i then
|
||||||
|
btn:setSprite(GConst.ShopConst.FUND_PAGE_BTN_ICON_ATLAS[i], GConst.ShopConst.FUND_PAGE_BTN_ICON_1[i])
|
||||||
|
else
|
||||||
|
btn:setSprite(GConst.ShopConst.FUND_PAGE_BTN_ICON_ATLAS[i], GConst.ShopConst.FUND_PAGE_BTN_ICON_2[i])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
btn:setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local width = BTN_RIGHT + BTN_WIDTH * openCount + BTN_SPACING * (openCount - 1) + 20
|
||||||
|
self.btnContent:setSizeDeltaX(width)
|
||||||
|
self.btnContent:setAnchoredPositionX(math.max(width - self.btnNode:getSizeDeltaX(), 0))
|
||||||
|
|
||||||
|
for i, comp in pairs(self.subComps) do
|
||||||
|
if self.curPage == i then
|
||||||
|
comp:getBaseObject():setActive(true)
|
||||||
|
comp:refresh()
|
||||||
|
else
|
||||||
|
comp:getBaseObject():setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 红点
|
||||||
|
self:refreshRedPoint()
|
||||||
|
|
||||||
|
self.btnNode:setActive(not self.onlyShowPage)
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:refreshRedPoint()
|
||||||
|
for i, btn in ipairs(self.btns) do
|
||||||
|
if self:hasRedPoint(i) then
|
||||||
|
btn:addRedPoint(30, 30, 0.9)
|
||||||
|
else
|
||||||
|
btn:removeRedPoint()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:isOpen(type)
|
||||||
|
if type == GConst.ShopConst.FUND_SHOW_PAGE.BOUNTY then
|
||||||
|
return DataManager.BountyData:isOpen()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.BOUNTY_COLLECTION then
|
||||||
|
return DataManager.BountyCollectionData:isOpen()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.FUND then
|
||||||
|
return DataManager.FundLevelData:getIsOpen()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND then
|
||||||
|
return DataManager.ChapterFundData:getIsOpen()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.TOWER_BOUNTY then
|
||||||
|
return DataManager.TowerData:isOpen()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.BOUNTY_GROWTH then
|
||||||
|
return DataManager.BountyGrowthData:getIsOpen()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundMainUI:hasRedPoint(type)
|
||||||
|
if type == GConst.ShopConst.FUND_SHOW_PAGE.BOUNTY then
|
||||||
|
return DataManager.BountyData:showRedPoint()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.BOUNTY_COLLECTION then
|
||||||
|
return DataManager.BountyCollectionData:showRedPoint()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.FUND then
|
||||||
|
return DataManager.FundLevelData:getRedPoint()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.CHAPTER_FUND then
|
||||||
|
return DataManager.ChapterFundData:getRedPoint()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.TOWER_BOUNTY then
|
||||||
|
return DataManager.TowerFundData:getRedPoint()
|
||||||
|
elseif type == GConst.ShopConst.FUND_SHOW_PAGE.BOUNTY_GROWTH then
|
||||||
|
return DataManager.BountyGrowthData:getRedPoint()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return FundMainUI
|
||||||
10
lua/app/ui/fund/fund_main_ui.lua.meta
Normal file
10
lua/app/ui/fund/fund_main_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7879ba2518a2946eea6f030201798907
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
83
lua/app/ui/fund/fund_reward_ui.lua
Executable file
83
lua/app/ui/fund/fund_reward_ui.lua
Executable file
@ -0,0 +1,83 @@
|
|||||||
|
local BaseTips = require "app/ui/tips/base_tips"
|
||||||
|
local FundRewardUI = class("FundRewardUI", BaseTips)
|
||||||
|
--fund_reward_ui FundRewardUI
|
||||||
|
local REWARD_BOX_CELL = "app/ui/tips/cell/reward_box_cell"
|
||||||
|
|
||||||
|
function FundRewardUI:ctor(params)
|
||||||
|
self.params = params or {}
|
||||||
|
self.params.txTitle = self.params.txTitle
|
||||||
|
self.params.giftIds = self.params.giftIds
|
||||||
|
self.params.rewards = params.rewards or {}
|
||||||
|
self.params.func = params.func
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundRewardUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/fund/fund_reward_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundRewardUI:setRootUI(ui)
|
||||||
|
self.parentUI = ui
|
||||||
|
end
|
||||||
|
|
||||||
|
function FundRewardUI:onLoadRootComplete()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
self.btnCloseMask = uiMap["fund_reward_ui.btn_close_mask"]
|
||||||
|
self.content = uiMap["fund_reward_ui.content"]
|
||||||
|
self.txTitle = uiMap["fund_reward_ui.content.tx_title"]
|
||||||
|
self.btnClose = uiMap["fund_reward_ui.content.btn_close"]
|
||||||
|
self.imgArt = uiMap["fund_reward_ui.content.img_art"]
|
||||||
|
self.imgProg = uiMap["fund_reward_ui.content.img_art.img_prog"]
|
||||||
|
self.txPro = uiMap["fund_reward_ui.content.img_art.img_prog.tx_pro"]
|
||||||
|
self.scrollrect = uiMap["fund_reward_ui.content.img_art.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
|
self.btnBuy = uiMap["fund_reward_ui.content.btn_buy"]
|
||||||
|
self.txDescBuy = uiMap["fund_reward_ui.content.btn_buy.tx_desc_buy"]
|
||||||
|
|
||||||
|
if self.params.giftIds ~= nil then
|
||||||
|
local gift = ConfigManager:getConfig("act_gift")[self.params.giftIds]
|
||||||
|
if gift ~= nil then
|
||||||
|
self.txDescBuy:setText(GFunc.getFormatPrice(gift.recharge_id))
|
||||||
|
self.txPro:setText(gift.value .. "%")
|
||||||
|
end
|
||||||
|
self.btnBuy:setVisible(true)
|
||||||
|
self.imgProg:setVisible(true)
|
||||||
|
else
|
||||||
|
self.imgProg:setVisible(false)
|
||||||
|
self.btnBuy:setVisible(false)
|
||||||
|
end
|
||||||
|
self.txTitle:setText(self.params.txTitle)
|
||||||
|
|
||||||
|
self.btnBuy:addClickListener(function()
|
||||||
|
if self.params.func ~= nil then
|
||||||
|
self.params.func()
|
||||||
|
end
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
|
||||||
|
self.btnCloseMask:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
self.btnClose:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
|
||||||
|
local count = #self.params.rewards
|
||||||
|
if count <= 5 then
|
||||||
|
uiMap["fund_reward_ui.content.img_art.scrollrect"]:setAnchoredPositionY(-191)
|
||||||
|
else
|
||||||
|
uiMap["fund_reward_ui.content.img_art.scrollrect"]:setAnchoredPositionY(-128)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.scrollrect:addInitCallback(function()
|
||||||
|
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
|
||||||
|
end)
|
||||||
|
self.scrollrect:addRefreshCallback(function(index, cell)
|
||||||
|
cell:refreshByConfig(self.params.rewards[index])
|
||||||
|
end)
|
||||||
|
if self.scrollrect:getTotalCount() == #self.params.rewards then
|
||||||
|
self.scrollrect:updateAllCell()
|
||||||
|
else
|
||||||
|
self.scrollrect:refillCells(#self.params.rewards)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return FundRewardUI
|
||||||
10
lua/app/ui/fund/fund_reward_ui.lua.meta
Normal file
10
lua/app/ui/fund/fund_reward_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bfaae72c5ce11422abf21b1e61ea07df
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -1,248 +0,0 @@
|
|||||||
local GrowthFundUI = class("GrowthFundUI", BaseUI)
|
|
||||||
|
|
||||||
function GrowthFundUI:isFullScreen()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:onPressBackspace()
|
|
||||||
self:closeUI()
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:getCurrencyParams()
|
|
||||||
if self.currencyParams == nil then
|
|
||||||
self.currencyParams = {
|
|
||||||
itemIds = {
|
|
||||||
GConst.ItemConst.ITEM_ID_GOLD,
|
|
||||||
GConst.ItemConst.ITEM_ID_GEM,
|
|
||||||
GConst.ItemConst.ITEM_ID_VIT,
|
|
||||||
},
|
|
||||||
showType = GConst.CURRENCY_TYPE.HORIZONTAL
|
|
||||||
}
|
|
||||||
end
|
|
||||||
return self.currencyParams
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:getPrefabPath()
|
|
||||||
return "assets/prefabs/ui/fund/growth_fund_ui.prefab"
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:ctor()
|
|
||||||
self.fundGrade = DataManager.GrowthFundData:getFundGrade()
|
|
||||||
self:initGradeInfoList()
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:initGradeInfoList()
|
|
||||||
self.gradeInfoList = DataManager.GrowthFundData:getCurrGradeInfoList()
|
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
|
||||||
local cfg = ConfigManager:getConfig("act_level_fund")
|
|
||||||
self.inactiveIndex = nil
|
|
||||||
for k, v in ipairs(self.gradeInfoList) do
|
|
||||||
if cfg[v] then
|
|
||||||
if playerLevel < cfg[v].level then
|
|
||||||
self.inactiveIndex = k
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if self.inactiveIndex == nil then
|
|
||||||
self.inactiveIndex = #self.gradeInfoList + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:onClose()
|
|
||||||
if self.originTitleBgHeight then
|
|
||||||
self.uiMap["growth_fund_ui.title_img.bg"]:setSizeDeltaY(self.originTitleBgHeight)
|
|
||||||
end
|
|
||||||
if self.heroNode then
|
|
||||||
self.heroNode:removeAllChildren()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:onLoadRootComplete()
|
|
||||||
self.uiMap = self.root:genAllChildren()
|
|
||||||
|
|
||||||
self.uiMap["growth_fund_ui.down.close_btn"]:addClickListener(function()
|
|
||||||
self:closeUI()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self:initTitle()
|
|
||||||
self:initPayBtns()
|
|
||||||
self:initRewards()
|
|
||||||
self:bindData()
|
|
||||||
BIReport:postPayUIShow(BIReport.GIFT_TYPE.GROWTH_FUND, nil, BIReport.PAY_UI_SHOW_TYPE.CLICK_SHOW)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:initTitle()
|
|
||||||
self.titleTx = self.uiMap["growth_fund_ui.title_img.title_tx"]
|
|
||||||
self.titleDialogBg = self.uiMap["growth_fund_ui.title_img.bg"]
|
|
||||||
self.originTitleBgHeight = self.titleDialogBg:fastGetSizeDeltaY()
|
|
||||||
self.heroNode = self.uiMap["growth_fund_ui.title_img.hero_node"]
|
|
||||||
self.heroNode:removeAllChildren()
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:initPayBtns()
|
|
||||||
local width = GConst.UI_SCREEN_WIDTH
|
|
||||||
|
|
||||||
local freeTx = self.uiMap["growth_fund_ui.title_bg_2.free_tx"]
|
|
||||||
freeTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE))
|
|
||||||
freeTx:setAnchoredPositionX(-width/3)
|
|
||||||
|
|
||||||
self.payBtn1 = self.uiMap["growth_fund_ui.title_bg_2.btn_1"]
|
|
||||||
self.payBtn1:addClickListener(function()
|
|
||||||
ModuleManager.FundManager:buyLevelFund(DataManager.GrowthFundData:getFundBaseId())
|
|
||||||
end)
|
|
||||||
self.payBtnTx1 = self.uiMap["growth_fund_ui.title_bg_2.btn_1.text"]
|
|
||||||
|
|
||||||
self.payBtn2 = self.uiMap["growth_fund_ui.title_bg_2.btn_2"]
|
|
||||||
self.payBtn2:setAnchoredPositionX(width/3)
|
|
||||||
self.payBtn2:addClickListener(function()
|
|
||||||
ModuleManager.FundManager:buyLevelFund(DataManager.GrowthFundData:getFundAdvanceId())
|
|
||||||
end)
|
|
||||||
self.payBtnTx2 = self.uiMap["growth_fund_ui.title_bg_2.btn_2.text"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:initRewards()
|
|
||||||
self.scrollRect = self.uiMap["growth_fund_ui.scrollrect"]
|
|
||||||
self.scrollRectComp = self.scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
|
||||||
self.scrollRectComp:addInitCallback(function()
|
|
||||||
return "app/ui/fund/cell/growth_fund_cell"
|
|
||||||
end)
|
|
||||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
|
||||||
cell:refresh(self.gradeInfoList[index])
|
|
||||||
end)
|
|
||||||
self.scrollRectComp:clearCells()
|
|
||||||
self.scrollRectComp:setTotalCount(0)
|
|
||||||
|
|
||||||
self.progressBg = self.uiMap["growth_fund_ui.scrollrect.viewport.content.progress_bg"]
|
|
||||||
self.progressComp = self.uiMap["growth_fund_ui.scrollrect.viewport.content.progress_bg.progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
|
||||||
self.grayImg = self.uiMap["growth_fund_ui.scrollrect.viewport.content.gray_img"]
|
|
||||||
self.horizontalLine = self.uiMap["growth_fund_ui.scrollrect.viewport.content.line_img"]
|
|
||||||
self.verticalLine1 = self.uiMap["growth_fund_ui.scrollrect.viewport.content.vertical_line_1"]
|
|
||||||
self.verticalLine2 = self.uiMap["growth_fund_ui.scrollrect.viewport.content.vertical_line_2"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:bindData()
|
|
||||||
self:bind(DataManager.GrowthFundData, "dirty", function()
|
|
||||||
if self.fundGrade ~= DataManager.GrowthFundData:getFundGrade() then
|
|
||||||
self.fundGrade = DataManager.GrowthFundData:getFundGrade()
|
|
||||||
self:initGradeInfoList()
|
|
||||||
end
|
|
||||||
self:onRefresh()
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:onRefresh()
|
|
||||||
self:refreshTitle()
|
|
||||||
self:refreshPayBtns()
|
|
||||||
self:refreshRewards()
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:refreshTitle()
|
|
||||||
local fundGrade = DataManager.GrowthFundData:getFundGrade()
|
|
||||||
if fundGrade == 1 then
|
|
||||||
self.uiMap["growth_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_1.png")
|
|
||||||
self.titleDialogBg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_9")
|
|
||||||
self:showHeroSpine(1)
|
|
||||||
elseif fundGrade == 2 then
|
|
||||||
self.uiMap["growth_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_2.png")
|
|
||||||
self.titleDialogBg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_1")
|
|
||||||
self:showHeroSpine(2)
|
|
||||||
end
|
|
||||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.LEVEL_FUND_DESC_1, fundGrade))
|
|
||||||
local height = self.titleTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight + 58
|
|
||||||
if height < self.originTitleBgHeight then
|
|
||||||
height = self.originTitleBgHeight
|
|
||||||
end
|
|
||||||
self.titleDialogBg:setSizeDeltaY(height)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:refreshPayBtns()
|
|
||||||
if not DataManager.GrowthFundData:getIsBoughtBase() then
|
|
||||||
local rechargeId = DataManager.GrowthFundData:getCurrGradeBaseRechargeId()
|
|
||||||
self.payBtnTx1:setText(GFunc.getFormatPrice(rechargeId))
|
|
||||||
self.payBtn1:setTouchEnable(true)
|
|
||||||
else
|
|
||||||
self.payBtnTx1:setText(I18N:getGlobalText(I18N.GlobalConst.ALREADY_ACTIVE))
|
|
||||||
self.payBtn1:setTouchEnable(false)
|
|
||||||
end
|
|
||||||
if not DataManager.GrowthFundData:getIsBoughtAdvance() then
|
|
||||||
local rechargeId = DataManager.GrowthFundData:getCurrGradeAdvanceRechargeId()
|
|
||||||
self.payBtnTx2:setText(GFunc.getFormatPrice(rechargeId))
|
|
||||||
self.payBtn2:setTouchEnable(true)
|
|
||||||
else
|
|
||||||
self.payBtnTx2:setText(I18N:getGlobalText(I18N.GlobalConst.ALREADY_ACTIVE))
|
|
||||||
self.payBtn2:setTouchEnable(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:refreshRewards()
|
|
||||||
local count = #self.gradeInfoList
|
|
||||||
if self.scrollRectComp:getTotalCount() <= 0 then
|
|
||||||
self.scrollRectComp:refillCells(count)
|
|
||||||
local minIndex = DataManager.GrowthFundData:getMinUnclaimedRewardIndex()
|
|
||||||
if minIndex > 1 then
|
|
||||||
self.scrollRectComp:moveToIndex(minIndex)
|
|
||||||
end
|
|
||||||
elseif self.scrollRectComp:getTotalCount() ~= count then -- 打开界面的时候定位到当前可领取的最低等级奖励,如果没有则定位到当前等级
|
|
||||||
self.scrollRectComp:clearCells()
|
|
||||||
self.scrollRectComp:refillCells(count)
|
|
||||||
else
|
|
||||||
self.scrollRectComp:updateAllCell()
|
|
||||||
end
|
|
||||||
|
|
||||||
local topRecoveryOffset = self.scrollRectComp:getTopRecoveryOffset()
|
|
||||||
local contentWidth = self.scrollRect:getRectWidth()
|
|
||||||
local cellWidth = self.scrollRectComp:getCellHeight()
|
|
||||||
self.progressBg:setAnchoredPosition(contentWidth/3, -topRecoveryOffset - cellWidth/2)
|
|
||||||
self.progressBg:setSizeDeltaX(cellWidth*(count - 1))
|
|
||||||
local percent = (self.inactiveIndex - 2) / (count - 1)
|
|
||||||
if percent < 0 then
|
|
||||||
percent = 0
|
|
||||||
end
|
|
||||||
self.progressComp.value = percent
|
|
||||||
|
|
||||||
self.grayImg:setAnchoredPositionY(-topRecoveryOffset - (self.inactiveIndex - 1)*cellWidth)
|
|
||||||
self.grayImg:setSizeDeltaY(cellWidth*count + GConst.UI_SCREEN_HEIGHT)
|
|
||||||
|
|
||||||
local lineHeight = topRecoveryOffset + cellWidth*count + GConst.UI_SCREEN_HEIGHT*2
|
|
||||||
self.verticalLine1:setAnchoredPositionX(contentWidth/3)
|
|
||||||
self.verticalLine1:setSizeDeltaY(lineHeight)
|
|
||||||
|
|
||||||
self.verticalLine2:setAnchoredPositionX(contentWidth*2/3)
|
|
||||||
self.verticalLine2:setSizeDeltaY(lineHeight)
|
|
||||||
|
|
||||||
self.horizontalLine:setAnchoredPositionY(-topRecoveryOffset - (self.inactiveIndex - 1)*cellWidth)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowthFundUI:showHeroSpine(index)
|
|
||||||
if self.heroSpineIndex == index then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
self.heroSpineIndex = index
|
|
||||||
local heroId = 0
|
|
||||||
if index == 1 then
|
|
||||||
heroId = GFunc.getConstValue("level_fund_hero_1")
|
|
||||||
elseif index == 2 then
|
|
||||||
heroId = GFunc.getConstValue("level_fund_hero_2")
|
|
||||||
end
|
|
||||||
if heroId <= 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local hero = DataManager.HeroData:getHeroById(heroId)
|
|
||||||
if not hero then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
SpineManager:loadHeroAsync(hero:getModelId(), self.heroNode, function(spineObject)
|
|
||||||
if self:isClosed() then
|
|
||||||
spineObject:destroy()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if self.heroSpine then
|
|
||||||
self.heroSpine:destroy()
|
|
||||||
end
|
|
||||||
spineObject:playAnimation("idle", true)
|
|
||||||
self.heroSpine = spineObject
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
return GrowthFundUI
|
|
||||||
177
lua/app/ui/fund/tower_bounty_comp.lua
Executable file
177
lua/app/ui/fund/tower_bounty_comp.lua
Executable file
@ -0,0 +1,177 @@
|
|||||||
|
local TowerBountyComp = class("TowerBountyComp", LuaComponent)
|
||||||
|
|
||||||
|
local CELL = "app/ui/fund/cell/fund_tower_cell"
|
||||||
|
|
||||||
|
local TAG_COMMON_TOTAL_SIZE = 640
|
||||||
|
local TAG_SIZE = 178
|
||||||
|
|
||||||
|
function TowerBountyComp:onClose()
|
||||||
|
self.curStage = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function TowerBountyComp:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.banner = uiMap["tower_bounty_comp.bg.banner"]
|
||||||
|
self.bg = uiMap["tower_bounty_comp.top.bg"]
|
||||||
|
self.txDesc = uiMap["tower_bounty_comp.top.bg.desc_1"]
|
||||||
|
self.txDesc2 = uiMap["tower_bounty_comp.top.bg.desc_2"]
|
||||||
|
self.btnHelp = uiMap["tower_bounty_comp.top.tx_title.btn_help"]
|
||||||
|
self.scrollrect = uiMap["tower_bounty_comp.scrollrect"]
|
||||||
|
self.txLevel = uiMap["tower_bounty_comp.scrollrect.title.tx_level"]
|
||||||
|
self.txCommon = uiMap["tower_bounty_comp.scrollrect.title.tx_common"]
|
||||||
|
self.txPro = uiMap["tower_bounty_comp.scrollrect.title.tx_pro"]
|
||||||
|
self.btnGet = uiMap["tower_bounty_comp.btns.btn_get"]
|
||||||
|
self.txGet = uiMap["tower_bounty_comp.btns.btn_get.tx_desc"]
|
||||||
|
self.btnBuy = uiMap["tower_bounty_comp.btns.btn_buy"]
|
||||||
|
self.txCost = uiMap["tower_bounty_comp.btns.btn_buy.tx_cost"]
|
||||||
|
self.tagsNode = uiMap["tower_bounty_comp.tags"]
|
||||||
|
self.tagsViewport = uiMap["tower_bounty_comp.tags.viewport"]
|
||||||
|
self.tagsContent = uiMap["tower_bounty_comp.tags.viewport.content"]
|
||||||
|
self.tags = {}
|
||||||
|
self.tagImgs = {}
|
||||||
|
self.tagDescs = {}
|
||||||
|
for i = 1, 10 do
|
||||||
|
table.insert(self.tags, uiMap["tower_bounty_comp.tags.viewport.content.tag_" .. i])
|
||||||
|
table.insert(self.tagImgs, uiMap["tower_bounty_comp.tags.viewport.content.tag_" .. i .. ".img"])
|
||||||
|
table.insert(self.tagDescs, uiMap["tower_bounty_comp.tags.viewport.content.tag_" .. i .. ".img.tx_desc"])
|
||||||
|
end
|
||||||
|
|
||||||
|
self.btnBuy:addClickListener(function()
|
||||||
|
local giftId = DataManager.TowerFundData:getProGiftId(self.curStage)
|
||||||
|
ModuleManager.FundTowerManager:onBuyTowerBounty(giftId)
|
||||||
|
end)
|
||||||
|
self.btnGet:addClickListener(function()
|
||||||
|
ModuleManager.FundTowerManager:getReward(self.curStage)
|
||||||
|
end)
|
||||||
|
self.btnHelp:addClickListener(function()
|
||||||
|
ModuleManager.TipsManager:showDescTips(I18N:getGlobalText(I18N.GlobalConst.FUND_TOWER_DESC_2), self.btnHelp)
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.TowerFundData, "isDirty", function()
|
||||||
|
if not DataManager.TowerFundData:getIsOpen() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not DataManager.TowerFundData:isStageUnlock(self.curStage) then
|
||||||
|
self.curStage = DataManager.TowerFundData:getCurStage()
|
||||||
|
end
|
||||||
|
if self.curStage == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not DataManager.TowerFundData:canGetRewards(self.curStage) then
|
||||||
|
local claimedStage = DataManager.TowerFundData:getMinUnclaimedStage()
|
||||||
|
if claimedStage ~= nil then
|
||||||
|
self.curStage = claimedStage
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:refresh(true)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function TowerBountyComp:refresh(isAuto)
|
||||||
|
if self.curStage == nil then
|
||||||
|
self.curStage = DataManager.TowerFundData:getMinUnclaimedStage() or DataManager.TowerFundData:getMaxUnclaimedStage()
|
||||||
|
isAuto = true
|
||||||
|
end
|
||||||
|
|
||||||
|
self:updateData(self.curStage)
|
||||||
|
self:refreshStageTags()
|
||||||
|
if isAuto then
|
||||||
|
local stageList = DataManager.TowerFundData:getUnlockStageList()
|
||||||
|
local index
|
||||||
|
for k, v in pairs(stageList) do
|
||||||
|
if self.curStage == v then
|
||||||
|
index = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if index then
|
||||||
|
self.tagsContent:setAnchoredPositionX(-self.tags[index]:getAnchoredPositionX())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not DataManager.TowerFundData:getProBought(self.curStage) then
|
||||||
|
local giftId = DataManager.TowerFundData:getProGiftId(self.curStage)
|
||||||
|
local cfg = ConfigManager:getConfig("act_gift")[giftId]
|
||||||
|
self.txCost:setText(GFunc.getFormatPrice(cfg.recharge_id))
|
||||||
|
self.btnBuy:setActive(true)
|
||||||
|
else
|
||||||
|
self.btnBuy:setActive(false)
|
||||||
|
end
|
||||||
|
self.btnGet:setActive(DataManager.TowerFundData:canGetRewards(self.curStage))
|
||||||
|
self.maxIndex = #self.cfgList
|
||||||
|
self.minIndex = DataManager.TowerFundData:getMinUnclaimedRewardIndex(self.curStage)
|
||||||
|
if self.scrollRect == nil then
|
||||||
|
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
|
self.scrollRect:addInitCallback(function()
|
||||||
|
return CELL
|
||||||
|
end)
|
||||||
|
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||||
|
cell:refresh(index, self.cfgList[index], index == self.maxIndex)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
|
||||||
|
self.scrollRect:refillCells(self.maxIndex)
|
||||||
|
elseif self.scrollRect:getTotalCount() ~= self.maxIndex then
|
||||||
|
self.scrollRect:clearCells()
|
||||||
|
self.scrollRect:refillCells(self.maxIndex)
|
||||||
|
else
|
||||||
|
self.scrollRect:updateAllCell()
|
||||||
|
end
|
||||||
|
self.scrollRect:moveToIndex(self.minIndex)
|
||||||
|
|
||||||
|
if self.curStage then
|
||||||
|
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.TOWER_BOUNTY .. self.curStage)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TowerBountyComp:updateData(stage)
|
||||||
|
stage = stage or DataManager.TowerFundData:getCurStage()
|
||||||
|
if DataManager.TowerFundData:getIsOpen(stage) then
|
||||||
|
self.cfgList = DataManager.TowerFundData:getListByStage(stage)
|
||||||
|
else
|
||||||
|
self.cfgList = {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TowerBountyComp:onClickStageTag(stage)
|
||||||
|
self.curStage = stage
|
||||||
|
self:refresh()
|
||||||
|
end
|
||||||
|
|
||||||
|
function TowerBountyComp:refreshStageTags()
|
||||||
|
local stageList = DataManager.TowerFundData:getUnlockStageList()
|
||||||
|
if #stageList <= 1 then
|
||||||
|
self.tagsNode:setActive(false)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.tagsNode:setActive(true)
|
||||||
|
local totalWidth = #stageList * TAG_SIZE + (#stageList - 1) * 5
|
||||||
|
self.tagsContent:setSizeDeltaX(totalWidth)
|
||||||
|
self.tagsViewport:setSizeDeltaX(totalWidth < TAG_COMMON_TOTAL_SIZE and totalWidth or TAG_COMMON_TOTAL_SIZE)
|
||||||
|
|
||||||
|
for i, tag in ipairs(self.tags) do
|
||||||
|
local stage = stageList[i]
|
||||||
|
if stage then
|
||||||
|
tag:setActive(true)
|
||||||
|
local isSelect = self.curStage == stage
|
||||||
|
self.tagImgs[i]:setSprite(GConst.ATLAS_PATH.COMMON, isSelect and "common_menu_4" or "common_menu_5")
|
||||||
|
self.tagImgs[i]:setAnchoredPositionY(isSelect and 5 or 0)
|
||||||
|
self.tagDescs[i]:setText(I18N:getGlobalText(I18N.GlobalConst["FUND_TOWER_TAG_DESC_" .. stage]))
|
||||||
|
|
||||||
|
if DataManager.TowerFundData:canGetRewards(stage) then
|
||||||
|
tag:addRedPoint(80, 33, 0.9)
|
||||||
|
else
|
||||||
|
tag:removeRedPoint()
|
||||||
|
end
|
||||||
|
|
||||||
|
tag:addClickListener(function()
|
||||||
|
if isSelect then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:onClickStageTag(stage)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
tag:setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return TowerBountyComp
|
||||||
10
lua/app/ui/fund/tower_bounty_comp.lua.meta
Normal file
10
lua/app/ui/fund/tower_bounty_comp.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8bb6da30880fd4533b9c77e0f459b782
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -847,7 +847,6 @@ function MainCityUI:switchComp(index)
|
|||||||
comp:getBaseObject():setActive(i == index)
|
comp:getBaseObject():setActive(i == index)
|
||||||
if i == index then
|
if i == index then
|
||||||
if index == GConst.MainCityConst.BOTTOM_PAGE.SHOP then
|
if index == GConst.MainCityConst.BOTTOM_PAGE.SHOP then
|
||||||
comp:clearPostFlag()
|
|
||||||
comp:refresh()
|
comp:refresh()
|
||||||
elseif index == GConst.MainCityConst.BOTTOM_PAGE.HERO then
|
elseif index == GConst.MainCityConst.BOTTOM_PAGE.HERO then
|
||||||
comp:refresh(GConst.BattleConst.BATTLE_TYPE.STAGE)
|
comp:refresh(GConst.BattleConst.BATTLE_TYPE.STAGE)
|
||||||
@ -1031,7 +1030,7 @@ function MainCityUI:refreshBottomRp()
|
|||||||
heroRpObj:removeRedPoint()
|
heroRpObj:removeRedPoint()
|
||||||
end
|
end
|
||||||
local shopRpObj = uiMap["main_ui.bottom_node.icons.ui_spine_obj_3.rp_node"]
|
local shopRpObj = uiMap["main_ui.bottom_node.icons.ui_spine_obj_3.rp_node"]
|
||||||
if DataManager.ShopData:getRp() then
|
if DataManager.ShopData:showRedPoint() then
|
||||||
shopRpObj:addRedPoint(0, 0, 1)
|
shopRpObj:addRedPoint(0, 0, 1)
|
||||||
else
|
else
|
||||||
shopRpObj:removeRedPoint()
|
shopRpObj:removeRedPoint()
|
||||||
|
|||||||
@ -1,173 +0,0 @@
|
|||||||
local BoxHeroUI = class("BoxHeroUI", BaseUI)
|
|
||||||
|
|
||||||
local TITLE_TEXT = {
|
|
||||||
[GConst.SummonConst.SUMMON_TYPE.LV_1] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_1), -- 普通宝箱
|
|
||||||
[GConst.SummonConst.SUMMON_TYPE.LV_2] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_2), -- 精致宝箱
|
|
||||||
[GConst.SummonConst.SUMMON_TYPE.LV_3] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_3), -- 珍贵宝箱
|
|
||||||
}
|
|
||||||
local ICON_NAME = {
|
|
||||||
[GConst.SummonConst.SUMMON_TYPE.LV_1] = "shop_chest_1",
|
|
||||||
[GConst.SummonConst.SUMMON_TYPE.LV_2] = "shop_chest_2",
|
|
||||||
[GConst.SummonConst.SUMMON_TYPE.LV_3] = "shop_chest_3"
|
|
||||||
}
|
|
||||||
local MAX_ITEM_NUM = 4
|
|
||||||
|
|
||||||
function BoxHeroUI:ctor(params)
|
|
||||||
params = params or {}
|
|
||||||
|
|
||||||
self.summonType = params.type
|
|
||||||
self.arenaBoxInfo = params.arena
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroUI:isFullScreen()
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroUI:onPressBackspace()
|
|
||||||
self:closeUI()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroUI:getPrefabPath()
|
|
||||||
return "assets/prefabs/ui/shop/box_hero_ui.prefab"
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroUI:onLoadRootComplete()
|
|
||||||
self.uiMap = self.root:genAllChildren()
|
|
||||||
self.uiMap["box_hero_ui.close_btn"]:addClickListener(function()
|
|
||||||
self:closeUI()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self.titleTx = self.uiMap["box_hero_ui.bg.title"]
|
|
||||||
self.boxImg = self.uiMap["box_hero_ui.bg.box"]
|
|
||||||
|
|
||||||
-- 购买按钮
|
|
||||||
self.buyBtn = self.uiMap["box_hero_ui.bg.buy_btn"]
|
|
||||||
self.buyBtnTx = self.uiMap["box_hero_ui.bg.buy_btn.text"]
|
|
||||||
self.buyBtnIcon = self.uiMap["box_hero_ui.bg.buy_btn.icon"]
|
|
||||||
-- 视频按钮
|
|
||||||
self.adBtn = self.uiMap["box_hero_ui.bg.ad_btn"]
|
|
||||||
self.adBtnTx = self.uiMap["box_hero_ui.bg.ad_btn.tx_ad"]
|
|
||||||
self.adBtnIcon = self.uiMap["box_hero_ui.bg.ad_btn.img_ad"]
|
|
||||||
-- tag提示
|
|
||||||
self.tag = self.uiMap["box_hero_ui.bg.item_node.item_4.tag"]
|
|
||||||
self.txTag = self.uiMap["box_hero_ui.bg.item_node.item_4.tag.tx_tag"]
|
|
||||||
|
|
||||||
self.itemNodeLayout = self.uiMap["box_hero_ui.bg.item_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
|
||||||
self.itemNodeList = {}
|
|
||||||
self.itemCellList = {}
|
|
||||||
self.itemTextList = {}
|
|
||||||
self.itemHelpList = {}
|
|
||||||
for i = 1, MAX_ITEM_NUM do
|
|
||||||
table.insert(self.itemNodeList, self.uiMap["box_hero_ui.bg.item_" .. i])
|
|
||||||
table.insert(self.itemCellList, CellManager:addCellComp(self.uiMap["box_hero_ui.bg.item_".. i .. ".item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL))
|
|
||||||
table.insert(self.itemTextList, self.uiMap["box_hero_ui.bg.item_".. i .. ".num"])
|
|
||||||
table.insert(self.itemHelpList, self.uiMap["box_hero_ui.bg.item_" .. i .. ".help"])
|
|
||||||
end
|
|
||||||
|
|
||||||
self.adBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_36))
|
|
||||||
GFunc.centerImgAndTx(self.adBtnIcon, self.adBtnTx, 5)
|
|
||||||
|
|
||||||
-- 奖励界面打开时 关闭此界面
|
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_BOX_HERO_UI, function()
|
|
||||||
if self.arenaBoxInfo then
|
|
||||||
self:closeUI()
|
|
||||||
else
|
|
||||||
self:onRefresh()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroUI:onRefresh()
|
|
||||||
self.buyBtn:setActive(false)
|
|
||||||
self.adBtn:setActive(false)
|
|
||||||
self.tag:setActive(false)
|
|
||||||
|
|
||||||
if self.summonType then
|
|
||||||
self:refreshCummonBox()
|
|
||||||
elseif self.arenaBoxInfo then
|
|
||||||
self:refreshArenaAdBox()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 刷新商城宝箱
|
|
||||||
function BoxHeroUI:refreshCummonBox()
|
|
||||||
self.buyBtn:setActive(true)
|
|
||||||
self.buyBtn:addClickListener(function()
|
|
||||||
self:onClickSummon()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self.titleTx:setText(TITLE_TEXT[self.summonType])
|
|
||||||
self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, ICON_NAME[self.summonType])
|
|
||||||
|
|
||||||
self:showRewards(DataManager.SummonData:getSummonTotalRewardByLv(self.summonType))-- 本次实际奖励
|
|
||||||
|
|
||||||
local costItem, cost = DataManager.SummonData:getSummonCost(self.summonType)
|
|
||||||
if GFunc.checkCost(costItem.id, costItem.num, false) then
|
|
||||||
self.buyBtnIcon:setSprite(GFunc.getIconRes(costItem.id))
|
|
||||||
self.buyBtnTx:setText(costItem.num)
|
|
||||||
else
|
|
||||||
self.buyBtnIcon:setSprite(GFunc.getIconRes(cost.id))
|
|
||||||
self.buyBtnTx:setText(cost.num)
|
|
||||||
end
|
|
||||||
GFunc.centerImgAndTx(self.buyBtnIcon, self.buyBtnTx, 5)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 刷新竞技场ad宝箱
|
|
||||||
function BoxHeroUI:refreshArenaAdBox()
|
|
||||||
self.adBtn:setActive(true)
|
|
||||||
self.adBtn:addClickListener(function()
|
|
||||||
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.ARENA_AD_BOX, function ()
|
|
||||||
ModuleManager.ArenaManager:reqAdBoxReward(self.arenaBoxInfo.isWin)
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
self.tag:setActive(true)
|
|
||||||
self.txTag:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_35))
|
|
||||||
|
|
||||||
if self.arenaBoxInfo.isWin then
|
|
||||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_33))
|
|
||||||
self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_chest_5")
|
|
||||||
else
|
|
||||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_34))
|
|
||||||
self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_chest_4")
|
|
||||||
end
|
|
||||||
self:showRewards(DataManager.ArenaData:getAdBoxRewards(self.arenaBoxInfo.isWin))
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroUI:showRewards(rewards)
|
|
||||||
for i = 1, MAX_ITEM_NUM do
|
|
||||||
if i <= #rewards then
|
|
||||||
self.itemNodeList[i]:setVisible(true)
|
|
||||||
self.itemCellList[i]:refreshByCfg(rewards[i].id, 0)
|
|
||||||
self.itemCellList[i]:setNum("")
|
|
||||||
self.itemTextList[i]:setText(rewards[i].num)
|
|
||||||
self.itemCellList[i]:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(rewards[i].id, GConst.REWARD_TYPE.ITEM, self.itemCellList[i]:getBaseObject())
|
|
||||||
end)
|
|
||||||
|
|
||||||
local type = ConfigManager:getConfig("item")[rewards[i].id].type
|
|
||||||
if type == 3 or type == 6 then
|
|
||||||
self.itemHelpList[i]:setVisible(true)
|
|
||||||
self.itemHelpList[i]:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showHeroFragmentTips(rewards[i].id)
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
self.itemHelpList[i]:setVisible(false)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
self.itemNodeList[i]:setVisible(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.itemNodeLayout:RefreshLayout()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroUI:onClickSummon()
|
|
||||||
local costItem, cost = DataManager.SummonData:getSummonCost(self.summonType)
|
|
||||||
if GFunc.checkCost(costItem.id, costItem.num, false) then
|
|
||||||
ModuleManager.SummonManager:summon(self.summonType, 1)
|
|
||||||
elseif GFunc.checkCost(cost.id, cost.num, true) then
|
|
||||||
ModuleManager.SummonManager:summon(self.summonType, 2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return BoxHeroUI
|
|
||||||
@ -1,218 +0,0 @@
|
|||||||
local BoxLevelUI = class("BoxLevelUI", BaseUI)
|
|
||||||
|
|
||||||
local BOX_3_CELL_HEIGHT = 260
|
|
||||||
local BG_WITHOUT_3_BOX_HEIGHT = 660
|
|
||||||
|
|
||||||
function BoxLevelUI:ctor(params)
|
|
||||||
params = params or {}
|
|
||||||
self.level = params.level or DataManager.SummonData:getSummonLevel()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxLevelUI:isFullScreen()
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxLevelUI:getPrefabPath()
|
|
||||||
return "assets/prefabs/ui/shop/box_level_ui.prefab"
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxLevelUI:onLoadRootComplete()
|
|
||||||
self.uiMap = self.root:genAllChildren()
|
|
||||||
self.uiMap["box_level_ui.close_btn"]:addClickListener(function()
|
|
||||||
self:closeUI()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self.bg = self.uiMap["box_level_ui.bg"]
|
|
||||||
self.titleTx = self.uiMap["box_level_ui.bg.title_img.title"]
|
|
||||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_37))
|
|
||||||
self.lvTx = self.uiMap["box_level_ui.bg.lv_node.lv_bg.text"]
|
|
||||||
self.leftArrow = self.uiMap["box_level_ui.bg.lv_node.left_arrow"]
|
|
||||||
self.rightArrow = self.uiMap["box_level_ui.bg.lv_node.right_arrow"]
|
|
||||||
|
|
||||||
self.box1Node = self.uiMap["box_level_ui.bg.box_1"]
|
|
||||||
self.box1Add1Node = self.uiMap["box_level_ui.bg.box_1.add_node_1"]
|
|
||||||
self.box1Add1ItemCell = CellManager:addCellComp(self.uiMap["box_level_ui.bg.box_1.add_node_1.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box1Add1Text = self.uiMap["box_level_ui.bg.box_1.add_node_1.text"]
|
|
||||||
self.box1Add2Node = self.uiMap["box_level_ui.bg.box_1.add_node_2"]
|
|
||||||
self.box1Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_ui.bg.box_1.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box1Add2Text = self.uiMap["box_level_ui.bg.box_1.add_node_2.text"]
|
|
||||||
self.box1Desc = self.uiMap["box_level_ui.bg.box_1.none_text"]
|
|
||||||
self.box1Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
|
|
||||||
|
|
||||||
self.box2Node = self.uiMap["box_level_ui.bg.box_2"]
|
|
||||||
self.box2Add1Node = self.uiMap["box_level_ui.bg.box_2.add_node_1"]
|
|
||||||
self.box2Add1ItemCell = CellManager:addCellComp(self.uiMap["box_level_ui.bg.box_2.add_node_1.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box2Add1Text = self.uiMap["box_level_ui.bg.box_2.add_node_1.text"]
|
|
||||||
self.box2Add2Node = self.uiMap["box_level_ui.bg.box_2.add_node_2"]
|
|
||||||
self.box2Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_ui.bg.box_2.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box2Add2Text = self.uiMap["box_level_ui.bg.box_2.add_node_2.text"]
|
|
||||||
self.box2Desc = self.uiMap["box_level_ui.bg.box_2.none_text"]
|
|
||||||
self.box2Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
|
|
||||||
|
|
||||||
self.box3Node = self.uiMap["box_level_ui.bg.box_3"]
|
|
||||||
self.box3Add1Node = self.uiMap["box_level_ui.bg.box_3.add_node_1"]
|
|
||||||
self.box3Add1ItemCell = CellManager:addCellComp(self.uiMap["box_level_ui.bg.box_3.add_node_1.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box3Add1Text = self.uiMap["box_level_ui.bg.box_3.add_node_1.text"]
|
|
||||||
self.box3Add2Node = self.uiMap["box_level_ui.bg.box_3.add_node_2"]
|
|
||||||
self.box3Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_ui.bg.box_3.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box3Add2Text = self.uiMap["box_level_ui.bg.box_3.add_node_2.text"]
|
|
||||||
self.box3Desc = self.uiMap["box_level_ui.bg.box_3.none_text"]
|
|
||||||
self.box3Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
|
|
||||||
|
|
||||||
self.bottomDesc = self.uiMap["box_level_ui.bg.title"]
|
|
||||||
self.bottomDesc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_5)) -- 开宝箱提升等级,增加宝箱奖励
|
|
||||||
|
|
||||||
self.leftArrow:addClickListener(function()
|
|
||||||
self.level = self.level - 1
|
|
||||||
if self.level <= 1 then
|
|
||||||
self.level = 1
|
|
||||||
end
|
|
||||||
self:refresh()
|
|
||||||
end)
|
|
||||||
self.rightArrow:addClickListener(function()
|
|
||||||
self.level = self.level + 1
|
|
||||||
if self.level >= DataManager.SummonData:getSummonMaxLv() then
|
|
||||||
self.level = DataManager.SummonData:getSummonMaxLv()
|
|
||||||
end
|
|
||||||
self:refresh()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self:refresh()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxLevelUI:refresh()
|
|
||||||
self.lvTx:setText("Lv." .. tostring(self.level))
|
|
||||||
|
|
||||||
local maxLevel = DataManager.SummonData:getSummonMaxLv()
|
|
||||||
if self.level == 1 then
|
|
||||||
self.leftArrow:setSprite(GConst.ATLAS_PATH.COMMON, "common_arrow_3")
|
|
||||||
self.rightArrow:setSprite(GConst.ATLAS_PATH.COMMON, "common_arrow_2")
|
|
||||||
elseif self.level == maxLevel then
|
|
||||||
self.leftArrow:setSprite(GConst.ATLAS_PATH.COMMON, "common_arrow_2")
|
|
||||||
self.rightArrow:setSprite(GConst.ATLAS_PATH.COMMON, "common_arrow_3")
|
|
||||||
else
|
|
||||||
self.leftArrow:setSprite(GConst.ATLAS_PATH.COMMON, "common_arrow_2")
|
|
||||||
self.rightArrow:setSprite(GConst.ATLAS_PATH.COMMON, "common_arrow_2")
|
|
||||||
end
|
|
||||||
|
|
||||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.STORE_BOX_3_OPEN, true) then
|
|
||||||
self.box3Node:setVisible(false)
|
|
||||||
self.bg:setSizeDeltaY(BG_WITHOUT_3_BOX_HEIGHT)
|
|
||||||
else
|
|
||||||
self.box3Node:setVisible(true)
|
|
||||||
self.bg:setSizeDeltaY(BG_WITHOUT_3_BOX_HEIGHT + BOX_3_CELL_HEIGHT)
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.level == 1 then
|
|
||||||
self.box1Add1Node:setVisible(false)
|
|
||||||
self.box1Add2Node:setVisible(false)
|
|
||||||
self.box1Desc:setVisible(true)
|
|
||||||
|
|
||||||
self.box2Add1Node:setVisible(false)
|
|
||||||
self.box2Add2Node:setVisible(false)
|
|
||||||
self.box2Desc:setVisible(true)
|
|
||||||
|
|
||||||
self.box3Add1Node:setVisible(false)
|
|
||||||
self.box3Add2Node:setVisible(false)
|
|
||||||
self.box3Desc:setVisible(true)
|
|
||||||
else
|
|
||||||
self.box1Add1Node:setVisible(false)
|
|
||||||
self.box1Add2Node:setVisible(false)
|
|
||||||
self.box1Desc:setVisible(false)
|
|
||||||
|
|
||||||
self.box2Add1Node:setVisible(false)
|
|
||||||
self.box2Add2Node:setVisible(false)
|
|
||||||
self.box2Desc:setVisible(false)
|
|
||||||
|
|
||||||
self.box3Add1Node:setVisible(false)
|
|
||||||
self.box3Add2Node:setVisible(false)
|
|
||||||
self.box3Desc:setVisible(false)
|
|
||||||
|
|
||||||
local reward1 = DataManager.SummonData:getSummonRewardByLv(GConst.SummonConst.SUMMON_TYPE.LV_1, self.level)
|
|
||||||
local reward2 = DataManager.SummonData:getSummonRewardByLv(GConst.SummonConst.SUMMON_TYPE.LV_2, self.level)
|
|
||||||
local reward3 = DataManager.SummonData:getSummonRewardByLv(GConst.SummonConst.SUMMON_TYPE.LV_3, self.level)
|
|
||||||
|
|
||||||
local count = #reward1
|
|
||||||
if count == 1 then
|
|
||||||
self.box1Add1Node:setVisible(true)
|
|
||||||
self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0)
|
|
||||||
self.box1Add1ItemCell:setNum("")
|
|
||||||
self.box1Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward1[1].id, GConst.REWARD_TYPE.ITEM, self.box1Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box1Add1Text:setText("+" .. tostring(reward1[1].num))
|
|
||||||
else
|
|
||||||
self.box1Add1Node:setVisible(true)
|
|
||||||
self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0)
|
|
||||||
self.box1Add1ItemCell:setNum("")
|
|
||||||
self.box1Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward1[1].id, GConst.REWARD_TYPE.ITEM, self.box1Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box1Add1Text:setText("+" .. tostring(reward1[1].num))
|
|
||||||
|
|
||||||
self.box1Add2Node:setVisible(true)
|
|
||||||
self.box1Add2ItemCell:refreshByCfg(reward1[2].id, 0)
|
|
||||||
self.box1Add2ItemCell:setNum("")
|
|
||||||
self.box1Add2ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward1[2].id, GConst.REWARD_TYPE.ITEM, self.box1Add2ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box1Add2Text:setText("+" .. tostring(reward1[2].num))
|
|
||||||
end
|
|
||||||
|
|
||||||
local count = #reward2
|
|
||||||
if count == 1 then
|
|
||||||
self.box2Add1Node:setVisible(true)
|
|
||||||
self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0)
|
|
||||||
self.box2Add1ItemCell:setNum("")
|
|
||||||
self.box2Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward2[1].id, GConst.REWARD_TYPE.ITEM, self.box2Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box2Add1Text:setText("+" .. tostring(reward2[1].num))
|
|
||||||
else
|
|
||||||
self.box2Add1Node:setVisible(true)
|
|
||||||
self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0)
|
|
||||||
self.box2Add1ItemCell:setNum("")
|
|
||||||
self.box2Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward2[1].id, GConst.REWARD_TYPE.ITEM, self.box2Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box2Add1Text:setText("+" .. tostring(reward2[1].num))
|
|
||||||
|
|
||||||
self.box2Add2Node:setVisible(true)
|
|
||||||
self.box2Add2ItemCell:refreshByCfg(reward2[2].id, 0)
|
|
||||||
self.box2Add2ItemCell:setNum("")
|
|
||||||
self.box2Add2ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward2[2].id, GConst.REWARD_TYPE.ITEM, self.box2Add2ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box2Add2Text:setText("+" .. tostring(reward2[2].num))
|
|
||||||
end
|
|
||||||
|
|
||||||
local count = #reward3
|
|
||||||
if count == 1 then
|
|
||||||
self.box3Add1Node:setVisible(true)
|
|
||||||
self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0)
|
|
||||||
self.box3Add1ItemCell:setNum("")
|
|
||||||
self.box3Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward3[1].id, GConst.REWARD_TYPE.ITEM, self.box3Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box3Add1Text:setText("+" .. tostring(reward3[1].num))
|
|
||||||
else
|
|
||||||
self.box3Add1Node:setVisible(true)
|
|
||||||
self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0)
|
|
||||||
self.box3Add1ItemCell:setNum("")
|
|
||||||
self.box3Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward3[1].id, GConst.REWARD_TYPE.ITEM, self.box3Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box3Add1Text:setText("+" .. tostring(reward3[1].num))
|
|
||||||
|
|
||||||
self.box3Add2Node:setVisible(true)
|
|
||||||
self.box3Add2ItemCell:refreshByCfg(reward3[2].id, 0)
|
|
||||||
self.box3Add2ItemCell:setNum("")
|
|
||||||
self.box3Add2ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward3[2].id, GConst.REWARD_TYPE.ITEM, self.box3Add2ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box3Add2Text:setText("+" .. tostring(reward3[2].num))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return BoxLevelUI
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 63f0b0bc9452a954ebac303e7b7f5afb
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,163 +0,0 @@
|
|||||||
local BoxLevelUpUI = class("BoxLevelUpUI", BaseUI)
|
|
||||||
|
|
||||||
function BoxLevelUpUI:ctor(params)
|
|
||||||
params = params or {}
|
|
||||||
self.level = params.level or DataManager.SummonData:getSummonLevel()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxLevelUpUI:isFullScreen()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxLevelUpUI:getPrefabPath()
|
|
||||||
return "assets/prefabs/ui/shop/box_level_up_ui.prefab"
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxLevelUpUI:onLoadRootComplete()
|
|
||||||
self.uiMap = self.root:genAllChildren()
|
|
||||||
self.uiMap["box_level_up_ui.mask"]:addClickListener(function()
|
|
||||||
self:closeUI()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self.titleTx = self.uiMap["box_level_up_ui.title.text"]
|
|
||||||
self.lvTx = self.uiMap["box_level_up_ui.lv_up.text"]
|
|
||||||
|
|
||||||
self.box1Node = self.uiMap["box_level_up_ui.box_1"]
|
|
||||||
self.box1Add1Node = self.uiMap["box_level_up_ui.box_1.add_node_1"]
|
|
||||||
self.box1Add1ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_1.add_node_1.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box1Add1Text = self.uiMap["box_level_up_ui.box_1.add_node_1.text"]
|
|
||||||
self.box1Add2Node = self.uiMap["box_level_up_ui.box_1.add_node_2"]
|
|
||||||
self.box1Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_1.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box1Add2Text = self.uiMap["box_level_up_ui.box_1.add_node_2.text"]
|
|
||||||
self.box1Desc = self.uiMap["box_level_up_ui.box_1.none_text"]
|
|
||||||
self.box1Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
|
|
||||||
|
|
||||||
self.box2Node = self.uiMap["box_level_up_ui.box_2"]
|
|
||||||
self.box2Add1Node = self.uiMap["box_level_up_ui.box_2.add_node_1"]
|
|
||||||
self.box2Add1ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_2.add_node_1.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box2Add1Text = self.uiMap["box_level_up_ui.box_2.add_node_1.text"]
|
|
||||||
self.box2Add2Node = self.uiMap["box_level_up_ui.box_2.add_node_2"]
|
|
||||||
self.box2Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_2.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box2Add2Text = self.uiMap["box_level_up_ui.box_2.add_node_2.text"]
|
|
||||||
self.box2Desc = self.uiMap["box_level_up_ui.box_2.none_text"]
|
|
||||||
self.box2Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
|
|
||||||
|
|
||||||
self.box3Node = self.uiMap["box_level_up_ui.box_3"]
|
|
||||||
self.box3Add1Node = self.uiMap["box_level_up_ui.box_3.add_node_1"]
|
|
||||||
self.box3Add1ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_3.add_node_1.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box3Add1Text = self.uiMap["box_level_up_ui.box_3.add_node_1.text"]
|
|
||||||
self.box3Add2Node = self.uiMap["box_level_up_ui.box_3.add_node_2"]
|
|
||||||
self.box3Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_3.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
|
||||||
self.box3Add2Text = self.uiMap["box_level_up_ui.box_3.add_node_2.text"]
|
|
||||||
self.box3Desc = self.uiMap["box_level_up_ui.box_3.none_text"]
|
|
||||||
self.box3Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
|
|
||||||
|
|
||||||
self.closeTx = self.uiMap["box_level_up_ui.close_tx"]
|
|
||||||
|
|
||||||
self:refresh()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxLevelUpUI:refresh()
|
|
||||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_6)) -- 宝箱等级提升!
|
|
||||||
self.lvTx:setText("Lv." .. tostring(self.level))
|
|
||||||
self.closeTx:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE)) -- 点击继续
|
|
||||||
|
|
||||||
self.box1Add1Node:setVisible(false)
|
|
||||||
self.box1Add2Node:setVisible(false)
|
|
||||||
self.box1Desc:setVisible(false)
|
|
||||||
|
|
||||||
self.box2Add1Node:setVisible(false)
|
|
||||||
self.box2Add2Node:setVisible(false)
|
|
||||||
self.box2Desc:setVisible(false)
|
|
||||||
|
|
||||||
self.box3Add1Node:setVisible(false)
|
|
||||||
self.box3Add2Node:setVisible(false)
|
|
||||||
self.box3Desc:setVisible(false)
|
|
||||||
|
|
||||||
local reward1 = DataManager.SummonData:getSummonRewardByLv(GConst.SummonConst.SUMMON_TYPE.LV_1, self.level)
|
|
||||||
local reward2 = DataManager.SummonData:getSummonRewardByLv(GConst.SummonConst.SUMMON_TYPE.LV_2, self.level)
|
|
||||||
local reward3 = DataManager.SummonData:getSummonRewardByLv(GConst.SummonConst.SUMMON_TYPE.LV_3, self.level)
|
|
||||||
|
|
||||||
local count = #reward1
|
|
||||||
if count == 1 then
|
|
||||||
self.box1Add1Node:setVisible(true)
|
|
||||||
self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0)
|
|
||||||
self.box1Add1ItemCell:setNum("")
|
|
||||||
self.box1Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward1[1].id, GConst.REWARD_TYPE.ITEM, self.box1Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box1Add1Text:setText("+" .. tostring(reward1[1].num))
|
|
||||||
else
|
|
||||||
self.box1Add1Node:setVisible(true)
|
|
||||||
self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0)
|
|
||||||
self.box1Add1ItemCell:setNum("")
|
|
||||||
self.box1Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward1[1].id, GConst.REWARD_TYPE.ITEM, self.box1Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box1Add1Text:setText("+" .. tostring(reward1[1].num))
|
|
||||||
|
|
||||||
self.box1Add2Node:setVisible(true)
|
|
||||||
self.box1Add2ItemCell:refreshByCfg(reward1[2].id, 0)
|
|
||||||
self.box1Add2ItemCell:setNum("")
|
|
||||||
self.box1Add2ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward1[2].id, GConst.REWARD_TYPE.ITEM, self.box1Add2ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box1Add2Text:setText("+" .. tostring(reward1[2].num))
|
|
||||||
end
|
|
||||||
|
|
||||||
local count = #reward2
|
|
||||||
if count == 1 then
|
|
||||||
self.box2Add1Node:setVisible(true)
|
|
||||||
self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0)
|
|
||||||
self.box2Add1ItemCell:setNum("")
|
|
||||||
self.box2Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward2[1].id, GConst.REWARD_TYPE.ITEM, self.box2Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box2Add1Text:setText("+" .. tostring(reward2[1].num))
|
|
||||||
else
|
|
||||||
self.box2Add1Node:setVisible(true)
|
|
||||||
self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0)
|
|
||||||
self.box2Add1ItemCell:setNum("")
|
|
||||||
self.box2Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward2[1].id, GConst.REWARD_TYPE.ITEM, self.box2Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box2Add1Text:setText("+" .. tostring(reward2[1].num))
|
|
||||||
|
|
||||||
self.box2Add2Node:setVisible(true)
|
|
||||||
self.box2Add2ItemCell:refreshByCfg(reward2[2].id, 0)
|
|
||||||
self.box2Add2ItemCell:setNum("")
|
|
||||||
self.box2Add2ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward2[2].id, GConst.REWARD_TYPE.ITEM, self.box2Add2ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box2Add2Text:setText("+" .. tostring(reward2[2].num))
|
|
||||||
end
|
|
||||||
|
|
||||||
local count = #reward3
|
|
||||||
if count == 1 then
|
|
||||||
self.box3Add1Node:setVisible(true)
|
|
||||||
self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0)
|
|
||||||
self.box3Add1ItemCell:setNum("")
|
|
||||||
self.box3Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward3[1].id, GConst.REWARD_TYPE.ITEM, self.box3Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box3Add1Text:setText("+" .. tostring(reward3[1].num))
|
|
||||||
else
|
|
||||||
self.box3Add1Node:setVisible(true)
|
|
||||||
self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0)
|
|
||||||
self.box3Add1ItemCell:setNum("")
|
|
||||||
self.box3Add1ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward3[1].id, GConst.REWARD_TYPE.ITEM, self.box3Add1ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box3Add1Text:setText("+" .. tostring(reward3[1].num))
|
|
||||||
|
|
||||||
self.box3Add2Node:setVisible(true)
|
|
||||||
self.box3Add2ItemCell:refreshByCfg(reward3[2].id, 0)
|
|
||||||
self.box3Add2ItemCell:setNum("")
|
|
||||||
self.box3Add2ItemCell:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward3[2].id, GConst.REWARD_TYPE.ITEM, self.box3Add2ItemCell:getBaseObject())
|
|
||||||
end)
|
|
||||||
self.box3Add2Text:setText("+" .. tostring(reward3[2].num))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return BoxLevelUpUI
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a0c868370ad4a41428279122b3d5dc49
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,81 +0,0 @@
|
|||||||
local BoxOpenUI = class("BoxOpenUI", BaseUI)
|
|
||||||
local AUDIO_DELAY_TIME = 0.4
|
|
||||||
local SPINE_OPEN_TIME = 1.4
|
|
||||||
local DEFAULT_SPINE_NAME = "ui_shop_box_1" -- 默认的展示动画
|
|
||||||
|
|
||||||
local SUMMON_SPINE_NAME = {
|
|
||||||
[1] = "ui_shop_box_1",
|
|
||||||
[2] = "ui_shop_box_2",
|
|
||||||
[3] = "ui_shop_box_3",
|
|
||||||
}
|
|
||||||
local BOUNTY_SPINE_NAME = {
|
|
||||||
[8] = "ui_bounty_chestopen_1",
|
|
||||||
[9] = "ui_bounty_chestopen_2",
|
|
||||||
[11] = "ui_bounty_chestopen_3",
|
|
||||||
[18] = "ui_bounty_chestopen_4",
|
|
||||||
[10] = "ui_bounty_chestopen_5",
|
|
||||||
}
|
|
||||||
local ARENA_BOUNTY_SPINE_NAME = {
|
|
||||||
[8] = "ui_bounty_chestopen_1",
|
|
||||||
[9] = "ui_bounty_chestopen_2",
|
|
||||||
[11] = "ui_bounty_chestopen_3",
|
|
||||||
[18] = "ui_bounty_chestopen_4",
|
|
||||||
[10] = "ui_bounty_chestopen_5",
|
|
||||||
}
|
|
||||||
|
|
||||||
local ARENA_AD_BOX_SPINE_NAME = {
|
|
||||||
[1] = "ui_arena_adchest_1",
|
|
||||||
[2] = "ui_arena_adchest_2",
|
|
||||||
}
|
|
||||||
|
|
||||||
function BoxOpenUI:ctor(params)
|
|
||||||
self.params = params or {} -- 将信息传递给下一个界面
|
|
||||||
self.type = self.params and self.params.type
|
|
||||||
self.index = self.params.params
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxOpenUI:isFullScreen()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxOpenUI:getPrefabPath()
|
|
||||||
return "assets/prefabs/ui/shop/box_open_ui.prefab"
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxOpenUI:onLoadRootComplete()
|
|
||||||
self.uiMap = self.root:genAllChildren()
|
|
||||||
self.bg = self.uiMap["box_open_ui.bg"]
|
|
||||||
-- 奖励界面打开时 关闭此界面
|
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_BOX_OPEN_UI, function()
|
|
||||||
self:closeUI()
|
|
||||||
end)
|
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CLOSE_BOX_HERO_UI)
|
|
||||||
-- 播放spine表现 播放完毕后打开奖励UI
|
|
||||||
self.spineObj = self.uiMap["box_open_ui.ui_spine_obj"]
|
|
||||||
local spineName
|
|
||||||
if self.type == GConst.ShopConst.BOX_REWARD_TYPE.SUMMON then
|
|
||||||
spineName = SUMMON_SPINE_NAME[self.index]
|
|
||||||
elseif self.type == GConst.ShopConst.BOX_REWARD_TYPE.BOUNTY then
|
|
||||||
spineName = BOUNTY_SPINE_NAME[self.index]
|
|
||||||
elseif self.type == GConst.ShopConst.BOX_REWARD_TYPE.ARENA_BOUNTY then
|
|
||||||
spineName = ARENA_BOUNTY_SPINE_NAME[self.index]
|
|
||||||
elseif self.type == GConst.ShopConst.BOX_REWARD_TYPE.ARENA_AD_BOX then
|
|
||||||
spineName = ARENA_AD_BOX_SPINE_NAME[self.index]
|
|
||||||
end
|
|
||||||
if not spineName then
|
|
||||||
spineName = DEFAULT_SPINE_NAME
|
|
||||||
end
|
|
||||||
self.spineObj:loadAssetAsync(spineName, function()
|
|
||||||
self.spineObj:playAnim("born", false, true, true)
|
|
||||||
self.spineObj:getSkeletonGraphic().enabled = true
|
|
||||||
self:performWithDelayGlobal(function()
|
|
||||||
ModuleManager.ShopManager:showBoxRewardUI(self.params)
|
|
||||||
end, SPINE_OPEN_TIME)
|
|
||||||
end, false)
|
|
||||||
-- 音频
|
|
||||||
self:performWithDelayGlobal(function()
|
|
||||||
AudioManager:playEffect(AudioManager.EFFECT_ID.SUMMON_START)
|
|
||||||
end, AUDIO_DELAY_TIME)
|
|
||||||
end
|
|
||||||
|
|
||||||
return BoxOpenUI
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ec611b1975a74654aa3cda5ebf0ea461
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,326 +0,0 @@
|
|||||||
local BoxRewardUI = class("BoxRewardUI", BaseUI)
|
|
||||||
local BOX_HERO_CELL = "app/ui/shop/cell/box_hero_cell"
|
|
||||||
|
|
||||||
local CELL_NUM = 4
|
|
||||||
local QLT_DELAY_TIME = {
|
|
||||||
[1] = 0.3, -- 预留
|
|
||||||
[2] = 0.3, -- 绿
|
|
||||||
[3] = 0.3, -- 蓝
|
|
||||||
[4] = 0.5, -- 紫
|
|
||||||
[5] = 0.5, -- 预留
|
|
||||||
}
|
|
||||||
local FIRST_DELAY_TIME = 0
|
|
||||||
local FADE_TIME = 0.5
|
|
||||||
local MAX_SCREEN_CELL_COUNT = 8 -- 触发滑动的限制值
|
|
||||||
local SCROLL_MOVE_TIME = 0.5
|
|
||||||
|
|
||||||
local REWARD_CELL_WIDTH = 160
|
|
||||||
local REWARD_CELL_HEIGHT = 250
|
|
||||||
|
|
||||||
local BASE_CONTENT_HEIGHT = 600
|
|
||||||
local JUMP_TIME_SCALE = 1000
|
|
||||||
|
|
||||||
local POSITION_X_DATA = {
|
|
||||||
[1] = {0},
|
|
||||||
[2] = {-120, 120},
|
|
||||||
[3] = {-200, 0, 200},
|
|
||||||
[4] = {-240, -80, 80, 240}
|
|
||||||
}
|
|
||||||
|
|
||||||
function BoxRewardUI:ctor(params)
|
|
||||||
self.params = params or {}
|
|
||||||
self.rewards = params.rewards or {}
|
|
||||||
self.actionStatus = {} -- 表现状态
|
|
||||||
self.cellDelayTime = {} -- {idx,time}
|
|
||||||
self.isPlayAni = true
|
|
||||||
-- 前端用展示奖励
|
|
||||||
self.fragmentRewards = {}
|
|
||||||
self.coinNum = 0
|
|
||||||
local fragmentMap = {}
|
|
||||||
-- 将服务器格式转为前端用的格式
|
|
||||||
for _, reward in ipairs(self.rewards) do
|
|
||||||
if reward.type == GConst.REWARD_TYPE.ITEM and reward.item.id == GConst.ItemConst.ITEM_ID_GOLD then
|
|
||||||
self.coinNum = self.coinNum + reward.item.count
|
|
||||||
elseif reward.item.id ~= GConst.ItemConst.ITEM_ID_GEM then
|
|
||||||
local id = reward.item.id
|
|
||||||
local count = reward.item.count
|
|
||||||
fragmentMap[id] = (fragmentMap[id] or 0) + count
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for id, count in pairs(fragmentMap) do
|
|
||||||
table.insert(self.fragmentRewards, {id = id, count = count})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxRewardUI:isFullScreen()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxRewardUI:getPrefabPath()
|
|
||||||
return "assets/prefabs/ui/shop/box_reward_ui.prefab"
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxRewardUI:onLoadRootComplete()
|
|
||||||
self.uiMap = self.root:genAllChildren()
|
|
||||||
|
|
||||||
self.titleTx = self.uiMap["box_reward_ui.title.text"]
|
|
||||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_8)) -- 恭喜获得
|
|
||||||
|
|
||||||
self.coinNode = self.uiMap["box_reward_ui.coin_node"]
|
|
||||||
self.coinIcon = self.uiMap["box_reward_ui.coin_node.coin"]
|
|
||||||
self.coinTx = self.uiMap["box_reward_ui.coin_node.text"]
|
|
||||||
if self.coinNum > 0 then
|
|
||||||
self.coinNode:setVisible(true)
|
|
||||||
self.coinTx:setText(self.coinNum)
|
|
||||||
GFunc.centerImgAndTx(self.coinIcon, self.coinTx, 5)
|
|
||||||
else
|
|
||||||
self.coinNode:setVisible(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
self.closeTx = self.uiMap["box_reward_ui.close_tx"]
|
|
||||||
self:refreshCloseText()
|
|
||||||
|
|
||||||
self.mask = self.uiMap["box_reward_ui.mask"]
|
|
||||||
self.mask:addClickListener(function()
|
|
||||||
-- 动画期间不可关闭
|
|
||||||
if self.isPlayAni then
|
|
||||||
self:jump()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
self:closeUI()
|
|
||||||
-- 如果宝箱等级提升了 则要弹出宝箱等级提升UI
|
|
||||||
if DataManager.SummonData:checkNeedPopBoxLvUpUI() then
|
|
||||||
DataManager.SummonData:clearNeedPopBoxLvUpUI()
|
|
||||||
ModuleManager.ShopManager:showBoxLevelUpUI()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- 关闭上一个界面
|
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CLOSE_BOX_OPEN_UI)
|
|
||||||
|
|
||||||
-- 因为特殊表现 用普通scrollRect处理
|
|
||||||
self.scrollRectContent = self.uiMap["box_reward_ui.scroll_rect.viewport.content"]
|
|
||||||
self.scrollMask = self.uiMap["box_reward_ui.scroll_mask"]
|
|
||||||
self.scrollMask:setVisible(true)
|
|
||||||
self.baseCell = self.uiMap["box_reward_ui.scroll_rect.viewport.content.cell"]
|
|
||||||
self.baseCell:setVisible(false)
|
|
||||||
-- 已拥有的cell
|
|
||||||
self.rewardCells = self.rewardCells or {}
|
|
||||||
local contentTrans = self.scrollRectContent:getTransform()
|
|
||||||
local alreadyCellCount = contentTrans.childCount - 1
|
|
||||||
local rewardCount = #self.fragmentRewards
|
|
||||||
if alreadyCellCount > 0 then
|
|
||||||
for i = 1, alreadyCellCount do
|
|
||||||
local prefab = contentTrans:GetChild(i).gameObject
|
|
||||||
local UIPrefabObject = require "app/bf/unity/uiprefab_object"
|
|
||||||
local prefabObject = UIPrefabObject:create()
|
|
||||||
prefabObject:initWithPrefab(GConst.EMPTY_STRING, prefab)
|
|
||||||
prefabObject:initPrefabHelper()
|
|
||||||
-- 设定位置
|
|
||||||
local index = i
|
|
||||||
local rowIdx = (index - 1) % CELL_NUM + 1 -- 横排位置 1-4
|
|
||||||
local cowIdx = (index - 1) // CELL_NUM + 1
|
|
||||||
if rewardCount <= CELL_NUM then -- 居中展示
|
|
||||||
prefabObject:setAnchoredPosition(POSITION_X_DATA[rewardCount][rowIdx], 0)
|
|
||||||
else
|
|
||||||
prefabObject:setAnchoredPosition(POSITION_X_DATA[4][rowIdx], -(cowIdx - 1) * REWARD_CELL_HEIGHT)
|
|
||||||
end
|
|
||||||
table.insert(self.rewardCells, CellManager:addCellComp(prefabObject, BOX_HERO_CELL))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local cellCount = #self.rewardCells
|
|
||||||
local needCreateCount = rewardCount - cellCount
|
|
||||||
-- 将cell扩充至与奖励等数量
|
|
||||||
if needCreateCount > 0 then
|
|
||||||
for i = 1, needCreateCount do
|
|
||||||
local prefab = CS.UnityEngine.Object.Instantiate(self.baseCell:getGameObject())
|
|
||||||
local UIPrefabObject = require "app/bf/unity/uiprefab_object"
|
|
||||||
local prefabObject = UIPrefabObject:create()
|
|
||||||
prefabObject:initWithPrefab(GConst.EMPTY_STRING, prefab)
|
|
||||||
prefabObject:initPrefabHelper()
|
|
||||||
prefabObject:setParent(self.scrollRectContent, false)
|
|
||||||
prefabObject:getTransform():SetAsLastSibling()
|
|
||||||
prefabObject:setVisible(true)
|
|
||||||
-- 设定位置
|
|
||||||
local index = cellCount + i
|
|
||||||
local rowIdx = (index - 1) % CELL_NUM + 1 -- 横排位置 1-4
|
|
||||||
local cowIdx = (index - 1) // CELL_NUM + 1
|
|
||||||
if rewardCount <= CELL_NUM then -- 居中展示
|
|
||||||
prefabObject:setAnchoredPosition(POSITION_X_DATA[rewardCount][rowIdx], 0)
|
|
||||||
else
|
|
||||||
prefabObject:setAnchoredPosition(POSITION_X_DATA[4][rowIdx], -(cowIdx - 1) * REWARD_CELL_HEIGHT)
|
|
||||||
end
|
|
||||||
table.insert(self.rewardCells, CellManager:addCellComp(prefabObject, BOX_HERO_CELL))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- 刷新
|
|
||||||
cellCount = #self.rewardCells
|
|
||||||
for i = 1, cellCount do
|
|
||||||
if i <= rewardCount then
|
|
||||||
self.rewardCells[i]:setVisible(true)
|
|
||||||
self.rewardCells[i]:refresh(self.fragmentRewards[i])
|
|
||||||
self.rewardCells[i]:disableAllEffect()
|
|
||||||
else
|
|
||||||
self.rewardCells[i]:setVisible(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.maxCow = (rewardCount - 1) // CELL_NUM + 1 -- 最大行数 1-4 = 1, 5-8 = 2,...
|
|
||||||
self.maxScrollContentHeight = math.max(BASE_CONTENT_HEIGHT, self.maxCow * REWARD_CELL_HEIGHT)
|
|
||||||
self.scrollRectContent:setAnchoredPositionY(0)
|
|
||||||
self.scrollRectContent:setSizeDeltaY(self.maxScrollContentHeight)
|
|
||||||
|
|
||||||
-- 如果超出屏蔽显示范围 初始化滑动数据
|
|
||||||
if rewardCount > MAX_SCREEN_CELL_COUNT then
|
|
||||||
self.showAction = true
|
|
||||||
self.turnIdx = MAX_SCREEN_CELL_COUNT // CELL_NUM
|
|
||||||
self.maxIdx = math.ceil(rewardCount / CELL_NUM)
|
|
||||||
end
|
|
||||||
-- 播放表现
|
|
||||||
if not self.cellSeqs then
|
|
||||||
self.cellSeqs = {}
|
|
||||||
end
|
|
||||||
for idx = 1, rewardCount do
|
|
||||||
local cell = self.rewardCells[idx]
|
|
||||||
self:playCellAction(cell, idx)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxRewardUI:playCellAction(cell, idx)
|
|
||||||
if self.actionStatus[idx] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local delayTime = FIRST_DELAY_TIME
|
|
||||||
if idx > 1 then
|
|
||||||
delayTime = self:getCellDelayTime(idx - 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
local canvasGroup = cell.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
|
||||||
if not canvasGroup then
|
|
||||||
canvasGroup = cell.baseObject:addComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
|
||||||
end
|
|
||||||
canvasGroup.alpha = 0
|
|
||||||
|
|
||||||
local seq = cell.baseObject:createBindTweenSequence()
|
|
||||||
table.insert(self.cellSeqs, seq)
|
|
||||||
|
|
||||||
-- local tween = canvasGroup:DOFade(1, FADE_TIME)
|
|
||||||
seq:AppendInterval(delayTime)
|
|
||||||
-- tween:SetEase(CS.DG.Tweening.Ease.InOutSine)
|
|
||||||
seq:AppendCallback(function()
|
|
||||||
cell:setSpineVisible(false) -- 防止spine因透明度变化导致的闪白
|
|
||||||
end)
|
|
||||||
-- seq:Append(tween)
|
|
||||||
seq:AppendCallback(function()
|
|
||||||
if not self:isClosed() then
|
|
||||||
-- 恢复显示
|
|
||||||
canvasGroup.alpha = 1
|
|
||||||
-- 特效
|
|
||||||
if self.isPlayAni then
|
|
||||||
cell:playEffect()
|
|
||||||
else
|
|
||||||
cell:disableAllEffect()
|
|
||||||
end
|
|
||||||
-- 如果需要spine 则显示
|
|
||||||
local heroEntity = DataManager.HeroData:getHeroById(self.fragmentRewards[idx].id)
|
|
||||||
if heroEntity and heroEntity:canLvUp() then
|
|
||||||
cell:setSpineVisible(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
self.actionStatus[idx] = true
|
|
||||||
self:turnToNext(idx)
|
|
||||||
-- 最后一个表现完毕
|
|
||||||
if idx == #self.fragmentRewards then
|
|
||||||
self.isPlayAni = false
|
|
||||||
self:refreshCloseText()
|
|
||||||
self.scrollMask:setVisible(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxRewardUI:turnToNext(idx)
|
|
||||||
if self:isClosed() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if not self.isPlayAni then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if not self.showAction or idx ~= self.turnIdx * CELL_NUM then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if self.contentSeq then
|
|
||||||
self.contentSeq:Kill()
|
|
||||||
self.contentSeq = nil
|
|
||||||
end
|
|
||||||
self.contentSeq = self.root:createBindTweenSequence()
|
|
||||||
self.contentSeq:Append(
|
|
||||||
self.scrollRectContent:getTransform():DOLocalMoveY(math.min(self.maxScrollContentHeight - BASE_CONTENT_HEIGHT, (self.turnIdx + 1) * REWARD_CELL_HEIGHT - BASE_CONTENT_HEIGHT), SCROLL_MOVE_TIME)
|
|
||||||
)
|
|
||||||
self.contentSeq:AppendCallback(
|
|
||||||
function()
|
|
||||||
self.turnIdx = self.turnIdx + 1
|
|
||||||
if self.turnIdx >= self.maxIdx then
|
|
||||||
self.showAction = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxRewardUI:getCellDelayTime(idx)
|
|
||||||
if not self.cellDelayTime[idx] then
|
|
||||||
local reward = self.fragmentRewards[idx]
|
|
||||||
local id = reward.id
|
|
||||||
local qlt = 2 -- 默认品质
|
|
||||||
local heroCfgInfo = ConfigManager:getConfig("hero")[id]
|
|
||||||
if heroCfgInfo then
|
|
||||||
qlt = heroCfgInfo.qlt
|
|
||||||
end
|
|
||||||
local cellDelayTime = QLT_DELAY_TIME[qlt] -- 这个cell的延迟时间
|
|
||||||
if idx == 1 then
|
|
||||||
self.cellDelayTime[idx] = cellDelayTime
|
|
||||||
else
|
|
||||||
self.cellDelayTime[idx] = cellDelayTime + self:getCellDelayTime(idx - 1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return self.cellDelayTime[idx]
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxRewardUI:jump()
|
|
||||||
self.isPlayAni = false
|
|
||||||
|
|
||||||
if self.cellSeqs then
|
|
||||||
for _, cellSeq in ipairs(self.cellSeqs) do
|
|
||||||
cellSeq.timeScale = JUMP_TIME_SCALE
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if self.contentSeq then
|
|
||||||
self.contentSeq.timeScale = JUMP_TIME_SCALE
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 强制刷新一次表现
|
|
||||||
local rewardCount = #self.fragmentRewards
|
|
||||||
for idx = 1, rewardCount do
|
|
||||||
local cell = self.rewardCells[idx]
|
|
||||||
local canvasGroup = cell.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
|
||||||
if not canvasGroup then
|
|
||||||
canvasGroup = cell.baseObject:addComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
|
||||||
end
|
|
||||||
canvasGroup.alpha = 1
|
|
||||||
cell:disableAllEffect()
|
|
||||||
end
|
|
||||||
self.scrollRectContent:setAnchoredPositionY(self.maxScrollContentHeight - BASE_CONTENT_HEIGHT)
|
|
||||||
self.turnIdx = self.maxIdx
|
|
||||||
self.showAction = false
|
|
||||||
self:refreshCloseText()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxRewardUI:refreshCloseText()
|
|
||||||
if self.isPlayAni then
|
|
||||||
self.closeTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_SKIP))
|
|
||||||
else
|
|
||||||
self.closeTx:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_CLOSE_DESC))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return BoxRewardUI
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 46d2b5d91a9f98348a9799f5084c8044
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
61
lua/app/ui/shop/buy_gem_ui.lua
Executable file
61
lua/app/ui/shop/buy_gem_ui.lua
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
local BuyGemUI = class("BuyGemUI", BaseUI)
|
||||||
|
|
||||||
|
local GEM_CELL = "app/ui/shop/cell/gem_cell"
|
||||||
|
|
||||||
|
function BuyGemUI:isFullScreen()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyGemUI:showCommonBG()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyGemUI:ctor()
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyGemUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/shop/buy_gem_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyGemUI:onLoadRootComplete()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
self.mask = uiMap["buy_gem_ui.mask"]
|
||||||
|
self.txTitle = uiMap["buy_gem_ui.content.tx_title"]
|
||||||
|
self.btnClose = uiMap["buy_gem_ui.content.btn_close"]
|
||||||
|
self.scrollrect = uiMap["buy_gem_ui.content.content.scrollrect"]
|
||||||
|
|
||||||
|
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_6))
|
||||||
|
|
||||||
|
self.mask:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
self.btnClose:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.ShopData, "isDirty", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyGemUI:onRefresh()
|
||||||
|
local count = #ConfigManager:getConfig("mall_treasure")
|
||||||
|
if not self.scrollRect then
|
||||||
|
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
|
self.scrollRect:addInitCallback(function()
|
||||||
|
return GEM_CELL
|
||||||
|
end)
|
||||||
|
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||||
|
cell:refresh(index)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
|
||||||
|
self.scrollRect:refillCells(count)
|
||||||
|
elseif self.scrollRect:getTotalCount() ~= count then
|
||||||
|
self.scrollRect:clearCells()
|
||||||
|
self.scrollRect:refillCells(count)
|
||||||
|
else
|
||||||
|
self.scrollRect:updateAllCell()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return BuyGemUI
|
||||||
10
lua/app/ui/shop/buy_gem_ui.lua.meta
Executable file
10
lua/app/ui/shop/buy_gem_ui.lua.meta
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 64d78238a6442b541a798b2942341c59
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
234
lua/app/ui/shop/buy_vit_ui.lua
Executable file
234
lua/app/ui/shop/buy_vit_ui.lua
Executable file
@ -0,0 +1,234 @@
|
|||||||
|
local BuyVitUI = class("BuyVitUI", BaseUI)
|
||||||
|
|
||||||
|
function BuyVitUI:isFullScreen()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:showCommonBG()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:ctor(params)
|
||||||
|
self.dataKey = params.dataKey
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/shop/buy_vit_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:onLoadRootComplete()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
self.mask = uiMap["buy_vit_ui.mask"]
|
||||||
|
self.txTitle = uiMap["buy_vit_ui.content.tx_title"]
|
||||||
|
self.btnClose = uiMap["buy_vit_ui.content.btn_close"]
|
||||||
|
self.buyNodes = {}
|
||||||
|
self.txRewards = {}
|
||||||
|
self.txCosts = {}
|
||||||
|
self.imgCosts = {}
|
||||||
|
self.txLimits = {}
|
||||||
|
self.imgChecks = {}
|
||||||
|
for k, buyType in pairs(GConst.VIT_BUY_TYPE) do
|
||||||
|
self.buyNodes[buyType] = uiMap["buy_vit_ui.content.content.cell_" .. buyType]
|
||||||
|
self.txRewards[buyType] = uiMap["buy_vit_ui.content.content.cell_" .. buyType .. ".tx_num"]
|
||||||
|
self.txCosts[buyType] = uiMap["buy_vit_ui.content.content.cell_" .. buyType .. ".tx_cost"]
|
||||||
|
self.imgCosts[buyType] = uiMap["buy_vit_ui.content.content.cell_" .. buyType .. ".img_cost"]
|
||||||
|
self.txLimits[buyType] = uiMap["buy_vit_ui.content.content.cell_" .. buyType .. ".tx_limit"]
|
||||||
|
self.imgChecks[buyType] = uiMap["buy_vit_ui.content.content.cell_" .. buyType .. ".img_check"]
|
||||||
|
end
|
||||||
|
|
||||||
|
self.txTitle:setText(self:getBuyTitle())
|
||||||
|
if self.buyNodes[GConst.VIT_BUY_TYPE.AD] then
|
||||||
|
self.buyNodes[GConst.VIT_BUY_TYPE.AD]:addClickListener(function()
|
||||||
|
if not GFunc.IsGotServerTime() then
|
||||||
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.NEED_NET))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
SDKManager:showFullScreenAds(self:getBuyAdType(), function()
|
||||||
|
self:getBuyFunc(GConst.VIT_BUY_TYPE.AD)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
self.buyNodes[GConst.VIT_BUY_TYPE.GEM]:addClickListener(function()
|
||||||
|
local cost = self:getBuyCost(GConst.VIT_BUY_TYPE.GEM)
|
||||||
|
if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true, self:getBuyBI()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local params = {}
|
||||||
|
params.content = I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_13)
|
||||||
|
params.boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL
|
||||||
|
params.showToday = GConst.MESSAGE_BOX_SHOW_TODAY.BUY_VIT_COUNT
|
||||||
|
params.okFunc = function()
|
||||||
|
self:getBuyFunc(GConst.VIT_BUY_TYPE.GEM)
|
||||||
|
end
|
||||||
|
GFunc.showMessageBox(params)
|
||||||
|
end)
|
||||||
|
self.mask:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
self.btnClose:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
|
||||||
|
self:bind(DataManager[self.dataKey], "isDirty", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:onRefresh()
|
||||||
|
for buyType, node in pairs(self.buyNodes) do
|
||||||
|
local reward = self:getBuyReward(buyType)
|
||||||
|
local cost = self:getBuyCost(buyType)
|
||||||
|
local remain = self:getBuyRemainCount(buyType)
|
||||||
|
|
||||||
|
node:setSprite(GConst.ATLAS_PATH.UI_SHOP, self:getBuyBg(buyType))
|
||||||
|
self.txRewards[buyType]:setText("x" .. GFunc.getRewardNum(reward))
|
||||||
|
if remain < 9999 then
|
||||||
|
self.txLimits[buyType]:setText(I18N:getGlobalText(I18N.GlobalConst.BUY_VIT_DESC_2, remain))
|
||||||
|
else
|
||||||
|
self.txLimits[buyType]:setText("")
|
||||||
|
end
|
||||||
|
|
||||||
|
if buyType == GConst.VIT_BUY_TYPE.AD then
|
||||||
|
GFunc.setAdsSprite(self.imgCosts[buyType])
|
||||||
|
self.txCosts[buyType]:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC))
|
||||||
|
elseif buyType == GConst.VIT_BUY_TYPE.GEM then
|
||||||
|
self.imgCosts[buyType]:setSprite(GFunc.getIconResByReward(cost))
|
||||||
|
self.txCosts[buyType]:setText(GFunc.getRewardNum(cost))
|
||||||
|
end
|
||||||
|
GFunc.centerImgAndTx(self.imgCosts[buyType], self.txCosts[buyType], 3)
|
||||||
|
|
||||||
|
if remain > 0 then
|
||||||
|
node:setTouchEnable(true)
|
||||||
|
self.imgChecks[buyType]:setActive(false)
|
||||||
|
self.imgCosts[buyType]:setActive(true)
|
||||||
|
self.txCosts[buyType]:setActive(true)
|
||||||
|
else
|
||||||
|
node:setTouchEnable(false)
|
||||||
|
self.imgChecks[buyType]:setActive(false)
|
||||||
|
self.imgCosts[buyType]:setActive(true)
|
||||||
|
self.txCosts[buyType]:setActive(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 红点
|
||||||
|
if buyType == GConst.VIT_BUY_TYPE.AD and remain > 0 then
|
||||||
|
node:addRedPoint(105, 160, 1)
|
||||||
|
else
|
||||||
|
node:removeRedPoint()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 以下接口,如果要加新的道具,需要补充对应的逻辑
|
||||||
|
|
||||||
|
function BuyVitUI:getBuyTitle()
|
||||||
|
if self.dataKey == "ShopData" then
|
||||||
|
return I18N:getGlobalText(I18N.GlobalConst.BUY_VIT_DESC_1)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChallengeTeamData" then
|
||||||
|
return I18N:getGlobalText(I18N.GlobalConst.BUY_VIT_DESC_3)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChapterTeamData" then
|
||||||
|
return I18N:getGlobalText(I18N.GlobalConst.BUY_VIT_DESC_4)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:getBuyBg(buyType)
|
||||||
|
if self.dataKey == "ShopData" then
|
||||||
|
if buyType == GConst.VIT_BUY_TYPE.AD then
|
||||||
|
return "shop_bg_14"
|
||||||
|
end
|
||||||
|
if buyType == GConst.VIT_BUY_TYPE.GEM then
|
||||||
|
return "shop_bg_13"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChallengeTeamData" then
|
||||||
|
if buyType == GConst.VIT_BUY_TYPE.AD then
|
||||||
|
return "shop_bg_8"
|
||||||
|
end
|
||||||
|
if buyType == GConst.VIT_BUY_TYPE.GEM then
|
||||||
|
return "shop_bg_11"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChapterTeamData" then
|
||||||
|
if buyType == GConst.VIT_BUY_TYPE.AD then
|
||||||
|
return "shop_bg_10"
|
||||||
|
end
|
||||||
|
if buyType == GConst.VIT_BUY_TYPE.GEM then
|
||||||
|
return "shop_bg_9"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:getBuyReward(buyType)
|
||||||
|
if self.dataKey == "ShopData" then
|
||||||
|
return DataManager.ShopData:getVitBuyReward(buyType)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChallengeTeamData" then
|
||||||
|
return DataManager.ChallengeTeamData:getVitBuyReward(buyType)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChapterTeamData" then
|
||||||
|
return DataManager.ChapterTeamData:getVitBuyReward(buyType)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:getBuyCost(buyType)
|
||||||
|
if self.dataKey == "ShopData" then
|
||||||
|
return DataManager.ShopData:getVitBuyCost(buyType)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChallengeTeamData" then
|
||||||
|
return DataManager.ChallengeTeamData:getVitBuyCost(buyType)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChapterTeamData" then
|
||||||
|
return DataManager.ChapterTeamData:getVitBuyCost(buyType)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:getBuyRemainCount(buyType)
|
||||||
|
if self.dataKey == "ShopData" then
|
||||||
|
return DataManager.ShopData:getVitBuyRemainCount(buyType)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChallengeTeamData" then
|
||||||
|
return DataManager.ChallengeTeamData:getVitBuyRemainCount(buyType)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChapterTeamData" then
|
||||||
|
return DataManager.ChapterTeamData:getVitBuyRemainCount(buyType)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:getBuyFunc(buyType)
|
||||||
|
if self.dataKey == "ShopData" then
|
||||||
|
return ModuleManager.ShopManager:reqBuyVit(buyType)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChallengeTeamData" then
|
||||||
|
return ModuleManager.ChallengeTeamManager:reqChallengeBuyVitality(buyType == GConst.VIT_BUY_TYPE.AD)
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChapterTeamData" then
|
||||||
|
return ModuleManager.ChapterTeamManager:reqBuyVitality(buyType)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:getBuyBI()
|
||||||
|
if self.dataKey == "ShopData" then
|
||||||
|
return BIReport.ITEM_GET_TYPE.BUY_VIT
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChallengeTeamData" then
|
||||||
|
return BIReport.ITEM_GET_TYPE.CHALLENGE_VITALITY_BUY_COUNT
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChapterTeamData" then
|
||||||
|
return BIReport.ITEM_GET_TYPE.CHAPTER_TEAM_BUY_COUNT
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuyVitUI:getBuyAdType()
|
||||||
|
if self.dataKey == "ShopData" then
|
||||||
|
return BIReport.ADS_CLICK_TYPE.AD_ENERGY
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChallengeTeamData" then
|
||||||
|
return BIReport.ADS_CLICK_TYPE.AD_CHALLENGE_ENERGY
|
||||||
|
end
|
||||||
|
if self.dataKey == "ChapterTeamData" then
|
||||||
|
return BIReport.ADS_CLICK_TYPE.AD_CHAPTER_TEAM_ENERGY
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return BuyVitUI
|
||||||
10
lua/app/ui/shop/buy_vit_ui.lua.meta
Executable file
10
lua/app/ui/shop/buy_vit_ui.lua.meta
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f43b0222a0b232d45b3f9c9ecb4d1862
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
2
lua/app/ui/shop/cell.meta
Normal file → Executable file
2
lua/app/ui/shop/cell.meta
Normal file → Executable file
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 6c4977772b149c848a64d89632133d2e
|
guid: bf5f095a69b17a44db1ceec247bc89c4
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@ -1,104 +0,0 @@
|
|||||||
local ArenaGiftSellCell = class("ArenaGiftSellCell", BaseCell)
|
|
||||||
local MAX_REWARD_COUNT = 4
|
|
||||||
local BASE_CELL_HEIGHT = 320
|
|
||||||
|
|
||||||
local BG = {
|
|
||||||
[90102] = "assets/arts/textures/background/shop/arena_gift_banner_1.png",
|
|
||||||
[90202] = "assets/arts/textures/background/shop/arena_gift_banner_2.png",
|
|
||||||
[90302] = "assets/arts/textures/background/shop/arena_gift_banner_3.png",
|
|
||||||
[90402] = "assets/arts/textures/background/shop/arena_gift_banner_4.png",
|
|
||||||
}
|
|
||||||
|
|
||||||
function ArenaGiftSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["gift_cell.bg"]
|
|
||||||
if BG[DataManager.ArenaData:getGiftId()] then
|
|
||||||
self.bg:setTexture(BG[DataManager.ArenaData:getGiftId()])
|
|
||||||
end
|
|
||||||
|
|
||||||
self.leftArrow = uiMap["gift_cell.left_arrow"]
|
|
||||||
self.rightArrow = uiMap["gift_cell.right_arrow"]
|
|
||||||
|
|
||||||
self.offImg = uiMap["gift_cell.bg.off_img"]
|
|
||||||
self.offText = uiMap["gift_cell.bg.off_img.text"]
|
|
||||||
|
|
||||||
self.limitImg = uiMap["gift_cell.bg.limit_img"]
|
|
||||||
self.limitText = uiMap["gift_cell.bg.limit_img.text"]
|
|
||||||
|
|
||||||
self.titleText = uiMap["gift_cell.bg.title_text"]
|
|
||||||
|
|
||||||
self.reweardLayout = uiMap["gift_cell.bg.reward_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) -- RefreshLayout()
|
|
||||||
if not self.rewardCellList then
|
|
||||||
self.rewardCellList = {}
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 不限时时使用1类型 否则使用2类型
|
|
||||||
self.priceText = uiMap["gift_cell.bg.price"]
|
|
||||||
self.timeImg = uiMap["gift_cell.bg.time_img"]
|
|
||||||
self.timeText = uiMap["gift_cell.bg.time_img.text"]
|
|
||||||
self.clickArea = uiMap["gift_cell.bg.click_area"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArenaGiftSellCell:refresh()
|
|
||||||
local actGiftId = DataManager.ArenaData:getGiftId()
|
|
||||||
local cfgInfo = ConfigManager:getConfig("act_gift")[actGiftId]
|
|
||||||
-- 超值
|
|
||||||
if cfgInfo.value then
|
|
||||||
self.offImg:setVisible(true)
|
|
||||||
self.offText:setText(tostring(cfgInfo.value) .. "%")
|
|
||||||
else
|
|
||||||
self.offImg:setVisible(false)
|
|
||||||
end
|
|
||||||
-- 限购
|
|
||||||
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, 1)) -- 限购1次
|
|
||||||
-- 标题
|
|
||||||
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_40)) -- 竞技场特惠
|
|
||||||
-- 奖励
|
|
||||||
local rewardList = cfgInfo.reward
|
|
||||||
local count = rewardList and #rewardList or 0
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
if i <= count then
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(true)
|
|
||||||
self.rewardCellList[i]:refreshByConfig(rewardList[i])
|
|
||||||
else
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.reweardLayout:RefreshLayout()
|
|
||||||
-- 价格
|
|
||||||
self.priceText:setText(GFunc.getFormatPrice(cfgInfo.recharge_id))
|
|
||||||
-- 限时
|
|
||||||
self.timeImg:setVisible(true)
|
|
||||||
self:refreshTime()
|
|
||||||
|
|
||||||
self.clickArea:addClickListener(function()
|
|
||||||
self:onClickGift(actGiftId)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArenaGiftSellCell:getCellHeight()
|
|
||||||
return BASE_CELL_HEIGHT -- 竞技场固定1个
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArenaGiftSellCell:getIsOpen()
|
|
||||||
return DataManager.ArenaData:getGiftId() ~= nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArenaGiftSellCell:refreshTime()
|
|
||||||
local remainTime = DataManager.ArenaData:getGiftRemainTime()
|
|
||||||
self.timeText:setText(Time:formatNumTime(remainTime))
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArenaGiftSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArenaGiftSellCell:onClickGift(id)
|
|
||||||
-- PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
|
||||||
ModuleManager.ArenaManager:showGiftPopUI(BIReport.PAY_UI_SHOW_TYPE.CLICK_SHOW)
|
|
||||||
end
|
|
||||||
|
|
||||||
return ArenaGiftSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 2259d1a0184c8284d9c5a78fd212baf3
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,110 +0,0 @@
|
|||||||
local ArmorSellCell = class("ArmorSellCell", BaseCell)
|
|
||||||
local MAX_REWARD_COUNT = 4
|
|
||||||
local BASE_CELL_HEIGHT = 320
|
|
||||||
local GIFT_TYPE = PayManager.PURCHARSE_ACT_TYPE.ARMOR_GIFT
|
|
||||||
|
|
||||||
function ArmorSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["gift_cell.bg"]
|
|
||||||
self.bg:setTexture("assets/arts/textures/background/shop/shop_gift_banner_7_1.png")
|
|
||||||
|
|
||||||
self.leftArrow = uiMap["gift_cell.left_arrow"]
|
|
||||||
self.rightArrow = uiMap["gift_cell.right_arrow"]
|
|
||||||
|
|
||||||
self.offImg = uiMap["gift_cell.bg.off_img"]
|
|
||||||
self.offText = uiMap["gift_cell.bg.off_img.text"]
|
|
||||||
|
|
||||||
self.limitImg = uiMap["gift_cell.bg.limit_img"]
|
|
||||||
self.limitText = uiMap["gift_cell.bg.limit_img.text"]
|
|
||||||
|
|
||||||
self.titleText = uiMap["gift_cell.bg.title_text"]
|
|
||||||
|
|
||||||
self.reweardLayout = uiMap["gift_cell.bg.reward_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) -- RefreshLayout()
|
|
||||||
if not self.rewardCellList then
|
|
||||||
self.rewardCellList = {}
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.priceText = uiMap["gift_cell.bg.price"]
|
|
||||||
self.timeImg = uiMap["gift_cell.bg.time_img"]
|
|
||||||
self.timeText = uiMap["gift_cell.bg.time_img.text"]
|
|
||||||
self.clickArea = uiMap["gift_cell.bg.click_area"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArmorSellCell:refresh()
|
|
||||||
local actGiftId = DataManager.ShopData:getGift(GIFT_TYPE).id
|
|
||||||
if actGiftId and actGiftId > 0 then
|
|
||||||
self.actGiftId = actGiftId
|
|
||||||
local cfgInfo = ConfigManager:getConfig("act_gift")[self.actGiftId]
|
|
||||||
-- 超值
|
|
||||||
self.offText:setText(tostring(cfgInfo.value) .. "%")
|
|
||||||
-- 限购
|
|
||||||
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, 1)) -- 限购1次
|
|
||||||
-- 标题
|
|
||||||
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_25))
|
|
||||||
-- 奖励
|
|
||||||
local rewardList = cfgInfo.reward
|
|
||||||
local count = rewardList and #rewardList or 0
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
if i <= count then
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(true)
|
|
||||||
self.rewardCellList[i]:refreshByConfig(rewardList[i])
|
|
||||||
else
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.reweardLayout:RefreshLayout()
|
|
||||||
-- 价格
|
|
||||||
self.priceText:setText(GFunc.getFormatPrice(cfgInfo.recharge_id))
|
|
||||||
-- 限时
|
|
||||||
self.timeImg:setVisible(true)
|
|
||||||
self:refreshTime()
|
|
||||||
|
|
||||||
self.clickArea:addClickListener(function()
|
|
||||||
self:onClickGift(self.actGiftId)
|
|
||||||
end)
|
|
||||||
else -- 倒计时结束的情况
|
|
||||||
if self.actGiftId then
|
|
||||||
DataManager.ShopData:setDirty()
|
|
||||||
self.actGiftId = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArmorSellCell:getCellHeight()
|
|
||||||
return BASE_CELL_HEIGHT -- 固定1个
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArmorSellCell:getIsOpen()
|
|
||||||
return DataManager.ShopData:getGift(GIFT_TYPE) ~= nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArmorSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArmorSellCell:onClickGift(id)
|
|
||||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArmorSellCell:refreshTime()
|
|
||||||
local remainTime = 0
|
|
||||||
if self.actGiftId and self.actGiftId > 0 then
|
|
||||||
remainTime = DataManager.ShopData:getGiftRemainTime(GIFT_TYPE)
|
|
||||||
if remainTime <= 0 then
|
|
||||||
remainTime = 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.timeText:setText(Time:formatNumTime(remainTime))
|
|
||||||
end
|
|
||||||
|
|
||||||
function ArmorSellCell:getCellCount()
|
|
||||||
if self.actGiftId and self.actGiftId > 0 then
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return ArmorSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: cf795bbf49a759d4e8ffadab2525497c
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
local BeginnerSellCell = class("BeginnerSellCell", BaseCell)
|
|
||||||
local MAX_REWARD_COUNT = 4
|
|
||||||
local BASE_CELL_HEIGHT = 320
|
|
||||||
|
|
||||||
function BeginnerSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["gift_cell.bg"]
|
|
||||||
self.bg:setTexture("assets/arts/textures/background/shop/shop_gift_banner_3.png")
|
|
||||||
|
|
||||||
self.leftArrow = uiMap["gift_cell.left_arrow"]
|
|
||||||
self.rightArrow = uiMap["gift_cell.right_arrow"]
|
|
||||||
|
|
||||||
self.offImg = uiMap["gift_cell.bg.off_img"]
|
|
||||||
self.offText = uiMap["gift_cell.bg.off_img.text"]
|
|
||||||
|
|
||||||
self.limitImg = uiMap["gift_cell.bg.limit_img"]
|
|
||||||
self.limitText = uiMap["gift_cell.bg.limit_img.text"]
|
|
||||||
|
|
||||||
self.titleText = uiMap["gift_cell.bg.title_text"]
|
|
||||||
|
|
||||||
self.reweardLayout = uiMap["gift_cell.bg.reward_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) -- RefreshLayout()
|
|
||||||
if not self.rewardCellList then
|
|
||||||
self.rewardCellList = {}
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 不限时时使用1类型 否则使用2类型
|
|
||||||
self.priceText = uiMap["gift_cell.bg.price"]
|
|
||||||
|
|
||||||
self.timeImg = uiMap["gift_cell.bg.time_img"]
|
|
||||||
self.timeText = uiMap["gift_cell.bg.time_img.text"]
|
|
||||||
|
|
||||||
self.clickArea = uiMap["gift_cell.bg.click_area"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function BeginnerSellCell:refresh()
|
|
||||||
local actGiftId = GConst.ShopConst.BEGINNER_GIFT_ID
|
|
||||||
local cfgInfo = ConfigManager:getConfig("act_gift")[actGiftId]
|
|
||||||
-- 超值
|
|
||||||
if cfgInfo.value then
|
|
||||||
self.offImg:setVisible(true)
|
|
||||||
self.offText:setText(tostring(cfgInfo.value * 100) .. "%")
|
|
||||||
else
|
|
||||||
self.offImg:setVisible(false)
|
|
||||||
end
|
|
||||||
-- 限购
|
|
||||||
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, 1)) -- 限购1次
|
|
||||||
-- 标题
|
|
||||||
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_11)) -- 新手礼包
|
|
||||||
-- 奖励
|
|
||||||
local rewardList = cfgInfo.reward
|
|
||||||
local count = rewardList and #rewardList or 0
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
if i <= count then
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(true)
|
|
||||||
self.rewardCellList[i]:refreshByConfig(rewardList[i])
|
|
||||||
else
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.reweardLayout:RefreshLayout()
|
|
||||||
-- 价格
|
|
||||||
self.priceText:setText(GFunc.getFormatPrice(cfgInfo.recharge_id))
|
|
||||||
-- 限时(隐藏)
|
|
||||||
self.timeImg:setVisible(false)
|
|
||||||
|
|
||||||
self.clickArea:addClickListener(function()
|
|
||||||
self:onClickGift(actGiftId)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BeginnerSellCell:getCellHeight()
|
|
||||||
return BASE_CELL_HEIGHT -- 新手礼包固定1个
|
|
||||||
end
|
|
||||||
|
|
||||||
function BeginnerSellCell:getIsOpen()
|
|
||||||
return not DataManager.ShopData:getBeginnerGiftHasBuy()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BeginnerSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BeginnerSellCell:onClickGift(id)
|
|
||||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
|
||||||
end
|
|
||||||
|
|
||||||
return BeginnerSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 49dcb2ca91052ea45a769729b7325d05
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
local BoxHeroCell = class("BoxHeroCell", BaseCell)
|
|
||||||
|
|
||||||
function BoxHeroCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.heroCell = CellManager:addCellComp(uiMap["cell.hero_cell"], GConst.TYPEOF_LUA_CLASS.HERO_CELL)
|
|
||||||
self.heroNumText = uiMap["cell.num_tx"]
|
|
||||||
self.effects = {}
|
|
||||||
self.effects[2] = uiMap["cell.effect_node.sfx_ui_zhaohuan_lv_b01"]
|
|
||||||
self.effects[3] = uiMap["cell.effect_node.sfx_ui_zhaohuan_lan_b01"]
|
|
||||||
self.effects[4] = uiMap["cell.effect_node.sfx_ui_zhaohuan_zi_b01"]
|
|
||||||
self:disableAllEffect()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroCell:refresh(data)
|
|
||||||
self.data = data
|
|
||||||
local id = data.id
|
|
||||||
local num = data.count
|
|
||||||
self.heroCell:setShowRedPoint(false)
|
|
||||||
|
|
||||||
local heroEntity = DataManager.HeroData:getHeroById(id)
|
|
||||||
if heroEntity then
|
|
||||||
self.heroCell:refresh(heroEntity)
|
|
||||||
else
|
|
||||||
self.heroCell:refreshWithCfgId(id)
|
|
||||||
end
|
|
||||||
self.heroNumText:setText("X" .. tostring(num))
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroCell:playEffect()
|
|
||||||
if self.data and self.effects then
|
|
||||||
local id = self.data.id
|
|
||||||
local heroInfo = ConfigManager:getConfig("hero")[id]
|
|
||||||
if heroInfo then
|
|
||||||
local qlt = heroInfo.qlt
|
|
||||||
for key, effect in pairs(self.effects) do
|
|
||||||
if key == qlt then
|
|
||||||
effect:setActive(true)
|
|
||||||
effect:play()
|
|
||||||
else
|
|
||||||
effect:setActive(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroCell:disableAllEffect()
|
|
||||||
if self.effects then
|
|
||||||
for key, effect in pairs(self.effects) do
|
|
||||||
effect:setActive(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroCell:setSpineVisible(visible)
|
|
||||||
self.heroCell:setSpineVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxHeroCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
return BoxHeroCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3482ec01640b03a488ecb2abda8a4fb0
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,146 +0,0 @@
|
|||||||
local BoxSellCell = class("BoxSellCell", BaseCell)
|
|
||||||
|
|
||||||
local BASE_CELL_HEIGHT = 522
|
|
||||||
local FULL_CELL_HEIGHT = 786
|
|
||||||
local HEIGHT_ADD = 30
|
|
||||||
|
|
||||||
function BoxSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["box_sell_cell.bg"]
|
|
||||||
local boxNameTx1 = uiMap["box_sell_cell.bg.box_1.name_tx"]
|
|
||||||
boxNameTx1:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_1)) -- 普通宝箱
|
|
||||||
local boxDescTx1 = uiMap["box_sell_cell.bg.box_1.desc_tx"]
|
|
||||||
boxDescTx1:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_24)) -- 必出<color=#5fff57>普通</color>英雄
|
|
||||||
self.boxBuyBtn1 = uiMap["box_sell_cell.bg.box_1"]
|
|
||||||
self.boxBuyBtnCoin1 = uiMap["box_sell_cell.bg.box_1.buy_btn.coin"]
|
|
||||||
self.boxBuyBtnTx1 = uiMap["box_sell_cell.bg.box_1.buy_btn.buy_tx"]
|
|
||||||
local boxNameTx2 = uiMap["box_sell_cell.bg.box_2.name_tx"]
|
|
||||||
boxNameTx2:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_2)) -- 精致宝箱
|
|
||||||
local boxDescTx2 = uiMap["box_sell_cell.bg.box_2.desc_tx"]
|
|
||||||
boxDescTx2:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_25)) -- 必出<color=#8aedff>稀有</color>英雄
|
|
||||||
self.boxBuyBtn2 = uiMap["box_sell_cell.bg.box_2"]
|
|
||||||
self.boxBuyBtnCoin2 = uiMap["box_sell_cell.bg.box_2.buy_btn.coin"]
|
|
||||||
self.boxBuyBtnTx2 = uiMap["box_sell_cell.bg.box_2.buy_btn.buy_tx"]
|
|
||||||
self.box3 = uiMap["box_sell_cell.bg.box_3"]
|
|
||||||
local boxNameTx3 = uiMap["box_sell_cell.bg.box_3.name_tx"]
|
|
||||||
boxNameTx3:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_3)) -- 珍贵宝箱
|
|
||||||
local boxDescTx3 = uiMap["box_sell_cell.bg.box_3.desc_tx"]
|
|
||||||
boxDescTx3:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_26)) -- 必出<color=#ff8af0>史诗</color>英雄
|
|
||||||
self.boxBuyBtn3 = uiMap["box_sell_cell.bg.box_3"]
|
|
||||||
self.boxBuyBtnCoin3 = uiMap["box_sell_cell.bg.box_3.buy_btn.coin"]
|
|
||||||
self.boxBuyBtnTx3 = uiMap["box_sell_cell.bg.box_3.buy_btn.buy_tx"]
|
|
||||||
self.progressSlider = uiMap["box_sell_cell.bg.progress_slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
|
||||||
self.progressLv = uiMap["box_sell_cell.bg.progress_lv"]
|
|
||||||
self.progressTx = uiMap["box_sell_cell.bg.progress_tx"]
|
|
||||||
self.helpBtn = uiMap["box_sell_cell.bg.help_btn"]
|
|
||||||
local titleTx = uiMap["box_sell_cell.title_bg.text"]
|
|
||||||
titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_27)) -- 宝箱
|
|
||||||
|
|
||||||
self.boxBuyBtn1:addClickListener(function()
|
|
||||||
self:onClickBox(GConst.SummonConst.SUMMON_TYPE.LV_1)
|
|
||||||
end)
|
|
||||||
self.boxBuyBtn2:addClickListener(function()
|
|
||||||
self:onClickBox(GConst.SummonConst.SUMMON_TYPE.LV_2)
|
|
||||||
end)
|
|
||||||
self.boxBuyBtn3:addClickListener(function()
|
|
||||||
self:onClickBox(GConst.SummonConst.SUMMON_TYPE.LV_3)
|
|
||||||
end)
|
|
||||||
self.helpBtn:addClickListener(function()
|
|
||||||
self:showHelpTips()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self.cellHeight = BASE_CELL_HEIGHT
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxSellCell:refresh()
|
|
||||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.STORE_BOX_3_OPEN, true) then -- 没解锁的话第三个宝箱不显示
|
|
||||||
self.cellHeight = BASE_CELL_HEIGHT + 70
|
|
||||||
self.baseObject:setSizeDeltaY(BASE_CELL_HEIGHT)
|
|
||||||
self.bg:setTexture("assets/arts/textures/background/shop/shop_bg_10.png")
|
|
||||||
self.bg:setSizeDeltaY(BASE_CELL_HEIGHT - HEIGHT_ADD)
|
|
||||||
self.box3:setVisible(false)
|
|
||||||
else
|
|
||||||
self.cellHeight = FULL_CELL_HEIGHT + 70
|
|
||||||
self.baseObject:setSizeDeltaY(FULL_CELL_HEIGHT)
|
|
||||||
self.bg:setTexture("assets/arts/textures/background/shop/shop_bg_9.png")
|
|
||||||
self.bg:setSizeDeltaY(FULL_CELL_HEIGHT - HEIGHT_ADD)
|
|
||||||
self.box3:setVisible(true)
|
|
||||||
end
|
|
||||||
self:refreshLv()
|
|
||||||
self:refreshCost()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxSellCell:refreshLv()
|
|
||||||
local lv = DataManager.SummonData:getSummonLevel()
|
|
||||||
local exp = DataManager.SummonData:getSummonExp()
|
|
||||||
local maxExp = DataManager.SummonData:getSummonMaxExp()
|
|
||||||
self.progressLv:setText("Lv." .. tostring(lv))
|
|
||||||
if maxExp and maxExp > 0 then
|
|
||||||
self.progressTx:setText(tostring(exp) .. "/" .. tostring(maxExp))
|
|
||||||
self.progressSlider.value = exp / maxExp
|
|
||||||
else
|
|
||||||
self.progressTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_MAX))
|
|
||||||
self.progressSlider.value = 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxSellCell:refreshCost()
|
|
||||||
local costItem1, cost1 = DataManager.SummonData:getSummonCost(GConst.SummonConst.SUMMON_TYPE.LV_1)
|
|
||||||
local costItem2, cost2 = DataManager.SummonData:getSummonCost(GConst.SummonConst.SUMMON_TYPE.LV_2)
|
|
||||||
local costItem3, cost3 = DataManager.SummonData:getSummonCost(GConst.SummonConst.SUMMON_TYPE.LV_3)
|
|
||||||
|
|
||||||
if not cost1 or GFunc.checkCost(costItem1.id, costItem1.num, false) then
|
|
||||||
self.boxBuyBtnCoin1:setSprite(GFunc.getIconRes(costItem1.id))
|
|
||||||
local totalCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_BOX_KEY_LV_1)
|
|
||||||
local totalCountStr = totalCount <= 99 and tostring(totalCount) or "99"
|
|
||||||
self.boxBuyBtnTx1:setText(totalCountStr .. "/" .. tostring(costItem1.num))
|
|
||||||
else
|
|
||||||
self.boxBuyBtnCoin1:setSprite(GFunc.getIconRes(cost1.id))
|
|
||||||
self.boxBuyBtnTx1:setText(cost1.num)
|
|
||||||
end
|
|
||||||
GFunc.centerImgAndTx(self.boxBuyBtnCoin1, self.boxBuyBtnTx1, 5)
|
|
||||||
|
|
||||||
if not cost2 or GFunc.checkCost(costItem2.id, costItem2.num, false) then
|
|
||||||
self.boxBuyBtnCoin2:setSprite(GFunc.getIconRes(costItem2.id))
|
|
||||||
local totalCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_BOX_KEY_LV_2)
|
|
||||||
local totalCountStr = totalCount <= 99 and tostring(totalCount) or "99"
|
|
||||||
self.boxBuyBtnTx2:setText(totalCountStr .. "/" .. tostring(costItem2.num))
|
|
||||||
else
|
|
||||||
self.boxBuyBtnCoin2:setSprite(GFunc.getIconRes(cost2.id))
|
|
||||||
self.boxBuyBtnTx2:setText(cost2.num)
|
|
||||||
end
|
|
||||||
GFunc.centerImgAndTx(self.boxBuyBtnCoin2, self.boxBuyBtnTx2, 5)
|
|
||||||
|
|
||||||
if not cost3 or GFunc.checkCost(costItem3.id, costItem3.num, false) then
|
|
||||||
self.boxBuyBtnCoin3:setSprite(GFunc.getIconRes(costItem3.id))
|
|
||||||
local totalCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_BOX_KEY_LV_3)
|
|
||||||
local totalCountStr = totalCount <= 99 and tostring(totalCount) or "99"
|
|
||||||
self.boxBuyBtnTx3:setText(totalCountStr .. "/" .. tostring(costItem3.num))
|
|
||||||
else
|
|
||||||
self.boxBuyBtnCoin3:setSprite(GFunc.getIconRes(cost3.id))
|
|
||||||
self.boxBuyBtnTx3:setText(cost3.num)
|
|
||||||
end
|
|
||||||
GFunc.centerImgAndTx(self.boxBuyBtnCoin3, self.boxBuyBtnTx3, 5)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxSellCell:onClickBox(summonType)
|
|
||||||
ModuleManager.ShopManager:showBoxHeroUI(summonType)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxSellCell:showHelpTips()
|
|
||||||
ModuleManager.ShopManager:showBoxLevelUI()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxSellCell:getCellHeight()
|
|
||||||
return self.cellHeight
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxSellCell:getIsOpen()
|
|
||||||
return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.STORE_BOX_OPEN, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function BoxSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
return BoxSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: caffbd8418813ca4a9f697470f753dd5
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
138
lua/app/ui/shop/cell/chapter_cell.lua
Normal file → Executable file
138
lua/app/ui/shop/cell/chapter_cell.lua
Normal file → Executable file
@ -1,98 +1,66 @@
|
|||||||
local ChapterCell = class("ChapterCell", BaseCell)
|
local ChapterCell = class("ChapterCell", BaseCell)
|
||||||
local MAX_REWARD_COUNT = 4
|
|
||||||
|
|
||||||
-- 目前礼包样式一致,章节/新手/助力/成长/金币礼包都通用
|
|
||||||
|
|
||||||
function ChapterCell:init()
|
function ChapterCell:init()
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
local uiMap = self:getUIMap()
|
||||||
self.bg = uiMap["gift_cell.bg"]
|
self.txName = uiMap["chapter_cell.tx_name"]
|
||||||
self.bg:setTexture("assets/arts/textures/background/shop/shop_gift_banner_2.png")
|
self.rewardNode = uiMap["chapter_cell.reward_node"]
|
||||||
|
self.rewardNodeLayout = self.rewardNode:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
||||||
self.leftArrow = uiMap["gift_cell.left_arrow"]
|
self.rewardCells = {}
|
||||||
self.rightArrow = uiMap["gift_cell.right_arrow"]
|
for i = 1, 3 do
|
||||||
|
table.insert(self.rewardCells, uiMap["chapter_cell.reward_node.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
|
||||||
self.offImg = uiMap["gift_cell.bg.off_img"]
|
|
||||||
self.offText = uiMap["gift_cell.bg.off_img.text"]
|
|
||||||
|
|
||||||
self.limitImg = uiMap["gift_cell.bg.limit_img"]
|
|
||||||
self.limitText = uiMap["gift_cell.bg.limit_img.text"]
|
|
||||||
|
|
||||||
self.titleText = uiMap["gift_cell.bg.title_text"]
|
|
||||||
|
|
||||||
self.reweardLayout = uiMap["gift_cell.bg.reward_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) -- RefreshLayout()
|
|
||||||
if not self.rewardCellList then
|
|
||||||
self.rewardCellList = {}
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
|
||||||
end
|
end
|
||||||
|
self.costNode = uiMap["chapter_cell.cost"]
|
||||||
|
self.imgCost = uiMap["chapter_cell.cost.img_cost"]
|
||||||
|
self.txCost = uiMap["chapter_cell.cost.tx_cost"]
|
||||||
|
self.tag = uiMap["chapter_cell.tag"]
|
||||||
|
self.txOff = uiMap["chapter_cell.tag.tx_off"]
|
||||||
|
self.btnLeft = uiMap["chapter_cell.btn_left"]
|
||||||
|
self.btnRight = uiMap["chapter_cell.btn_right"]
|
||||||
|
|
||||||
|
self.baseObject:addClickListener(function()
|
||||||
|
-- local cost = DataManager.ShopData:getChapterGiftConfig(self.id).cost
|
||||||
|
-- if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true, BIReport.ITEM_GET_TYPE.SHOP_CHAPTER) then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
-- ModuleManager.ShopManager:reqBuyChapterGift(self.id)
|
||||||
|
PayManager:purchasePackage(self.info.id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
||||||
|
end)
|
||||||
|
self.btnLeft:addClickListener(function()
|
||||||
|
if self.callback then
|
||||||
|
self.callback(1)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
-- 不限时时使用1类型 否则使用2类型
|
self.btnRight:addClickListener(function()
|
||||||
self.priceText = uiMap["gift_cell.bg.price"]
|
if self.callback then
|
||||||
|
self.callback(-1)
|
||||||
self.timeImg = uiMap["gift_cell.bg.time_img"]
|
end
|
||||||
self.timeText = uiMap["gift_cell.bg.time_img.text"]
|
end)
|
||||||
|
|
||||||
self.clickArea = uiMap["gift_cell.bg.click_area"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterCell:refresh(idx, cfgInfo, totalCount, arrowCallback)
|
function ChapterCell:refresh(info, curIdx, maxIdx, callback)
|
||||||
-- 箭头
|
self.info = info
|
||||||
local showLeftArrow = true
|
self.callback = callback
|
||||||
local showRightArrow = true
|
local cfg = DataManager.GiftPopData:getGiftConfig(self.info.id)
|
||||||
if idx == 1 then
|
-- self.baseObject:setSprite(GConst.ATLAS_PATH.UI_SHOP, cfg.atr_resource)
|
||||||
showLeftArrow = false
|
-- self.baseObject:setSprite(GConst.ATLAS_PATH.UI_SHOP, "shop_gift_bg_3")
|
||||||
end
|
self.txName:setText(I18N:getText("act_gift", self.info.id, "value")) -- I18N:getGlobalText(I18N.GlobalConst.MALL_CHAPTER_DESC_1, cfg.parameter))
|
||||||
if idx == totalCount then
|
self.txCost:setText(GFunc.getFormatPrice(cfg.recharge_id))
|
||||||
showRightArrow = false
|
-- GFunc.centerImgAndTx(self.imgCost, self.txCost, 3)
|
||||||
end
|
self.txOff:setText(cfg.value .. "%")
|
||||||
self.leftArrow:setVisible(showLeftArrow)
|
local rewardCount = 0
|
||||||
self.rightArrow:setVisible(showRightArrow)
|
for i, cell in pairs(self.rewardCells) do
|
||||||
|
if cfg.reward and cfg.reward[i] then
|
||||||
self.leftArrow:addClickListener(function()
|
rewardCount = rewardCount + 1
|
||||||
if idx > 1 then
|
cell:setVisible(true)
|
||||||
arrowCallback(1)
|
cell:refreshByConfig(cfg.reward[i])
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.rightArrow:addClickListener(function()
|
|
||||||
if idx < totalCount then
|
|
||||||
arrowCallback(-1)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
-- 超值
|
|
||||||
self.offText:setText(tostring(cfgInfo.value * 100) .. "%")
|
|
||||||
-- 限购
|
|
||||||
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, 1)) -- 限购1次
|
|
||||||
-- 标题
|
|
||||||
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_19, tostring(cfgInfo.chapter))) -- 第{0}章礼包
|
|
||||||
-- 奖励
|
|
||||||
local rewardList = cfgInfo.reward
|
|
||||||
local count = rewardList and #rewardList or 0
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
if i <= count then
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(true)
|
|
||||||
self.rewardCellList[i]:refreshByConfig(rewardList[i])
|
|
||||||
else
|
else
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(false)
|
cell:setVisible(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.reweardLayout:RefreshLayout()
|
self.rewardNode:setSizeDeltaX(rewardCount * 102 + 12)
|
||||||
-- 价格
|
self.rewardNodeLayout:RefreshLayout()
|
||||||
self.priceText:setText(GFunc.getFormatPrice(cfgInfo.recharge_id))
|
self.btnLeft:setActive(maxIdx > 1 and curIdx > 1)
|
||||||
-- 限时(隐藏)
|
self.btnRight:setActive(maxIdx > 1 and curIdx < maxIdx)
|
||||||
self.timeImg:setVisible(false)
|
|
||||||
|
|
||||||
self.clickArea:addClickListener(function()
|
|
||||||
self:onClickGift(cfgInfo.id)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterCell:onClickGift(id)
|
|
||||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.CHAPTER_GIFT)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return ChapterCell
|
return ChapterCell
|
||||||
2
lua/app/ui/shop/cell/chapter_cell.lua.meta
Normal file → Executable file
2
lua/app/ui/shop/cell/chapter_cell.lua.meta
Normal file → Executable file
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 9d83d1e8c37389e4eb88dd51f2fcbde8
|
guid: 1f7095593f1048f4aa16443056a5338e
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@ -1,54 +0,0 @@
|
|||||||
local ChapterSellCell = class("ChapterSellCell", BaseCell)
|
|
||||||
local CHAPTER_CELL = "app/ui/shop/cell/chapter_cell"
|
|
||||||
local BASE_CELL_HEIGHT = 320
|
|
||||||
|
|
||||||
function ChapterSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.scrollRectObj = uiMap["chapter_sell_cell.scroll_rect"]
|
|
||||||
self.contentObj = uiMap["chapter_sell_cell.scroll_rect.viewport.content"]
|
|
||||||
self.scrollRect = self.scrollRectObj:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
|
||||||
self.scrollRect:addInitCallback(function()
|
|
||||||
return CHAPTER_CELL
|
|
||||||
end)
|
|
||||||
self.scrollRect:addRefreshCallback(function(idx, cell)
|
|
||||||
if self.actChapterCfg and self.actChapterCfg[idx] then
|
|
||||||
cell:refresh(idx, self.actChapterCfg[idx], #self.actChapterCfg,
|
|
||||||
function (add)
|
|
||||||
self.contentObj:addAnchoredPosition(add*720)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.scrollRect:clearCells()
|
|
||||||
|
|
||||||
self.cellHeight = BASE_CELL_HEIGHT
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterSellCell:refresh()
|
|
||||||
local actIdList = DataManager.ShopData:getActChapterStoreCanBuyActIds()
|
|
||||||
self.actChapterCfg = {}
|
|
||||||
local actChapterCfg = DataManager.ShopData:getActChapterStoreConfig()
|
|
||||||
for i = 1, #actIdList do
|
|
||||||
local cfgInfo = clone(actChapterCfg[actIdList[i]])
|
|
||||||
cfgInfo.id = actIdList[i]
|
|
||||||
table.insert(self.actChapterCfg, cfgInfo)
|
|
||||||
end
|
|
||||||
local count = #self.actChapterCfg
|
|
||||||
self.scrollRect:refillCells(count)
|
|
||||||
self.contentObj:setAnchoredPositionX(0)
|
|
||||||
self.scrollRect:moveToIndex(count)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterSellCell:getCellHeight()
|
|
||||||
return BASE_CELL_HEIGHT -- 章节礼包横向展开
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterSellCell:getIsOpen()
|
|
||||||
-- 有可购买的礼包 才打开
|
|
||||||
return #DataManager.ShopData:getActChapterStoreCanBuyActIds() > 0
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
return ChapterSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 15313f1ba35cfcd46bb95876a7801283
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,113 +0,0 @@
|
|||||||
local CoinSellCell = class("CoinSellCell", BaseCell)
|
|
||||||
local MAX_REWARD_COUNT = 4
|
|
||||||
local BASE_CELL_HEIGHT = 320
|
|
||||||
|
|
||||||
function CoinSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["gift_cell.bg"]
|
|
||||||
self.bg:setTexture("assets/arts/textures/background/shop/shop_gift_banner_6.png")
|
|
||||||
|
|
||||||
self.leftArrow = uiMap["gift_cell.left_arrow"]
|
|
||||||
self.rightArrow = uiMap["gift_cell.right_arrow"]
|
|
||||||
|
|
||||||
self.offImg = uiMap["gift_cell.bg.off_img"]
|
|
||||||
self.offText = uiMap["gift_cell.bg.off_img.text"]
|
|
||||||
|
|
||||||
self.limitImg = uiMap["gift_cell.bg.limit_img"]
|
|
||||||
self.limitText = uiMap["gift_cell.bg.limit_img.text"]
|
|
||||||
|
|
||||||
self.titleText = uiMap["gift_cell.bg.title_text"]
|
|
||||||
|
|
||||||
self.reweardLayout = uiMap["gift_cell.bg.reward_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) -- RefreshLayout()
|
|
||||||
if not self.rewardCellList then
|
|
||||||
self.rewardCellList = {}
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.priceText = uiMap["gift_cell.bg.price"]
|
|
||||||
|
|
||||||
self.timeImg = uiMap["gift_cell.bg.time_img"]
|
|
||||||
self.timeText = uiMap["gift_cell.bg.time_img.text"]
|
|
||||||
|
|
||||||
self.clickArea = uiMap["gift_cell.bg.click_area"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function CoinSellCell:refresh()
|
|
||||||
local actGiftId = DataManager.ShopData:getValidCoinGiftId()
|
|
||||||
if actGiftId and actGiftId > 0 then
|
|
||||||
self.actGiftId = actGiftId -- 记录当前金币礼包ID
|
|
||||||
local cfgInfo = ConfigManager:getConfig("act_gift")[self.actGiftId]
|
|
||||||
-- 超值
|
|
||||||
self.offText:setText(tostring(cfgInfo.value) .. "%")
|
|
||||||
-- 限购
|
|
||||||
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, tostring(cfgInfo.limit))) -- 限购{0}次
|
|
||||||
-- 标题
|
|
||||||
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_14))
|
|
||||||
-- 奖励
|
|
||||||
local rewardList = cfgInfo.reward
|
|
||||||
local count = rewardList and #rewardList or 0
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
if i <= count then
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(true)
|
|
||||||
self.rewardCellList[i]:refreshByConfig(rewardList[i])
|
|
||||||
else
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.reweardLayout:RefreshLayout()
|
|
||||||
-- 价格
|
|
||||||
self.priceText:setText(GFunc.getFormatPrice(cfgInfo.recharge_id))
|
|
||||||
-- 限时
|
|
||||||
self.timeImg:setVisible(true)
|
|
||||||
self:refreshTime()
|
|
||||||
|
|
||||||
self.clickArea:addClickListener(function()
|
|
||||||
self:onClickGift(self.actGiftId)
|
|
||||||
end)
|
|
||||||
else -- 倒计时结束的情况
|
|
||||||
if self.actGiftId then
|
|
||||||
DataManager.ShopData:setDirty()
|
|
||||||
self.actGiftId = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function CoinSellCell:getCellHeight()
|
|
||||||
return BASE_CELL_HEIGHT -- 固定1个
|
|
||||||
end
|
|
||||||
|
|
||||||
function CoinSellCell:getIsOpen()
|
|
||||||
return DataManager.ShopData:getValidCoinGiftId() ~= nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function CoinSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function CoinSellCell:onClickGift(id)
|
|
||||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
|
||||||
end
|
|
||||||
|
|
||||||
function CoinSellCell:refreshTime()
|
|
||||||
local remainTime = 0
|
|
||||||
if self.actGiftId and self.actGiftId > 0 then
|
|
||||||
local cfgInfo = DataManager.ShopData:getActGiftConfig()[self.actGiftId]
|
|
||||||
local triggerTime = DataManager.ShopData:getCoinGiftTriggerTime()
|
|
||||||
remainTime = triggerTime + (cfgInfo.limit_time or 0) * 3600 - Time:getServerTime()
|
|
||||||
if remainTime <= 0 then
|
|
||||||
remainTime = 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.timeText:setText(Time:formatNumTime(remainTime))
|
|
||||||
end
|
|
||||||
|
|
||||||
function CoinSellCell:getCellCount()
|
|
||||||
if self.actGiftId and self.actGiftId > 0 then
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return CoinSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c3011d7c0a218224a8e6601dd1c992cd
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
245
lua/app/ui/shop/cell/core_soul_cell.lua
Normal file
245
lua/app/ui/shop/cell/core_soul_cell.lua
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
local CoreSoulCell = class("CoreSoulCell", BaseCell)
|
||||||
|
|
||||||
|
local TITLE_TX = {
|
||||||
|
[1] = I18N.GlobalConst.CORE_SUMMON_DESC_1,
|
||||||
|
[2] = I18N.GlobalConst.CORE_SUMMON_DESC_2,
|
||||||
|
}
|
||||||
|
local INFO_TX = {
|
||||||
|
[1] = I18N.GlobalConst.CORE_SUMMON_DESC_3,
|
||||||
|
[2] = I18N.GlobalConst.CORE_SUMMON_DESC_4,
|
||||||
|
}
|
||||||
|
local BIG_REWARD_TX = {
|
||||||
|
[1] = I18N.GlobalConst.CORE_SUMMON_DESC_9,
|
||||||
|
[2] = I18N.GlobalConst.CORE_SUMMON_DESC_10,
|
||||||
|
}
|
||||||
|
local LAST_BIG_REWARD_TX = {
|
||||||
|
[1] = I18N.GlobalConst.CORE_SUMMON_DESC_11,
|
||||||
|
[2] = I18N.GlobalConst.CORE_SUMMON_DESC_12,
|
||||||
|
}
|
||||||
|
|
||||||
|
function CoreSoulCell:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.content = uiMap["core_soul_cell.content"]
|
||||||
|
self.txTitle = uiMap["core_soul_cell.content.tx_title"]
|
||||||
|
self.helpBtn = uiMap["core_soul_cell.content.help_btn"]
|
||||||
|
self.txInfo = uiMap["core_soul_cell.content.tx_info"]
|
||||||
|
self.icon = uiMap["core_soul_cell.content.icon"]
|
||||||
|
self.txTimes = uiMap["core_soul_cell.content.tx_times"]
|
||||||
|
self.itemIcon = uiMap["core_soul_cell.content.item_icon"]
|
||||||
|
self.adBtn = uiMap["core_soul_cell.content.ad_btn"]
|
||||||
|
self.adIcon = uiMap["core_soul_cell.content.ad_btn.ad_icon"]
|
||||||
|
self.adTx = uiMap["core_soul_cell.content.ad_btn.tx"]
|
||||||
|
self.singleBtn = uiMap["core_soul_cell.content.single_btn"]
|
||||||
|
self.singleTitleTx = uiMap["core_soul_cell.content.single_btn.tx_title"]
|
||||||
|
self.singleIcon = uiMap["core_soul_cell.content.single_btn.icon"]
|
||||||
|
self.singleTx = uiMap["core_soul_cell.content.single_btn.tx"]
|
||||||
|
self.multiBtn = uiMap["core_soul_cell.content.multi_btn"]
|
||||||
|
self.multiTitleTx = uiMap["core_soul_cell.content.multi_btn.tx_title"]
|
||||||
|
self.multiIcon = uiMap["core_soul_cell.content.multi_btn.icon"]
|
||||||
|
self.multiTx = uiMap["core_soul_cell.content.multi_btn.tx"]
|
||||||
|
self.multiIcon2 = uiMap["core_soul_cell.content.multi_btn.icon_2"]
|
||||||
|
self.multiTx2 = uiMap["core_soul_cell.content.multi_btn.tx_2"]
|
||||||
|
end
|
||||||
|
function CoreSoulCell:refresh(id)
|
||||||
|
self.id = id
|
||||||
|
if self.id == GConst.ShopConst.CORE_SOUL_TYPE.NORMAL then -- 普通宝箱
|
||||||
|
self.adBtn:addClickListener(function()
|
||||||
|
if DataManager.ShopData:getCoreSoulAdRemainTimes() > 0 then
|
||||||
|
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.AD_CORE_SOUL, function ()
|
||||||
|
ModuleManager.ShopManager:reqBuyCoreSoulBox(self.id, true, 1)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
self.multiBtn:addClickListener(function()
|
||||||
|
local costId = DataManager.ShopData:getCoreSoulCostItemId(self.id)
|
||||||
|
local ownItemCount = DataManager.BagData.ItemData:getItemNumById(costId)
|
||||||
|
local maxItemCount = GConst.ShopConst.CORE_SOUL_NORMAL_MAX_COUNT
|
||||||
|
|
||||||
|
local times = math.min(ownItemCount, maxItemCount)
|
||||||
|
if times > 0 then
|
||||||
|
ModuleManager.ShopManager:reqBuyCoreSoulBox(self.id, false, times)
|
||||||
|
else
|
||||||
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ITEM_NOT_ENOUGH, I18N:getConfig("item")[costId].name))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else -- 史诗宝箱
|
||||||
|
self.singleBtn:addClickListener(function()
|
||||||
|
local costId = DataManager.ShopData:getCoreSoulCostItemId(self.id)
|
||||||
|
local ownItemCount = DataManager.BagData.ItemData:getItemNumById(costId)
|
||||||
|
local ownGem = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GEM)
|
||||||
|
local costGem = DataManager.ShopData:getCoreSoulSingleCostGemNum(self.id)
|
||||||
|
if ownItemCount >= 1 then
|
||||||
|
ModuleManager.ShopManager:reqBuyCoreSoulBox(self.id, false, 1)
|
||||||
|
elseif ownGem >= costGem then
|
||||||
|
local params = {}
|
||||||
|
params.content = I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_13)
|
||||||
|
params.boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL
|
||||||
|
params.showToday = GConst.MESSAGE_BOX_SHOW_TODAY.SHOP_SOUL_SUMMON
|
||||||
|
params.okFunc = function()
|
||||||
|
ModuleManager.ShopManager:reqBuyCoreSoulBox(self.id, false, 1)
|
||||||
|
end
|
||||||
|
GFunc.showMessageBox(params)
|
||||||
|
else
|
||||||
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ITEM_NOT_ENOUGH, I18N:getConfig("item")[GConst.ItemConst.ITEM_ID_GEM].name))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
self.multiBtn:addClickListener(function()
|
||||||
|
local costId = DataManager.ShopData:getCoreSoulCostItemId(self.id)
|
||||||
|
local ownItemCount = DataManager.BagData.ItemData:getItemNumById(costId)
|
||||||
|
local ownGem = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GEM)
|
||||||
|
local costGem = DataManager.ShopData:getCoreSoulSingleCostGemNum(self.id)
|
||||||
|
local totalCount = GConst.ShopConst.CORE_SOUL_ELITE_MULTI_COUNT
|
||||||
|
if ownItemCount >= totalCount then
|
||||||
|
ModuleManager.ShopManager:reqBuyCoreSoulBox(self.id, false, totalCount)
|
||||||
|
elseif ownGem >= costGem * (totalCount - ownItemCount) then
|
||||||
|
local params = {}
|
||||||
|
params.content = I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_13)
|
||||||
|
params.boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL
|
||||||
|
params.showToday = GConst.MESSAGE_BOX_SHOW_TODAY.SHOP_SOUL_SUMMON
|
||||||
|
params.okFunc = function()
|
||||||
|
ModuleManager.ShopManager:reqBuyCoreSoulBox(self.id, false, totalCount)
|
||||||
|
end
|
||||||
|
GFunc.showMessageBox(params)
|
||||||
|
else
|
||||||
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ITEM_NOT_ENOUGH, I18N:getConfig("item")[GConst.ItemConst.ITEM_ID_GEM].name))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- self.content:setSprite(GConst.ATLAS_PATH.UI_SHOP, CONTENT_BG[self.id])
|
||||||
|
self.txTitle:setText(I18N:getGlobalText(TITLE_TX[self.id]))
|
||||||
|
self.helpBtn:addClickListener(function()
|
||||||
|
self:onClickHelpBtn(self.id)
|
||||||
|
end)
|
||||||
|
self.txInfo:setText(I18N:getGlobalText(INFO_TX[self.id]))
|
||||||
|
-- self.icon:setSprite(GConst.ATLAS_PATH.UI_SHOP, CONTENT_BG[self.id])
|
||||||
|
if self.id == 1 then
|
||||||
|
self.itemIcon:setActive(false)
|
||||||
|
local count = DataManager.ShopData:getCoreSoulBigRewardTimes(self.id)
|
||||||
|
self.txTimes:setAnchoredPositionX(0)
|
||||||
|
if count == 1 then
|
||||||
|
self.txTimes:setText(I18N:getGlobalText(LAST_BIG_REWARD_TX[self.id]))
|
||||||
|
else
|
||||||
|
self.txTimes:setText(I18N:getGlobalText(BIG_REWARD_TX[self.id], count))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.itemIcon:setActive(true)
|
||||||
|
self.txTimes:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_15))
|
||||||
|
local txW = self.txTimes:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
|
||||||
|
self.txTimes:setAnchoredPositionX(-15)
|
||||||
|
self.txTimes:setSizeDeltaX(txW)
|
||||||
|
end
|
||||||
|
if self.id == GConst.ShopConst.CORE_SOUL_TYPE.NORMAL then
|
||||||
|
self.adBtn:setActive(true)
|
||||||
|
self.singleBtn:setActive(false)
|
||||||
|
self.multiBtn:setActive(true)
|
||||||
|
-- 普通广告
|
||||||
|
GFunc.setAdsSprite(self.adIcon)
|
||||||
|
-- self.adBtn:setSprite("act_common_btn_blue_1" or "")
|
||||||
|
self.adTx:setText(DataManager.ShopData:getCoreSoulAdRemainTimes() .. "/" .. DataManager.ShopData:getCoreSoulAdMaxTimes())
|
||||||
|
if DataManager.ShopData:getCoreSoulAdRemainTimes() > 0 then
|
||||||
|
self.adBtn:addRedPoint(40, 32, 0.9)
|
||||||
|
else
|
||||||
|
self.adBtn:removeRedPoint()
|
||||||
|
end
|
||||||
|
-- 普通多抽
|
||||||
|
self.multiIcon2:setVisible(false)
|
||||||
|
self.multiTx2:setVisible(false)
|
||||||
|
local costId = DataManager.ShopData:getCoreSoulCostItemId(self.id)
|
||||||
|
local ownItemCount = DataManager.BagData.ItemData:getItemNumById(costId)
|
||||||
|
local maxItemCount = GConst.ShopConst.CORE_SOUL_NORMAL_MAX_COUNT
|
||||||
|
self.multiTitleTx:setText(I18N:getGlobalText(I18N.GlobalConst.CORE_SUMMON_DESC_5, math.min(ownItemCount, maxItemCount)))
|
||||||
|
self.multiIcon:setSprite(GFunc.getIconRes(costId))
|
||||||
|
if ownItemCount <= 0 then -- 没有道具
|
||||||
|
self.multiTx:setText("<color=red>0</color>/1")
|
||||||
|
self.multiBtn:removeRedPoint()
|
||||||
|
elseif ownItemCount <= maxItemCount then -- 有道具且在范围内,直接按当前拥有值消耗
|
||||||
|
self.multiTx:setText(ownItemCount .. "/" .. ownItemCount)
|
||||||
|
self.multiBtn:addRedPoint(60, 32, 0.9)
|
||||||
|
else -- 按最大允许值消耗
|
||||||
|
self.multiTx:setText(ownItemCount .. "/" .. maxItemCount)
|
||||||
|
self.multiBtn:addRedPoint(60, 32, 0.9)
|
||||||
|
end
|
||||||
|
GFunc.centerImgAndTx(self.multiIcon, self.multiTx, 0)
|
||||||
|
else
|
||||||
|
self.adBtn:setActive(false)
|
||||||
|
self.singleBtn:setActive(true)
|
||||||
|
self.multiBtn:setActive(true)
|
||||||
|
|
||||||
|
self.singleTitleTx:setText(I18N:getGlobalText(I18N.GlobalConst.CORE_SUMMON_DESC_7))
|
||||||
|
self.multiTitleTx:setText(I18N:getGlobalText(I18N.GlobalConst.CORE_SUMMON_DESC_8))
|
||||||
|
|
||||||
|
local costId = DataManager.ShopData:getCoreSoulCostItemId(self.id)
|
||||||
|
local ownItemCount = DataManager.BagData.ItemData:getItemNumById(costId)
|
||||||
|
local ownGem = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GEM)
|
||||||
|
-- 史诗单抽
|
||||||
|
if ownItemCount <= 0 then
|
||||||
|
self.singleIcon:setSprite(GFunc.getIconRes(GConst.ItemConst.ITEM_ID_GEM))
|
||||||
|
local costGem = DataManager.ShopData:getCoreSoulSingleCostGemNum(self.id)
|
||||||
|
if ownGem < costGem then
|
||||||
|
self.singleTx:setText("<color=red>" .. costGem .. "</color>")
|
||||||
|
else
|
||||||
|
self.singleTx:setText(costGem)
|
||||||
|
end
|
||||||
|
self.singleBtn:removeRedPoint()
|
||||||
|
else
|
||||||
|
self.singleIcon:setSprite(GFunc.getIconRes(costId))
|
||||||
|
self.singleTx:setText(ownItemCount .. "/1")
|
||||||
|
self.singleBtn:addRedPoint(60, 32, 0.9)
|
||||||
|
end
|
||||||
|
GFunc.centerImgAndTx(self.singleIcon, self.singleTx, 0)
|
||||||
|
-- 史诗多抽
|
||||||
|
if ownItemCount <= 0 then -- 没有道具,全钻石
|
||||||
|
self.multiIcon2:setVisible(false)
|
||||||
|
self.multiTx2:setVisible(false)
|
||||||
|
-- 显示钻石
|
||||||
|
self.multiIcon:setSprite(GFunc.getIconRes(GConst.ItemConst.ITEM_ID_GEM))
|
||||||
|
local costGem = DataManager.ShopData:getCoreSoulMultiCostGemNum(self.id)
|
||||||
|
if ownGem < costGem then
|
||||||
|
self.multiTx:setText("<color=red>" .. costGem .. "</color>")
|
||||||
|
else
|
||||||
|
self.multiTx:setText(costGem)
|
||||||
|
end
|
||||||
|
self.multiBtn:removeRedPoint()
|
||||||
|
GFunc.centerImgAndTx(self.multiIcon, self.multiTx, 0)
|
||||||
|
elseif ownItemCount < GConst.ShopConst.CORE_SOUL_ELITE_MULTI_COUNT then -- 需要和钻石混搭
|
||||||
|
self.multiIcon2:setVisible(true)
|
||||||
|
self.multiTx2:setVisible(true)
|
||||||
|
-- 显示道具
|
||||||
|
self.multiIcon:setSprite(GFunc.getIconRes(costId))
|
||||||
|
self.multiTx:setText(ownItemCount)
|
||||||
|
-- 显示钻石
|
||||||
|
self.multiIcon2:setSprite(GFunc.getIconRes(GConst.ItemConst.ITEM_ID_GEM))
|
||||||
|
local otherCount = GConst.ShopConst.CORE_SOUL_ELITE_MULTI_COUNT - ownItemCount
|
||||||
|
local costGem = DataManager.ShopData:getCoreSoulSingleCostGemNum(self.id) * otherCount
|
||||||
|
if ownGem < costGem then
|
||||||
|
self.multiTx2:setText("<color=red>" .. costGem .. "</color>")
|
||||||
|
else
|
||||||
|
self.multiTx2:setText(costGem)
|
||||||
|
end
|
||||||
|
self.multiBtn:removeRedPoint()
|
||||||
|
GFunc.centerImgAndTxAndImgAndTx(self.multiIcon, self.multiTx, self.multiIcon2, self.multiTx2, 0)
|
||||||
|
else -- 可以道具全抽
|
||||||
|
self.multiIcon2:setVisible(false)
|
||||||
|
self.multiTx2:setVisible(false)
|
||||||
|
|
||||||
|
self.multiIcon:setSprite(GFunc.getIconRes(costId))
|
||||||
|
self.multiTx:setText(ownItemCount .. "/" .. GConst.ShopConst.CORE_SOUL_ELITE_MULTI_COUNT)
|
||||||
|
self.multiBtn:addRedPoint(60, 32, 0.9)
|
||||||
|
GFunc.centerImgAndTx(self.multiIcon, self.multiTx, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function CoreSoulCell:setVisible(visible)
|
||||||
|
self.baseObject:setVisible(visible)
|
||||||
|
end
|
||||||
|
|
||||||
|
function CoreSoulCell:onClickHelpBtn(idx)
|
||||||
|
ModuleManager.TipsManager:showSummonProbabilityTips({
|
||||||
|
cfgName = "summon_core",
|
||||||
|
id = idx
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return CoreSoulCell
|
||||||
10
lua/app/ui/shop/cell/core_soul_cell.lua.meta
Executable file
10
lua/app/ui/shop/cell/core_soul_cell.lua.meta
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0fdbfabcf22c67046973158a7c97c6c0
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
22
lua/app/ui/shop/cell/core_soul_main_cell.lua
Executable file
22
lua/app/ui/shop/cell/core_soul_main_cell.lua
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
local CoreSoulMainCell = class("CoreSoulMainCell", BaseCell)
|
||||||
|
|
||||||
|
function CoreSoulMainCell:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.normalCell = uiMap["core_soul_cell.cell_1"]:addLuaComponent("app/ui/shop/cell/core_soul_cell")
|
||||||
|
self.eliteCell = uiMap["core_soul_cell.cell_2"]:addLuaComponent("app/ui/shop/cell/core_soul_cell")
|
||||||
|
-- self:updateTime()
|
||||||
|
-- self.sid = uiMap["core_soul_cell.cell_1"]:scheduleGlobal(function ()
|
||||||
|
-- self:updateTime()
|
||||||
|
-- end, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function CoreSoulMainCell:updateTime()
|
||||||
|
-- 无需处理
|
||||||
|
end
|
||||||
|
|
||||||
|
function CoreSoulMainCell:refresh()
|
||||||
|
self.normalCell:refresh(GConst.ShopConst.CORE_SOUL_TYPE.NORMAL)
|
||||||
|
self.eliteCell:refresh(GConst.ShopConst.CORE_SOUL_TYPE.ELITE)
|
||||||
|
end
|
||||||
|
|
||||||
|
return CoreSoulMainCell
|
||||||
10
lua/app/ui/shop/cell/core_soul_main_cell.lua.meta
Executable file
10
lua/app/ui/shop/cell/core_soul_main_cell.lua.meta
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 71d0626db99ea3848bbfbc66b2cade41
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
157
lua/app/ui/shop/cell/daily_cell.lua
Executable file
157
lua/app/ui/shop/cell/daily_cell.lua
Executable file
@ -0,0 +1,157 @@
|
|||||||
|
local DailyCell = class("DailyCell", BaseCell)
|
||||||
|
|
||||||
|
function DailyCell:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.content = uiMap["daily_cell.content"]
|
||||||
|
self.txName = uiMap["daily_cell.content.tx_name"]
|
||||||
|
self.rewardCell = uiMap["daily_cell.content.reward_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||||
|
self.txLimit = uiMap["daily_cell.content.tx_limit"]
|
||||||
|
self.costNode = uiMap["daily_cell.content.cost"]
|
||||||
|
self.imgCost = uiMap["daily_cell.content.cost.img_cost"]
|
||||||
|
self.txCost = uiMap["daily_cell.content.cost.tx_cost"]
|
||||||
|
self.tag = uiMap["daily_cell.content.tag"]
|
||||||
|
self.txOff = uiMap["daily_cell.content.tag.tx_off"]
|
||||||
|
self.imgEmpty = uiMap["daily_cell.content.img_empty"]
|
||||||
|
self.txLock = uiMap["daily_cell.content.tx_lock"]
|
||||||
|
end
|
||||||
|
|
||||||
|
function DailyCell:refresh(id)
|
||||||
|
self.id = id
|
||||||
|
|
||||||
|
local reward = DataManager.ShopData:getDailyReward(self.id)
|
||||||
|
if reward then
|
||||||
|
self.rewardCell:refreshByConfig(reward)
|
||||||
|
if reward.type == GConst.REWARD_TYPE_NUM.ITEM then
|
||||||
|
self.txName:setText(I18N:getConfig("item")[reward.id].name)
|
||||||
|
elseif reward.type == GConst.REWARD_TYPE_NUM.EQUIP then
|
||||||
|
self.txName:setText(I18N:getConfig("equip")[reward.id].name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local cfg = DataManager.ShopData:getDailyConfig(self.id)
|
||||||
|
local remainCount = math.max(0, DataManager.ShopData:getDailyRemainCount(self.id))
|
||||||
|
local adCount = cfg.limit_ad or 0
|
||||||
|
local cost = DataManager.ShopData:getDailyCost(self.id)
|
||||||
|
|
||||||
|
self.txLimit:setText(I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_15) .. remainCount)
|
||||||
|
|
||||||
|
if remainCount <= 0 then
|
||||||
|
-- 告罄
|
||||||
|
self.imgEmpty:setActive(true)
|
||||||
|
self.baseObject:setTouchEnable(false)
|
||||||
|
self.baseObject:removeRedPoint()
|
||||||
|
self.imgCost:setActive(false)
|
||||||
|
self.txCost:setText("<color=#FF8F8F>" .. I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_14) .. "</color>")
|
||||||
|
self.txCost:setAnchoredPositionX(0)
|
||||||
|
self.txCost:setSizeDeltaX(150)
|
||||||
|
elseif not cost or cost.num <= 0 then
|
||||||
|
self.imgEmpty:setActive(false)
|
||||||
|
self.baseObject:setTouchEnable(true)
|
||||||
|
if remainCount > adCount then
|
||||||
|
self.baseObject:addRedPoint(84, 118, 1.2)
|
||||||
|
-- 纯免费
|
||||||
|
self.imgCost:setActive(false)
|
||||||
|
self.txCost:setText(I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_12))
|
||||||
|
self.txCost:setAnchoredPositionX(0)
|
||||||
|
else
|
||||||
|
if SDKManager:isAdLoaded() then
|
||||||
|
self.baseObject:addRedPoint(84, 118, 1.2)
|
||||||
|
else
|
||||||
|
self.baseObject:removeRedPoint()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 广告购买
|
||||||
|
self.imgCost:setActive(true)
|
||||||
|
self.imgCost:setSizeDelta(45, 45)
|
||||||
|
GFunc.setAdsSprite(self.imgCost)
|
||||||
|
|
||||||
|
self.txCost:setText("(" .. remainCount .. "/" .. adCount .. ")")
|
||||||
|
GFunc.centerImgAndTx(self.imgCost, self.txCost, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
self.baseObject:addClickListener(function()
|
||||||
|
if remainCount > adCount then -- 纯免费
|
||||||
|
self:onBuy()
|
||||||
|
elseif remainCount > 0 then -- 广告免费
|
||||||
|
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.AD_DAILY_SHOP, function ()
|
||||||
|
self:onBuy()
|
||||||
|
end)
|
||||||
|
else -- 付费
|
||||||
|
self:onBuy()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
-- 道具购买
|
||||||
|
self.imgEmpty:setActive(false)
|
||||||
|
self.baseObject:setTouchEnable(true)
|
||||||
|
self.baseObject:removeRedPoint()
|
||||||
|
|
||||||
|
self.imgCost:setActive(true)
|
||||||
|
self.imgCost:setSizeDelta(60, 60)
|
||||||
|
self.imgCost:setSprite(GFunc.getIconResByReward(cost))
|
||||||
|
self.txCost:setText(GFunc.getRewardNum(cost))
|
||||||
|
GFunc.centerImgAndTx(self.imgCost, self.txCost, 0)
|
||||||
|
|
||||||
|
self.baseObject:addClickListener(function()
|
||||||
|
local remainCount = math.max(0, DataManager.ShopData:getDailyRemainCount(self.id))
|
||||||
|
if remainCount == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true, BIReport.ITEM_GET_TYPE.SHOP_DAILY) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if GFunc.getRewardId(cost) == GConst.ItemConst.ITEM_ID_GEM then
|
||||||
|
local params = {}
|
||||||
|
params.content = I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_13)
|
||||||
|
params.boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL
|
||||||
|
params.showToday = GConst.MESSAGE_BOX_SHOW_TODAY.SHOP_DAILY
|
||||||
|
params.okFunc = function()
|
||||||
|
self:onBuy()
|
||||||
|
end
|
||||||
|
GFunc.showMessageBox(params)
|
||||||
|
else
|
||||||
|
self:onBuy()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
local locked = DataManager.ShopData:getDailyLocked(self.id)
|
||||||
|
if locked then
|
||||||
|
self.baseObject:setTouchEnable(false)
|
||||||
|
self.txLock:setText(locked or "")
|
||||||
|
self.baseObject:removeRedPoint()
|
||||||
|
|
||||||
|
self.txName:setActive(false)
|
||||||
|
self.rewardCell:getBaseObject():setActive(false)
|
||||||
|
self.costNode:setActive(false)
|
||||||
|
self.txLimit:setActive(false)
|
||||||
|
self.tag:setActive(false)
|
||||||
|
else
|
||||||
|
self.baseObject:setTouchEnable(true)
|
||||||
|
self.txLock:setText("")
|
||||||
|
|
||||||
|
self.txName:setActive(true)
|
||||||
|
self.rewardCell:getBaseObject():setActive(true)
|
||||||
|
self.costNode:setActive(true)
|
||||||
|
self.txLimit:setActive(true)
|
||||||
|
|
||||||
|
local idx = DataManager.ShopData:getDailyIdx(self.id)
|
||||||
|
if cfg.value and cfg.value[idx] and cfg.value[idx] ~= 0 then
|
||||||
|
self.tag:setActive(true)
|
||||||
|
self.txOff:setText(cfg.value[idx] .. "%")
|
||||||
|
else
|
||||||
|
self.tag:setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function DailyCell:setVisible(visible)
|
||||||
|
self.baseObject:setVisible(visible)
|
||||||
|
end
|
||||||
|
|
||||||
|
function DailyCell:onBuy()
|
||||||
|
ModuleManager.ShopManager:reqBuyDailyGift(self.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
return DailyCell
|
||||||
10
lua/app/ui/shop/cell/daily_cell.lua.meta
Executable file
10
lua/app/ui/shop/cell/daily_cell.lua.meta
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 73ec34a91376a404c976e0750f083204
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
128
lua/app/ui/shop/cell/daily_main_cell.lua
Executable file
128
lua/app/ui/shop/cell/daily_main_cell.lua
Executable file
@ -0,0 +1,128 @@
|
|||||||
|
local DailyMainCell = class("DailyMainCell", BaseCell)
|
||||||
|
|
||||||
|
function DailyMainCell:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.dailyCells = {}
|
||||||
|
for i = 1, 6 do
|
||||||
|
table.insert(self.dailyCells, uiMap["daily_cell.cell_" .. i]:addLuaComponent("app/ui/shop/cell/daily_cell"))
|
||||||
|
end
|
||||||
|
self.refreshNode = uiMap["daily_cell.refresh_node"]
|
||||||
|
self.txTime = uiMap["daily_cell.refresh_node.tx_time"]
|
||||||
|
-- 广告刷新
|
||||||
|
self.btnRefreshAd = uiMap["daily_cell.refresh_node.btn_refresh_ad"]
|
||||||
|
self.imgAd = uiMap["daily_cell.refresh_node.btn_refresh_ad.img_ad"]
|
||||||
|
self.txAd = uiMap["daily_cell.refresh_node.btn_refresh_ad.tx_ad"]
|
||||||
|
self.txTimeAd = uiMap["daily_cell.refresh_node.btn_refresh_ad.tx_time"]
|
||||||
|
-- 免费刷新/钻石刷新
|
||||||
|
self.btnRefresh = uiMap["daily_cell.refresh_node.btn_refresh"]
|
||||||
|
self.imgCost = uiMap["daily_cell.refresh_node.btn_refresh.img_cost"]
|
||||||
|
self.txCost = uiMap["daily_cell.refresh_node.btn_refresh.tx_cost"]
|
||||||
|
self.txTimeCost = uiMap["daily_cell.refresh_node.btn_refresh.tx_time"]
|
||||||
|
self.txFree = uiMap["daily_cell.refresh_node.btn_refresh.tx_free"]
|
||||||
|
|
||||||
|
self:updateTime()
|
||||||
|
self.sid = self.txTime:scheduleGlobal(function ()
|
||||||
|
self:updateTime()
|
||||||
|
end, 1)
|
||||||
|
|
||||||
|
self.btnRefresh:addClickListener(function()
|
||||||
|
if DataManager.ShopData:getDailyFreeRefreshRemainCount() > 0 then
|
||||||
|
-- 可以免费刷新
|
||||||
|
self:onRefreshDaily(false)
|
||||||
|
elseif DataManager.ShopData:getDailyCostRefreshRemainCount() > 0 then
|
||||||
|
-- 可以道具刷新
|
||||||
|
local cost = DataManager.ShopData:getDailyRefreshCost()
|
||||||
|
if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:onRefreshDaily(false)
|
||||||
|
|
||||||
|
-- local params = {}
|
||||||
|
-- params.content = I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_13)
|
||||||
|
-- params.boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL
|
||||||
|
-- params.showToday = GConst.MESSAGE_BOX_SHOW_TODAY.SHOP_DAILY
|
||||||
|
-- params.okFunc = function()
|
||||||
|
-- self:onRefreshDaily(false)
|
||||||
|
-- end
|
||||||
|
-- GFunc.showMessageBox(params)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
self.btnRefreshAd:addClickListener(function()
|
||||||
|
if DataManager.ShopData:getDailyAdRefreshRemainCount() <= 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.AD_DAILY_SHOP_REFRESH, function()
|
||||||
|
self:onRefreshDaily(true)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function DailyMainCell:updateTime()
|
||||||
|
local remainTime = DataManager.ShopData:getDailyRefreshAutoTime()
|
||||||
|
self.txTime:setText(I18N:getGlobalText(I18N.GlobalConst.MALL_DESC_5, remainTime))
|
||||||
|
if DataManager.ShopData:getDailyAdRefreshRemainCount() <= 0 then
|
||||||
|
self.txTimeAd:setText(remainTime)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function DailyMainCell:refresh()
|
||||||
|
for idx, cell in pairs(self.dailyCells) do
|
||||||
|
cell:refresh(idx)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 广告
|
||||||
|
if DataManager.ShopData:getDailyAdRefreshRemainCount() > 0 then
|
||||||
|
self.btnRefreshAd:setTouchEnable(true)
|
||||||
|
GFunc.setGrey(self.btnRefreshAd:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), false)
|
||||||
|
GFunc.setAdsSprite(self.imgAd, false)
|
||||||
|
self.txTimeAd:setText("(" .. DataManager.ShopData:getDailyAdRefreshRemainCount() .. "/" .. DataManager.ShopData:getDailyRefreshAdCount() .. ")")
|
||||||
|
self.btnRefreshAd:addRedPoint(80, 25, 0.8)
|
||||||
|
else
|
||||||
|
self.btnRefreshAd:setTouchEnable(false)
|
||||||
|
GFunc.setGrey(self.btnRefreshAd:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), true)
|
||||||
|
GFunc.setAdsSprite(self.imgAd, true)
|
||||||
|
self.btnRefreshAd:removeRedPoint()
|
||||||
|
end
|
||||||
|
self.txAd:setText(I18N:getGlobalText(I18N.GlobalConst.REFRESH_DESC_1))
|
||||||
|
GFunc.centerImgAndTx(self.imgAd, self.txAd, 3)
|
||||||
|
|
||||||
|
-- 免费/钻石
|
||||||
|
if DataManager.ShopData:getDailyFreeRefreshRemainCount() > 0 then
|
||||||
|
-- 可以免费刷新
|
||||||
|
self.btnRefresh:setTouchEnable(true)
|
||||||
|
GFunc.setGrey(self.btnRefresh:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), false)
|
||||||
|
self.imgCost:setActive(false)
|
||||||
|
self.txCost:setText(I18N:getGlobalText(I18N.GlobalConst.REFRESH_DESC_2))
|
||||||
|
self.txCost:setAnchoredPositionX(0)
|
||||||
|
self.txTimeCost:setText("(" .. DataManager.ShopData:getDailyFreeRefreshRemainCount() .. "/" .. DataManager.ShopData:getDailyRefreshFreeCount() .. ")")
|
||||||
|
self.txFree:setText("")
|
||||||
|
self.btnRefresh:addRedPoint(80, 25, 0.8)
|
||||||
|
elseif DataManager.ShopData:getDailyCostRefreshRemainCount() > 0 then
|
||||||
|
-- 可以道具刷新
|
||||||
|
self.btnRefresh:setTouchEnable(true)
|
||||||
|
GFunc.setGrey(self.btnRefresh:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), false)
|
||||||
|
local cost = DataManager.ShopData:getDailyRefreshCost()
|
||||||
|
self.imgCost:setActive(true)
|
||||||
|
self.imgCost:setSprite(GFunc.getIconResByReward(cost))
|
||||||
|
self.txCost:setText(GFunc.getRewardNum(cost))
|
||||||
|
GFunc.centerImgAndTx(self.imgCost, self.txCost, 3)
|
||||||
|
self.txTimeCost:setText("(" .. DataManager.ShopData:getDailyCostRefreshRemainCount() .. "/" .. DataManager.ShopData:getDailyRefreshCostCount() .. ")")
|
||||||
|
self.txFree:setText("")
|
||||||
|
self.btnRefresh:removeRedPoint()
|
||||||
|
else
|
||||||
|
-- 没刷新次数
|
||||||
|
self.btnRefresh:setTouchEnable(false)
|
||||||
|
GFunc.setGrey(self.btnRefresh:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), true)
|
||||||
|
self.imgCost:setActive(false)
|
||||||
|
self.txCost:setText("")
|
||||||
|
self.txTimeCost:setText("")
|
||||||
|
self.txFree:setText(I18N:getGlobalText(I18N.GlobalConst.REFRESH_DESC_2))
|
||||||
|
self.btnRefresh:removeRedPoint()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function DailyMainCell:onRefreshDaily(isAd)
|
||||||
|
ModuleManager.ShopManager:reqRefreshDailyGift(isAd)
|
||||||
|
end
|
||||||
|
|
||||||
|
return DailyMainCell
|
||||||
10
lua/app/ui/shop/cell/daily_main_cell.lua.meta
Executable file
10
lua/app/ui/shop/cell/daily_main_cell.lua.meta
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e4c0e9f438df1454c8ebb6da4ec0cf77
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
73
lua/app/ui/shop/cell/force_skin_shop_cell.lua
Executable file
73
lua/app/ui/shop/cell/force_skin_shop_cell.lua
Executable file
@ -0,0 +1,73 @@
|
|||||||
|
local ForceSkinShopCell = class("ForceSkinShopCell", BaseCell)
|
||||||
|
|
||||||
|
function ForceSkinShopCell:init()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
self.imgQlt = uiMap["force_skin_shop_cell.content.img_qlt"]
|
||||||
|
self.imgArt = uiMap["force_skin_shop_cell.content.img_art"]
|
||||||
|
self.nameNode = uiMap["force_skin_shop_cell.content.name"]
|
||||||
|
self.txForceName = uiMap["force_skin_shop_cell.content.name.tx_force_name"]
|
||||||
|
self.txSkinName = uiMap["force_skin_shop_cell.content.name.tx_skin_name"]
|
||||||
|
self.costNode = uiMap["force_skin_shop_cell.cost"]
|
||||||
|
self.imgCost = uiMap["force_skin_shop_cell.cost.img_cost"]
|
||||||
|
self.txCost = uiMap["force_skin_shop_cell.cost.tx_cost"]
|
||||||
|
self.txTips = uiMap["force_skin_shop_cell.tx_tips"]
|
||||||
|
|
||||||
|
self:addClickListener(function()
|
||||||
|
ModuleManager.ForceManager:showForceSkinInfoUI(self.skinId)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ForceSkinShopCell:refresh(skinId)
|
||||||
|
self.skinId = skinId
|
||||||
|
local forceId = DataManager.ForceData:getSkinForceId(self.skinId)
|
||||||
|
local qlt = DataManager.ForceData:getSkinQlt(self.skinId)
|
||||||
|
local unlock = DataManager.ForceData:isSkinUnlock(self.skinId)
|
||||||
|
local getType = DataManager.ForceData:getSkinGetType(self.skinId)
|
||||||
|
local canUnlock = DataManager.ForceData:canUnlockSkin(self.skinId)
|
||||||
|
|
||||||
|
self.imgQlt:setSprite(GConst.ATLAS_PATH.UI_FORCE_SKIN, "skin_force_bg_" .. qlt)
|
||||||
|
-- self.imgArt:setSprite(GConst.ATLAS_PATH.ICON_SKIN_FORCE_SHOP, self.skinId)
|
||||||
|
self.txForceName:setText(DataManager.ForceData:getForceName(forceId))
|
||||||
|
self.txSkinName:setText(DataManager.ForceData:getSkinName(self.skinId))
|
||||||
|
|
||||||
|
if not canUnlock and not unlock then
|
||||||
|
local param = DataManager.ForceData:getSkinGetParam(self.skinId)
|
||||||
|
if getType == GConst.ForceConst.SKIN_GET_TYPE.SHOP then
|
||||||
|
self.costNode:setActive(true)
|
||||||
|
self.imgCost:setActive(false)
|
||||||
|
self.txTips:setText(GConst.EMPTY_STRING)
|
||||||
|
self.txCost:setAnchoredPositionX(0)
|
||||||
|
local giftCfg = ConfigManager:getConfig("act_gift")[param[1]]
|
||||||
|
local price = GFunc.getFormatPrice(giftCfg.recharge_id)
|
||||||
|
self.txCost:setText(price)
|
||||||
|
elseif getType == GConst.ForceConst.SKIN_GET_TYPE.FUNC then
|
||||||
|
self.costNode:setActive(false)
|
||||||
|
local func = param[1]
|
||||||
|
local target = param[2]
|
||||||
|
if func == 1 then
|
||||||
|
self.txTips:setText(DataManager.ForceData:getSkinGetWay(self.skinId), target)
|
||||||
|
else
|
||||||
|
self.txTips:setText(GConst.EMPTY_STRING)
|
||||||
|
end
|
||||||
|
elseif getType == GConst.ForceConst.SKIN_GET_TYPE.ACT then
|
||||||
|
self.costNode:setActive(false)
|
||||||
|
self.txTips:setText(DataManager.ForceData:getSkinGetWay(self.skinId))
|
||||||
|
elseif getType == GConst.ForceConst.SKIN_GET_TYPE.EXCHANGE then
|
||||||
|
self.costNode:setActive(true)
|
||||||
|
self.imgCost:setActive(true)
|
||||||
|
self.txTips:setText(GConst.EMPTY_STRING)
|
||||||
|
local giftCfg = ConfigManager:getConfig("act_gift")[param[1]]
|
||||||
|
local cost = giftCfg.item_cost[1]
|
||||||
|
local id = GFunc.getRewardId(cost)
|
||||||
|
local num = GFunc.getRewardNum(cost)
|
||||||
|
self.imgCost:setSprite(GFunc.getIconRes(id))
|
||||||
|
self.txCost:setText(num)
|
||||||
|
GFunc.centerImgAndTx(self.imgCost, self.txCost, 3)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.costNode:setActive(false)
|
||||||
|
self.txTips:setText("<color=#9CFF75>" .. I18N:getGlobalText(I18N.GlobalConst.SKIN_FORCE_DESC_6) .. "</color>")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return ForceSkinShopCell
|
||||||
10
lua/app/ui/shop/cell/force_skin_shop_cell.lua.meta
Executable file
10
lua/app/ui/shop/cell/force_skin_shop_cell.lua.meta
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8cf3773a5a408624ea6f94ec77d9d32d
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
135
lua/app/ui/shop/cell/gem_cell.lua
Normal file → Executable file
135
lua/app/ui/shop/cell/gem_cell.lua
Normal file → Executable file
@ -1,107 +1,60 @@
|
|||||||
local GemCell = class("GemCell", BaseCell)
|
local GemCell = class("GemCell", BaseCell)
|
||||||
|
|
||||||
function GemCell:init()
|
function GemCell:init()
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
local uiMap = self:getUIMap()
|
||||||
self.bg = uiMap["gem_cell.bg"]
|
self.content = uiMap["gem_cell.content"]
|
||||||
self.icon = uiMap["gem_cell.icon"]
|
self.img = uiMap["gem_cell.content.img"]
|
||||||
self.nameText = uiMap["gem_cell.num"]
|
self.txReward = uiMap["gem_cell.content.tx_reward"]
|
||||||
self.priceText = uiMap["gem_cell.price"]
|
self.txPrice = uiMap["gem_cell.content.tx_price"]
|
||||||
self.doubleNode = uiMap["gem_cell.double_bg"]
|
self.tag = uiMap["gem_cell.content.tag"]
|
||||||
self.doubleDesc = uiMap["gem_cell.double_bg.desc"]
|
self.txDouble = uiMap["gem_cell.content.tag.tx_double"]
|
||||||
self.doubleText = uiMap["gem_cell.double_bg.num"]
|
self.imgIcon = uiMap["gem_cell.content.tag.img_icon"]
|
||||||
self.doubleImg = uiMap["gem_cell.double_bg.icon"]
|
self.txDoubleNum = uiMap["gem_cell.content.tag.tx_num"]
|
||||||
self.doubleOriginText = uiMap["gem_cell.double_bg.origin_num"]
|
|
||||||
self.doubleOriginLine = uiMap["gem_cell.double_bg.line"]
|
|
||||||
self.adNode = uiMap["gem_cell.ad"]
|
|
||||||
self.adImg = uiMap["gem_cell.ad.image"]
|
|
||||||
self.adText = uiMap["gem_cell.ad.desc"]
|
|
||||||
self.sellOutText = uiMap["gem_cell.sell_out"]
|
|
||||||
|
|
||||||
self.sellOutText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_20))
|
self.baseObject:addClickListener(function()
|
||||||
end
|
local isDouble = DataManager.PaymentData:getGemStoreDoubleCount(self.id) > 0
|
||||||
|
local doubleType = ""
|
||||||
function GemCell:refresh(id, cfgInfo)
|
if isDouble then
|
||||||
local rechargeId = cfgInfo.recharge_id
|
doubleType = BIReport.PAY_DOUBLE.DOUBLED
|
||||||
local reward = cfgInfo.reward[1]
|
|
||||||
local limit = cfgInfo.limit or 0
|
|
||||||
local adMaxTimes = cfgInfo.daily or 0
|
|
||||||
local bought = DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.MALL_TREASURE, id)
|
|
||||||
|
|
||||||
local isFree = rechargeId == nil
|
|
||||||
local hasDoubleTimes = bought < limit
|
|
||||||
local leftDoubleTimes = limit - bought
|
|
||||||
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.SHOP, GConst.ShopConst.GEM_ICON_NAME[id])
|
|
||||||
if isFree then -- 免费广告
|
|
||||||
self.adNode:setVisible(true)
|
|
||||||
self.priceText:setVisible(false)
|
|
||||||
self.doubleNode:setVisible(false)
|
|
||||||
|
|
||||||
GFunc.setAdsSprite(self.adImg)
|
|
||||||
local adLeftCount = adMaxTimes - bought
|
|
||||||
if adLeftCount > 0 then
|
|
||||||
self.adText:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE) .. "(" .. tostring(adLeftCount) .. ")") -- 免费(x)
|
|
||||||
GFunc.centerImgAndTx(self.adImg, self.adText, 5)
|
|
||||||
self.sellOutText:setVisible(false)
|
|
||||||
|
|
||||||
self:getBaseObject():addRedPoint(100, 145, 0.6)
|
|
||||||
else
|
else
|
||||||
self.adNode:setVisible(false)
|
doubleType = BIReport.PAY_DOUBLE.NORMAL
|
||||||
self.sellOutText:setVisible(true)
|
|
||||||
|
|
||||||
self:getBaseObject():removeRedPoint()
|
|
||||||
end
|
end
|
||||||
else -- 付费
|
ModuleManager.ShopManager:onBuyGemGift(self.id, doubleType)
|
||||||
self.adNode:setVisible(false)
|
|
||||||
self.priceText:setVisible(true)
|
|
||||||
|
|
||||||
if hasDoubleTimes then -- 有双倍效果
|
|
||||||
self.doubleNode:setVisible(true)
|
|
||||||
self.doubleDesc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_21, tostring(leftDoubleTimes))) -- 剩余次数:{0}
|
|
||||||
self.doubleText:setText("+" .. tostring(reward.num * 2))
|
|
||||||
-- GFunc.centerImgAndTx(self.doubleImg, self.doubleText, 5)
|
|
||||||
self.doubleOriginText:setText(reward.num)
|
|
||||||
self.doubleOriginLine:setVisible(true)
|
|
||||||
|
|
||||||
self.doubleDesc:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO):ForceMeshUpdate()
|
|
||||||
local txW = self.doubleDesc:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).renderedWidth
|
|
||||||
local setWidth = txW + 30
|
|
||||||
local curWidth = self.doubleNode:getSizeDeltaX()
|
|
||||||
if setWidth > curWidth then
|
|
||||||
self.doubleNode:setSizeDeltaX(setWidth)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
self.doubleNode:setVisible(false)
|
|
||||||
self.doubleOriginLine:setVisible(false)
|
|
||||||
end
|
|
||||||
self.sellOutText:setVisible(false)
|
|
||||||
end
|
|
||||||
self.nameText:setText(reward.num)
|
|
||||||
self.priceText:setText(GFunc.getFormatPrice(rechargeId))
|
|
||||||
|
|
||||||
self:addClickListener(function()
|
|
||||||
self:onClickGift(id, isFree)
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GemCell:onClickGift(id, isAd)
|
function GemCell:refresh(id)
|
||||||
if isAd then
|
self.id = id
|
||||||
local cfgInfo = DataManager.ShopData:getMallTreasureConfig()[id]
|
local cfg = DataManager.ShopData:getGemConfig(self.id)
|
||||||
local adMaxTimes = cfgInfo.daily or 0
|
local reward = cfg.reward[1]
|
||||||
local bought = DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.MALL_TREASURE, id)
|
if self.id >= 6 then
|
||||||
local adLeftCount = adMaxTimes - bought
|
self.img:setSprite(GConst.ATLAS_PATH.UI_SHOP, "shop_diamond_6")
|
||||||
if adLeftCount > 0 then
|
|
||||||
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.MALL_TREASURE, function ()
|
|
||||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.MALL_TREASURE)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.MALL_TREASURE)
|
self.img:setSprite(GConst.ATLAS_PATH.UI_SHOP, "shop_diamond_" .. self.id)
|
||||||
|
end
|
||||||
|
self.txReward:setText(GFunc.getRewardNum(reward))
|
||||||
|
local rechargeId = cfg.recharge_id
|
||||||
|
local priceStr = nil
|
||||||
|
if rechargeId and ConfigManager:getConfig("recharge")[rechargeId] then
|
||||||
|
priceStr = GFunc.getFormatPrice(rechargeId)
|
||||||
|
end
|
||||||
|
self.txPrice:setText(priceStr)
|
||||||
|
|
||||||
|
local count = DataManager.PaymentData:getGemStoreDoubleCount(self.id)
|
||||||
|
if count > 0 then
|
||||||
|
self.tag:setActive(true)
|
||||||
|
self.txReward:setAnchoredPositionY(-90)
|
||||||
|
self.txDouble:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_21, count))
|
||||||
|
self.txDoubleNum:setText("+" .. GFunc.getRewardNum(reward))
|
||||||
|
GFunc.centerImgAndTx(self.imgIcon, self.txDoubleNum, 0)
|
||||||
|
else
|
||||||
|
self.tag:setActive(false)
|
||||||
|
self.txReward:setAnchoredPositionY(-50)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GemCell:setVisible(visible)
|
function GemCell:setVisible(visible, scale)
|
||||||
self.baseObject:setVisible(visible)
|
self.baseObject:setVisible(visible, scale)
|
||||||
end
|
end
|
||||||
|
|
||||||
return GemCell
|
return GemCell
|
||||||
2
lua/app/ui/shop/cell/gem_cell.lua.meta
Normal file → Executable file
2
lua/app/ui/shop/cell/gem_cell.lua.meta
Normal file → Executable file
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e0b616e04a175984c89094cf09b2e892
|
guid: f5288d41d8ad3824f9931dd5f28a0f8c
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
18
lua/app/ui/shop/cell/gem_main_cell.lua
Executable file
18
lua/app/ui/shop/cell/gem_main_cell.lua
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
local GemMainCell = class("GemMainCell", BaseCell)
|
||||||
|
|
||||||
|
function GemMainCell:refresh()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
|
||||||
|
local MallTreasureCfg = ConfigManager:getConfig("mall_treasure")
|
||||||
|
for i = 1, 18 do
|
||||||
|
local cell = uiMap["gem_cell.cell_" .. i]:addLuaComponent("app/ui/shop/cell/gem_cell")
|
||||||
|
if MallTreasureCfg[i] then
|
||||||
|
cell:refresh(i)
|
||||||
|
cell:setVisible(true)
|
||||||
|
else
|
||||||
|
cell:setVisible(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return GemMainCell
|
||||||
10
lua/app/ui/shop/cell/gem_main_cell.lua.meta
Executable file
10
lua/app/ui/shop/cell/gem_main_cell.lua.meta
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b59b86dcb675f164ea5d3403e11f6ee4
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -1,61 +0,0 @@
|
|||||||
local GemSellCell = class("GemSellCell", BaseCell)
|
|
||||||
|
|
||||||
function GemSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
local titleTx = uiMap["gem_sell_cell.title_bg.text"]
|
|
||||||
titleTx:setText(ModuleManager.ItemManager:getItemName(GConst.ItemConst.ITEM_ID_GEM))
|
|
||||||
|
|
||||||
self.cells = {}
|
|
||||||
self.cellHeight = 0
|
|
||||||
local cellHeight = nil
|
|
||||||
local cfg = DataManager.ShopData:getMallTreasureConfig() -- 审核模式读取另一张表
|
|
||||||
for i = 1, 19 do -- 正常9个 提审19个
|
|
||||||
local cell = uiMap["gem_sell_cell.cell_" .. i]
|
|
||||||
if cellHeight == nil then
|
|
||||||
local w, h = cell:fastGetSizeDelta()
|
|
||||||
cellHeight = h
|
|
||||||
end
|
|
||||||
local id = i
|
|
||||||
if CS.BF.BFMain.IsShenhe then
|
|
||||||
id = i + 1 -- 配置表结构约定
|
|
||||||
end
|
|
||||||
if cfg[id] then
|
|
||||||
local cellComp = cell:addLuaComponent("app/ui/shop/cell/gem_cell")
|
|
||||||
cell:setVisible(true)
|
|
||||||
table.insert(self.cells, cellComp)
|
|
||||||
else
|
|
||||||
cell:setVisible(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local totalCount = #self.cells
|
|
||||||
if totalCount > 0 then
|
|
||||||
self.cellHeight = self.cellHeight + (20 + cellHeight) * math.ceil(totalCount / 3) + 80
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GemSellCell:refresh()
|
|
||||||
local cfg = DataManager.ShopData:getMallTreasureConfig()
|
|
||||||
for idx, v in ipairs(self.cells) do
|
|
||||||
local id = idx
|
|
||||||
if CS.BF.BFMain.IsShenhe then
|
|
||||||
id = idx + 1 -- 配置表结构约定
|
|
||||||
v:refresh(id, cfg[id])
|
|
||||||
else
|
|
||||||
v:refresh(id, cfg[id])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GemSellCell:getCellHeight()
|
|
||||||
return self.cellHeight
|
|
||||||
end
|
|
||||||
|
|
||||||
function GemSellCell:getIsOpen()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function GemSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
return GemSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 061713e2f54219449b0b87d922acaacf
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
local GiftRewardCell = class("GiftRewardCell", BaseCell)
|
|
||||||
|
|
||||||
function GiftRewardCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["gift_reward_cell.bg"]
|
|
||||||
self.icon = uiMap["gift_reward_cell.icon"]
|
|
||||||
self.fragmenImg = uiMap["gift_reward_cell.fragment"]
|
|
||||||
self.numTx = uiMap["gift_reward_cell.num"]
|
|
||||||
|
|
||||||
self.baseObject:addClickListener(function()
|
|
||||||
if self.clickCallback then
|
|
||||||
self.clickCallback()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GiftRewardCell:refreshByConfig(reward)
|
|
||||||
local id = reward.id
|
|
||||||
local num = reward.num
|
|
||||||
local heroCfgInfo = ConfigManager:getConfig("hero")[id]
|
|
||||||
if heroCfgInfo then
|
|
||||||
local qlt = heroCfgInfo.qlt
|
|
||||||
self.bg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_gift_bg_" .. qlt)
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, tostring(heroCfgInfo.icon))
|
|
||||||
self.fragmenImg:setVisible(true)
|
|
||||||
self.numTx:setText("X" .. tostring(num))
|
|
||||||
else
|
|
||||||
local itemCfgInfo = ConfigManager:getConfig("item")[id]
|
|
||||||
self.bg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_gift_bg")
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, tostring(itemCfgInfo.icon))
|
|
||||||
self.fragmenImg:setVisible(false)
|
|
||||||
self.numTx:setText(num)
|
|
||||||
end
|
|
||||||
self:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.baseObject)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GiftRewardCell:addClickListener(callback)
|
|
||||||
self.clickCallback = callback
|
|
||||||
end
|
|
||||||
|
|
||||||
function GiftRewardCell:setVisible(visible, scale)
|
|
||||||
self.baseObject:setVisible(visible, scale)
|
|
||||||
end
|
|
||||||
|
|
||||||
return GiftRewardCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 88089f781c49b0c4d8a41180459d2f3e
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
156
lua/app/ui/shop/cell/gold_cell.lua
Normal file → Executable file
156
lua/app/ui/shop/cell/gold_cell.lua
Normal file → Executable file
@ -1,102 +1,84 @@
|
|||||||
local GoldCell = class("GoldCell", BaseCell)
|
local GoldCell = class("GoldCell", BaseCell)
|
||||||
|
|
||||||
function GoldCell:init()
|
function GoldCell:init()
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
local uiMap = self:getUIMap()
|
||||||
self.bg = uiMap["gold_cell.bg"]
|
self.content = uiMap["gold_cell.content"]
|
||||||
self.icon = uiMap["gold_cell.icon"]
|
self.img = uiMap["gold_cell.content.img"]
|
||||||
self.nameText = uiMap["gold_cell.num"]
|
self.txReward = uiMap["gold_cell.content.tx_reward"]
|
||||||
self.costNode = uiMap["gold_cell.cost"]
|
self.txDesc = uiMap["gold_cell.content.desc.tx_desc"]
|
||||||
self.costImg = uiMap["gold_cell.cost.icon"]
|
self.costNode = uiMap["gold_cell.content.cost"]
|
||||||
self.costText = uiMap["gold_cell.cost.num"]
|
self.imgCost = uiMap["gold_cell.content.cost.img_cost"]
|
||||||
self.adNode = uiMap["gold_cell.ad"]
|
self.txCost = uiMap["gold_cell.content.cost.tx_cost"]
|
||||||
self.adImg = uiMap["gold_cell.ad.image"]
|
|
||||||
self.adText = uiMap["gold_cell.ad.desc"]
|
|
||||||
self.descText = uiMap["gold_cell.desc"]
|
|
||||||
self.sellOutText = uiMap["gold_cell.sell_out"]
|
|
||||||
|
|
||||||
self.sellOutText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_20)) -- 已购买
|
self.baseObject:addClickListener(function()
|
||||||
end
|
if DataManager.ShopData:getGoldBuyRemainCountByFree(self.id) > 0 then
|
||||||
|
-- 免费
|
||||||
|
ModuleManager.ShopManager:reqBuyGoldGift(self.id)
|
||||||
|
|
||||||
function GoldCell:refresh(id, cfgInfo)
|
elseif DataManager.ShopData:getGoldBuyRemainCountByAd(self.id) > 0 then
|
||||||
local idleTime = cfgInfo.idel_time
|
-- 广告免费
|
||||||
local cost = cfgInfo.cost
|
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.AD_SHOP_GOLD, function ()
|
||||||
local adMaxTimes = cfgInfo.daily or 0
|
ModuleManager.ShopManager:reqBuyGoldGift(self.id)
|
||||||
local goldNum = DataManager.ShopData:getCommonDailyCoinNum(id)
|
|
||||||
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.SHOP, GConst.ShopConst.COIN_ICON_NAME[id])
|
|
||||||
|
|
||||||
local hasDaily = adMaxTimes > 0
|
|
||||||
local adBought = DataManager.ShopData:getCommonDailyCoinAdBuyCount() -- 金币礼包AD购买次数
|
|
||||||
local isAd = hasDaily and adMaxTimes > adBought
|
|
||||||
if isAd then -- 免费广告
|
|
||||||
self.adNode:setVisible(true)
|
|
||||||
self.costNode:setVisible(false)
|
|
||||||
|
|
||||||
GFunc.setAdsSprite(self.adImg)
|
|
||||||
local adLeftCount = adMaxTimes - adBought
|
|
||||||
if adLeftCount > 0 then
|
|
||||||
self.adText:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE) .. "(" .. tostring(adLeftCount) .. ")") -- 免费(x)
|
|
||||||
GFunc.centerImgAndTx(self.adImg, self.adText, 5)
|
|
||||||
self.sellOutText:setVisible(false)
|
|
||||||
|
|
||||||
self:getBaseObject():addRedPoint(100, 145, 0.6)
|
|
||||||
else
|
|
||||||
self.adNode:setVisible(false)
|
|
||||||
self.sellOutText:setVisible(true)
|
|
||||||
|
|
||||||
self:getBaseObject():removeRedPoint()
|
|
||||||
end
|
|
||||||
else -- 付费
|
|
||||||
self.adNode:setVisible(false)
|
|
||||||
self.costNode:setVisible(true)
|
|
||||||
|
|
||||||
self.costText:setText(tostring(cost.num))
|
|
||||||
GFunc.centerImgAndTx(self.costImg, self.costText, 5)
|
|
||||||
self.sellOutText:setVisible(false)
|
|
||||||
|
|
||||||
self:getBaseObject():removeRedPoint()
|
|
||||||
end
|
|
||||||
self.nameText:setText(GFunc.num2Str(goldNum))
|
|
||||||
|
|
||||||
self.descText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_14)) -- 金币礼包
|
|
||||||
|
|
||||||
self:addClickListener(function()
|
|
||||||
self:onClickGift(id, isAd)
|
|
||||||
end)
|
end)
|
||||||
end
|
|
||||||
|
|
||||||
function GoldCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GoldCell:onClickGift(id, isAd)
|
|
||||||
local cfg = DataManager.ShopData:getMallGoldConfig()
|
|
||||||
local cfgInfo = cfg[id]
|
|
||||||
if isAd then
|
|
||||||
local adMaxTimes = cfgInfo and cfgInfo.daily or 0
|
|
||||||
local bought = DataManager.ShopData:getCommonDailyCoinAdBuyCount() -- 金币礼包购买次数
|
|
||||||
local adLeftCount = adMaxTimes - bought
|
|
||||||
if adLeftCount > 0 then
|
|
||||||
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.MALL_GOLD, function ()
|
|
||||||
ModuleManager.ShopManager:buyMallIdleCoin(id, isAd)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
local costs = cfgInfo and cfgInfo.cost or {}
|
-- 付费
|
||||||
if not GFunc.checkCost(costs.id, costs.num, true) then
|
local cost = DataManager.ShopData:getGoldConfig(self.id).cost
|
||||||
|
if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- 二次提示
|
|
||||||
local params = {
|
local params = {}
|
||||||
content = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_33), -- 是否使用钻石刷新每日特惠?
|
params.content = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_33)
|
||||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
params.boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL
|
||||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
params.showToday = GConst.MESSAGE_BOX_SHOW_TODAY.SHOP_GOLD
|
||||||
okFunc = function()
|
params.okFunc = function()
|
||||||
ModuleManager.ShopManager:buyMallIdleCoin(id, isAd)
|
ModuleManager.ShopManager:reqBuyGoldGift(self.id)
|
||||||
end
|
end
|
||||||
}
|
|
||||||
GFunc.showMessageBox(params)
|
GFunc.showMessageBox(params)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function GoldCell:refresh(id)
|
||||||
|
self.id = id
|
||||||
|
local cfg = DataManager.ShopData:getGoldConfig(self.id)
|
||||||
|
local reward = cfg.gold
|
||||||
|
|
||||||
|
self.img:setSprite(GConst.ATLAS_PATH.UI_SHOP, "shop_species_" .. self.id)
|
||||||
|
self.txDesc:setText(I18N:getText("mall_gold", self.id, "name"))
|
||||||
|
self.txReward:setText(GFunc.getRewardNum(reward))
|
||||||
|
|
||||||
|
local totalFreeCount = DataManager.ShopData:getBuyGoldFreeCount(self.id)
|
||||||
|
local remainFreeCount = DataManager.ShopData:getGoldBuyRemainCountByFree(self.id)
|
||||||
|
local totalAdCount = DataManager.ShopData:getBuyGoldAdCount(self.id)
|
||||||
|
local remainAdCount = DataManager.ShopData:getGoldBuyRemainCountByAd(self.id)
|
||||||
|
if remainFreeCount > 0 then
|
||||||
|
-- 免费
|
||||||
|
self.baseObject:addRedPoint(80, 120, 1.2)
|
||||||
|
self.imgCost:setActive(false)
|
||||||
|
self.txCost:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC) .. "(" .. remainFreeCount .. "/" .. totalFreeCount .. ")")
|
||||||
|
self.txCost:setAnchoredPositionX(0)
|
||||||
|
elseif remainAdCount > 0 then
|
||||||
|
-- 广告免费
|
||||||
|
if SDKManager:isAdLoaded() then
|
||||||
|
self.baseObject:addRedPoint(80, 120, 1.2)
|
||||||
|
else
|
||||||
|
self.baseObject:removeRedPoint()
|
||||||
|
end
|
||||||
|
|
||||||
|
self.imgCost:setActive(true)
|
||||||
|
GFunc.setAdsSprite(self.imgCost)
|
||||||
|
self.txCost:setText("(" .. remainAdCount .. "/" .. totalAdCount .. ")")
|
||||||
|
GFunc.centerImgAndTx(self.imgCost, self.txCost, 3)
|
||||||
|
else
|
||||||
|
-- 付费
|
||||||
|
local cost = cfg.cost
|
||||||
|
self.baseObject:removeRedPoint()
|
||||||
|
self.imgCost:setActive(true)
|
||||||
|
self.imgCost:setSprite(GFunc.getIconResByReward(cost))
|
||||||
|
self.txCost:setText(GFunc.getRewardNum(cost))
|
||||||
|
GFunc.centerImgAndTx(self.imgCost, self.txCost, 3)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return GoldCell
|
return GoldCell
|
||||||
2
lua/app/ui/shop/cell/gold_cell.lua.meta
Normal file → Executable file
2
lua/app/ui/shop/cell/gold_cell.lua.meta
Normal file → Executable file
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: a579df8023b985842b736d3e6beba288
|
guid: 24aeee5090b74a54eb80b1161f687743
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
12
lua/app/ui/shop/cell/gold_main_cell.lua
Executable file
12
lua/app/ui/shop/cell/gold_main_cell.lua
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
local GoldMainCell = class("GoldMainCell", BaseCell)
|
||||||
|
|
||||||
|
function GoldMainCell:refresh()
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
|
||||||
|
for i = 1, 3 do
|
||||||
|
local cell = uiMap["gold_cell.cell_" .. i]:addLuaComponent("app/ui/shop/cell/gold_cell")
|
||||||
|
cell:refresh(i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return GoldMainCell
|
||||||
10
lua/app/ui/shop/cell/gold_main_cell.lua.meta
Executable file
10
lua/app/ui/shop/cell/gold_main_cell.lua.meta
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7cc8251bbc63b154f8ccb8e582d25e4c
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -1,51 +0,0 @@
|
|||||||
local GoldSellCell = class("GoldSellCell", BaseCell)
|
|
||||||
|
|
||||||
function GoldSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
local titleTx = uiMap["gold_sell_cell.title_bg.text"]
|
|
||||||
titleTx:setText(ModuleManager.ItemManager:getItemName(GConst.ItemConst.ITEM_ID_GOLD))
|
|
||||||
|
|
||||||
self.cells = {}
|
|
||||||
self.cellHeight = 0
|
|
||||||
local cellHeight = nil
|
|
||||||
local cfg = DataManager.ShopData:getMallGoldConfig()
|
|
||||||
for i = 1, 3 do
|
|
||||||
local cell = uiMap["gold_sell_cell.cell_" .. i]
|
|
||||||
if cellHeight == nil then
|
|
||||||
local w, h = cell:fastGetSizeDelta()
|
|
||||||
cellHeight = h
|
|
||||||
end
|
|
||||||
if cfg[i] then
|
|
||||||
local cellComp = cell:addLuaComponent("app/ui/shop/cell/gold_cell")
|
|
||||||
cell:setVisible(true)
|
|
||||||
table.insert(self.cells, cellComp)
|
|
||||||
else
|
|
||||||
cell:setVisible(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local totalCount = #self.cells
|
|
||||||
if totalCount > 0 then
|
|
||||||
self.cellHeight = self.cellHeight + (20 + cellHeight) * math.ceil(totalCount / 3) + 80
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GoldSellCell:refresh()
|
|
||||||
local cfg = DataManager.ShopData:getMallGoldConfig()
|
|
||||||
for k, v in ipairs(self.cells) do
|
|
||||||
v:refresh(k, cfg[k])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GoldSellCell:getCellHeight()
|
|
||||||
return self.cellHeight
|
|
||||||
end
|
|
||||||
|
|
||||||
function GoldSellCell:getIsOpen()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function GoldSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
return GoldSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 9790bf19c429525488b974b5eb9c2cc2
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
local GrowCell = class("GrowCell", BaseCell)
|
|
||||||
local MAX_REWARD_COUNT = 4
|
|
||||||
|
|
||||||
function GrowCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["gift_cell.bg"]
|
|
||||||
self.bg:setTexture("assets/arts/textures/background/shop/shop_gift_banner_5.png")
|
|
||||||
|
|
||||||
self.leftArrow = uiMap["gift_cell.left_arrow"]
|
|
||||||
self.rightArrow = uiMap["gift_cell.right_arrow"]
|
|
||||||
|
|
||||||
self.offImg = uiMap["gift_cell.bg.off_img"]
|
|
||||||
self.offText = uiMap["gift_cell.bg.off_img.text"]
|
|
||||||
|
|
||||||
self.limitImg = uiMap["gift_cell.bg.limit_img"]
|
|
||||||
self.limitText = uiMap["gift_cell.bg.limit_img.text"]
|
|
||||||
|
|
||||||
self.titleText = uiMap["gift_cell.bg.title_text"]
|
|
||||||
|
|
||||||
self.reweardLayout = uiMap["gift_cell.bg.reward_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) -- RefreshLayout()
|
|
||||||
if not self.rewardCellList then
|
|
||||||
self.rewardCellList = {}
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 不限时时使用1类型 否则使用2类型
|
|
||||||
self.priceText = uiMap["gift_cell.bg.price"]
|
|
||||||
|
|
||||||
self.timeImg = uiMap["gift_cell.bg.time_img"]
|
|
||||||
self.timeText = uiMap["gift_cell.bg.time_img.text"]
|
|
||||||
|
|
||||||
self.clickArea = uiMap["gift_cell.bg.click_area"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowCell:refresh(idx, gift)
|
|
||||||
self.gift = gift
|
|
||||||
self.actId = gift.current_grow_up_id
|
|
||||||
local cfgInfo = DataManager.ShopData:getActGrowUpGiftConfig()[self.actId]
|
|
||||||
-- 超值
|
|
||||||
self.offText:setText(tostring(cfgInfo.value) .. "%")
|
|
||||||
-- 限购
|
|
||||||
if cfgInfo.limit then
|
|
||||||
self.limitImg:setVisible(true)
|
|
||||||
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, tostring(cfgInfo.limit))) -- 限购{0}次
|
|
||||||
else
|
|
||||||
self.limitImg:setVisible(false)
|
|
||||||
end
|
|
||||||
-- 标题
|
|
||||||
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_13)) -- 成长礼包
|
|
||||||
-- 奖励
|
|
||||||
local rewardList = cfgInfo.reward
|
|
||||||
local count = rewardList and #rewardList or 0
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
if i <= count then
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(true)
|
|
||||||
self.rewardCellList[i]:refreshByConfig(rewardList[i])
|
|
||||||
else
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.reweardLayout:RefreshLayout()
|
|
||||||
-- 价格
|
|
||||||
self.priceText:setText(GFunc.getFormatPrice(cfgInfo.recharge_id))
|
|
||||||
-- 限时
|
|
||||||
self.timeImg:setVisible(true)
|
|
||||||
self:refreshTime()
|
|
||||||
|
|
||||||
self.clickArea:addClickListener(function()
|
|
||||||
self:onClickGift(self.actId)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowCell:refreshTime()
|
|
||||||
local remainTime = DataManager.ShopData:getGrowUpGiftRemainTime()
|
|
||||||
if remainTime <= 0 then
|
|
||||||
remainTime = 0
|
|
||||||
end
|
|
||||||
self.timeText:setText(Time:formatNumTime(remainTime))
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowCell:onClickGift(id)
|
|
||||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.GROW_UP_GIFT_NEW)
|
|
||||||
end
|
|
||||||
|
|
||||||
return GrowCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c7dad95a4d35f014fbe29f4d221fd858
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
local GrowSellCell = class("GrowSellCell", BaseCell)
|
|
||||||
local GROW_CELL = "app/ui/shop/cell/grow_cell"
|
|
||||||
local BASE_CELL_HEIGHT = 320
|
|
||||||
|
|
||||||
function GrowSellCell:init()
|
|
||||||
self.actGifts = {}
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.scrollRectObj = uiMap["grow_sell_cell.scroll_rect"]
|
|
||||||
self.contentObj = uiMap["grow_sell_cell.scroll_rect.viewport.content"]
|
|
||||||
self.scrollRect = self.scrollRectObj:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
|
||||||
self.scrollRect:addInitCallback(function()
|
|
||||||
return GROW_CELL
|
|
||||||
end)
|
|
||||||
self.scrollRect:addRefreshCallback(function(idx, cell)
|
|
||||||
if self.actGifts and self.actGifts[idx] then
|
|
||||||
cell:refresh(idx, self.actGifts[idx])
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.scrollRect:clearCells()
|
|
||||||
|
|
||||||
self.cellHeight = BASE_CELL_HEIGHT
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowSellCell:refresh()
|
|
||||||
self.actGifts = {}
|
|
||||||
table.insert(self.actGifts, DataManager.ShopData:getGrowUpGift())
|
|
||||||
self.scrollRect:refillCells(#self.actGifts)
|
|
||||||
|
|
||||||
self:getBaseObject():setSizeDeltaY(self:getCellHeight())
|
|
||||||
self.scrollRectObj:setSizeDeltaY(self:getCellHeight())
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowSellCell:refreshTime()
|
|
||||||
if self.scrollRect then
|
|
||||||
if self.curCellCount ~= #self.actGifts then
|
|
||||||
self.curCellCount = self.actGifts
|
|
||||||
self:refresh()
|
|
||||||
else
|
|
||||||
self.scrollRect:refreshAll()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowSellCell:getCellCount()
|
|
||||||
return self.actGifts and #self.actGifts or 0
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowSellCell:getCellHeight()
|
|
||||||
return BASE_CELL_HEIGHT * self:getCellCount()
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowSellCell:getIsOpen()
|
|
||||||
return DataManager.ShopData:hasGrowUpGift()
|
|
||||||
end
|
|
||||||
|
|
||||||
function GrowSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
return GrowSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3734b11b82b80834393166a49267ea2c
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,119 +0,0 @@
|
|||||||
local HotCell = class("HotCell", BaseCell)
|
|
||||||
|
|
||||||
local AD_REWARD_ICON = {
|
|
||||||
[GConst.ItemConst.ITEM_ID_GOLD] = "shop_species_1",
|
|
||||||
[GConst.ItemConst.ITEM_ID_GEM] = "shop_diamond_1"
|
|
||||||
}
|
|
||||||
|
|
||||||
function HotCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["hot_cell.bg"]
|
|
||||||
self.icon = uiMap["hot_cell.icon"]
|
|
||||||
self.nameText = uiMap["hot_cell.name"]
|
|
||||||
self.adNode = uiMap["hot_cell.ad"]
|
|
||||||
self.adImg = uiMap["hot_cell.ad.image"]
|
|
||||||
self.adText = uiMap["hot_cell.ad.desc"]
|
|
||||||
self.costNode = uiMap["hot_cell.cost"]
|
|
||||||
self.costImg = uiMap["hot_cell.cost.icon"]
|
|
||||||
self.costText = uiMap["hot_cell.cost.num"]
|
|
||||||
self.heroNode = uiMap["hot_cell.hero"]
|
|
||||||
self.heroCell = CellManager:addCellComp(uiMap["hot_cell.hero.hero_cell"], GConst.TYPEOF_LUA_CLASS.HERO_CELL)
|
|
||||||
self.heroNumText = uiMap["hot_cell.hero.num_tx"]
|
|
||||||
self.sellOutText = uiMap["hot_cell.sell_out"]
|
|
||||||
|
|
||||||
self.sellOutText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_20)) -- 已购买
|
|
||||||
end
|
|
||||||
|
|
||||||
function HotCell:refresh(data)
|
|
||||||
self.data = data
|
|
||||||
local id = data.id
|
|
||||||
local index = data.good_index
|
|
||||||
local bought = data.bought
|
|
||||||
local cfgInfo = DataManager.ShopData:getMallDailyConfig()[id]
|
|
||||||
local reward = cfgInfo.good and cfgInfo.good[index]
|
|
||||||
local cost = cfgInfo.cost and cfgInfo.cost[index]
|
|
||||||
|
|
||||||
-- local isHeroReward = id ~= 1 -- 约定
|
|
||||||
local isHeroReward = false
|
|
||||||
local isFree = id == 1 -- 约定
|
|
||||||
|
|
||||||
if isHeroReward then
|
|
||||||
self.icon:setVisible(false)
|
|
||||||
self.heroNode:setVisible(true)
|
|
||||||
|
|
||||||
local heroEntity = DataManager.HeroData:getHeroById(reward.id)
|
|
||||||
if heroEntity then
|
|
||||||
self.heroCell:refresh(heroEntity)
|
|
||||||
else
|
|
||||||
self.heroCell:refreshWithCfgId(reward.id)
|
|
||||||
end
|
|
||||||
self.heroNumText:setText("X" .. tostring(reward.num))
|
|
||||||
self.nameText:setText(ModuleManager.HeroManager:getHeroName(reward.id, false))
|
|
||||||
else
|
|
||||||
self.icon:setVisible(true)
|
|
||||||
self.heroNode:setVisible(false)
|
|
||||||
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.SHOP, AD_REWARD_ICON[reward.id])
|
|
||||||
self.nameText:setText(reward.num)
|
|
||||||
end
|
|
||||||
if isFree then -- (1)广告商品
|
|
||||||
self.adNode:setVisible(true)
|
|
||||||
self.costNode:setVisible(false)
|
|
||||||
|
|
||||||
GFunc.setAdsSprite(self.adImg)
|
|
||||||
local adLeftCount = DataManager.ShopData:getMallDailyFirstItemAdMaxCount() - bought
|
|
||||||
if adLeftCount > 0 then
|
|
||||||
self.adText:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE) .. "(" .. tostring(adLeftCount) .. ")") -- 免费(x)
|
|
||||||
GFunc.centerImgAndTx(self.adImg, self.adText, 5)
|
|
||||||
self.sellOutText:setVisible(false)
|
|
||||||
|
|
||||||
self:getBaseObject():addRedPoint(100, 145, 0.6)
|
|
||||||
else
|
|
||||||
self.adNode:setVisible(false)
|
|
||||||
self.sellOutText:setVisible(true)
|
|
||||||
|
|
||||||
self:getBaseObject():removeRedPoint()
|
|
||||||
end
|
|
||||||
else -- (2,3)金币(4,5,6)钻石商品
|
|
||||||
self.adNode:setVisible(false)
|
|
||||||
self.costNode:setVisible(true)
|
|
||||||
|
|
||||||
local leftCount = DataManager.ShopData:getMallDailyGoodsLimitCount() - bought
|
|
||||||
if leftCount > 0 then
|
|
||||||
self.costImg:setSprite(GFunc.getIconRes(cost.id))
|
|
||||||
self.costText:setText(cost.num)
|
|
||||||
GFunc.centerImgAndTx(self.costImg, self.costText, 5)
|
|
||||||
self.sellOutText:setVisible(false)
|
|
||||||
else
|
|
||||||
self.costNode:setVisible(false)
|
|
||||||
self.sellOutText:setVisible(true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self:addClickListener(function()
|
|
||||||
self:onClickGift(id, isFree)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function HotCell:onClickGift(id, isAd)
|
|
||||||
local bought = self.data.bought
|
|
||||||
if isAd then
|
|
||||||
local adLeftCount = DataManager.ShopData:getMallDailyFirstItemAdMaxCount() - bought
|
|
||||||
if adLeftCount > 0 then
|
|
||||||
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.MALL_DAILY, function ()
|
|
||||||
ModuleManager.ShopManager:buyMallDailyGift(id, isAd)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
local leftCount = DataManager.ShopData:getMallDailyGoodsLimitCount() - bought
|
|
||||||
if leftCount > 0 then
|
|
||||||
ModuleManager.ShopManager:buyMallDailyGift(id, isAd)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function HotCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
return HotCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f0d28230c07310f42b57246a5307c8f1
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,115 +0,0 @@
|
|||||||
local HotSellCell = class("HotSellCell", BaseCell)
|
|
||||||
local HOT_CELL = "app/ui/shop/cell/hot_cell"
|
|
||||||
local CELL_COUNT = 6
|
|
||||||
|
|
||||||
function HotSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.cellHeight = self.baseObject:fastGetSizeDeltaY() + 20
|
|
||||||
|
|
||||||
uiMap["hot_sell_cell.title_bg.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_28)) -- 每日特惠
|
|
||||||
uiMap["hot_sell_cell.help_btn"]:addClickListener(function()
|
|
||||||
ModuleManager.TipsManager:showDescTips(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_29), uiMap["hot_sell_cell.help_btn"])
|
|
||||||
end)
|
|
||||||
self.time1Tx = uiMap["hot_sell_cell.time_icon_1.text"]
|
|
||||||
self.time2Tx = uiMap["hot_sell_cell.time_icon_2.text"]
|
|
||||||
self.time3Tx = uiMap["hot_sell_cell.time_icon_3.text"]
|
|
||||||
self.cells = {}
|
|
||||||
for i = 1, CELL_COUNT do
|
|
||||||
local cellObj = uiMap["hot_sell_cell.cell_" .. i]
|
|
||||||
local cell = cellObj:addLuaComponent(HOT_CELL)
|
|
||||||
table.insert(self.cells, cell)
|
|
||||||
end
|
|
||||||
|
|
||||||
self.refreshBtn = uiMap["hot_sell_cell.refresh_btn"]
|
|
||||||
self.refreshAdImg = uiMap["hot_sell_cell.refresh_btn.ad_img"]
|
|
||||||
self.refreshGemImg = uiMap["hot_sell_cell.refresh_btn.gem_img"]
|
|
||||||
self.refreshText = uiMap["hot_sell_cell.refresh_btn.desc"]
|
|
||||||
|
|
||||||
self.refreshBtn:addClickListener(function()
|
|
||||||
self:onClickRefresh()
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function HotSellCell:refresh()
|
|
||||||
local goods = DataManager.ShopData:getMallDailyGoods()
|
|
||||||
local freeRefreshCount = DataManager.ShopData:getMallDailyAdLeftCount() -- 剩余免费刷新次数
|
|
||||||
local gemRefreshCount = DataManager.ShopData:getMallDailyDiamondLeftCount() -- 剩余钻石刷新次数
|
|
||||||
local gemRefreshCost = DataManager.ShopData:getMallDailyDiamondResetCost() -- 钻石刷新消耗
|
|
||||||
if freeRefreshCount > 0 then
|
|
||||||
self.refreshBtn:setActive(true)
|
|
||||||
self.refreshAdImg:setVisible(true)
|
|
||||||
GFunc.setAdsSprite(self.refreshAdImg)
|
|
||||||
self.refreshGemImg:setVisible(false)
|
|
||||||
self.refreshText:setText(I18N:getGlobalText(I18N.GlobalConst.STR_REFRESH))
|
|
||||||
self.refreshBtn:addRedPoint(80, 30, 0.6)
|
|
||||||
elseif gemRefreshCount > 0 then
|
|
||||||
self.refreshBtn:setActive(true)
|
|
||||||
self.refreshAdImg:setVisible(false)
|
|
||||||
self.refreshGemImg:setVisible(true)
|
|
||||||
self.refreshText:setText(gemRefreshCost)
|
|
||||||
self.refreshBtn:removeRedPoint()
|
|
||||||
else
|
|
||||||
self.refreshBtn:setActive(false)
|
|
||||||
self.refreshBtn:removeRedPoint()
|
|
||||||
end
|
|
||||||
|
|
||||||
local goodsCount = goods and #goods or 0
|
|
||||||
for i = 1, CELL_COUNT do
|
|
||||||
if i <= goodsCount then
|
|
||||||
self.cells[i]:setVisible(true)
|
|
||||||
self.cells[i]:refresh(goods[i])
|
|
||||||
else
|
|
||||||
self.cells[i]:setVisible(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function HotSellCell:refreshTime()
|
|
||||||
local remainTime = Time:getOverOfServerToday() - Time:getServerTime()
|
|
||||||
if remainTime < 0 then
|
|
||||||
remainTime = 0
|
|
||||||
end
|
|
||||||
local h,m,s = GFunc.getTimeWithHMS(remainTime)
|
|
||||||
self.time1Tx:setText(h)
|
|
||||||
self.time2Tx:setText(m)
|
|
||||||
self.time3Tx:setText(s)
|
|
||||||
end
|
|
||||||
|
|
||||||
function HotSellCell:getCellHeight()
|
|
||||||
return self.cellHeight
|
|
||||||
end
|
|
||||||
|
|
||||||
function HotSellCell:getIsOpen()
|
|
||||||
return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL_DAILY, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function HotSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function HotSellCell:onClickRefresh()
|
|
||||||
local freeRefreshCount = DataManager.ShopData:getMallDailyAdLeftCount() -- 免费刷新次数
|
|
||||||
local gemRefreshCount = DataManager.ShopData:getMallDailyDiamondLeftCount() -- 钻石刷新次数
|
|
||||||
local gemRefreshCost = DataManager.ShopData:getMallDailyDiamondResetCost() -- 钻石刷新消耗
|
|
||||||
|
|
||||||
if freeRefreshCount > 0 then
|
|
||||||
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.MALL_DAILY_RESET, function ()
|
|
||||||
ModuleManager.ShopManager:resetMallDailyGift(1)
|
|
||||||
end)
|
|
||||||
elseif gemRefreshCount > 0 then
|
|
||||||
if GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, gemRefreshCost, true) then
|
|
||||||
-- 二次提示
|
|
||||||
local params = {
|
|
||||||
content = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_30), -- 是否使用钻石刷新每日特惠?
|
|
||||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
|
||||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
|
||||||
okFunc = function()
|
|
||||||
ModuleManager.ShopManager:resetMallDailyGift(2)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
GFunc.showMessageBox(params)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return HotSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6438f703cbc963a4980dbe66a3bb9059
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
local LevelCell = class("LevelCell", BaseCell)
|
|
||||||
local MAX_REWARD_COUNT = 4
|
|
||||||
|
|
||||||
function LevelCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["gift_cell.bg"]
|
|
||||||
self.bg:setTexture("assets/arts/textures/background/shop/shop_gift_banner_4.png")
|
|
||||||
|
|
||||||
self.leftArrow = uiMap["gift_cell.left_arrow"]
|
|
||||||
self.rightArrow = uiMap["gift_cell.right_arrow"]
|
|
||||||
|
|
||||||
self.offImg = uiMap["gift_cell.bg.off_img"]
|
|
||||||
self.offText = uiMap["gift_cell.bg.off_img.text"]
|
|
||||||
|
|
||||||
self.limitImg = uiMap["gift_cell.bg.limit_img"]
|
|
||||||
self.limitText = uiMap["gift_cell.bg.limit_img.text"]
|
|
||||||
|
|
||||||
self.titleText = uiMap["gift_cell.bg.title_text"]
|
|
||||||
|
|
||||||
self.reweardLayout = uiMap["gift_cell.bg.reward_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) -- RefreshLayout()
|
|
||||||
if not self.rewardCellList then
|
|
||||||
self.rewardCellList = {}
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 不限时时使用1类型 否则使用2类型
|
|
||||||
self.priceText = uiMap["gift_cell.bg.price"]
|
|
||||||
|
|
||||||
self.timeImg = uiMap["gift_cell.bg.time_img"]
|
|
||||||
self.timeText = uiMap["gift_cell.bg.time_img.text"]
|
|
||||||
|
|
||||||
self.clickArea = uiMap["gift_cell.bg.click_area"]
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelCell:refresh(idx, cfgInfo, clickCallback)
|
|
||||||
-- 超值
|
|
||||||
self.offText:setText(tostring(cfgInfo.value) .. "%")
|
|
||||||
-- 限购
|
|
||||||
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, 1)) -- 限购1次
|
|
||||||
-- 标题
|
|
||||||
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_23, tostring(cfgInfo.parameter))) -- {0}级助力礼包
|
|
||||||
-- 奖励
|
|
||||||
local rewardList = cfgInfo.reward
|
|
||||||
local count = rewardList and #rewardList or 0
|
|
||||||
for i = 1, MAX_REWARD_COUNT do
|
|
||||||
if i <= count then
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(true)
|
|
||||||
self.rewardCellList[i]:refreshByConfig(rewardList[i])
|
|
||||||
else
|
|
||||||
self.rewardCellList[i]:getBaseObject():setActive(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.reweardLayout:RefreshLayout()
|
|
||||||
-- 价格
|
|
||||||
self.priceText:setText(GFunc.getFormatPrice(cfgInfo.recharge_id))
|
|
||||||
-- 限时(隐藏)
|
|
||||||
self.timeImg:setVisible(false)
|
|
||||||
|
|
||||||
self.clickArea:addClickListener(function()
|
|
||||||
self:onClickGift(cfgInfo.id)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelCell:onClickGift(id)
|
|
||||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
|
||||||
end
|
|
||||||
|
|
||||||
return LevelCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 36fbab6ccc9948a4191206a7aa8d8735
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
local LevelSellCell = class("LevelSellCell", BaseCell)
|
|
||||||
local LEVEL_CELL = "app/ui/shop/cell/level_cell"
|
|
||||||
local BASE_CELL_HEIGHT = 320
|
|
||||||
|
|
||||||
function LevelSellCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.scrollRectObj = uiMap["level_sell_cell.scroll_rect"]
|
|
||||||
self.contentObj = uiMap["level_sell_cell.scroll_rect.viewport.content"]
|
|
||||||
self.scrollRect = self.scrollRectObj:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
|
||||||
self.scrollRect:addInitCallback(function()
|
|
||||||
return LEVEL_CELL
|
|
||||||
end)
|
|
||||||
self.scrollRect:addRefreshCallback(function(idx, cell)
|
|
||||||
if self.actGiftCfg and self.actGiftCfg[idx] then
|
|
||||||
cell:refresh(idx, self.actGiftCfg[idx])
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
self.scrollRect:clearCells()
|
|
||||||
|
|
||||||
self.cellHeight = BASE_CELL_HEIGHT
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelSellCell:refresh()
|
|
||||||
local actIds = DataManager.ShopData:getLevelUpGiftActIds()
|
|
||||||
self.actGiftCfg = {}
|
|
||||||
local actGiftCfg = ConfigManager:getConfig("act_gift")
|
|
||||||
for i = 1, #actIds do
|
|
||||||
local cfgInfo = clone(actGiftCfg[actIds[i]])
|
|
||||||
cfgInfo.id = actIds[i]
|
|
||||||
table.insert(self.actGiftCfg, cfgInfo)
|
|
||||||
end
|
|
||||||
self.scrollRect:refillCells(#self.actGiftCfg)
|
|
||||||
|
|
||||||
self:getBaseObject():setSizeDeltaY(self:getCellHeight())
|
|
||||||
self.scrollRectObj:setSizeDeltaY(self:getCellHeight())
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelSellCell:getCellHeight()
|
|
||||||
local cellCount = self.actGiftCfg and #self.actGiftCfg or 0
|
|
||||||
return BASE_CELL_HEIGHT * cellCount
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelSellCell:getIsOpen()
|
|
||||||
return #DataManager.ShopData:getLevelUpGiftActIds() > 0
|
|
||||||
end
|
|
||||||
|
|
||||||
function LevelSellCell:setVisible(visible)
|
|
||||||
self.baseObject:setVisible(visible)
|
|
||||||
end
|
|
||||||
|
|
||||||
return LevelSellCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1da2708abce3d574cb5878bf216d9524
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
local PopHeroCell = class("PopHeroCell", BaseCell)
|
|
||||||
|
|
||||||
function PopHeroCell:init()
|
|
||||||
local uiMap = self.baseObject:genAllChildren()
|
|
||||||
self.bg = uiMap["pop_hero_cell.bg"]
|
|
||||||
self.icon = uiMap["pop_hero_cell.icon"]
|
|
||||||
self.matchImg = uiMap["pop_hero_cell.match_img"]
|
|
||||||
self.progressBg = uiMap["pop_hero_cell.progress_bg"]
|
|
||||||
self.progress = uiMap["pop_hero_cell.progress_bg.progress"]
|
|
||||||
self.progressTx = uiMap["pop_hero_cell.progress_bg.progress_tx"]
|
|
||||||
self.lvUpArrow = uiMap["pop_hero_cell.effect_node.ui_spine_obj"]
|
|
||||||
self.fragmenImg = uiMap["pop_hero_cell.progress_bg.fragment_img"]
|
|
||||||
self.newBg = uiMap["pop_hero_cell.new_bg"]
|
|
||||||
self.newTx = uiMap["pop_hero_cell.new_bg.text"]
|
|
||||||
self.numTx = uiMap["pop_hero_cell.num_tx"]
|
|
||||||
|
|
||||||
self.baseObject:addClickListener(function()
|
|
||||||
if self.clickCallback then
|
|
||||||
self.clickCallback()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function PopHeroCell:refresh(heroEntity, num)
|
|
||||||
local heroInfo = heroEntity:getConfig()
|
|
||||||
self:_refresh(heroInfo)
|
|
||||||
|
|
||||||
local canLvUp = heroEntity:canLvUp()
|
|
||||||
self.lvUpArrow:setVisible(canLvUp)
|
|
||||||
if canLvUp then
|
|
||||||
self.lvUpArrow:playAnim("animation", true, false)
|
|
||||||
end
|
|
||||||
self.fragmenImg:setVisible(not canLvUp)
|
|
||||||
local materials = heroEntity:getLvUpMaterials() or {}
|
|
||||||
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroEntity:getFragmentId())
|
|
||||||
local needFragmentCount = materials[1] or 1
|
|
||||||
self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount)
|
|
||||||
if fragmentCount >= needFragmentCount then
|
|
||||||
self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_1", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER))
|
|
||||||
else
|
|
||||||
self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER))
|
|
||||||
end
|
|
||||||
self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
|
|
||||||
if heroEntity:isUnlock() then
|
|
||||||
self.progressBg:setVisible(not heroEntity:isMaxLv())
|
|
||||||
else
|
|
||||||
if canLvUp then
|
|
||||||
self.progressBg:setVisible(true)
|
|
||||||
else
|
|
||||||
self.progressBg:setVisible(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if heroEntity:isActived() or fragmentCount > 0 then
|
|
||||||
self.newBg:setVisible(false)
|
|
||||||
else
|
|
||||||
self.newBg:setVisible(true)
|
|
||||||
self.newTx:setText("New")
|
|
||||||
end
|
|
||||||
self.numTx:setText("X" .. tostring(num))
|
|
||||||
end
|
|
||||||
|
|
||||||
function PopHeroCell:refreshWithCfgId(id, num)
|
|
||||||
local heroInfo = ConfigManager:getConfig("hero")[id]
|
|
||||||
self:_refresh(heroInfo)
|
|
||||||
local lv = heroInfo.begin_lv
|
|
||||||
local lvInfo = ConfigManager:getConfig("hero_level")[lv]
|
|
||||||
local materials = lvInfo["cost_" .. heroInfo.qlt]
|
|
||||||
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroInfo.item_id)
|
|
||||||
if fragmentCount > 0 then -- 已拥有,则不是NEW了
|
|
||||||
local needFragmentCount = materials[1] or 1
|
|
||||||
self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount)
|
|
||||||
self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
|
|
||||||
self.progressBg:setVisible(true)
|
|
||||||
else
|
|
||||||
self.progressBg:setVisible(false)
|
|
||||||
end
|
|
||||||
self.lvUpArrow:setVisible(false)
|
|
||||||
self.fragmenImg:setVisible(true)
|
|
||||||
|
|
||||||
if fragmentCount > 0 then
|
|
||||||
self.newBg:setVisible(false)
|
|
||||||
else
|
|
||||||
self.newBg:setVisible(true)
|
|
||||||
self.newTx:setText("New")
|
|
||||||
end
|
|
||||||
self.numTx:setText("X" .. tostring(num))
|
|
||||||
end
|
|
||||||
|
|
||||||
function PopHeroCell:_refresh(heroInfo)
|
|
||||||
self.bg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, GConst.FRAME_QLT[heroInfo.qlt])
|
|
||||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, tostring(heroInfo.icon))
|
|
||||||
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position])
|
|
||||||
end
|
|
||||||
|
|
||||||
function PopHeroCell:addClickListener(callback)
|
|
||||||
self.clickCallback = callback
|
|
||||||
end
|
|
||||||
|
|
||||||
function PopHeroCell:setVisible(visible, scale)
|
|
||||||
self.baseObject:setVisible(visible, scale)
|
|
||||||
end
|
|
||||||
|
|
||||||
return PopHeroCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 996bfe193d1cbf048921a6dc5f669192
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user