This commit is contained in:
chenxi 2023-04-14 15:55:14 +08:00
commit 0d7d3a5b72
24 changed files with 518 additions and 120 deletions

View File

@ -120,18 +120,7 @@ BIReport.ITEM_GET_TYPE = {
}
BIReport.ADS_CLICK_TYPE = {
SUMMON = "Summon",
MINING = "Mine",
RESEARCH = "Research",
DUNGEON = "Dungeon",
ARENA = "Arena",
DAILY_TASK = "DailyTask",
QUICK_PASS = "QuickPass",
GIFT = "Gift",
BATTLE_SPEEDUP = "BattleSpeedup",
BLESSING = "Blessing",
IDLE_EXT_REWARDS = "IdleExtRewards",
MAIL = "Mail",
BATTLE_SKILL_REFRESH = "BattleSkillRefresh"
}
-- BIReport.OPEN_STORE_TYPE = {
@ -734,7 +723,7 @@ function BIReport:postGemGet(bigNum, getType, itemId)
coin_type = BIReport.COIN_TYPE[itemId],
}
if itemId == GConst.ItemConst.ITEM_ID_GEM then
args.coin_value = BigNumOpt.bigNum2Num(bigNum)
-- args.coin_value = BigNumOpt.bigNum2Num(bigNum)
args.coin_unit = 0
else
args.coin_value = bigNum.value

View File

@ -332,7 +332,7 @@ function SDKManager:adRewradAd(noReport)
Logger.logHighlight("-------------------")
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_WATCH_AD)
if not noReport then
DataManager.PlayerData:addAdCount()
-- DataManager.PlayerData:addAdCount()
-- BIReport:postAdEvent()
end
end

View File

@ -25,6 +25,17 @@ local localization_global =
["HERO_DESC_5"] = "激活",
["HERO_DESC_6"] = "已解锁",
["HERO_DESC_7"] = "未解锁",
["GET_REWARDS_DESC"] = "获得奖励",
["CLICK_CLOSE_DESC"] = "点击关闭",
["REWARD_DESC"] = "奖励",
["CONTINUE_DESC"] = "继续",
["BATTLE_DESC_2"] = "暂停",
["BATTLE_DESC_3"] = "刷新",
["BATTLE_DESC_4"] = "达到",
["BATTLE_DESC_5"] = "胜利",
["BATTLE_DESC_6"] = "失败",
["BATTLE_DESC_7"] = "累计造成总伤害:<color=#89FF76>{0}</color>",
}
return localization_global

View File

@ -727,6 +727,20 @@ function GFunc.showRewardBox(rewards, extParams, callback)
ModuleManager.TipsManager:showRewardsBox(params)
end
function GFunc.mergeRewards2(rewards, newRewards)
local items = {}
for i,v in ipairs(rewards) do
if v.type == GConst.REWARD_TYPE.ITEM then
items[v.item.cfg_id] = (items[v.item.cfg_id] or 0) + v.item.count
elseif v.type == GConst.REWARD_TYPE.EQUIP then
table.insert(newRewards, v)
end
end
for k,v in pairs(items) do
table.insert(newRewards, {type = GConst.REWARD_TYPE.ITEM, item = {cfg_id = k, count = v}})
end
end
-- reward 结构为 type id num 配置中结构
function GFunc.mergeRewards(rewards)
local items = {}

View File

@ -10,10 +10,18 @@ local BATTLE_CONTROLLER = {
[BattleConst.BATTLE_TYPE.STAGE] = "app/module/battle/controller/battle_controller_stage"
}
function BattleManager:showPauseUI()
UIManager:showUI("app/ui/battle/battle_pause_ui")
end
function BattleManager:showSelectSkillUI(skillList)
UIManager:showUI("app/ui/battle/battle_skill_select_ui", {skillList = skillList})
end
function BattleManager:showBattleResultUI(rewards, combatReport)
UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport})
end
function BattleManager:playBattle(battleType, params, returnFunc)
if self.battleController then -- 同一时间只能有一场战斗
self:clear()

View File

