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

This commit is contained in:
CloudJ 2023-05-22 16:14:47 +08:00
commit 99fedebb96
26 changed files with 327 additions and 13 deletions

View File

@ -69,6 +69,7 @@ BIReport.ITEM_GET_TYPE = {
BOUNTY = "Bounty",
IDLE_DROP = "IdleDrop",
IDLE_QUICK_DROP = "IdleQuickDrop",
MAIL = "Mail"
}
BIReport.ADS_CLICK_TYPE = {
@ -112,6 +113,11 @@ BIReport.COIN_TYPE = {
[2] = "Gem",
}
BIReport.MAIL_OPT_TYPE = {
OPEN = "Open",
CLAIM = "Claim",
}
-- b6
local EVENT_NAME_EXIT = "client_exit"
local EVENT_NAME_FIGHT = "client_fight"
@ -130,6 +136,7 @@ local EVENT_NAME_CHAPTER_OPT = "client_chapter_opt" -- 章节
local EVENT_NAME_VIT_USE = "client_vit_use"
local EVENT_NAME_VIT_GET = "client_vit_get"
local EVENT_NAME_TASK = "client_task"
local EVENT_NAME_MAIL_OPT = "client_mail_opt"
function BIReport:setIsNewPlayer(isNewPlayer)
self.isNewPlayer = isNewPlayer
@ -714,4 +721,31 @@ function BIReport:postDailyTaskFinish(taskType, cfgId, taskId, refresh)
self:report(EVENT_NAME_TASK, args)
end
-- 邮箱
function BIReport:postMailOpen(mailId)
-- IsNew 是否是新用户
-- MaxLevel 最大关卡
-- Email_ID 邮件编号
local args = {
mail_id = mailId,
event_type = BIReport.MAIL_OPT_TYPE.OPEN,
}
self:report(EVENT_NAME_MAIL_OPT, args)
BIReport:printArgsStr(EVENT_NAME_MAIL_OPT, args)
end
function BIReport:postMailClaim(mailId)
-- IsNew 是否是新用户
-- MaxLevel 最大关卡
-- Email_ID 邮件编号
local args = {
mail_id = mailId,
event_type = BIReport.MAIL_OPT_TYPE.CLAIM,
}
self:report(EVENT_NAME_MAIL_OPT, args)
BIReport:printArgsStr(EVENT_NAME_MAIL_OPT, args)
end
return BIReport

View File

@ -1,5 +1,7 @@
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",
@ -116,6 +118,7 @@ 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",
}
return LocalizationGlobalConst

View File

@ -116,6 +116,7 @@ local localization_global =
["BTN_DELETE_ALL_READ_MAIL"] = "删除已读邮件",
["BTN_CLAIM_ALL"] = "领取所有",
["BTN_READ"] = "读取",
["MAIL_COUNTDOWN"] = "{0}小时到期",
}
return localization_global

View File

@ -136,6 +136,7 @@ GConst.TYPEOF_UNITY_CLASS = {
BF_TUTORIAL_CLICKAREA = typeof(CS.BF.TutorialClickArea),
BF_CAMERA_HELPER = typeof(CS.BF.CameraHelper),
BF_HORIZONTAL_OR_VERTICAL_LAYOUT = typeof(CS.BF.BFHorizontalOrVerticalLayout),
BF_GRID_LAYOUT = typeof(CS.BF.BFGridLayout),
BF_SCROLL_RECT_CENTER = typeof(CS.BF.ScrollRectCenterController),
BF_SCROLL_RECT_CENTER_CORE = typeof(CS.BF.ScrollRectCenter),
BF_GRAPHIC_FLIP = typeof(CS.BF.BFGraphicFlip),

View File

@ -18,6 +18,10 @@ function BattleManager:showBattleResultUI(rewards, combatReport, mysteryBoxIdx)
UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport, mysteryBoxIdx = mysteryBoxIdx})
end
function BattleManager:showBoxOpenUI(rewards, callback)
UIManager:showUI("app/ui/battle/battle_box_open_ui", {rewards = rewards, callback = callback})
end
function BattleManager:playBattle(battleType, params, returnFunc)
params = params or {}
if self.battleController then -- 同一时间只能有一场战斗

View File

