Update - 1.13.0.124
EN: 1.13.0.124 CN: 1.13.0.124 JP: 1.13.0.128 KR: 1.13.0.130
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
local CommonTipsBaseCtrl = require("Game.UI.CommonTipsEx.CommonTipsBaseCtrl")
|
||||
local SoldierCharPotentialDetailCtrl = class("SoldierCharPotentialDetailCtrl", CommonTipsBaseCtrl)
|
||||
SoldierCharPotentialDetailCtrl._mapNodeConfig = {
|
||||
PotentialItem = {},
|
||||
switch_des = {},
|
||||
switch_img_bg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
switch_name = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Potential_Change_Desc"
|
||||
},
|
||||
btnSwitch_on = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SetDes"
|
||||
},
|
||||
btnSwitch_off = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SetSimpleDes"
|
||||
},
|
||||
btnClosePanel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ClosePanel"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtContent = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
SoldierCharPotentialDetailCtrl._mapEventConfig = {}
|
||||
SoldierCharPotentialDetailCtrl._mapRedDotConfig = {}
|
||||
function SoldierCharPotentialDetailCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.rtTarget = param[1]
|
||||
self.nPotentialId = param[2] or 0
|
||||
end
|
||||
end
|
||||
function SoldierCharPotentialDetailCtrl:OnEnable()
|
||||
self:SetData(self.nPotentialId)
|
||||
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
|
||||
local pos = self._mapNode.rtContent.transform.localPosition
|
||||
pos.z = 0
|
||||
self._mapNode.rtContent.transform.localPosition = pos
|
||||
end
|
||||
function SoldierCharPotentialDetailCtrl:OnDisable()
|
||||
end
|
||||
function SoldierCharPotentialDetailCtrl:OnDestroy()
|
||||
end
|
||||
function SoldierCharPotentialDetailCtrl:SetData(nPotentialId)
|
||||
if nPotentialId == nil or nPotentialId == 0 then
|
||||
return
|
||||
end
|
||||
local potentialItemRoot = self._mapNode.PotentialItem.transform:Find("AnimRoot/goPotentialNormal")
|
||||
local txtName = potentialItemRoot:Find("txtName"):GetComponent("TMP_Text")
|
||||
local imgIcon = potentialItemRoot:Find("goIcon/imgIcon3"):GetComponent("Image")
|
||||
local txtDesc = potentialItemRoot:Find("ScrollView/Viewport/Content/txtDesc"):GetComponent("TMP_Text")
|
||||
local potentialConfig = ConfigTable.GetData("SoldierPotential", nPotentialId)
|
||||
NovaAPI.SetTMPText(txtName, potentialConfig.Name)
|
||||
self:SetPngSprite(imgIcon, potentialConfig.Icon)
|
||||
NovaAPI.SetTMPText(txtDesc, potentialConfig.Des)
|
||||
end
|
||||
function SoldierCharPotentialDetailCtrl:OnBtnClick_SetSimpleDes()
|
||||
self:_ApplySimple(true)
|
||||
end
|
||||
function SoldierCharPotentialDetailCtrl:OnBtnClick_SetDes()
|
||||
self:_ApplySimple(false)
|
||||
end
|
||||
function SoldierCharPotentialDetailCtrl:_ApplySimple(bSimple)
|
||||
self.bSimple = bSimple
|
||||
PlayerData.StarTower:SetPotentialDescSimple(bSimple)
|
||||
self:_RefreshSwitch()
|
||||
if self._mapNode.PotentialItem ~= nil then
|
||||
self._mapNode.PotentialItem:ChangeDesc(bSimple)
|
||||
end
|
||||
end
|
||||
function SoldierCharPotentialDetailCtrl:_RefreshSwitch()
|
||||
if self._mapNode.btnSwitch_on ~= nil then
|
||||
self._mapNode.btnSwitch_on.gameObject:SetActive(self.bSimple)
|
||||
end
|
||||
if self._mapNode.btnSwitch_off ~= nil then
|
||||
self._mapNode.btnSwitch_off.gameObject:SetActive(not self.bSimple)
|
||||
end
|
||||
end
|
||||
function SoldierCharPotentialDetailCtrl:OnBtnClick_ClosePanel()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.SoldierCharPontentialDetailPanel)
|
||||
end
|
||||
return SoldierCharPotentialDetailCtrl
|
||||
@@ -0,0 +1,22 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local SoldierCharTalentDetailPanel = class("SoldierCharTalentDetailPanel", BasePanel)
|
||||
SoldierCharTalentDetailPanel._bIsMainPanel = false
|
||||
SoldierCharTalentDetailPanel._bAddToBackHistory = false
|
||||
SoldierCharTalentDetailPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
|
||||
SoldierCharTalentDetailPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Soldier/Tips/CharacterCardTips/SoldierCharPontentialDetailPanel.prefab",
|
||||
sCtrlName = "Game.UI.Soldier.CharacterTips.Components.SoldierCharPotentialDetailCtrl"
|
||||
}
|
||||
}
|
||||
function SoldierCharTalentDetailPanel:Awake()
|
||||
end
|
||||
function SoldierCharTalentDetailPanel:OnEnable()
|
||||
end
|
||||
function SoldierCharTalentDetailPanel:OnDisable()
|
||||
end
|
||||
function SoldierCharTalentDetailPanel:OnDestroy()
|
||||
end
|
||||
function SoldierCharTalentDetailPanel:OnRelease()
|
||||
end
|
||||
return SoldierCharTalentDetailPanel
|
||||
@@ -0,0 +1,46 @@
|
||||
local SoldierCharSkillDetailItemCtrl = class("SoldierCharSkillDetailItemCtrl", BaseCtrl)
|
||||
SoldierCharSkillDetailItemCtrl._mapNodeConfig = {
|
||||
goSkillItem = {
|
||||
sCtrlName = "Game.UI.Soldier.CharacterTips.Items.SoldierCharSkillItemCtrl"
|
||||
},
|
||||
txt_title = {sComponentName = "TMP_Text"},
|
||||
txt_desc = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txt_desc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
},
|
||||
imgLine = {}
|
||||
}
|
||||
SoldierCharSkillDetailItemCtrl._mapEventConfig = {}
|
||||
SoldierCharSkillDetailItemCtrl._mapRedDotConfig = {}
|
||||
function SoldierCharSkillDetailItemCtrl:Awake()
|
||||
end
|
||||
function SoldierCharSkillDetailItemCtrl:OnEnable()
|
||||
end
|
||||
function SoldierCharSkillDetailItemCtrl:OnDisable()
|
||||
end
|
||||
function SoldierCharSkillDetailItemCtrl:OnDestroy()
|
||||
end
|
||||
function SoldierCharSkillDetailItemCtrl:SetData(nSkillId, nSkillIndex, nSkillLevel, bLast)
|
||||
if nSkillId == nil or nSkillId == 0 then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
self.nSkillId = nSkillId
|
||||
self._mapNode.goSkillItem:SetData(nSkillId, nSkillIndex)
|
||||
local skillCfg = ConfigTable.GetData("Skill", nSkillId)
|
||||
if skillCfg == nil then
|
||||
printError("[SoldierCharSkillDetailItemCtrl] Skill 表找不到数据,id:" .. tostring(nSkillId))
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_title, skillCfg.Title)
|
||||
local sDesc = UTILS.ParseDesc(skillCfg, GameEnum.levelTypeData.SoldierLevel, nil, false, nSkillLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_desc, sDesc)
|
||||
self._mapNode.imgLine:SetActive(not bLast)
|
||||
end
|
||||
function SoldierCharSkillDetailItemCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return SoldierCharSkillDetailItemCtrl
|
||||
@@ -0,0 +1,34 @@
|
||||
local SoldierCharSkillItemCtrl = class("SoldierCharSkillItemCtrl", BaseCtrl)
|
||||
SoldierCharSkillItemCtrl._mapNodeConfig = {
|
||||
imgBg = {nCount = 2, sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgType = {sComponentName = "Image"}
|
||||
}
|
||||
SoldierCharSkillItemCtrl._mapEventConfig = {}
|
||||
SoldierCharSkillItemCtrl._mapRedDotConfig = {}
|
||||
function SoldierCharSkillItemCtrl:Awake()
|
||||
end
|
||||
function SoldierCharSkillItemCtrl:OnEnable()
|
||||
end
|
||||
function SoldierCharSkillItemCtrl:OnDisable()
|
||||
end
|
||||
function SoldierCharSkillItemCtrl:OnDestroy()
|
||||
end
|
||||
function SoldierCharSkillItemCtrl:SetData(nSkillId, nSkillIndex)
|
||||
local skillCfg = ConfigTable.GetData_Skill(nSkillId)
|
||||
if nil == skillCfg then
|
||||
printError("找不到技能配置!!技能id = " .. nSkillId)
|
||||
return
|
||||
end
|
||||
local skillShowCfg = AllEnum.SkillTypeShow[nSkillIndex]
|
||||
local bgIconIndex = skillShowCfg.bgIconIndex
|
||||
self:SetAtlasSprite(self._mapNode.imgBg[2], "10_ico", "zs_character_skill_" .. bgIconIndex)
|
||||
local _, color = ColorUtility.TryParseHtmlString(skillShowCfg.bgColor)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgBg[2], Color(color.r, color.g, color.b, 0.19607843137254902))
|
||||
self:SetAtlasSprite(self._mapNode.imgBg[1], "12_rare", "rare_character_skill_6")
|
||||
local skillTypeIconIdx = skillShowCfg.iconIndex
|
||||
self:SetAtlasSprite(self._mapNode.imgType, "05_language", "zs_character_skill_text_" .. skillTypeIconIdx)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgType)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, skillCfg.Icon)
|
||||
end
|
||||
return SoldierCharSkillItemCtrl
|
||||
@@ -0,0 +1,138 @@
|
||||
local CommonTipsBaseCtrl = require("Game.UI.CommonTipsEx.CommonTipsBaseCtrl")
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local SoldierCharSkillDetailCtrl = class("SoldierCharSkillDetailCtrl", CommonTipsBaseCtrl)
|
||||
SoldierCharSkillDetailCtrl._mapNodeConfig = {
|
||||
btnCloseTips = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ClosePanel"
|
||||
},
|
||||
rtContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnCloseWordTip = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_CloseWord"
|
||||
},
|
||||
imgWordTipBg = {},
|
||||
TMPWordDesc = {sComponentName = "TMP_Text"},
|
||||
TMPWordTipsTitle = {sComponentName = "TMP_Text"},
|
||||
imgTipsBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
TipsContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
TipsView = {sComponentName = "ScrollRect"},
|
||||
goSkillDetailItem = {
|
||||
sNodeName = "SoldierCharSkillDetailItem",
|
||||
ComponentName = "Transform"
|
||||
}
|
||||
}
|
||||
SoldierCharSkillDetailCtrl._mapEventConfig = {}
|
||||
SoldierCharSkillDetailCtrl._mapRedDotConfig = {}
|
||||
SoldierCharSkillDetailCtrl.maxTipHeight = 896
|
||||
function SoldierCharSkillDetailCtrl:Awake()
|
||||
self._tbItems = {}
|
||||
self._nCharId = 0
|
||||
self._nStar = 1
|
||||
self._mapNode.goSkillDetailItem.gameObject:SetActive(false)
|
||||
end
|
||||
function SoldierCharSkillDetailCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.rtTarget = tbParam[1]
|
||||
self._nCharId = tbParam[2]
|
||||
self._nStar = tbParam[3] or 1
|
||||
self._bFront = tbParam[4] or false
|
||||
end
|
||||
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
|
||||
self._mapNode.imgWordTipBg:SetActive(false)
|
||||
if self._mapNode.btnShortcutClose ~= nil then
|
||||
self:EnableGamepadUI(self._mapNode.btnShortcutClose, true)
|
||||
end
|
||||
self:_RefreshSkillList()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if self._mapNode == nil then
|
||||
return
|
||||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.TipsContent)
|
||||
local nContentHeight = self._mapNode.TipsContent.rect.height
|
||||
local bExceed = nContentHeight > self.maxTipHeight
|
||||
if bExceed then
|
||||
nContentHeight = self.maxTipHeight
|
||||
end
|
||||
if self._mapNode.TipsView ~= nil then
|
||||
NovaAPI.SetScrollRectVertical(self._mapNode.TipsView, bExceed)
|
||||
end
|
||||
if self._mapNode.imgTipsBg ~= nil then
|
||||
self._mapNode.imgTipsBg.sizeDelta = Vector2(self._mapNode.imgTipsBg.sizeDelta.x, nContentHeight)
|
||||
end
|
||||
if self.rtTarget ~= nil and self._mapNode.rtContent ~= nil and self._mapNode.safeAreaRoot ~= nil then
|
||||
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function SoldierCharSkillDetailCtrl:OnDisable()
|
||||
self:DisableGamepadUI()
|
||||
self:_ClearItems()
|
||||
end
|
||||
function SoldierCharSkillDetailCtrl:OnDestroy()
|
||||
end
|
||||
function SoldierCharSkillDetailCtrl:OnBtnClick_ClosePanel()
|
||||
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
|
||||
end
|
||||
function SoldierCharSkillDetailCtrl:OnBtnClick_CloseWord(btn)
|
||||
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
|
||||
self._mapNode.imgWordTipBg:SetActive(false)
|
||||
end
|
||||
function SoldierCharSkillDetailCtrl:_RefreshSkillList()
|
||||
if self._nCharId == nil or self._nCharId == 0 then
|
||||
return
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("SoldierCharacter", self._nCharId)
|
||||
if mapCfg == nil then
|
||||
printError("[SoldierCharSkillDetailCtrl] SoldierCharacter 表找不到数据,id=" .. tostring(self._nCharId))
|
||||
return
|
||||
end
|
||||
local tbSlots = self._bFront and {
|
||||
{
|
||||
nSkillId = mapCfg.Skill,
|
||||
nIndex = 2
|
||||
}
|
||||
} or {
|
||||
{
|
||||
nSkillId = mapCfg.Support,
|
||||
nIndex = 3
|
||||
}
|
||||
}
|
||||
for _, slot in ipairs(tbSlots) do
|
||||
if slot.nSkillId ~= nil and slot.nSkillId ~= 0 then
|
||||
local goItem = instantiate(self._mapNode.goSkillDetailItem.gameObject, self._mapNode.TipsContent)
|
||||
goItem:SetActive(true)
|
||||
local objCtrl = self:BindCtrlByNode(goItem, "Game.UI.Soldier.CharacterTips.Items.SoldierCharSkillDetailItemCtrl")
|
||||
objCtrl:SetData(slot.nSkillId, slot.nIndex, self._nStar)
|
||||
table.insert(self._tbItems, objCtrl)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierCharSkillDetailCtrl:_ClearItems()
|
||||
if type(self._tbItems) ~= "table" then
|
||||
return
|
||||
end
|
||||
for _, objCtrl in ipairs(self._tbItems) do
|
||||
local goItem = objCtrl.gameObject
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
if goItem ~= nil and goItem:IsNull() == false then
|
||||
destroy(goItem)
|
||||
end
|
||||
end
|
||||
self._tbItems = {}
|
||||
end
|
||||
return SoldierCharSkillDetailCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local SoldierCharSkillDetailPanel = class("SoldierCharSkillDetailPanel", BasePanel)
|
||||
SoldierCharSkillDetailPanel._bIsMainPanel = false
|
||||
SoldierCharSkillDetailPanel._bAddToBackHistory = false
|
||||
SoldierCharSkillDetailPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
|
||||
SoldierCharSkillDetailPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Soldier/Tips/SoldierCharSkillDetailPanel.prefab",
|
||||
sCtrlName = "Game.UI.Soldier.CharacterTips.SoldierCharSkillDetailCtrl"
|
||||
}
|
||||
}
|
||||
function SoldierCharSkillDetailPanel:Awake()
|
||||
end
|
||||
function SoldierCharSkillDetailPanel:OnEnable()
|
||||
end
|
||||
function SoldierCharSkillDetailPanel:OnAfterEnter()
|
||||
end
|
||||
function SoldierCharSkillDetailPanel:OnDisable()
|
||||
end
|
||||
function SoldierCharSkillDetailPanel:OnDestroy()
|
||||
end
|
||||
function SoldierCharSkillDetailPanel:OnRelease()
|
||||
end
|
||||
return SoldierCharSkillDetailPanel
|
||||
@@ -0,0 +1,138 @@
|
||||
local SoldierCharSkillPreviewCtrl = class("SoldierCharSkillPreviewCtrl", BaseCtrl)
|
||||
SoldierCharSkillPreviewCtrl._mapNodeConfig = {
|
||||
rtToggleStar = {},
|
||||
btnLevel = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_BtnLevel"
|
||||
},
|
||||
imgOn = {nCount = 3},
|
||||
imgOff = {nCount = 3},
|
||||
ScrollRoot = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
bgClosePanel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ClosePanel"
|
||||
},
|
||||
grid = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
SoldierCharSkillPreviewCtrl._mapEventConfig = {}
|
||||
SoldierCharSkillPreviewCtrl._mapRedDotConfig = {}
|
||||
function SoldierCharSkillPreviewCtrl:Awake()
|
||||
self._tbItems = {}
|
||||
self._nCharId = 0
|
||||
self._nCurLevel = 0
|
||||
self.mapSkillItemCtrl = {}
|
||||
self._nSkillIndex = 2
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self._nCharId = tbParam[1]
|
||||
self._nSkillIndex = tbParam[2]
|
||||
end
|
||||
self:SetData()
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:OnDisable()
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:OnDestroy()
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:SetData()
|
||||
local bShowToggle = self._nCurLevel == nil or self._nCurLevel == 0
|
||||
if bShowToggle then
|
||||
self._nCurLevel = 1
|
||||
end
|
||||
self._mapNode.rtToggleStar.gameObject:SetActive(bShowToggle)
|
||||
if bShowToggle then
|
||||
self:_RefreshLevelTabUI()
|
||||
end
|
||||
self:_RefreshSkillList()
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:Show(bShow)
|
||||
if self.gameObject ~= nil and self.gameObject:IsNull() == false then
|
||||
self.gameObject:SetActive(bShow == true)
|
||||
end
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:OnBtnClick_BtnLevel(btn, nIdx)
|
||||
if type(nIdx) ~= "number" then
|
||||
return
|
||||
end
|
||||
if nIdx < 1 or 3 < nIdx then
|
||||
return
|
||||
end
|
||||
if self._nCurLevel == nIdx then
|
||||
return
|
||||
end
|
||||
self._nCurLevel = nIdx
|
||||
self:_RefreshLevelTabUI(nIdx)
|
||||
self:_RefreshSkillList(nIdx)
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:OnBtnClick_ClosePanel()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.SoldierCharSkillPreview)
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:_RefreshLevelTabUI()
|
||||
if type(self._mapNode.imgOn) == "table" then
|
||||
for i, goImgOn in ipairs(self._mapNode.imgOn) do
|
||||
goImgOn.gameObject:SetActive(i == self._nCurLevel)
|
||||
end
|
||||
end
|
||||
if type(self._mapNode.imgOff) == "table" then
|
||||
for i, goImgOff in ipairs(self._mapNode.imgOff) do
|
||||
goImgOff.gameObject:SetActive(i ~= self._nCurLevel)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:_RefreshSkillList()
|
||||
if self._nCharId == nil or self._nCharId == 0 then
|
||||
return
|
||||
end
|
||||
self.tbAllSkillIds = {}
|
||||
local mapCfg = ConfigTable.GetData("SoldierCharacter", self._nCharId)
|
||||
local tbSkillId = {}
|
||||
if self._nSkillIndex == 2 then
|
||||
tbSkillId = {
|
||||
mapCfg.Skill
|
||||
}
|
||||
else
|
||||
tbSkillId = {
|
||||
mapCfg.Support
|
||||
}
|
||||
end
|
||||
for nIndex, nSkillId in ipairs(tbSkillId) do
|
||||
if nSkillId ~= nil and nSkillId ~= 0 then
|
||||
table.insert(self.tbAllSkillIds, {
|
||||
nId = nSkillId,
|
||||
nIndex = self._nSkillIndex
|
||||
})
|
||||
end
|
||||
end
|
||||
self:CalGridHeight()
|
||||
self._mapNode.ScrollRoot:InitEx(self.tbAllSkillIdHeight, self, self.OnRefreshSkillItem)
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:CalGridHeight()
|
||||
self.tbAllSkillIdHeight = {}
|
||||
for _, skill in ipairs(self.tbAllSkillIds) do
|
||||
local nSkillId = skill.nId
|
||||
local skillCfg = ConfigTable.GetData("Skill", nSkillId)
|
||||
local sDesc = UTILS.ParseDesc(skillCfg, GameEnum.levelTypeData.SoldierLevel, nil, false, nil, self._nCurLevel)
|
||||
local txtDesc = self._mapNode.grid.transform:Find("ImgdescBg/txt_desc"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtDesc, sDesc)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.grid)
|
||||
local nHeight = self._mapNode.grid.sizeDelta.y
|
||||
table.insert(self.tbAllSkillIdHeight, nHeight)
|
||||
end
|
||||
end
|
||||
function SoldierCharSkillPreviewCtrl:OnRefreshSkillItem(goGrid, gridIndex)
|
||||
local index = gridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
local objCtrl = self.mapSkillItemCtrl[nInstanceId]
|
||||
if objCtrl == nil then
|
||||
objCtrl = self:BindCtrlByNode(goGrid, "Game.UI.Soldier.CharacterTips.Items.SoldierCharSkillDetailItemCtrl")
|
||||
self.mapSkillItemCtrl[nInstanceId] = objCtrl
|
||||
end
|
||||
objCtrl:SetData(self.tbAllSkillIds[index].nId, self.tbAllSkillIds[index].nIndex, self._nCurLevel, index == #self.tbAllSkillIds)
|
||||
end
|
||||
return SoldierCharSkillPreviewCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local SoldierCharSkillPreviewPanel = class("SoldierCharSkillPreviewPanel", BasePanel)
|
||||
SoldierCharSkillPreviewPanel._bIsMainPanel = false
|
||||
SoldierCharSkillPreviewPanel._bAddToBackHistory = false
|
||||
SoldierCharSkillPreviewPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
|
||||
SoldierCharSkillPreviewPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Soldier/Tips/SoldierCharSkillPreviewPanel.prefab",
|
||||
sCtrlName = "Game.UI.Soldier.CharacterTips.SoldierCharSkillPreviewCtrl"
|
||||
}
|
||||
}
|
||||
function SoldierCharSkillPreviewPanel:Awake()
|
||||
end
|
||||
function SoldierCharSkillPreviewPanel:OnEnable()
|
||||
end
|
||||
function SoldierCharSkillPreviewPanel:OnAfterEnter()
|
||||
end
|
||||
function SoldierCharSkillPreviewPanel:OnDisable()
|
||||
end
|
||||
function SoldierCharSkillPreviewPanel:OnDestroy()
|
||||
end
|
||||
function SoldierCharSkillPreviewPanel:OnRelease()
|
||||
end
|
||||
return SoldierCharSkillPreviewPanel
|
||||
@@ -0,0 +1,533 @@
|
||||
local CommonTipsBaseCtrl = require("Game.UI.CommonTipsEx.CommonTipsBaseCtrl")
|
||||
local SoldierAttrData = require("GameCore.Data.DataClass.Soldier.SoldierAttrData")
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local SoldierCharTipsCtrl = class("SoldierCharTipsCtrl", CommonTipsBaseCtrl)
|
||||
SoldierCharTipsCtrl._mapNodeConfig = {
|
||||
btnCloseTips = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ClosePanel"
|
||||
},
|
||||
rtContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnCloseWordTip = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_CloseWord"
|
||||
},
|
||||
imgWordTipBg = {},
|
||||
TMPWordDesc = {sComponentName = "TMP_Text"},
|
||||
TMPWordTipsTitle = {sComponentName = "TMP_Text"},
|
||||
imgTipsBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
TipsContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ScrollView = {sComponentName = "ScrollRect"},
|
||||
rtDescContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
srDesc = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
tc_char_small = {
|
||||
sCtrlName = "Game.UI.Soldier.Template.Character.SoldierCharItemCtrl"
|
||||
},
|
||||
txtTitleName = {sComponentName = "TMP_Text"},
|
||||
txtCost = {sComponentName = "TMP_Text"},
|
||||
txtChessType = {sComponentName = "TMP_Text"},
|
||||
goStar = {sNodeName = "Star", nCount = 5},
|
||||
goPartnerRootLayout = {sComponentName = "Transform"},
|
||||
goPartnerItem = {sComponentName = "Transform"},
|
||||
imgHpBar = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgHpFill = {sComponentName = "Image"},
|
||||
txtHp = {sComponentName = "TMP_Text"},
|
||||
imgEnergyBar = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgEnergyFill = {sComponentName = "Image"},
|
||||
txtEnergy = {sComponentName = "TMP_Text"},
|
||||
goAttrGridLayout = {sComponentName = "Transform"},
|
||||
goPropertyItem = {sComponentName = "Transform"},
|
||||
goBaseInfo = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnTabFront = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Front"
|
||||
},
|
||||
btnTabSupport = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Support"
|
||||
},
|
||||
txtTitleSkill = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Soldier_Handbook_SkillTitle"
|
||||
},
|
||||
goSkillItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.Soldier.CharacterTips.Items.SoldierCharSkillItemCtrl"
|
||||
},
|
||||
btnSkillItem = {
|
||||
nCount = 3,
|
||||
sNodeName = "goSkillItem",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SkillItem"
|
||||
},
|
||||
txtTitlePotential = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Soldier_Handbook_PotentialTitle"
|
||||
},
|
||||
goPotentialList = {sComponentName = "Transform"},
|
||||
goPotentialItem = {sComponentName = "Transform"},
|
||||
go_Vanguard_on = {},
|
||||
go_Vanguard_off = {},
|
||||
go_Support_on = {},
|
||||
go_Support_off = {},
|
||||
txt_Vanguard_on = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Soldier_Vanguard_Skill"
|
||||
},
|
||||
txt_Vanguard_off = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Soldier_Vanguard_Skill"
|
||||
},
|
||||
txt_Support_on = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Soldier_Support_Skill"
|
||||
},
|
||||
txt_Support_off = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Soldier_Support_Skill"
|
||||
},
|
||||
icon_Position = {sComponentName = "Image"},
|
||||
btnShortcutClose = {
|
||||
callback = "OnBtnClick_ClosePanel"
|
||||
},
|
||||
imgBg_Rare = {sComponentName = "Image"},
|
||||
img_Rare = {sComponentName = "Image"},
|
||||
trSkillDetail = {sComponentName = "Transform"},
|
||||
trPontentialDetail = {sComponentName = "Transform"},
|
||||
trPartnerDetail = {sComponentName = "Transform"},
|
||||
imgBG = {sNodeName = "----BG----", sComponentName = "Image"}
|
||||
}
|
||||
SoldierCharTipsCtrl._mapEventConfig = {
|
||||
OnSetTipsPosition = "OnEvent_SetTipsPosition",
|
||||
SoldierCharTips_ShowBg = "OnEvent_ShowBg"
|
||||
}
|
||||
SoldierCharTipsCtrl._mapRedDotConfig = {}
|
||||
SoldierCharTipsCtrl.minTipHeight = 59.13
|
||||
SoldierCharTipsCtrl.maxTipHeight = 896
|
||||
local iconPath = "Icon/SoldierOtherIcon/"
|
||||
local iconPartnerPath = "Icon/SoldierPartner/"
|
||||
local ImgChessRarity = {
|
||||
[GameEnum.ChessRarity.Gold] = "ChessQuality_05_XL",
|
||||
[GameEnum.ChessRarity.Purple] = "ChessQuality_04_XL",
|
||||
[GameEnum.ChessRarity.Blue] = "ChessQuality_03_XL",
|
||||
[GameEnum.ChessRarity.Green] = "ChessQuality_02_XL",
|
||||
[GameEnum.ChessRarity.White] = "ChessQuality_01_XL"
|
||||
}
|
||||
local tbColor = {
|
||||
"#d5ddec",
|
||||
"#d8e8b6",
|
||||
"#a0c8fe",
|
||||
"#caaefa",
|
||||
"#fecc88"
|
||||
}
|
||||
function SoldierCharTipsCtrl:Awake()
|
||||
self._tbPartnerItems = {}
|
||||
self._tbPropertyItems = {}
|
||||
self._tbPotentialItems = {}
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.rtTarget = tbParam[1]
|
||||
self.tbData = tbParam[2]
|
||||
self.tbDeployedChess = tbParam[3] or {}
|
||||
self.tbPartner = tbParam[4] or {}
|
||||
self.tbCurAttr = tbParam[5] or {}
|
||||
end
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnEnable()
|
||||
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
|
||||
self._mapNode.imgWordTipBg:SetActive(false)
|
||||
if self._mapNode.btnShortcutClose ~= nil then
|
||||
self:EnableGamepadUI(self._mapNode.btnShortcutClose, true)
|
||||
end
|
||||
self.nId = self.tbData.nId
|
||||
if self.nId ~= nil then
|
||||
self:Refresh(self.nId, self.tbData)
|
||||
end
|
||||
if self.rtTarget ~= nil and self._mapNode.rtContent ~= nil and self._mapNode.safeAreaRoot ~= nil then
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if self._mapNode == nil then
|
||||
return
|
||||
end
|
||||
local nContentHeight = self._mapNode.rtDescContent.sizeDelta.y
|
||||
if nContentHeight > self.maxTipHeight then
|
||||
nContentHeight = self.maxTipHeight
|
||||
NovaAPI.SetScrollRectVertical(self._mapNode.ScrollView, true)
|
||||
end
|
||||
if nContentHeight < self.minTipHeight then
|
||||
nContentHeight = self.minTipHeight
|
||||
NovaAPI.SetScrollRectVertical(self._mapNode.ScrollView, false)
|
||||
end
|
||||
self._mapNode.srDesc.sizeDelta = Vector2(self._mapNode.srDesc.sizeDelta.x, nContentHeight)
|
||||
local nBaseInfoHeight = 0
|
||||
if self._mapNode.goBaseInfo ~= nil then
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.goBaseInfo)
|
||||
nBaseInfoHeight = self._mapNode.goBaseInfo.rect.height
|
||||
end
|
||||
self._mapNode.imgTipsBg.sizeDelta = Vector2(self._mapNode.imgTipsBg.sizeDelta.x, nContentHeight + nBaseInfoHeight)
|
||||
self._mapNode.srDesc.gameObject:SetActive(false)
|
||||
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
|
||||
self._mapNode.srDesc.gameObject:SetActive(true)
|
||||
if self.bSetTipsPos ~= true then
|
||||
self._mapNode.trSkillDetail.position = self._mapNode.imgTipsBg.position
|
||||
self._mapNode.trPontentialDetail.position = self._mapNode.imgTipsBg.position
|
||||
self._mapNode.trPartnerDetail.position = self._mapNode.imgTipsBg.position
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnDisable()
|
||||
self:DisableGamepadUI()
|
||||
self:_ClearPartnerTags()
|
||||
self:_ClearPropertyItems()
|
||||
self:_ClearPotentialItems()
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnDestroy()
|
||||
end
|
||||
function SoldierCharTipsCtrl:Refresh(nId, tbData)
|
||||
self.nId = nId
|
||||
self.tbData = tbData
|
||||
local mapCfg = ConfigTable.GetData("SoldierCharacter", nId)
|
||||
if mapCfg == nil then
|
||||
printError("[SoldierCharTipsCtrl] SoldierCharacter 表找不到数据,id:" .. tostring(nId))
|
||||
return
|
||||
end
|
||||
self.mapCfg = mapCfg
|
||||
self:_SetBaseInfo(mapCfg, tbData)
|
||||
self:_SetAttr(mapCfg, tbData)
|
||||
self:_SetPotentials(mapCfg)
|
||||
self:_RefreshTabSelect(self.bChosenFont)
|
||||
self:_SetSkills(mapCfg, self.bChosenFont)
|
||||
end
|
||||
function SoldierCharTipsCtrl:_SetPotentials(mapCfg)
|
||||
self._mapNode.goPotentialItem.gameObject:SetActive(false)
|
||||
local tbList = {}
|
||||
for nStar = 1, 4 do
|
||||
local tbIds = mapCfg["Potential" .. nStar]
|
||||
if type(tbIds) == "table" then
|
||||
for _, nId in ipairs(tbIds) do
|
||||
if nId ~= nil and nId ~= 0 then
|
||||
tbList[#tbList + 1] = {nId = nId, nStar = nStar}
|
||||
end
|
||||
end
|
||||
elseif type(tbIds) == "number" and tbIds ~= 0 then
|
||||
tbList[#tbList + 1] = {nId = tbIds, nStar = nStar}
|
||||
end
|
||||
end
|
||||
for _, tbItem in ipairs(tbList) do
|
||||
local goItem = instantiate(self._mapNode.goPotentialItem, self._mapNode.goPotentialList)
|
||||
goItem.gameObject:SetActive(true)
|
||||
local objCtrl = self:BindCtrlByNode(goItem, "Game.UI.Soldier.Template.SoldierPotentialItemCtrl")
|
||||
if objCtrl ~= nil then
|
||||
local nStar = self.tbData.nStar
|
||||
objCtrl:SetItemData(tbItem.nId, tbItem.nStar)
|
||||
if nStar < tbItem.nStar then
|
||||
objCtrl:SetItemLockData(tbItem.nId, tbItem.nStar)
|
||||
end
|
||||
self._tbPotentialItems[#self._tbPotentialItems + 1] = objCtrl
|
||||
end
|
||||
local btnItem = goItem:GetComponent("UIButton")
|
||||
if btnItem ~= nil then
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
btnItem.onClick:AddListener(function()
|
||||
self:OnBtnClick_PotentialItem(tbItem)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierCharTipsCtrl:_SetSkills(mapCfg, bFront)
|
||||
if mapCfg == nil or type(self._mapNode.goSkillItem) ~= "table" then
|
||||
return
|
||||
end
|
||||
if bFront then
|
||||
local tbSlots = {
|
||||
{
|
||||
nSkillId = mapCfg.Skill,
|
||||
nSkillIndex = 2
|
||||
}
|
||||
}
|
||||
for i, objCtrl in ipairs(self._mapNode.goSkillItem) do
|
||||
local slot = tbSlots[i]
|
||||
if slot ~= nil and slot.nSkillId ~= nil and slot.nSkillId ~= 0 then
|
||||
objCtrl.gameObject:SetActive(true)
|
||||
objCtrl:SetData(slot.nSkillId, slot.nSkillIndex)
|
||||
else
|
||||
objCtrl.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
else
|
||||
local nSkillId = mapCfg.Support
|
||||
for i, objCtrl in ipairs(self._mapNode.goSkillItem) do
|
||||
if i == 1 and nSkillId ~= nil and nSkillId ~= 0 then
|
||||
objCtrl.gameObject:SetActive(true)
|
||||
objCtrl:SetData(nSkillId, 3)
|
||||
else
|
||||
objCtrl.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierCharTipsCtrl:_ClearPotentialItems()
|
||||
if type(self._tbPotentialItems) == "table" then
|
||||
for _, objCtrl in ipairs(self._tbPotentialItems) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
end
|
||||
end
|
||||
self._tbPotentialItems = {}
|
||||
end
|
||||
function SoldierCharTipsCtrl:_SetBaseInfo(mapCfg)
|
||||
self._mapNode.tc_char_small:SetItemData(mapCfg.Id)
|
||||
self._mapNode.tc_char_small:SetCharLevel(self.tbData.nStar)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitleName, mapCfg.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCost, mapCfg.Cost)
|
||||
local nChessType = mapCfg.Type
|
||||
local tbChessTypeConfig = CacheTable.GetData("_SoldierChessType", nChessType)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChessType, tbChessTypeConfig.Name)
|
||||
self:SetPngSprite(self._mapNode.icon_Position, iconPath .. tbChessTypeConfig.Icon)
|
||||
self:_SetPartnerTags(mapCfg)
|
||||
self:_SetStar(mapCfg)
|
||||
self:SetPngSprite(self._mapNode.imgBg_Rare, iconPath .. ImgChessRarity[mapCfg.Rarity])
|
||||
local _, rareColor = ColorUtility.TryParseHtmlString(tbColor[mapCfg.Rarity])
|
||||
NovaAPI.SetImageColor(self._mapNode.img_Rare, rareColor)
|
||||
if self.tbData.nPositionType == GameEnum.SoldierPositionType.FightPosition then
|
||||
nChessType = GameEnum.ChessType.Vanguard
|
||||
elseif self.tbData.nPositionType == GameEnum.SoldierPositionType.SupportPosition then
|
||||
nChessType = GameEnum.ChessType.Support
|
||||
end
|
||||
if nChessType == GameEnum.ChessType.Balance or nChessType == GameEnum.ChessType.Vanguard then
|
||||
self:OnBtnClick_Front()
|
||||
else
|
||||
self:OnBtnClick_Support()
|
||||
end
|
||||
end
|
||||
local _TransValueFormat = function(nValue, bPercent, nFormat)
|
||||
return FormatEffectValue(nValue, bPercent, nFormat)
|
||||
end
|
||||
function SoldierCharTipsCtrl:_SetAttr(mapCfg)
|
||||
self:_ClearPropertyItems()
|
||||
self._mapNode.goPropertyItem.gameObject:SetActive(false)
|
||||
local nStar = type(self.tbData) == "table" and self.tbData.nStar or mapCfg.MaxStar or 1
|
||||
local tbAttrSortList, tbAttrMap = SoldierAttrData.CalcCharacterAttr(mapCfg.Id, nStar, self.tbDeployedChess, self.tbPartner)
|
||||
if type(tbAttrSortList) ~= "table" then
|
||||
return
|
||||
end
|
||||
if type(self.tbCurAttr) == "table" and next(self.tbCurAttr) ~= nil then
|
||||
local attrKeyMap = {
|
||||
Hp = "hp",
|
||||
HpMax = "hpMax",
|
||||
Energy = "nMaxEnergy",
|
||||
Atk = "atk",
|
||||
Def = "def",
|
||||
Recovery = "nRecoverRate",
|
||||
CritRate = "critRate",
|
||||
CritPower = "critPower",
|
||||
AttackSpeed = "attackSpeed"
|
||||
}
|
||||
for _, mapAttr in ipairs(tbAttrSortList) do
|
||||
local curAttrKey = attrKeyMap[mapAttr.sKey]
|
||||
if curAttrKey ~= nil and self.tbCurAttr[curAttrKey] ~= nil then
|
||||
mapAttr.nValue = self.tbCurAttr[curAttrKey]
|
||||
print("[SoldierCharTipsCtrl] 实时属性覆盖:", mapAttr.sKey, "=", mapAttr.nValue)
|
||||
end
|
||||
end
|
||||
if tbAttrMap and tbAttrMap.InitialEnergy and self.tbCurAttr.nEnergy ~= nil then
|
||||
tbAttrMap.InitialEnergy.nValue = self.tbCurAttr.nEnergy
|
||||
end
|
||||
end
|
||||
for _, mapAttr in ipairs(tbAttrSortList) do
|
||||
local sKey = mapAttr.sKey
|
||||
if sKey == "Hp" then
|
||||
local nHp = type(self.tbCurAttr) == "table" and self.tbCurAttr.hp ~= nil and self.tbCurAttr.hp or mapAttr.nValue or 0
|
||||
local nMaxHp = type(self.tbCurAttr) == "table" and self.tbCurAttr.hpMax ~= nil and self.tbCurAttr.hpMax or mapAttr.nValue or 0
|
||||
self:_SetBar(self._mapNode.imgHpFill, self._mapNode.txtHp, nHp, nMaxHp, self._mapNode.imgHpBar)
|
||||
elseif sKey == "Energy" then
|
||||
local nMaxEnergy = mapAttr.nValue or 0
|
||||
local nInitEnergy = tbAttrMap and tbAttrMap.InitialEnergy and tbAttrMap.InitialEnergy.nValue or 0
|
||||
self:_SetBar(self._mapNode.imgEnergyFill, self._mapNode.txtEnergy, nInitEnergy, nMaxEnergy, self._mapNode.imgEnergyBar)
|
||||
elseif sKey ~= "InitialEnergy" then
|
||||
local mapAttributeDesc = CacheTable.GetData("_AttributeDesc", sKey)
|
||||
if mapAttributeDesc ~= nil then
|
||||
local goItem = instantiate(self._mapNode.goPropertyItem, self._mapNode.goAttrGridLayout)
|
||||
goItem.gameObject:SetActive(true)
|
||||
local trIcon = goItem:Find("imgIcon")
|
||||
if trIcon ~= nil and mapAttributeDesc.Icon and 0 < #mapAttributeDesc.Icon then
|
||||
local img = trIcon:GetComponent("Image")
|
||||
if img ~= nil then
|
||||
self:SetPngSprite(img, mapAttributeDesc.Icon)
|
||||
end
|
||||
end
|
||||
local trName = goItem:Find("txtProperty")
|
||||
if trName ~= nil then
|
||||
local tmp = trName:GetComponent("TMP_Text")
|
||||
if tmp ~= nil then
|
||||
local sName
|
||||
if mapAttr.sLanguageId ~= nil then
|
||||
sName = ConfigTable.GetUIText(mapAttr.sLanguageId)
|
||||
else
|
||||
sName = mapAttributeDesc.Desc or ""
|
||||
end
|
||||
NovaAPI.SetTMPText(tmp, sName)
|
||||
end
|
||||
end
|
||||
local trValue = goItem:Find("txtValue2")
|
||||
if trValue ~= nil then
|
||||
local tmp = trValue:GetComponent("TMP_Text")
|
||||
if tmp ~= nil then
|
||||
local sValue = _TransValueFormat(mapAttr.nValue or 0, mapAttributeDesc.isPercent, mapAttributeDesc.Format)
|
||||
NovaAPI.SetTMPText(tmp, sValue)
|
||||
print("[SoldierCharTipsCtrl] 属性值:", sKey, "=", sValue)
|
||||
end
|
||||
end
|
||||
self._tbPropertyItems[#self._tbPropertyItems + 1] = goItem
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierCharTipsCtrl:_ClearPropertyItems()
|
||||
if type(self._tbPropertyItems) == "table" then
|
||||
for _, goItem in ipairs(self._tbPropertyItems) do
|
||||
if goItem ~= nil and goItem:IsNull() == false then
|
||||
destroy(goItem.gameObject)
|
||||
end
|
||||
end
|
||||
end
|
||||
self._tbPropertyItems = {}
|
||||
end
|
||||
function SoldierCharTipsCtrl:_SetPartnerTags(mapCfg)
|
||||
self:_ClearPartnerTags()
|
||||
self._mapNode.goPartnerItem.gameObject:SetActive(false)
|
||||
local tbPartner = mapCfg.PartnerType
|
||||
if type(tbPartner) ~= "table" then
|
||||
return
|
||||
end
|
||||
for _, nPartnerType in ipairs(tbPartner) do
|
||||
local mapGroup = CacheTable.GetData("_SoldierPartnerGroup", nPartnerType)
|
||||
if mapGroup ~= nil then
|
||||
local goItem = instantiate(self._mapNode.goPartnerItem, self._mapNode.goPartnerRootLayout)
|
||||
goItem.gameObject:SetActive(true)
|
||||
local txtPartner = goItem:Find("txtPartner")
|
||||
if txtPartner ~= nil then
|
||||
local tmp = txtPartner:GetComponent("TMP_Text")
|
||||
if tmp ~= nil then
|
||||
NovaAPI.SetTMPText(tmp, mapGroup.Name or "")
|
||||
end
|
||||
local trIcon = goItem:Find("imgIcon")
|
||||
if trIcon ~= nil and mapGroup.Icon and #mapGroup.Icon > 0 then
|
||||
local img = trIcon:GetComponent("Image")
|
||||
if img ~= nil then
|
||||
self:SetPngSprite(img, iconPartnerPath .. mapGroup.Icon .. "_M")
|
||||
end
|
||||
end
|
||||
end
|
||||
local btnPartner = goItem:GetComponent("UIButton")
|
||||
if btnPartner ~= nil then
|
||||
btnPartner.onClick:RemoveAllListeners()
|
||||
btnPartner.onClick:AddListener(function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SoldierPartnerTips, self._mapNode.trPartnerDetail, nPartnerType, 0, false, {}, false)
|
||||
end)
|
||||
end
|
||||
self._tbPartnerItems[#self._tbPartnerItems + 1] = goItem
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierCharTipsCtrl:_ClearPartnerTags()
|
||||
if type(self._tbPartnerItems) == "table" then
|
||||
for _, goItem in ipairs(self._tbPartnerItems) do
|
||||
if goItem ~= nil and goItem:IsNull() == false then
|
||||
destroy(goItem.gameObject)
|
||||
end
|
||||
end
|
||||
end
|
||||
self._tbPartnerItems = {}
|
||||
end
|
||||
function SoldierCharTipsCtrl:_SetStar(mapCfg)
|
||||
local nStar = type(self.tbData) == "table" and self.tbData.nStar or mapCfg.MaxStar or 0
|
||||
for i = 1, 5 do
|
||||
if self._mapNode.goStar[i] ~= nil then
|
||||
self._mapNode.goStar[i]:SetActive(i <= nStar)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierCharTipsCtrl:_SetBar(imgFill, txt, nCur, nMax, rtBar)
|
||||
nCur = nCur or 0
|
||||
nMax = nMax or 0
|
||||
if imgFill ~= nil and rtBar ~= nil then
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(rtBar)
|
||||
local nInitWidth = rtBar.rect.width
|
||||
local rt = imgFill.rectTransform
|
||||
if rt ~= nil then
|
||||
local nPct = 0 < nMax and nCur / nMax or 0
|
||||
rt.sizeDelta = Vector2(nInitWidth * nPct, rt.sizeDelta.y)
|
||||
end
|
||||
end
|
||||
if txt ~= nil then
|
||||
NovaAPI.SetTMPText(txt, string.format("%s/%s", tostring(nCur), tostring(nMax)))
|
||||
end
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnBtnClick_ClosePanel()
|
||||
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnBtnClick_Front()
|
||||
self:_RefreshTabSelect(true)
|
||||
self:_SetSkills(self.mapCfg, true)
|
||||
self.bChosenFont = true
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnBtnClick_Support()
|
||||
self:_RefreshTabSelect(false)
|
||||
self:_SetSkills(self.mapCfg, false)
|
||||
self.bChosenFont = false
|
||||
end
|
||||
function SoldierCharTipsCtrl:_RefreshTabSelect(bFront)
|
||||
self._mapNode.go_Vanguard_on.gameObject:SetActive(bFront)
|
||||
self._mapNode.go_Support_on.gameObject:SetActive(not bFront)
|
||||
self._mapNode.go_Vanguard_off.gameObject:SetActive(not bFront)
|
||||
self._mapNode.go_Support_off.gameObject:SetActive(bFront)
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnBtnClick_SkillItem(btn, nIndex)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SoldierCharSkillDetail, self._mapNode.trSkillDetail, self.nId, self.tbData.nStar, self.bChosenFont)
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnBtnClick_PotentialItem(tbItem)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SoldierCharPontentialDetailPanel, self._mapNode.trPontentialDetail, tbItem.nId)
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnBtnClick_CloseWord(btn)
|
||||
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
|
||||
self._mapNode.imgWordTipBg:SetActive(false)
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnEvent_ShowBg()
|
||||
self._mapNode.imgBG.enabled = true
|
||||
end
|
||||
function SoldierCharTipsCtrl:OnEvent_SetTipsPosition(skillTipsPos, pontentialTipsPos, partnerTipsPos)
|
||||
self.bSetTipsPos = true
|
||||
if skillTipsPos ~= nil and self._mapNode.trSkillDetail ~= nil then
|
||||
self._mapNode.trSkillDetail.position = skillTipsPos
|
||||
end
|
||||
if pontentialTipsPos ~= nil and self._mapNode.trPontentialDetail ~= nil then
|
||||
self._mapNode.trPontentialDetail.position = pontentialTipsPos
|
||||
end
|
||||
if partnerTipsPos ~= nil and self._mapNode.trPartnerDetail ~= nil then
|
||||
self._mapNode.trPartnerDetail.position = partnerTipsPos
|
||||
end
|
||||
end
|
||||
return SoldierCharTipsCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local SoldierCharTipsPanel = class("SoldierCharTipsPanel", BasePanel)
|
||||
SoldierCharTipsPanel._bIsMainPanel = false
|
||||
SoldierCharTipsPanel._bAddToBackHistory = false
|
||||
SoldierCharTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
|
||||
SoldierCharTipsPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Soldier/Tips/SoldierCharCardTipsPanel.prefab",
|
||||
sCtrlName = "Game.UI.Soldier.CharacterTips.SoldierCharTipsCtrl"
|
||||
}
|
||||
}
|
||||
function SoldierCharTipsPanel:Awake()
|
||||
end
|
||||
function SoldierCharTipsPanel:OnEnable()
|
||||
end
|
||||
function SoldierCharTipsPanel:OnAfterEnter()
|
||||
end
|
||||
function SoldierCharTipsPanel:OnDisable()
|
||||
end
|
||||
function SoldierCharTipsPanel:OnDestroy()
|
||||
end
|
||||
function SoldierCharTipsPanel:OnRelease()
|
||||
end
|
||||
return SoldierCharTipsPanel
|
||||
Reference in New Issue
Block a user