@ -4,45 +4,6 @@ function HeroManager:showHeroDetailUI(heroId)
UIManager:showUI("app/ui/hero/hero_detail_ui", {heroId = heroId})
end
function HeroManager:getMatchTypeIcon(matchType)
return GConst.HeroConst.MATCH_ICON_NAME[matchType]
end
function HeroManager:getMatchTypeName(matchType)
return I18N:getGlobalText("ELEMENT_NAME_" .. matchType)
end
function HeroManager:getSkillDesc(skillId)
return I18N:getConfig("skill")[skillId].desc
end
function HeroManager:getSkillIcon(skillId)
return ConfigManager:getConfig("skill")[skillId].icon
end
function HeroManager:getSkillRogueDesc(skillId)
return I18N:getConfig("skill_rogue")[skillId].desc
end
function HeroManager:getSkillRogueIcon(skillId)
return ConfigManager:getConfig("skill_rogue")[skillId].icon
end
function HeroManager:getActiveRogueLvs()
if not self.activeRogueLvs then
self.activeRogueLvs = {}
local lvMap = {}
for lv, info in ipairs(ConfigManager:getConfig("hero_level")) do
if not lvMap[info.unlock_skill] then
table.insert(self.activeRogueLvs, lv)
lvMap[info.unlock_skill] = true
end
end
end
return self.activeRogueLvs
end
function HeroManager:upgradeHero(heroId, heroEntity)
local heroEntity = heroEntity or DataManager.HeroData:getHeroById(heroId)
if not heroEntity then
@ -72,4 +33,54 @@ function HeroManager:upgradeHero(heroId, heroEntity)
end)
end
------------------------------------------ 英雄相关的工具方法 ------------------------------
function HeroManager:getHeroIcon(heroId)
local cfg = ConfigManager:getConfig("hero")[heroId]
return cfg and tostring(cfg.icon)
end
function HeroManager:getMatchTypeIcon(matchType)
return GConst.HeroConst.MATCH_ICON_NAME[matchType]
end
function HeroManager:getMatchTypeName(matchType)
return I18N:getGlobalText("ELEMENT_NAME_" .. matchType)
end
function HeroManager:getSkillDesc(skillId)
local cfg = I18N:getConfig("skill")[skillId]
return cfg and cfg.desc
end
function HeroManager:getSkillIcon(skillId)
local cfg = ConfigManager:getConfig("skill")[skillId]
return cfg and cfg.icon
end
function HeroManager:getSkillRogueDesc(skillId)
local cfg = I18N:getConfig("skill_rogue")[skillId]
return cfg and cfg.desc
end
function HeroManager:getSkillRogueIcon(skillId)
local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
return cfg and tostring(cfg.icon)
end
function HeroManager:getActiveRogueLvs()
if not self.activeRogueLvs then
self.activeRogueLvs = {}
local lvMap = {}
for lv, info in ipairs(ConfigManager:getConfig("hero_level")) do
if not lvMap[info.unlock_skill] then
table.insert(self.activeRogueLvs, lv)
lvMap[info.unlock_skill] = true
end
end
end
return self.activeRogueLvs
end
return HeroManager

View File

