技能tips
This commit is contained in:
parent
8d131457f6
commit
528ac6a89b
@ -1,5 +1,7 @@
|
|||||||
local LocalizationGlobalConst =
|
local LocalizationGlobalConst =
|
||||||
{
|
{
|
||||||
|
BATTLE_DESC_9 = "BATTLE_DESC_9",
|
||||||
|
BATTLE_DESC_10 = "BATTLE_DESC_10",
|
||||||
MAIN_BTN_1 = "MAIN_BTN_1",
|
MAIN_BTN_1 = "MAIN_BTN_1",
|
||||||
QLT_DESC_1 = "QLT_DESC_1",
|
QLT_DESC_1 = "QLT_DESC_1",
|
||||||
QLT_DESC_2 = "QLT_DESC_2",
|
QLT_DESC_2 = "QLT_DESC_2",
|
||||||
|
|||||||
@ -116,6 +116,9 @@ local localization_global =
|
|||||||
["BTN_DELETE_ALL_READ_MAIL"] = "删除已读邮件",
|
["BTN_DELETE_ALL_READ_MAIL"] = "删除已读邮件",
|
||||||
["BTN_CLAIM_ALL"] = "领取所有",
|
["BTN_CLAIM_ALL"] = "领取所有",
|
||||||
["BTN_READ"] = "读取",
|
["BTN_READ"] = "读取",
|
||||||
|
|
||||||
|
["BATTLE_DESC_9"] = "{0}攻击力:<color=#ffffff>{1}</color>",
|
||||||
|
["BATTLE_DESC_10"] = "已激活效果",
|
||||||
}
|
}
|
||||||
|
|
||||||
return localization_global
|
return localization_global
|
||||||
@ -135,6 +135,7 @@ GConst.TYPEOF_UNITY_CLASS = {
|
|||||||
BF_TUTORIAL_CLICKAREA = typeof(CS.BF.TutorialClickArea),
|
BF_TUTORIAL_CLICKAREA = typeof(CS.BF.TutorialClickArea),
|
||||||
BF_CAMERA_HELPER = typeof(CS.BF.CameraHelper),
|
BF_CAMERA_HELPER = typeof(CS.BF.CameraHelper),
|
||||||
BF_HORIZONTAL_OR_VERTICAL_LAYOUT = typeof(CS.BF.BFHorizontalOrVerticalLayout),
|
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 = typeof(CS.BF.ScrollRectCenterController),
|
||||||
BF_SCROLL_RECT_CENTER_CORE = typeof(CS.BF.ScrollRectCenter),
|
BF_SCROLL_RECT_CENTER_CORE = typeof(CS.BF.ScrollRectCenter),
|
||||||
BF_GRAPHIC_FLIP = typeof(CS.BF.BFGraphicFlip),
|
BF_GRAPHIC_FLIP = typeof(CS.BF.BFGraphicFlip),
|
||||||
|
|||||||
@ -26,6 +26,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
------------------------------------------ 英雄相关的工具方法 ------------------------------
|
------------------------------------------ 英雄相关的工具方法 ------------------------------
|
||||||
|
function HeroManager:getHeroName(id)
|
||||||
|
return I18N:getConfig("hero")[id].name
|
||||||
|
end
|
||||||
|
|
||||||
function HeroManager:getHeroIcon(heroId)
|
function HeroManager:getHeroIcon(heroId)
|
||||||
local cfg = ConfigManager:getConfig("hero")[heroId]
|
local cfg = ConfigManager:getConfig("hero")[heroId]
|
||||||
return cfg and tostring(cfg.icon)
|
return cfg and tostring(cfg.icon)
|
||||||
|
|||||||
@ -111,6 +111,20 @@ function TipsManager:getRewardDesc(rewardId, rewardType)
|
|||||||
return GConst.EMPTY_STRING
|
return GConst.EMPTY_STRING
|
||||||
end
|
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)
|
function TipsManager:getCornerScreenPosition(tarPrefabObj, alignType)
|
||||||
local uiCamera = UIManager:getUICameraComponent()
|
local uiCamera = UIManager:getUICameraComponent()
|
||||||
local rectTransform = tarPrefabObj:getComponent(GConst.TYPEOF_UNITY_CLASS.RECTTRANSFORM)
|
local rectTransform = tarPrefabObj:getComponent(GConst.TYPEOF_UNITY_CLASS.RECTTRANSFORM)
|
||||||
|
|||||||
@ -134,6 +134,9 @@ function BattleUI:initSkill()
|
|||||||
self.skillNodeCells[elementType]:refresh(skillEntity)
|
self.skillNodeCells[elementType]:refresh(skillEntity)
|
||||||
end
|
end
|
||||||
self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
|
self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
|
||||||
|
self.skillNodeCells[elementType]:addClickListener(function()
|
||||||
|
ModuleManager.TipsManager:showBattleBoardSkillTips(elementType)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -57,4 +57,10 @@ function SkillNodeCell:refresh(skillEntity, elementMap, showSfx)
|
|||||||
self.lastValue = value
|
self.lastValue = value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SkillNodeCell:addClickListener(func)
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
local iconNode = uiMap["skill_node_cell.icon_node"]
|
||||||
|
iconNode:addClickListener(func)
|
||||||
|
end
|
||||||
|
|
||||||
return SkillNodeCell
|
return SkillNodeCell
|
||||||
115
lua/app/ui/tips/battle_board_skill_tips.lua
Normal file
115
lua/app/ui/tips/battle_board_skill_tips.lua
Normal 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
|
||||||
10
lua/app/ui/tips/battle_board_skill_tips.lua.meta
Normal file
10
lua/app/ui/tips/battle_board_skill_tips.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7c2687668f1925246a6f78bf3b8defd1
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -521,11 +521,9 @@ end
|
|||||||
|
|
||||||
function BattleData:addCommonSelectSkillCount(count)
|
function BattleData:addCommonSelectSkillCount(count)
|
||||||
self.commonSelectSkillCount = self.commonSelectSkillCount + (count or 1)
|
self.commonSelectSkillCount = self.commonSelectSkillCount + (count or 1)
|
||||||
Logger.logHighlight("self.commonSelectSkillCount " .. self.commonSelectSkillCount)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleData:useCommonSelectSkillCount()
|
function BattleData:useCommonSelectSkillCount()
|
||||||
Logger.logHighlight("useCommonSelectSkillCount " .. self.commonSelectSkillCount)
|
|
||||||
if self.commonSelectSkillCount <= 0 then
|
if self.commonSelectSkillCount <= 0 then
|
||||||
self.commonSelectSkillCount = 0
|
self.commonSelectSkillCount = 0
|
||||||
return false
|
return false
|
||||||
|
|||||||
@ -222,7 +222,7 @@ function HeroEntity:getHurtNum()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getName()
|
function HeroEntity:getName()
|
||||||
return I18N:getConfig("hero")[self:getCfgId()].name
|
return ModuleManager.HeroManager:getHeroName(self:getCfgId())
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroEntity:getActiveRogueCount()
|
function HeroEntity:getActiveRogueCount()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user