@ -1011,7 +1011,7 @@ function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequ
end
end
if entity:getEffectType() then
local list = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(posId, gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_GRID_BREAK, self, onlyCheck)
local succ, list = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(posId, gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_GRID_BREAK, self, onlyCheck)
if list then
aniUnit.aniPosList = {}
aniUnit.overCallback = aniUnit.callback
@ -1156,7 +1156,7 @@ function BattleController:onFillBoardOver(isRoundBeginCheck)
local index = table.remove(self.showMysteryBoxIndexs, 1)
local boardList, _, mysteryBoxIndexMap = self:getInitBoard()
local rewards = mysteryBoxIndexMap[index]
ModuleManager.TipsManager:showRewardsTips(rewards, nil, nil, function()
ModuleManager.BattleManager:showBoxOpenUI(rewards, function()
self:onFillBoardOver()
end)
return

View File

@ -12,7 +12,7 @@ local function _directionElinination(entity, gridEntities, battleController, onl
end
local direction = effectParams[1]
local list = ModuleManager.BattleManager:getPosIdsByDirection(entity:getPosId(), direction)
return list
return true, list
end
local function _crossSpread(entity, gridEntities, battleController, onlyCheck)

View File

@ -91,7 +91,7 @@ function ChapterManager:endFightFinish(result)
ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport, mysteryBoxIdx)
DataManager.ChapterData:fightChapter(reqData.chapter_id, result.max_chapter_id, result.max_wave, reqData.mystery_box_idx)
-- 处理金猪
DataManager.GodPigData:addGoldPigCount()
-- DataManager.GodPigData:addGoldPigCount()
local newMaxChapter = DataManager.ChapterData:getNewChapterId()
if maxChapter ~= newMaxChapter then

View File

@ -26,6 +26,10 @@ end
------------------------------------------ 英雄相关的工具方法 ------------------------------
function HeroManager:getHeroName(id)
return I18N:getConfig("hero")[id].name
end
function HeroManager:getHeroIcon(heroId)
local cfg = ConfigManager:getConfig("hero")[heroId]
return cfg and tostring(cfg.icon)

View File

@ -111,6 +111,20 @@ function TipsManager:getRewardDesc(rewardId, rewardType)
return GConst.EMPTY_STRING
end
function TipsManager:showBattleBoardSkillTips(elementType, tarPrefabObj, alignType)
local params = {
elementType = elementType,
aniType = UIManager.ANI_TYPE.NONE,
}
if tarPrefabObj then
alignType = alignType or TipsManager.ALIGN_TYPE.TOP_CENTER
local tarCornerScreenPos, location = self:getCornerScreenPosition(tarPrefabObj, alignType)
params.tarCornerScreenPos = tarCornerScreenPos
params.location = location
end
UIManager:showUI("app/ui/tips/battle_board_skill_tips", params)
end
function TipsManager:getCornerScreenPosition(tarPrefabObj, alignType)
local uiCamera = UIManager:getUICameraComponent()
local rectTransform = tarPrefabObj:getComponent(GConst.TYPEOF_UNITY_CLASS.RECTTRANSFORM)

View File

@ -0,0 +1,35 @@
local BattleBoxOpenUI = class("BattleBoxOpenUI", BaseUI)
function BattleBoxOpenUI:isFullScreen()
return false
end
function BattleBoxOpenUI:getPrefabPath()
return "assets/prefabs/ui/battle/battle_box_open_ui.prefab"
end
function BattleBoxOpenUI:ctor(params)
self.rewards = params.rewards
self.callback = params.callback
end
function BattleBoxOpenUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
if not self.rewardCell then
self.rewardCell = CellManager:addCellComp(uiMap["battle_box_open_ui.reward_cell"], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
end
local reward = self.rewards[1]
if reward then
self.rewardCell:refreshByConfig(reward)
end
uiMap["battle_box_open_ui.mask"]:addClickListener(function()
self:closeUI()
if self.callback then
self.callback()
end
end)
end
return BattleBoxOpenUI

View File

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

View File

@ -20,6 +20,8 @@ end
function BattleSkillSelectComp:_display()
local uiMap = self:getUIMap()
uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
local bg2 = uiMap["battle_select_skill_comp.bg_2"]
bg2:setVisible(self.onlyCommonSkill)
local bg = uiMap["battle_select_skill_comp.bg_1"]
if ModuleManager.BattleManager.battleController then
bg:setVisible(false)

View File

@ -134,6 +134,9 @@ function BattleUI:initSkill()
self.skillNodeCells[elementType]:refresh(skillEntity)
end
self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
self.skillNodeCells[elementType]:addClickListener(function()
ModuleManager.TipsManager:showBattleBoardSkillTips(elementType)
end)
end
end

View File

@ -57,4 +57,10 @@ function SkillNodeCell:refresh(skillEntity, elementMap, showSfx)
self.lastValue = value
end
function SkillNodeCell:addClickListener(func)
local uiMap = self:getUIMap()
local iconNode = uiMap["skill_node_cell.icon_node"]
iconNode:addClickListener(func)
end
return SkillNodeCell

View File

@ -20,6 +20,18 @@ function SelectOtherBtnUI:onLoadRootComplete()
self:closeUI()
ModuleManager.MailManager:showMailUI()
end)
local redPoint, isAdRedPoint = DataManager.MailData:getRedPoint()
if redPoint then
if isAdRedPoint then
self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 1, "common_ad_3", nil, true)
else
self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 0.8)
end
else
self.uiMap["select_other_btn_ui.bg.mail_btn"]:removeRedPoint()
end
self.uiMap["select_other_btn_ui.bg.mail_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIL_NAME))
self.uiMap["select_other_btn_ui.bg.setting_btn"]:addClickListener(function()

View File

@ -27,7 +27,7 @@ function MailDetailUI:_display()
local uiMap = self.root:genAllChildren()
uiMap["mail_detail_ui.bg.btn_claimed.btn_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM))
uiMap["mail_detail_ui.bg.tx_1"]:setText(self.entity:getMailName())
uiMap["mail_detail_ui.bg.tx_4"]:setText(I18N:getGlobalText(I18N.GlobalConst.IDLE_TITLE2))
uiMap["mail_detail_ui.bg.tx_4"]:setText(I18N:getGlobalText(I18N.GlobalConst.EXTRA_REWARDS))
uiMap["mail_detail_ui.bg.btn_claimed"]:setActive(not self.entity:isReceived())
local content = uiMap["mail_detail_ui.bg.tx_3"]
@ -35,7 +35,6 @@ function MailDetailUI:_display()
content:setSizeDeltaY(content:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight)
content:setAnchoredPositionY(0)
local haveReward = self.entity:haveReward()
uiMap["mail_detail_ui.bg.img_bg"]:setVisible(haveReward)
local contentScroll = uiMap["mail_detail_ui.bg.scrollrect"]
@ -55,7 +54,13 @@ function MailDetailUI:_addListeners()
end)
uiMap["mail_detail_ui.bg.btn_close"]:addClickListener(function()
self:closeUI()
local haveReward = self.entity:haveReward()
if haveReward then
ModuleManager.MailManager:claimMail({self.entity:getId()})
self:closeUI()
else
self:closeUI()
end
end)
end

View File

@ -68,6 +68,8 @@ function MailUI:_display()
uiMap["mail_ui.bg.title_bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIL_TITLE))
uiMap["mail_ui.bg.btn_delect.btn_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_DELETE_ALL_READ_MAIL))
uiMap["mail_ui.bg.btn_claimed.btn_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM_ALL))
self.emptyBg = uiMap["mail_ui.bg.empty"]
end
function MailUI:_addListeners()
@ -90,6 +92,11 @@ function MailUI:refreshScrollRect()
if self.needRefills then
self.scrollRect:clearCells()
self.scrollRect:refillCells(#self.mailList)
if #self.mailList > 0 then
self.emptyBg:setVisible(false)
else
self.emptyBg:setVisible(true)
end
else
self.scrollRect:updateAllCell()
end
@ -108,6 +115,12 @@ function MailUI:refreshScrollRect()
end)
self.scrollRect:clearCells()
self.scrollRect:refillCells(#self.mailList)
if #self.mailList > 0 then
self.emptyBg:setVisible(false)
else
self.emptyBg:setVisible(true)
end
self.needRefills = false
end

View File

@ -2,7 +2,7 @@ local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarGodPigCell = class("SideBarGodPigCell", SideBarBaseCellComp)
function SideBarGodPigCell:getIsOpen()
return DataManager.GodPigData:getIsOpen()
return false
end
function SideBarGodPigCell:getIconRes()

View File

@ -81,6 +81,7 @@ function MainCityUI:onRefresh()
self:refreshLeftBtns()
self:refreshRightBtns()
self:updateSideBarStatus()
self:refreshSettingBtn()
end
function MainCityUI:onReshow()
@ -162,6 +163,10 @@ function MainCityUI:_bind()
self:bind(DataManager.BountyData, "dirty", function()
self:refreshBounty()
end)
self:bind(DataManager.MailData, "redPoint", function()
self:refreshSettingBtn()
end)
end
function MainCityUI:initBottomUI()
@ -665,6 +670,14 @@ function MainCityUI:refreshBottomRp()
end
end
function MainCityUI:refreshSettingBtn()
if DataManager.MailData:getRedPoint() then
self.settingbtn:addRedPoint(40, 40, 0.7)
else
self.settingbtn:removeRedPoint()
end
end
function MainCityUI:checkMainPop()
-- 引导
if self:checkTutorial() then

View File

@ -0,0 +1,115 @@
local BaseTips = require "app/ui/tips/base_tips"
local BattleBoardSkillTips = class("BattleBoardSkillTips", BaseTips)
local SELECT_SKILL_CELL = "app/ui/battle/cell/select_skill_cell"
local MIN_HEIGHT = 248
local MAX_HEIGHT = 348
local NO_SKILL_HRIGHT = 136
function BattleBoardSkillTips:ctor(params)
local elementType = params.elementType
self.params = params
self.boardSkillEntity = DataManager.BattleData:getSkillEntityByElement(elementType)
self.battleUnitEntity = DataManager.BattleData:getAtkTeam():getAllMembers()[elementType]
self.tarCornerScreenPos = params.tarCornerScreenPos
self.location = params.location
end
function BattleBoardSkillTips:getPrefabPath()
return "assets/prefabs/ui/tips/battle_skill_tips.prefab"
end
function BattleBoardSkillTips:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
self.bg = uiMap["battle_skill_tips.bg_1"]
self.mask = uiMap["battle_skill_tips.mask"]
self.atkDesc = uiMap["battle_skill_tips.bg_1.atk_desc"]
self.skillDesc = uiMap["battle_skill_tips.bg_1.skill_desc"]
self.validEffectDesc = uiMap["battle_skill_tips.bg_1.valid_effect_desc"]
self.gridLayout = uiMap["battle_skill_tips.bg_1.grid_layout"]
if not self.selectSkillCells then
self.selectSkillCells = {}
for i = 1, 7 do
self.selectSkillCells[i] = CellManager:addCellComp(uiMap["battle_skill_tips.bg_1.grid_layout.skill_select_cell_" .. i], SELECT_SKILL_CELL)
end
end
local tipsBgTransform = self.bg:getTransform()
self.originSizeDelta = tipsBgTransform.sizeDelta
self.originPivot = tipsBgTransform.pivot
self.originAnchoredPosition = tipsBgTransform.anchoredPosition
self.originLocalPosition = tipsBgTransform.localPosition
end
function BattleBoardSkillTips:onRefresh()
self.mask:addClickListener(function ()
self:closeUI()
end)
local heroId = self.battleUnitEntity:getId()
local heroEntity = DataManager.HeroData:getHeroById(heroId)
if not heroEntity then
return
end
local heroNmae = ModuleManager.HeroManager:getHeroName(heroId)
local atk = self.battleUnitEntity:getAtk()
self.atkDesc:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_9, heroNmae, atk))
self.skillDesc:setText(ModuleManager.HeroManager:getSkillDesc(heroEntity:getBaseSkill()))
self.validEffectDesc:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_10))
local addY = self.skillDesc:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight - self.skillDesc:fastGetSizeDeltaY()
if addY < 0 then
addY = 0
end
local count = 0
local rougeSkillList = heroEntity:getRogueSkillList()
for index, cell in ipairs(self.selectSkillCells) do
local rogueSkillId = rougeSkillList[index]
cell:getBaseObject():setActive(rogueSkillId ~= nil)
if rogueSkillId then
local selectedCount = DataManager.BattleData:getSkillCount(rogueSkillId)
if selectedCount > 0 then
count = count + 1
local skillId = rogueSkillId
local count = selectedCount
local value = DataManager.BattleData:getSelectSkillMap()[skillId].value or 0
cell:refresh(skillId, count)
cell:addClickListener(function()
ModuleManager.TipsManager:showDescTips(ModuleManager.HeroManager:getSkillRogueDesc(skillId, value), cell:getBaseObject())
end)
else
cell:getBaseObject():setActive(false)
end
end
end
self.gridLayout:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_GRID_LAYOUT):RefreshLayout()
if count > 5 then
addY = addY + MAX_HEIGHT
elseif count >= 1 then
addY = addY + MIN_HEIGHT
else
addY = addY + NO_SKILL_HRIGHT
self.validEffectDesc:setText(GConst.EMPTY_STRING)
end
self.bg:setSizeDeltaY(addY)
if self.tarCornerScreenPos then
self:locate(self.location, self.originSizeDelta, self.bg, self.tarCornerScreenPos)
end
end
function BattleBoardSkillTips:onClose()
if self.originSizeDelta then
local tipsBgTransform = self.bg:getTransform()
tipsBgTransform.sizeDelta = self.originSizeDelta
tipsBgTransform.pivot = self.originPivot
tipsBgTransform.anchoredPosition = self.originAnchoredPosition
tipsBgTransform.localPosition = self.originLocalPosition
end
end
return BattleBoardSkillTips

View File

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

View File

@ -206,6 +206,8 @@ function ItemData:_addItemNumById(id, num)
end
elseif id == ItemConst.ITEM_ID_BOUNTY_EXP then
DataManager.BountyData:addExp(num)
elseif id == ItemConst.ITEM_ID_EXP then
DataManager.PlayerData:addExp(num)
end
self:setDirty()
end

View File

@ -521,11 +521,9 @@ end
function BattleData:addCommonSelectSkillCount(count)
self.commonSelectSkillCount = self.commonSelectSkillCount + (count or 1)
Logger.logHighlight("self.commonSelectSkillCount " .. self.commonSelectSkillCount)
end
function BattleData:useCommonSelectSkillCount()
Logger.logHighlight("useCommonSelectSkillCount " .. self.commonSelectSkillCount)
if self.commonSelectSkillCount <= 0 then
self.commonSelectSkillCount = 0
return false

View File

@ -222,7 +222,7 @@ function HeroEntity:getHurtNum()
end
function HeroEntity:getName()
return I18N:getConfig("hero")[self:getCfgId()].name
return ModuleManager.HeroManager:getHeroName(self:getCfgId())
end
function HeroEntity:getActiveRogueCount()

View File

@ -1,10 +1,14 @@
local PlayerData = class("PlayerData", BaseData)
function PlayerData:ctor()
self.data.dirty = false
end
function PlayerData:init(data)
local basicInfo = data.basic_info or GConst.EMPTY_TABLE
self.data.level = basicInfo.level or 1
self.data.exp = basicInfo.exp or 0
self.data.dirty = false
self.lvUpNeedExp = self:getNextExp(self.data.level)
self.data.payAmount = basicInfo.pay_amount or 0
local energyLimit = data.energy_limit or GConst.EMPTY_TABLE
@ -14,6 +18,10 @@ function PlayerData:init(data)
self.lastLoginTime = basicInfo.lastLoginTime or Time:getBeginningOfServerToday()
end
function PlayerData:markDirty()
self.data.dirty = not self.data.dirty
end
function PlayerData:setVit(vit)
self.vit = vit
end
@ -29,12 +37,33 @@ function PlayerData:getMaxVit()
return self.maxVit
end
function PlayerData:getMaxLv()
return ConfigManager:getConfigNum("player_exp")
end
function PlayerData:addExp(exp)
self.data.exp = self.data.exp + exp
if self.data.level >= self:getMaxLv() then
return
end
self:markDirty()
end
function PlayerData:getLv()
return self.data.level
end
function PlayerData:getNextExp(lv)
lv = lv or self.data.level
local cfg = ConfigManager:getConfig("player_exp")
if not cfg[lv] then
return 1
end
return cfg[lv].need_exp
end
function PlayerData:getExpPercent()
return 0
return self.data.exp / self.lvUpNeedExp
end
function PlayerData:getAccountInfo()