@ -76,31 +76,18 @@ function TipsManager:showEquipTips(entity, id, params)
UIManager:showUI("app/ui/tips/equip_tips", params)
end
function TipsManager:showSkillTips(params)
params = params or {}
params.aniType = UIManager.ANI_TYPE.NONE
if params.tarPrefabObj then
local tarCornerScreenPos, location = self:getCornerScreenPosition(params.tarPrefabObj, TipsManager.ALIGN_TYPE.TOP_CENTER)
function TipsManager:showDescTips(desc, tarPrefabObj, alignType)
local params = {
desc = desc,
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/skill_tips", params)
end
function TipsManager:showLegacyUpTips(params)
params = params or {}
UIManager:showUI("app/ui/tips/legacy_up_tips", params)
end
function TipsManager:showLegacyTips(id)
local params = {}
params.id = id
UIManager:showUI("app/ui/tips/legacy_tips", params)
end
function TipsManager:showGetRuneTips(params)
params = params or {}
UIManager:showUI("app/ui/tips/get_rune_tips", params)
UIManager:showUI("app/ui/tips/desc_tips", params)
end
function TipsManager:getCornerScreenPosition(tarPrefabObj, alignType)

View File

@ -0,0 +1,78 @@
local BattlePauseUI = class("BattlePauseUI", BaseUI)
local SELECT_SKILL_CELL = "app/ui/battle/cell/select_skill_cell"
function BattlePauseUI:isFullScreen()
return false
end
function BattlePauseUI:showCommonBG()
return false
end
function BattlePauseUI:getPrefabPath()
return "assets/prefabs/ui/battle/battle_pause_ui.prefab"
end
function BattlePauseUI:ctor(params)
local map = DataManager.BattleData:getSelectSkillMap()
self.skillList = {}
for skillId, count in pairs(map) do
table.insert(self.skillList, {skillId = skillId, count = count})
end
end
function BattlePauseUI:onLoadRootComplete()
self:_display()
self:_addListeners()
end
function BattlePauseUI:_display()
local uiMap = self.root:genAllChildren()
uiMap["battle_pause_ui.skill_node.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_2))
self:_refreshScrollRect()
end
function BattlePauseUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["battle_pause_ui.home_btn"]:addClickListener(function()
local params = {
content = I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_1),
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
cancelText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL),
okFunc = function()
ModuleManager.BattleManager:endBattleAndExit()
end,
}
GFunc.showMessageBox(params)
end)
uiMap["battle_pause_ui.continue_btn"]:addClickListener(function()
self:closeUI()
end)
end
function BattlePauseUI:_refreshScrollRect()
if self.scrollRect then
self.scrollRect:updateAllCell()
return
end
local uiMap = self.root:genAllChildren()
self.scrollRect = uiMap["battle_pause_ui.skill_node.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRect:addInitCallback(function()
return SELECT_SKILL_CELL
end)
self.scrollRect:addRefreshCallback(function(index, cell)
local skillId = self.skillList[index].skillId
cell:refresh(skillId, self.skillList[index].count)
cell:addClickListener(function()
ModuleManager.TipsManager:showDescTips(ModuleManager.HeroManager:getSkillRogueDesc(skillId), cell:getBaseObject())
end)
end)
self.scrollRect:clearCells()
self.scrollRect:refillCells(#self.skillList)
end
return BattlePauseUI

View File

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

View File

@ -0,0 +1,137 @@
local BattleResultUI = class("BattleResultUI", BaseUI)
local UNIT_RESULT_RERPORT_CELL = "app/ui/battle/cell/unit_result_report_cell"
function BattleResultUI:getPrefabPath()
return "assets/prefabs/ui/battle/battle_result_ui.prefab"
end
function BattleResultUI:ctor(params)
self.rewards = params.rewards
self.combatReport = params.combatReport
---- 假数据
-- self.combatReport = {
-- battleType = GConst.BattleConst.BATTLE_TYPE.STAGE,
-- victory = false,
-- wave = 3,
-- atkReport = {
-- {
-- heroId = 12001,
-- dmg = 237800,
-- },
-- {
-- heroId = 12001,
-- dmg = 23700,
-- }
-- }
-- }
self.totalDmg = 0
if self.combatReport.atkReport then
for _, info in ipairs(self.combatReport.atkReport) do
self.totalDmg = self.totalDmg + info.dmg
end
end
end
function BattleResultUI:onLoadRootComplete()
self:_display()
self:_addListeners()
end
function BattleResultUI:_display()
local uiMap = self.root:genAllChildren()
if self.combatReport.victory then
self:refreshVictoryNode()
else
self:refreshDefeatNode()
end
self:refreshFixedInfo()
self:refreshRewards()
self:refreshUnitInfo()
end
function BattleResultUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["battle_result_ui.mask_v"]:addClickListener(function()
ModuleManager.BattleManager:endBattleAndExit()
end)
uiMap["battle_result_ui.mask_d"]:addClickListener(function()
ModuleManager.BattleManager:endBattleAndExit()
end)
end
function BattleResultUI:refreshFixedInfo()
local uiMap = self.root:genAllChildren()
local icon = uiMap["battle_result_ui.icon"]
local desc1 = uiMap["battle_result_ui.desc_1"]
local desc2 = uiMap["battle_result_ui.desc_2"]
local desc3 = uiMap["battle_result_ui.desc_3"]
local rewardTitle = uiMap["battle_result_ui.reward_title"]
local continue = uiMap["battle_result_ui.continue"]
desc1:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_4))
desc2:setText(self.combatReport.wave)
desc3:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_7, GFunc.num2Str(self.totalDmg)))
rewardTitle:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC))
continue:setText(I18N:getGlobalText(I18N.GlobalConst.CONTINUE_DESC))
GFunc.centerImgAndTx(icon, desc2, 7)
end
function BattleResultUI:refreshVictoryNode()
local uiMap = self.root:genAllChildren()
uiMap["battle_result_ui.mask_v"]:setActive(true)
uiMap["battle_result_ui.mask_d"]:setActive(false)
uiMap["battle_result_ui.defeat_node"]:setActive(false)
uiMap["battle_result_ui.victory_node"]:setActive(true)
uiMap["battle_result_ui.victory_node.title_bg.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_6))
end
function BattleResultUI:refreshDefeatNode()
local uiMap = self.root:genAllChildren()
uiMap["battle_result_ui.mask_v"]:setActive(true)
uiMap["battle_result_ui.mask_d"]:setActive(false)
uiMap["battle_result_ui.defeat_node"]:setActive(true)
uiMap["battle_result_ui.victory_node"]:setActive(false)
uiMap["battle_result_ui.defeat_node.title_bg.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_6))
end
function BattleResultUI:refreshRewards()
if self.scrollRect then
self.scrollRect:updateAllCell()
return
end
local uiMap = self.root:genAllChildren()
self.scrollRect = uiMap["battle_result_ui.scroll_rect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRect:addInitCallback(function()
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
end)
self.scrollRect:addRefreshCallback(function(index, cell)
cell:refreshByConfig(self.rewards[index])
end)
self.scrollRect:clearCells()
self.scrollRect:refillCells(#self.rewards)
end
function BattleResultUI:refreshUnitInfo()
local uiMap = self.root:genAllChildren()
if not self.unitResultReportCells then
self.unitResultReportCells = {}
for index = 1, 5 do
self.unitResultReportCells[index] = CellManager:addCellComp(uiMap["battle_result_ui.unit_result_report_cell_" .. index], UNIT_RESULT_RERPORT_CELL)
end
end
for index, cell in ipairs(self.unitResultReportCells) do
local info = self.combatReport.atkReport[index]
cell:getBaseObject():setVisible(info ~= nil)
if info then
cell:refresh(info, self.totalDmg)
end
end
end
return BattleResultUI

View File

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

View File

@ -19,6 +19,40 @@ function BattleSkillSelectUI:ctor(params)
end
function BattleSkillSelectUI:onLoadRootComplete()
self:_display()
self:_addListeners()
end
function BattleSkillSelectUI:_display()
local uiMap = self.root:genAllChildren()
uiMap["battle_skill_select_ui.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
self:refreshRogueSkill()
end
function BattleSkillSelectUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["battle_skill_select_ui.skill_node.ad_btn"]:addClickListener(function()
if not ModuleManager.BattleManager.battleController then
return
end
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.BATTLE_SKILL_REFRESH, function()
self.skillList = ModuleManager.BattleManager.battleController:getRandomSkillList()
self:refreshRogueSkill()
end)
end)
self.canvasGroup = uiMap["battle_skill_select_ui.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
uiMap["battle_skill_select_ui.look_btn"]:addTouchListener(function(eventType, x, y)
if eventType == GConst.TOUCH_EVENT.DOWN or eventType == GConst.TOUCH_EVENT.DRAG then
self.canvasGroup.alpha = 0.3
else
self.canvasGroup.alpha = 1
end
end)
end
function BattleSkillSelectUI:refreshRogueSkill()
local uiMap = self.root:genAllChildren()
if not self.selectSkillCells then
self.selectSkillCells = {}

View File

@ -41,16 +41,7 @@ end
function BattleUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["battle_ui.close_btn"]:addClickListener(function()
local params = {
content = I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_1),
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
cancelText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL),
okFunc = function()
ModuleManager.BattleManager:endBattleAndExit()
end,
}
GFunc.showMessageBox(params)
ModuleManager.BattleManager:showPauseUI()
end)
end

View File

@ -1,5 +1,7 @@
local BattleSelectSkillCell = class("BattleSelectSkillCell", BaseCell)
local SELECT_SKILL_CELL = "app/ui/battle/cell/select_skill_cell"
function BattleSelectSkillCell:refresh(skillId, func)
local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
local i18Cfg = I18N:getConfig("skill_rogue")[skillId]
@ -10,6 +12,10 @@ function BattleSelectSkillCell:refresh(skillId, func)
local uiMap = self:getUIMap()
uiMap["skill_select_cell.desc"]:setText(i18Cfg.desc)
self:getBaseObject():addClickListener(func)
if not self.selectSkillCell then
self.selectSkillCell = CellManager:addCellComp(uiMap["skill_select_cell.skill_select_cell"], SELECT_SKILL_CELL)
end
self.selectSkillCell:refresh(skillId)
end
return BattleSelectSkillCell

View File

@ -0,0 +1,14 @@
local SelectSkillCell = class("SelectSkillCell", BaseCell)
function SelectSkillCell:refresh(skillId, count)
local uiMap = self:getUIMap()
uiMap["skill_select_cell.icon"]:setSprite(GConst.ATLAS_PATH.ICON_SKILL_BUFF, ModuleManager.HeroManager:getSkillRogueIcon(skillId))
-- uiMap["skill_select_cell.value"]:setText()
uiMap["skill_select_cell.count"]:setText(count or GConst.EMPTY_STRING)
end
function SelectSkillCell:addClickListener(func)
self.baseObject:addClickListener(func)
end
return SelectSkillCell

View File

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

View File

@ -0,0 +1,14 @@
local UnitResultReportCell = class("UnitResultReportCell", BaseCell)
function UnitResultReportCell:refresh(info, maxValue)
local uiMap = self:getUIMap()
local icon = ModuleManager.HeroManager:getHeroIcon(info.heroId)
if icon then
uiMap["unit_result_report_cell.icon"]:setSprite(GConst.ATLAS_PATH.ICON_HERO, icon)
end
uiMap["unit_result_report_cell.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = info.dmg / maxValue
uiMap["unit_result_report_cell.value"]:setText(GFunc.num2Str(info.dmg))
end
return UnitResultReportCell

View File

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

View File

@ -14,7 +14,7 @@ function RewardCell:refresh(reward)
local id
if reward.type == GConst.REWARD_TYPE.ITEM then
self:_refreshItem(reward.item)
id = reward.item.id
id = reward.item.cfg_id
-- elseif reward.type == GConst.REWARD_TYPE.EQUIP then
-- self:_refreshEquip(reward.equip)
-- id = reward.equip.id

View File

@ -49,8 +49,7 @@ function HeroDetailUI:_display()
local skillIcon = uiMap["hero_detail_ui.bg.skill_up_" .. i]
local skillLv = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".desc"]
skillIcon:addClickListener(function()
-- ModuleManager.TipsManager:show
GFunc.showToast(ModuleManager.HeroManager:getSkillRogueDesc(skillId))
ModuleManager.TipsManager:showDescTips(ModuleManager.HeroManager:getSkillRogueDesc(skillId), skillIcon)
end)
skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_BUFF, ModuleManager.HeroManager:getSkillRogueIcon(skillId))

View File

@ -0,0 +1,55 @@
local BaseTips = require "app/ui/tips/base_tips"
local DescTips = class("DescTips", BaseTips)
function DescTips:ctor(params)
self.desc = (params.desc or GConst.EMPTY_STRING)
self.tarCornerScreenPos = params.tarCornerScreenPos
self.location = params.location
end
function DescTips:getPrefabPath()
return "assets/prefabs/ui/tips/desc_tips.prefab"
end
function DescTips:init()
local uiMap = self.root:genAllChildren()
self.bg = uiMap["item_tips.bg1.bg"]
self.bg1 = uiMap["item_tips.bg1"]
self.descTx = uiMap["item_tips.bg1.bg.desc_tx"]
end
function DescTips:onLoadRootComplete()
self:init()
local tipsBgTransform = self.bg:getTransform()
self.originSizeDelta = tipsBgTransform.sizeDelta
self.originPivot = tipsBgTransform.pivot
self.originAnchoredPosition = tipsBgTransform.anchoredPosition
self.originLocalPosition = tipsBgTransform.localPosition
end
function DescTips:onRefresh()
self.root:addClickListener(function ()
self:closeUI()
end)
self.descTx:setText(self.desc)
-- 这里原来是用preferredHeight,但是在中英文混合的时候这个值可能不准,只有改用renderedHeight
-- renderedHeight必须要先调用下ForceMeshUpdate强制刷新才有效
self.descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO):ForceMeshUpdate()
self.bg:setSizeDeltaY(self.descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).renderedHeight + 18)
if self.tarCornerScreenPos then
self:locate(self.location, self.originSizeDelta, self.bg, self.tarCornerScreenPos)
end
end
function DescTips: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 DescTips

