Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev

# Conflicts:
#	lua/app/common/bi_report.lua
This commit is contained in:
CloudJ 2023-05-22 17:50:24 +08:00
commit 46a2c52ca4
24 changed files with 4443 additions and 119 deletions

View File

@ -73,6 +73,7 @@ BIReport.ITEM_GET_TYPE = {
MALL = "Mall",
MALL_DAILY = "MallDaily", -- 每日特惠
MALL_DAILY_RESET = "MallDailyReset",
PLAYER_LV_UP = "PlayerLvUp",
}
BIReport.ADS_CLICK_TYPE = {

View File

@ -24,6 +24,7 @@ EventManager.CUSTOM_EVENT = {
BOARD_FILL_OVER = "BOARD_FILL_OVER",
LOGIN_REQ_SUCCESS = "LOGIN_REQ_SUCCESS",
DAILY_TASK_ADD_PROGRESS = "DAILY_TASK_ADD_PROGRESS",
BOSS_ENTER_ANI_OVER = "BOSS_ENTER_ANI_OVER",
-- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN",
-- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER"
}

View File

@ -39,6 +39,8 @@ local MODULE_PATHS = {
ShopManager = "app/module/shop/shop_manager",
-- 邮件
MailManager = "app/module/mail/mail_manager",
-- 玩家
PlayerManager = "app/module/player/player_manager",
}
-- 这里的key对应func_open里的id

View File

@ -2,29 +2,29 @@ local act_gold_pig = {
[101]={
["before_id"]=101,
["next_id"]=201,
["battle_diamond"]=120,
["min_diamond"]=360,
["max_diamond"]=720,
["recharge_id"]=3,
["value"]=300
["battle_diamond"]=100,
["min_diamond"]=300,
["max_diamond"]=600,
["recharge_id"]=5,
["value"]=400
},
[201]={
["before_id"]=101,
["next_id"]=301,
["battle_diamond"]=200,
["min_diamond"]=600,
["max_diamond"]=1200,
["recharge_id"]=4,
["value"]=300
["battle_diamond"]=250,
["min_diamond"]=1000,
["max_diamond"]=2000,
["recharge_id"]=10,
["value"]=700
},
[301]={
["before_id"]=201,
["next_id"]=401,
["battle_diamond"]=350,
["min_diamond"]=1400,
["max_diamond"]=2800,
["recharge_id"]=5,
["value"]=300
["battle_diamond"]=300,
["min_diamond"]=1500,
["max_diamond"]=3000,
["recharge_id"]=12,
["value"]=700
},
[401]={
["before_id"]=301,
@ -32,35 +32,35 @@ local act_gold_pig = {
["battle_diamond"]=400,
["min_diamond"]=2000,
["max_diamond"]=4000,
["recharge_id"]=6,
["value"]=300
["recharge_id"]=13,
["value"]=700
},
[501]={
["before_id"]=401,
["next_id"]=601,
["battle_diamond"]=520,
["min_diamond"]=2600,
["max_diamond"]=5200,
["recharge_id"]=7,
["value"]=300
["battle_diamond"]=500,
["min_diamond"]=2500,
["max_diamond"]=5000,
["recharge_id"]=14,
["value"]=700
},
[601]={
["before_id"]=501,
["next_id"]=701,
["battle_diamond"]=680,
["min_diamond"]=3400,
["max_diamond"]=6800,
["recharge_id"]=8,
["value"]=300
["battle_diamond"]=600,
["min_diamond"]=3000,
["max_diamond"]=6000,
["recharge_id"]=15,
["value"]=700
},
[701]={
["before_id"]=601,
["next_id"]=701,
["battle_diamond"]=800,
["min_diamond"]=4000,
["max_diamond"]=8000,
["recharge_id"]=9,
["value"]=300
["battle_diamond"]=1000,
["min_diamond"]=5000,
["max_diamond"]=10000,
["recharge_id"]=16,
["value"]=700
}
}
local config = {

File diff suppressed because it is too large Load Diff

View File

@ -105,13 +105,13 @@ local const = {
["value"]=57600
},
["idle_exp_drop_time"]={
["value"]=30
["value"]=1200
},
["idle_gold_drop_time"]={
["value"]=30
["value"]=1200
},
["idle_item_drop_time"]={
["value"]=4320
["value"]=1200
},
["idle_drop_fast_times_1"]={
["value"]=2
@ -128,8 +128,8 @@ local const = {
["type_for_nothing"]="Vw==",
["id"]=3,
["id_for_nothing"]="VQ==",
["num"]=20,
["num_for_nothing"]="VAg="
["num"]=30,
["num_for_nothing"]="VQg="
}
},
["refresh_skill_cost"]={

View File

@ -1,7 +1,5 @@
local LocalizationGlobalConst =
{
BATTLE_DESC_9 = "BATTLE_DESC_9",
BATTLE_DESC_10 = "BATTLE_DESC_10",
MAIN_BTN_1 = "MAIN_BTN_1",
QLT_DESC_1 = "QLT_DESC_1",
QLT_DESC_2 = "QLT_DESC_2",
@ -118,7 +116,8 @@ local LocalizationGlobalConst =
BTN_DELETE_ALL_READ_MAIL = "BTN_DELETE_ALL_READ_MAIL",
BTN_CLAIM_ALL = "BTN_CLAIM_ALL",
BTN_READ = "BTN_READ",
MAIL_COUNTDOWN = "MAIL_COUNTDOWN",
BATTLE_DESC_9 = "BATTLE_DESC_9",
BATTLE_DESC_10 = "BATTLE_DESC_10",
}
return LocalizationGlobalConst

View File

@ -1,6 +1,7 @@
local skill_rogue = {
[1]={
["universal"]=1,
["toast_mark"]=1,
["limit_times"]=3,
["weight"]=3000,
["qlt"]=2,
@ -15,6 +16,7 @@ local skill_rogue = {
},
[2]={
["universal"]=1,
["toast_mark"]=1,
["limit_times"]=2,
["weight"]=2000,
["qlt"]=3,
@ -29,6 +31,7 @@ local skill_rogue = {
},
[3]={
["universal"]=1,
["toast_mark"]=1,
["limit_times"]=1,
["weight"]=1000,
["qlt"]=4,
@ -43,6 +46,7 @@ local skill_rogue = {
},
[4]={
["universal"]=1,
["toast_mark"]=2,
["limit_times"]=4,
["weight"]=3000,
["qlt"]=2,
@ -57,6 +61,7 @@ local skill_rogue = {
},
[5]={
["universal"]=1,
["toast_mark"]=2,
["limit_times"]=3,
["weight"]=3000,
["qlt"]=3,
@ -71,6 +76,7 @@ local skill_rogue = {
},
[6]={
["universal"]=1,
["toast_mark"]=2,
["limit_times"]=2,
["weight"]=2000,
["qlt"]=3,
@ -85,6 +91,7 @@ local skill_rogue = {
},
[7]={
["universal"]=1,
["toast_mark"]=3,
["limit_times"]=4,
["weight"]=3000,
["qlt"]=2,
@ -99,6 +106,7 @@ local skill_rogue = {
},
[8]={
["universal"]=1,
["toast_mark"]=3,
["limit_times"]=3,
["weight"]=3000,
["qlt"]=3,
@ -113,6 +121,7 @@ local skill_rogue = {
},
[9]={
["universal"]=1,
["toast_mark"]=3,
["limit_times"]=2,
["weight"]=2000,
["qlt"]=3,
@ -127,6 +136,7 @@ local skill_rogue = {
},
[10]={
["universal"]=1,
["toast_mark"]=4,
["limit_times"]=4,
["weight"]=3000,
["qlt"]=2,
@ -141,6 +151,7 @@ local skill_rogue = {
},
[11]={
["universal"]=1,
["toast_mark"]=4,
["limit_times"]=3,
["weight"]=3000,
["qlt"]=3,
@ -155,6 +166,7 @@ local skill_rogue = {
},
[12]={
["universal"]=1,
["toast_mark"]=4,
["limit_times"]=2,
["weight"]=2000,
["qlt"]=3,
@ -169,6 +181,7 @@ local skill_rogue = {
},
[13]={
["universal"]=1,
["toast_mark"]=5,
["limit_times"]=4,
["weight"]=3000,
["qlt"]=2,
@ -183,6 +196,7 @@ local skill_rogue = {
},
[14]={
["universal"]=1,
["toast_mark"]=5,
["limit_times"]=3,
["weight"]=3000,
["qlt"]=3,
@ -197,6 +211,7 @@ local skill_rogue = {
},
[15]={
["universal"]=1,
["toast_mark"]=5,
["limit_times"]=2,
["weight"]=2000,
["qlt"]=3,
@ -211,6 +226,7 @@ local skill_rogue = {
},
[16]={
["universal"]=1,
["toast_mark"]=6,
["limit_times"]=4,
["weight"]=3000,
["qlt"]=2,
@ -225,6 +241,7 @@ local skill_rogue = {
},
[17]={
["universal"]=1,
["toast_mark"]=6,
["limit_times"]=3,
["weight"]=3000,
["qlt"]=3,
@ -239,6 +256,7 @@ local skill_rogue = {
},
[18]={
["universal"]=1,
["toast_mark"]=6,
["limit_times"]=2,
["weight"]=2000,
["qlt"]=3,
@ -270,6 +288,7 @@ local skill_rogue = {
},
[20]={
["universal"]=1,
["toast_mark"]=7,
["limit_times"]=4,
["weight"]=3000,
["qlt"]=2,
@ -284,6 +303,7 @@ local skill_rogue = {
},
[21]={
["universal"]=1,
["toast_mark"]=8,
["limit_times"]=3,
["weight"]=3000,
["qlt"]=2,
@ -298,6 +318,7 @@ local skill_rogue = {
},
[22]={
["universal"]=1,
["toast_mark"]=8,
["limit_times"]=2,
["weight"]=2000,
["qlt"]=3,
@ -312,6 +333,7 @@ local skill_rogue = {
},
[23]={
["universal"]=1,
["toast_mark"]=8,
["limit_times"]=1,
["weight"]=1000,
["qlt"]=4,
@ -326,6 +348,7 @@ local skill_rogue = {
},
[24]={
["universal"]=1,
["toast_mark"]=9,
["limit_times"]=2,
["weight"]=2000,
["qlt"]=3,
@ -343,6 +366,7 @@ local skill_rogue = {
},
[25]={
["universal"]=1,
["toast_mark"]=10,
["limit_times"]=3,
["weight"]=3000,
["qlt"]=3,
@ -357,6 +381,7 @@ local skill_rogue = {
},
[26]={
["universal"]=1,
["toast_mark"]=11,
["limit_times"]=3,
["weight"]=2000,
["qlt"]=3,
@ -371,6 +396,7 @@ local skill_rogue = {
},
[27]={
["universal"]=1,
["toast_mark"]=12,
["limit_times"]=3,
["weight"]=2000,
["qlt"]=3,
@ -385,6 +411,7 @@ local skill_rogue = {
},
[28]={
["universal"]=1,
["toast_mark"]=13,
["limit_times"]=3,
["weight"]=2000,
["qlt"]=3,

View File

@ -116,7 +116,8 @@ local localization_global =
["BTN_DELETE_ALL_READ_MAIL"] = "删除已读邮件",
["BTN_CLAIM_ALL"] = "领取所有",
["BTN_READ"] = "读取",
["MAIL_COUNTDOWN"] = "{0}小时到期",
["BATTLE_DESC_9"] = "{0}攻击力:<color=#ffffff>{1}</color>",
["BATTLE_DESC_10"] = "已激活效果",
}
return localization_global

View File

@ -258,19 +258,19 @@ function BattleController:clearBuff(side)
self.battleUI:clearBuff(side)
end
function BattleController:showBuffTips(side)
function BattleController:showBuffTips(side, autoClose)
if side == BattleConst.SIDE_ATK then
local buffList = self.atkTeam:getBuffList()
if #buffList <= 0 then
return
end
self.battleUI:showLeftBuffTips(buffList)
self.battleUI:showLeftBuffTips(buffList, autoClose)
else
local buffList = self.defTeam:getBuffList()
if #buffList <= 0 then
return
end
self.battleUI:showRightBuffTips(buffList)
self.battleUI:showRightBuffTips(buffList, autoClose)
end
end
@ -450,6 +450,9 @@ function BattleController:enterNextWave()
self.eliminateCount = 0
self.isBossWave = self.defTeam:getMainUnit().unitEntity:getIsBoss()
if self.isBossWave then
self:showBuffTips(BattleConst.SIDE_DEF, true)
end
self:postFightStart()
self:enterRoundBegin()
end
@ -1737,6 +1740,8 @@ function BattleController:onSelectSkill(skillId, value, pos)
end
self:selectSKillNextToStep()
self.battleUI:showCommonSkillTips(skillId)
end
function BattleController:selectSKillNextToStep()

View File

@ -78,7 +78,8 @@ function HeroManager:getSkillRogueDesc(skillId, value)
end
function HeroManager:showValueRogue(skillId)
if (skillId >= 1 and skillId <= 18) or (skillId >= 21 and skillId <= 23) then
local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
if cfg and cfg.toast_mark then
return true
end

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 98178fc3bab492b46975a763c42497c9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
local PlayerManager = class("PlayerManager", BaseModule)
function PlayerManager:showPlayerUpUI(currLv, rewards)
local params = {
fromLevel = currLv,
rewards = rewards,
}
UIManager:showUI("app/ui/player/player_level_up_ui", params)
end
function PlayerManager:levelUp()
self:sendMessage(ProtoMsgType.FromMsgEnum.LevelUpReq, {}, {}, self.onLevelUpFinish, BIReport.ITEM_GET_TYPE.PLAYER_LV_UP)
end
function PlayerManager:onLevelUpFinish(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then
local currLv = DataManager.PlayerData:getLv()
DataManager.PlayerData:setLv(result.level, result.exp)
self:showPlayerUpUI(currLv, result.rewards)
end
end
return PlayerManager

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2f013f123922ef74294a3dc5ea3784a4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -21,7 +21,7 @@ function BaseUI:getPreLoadList()
end
function BaseUI:showCommonBG()
return true
return false
end
-- 界面prefab路径

View File

@ -64,6 +64,7 @@ function BattleUI:_display()
self:initSkillLineSfx()
self:initGenerateSkillEffect()
self:initSelectSkillNode()
self:initCommonSkillDescTips()
end
function BattleUI:_addListeners()
@ -192,6 +193,10 @@ function BattleUI:initBuff()
self.battleBuffTipsRoot:setLocalScale(0, 0, 0)
local battleBuffTipsMask = self.uiMap["battle_ui.battle_buff_tips.mask"]
battleBuffTipsMask:addClickListener(function()
if self.autoCloseBuffSid then
self:unscheduleGlobal(self.autoCloseBuffSid)
self.autoCloseBuffSid = nil
end
self.battleBuffTipsRoot:setLocalScale(0, 0, 0)
end)
self.battleBuffTipsBg = self.uiMap["battle_ui.battle_buff_tips.bg"]
@ -283,23 +288,23 @@ function BattleUI:clearBuff(side)
end
end
function BattleUI:showLeftBuffTips(buffList)
function BattleUI:showLeftBuffTips(buffList, autoClose)
local x = self.battleBuffTipsBg:fastGetAnchoredPosition()
if x > 0 then
self.battleBuffTipsBg:setAnchoredPositionX(-x)
end
self:showBuffTips(buffList)
self:showBuffTips(buffList, autoClose)
end
function BattleUI:showRightBuffTips(buffList)
function BattleUI:showRightBuffTips(buffList, autoClose)
local x = self.battleBuffTipsBg:fastGetAnchoredPosition()
if x < 0 then
self.battleBuffTipsBg:setAnchoredPositionX(-x)
end
self:showBuffTips(buffList)
self:showBuffTips(buffList, autoClose)
end
function BattleUI:showBuffTips(buffList)
function BattleUI:showBuffTips(buffList, autoClose)
if #buffList <= 0 then
return
end
@ -338,6 +343,17 @@ function BattleUI:showBuffTips(buffList)
self.battleBuffTipsBuffList[i]:setLocalScale(0, 0, 0)
end
self.battleBuffTipsBg:setSizeDeltaY(addY + 10)
if self.autoCloseBuffSid then
self:unscheduleGlobal(self.autoCloseBuffSid)
self.autoCloseBuffSid = nil
end
if autoClose then
self.autoCloseBuffSid = self:performWithDelayGlobal(function()
self.battleBuffTipsRoot:setLocalScale(0, 0, 0)
end, 1.5)
end
end
function BattleUI:getBattleBuffTipsObj(index)
@ -1924,6 +1940,47 @@ function BattleUI:hideAllBoardSfxs()
end
end
function BattleUI:initCommonSkillDescTips()
local uiMap = self.root:genAllChildren()
self.skillDescTipsNode = uiMap["battle_ui.bg_2.lv_node.skill_desc_tips"]
self.skillDescTips = uiMap["battle_ui.bg_2.lv_node.skill_desc_tips.desc"]
self.skillDescTipsNode:setVisible(false)
end
function BattleUI:showCommonSkillTips(skillId)
-- 需要合并显示
local rogueCfg = ConfigManager:getConfig("skill_rogue")
local curCfg = rogueCfg[skillId]
if not curCfg or curCfg.universal ~= 1 then
return
end
local value = 0
local selectSkillMap = DataManager.BattleData:getSelectSkillMap()
if selectSkillMap[skillId] then
value = selectSkillMap[skillId].value
end
if curCfg.toast_mark then
for id, info in pairs(rogueCfg) do
if selectSkillMap[id] and id ~= skillId and info.toast_mark == curCfg.toast_mark then
value = value + selectSkillMap[id].value
end
end
end
if self.showCommonSkillTipsSid then
self:unscheduleGlobal(self.showCommonSkillTipsSid)
self.showCommonSkillTipsSid = nil
end
self.skillDescTipsNode:setVisible(true)
self.skillDescTips:setText(ModuleManager.HeroManager:getSkillRogueDesc(skillId, value))
self.showCommonSkillTipsSid = self:performWithDelayGlobal(function()
self.skillDescTipsNode:setVisible(false)
end, 1.5)
end
function BattleUI:clear()
if self.alreadyClear then
return
@ -2019,6 +2076,16 @@ function BattleUI:clear()
self.monsterSkillAniSeq:Kill()
self.monsterSkillAniSeq = nil
end
if self.showCommonSkillTipsSid then
self:unscheduleGlobal(self.showCommonSkillTipsSid)
self.showCommonSkillTipsSid = nil
end
if self.autoCloseBuffSid then
self:unscheduleGlobal(self.autoCloseBuffSid)
self.autoCloseBuffSid = nil
end
end
return BattleUI

View File

@ -31,6 +31,10 @@ function IdleDropUI:onReshow()
if self.cdSid then
self:resumeScheduleGlobal(self.cdSid)
end
-- 检查是否升级
if DataManager.PlayerData:getIfCanLevelUp() then
ModuleManager.PlayerManager:levelUp()
end
end
function IdleDropUI:onClose()

View File

@ -36,6 +36,13 @@ function IdleQuickDropUI:ctor()
end
end
function IdleQuickDropUI:onReshow()
-- 检查是否升级
if DataManager.PlayerData:getIfCanLevelUp() then
ModuleManager.PlayerManager:levelUp()
end
end
function IdleQuickDropUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
self.uiMap = uiMap

View File

@ -99,8 +99,8 @@ function MainComp:refreshChapter(force)
local mysteryBoxIcon = self.uiMap["main_comp.chapter.img.mystery_box_icon"]
mysteryBoxIcon:setVisible(mysteryBoxCount > 0)
if mysteryBoxCount > 0 then
local remainCount = math.max(mysteryBoxCount - DataManager.ChapterData:getChapterMysteryBoxGotCount(chapterId), 0)
self.uiMap["main_comp.chapter.img.mystery_box_icon.desc"]:setText(remainCount .. "/" .. mysteryBoxCount)
local gotCount = DataManager.ChapterData:getChapterMysteryBoxGotCount(chapterId)
self.uiMap["main_comp.chapter.img.mystery_box_icon.desc"]:setText(gotCount .. "/" .. mysteryBoxCount)
end
local rewardChapterId = DataManager.ChapterData:getIsHaveRewardsMinId()

View File

@ -110,9 +110,6 @@ function MainCityUI:_display()
end
function MainCityUI:_addListeners()
self:addEventListener(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP, function()
self:checkMainPop()
end)
end
function MainCityUI:_bind()
@ -126,9 +123,6 @@ function MainCityUI:_bind()
self:bind(DataManager.PlayerData, "dirty", function(binder, value)
self:refreshPlayerInfo()
end, true)
self:bind(DataManager.PlayerData, "lvUpDirty", function(binder, value)
self:checkMainPop()
end)
self:bind(DataManager.FormationData, "dirty", function(binder, value)
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then
self.subComps[self.selectedIndex]:refresh()
@ -687,6 +681,12 @@ function MainCityUI:refreshSettingBtn()
end
function MainCityUI:checkMainPop()
-- 检查是否升级
if DataManager.PlayerData:getIfCanLevelUp() then
ModuleManager.PlayerManager:levelUp()
return
end
-- 引导
if self:checkTutorial() then
return

8
lua/app/ui/player.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 60f05ec49fd1e1544b596ad1fb4cd483
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,86 @@
local PlayerLevelUpUI = class("PlayerLevelUpUI", BaseUI)
local CELL_WIDTH = 114.8
function PlayerLevelUpUI:isFullScreen()
return false
end
function PlayerLevelUpUI:getPrefabPath()
return "assets/prefabs/ui/player/player_level_up_ui.prefab"
end
function PlayerLevelUpUI:ctor(params)
params = params or GConst.EMPTY_TABLE
self.fromLevel = params.fromLevel
self.rewards = params.rewards or GConst.EMPTY_TABLE
end
function PlayerLevelUpUI:onLoadRootComplete()
self:_display()
end
function PlayerLevelUpUI:_display()
local uiMap = self.root:genAllChildren()
self.uiMap = uiMap
uiMap["player_level_up_ui.bg"]:addClickListener(function()
self:closeUI()
end)
local toLevel = DataManager.PlayerData:getLv()
uiMap["player_level_up_ui.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.PLAYER_LEVEL_UP_DESC, toLevel))
uiMap["player_level_up_ui.reward_title"]:setText(I18N:getGlobalText(I18N.GlobalConst.LEVEL_UP_REWARD))
uiMap["player_level_up_ui.continue"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE))
uiMap["player_level_up_ui.lv_img_l.text"]:setText(tostring(self.fromLevel))
uiMap["player_level_up_ui.lv_img_r.text"]:setText(tostring(toLevel))
local width = uiMap["player_level_up_ui.reward_title"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
uiMap["player_level_up_ui.r"]:setAnchoredPositionX(width/2 + 40)
uiMap["player_level_up_ui.l"]:setAnchoredPositionX(-width/2 - 40)
self:refreshRewards()
end
function PlayerLevelUpUI:refreshRewards()
if self.scrollRectComp then
self.scrollRectComp:updateAllCell()
return
end
local uiMap = self.root:genAllChildren()
local scrollRect = uiMap["player_level_up_ui.scroll_rect"]
self.scrollRectComp = scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRectComp:addInitCallback(function()
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
end)
self.scrollRectComp:addRefreshCallback(function(index, cell)
cell:refresh(self.rewards[index])
end)
self.scrollRectComp:setFadeArgs(0.05, 0.3)
self.scrollRectComp:clearCells()
local rewardCount = #self.rewards
if rewardCount > 10 then
local comp = scrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT)
comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Elastic
self.scrollRectComp:setPerLineNum(5)
scrollRect:setSizeDeltaX(560)
else
local comp = scrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT)
comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Clamped
if rewardCount >= 5 then
self.scrollRectComp:setPerLineNum(5)
scrollRect:setSizeDeltaX(560)
elseif rewardCount <= 0 then
self.scrollRectComp:setPerLineNum(1)
scrollRect:setSizeDeltaX(560)
else
self.scrollRectComp:setPerLineNum(rewardCount)
scrollRect:setSizeDeltaX(112*rewardCount)
end
end
self.scrollRectComp:refillCells(rewardCount, true)
end
return PlayerLevelUpUI

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b83a832315fd3374695b7da2524db2c4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -49,6 +49,13 @@ function PlayerData:addExp(exp)
self:markDirty()
end
function PlayerData:setLv(level, exp)
self.data.level = level
self.data.exp = exp
self.lvUpNeedExp = self:getNextExp(self.data.level)
self:markDirty()
end
function PlayerData:getLv()
return self.data.level
end
@ -66,6 +73,13 @@ function PlayerData:getExpPercent()
return self.data.exp / self.lvUpNeedExp
end
function PlayerData:getIfCanLevelUp()
if self.data.level >= self:getMaxLv() then
return false
end
return self.data.exp >= self.lvUpNeedExp
end
function PlayerData:getAccountInfo()
if not self.accountInfo then
self.accountInfo = LocalData:getAccountInfo()