View File

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

View File

@ -1,13 +1,13 @@
local BaseTips = require "app/ui/tips/base_tips"
local RewardBox = class("RewardBox", BaseTips)
local CELL_WIDTH = 138
local CELL_WIDTH = 151
local CELL_NUM = 5
local MIN_SIZE_Y = 426
local MAX_SIZE_Y = 966
local MAX_SIZE_X = 690
local MIN_TITLE_POS_Y = 370
local MIN_TITLE_POS_Y = 264
local MAX_TITLE_POS_Y = 540
function RewardBox:ctor(params)
@ -15,8 +15,8 @@ function RewardBox:ctor(params)
self.params.rewards = params.rewards or {}
self.customTitleStr = params.customTitleStr
self.callback = params.callback
-- self.flyPos = {}
-- self.showFly = false
self.flyPos = {}
self.showFly = false
self.actionStatus = {}
if #self.params.rewards > 35 then
self.showAction = true
@ -44,46 +44,42 @@ function RewardBox:onLoadRootComplete()
self.root:addClickListener(function()
self:closeUI()
-- if self.showFly then
-- local pos = clone(self.flyPos)
-- self:showCurrencyAction(pos)
-- end
if self.showFly then
local pos = clone(self.flyPos)
-- self:showCurrencyAction(pos)
end
if self.callback then
self.callback()
end
end)
self.titleTx = uiMap["reward_box.title_tx"]
self.titleTx:setText(self.customTitleStr or I18N:getGlobalText(I18N.GlobalConst.GET_REWARDS))
self.titleTx = uiMap["reward_box.reward_title"]
self.titleTx:setText(self.customTitleStr or I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC))
uiMap["reward_box.continue_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_CLOSE_DESC))
AudioManager:playEffect(AudioManager.EFFECT_ID.REWARD)
-- AudioManager:playEffect(AudioManager.EFFECT_ID.REWARD)
self:_refreshScrollRect()
end
function RewardBox:_refreshScrollRect(onlyRefresh)
-- for i,v in ipairs(self.params.rewards) do
-- if self.params.rewards[i].type == GConst.REWARD_TYPE.ITEM then
-- if self.params.rewards[i].item.id == GConst.ItemConst.ITEM_ID_GOLD or
-- self.params.rewards[i].item.id == GConst.ItemConst.ITEM_ID_GEM or
-- self.params.rewards[i].item.id == GConst.ItemConst.ITEM_ID_VIT
-- then
-- self.showFly = true
-- local allPos = {}
-- for i = 1, 4 do
-- local posX, posY = GFunc.randomPos(i, {x = 0, y = 0})
-- allPos[i] = {x = posX, y = posY}
-- end
-- self.flyPos[self.params.rewards[i].item.id] = allPos
-- end
-- end
-- end
for i,v in ipairs(self.params.rewards) do
if self.params.rewards[i].type == GConst.REWARD_TYPE.ITEM then
local id = self.params.rewards[i].item.id or self.params.rewards[i].item.cfg_id
if id == GConst.ItemConst.ITEM_ID_GOLD or
id == GConst.ItemConst.ITEM_ID_GEM or
id == GConst.ItemConst.ITEM_ID_VIT
then
self.showFly = true
local allPos = {}
for i = 1, 4 do
local posX, posY = GFunc.randomPos(i, {x = 0, y = 0})
allPos[i] = {x = posX, y = posY}
end
self.flyPos[id] = allPos
end
end
end
-- local offset = 0
-- if #self.params.rewards < 4 then
-- offset = (4 - #self.params.rewards) * CELL_WIDTH / 2
-- end
-- self.scrollView:setAnchoredPositionX(offset)
if #self.params.rewards <= 5 then
self.scrollView:setSizeDelta(#self.params.rewards*CELL_WIDTH, MIN_SIZE_Y)
self.scrollRect:setPerLineNum(#self.params.rewards)

View File

@ -255,6 +255,10 @@ function BattleData:getSkillCount(skillId)
return self.selectSkillMap[skillId] or 0
end
function BattleData:getSelectSkillMap()
return self.selectSkillMap
end
function BattleData:getSkillPool()
return self.skillPool
end