Initial version - 1.2.0.60

EN: 1.2.0.60
CN: 1.2.0.61
JP: 1.2.0.63
KR: 1.2.0.67
This commit is contained in:
SL1900
2025-12-03 01:00:00 +09:00
commit 5e0d58cfad
3595 changed files with 9373562 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
local BtnTipsCtrl = class("BtnTipsCtrl", BaseCtrl)
BtnTipsCtrl._mapNodeConfig = {
BtnScreen = {sComponentName = "Button", callback = "OnBtnClick"}
}
BtnTipsCtrl._mapEventConfig = {}
function BtnTipsCtrl:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.callback = tbParam[1]
end
end
function BtnTipsCtrl:FadeIn()
end
function BtnTipsCtrl:FadeOut()
end
function BtnTipsCtrl:OnEnable()
end
function BtnTipsCtrl:OnDisable()
end
function BtnTipsCtrl:OnDestroy()
end
function BtnTipsCtrl:OnRelease()
end
function BtnTipsCtrl:OnBtnClick()
if type(self.callback) == "function" then
self.callback()
end
EventManager.Hit(EventId.ClosePanel, PanelId.BtnTips)
end
return BtnTipsCtrl
+21
View File
@@ -0,0 +1,21 @@
local BtnTipsPanel = class("BtnTipsPanel", BasePanel)
BtnTipsPanel._bIsMainPanel = false
BtnTipsPanel._bAddToBackHistory = false
BtnTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
BtnTipsPanel._tbDefine = {
{
sPrefabPath = "CommonTipsEx/ButtonTips.prefab",
sCtrlName = "Game.UI.CommonTipsEx.BtnTipsCtrl"
}
}
function BtnTipsPanel:Awake()
end
function BtnTipsPanel:OnEnable()
end
function BtnTipsPanel:OnDisable()
end
function BtnTipsPanel:OnDestroy()
end
function BtnTipsPanel:OnRelease()
end
return BtnTipsPanel
@@ -0,0 +1,55 @@
local CommonTipsBaseCtrl = class("CommonTipsBaseCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local nOffsetBottom = -148
local nContentEdge = 4
local nArrowOffect = 9.5
local leftSafeEdge = 30
CommonTipsBaseCtrl.minTipHeight = 300
CommonTipsBaseCtrl.maxTipHeight = 770
function CommonTipsBaseCtrl:EnableGamepadUI(btn)
if GamepadUIManager.GetInputState() then
btn.gameObject:SetActive(true)
GamepadUIManager.EnableGamepadUI("CommonTipsBaseCtrl", self:GetGamepadUINode())
end
end
function CommonTipsBaseCtrl:DisableGamepadUI()
if GamepadUIManager.GetInputState() then
GamepadUIManager.DisableGamepadUI("CommonTipsBaseCtrl")
end
end
function CommonTipsBaseCtrl:SetTipsPosition(rtTarget, rtContent, safeAreaRoot)
local rtTargetRect = rtTarget:GetComponent("RectTransform")
local rtTipsContent = rtContent:Find("rtTipsPoint/imgTipsBg"):GetComponent("RectTransform")
local rtArrow = rtContent:Find("rtTipsPoint/imgArrow"):GetComponent("RectTransform")
local rtTipsPoint = rtContent:Find("rtTipsPoint"):GetComponent("RectTransform")
local screenHeight = safeAreaRoot.rect.size.y
local screenWidth = safeAreaRoot.rect.size.x
local nTipHeight = rtTipsContent.sizeDelta.y
local nTipWidth = rtTipsContent.sizeDelta.x
local niconSize = rtTargetRect.sizeDelta.x
local nIconScale = rtTargetRect.localScale.x
local nFinalSize = niconSize * nIconScale
rtContent.sizeDelta = Vector2(nFinalSize, nFinalSize)
rtContent.position = rtTarget.transform.position
local nFactor = -1
if rtContent.anchoredPosition.x + nContentEdge - 0.5 * nFinalSize - nTipWidth - nArrowOffect - leftSafeEdge < -(0.5 * screenWidth) then
nFactor = 1
end
local xPoint = 0.5 * nFinalSize * nFactor
local xArrow = nArrowOffect * nFactor
local xTip = 0.5 * nTipWidth * nFactor - nContentEdge * nFactor
local nTipsContentYOffest = 0
if rtContent.anchoredPosition.y + nOffsetBottom + nTipHeight > 0.5 * screenHeight - 30 then
nTipsContentYOffest = rtContent.anchoredPosition.y + nOffsetBottom + nTipHeight - (0.5 * screenHeight - 30)
elseif rtContent.anchoredPosition.y + nOffsetBottom < -0.5 * screenHeight + 30 then
nTipsContentYOffest = rtContent.anchoredPosition.y + nOffsetBottom - (-0.5 * screenHeight + 30)
end
local yTip = nOffsetBottom - nTipsContentYOffest
rtTipsPoint.anchoredPosition = Vector2(xPoint, 0)
rtArrow.anchoredPosition = Vector2(xArrow, 0)
rtTipsContent.anchoredPosition = Vector2(xTip, yTip)
rtArrow.localScale = Vector3(-nFactor, 1, 1)
local cg = rtContent:GetComponent("CanvasGroup")
NovaAPI.SetCanvasGroupAlpha(cg, 1)
end
return CommonTipsBaseCtrl
@@ -0,0 +1,144 @@
local BaseCtrl = require("Game.UI.CommonTipsEx.CommonTipsBaseCtrl")
local DiscSkillTipsCtrl = class("DiscSkillTipsCtrl", BaseCtrl)
DiscSkillTipsCtrl._mapNodeConfig = {
btnCloseTips = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClosePanel"
},
btnCloseWordTip = {
sComponentName = "Button",
callback = "OnBtnClick_CloseWord"
},
imgWordTipBg = {},
TMPWordDesc = {sComponentName = "TMP_Text"},
TMPWordTipsTitle = {sComponentName = "TMP_Text"},
imgTipsBg = {
sComponentName = "RectTransform"
},
rtContent = {
sComponentName = "RectTransform"
},
rtContentCanvasGroup = {
sNodeName = "rtContent",
sComponentName = "CanvasGroup"
},
TipsContent = {
sComponentName = "RectTransform"
},
safeAreaRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "RectTransform"
},
ScrollView = {sComponentName = "ScrollRect"},
rtDescContent = {
sComponentName = "RectTransform"
},
srDesc = {
sComponentName = "RectTransform"
},
txtSkillName = {sComponentName = "TMP_Text"},
imgIcon = {sComponentName = "Image"},
imgIconBg = {sComponentName = "Image"},
txtSubSkillDesc = {sComponentName = "TMP_Text"},
TMP_Link = {
sNodeName = "txtSubSkillDesc",
sComponentName = "TMPHyperLink",
callback = "OnLinkClick_Word"
},
btnShortcutClose = {
sComponentName = "NaviButton",
callback = "OnBtnClick_ClosePanel"
},
exId = {sComponentName = "TMP_Text"}
}
DiscSkillTipsCtrl._mapEventConfig = {}
DiscSkillTipsCtrl._mapRedDotConfig = {}
DiscSkillTipsCtrl.minTipHeight = 59.13
DiscSkillTipsCtrl.maxTipHeight = 481.4
local titleHeight = 140.2
function DiscSkillTipsCtrl:Refresh(mapData)
self.nSkillId = mapData.nSkillId
self:RefreshSubSkill()
end
function DiscSkillTipsCtrl:RefreshSubSkill()
local skillCfg = ConfigTable.GetData("SecondarySkill", self.nSkillId)
if not skillCfg then
return
end
NovaAPI.SetTMPText(self._mapNode.txtSkillName, skillCfg.Name)
self:SetPngSprite(self._mapNode.imgIcon, skillCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
self:SetPngSprite(self._mapNode.imgIconBg, skillCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Small)
local sDesc = UTILS.ParseParamDesc(skillCfg.Desc, skillCfg)
NovaAPI.SetTMPText(self._mapNode.txtSubSkillDesc, sDesc)
end
function DiscSkillTipsCtrl:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.rtTarget = tbParam[1]
self.mapData = tbParam[2]
end
end
function DiscSkillTipsCtrl:OnEnable()
self:EnableGamepadUI(self._mapNode.btnShortcutClose)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtContentCanvasGroup, 0)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
self.sortingOrder = NovaAPI.GetCanvasSortingOrder(self.gameObject:GetComponent("Canvas"))
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = false
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", true)
NovaAPI.SetTopGridCanvasSorting(self.rtTarget.gameObject, self.sortingOrder)
self:Refresh(self.mapData)
self._mapNode.exId.gameObject:SetActive(false)
EventManager.Hit("TipsId", self._mapNode.exId, self.nSkillId)
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
print(nContentHeight)
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)
self._mapNode.imgTipsBg.sizeDelta = Vector2(self._mapNode.imgTipsBg.sizeDelta.x, nContentHeight + titleHeight)
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtContentCanvasGroup, 1)
end
cs_coroutine.start(wait)
end
function DiscSkillTipsCtrl:OnDisable()
self:DisableGamepadUI()
end
function DiscSkillTipsCtrl:OnBtnClick_CloseWordTips()
self._mapNode.btn_CloseWordTips.gameObject:SetActive(false)
self._mapNode.go_WordTip:SetActive(false)
if self.funcCloseTips ~= nil and self.mapParent ~= nil then
self.funcCloseTips(self.mapParent)
end
end
function DiscSkillTipsCtrl:OnLinkClick_Word(link, sWordId)
UTILS.ClickWordLink(link, sWordId)
end
function DiscSkillTipsCtrl:OnBtnClick_ClosePanel(btn)
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = true
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", false)
EventManager.Hit(EventId.ClosePanel, PanelId.DiscSkillTips)
end
function DiscSkillTipsCtrl:OnBtnClick_CloseWord(btn)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
end
return DiscSkillTipsCtrl
@@ -0,0 +1,21 @@
local DiscSkillTipsPanel = class("DiscSkillTipsPanel", BasePanel)
DiscSkillTipsPanel._bIsMainPanel = false
DiscSkillTipsPanel._bAddToBackHistory = false
DiscSkillTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
DiscSkillTipsPanel._tbDefine = {
{
sPrefabPath = "CommonTipsEx/DiscSkillTips.prefab",
sCtrlName = "Game.UI.CommonTipsEx.DiscSkillTipsCtrl"
}
}
function DiscSkillTipsPanel:Awake()
end
function DiscSkillTipsPanel:OnEnable()
end
function DiscSkillTipsPanel:OnDisable()
end
function DiscSkillTipsPanel:OnDestroy()
end
function DiscSkillTipsPanel:OnRelease()
end
return DiscSkillTipsPanel
@@ -0,0 +1,257 @@
local BaseCtrl = require("Game.UI.CommonTipsEx.CommonTipsBaseCtrl")
local EquipmentTipsCtrl = class("EquipmentTipsCtrl", BaseCtrl)
EquipmentTipsCtrl._mapNodeConfig = {
btnCloseTips = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClosePanel"
},
btnCloseWordTip = {
sComponentName = "Button",
callback = "OnBtnClick_CloseWord"
},
imgWordTipBg = {},
TMPWordDesc = {sComponentName = "TMP_Text"},
TMPWordTipsTitle = {sComponentName = "TMP_Text"},
imgTipsBg = {
sComponentName = "RectTransform"
},
rtContent = {
sComponentName = "RectTransform"
},
rtContentCanvasGroup = {
sNodeName = "rtContent",
sComponentName = "CanvasGroup"
},
TipsContent = {
sComponentName = "RectTransform"
},
safeAreaRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "RectTransform"
},
srDesc = {
sComponentName = "RectTransform"
},
ScrollView = {sComponentName = "ScrollRect"},
Content = {
sComponentName = "RectTransform"
},
txtTipName = {sComponentName = "TMP_Text"},
goStar = {
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
},
txtTipLevel = {sComponentName = "TMP_Text"},
txtTipLevelCn = {sComponentName = "TMP_Text"},
btnLock = {
sComponentName = "UIButton",
callback = "OnBtnClick_Lock"
},
imgLock = {},
imgUnlock = {},
imgEquipType = {sComponentName = "Image"},
txtEquipmentType = {sComponentName = "TMP_Text"},
txtEquipped = {sComponentName = "TMP_Text"},
goBaseProperty = {},
goRandomProperty = {nCount = 3},
txtTipBaseAttr = {
sComponentName = "TMP_Text",
sLanguageId = "Equipment_Base_Attr_Title"
},
rtBaseAttr = {
sComponentName = "RectTransform"
},
txtTipRandomAttr = {
sComponentName = "TMP_Text",
sLanguageId = "Equipment_Random_Attr_Title"
},
rtRandomAttr = {
sComponentName = "RectTransform"
},
txtTipDesc = {
sComponentName = "TMP_Text",
sLanguageId = "Equipment_Desc_Title"
},
btnShortcutClose = {
sComponentName = "NaviButton",
callback = "OnBtnClick_ClosePanel"
}
}
EquipmentTipsCtrl._mapEventConfig = {}
EquipmentTipsCtrl.minTipHeight = 87
EquipmentTipsCtrl.maxTipHeight = 587.6
local titleHeight = 285.87
local random_attr_normal = 1
local random_attr_match = 2
local random_attr_lock = 3
function EquipmentTipsCtrl:Refresh(nId, mapEquip, nCharId)
local nChar, equipmentData
if nId ~= nil and nId ~= 0 then
self.nEquipmentId = nId
equipmentData = PlayerData.Equipment:GetEquipmentById(nId)
nChar = PlayerData.Char:GetCharByEquipment(nId)
elseif mapEquip ~= nil then
equipmentData = mapEquip
self.nEquipmentId = 0
nChar = nCharId
end
if nil ~= equipmentData then
NovaAPI.SetTMPText(self._mapNode.txtTipName, equipmentData:GetName())
self._mapNode.goStar:SetStar(equipmentData:GetStar(), equipmentData:GetStar())
NovaAPI.SetTMPText(self._mapNode.txtTipLevel, equipmentData:GetLevel())
self:ChangeLock(equipmentData:GetLock())
self:SetPngSprite(self._mapNode.imgEquipType, equipmentData:GetTypeIcon())
NovaAPI.SetTMPText(self._mapNode.txtEquipmentType, equipmentData:GetTypeDesc())
self._mapNode.txtEquipped.gameObject:SetActive(nil ~= nChar and nChar ~= 0)
if nil ~= nChar and nChar ~= 0 then
local charCfg = ConfigTable.GetData_Character(nChar)
NovaAPI.SetTMPText(self._mapNode.txtEquipped, charCfg.Name .. ConfigTable.GetUIText("Equipment_Equipped"))
end
self._mapNode.goBaseProperty.gameObject:SetActive(false)
for _, v in ipairs(self._mapNode.goRandomProperty) do
v.gameObject:SetActive(false)
end
delChildren(self._mapNode.rtBaseAttr.gameObject)
local tbBaseAttr = equipmentData:GetBaseAttr()
if next(tbBaseAttr) ~= nil then
for _, mapAttachAttr in pairs(AllEnum.AttachAttr) do
local mapAttr = tbBaseAttr[mapAttachAttr.sKey]
if 0 < mapAttr.Value then
local goItemObj = instantiate(self._mapNode.goBaseProperty, self._mapNode.rtBaseAttr)
goItemObj:SetActive(true)
local ctrlItem = self:BindCtrlByNode(goItemObj, "Game.UI.TemplateEx.TemplatePropertyCtrl")
ctrlItem:SetItemProperty(mapAttr.Key, mapAttr.Value, nil, true)
end
end
end
delChildren(self._mapNode.rtRandomAttr.gameObject)
local tbCharTag = {}
if nChar ~= 0 then
local mapCharDescCfg = ConfigTable.GetData("CharacterDes", nChar)
for _, v in ipairs(mapCharDescCfg.Tag) do
tbCharTag[v] = v
end
end
local nMatchAddition = PlayerData.Equipment:GetEquipmentMatchAddition()
local tbRandomAttr = equipmentData:GetRandomAttr()
local tbTag = equipmentData:GetTag()
local nLevel = equipmentData:GetLevel()
for k, v in ipairs(tbRandomAttr) do
local nIndex = 0
if nLevel < v.UnlockLv then
nIndex = random_attr_lock
elseif tbCharTag[tbTag[k]] ~= nil then
nIndex = random_attr_match
else
nIndex = random_attr_normal
end
local goItemObj = instantiate(self._mapNode.goRandomProperty[nIndex], self._mapNode.rtRandomAttr)
goItemObj:SetActive(true)
local ctrlItem = self:BindCtrlByNode(goItemObj, "Game.UI.TemplateEx.TemplateRandomPropertyCtrl")
if nLevel < v.UnlockLv then
ctrlItem:SetAttrLock(tbTag[k], v.UnlockLv)
else
local nValue = v.Value
if nIndex == random_attr_match then
nValue = nValue * (1 + nMatchAddition)
end
ctrlItem:SetProperty(tbTag[k], v.AttrId, nValue)
end
end
end
end
function EquipmentTipsCtrl:ChangeLock(bLock)
self.bLock = bLock
self._mapNode.imgLock.gameObject:SetActive(bLock)
self._mapNode.imgUnlock.gameObject:SetActive(not bLock)
end
function EquipmentTipsCtrl:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.rtTarget = tbParam[1]
self.mapData = tbParam[2]
end
end
function EquipmentTipsCtrl:OnEnable()
self:EnableGamepadUI(self._mapNode.btnShortcutClose)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtContentCanvasGroup, 0)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
self.sortingOrder = NovaAPI.GetCanvasSortingOrder(self.gameObject:GetComponent("Canvas"))
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = false
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", true)
NovaAPI.SetTopGridCanvasSorting(self.rtTarget.gameObject, self.sortingOrder)
local bHideLock = self.mapData.bHideLock
self._mapNode.btnLock.gameObject:SetActive(not bHideLock)
self:Refresh(self.mapData.nId, self.mapData.equipmentData, self.mapData.nCharId)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local nContentHeight = self._mapNode.Content.sizeDelta.y
print(nContentHeight)
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)
self._mapNode.imgTipsBg.sizeDelta = Vector2(self._mapNode.imgTipsBg.sizeDelta.x, nContentHeight + titleHeight)
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtContentCanvasGroup, 1)
end
cs_coroutine.start(wait)
end
function EquipmentTipsCtrl:OnDisable()
self:DisableGamepadUI()
end
function EquipmentTipsCtrl:OnBtnClick_Close()
end
function EquipmentTipsCtrl:OnBtnClick_Lock()
local callback = function(bLock)
EventManager.Hit(EventId.EquipmentChangeLockState, self.nEquipmentId)
local equipmentData = PlayerData.Equipment:GetEquipmentById(self.nEquipmentId)
if bLock then
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Tips,
bPositive = true,
sContent = orderedFormat(ConfigTable.GetUIText("Equipment_Lock_Suc"), equipmentData:GetName())
})
else
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Tips,
bPositive = true,
sContent = orderedFormat(ConfigTable.GetUIText("Equipment_Unlock_Suc"), equipmentData.sName)
})
end
self:ChangeLock(bLock)
end
PlayerData.Equipment:SendEquipmentLockUnlockReq(self.nEquipmentId, not self.bLock, callback)
end
function EquipmentTipsCtrl:OnBtnClick_CloseWordTips()
self._mapNode.btn_CloseWordTips.gameObject:SetActive(false)
self._mapNode.go_WordTip:SetActive(false)
if self.funcCloseTips ~= nil and self.mapParent ~= nil then
self.funcCloseTips(self.mapParent)
end
end
function EquipmentTipsCtrl:OnLinkClick_Word(link, sWordId)
UTILS.ClickWordLink(link, sWordId)
end
function EquipmentTipsCtrl:OnBtnClick_ClosePanel(btn)
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = true
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", false)
EventManager.Hit(EventId.ClosePanel, PanelId.EquipmentTips)
end
function EquipmentTipsCtrl:OnBtnClick_CloseWord(btn)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
end
return EquipmentTipsCtrl
@@ -0,0 +1,21 @@
local EquipmentTipsPanel = class("EquipmentTipsPanel", BasePanel)
EquipmentTipsPanel._bIsMainPanel = false
EquipmentTipsPanel._bAddToBackHistory = false
EquipmentTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
EquipmentTipsPanel._tbDefine = {
{
sPrefabPath = "CommonTipsEx/EquipmentTips.prefab",
sCtrlName = "Game.UI.CommonTipsEx.EquipmentTipsCtrl"
}
}
function EquipmentTipsPanel:Awake()
end
function EquipmentTipsPanel:OnEnable()
end
function EquipmentTipsPanel:OnDisable()
end
function EquipmentTipsPanel:OnDestroy()
end
function EquipmentTipsPanel:OnRelease()
end
return EquipmentTipsPanel
+388
View File
@@ -0,0 +1,388 @@
local BaseCtrl = require("Game.UI.CommonTipsEx.CommonTipsBaseCtrl")
local ItemTipsCtrl = class("ItemTipsCtrl", BaseCtrl)
local JumpUtil = require("Game.Common.Utils.JumpUtil")
ItemTipsCtrl.minTipHeight = 87
ItemTipsCtrl.maxTipHeight = 557
local titleHeight = 240
local halfTitleNameHeight = 45
local MoveUpHeight = 45
local textTitleWidthWithDetail = 460
local textTitleWidth = 560
ItemTipsCtrl._mapNodeConfig = {
btnCloseTips = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClosePanel"
},
btnCloseWordTip = {
sComponentName = "Button",
callback = "OnBtnClick_CloseWord"
},
imgWordTipBg = {},
TMPWordDesc = {sComponentName = "TMP_Text"},
TMPWordTipsTitle = {sComponentName = "TMP_Text"},
imgTipsBg = {
sComponentName = "RectTransform"
},
rtContent = {
sComponentName = "RectTransform"
},
TipsContent = {
sComponentName = "RectTransform"
},
safeAreaRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "RectTransform"
},
TMPItemTitle = {sComponentName = "TMP_Text"},
TMPItemCount = {sComponentName = "TMP_Text"},
imgRemainTime = {nCount = 3},
TMPTimeLimit = {sComponentName = "TMP_Text"},
TMPSubTitle = {sComponentName = "TMP_Text"},
TMPItemDesc = {sComponentName = "TMP_Text"},
rtJumptoContent = {
sComponentName = "RectTransform"
},
goJumptoGrid = {},
rtJumpTo = {
sComponentName = "RectTransform"
},
TMPJumptoTitle = {
sComponentName = "TMP_Text",
sLanguageId = "ItemTips_GetWay"
},
srDesc = {
sComponentName = "RectTransform"
},
rtDescContent = {
sComponentName = "RectTransform"
},
btnShortcutClose = {
sComponentName = "NaviButton",
callback = "OnBtnClick_ClosePanel"
},
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtBtnDetail = {sComponentName = "TMP_Text", sLanguageId = "MoreInfo"},
exId = {sComponentName = "TMP_Text"}
}
ItemTipsCtrl._mapEventConfig = {}
function ItemTipsCtrl:Awake()
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.rtTarget = tbParam[1]
self.mapData = tbParam[2]
end
end
function ItemTipsCtrl:FadeIn()
end
function ItemTipsCtrl:FadeOut()
end
function ItemTipsCtrl:OnEnable()
self:EnableGamepadUI(self._mapNode.btnShortcutClose)
self.tbGoJumpto = {}
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
self._mapNode.goJumptoGrid:SetActive(false)
self.sortingOrder = NovaAPI.GetCanvasSortingOrder(self.gameObject:GetComponent("Canvas"))
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = false
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", true)
NovaAPI.SetTopGridCanvasSorting(self.rtTarget.gameObject, self.sortingOrder)
local mapItemCfgData = ConfigTable.GetData_Item(self.mapData.nTid)
if mapItemCfgData == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.TMPItemTitle, mapItemCfgData.Title)
if mapItemCfgData.ExpireType == GameEnum.expireType.ExpireDate then
local nExpire = CS.ClientManager.Instance:ISO8601StrToTimeStamp(mapItemCfgData.ExpireDate)
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
local remainTime = nExpire - nCurTime
local sTime = ""
if 86400 <= remainTime then
local day = math.floor(remainTime / 86400)
local hour = math.floor((remainTime - day * 86400) / 3600)
if hour == 0 then
day = day - 1
hour = 24
end
sTime = string.format("%s%s%s%s", day, ConfigTable.GetUIText("Depot_LeftTime_Day"), hour, ConfigTable.GetUIText("Depot_LeftTime_Hour"))
elseif 3600 <= remainTime then
local hour = math.floor(remainTime / 3600)
local min = math.floor((remainTime - hour * 3600) / 60)
if min == 0 then
hour = hour - 1
min = 60
end
sTime = string.format("%s%s%s%s", hour, ConfigTable.GetUIText("Depot_LeftTime_Hour"), min, ConfigTable.GetUIText("Depot_LeftTime_Min"))
elseif 0 < remainTime then
local min = math.floor(remainTime / 60)
sTime = string.format("%s%s", min, ConfigTable.GetUIText("Depot_LeftTime_Min"))
else
sTime = ConfigTable.GetUIText("Depot_Item_Expire")
end
NovaAPI.SetTMPText(self._mapNode.TMPTimeLimit, sTime)
self._mapNode.imgRemainTime[1].gameObject:SetActive(86400 <= remainTime)
self._mapNode.imgRemainTime[2].gameObject:SetActive(remainTime < 86400 and 3600 <= remainTime)
self._mapNode.imgRemainTime[3].gameObject:SetActive(remainTime < 3600)
else
self._mapNode.TMPTimeLimit.gameObject:SetActive(false)
end
if mapItemCfgData.Desc then
if mapItemCfgData.Literary and mapItemCfgData.Literary ~= "" then
NovaAPI.SetTMPText(self._mapNode.TMPItemDesc, mapItemCfgData.Desc .. [[
<color=#5E89B4>]] .. mapItemCfgData.Literary .. "</color>")
else
NovaAPI.SetTMPText(self._mapNode.TMPItemDesc, mapItemCfgData.Desc)
end
elseif mapItemCfgData.Literary and mapItemCfgData.Literary ~= "" then
NovaAPI.SetTMPText(self._mapNode.TMPItemDesc, mapItemCfgData.Literary)
else
NovaAPI.SetTMPText(self._mapNode.TMPItemDesc, "")
end
self.tbDetailItem = {}
local sort = function(a, b)
local mapItemCfgDataA = ConfigTable.GetData_Item(a.nId)
local mapItemCfgDataB = ConfigTable.GetData_Item(b.nId)
if mapItemCfgDataA and mapItemCfgDataB and mapItemCfgDataA.Rarity ~= mapItemCfgDataB.Rarity then
return mapItemCfgDataA.Rarity < mapItemCfgDataB.Rarity
end
return a.nId < b.nId
end
if mapItemCfgData.Stype == GameEnum.itemStype.RandomPackage then
local mapItemUseCfg = decodeJson(mapItemCfgData.UseArgs)
for sTid, _ in pairs(mapItemUseCfg) do
local nItemTid = tonumber(sTid)
if nItemTid ~= nil then
local tbDropShowData = PlayerData.Item:GetDropItemShow(nItemTid)
if tbDropShowData ~= nil then
for _, mapData in ipairs(tbDropShowData) do
table.insert(self.tbDetailItem, {
nId = mapData.ItemId,
nCount = mapData.ItemQty
})
end
end
end
end
table.sort(self.tbDetailItem, sort)
self.sDetailTitle = ConfigTable.GetUIText("ItemTip_RandomPackageTitle")
self._mapNode.btnDetail.gameObject:SetActive(next(self.tbDetailItem) ~= nil)
local titleTra = self._mapNode.TMPItemTitle:GetComponent("RectTransform")
if next(self.tbDetailItem) ~= nil then
titleTra.sizeDelta = Vector2(textTitleWidthWithDetail, titleTra.sizeDelta.y)
else
titleTra.sizeDelta = Vector2(textTitleWidth, titleTra.sizeDelta.y)
end
elseif mapItemCfgData.Stype == GameEnum.itemStype.ComCYO then
local mapItemUseCfg = decodeJson(mapItemCfgData.UseArgs)
for sTid, nCount in pairs(mapItemUseCfg) do
local nItemTid = tonumber(sTid)
if nItemTid ~= nil then
table.insert(self.tbDetailItem, {nId = nItemTid, nCount = nCount})
end
end
table.sort(self.tbDetailItem, sort)
self.sDetailTitle = ConfigTable.GetUIText("ItemTip_ComCYOTitle")
self._mapNode.btnDetail.gameObject:SetActive(next(self.tbDetailItem) ~= nil)
local titleTra = self._mapNode.TMPItemTitle:GetComponent("RectTransform")
if next(self.tbDetailItem) ~= nil then
titleTra.sizeDelta = Vector2(textTitleWidthWithDetail, titleTra.sizeDelta.y)
else
titleTra.sizeDelta = Vector2(textTitleWidth, titleTra.sizeDelta.y)
end
elseif mapItemCfgData.Stype == GameEnum.itemStype.CharacterYO or mapItemCfgData.Stype == GameEnum.itemStype.OutfitCYO then
self.sDetailTitle = ConfigTable.GetUIText("ItemTip_ComCYOTitle")
self._mapNode.btnDetail.gameObject:SetActive(true)
local titleTra = self._mapNode.TMPItemTitle:GetComponent("RectTransform")
titleTra.sizeDelta = Vector2(textTitleWidthWithDetail, titleTra.sizeDelta.y)
else
self._mapNode.btnDetail.gameObject:SetActive(false)
local titleTra = self._mapNode.TMPItemTitle:GetComponent("RectTransform")
titleTra.sizeDelta = Vector2(textTitleWidth, titleTra.sizeDelta.y)
end
if self.mapData.bShowDepot and not mapItemCfgData.DisHaving then
local nItemDepotCount = 0
if self.mapData.nHasCount ~= nil then
nItemDepotCount = self.mapData.nHasCount
elseif self.mapData.nTid == AllEnum.CoinItemId.FREESTONE or self.mapData.nTid == AllEnum.CoinItemId.STONE then
nItemDepotCount = PlayerData.Item:GetItemCountByID(AllEnum.CoinItemId.FREESTONE) + PlayerData.Item:GetItemCountByID(AllEnum.CoinItemId.STONE)
else
nItemDepotCount = PlayerData.Item:GetItemCountByID(self.mapData.nTid)
end
self._mapNode.TMPItemCount.gameObject:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.TMPItemCount, orderedFormat(ConfigTable.GetUIText("ItemTip_DepotCount"), nItemDepotCount))
else
self._mapNode.TMPItemCount.gameObject:SetActive(false)
end
local sLanguage = "ItemStype_" .. mapItemCfgData.Stype
NovaAPI.SetTMPText(self._mapNode.TMPSubTitle, ConfigTable.GetUIText(sLanguage) or "")
if self.mapData.bShowJumpto and 0 < #mapItemCfgData.JumpTo then
self._mapNode.rtJumpTo.gameObject:SetActive(true)
self:RefreshJumpto(mapItemCfgData.JumpTo)
else
self._mapNode.rtJumpTo.gameObject:SetActive(false)
end
self._mapNode.exId.gameObject:SetActive(false)
EventManager.Hit("TipsId", self._mapNode.exId, self.mapData.nTid)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local nContentHeight = self._mapNode.rtDescContent.sizeDelta.y
print(nContentHeight)
if nContentHeight > self.maxTipHeight then
nContentHeight = self.maxTipHeight
end
if nContentHeight < self.minTipHeight then
nContentHeight = self.minTipHeight
end
self._mapNode.srDesc.sizeDelta = Vector2(self._mapNode.srDesc.sizeDelta.x, nContentHeight)
local titleTra = self._mapNode.TMPItemTitle:GetComponent("RectTransform")
local nTitleHeight = titleHeight
if titleTra.sizeDelta.y < 75 then
local itemCountTra = self._mapNode.TMPItemCount:GetComponent("RectTransform")
itemCountTra.anchoredPosition = Vector2(itemCountTra.anchoredPosition.x, itemCountTra.anchoredPosition.y + MoveUpHeight)
local exIdTra = self._mapNode.exId:GetComponent("RectTransform")
exIdTra.anchoredPosition = Vector2(exIdTra.anchoredPosition.x, exIdTra.anchoredPosition.y + MoveUpHeight)
if self.mapData.bShowDepot and not mapItemCfgData.DisHaving then
self._mapNode.srDesc.anchoredPosition = Vector2(self._mapNode.srDesc.anchoredPosition.x, self._mapNode.srDesc.anchoredPosition.y + MoveUpHeight)
nTitleHeight = nTitleHeight - MoveUpHeight
else
self._mapNode.srDesc.anchoredPosition = Vector2(self._mapNode.srDesc.anchoredPosition.x, self._mapNode.srDesc.anchoredPosition.y + MoveUpHeight * 2)
nTitleHeight = nTitleHeight - MoveUpHeight * 2
end
end
self._mapNode.imgTipsBg.sizeDelta = Vector2(self._mapNode.imgTipsBg.sizeDelta.x, nContentHeight + nTitleHeight)
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
end
cs_coroutine.start(wait)
end
function ItemTipsCtrl:OnDisable()
self:DisableGamepadUI()
if self.tbGoJumpto == nil then
return
end
for _, btnComp in pairs(self.tbGoJumpto) do
btnComp.onClick:RemoveAllListeners()
end
self.tbGoJumpto = {}
end
function ItemTipsCtrl:OnDestroy()
end
function ItemTipsCtrl:OnRelease()
end
function ItemTipsCtrl:RefreshJumpto(tbJumpto)
self.tbJumptoData = {}
for _, nJumptoId in ipairs(tbJumpto) do
local mapJumpTo = ConfigTable.GetData("JumpTo", nJumptoId)
if mapJumpTo ~= nil then
if mapJumpTo.Type == GameEnum.jumpType.ComCYO then
local mapProduceCfg = ConfigTable.GetData("ProduceHelper", self.mapData.nTid)
if mapProduceCfg ~= nil then
local tbComCYO = mapProduceCfg.ComCYOIds
for _, v in ipairs(tbComCYO) do
local nCount = PlayerData.Item:GetItemCountByID(v)
if 0 < nCount then
local itemCfgData = ConfigTable.GetData_Item(v, true)
if itemCfgData ~= nil then
local mapAfter = clone(mapJumpTo)
mapAfter.Desc = string.format(mapAfter.Desc, itemCfgData.Title)
mapAfter.Param = {v}
table.insert(self.tbJumptoData, mapAfter)
end
end
end
end
else
table.insert(self.tbJumptoData, mapJumpTo)
end
end
end
for i, mapJumpTo in ipairs(self.tbJumptoData) do
local goJumpto = instantiate(self._mapNode.goJumptoGrid, self._mapNode.rtJumptoContent)
goJumpto:SetActive(true)
local btnComp = goJumpto.transform:Find("btnJump"):GetComponent("Button")
table.insert(self.tbGoJumpto, btnComp)
local func_Handler = ui_handler(self, self.OnBtnClick_JumpTo, btnComp, i)
btnComp.onClick:AddListener(func_Handler)
local imgIconJumpto = goJumpto.transform:Find("btnJump/AnimRoot/imgIcon"):GetComponent("Image")
local txtDesc = goJumpto.transform:Find("btnJump/AnimRoot/txtDesc"):GetComponent("TMP_Text")
local goArrow = goJumpto.transform:Find("btnJump/AnimRoot/imgArrow").gameObject
if mapJumpTo.Icon == nil then
mapJumpTo.Icon = ""
end
self:SetPngSprite(imgIconJumpto, mapJumpTo.Icon)
NovaAPI.SetImageNativeSize(imgIconJumpto)
NovaAPI.SetTMPText(txtDesc, mapJumpTo.Desc)
if mapJumpTo.Type == GameEnum.jumpType.Text then
btnComp.interactable = false
goArrow:SetActive(false)
else
btnComp.interactable = true
goArrow:SetActive(true)
end
end
end
function ItemTipsCtrl:OnBtnClick_JumpTo(_, nIndex)
self:OnBtnClick_ClosePanel()
JumpUtil.JumpTo(self.tbJumptoData[nIndex].Id, self.tbJumptoData[nIndex].Param, self.mapData.nTid, self.mapData.nNeedCount)
end
function ItemTipsCtrl:OnBtnClick_Word(sWordId)
local nWordId = tonumber(sWordId)
local mapWordData = ConfigTable.GetData_World(nWordId)
if mapWordData == nil then
printError("wordId error:" .. sWordId)
return
end
self._mapNode.btnCloseWordTip.gameObject:SetActive(true)
self._mapNode.imgWordTipBg:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.TMPWordDesc, mapWordData.Desc)
NovaAPI.SetTMPSourceText(self._mapNode.TMPWordTipsTitle, mapWordData.Title)
self:SetWordTipsSize()
end
function ItemTipsCtrl:OnBtnClick_CloseWord(btn)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
end
function ItemTipsCtrl:OnBtnClick_ClosePanel(btn)
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = true
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", false)
EventManager.Hit(EventId.ClosePanel, PanelId.ItemTips)
end
function ItemTipsCtrl:OnBtnClick_Detail()
local mapItemCfgData = ConfigTable.GetData_Item(self.mapData.nTid)
if mapItemCfgData == nil then
return
end
self:OnBtnClick_ClosePanel()
EventManager.Hit(EventId.CloseMessageBox)
EventManager.Hit(EventId.BlockInput, true)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.BlockInput, false)
if mapItemCfgData.Stype == GameEnum.itemStype.CharacterYO then
EventManager.Hit(EventId.OpenPanel, PanelId.CharConsumablePanel, self.mapData.nTid, true)
elseif mapItemCfgData.Stype == GameEnum.itemStype.OutfitCYO then
EventManager.Hit(EventId.OpenPanel, PanelId.DiscPreview, self.mapData.nTid, true)
else
local msg = {
nType = AllEnum.MessageBox.ItemList,
tbItem = self.tbDetailItem,
sTitle = self.sDetailTitle
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
end
cs_coroutine.start(wait)
end
return ItemTipsCtrl
@@ -0,0 +1,21 @@
local ItemTipsPanel = class("ItemTipsPanel", BasePanel)
ItemTipsPanel._bIsMainPanel = false
ItemTipsPanel._bAddToBackHistory = false
ItemTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
ItemTipsPanel._tbDefine = {
{
sPrefabPath = "CommonTipsEx/ItemTips.prefab",
sCtrlName = "Game.UI.CommonTipsEx.ItemTipsCtrl"
}
}
function ItemTipsPanel:Awake()
end
function ItemTipsPanel:OnEnable()
end
function ItemTipsPanel:OnDisable()
end
function ItemTipsPanel:OnDestroy()
end
function ItemTipsPanel:OnRelease()
end
return ItemTipsPanel
@@ -0,0 +1,124 @@
local BaseCtrl = require("Game.UI.CommonTipsEx.CommonTipsBaseCtrl")
local MonsterTipsCtrl = class("MonsterTipsCtrl", BaseCtrl)
MonsterTipsCtrl._mapNodeConfig = {
btnCloseTips = {
sComponentName = "Button",
callback = "OnBtnClick_ClosePanel"
},
rtContent = {
sComponentName = "RectTransform"
},
safeAreaRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "RectTransform"
},
TMP_monsterInfo = {sComponentName = "TMP_Text"},
txtName = {sComponentName = "TMP_Text"},
goMonsterType = {},
goBoss = {},
goElite = {},
goLeader = {},
txtPropertyNone = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "EnemyInfo_Window_Property_None"
},
txtProperty1 = {
sComponentName = "TMP_Text",
sLanguageId = "EnemyInfo_Window_Property_1"
},
txtProperty2 = {
sComponentName = "TMP_Text",
sLanguageId = "EnemyInfo_Window_Property_2"
},
goPropertyList = {nCount = 2, sComponentName = "Transform"},
btnShortcutClose = {
sComponentName = "NaviButton",
callback = "OnBtnClick_ClosePanel"
}
}
MonsterTipsCtrl._mapEventConfig = {}
function MonsterTipsCtrl:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.rtTarget = tbParam[1]
self.mapData = tbParam[2]
end
end
function MonsterTipsCtrl:FadeIn()
end
function MonsterTipsCtrl:FadeOut()
end
function MonsterTipsCtrl:OnEnable()
self:EnableGamepadUI(self._mapNode.btnShortcutClose)
self:RefreshMonsterInfo(self.mapData.nTid)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
end
cs_coroutine.start(wait)
end
function MonsterTipsCtrl:RefreshMonsterInfo(nMonsterId)
local monsterData = ConfigTable.GetData("Monster", nMonsterId)
if nil == monsterData then
printError(string.format("Monster数据为空!!!id = [%s]", nMonsterId))
return
end
local monsterSkin = ConfigTable.GetData("MonsterSkin", monsterData.FAId)
if nil == monsterSkin then
printError(string.format("MonsterSkin数据为空!!!id = [%s]", monsterData.FAId))
return
end
local monsterAdjust = ConfigTable.GetData("MonsterValueTempleteAdjust", monsterData.Templete)
if nil == monsterAdjust then
printError(string.format("MonsterValueTempleteAdjust数据为空!!!id = [%s]", monsterData.Templete))
return
end
local monsterManual = ConfigTable.GetData("MonsterManual", monsterSkin.MonsterManual)
if nil == monsterManual then
printError(string.format("MonsterManual数据为空!!!id = [%s]", monsterSkin.MonsterManual))
return
end
NovaAPI.SetTMPText(self._mapNode.txtName, monsterManual.Name)
NovaAPI.SetTMPText(self._mapNode.TMP_monsterInfo, monsterManual.Desc)
local eets = {
monsterAdjust.EET
}
self:RefreshElement(self._mapNode.goPropertyList[1], monsterAdjust.WeakEET, 1)
self:RefreshElement(self._mapNode.goPropertyList[2], eets, 2)
if monsterData.EpicLv ~= GameEnum.monsterEpicType.NORMAL then
self._mapNode.goMonsterType:SetActive(true)
self._mapNode.goBoss:SetActive(monsterData.EpicLv == GameEnum.monsterEpicType.LORD)
self._mapNode.goElite:SetActive(monsterData.EpicLv == GameEnum.monsterEpicType.ELITE)
self._mapNode.goLeader:SetActive(monsterData.EpicLv == GameEnum.monsterEpicType.LEADER)
else
self._mapNode.goMonsterType:SetActive(false)
end
end
function MonsterTipsCtrl:RefreshElement(goParent, elementType, index)
local bNone = true
for i = 1, 3 do
local icon = goParent:GetChild(i - 1):GetComponent("Image")
if elementType[i] ~= nil then
icon.gameObject:SetActive(true)
local sName = AllEnum.ElementIconType.Icon .. elementType[i]
self:SetAtlasSprite(icon, "12_rare", sName)
bNone = false
else
icon.gameObject:SetActive(false)
end
end
self._mapNode.txtPropertyNone[index].gameObject:SetActive(bNone)
end
function MonsterTipsCtrl:OnDisable()
self:DisableGamepadUI()
end
function MonsterTipsCtrl:OnDestroy()
end
function MonsterTipsCtrl:OnRelease()
end
function MonsterTipsCtrl:OnBtnClick_ClosePanel(btn)
EventManager.Hit(EventId.ClosePanel, PanelId.MonsterTips)
end
return MonsterTipsCtrl
@@ -0,0 +1,21 @@
local MonsterTipsPanel = class("MonsterTipsPanel", BasePanel)
MonsterTipsPanel._bIsMainPanel = false
MonsterTipsPanel._bAddToBackHistory = false
MonsterTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
MonsterTipsPanel._tbDefine = {
{
sPrefabPath = "CommonTipsEx/MonsterTips.prefab",
sCtrlName = "Game.UI.CommonTipsEx.MonsterTipsCtrl"
}
}
function MonsterTipsPanel:Awake()
end
function MonsterTipsPanel:OnEnable()
end
function MonsterTipsPanel:OnDisable()
end
function MonsterTipsPanel:OnDestroy()
end
function MonsterTipsPanel:OnRelease()
end
return MonsterTipsPanel
+265
View File
@@ -0,0 +1,265 @@
local BaseCtrl = require("Game.UI.CommonTipsEx.CommonTipsBaseCtrl")
local PerkTipsCtrl = class("PerkTipsCtrl", BaseCtrl)
PerkTipsCtrl._mapNodeConfig = {
btnCloseTips = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClosePanel"
},
btnCloseWordTip = {
sComponentName = "Button",
callback = "OnBtnClick_CloseWord"
},
TMP_LinkBranch = {
sNodeName = "TMPItemDesc",
sComponentName = "TMPHyperLink",
callback = "OnBtnClick_Word"
},
safeAreaRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "RectTransform"
},
imgWordTipBg = {},
TMPWordDesc = {sComponentName = "TMP_Text"},
TMPWordTipsTitle = {sComponentName = "TMP_Text"},
imgTipsBg = {
sComponentName = "RectTransform"
},
rtContent = {
sComponentName = "RectTransform"
},
rtContentCanvasGroup = {
sNodeName = "rtContent",
sComponentName = "CanvasGroup"
},
TipsContent = {
sComponentName = "RectTransform"
},
TipsView = {
sComponentName = "RectTransform"
},
TMPPerkTitle = {sComponentName = "TMP_Text"},
TMPItemDesc = {sComponentName = "TMP_Text"},
svContent = {
sComponentName = "RectTransform"
},
svTipsContent = {
sComponentName = "RectTransform"
},
goParam = {
nCount = 4,
sCtrlName = "Game.UI.CommonTipsEx.PerkTipsParamCtrl"
},
rtQuest = {},
txtQuestTitle = {sComponentName = "TMP_Text"},
goStateOn = {},
goStateOff = {},
txtStateOn = {
sComponentName = "TMP_Text",
sLanguageId = "PerkQuest_Doing"
},
txtStateOff = {
sComponentName = "TMP_Text",
sLanguageId = "PerkQuest_Stop"
},
goCond = {nCount = 2},
imgContOff = {nCount = 2},
imgContOn = {nCount = 2},
txtCondTitle = {nCount = 4, sComponentName = "TMP_Text"},
txtCondDesc = {nCount = 4, sComponentName = "TMP_Text"},
btnShortcutClose = {
sComponentName = "NaviButton",
callback = "OnBtnClick_ClosePanel"
}
}
PerkTipsCtrl._mapEventConfig = {}
PerkTipsCtrl.minTipHeight = 87
PerkTipsCtrl.maxTipHeight = 557
local titleHeight = 72
function PerkTipsCtrl:RefreshQuest(mapQuest)
self._mapNode.rtQuest:SetActive(mapQuest)
if not mapQuest then
return
end
local mapCfg = ConfigTable.GetData("RoguelikeQuestCondition", mapQuest.nCondId)
NovaAPI.SetTMPText(self._mapNode.txtQuestTitle, ConfigTable.GetUIText("PerkQuest_Title2") .. mapCfg.Title)
local mapCond1 = {
nCur = mapQuest.tbProgress[1].Cur,
nMax = mapQuest.tbProgress[1].Max
}
local mapCond2 = {
nCur = mapQuest.tbProgress[2].Cur,
nMax = mapQuest.tbProgress[2].Max
}
self._mapNode.goStateOn:SetActive(mapCond1.nCur == mapCond1.nMax)
self._mapNode.goStateOff:SetActive(mapCond1.nCur < mapCond1.nMax)
if mapCond1.nCur == mapCond1.nMax then
self._mapNode.imgContOn[1]:SetActive(false)
self._mapNode.imgContOff[1]:SetActive(true)
self._mapNode.txtCondDesc[2].gameObject:SetActive(false)
self._mapNode.txtCondDesc[1].gameObject:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.txtCondTitle[1], orderedFormat(ConfigTable.GetUIText("PerkQuest_Condition"), 1))
NovaAPI.SetTMPText(self._mapNode.txtCondDesc[1], mapCfg.Desc1)
else
self._mapNode.imgContOn[1]:SetActive(true)
self._mapNode.imgContOff[1]:SetActive(false)
self._mapNode.txtCondDesc[2].gameObject:SetActive(true)
self._mapNode.txtCondDesc[1].gameObject:SetActive(false)
NovaAPI.SetTMPText(self._mapNode.txtCondTitle[2], orderedFormat(ConfigTable.GetUIText("PerkQuest_Condition"), 1))
NovaAPI.SetTMPText(self._mapNode.txtCondDesc[2], mapCfg.Desc1)
end
if mapCond2.nCur == mapCond2.nMax then
self._mapNode.imgContOn[2]:SetActive(false)
self._mapNode.imgContOff[2]:SetActive(true)
self._mapNode.txtCondDesc[4].gameObject:SetActive(false)
self._mapNode.txtCondDesc[3].gameObject:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.txtCondTitle[3], orderedFormat(ConfigTable.GetUIText("PerkQuest_Condition"), 2))
NovaAPI.SetTMPText(self._mapNode.txtCondDesc[3], mapCfg.Desc2)
else
self._mapNode.imgContOn[2]:SetActive(true)
self._mapNode.imgContOff[2]:SetActive(false)
self._mapNode.txtCondDesc[4].gameObject:SetActive(true)
self._mapNode.txtCondDesc[3].gameObject:SetActive(false)
NovaAPI.SetTMPText(self._mapNode.txtCondTitle[4], orderedFormat(ConfigTable.GetUIText("PerkQuest_Condition"), 2))
NovaAPI.SetTMPText(self._mapNode.txtCondDesc[4], string.format("%s%d/%d", mapCfg.Desc2, mapCond2.nCur, mapCond2.nMax))
end
end
function PerkTipsCtrl:RefreshHarmonySkill()
local mapCfg = ConfigTable.GetData("StarTowerHarmonySkill", self.mapData.nHarmonyId)
if not mapCfg then
return
end
NovaAPI.SetTMPText(self._mapNode.TMPPerkTitle, mapCfg.Name)
NovaAPI.SetTMPText(self._mapNode.TMPItemDesc, UTILS.ParseDesc(mapCfg))
self:RefreshQuest(false)
for _, v in ipairs(self._mapNode.goParam) do
v.gameObject:SetActive(false)
end
end
function PerkTipsCtrl:RefreshPerk()
local mapPerk = ConfigTable.GetData("Potential", self.mapData.nPerkId)
self.mapData.nLevel = self.mapData.nCount
local nType = mapPerk.BranchType
local nCharId = mapPerk.CharId
local tbSkillLevel = PlayerData.Char:GetSkillLevel(nCharId)
if nType == GameEnum.BranchType.Master then
self.mapData.nLevel = tbSkillLevel[GameEnum.skillSlotType.B]
elseif nType == GameEnum.BranchType.Assist then
self.mapData.nLevel = tbSkillLevel[GameEnum.skillSlotType.C]
end
local mapItemData = ConfigTable.GetData_Item(self.mapData.nPerkId)
NovaAPI.SetTMPText(self._mapNode.TMPPerkTitle, mapItemData.Title)
NovaAPI.SetTMPText(self._mapNode.TMPItemDesc, UTILS.ParseDesc(mapPerk))
self:RefreshQuest(false)
for _, v in ipairs(self._mapNode.goParam) do
v.gameObject:SetActive(false)
end
end
function PerkTipsCtrl:RefreshAffix()
local mapAffix = ConfigTable.GetData("StarTowerRankAffix", self.mapData.nAffixId)
if mapAffix ~= nil then
NovaAPI.SetTMPText(self._mapNode.TMPPerkTitle, mapAffix.Name)
NovaAPI.SetTMPText(self._mapNode.TMPItemDesc, UTILS.ParseDesc(mapAffix))
end
self:RefreshQuest(false)
for _, v in ipairs(self._mapNode.goParam) do
v.gameObject:SetActive(false)
end
end
function PerkTipsCtrl:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.rtTarget = tbParam[1]
self.mapData = tbParam[2]
end
end
function PerkTipsCtrl:FadeIn()
end
function PerkTipsCtrl:FadeOut()
end
function PerkTipsCtrl:OnEnable()
self:EnableGamepadUI(self._mapNode.btnShortcutClose)
if self.mapData.bWordTip then
if self.rtTarget ~= nil then
local vX = NovaAPI.GetViewPointX(self.rtTarget.gameObject)
if 0.5 < vX then
self._mapNode.imgWordTipBg.transform.localPosition = Vector3(-self._mapNode.imgWordTipBg.transform.localPosition.x, self._mapNode.imgWordTipBg.transform.localPosition.y, self._mapNode.imgWordTipBg.transform.localPosition.z)
end
end
self:OnBtnClick_Word(nil, self.mapData.sWordId)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.rtContent.gameObject:SetActive(false)
return
end
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtContentCanvasGroup, 0)
self._mapNode.imgWordTipBg:SetActive(false)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self.sortingOrder = NovaAPI.GetCanvasSortingOrder(self.gameObject:GetComponent("Canvas"))
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = false
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", true)
NovaAPI.SetTopGridCanvasSorting(self.rtTarget.gameObject, self.sortingOrder)
if self.mapData.bHarmony then
self:RefreshHarmonySkill()
elseif self.mapData.bAffix then
self:RefreshAffix()
else
self:RefreshPerk()
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local nContentHeight = self._mapNode.svTipsContent.sizeDelta.y
if nContentHeight > self.maxTipHeight then
nContentHeight = self.maxTipHeight
end
if nContentHeight < self.minTipHeight then
nContentHeight = self.minTipHeight
end
self._mapNode.svContent.sizeDelta = Vector2(self._mapNode.svContent.sizeDelta.x, nContentHeight)
self._mapNode.TipsContent.sizeDelta = Vector2(self._mapNode.TipsContent.sizeDelta.x, nContentHeight + titleHeight)
self._mapNode.imgTipsBg.sizeDelta = Vector2(self._mapNode.imgTipsBg.sizeDelta.x, nContentHeight + titleHeight + 40)
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtContentCanvasGroup, 1)
end
cs_coroutine.start(wait)
end
function PerkTipsCtrl:OnDisable()
self:DisableGamepadUI()
end
function PerkTipsCtrl:OnDestroy()
end
function PerkTipsCtrl:OnRelease()
end
function PerkTipsCtrl:OnBtnClick_Word(_, sWordId)
self._mapNode.btnCloseWordTip.gameObject:SetActive(true)
self._mapNode.imgWordTipBg:SetActive(true)
local nWordId = tonumber(sWordId)
local mapWordData = ConfigTable.GetData("Word", nWordId)
if mapWordData == nil then
if sWordId == nil then
printError("sWordId为空")
return
end
printError("wordId error:" .. sWordId)
return
end
NovaAPI.SetTMPText(self._mapNode.TMPWordDesc, UTILS.ParseDesc(mapWordData, GameEnum.levelTypeData.Exclusive, self.mapData.nNextLevel))
self._mapNode.TMPWordTipsTitle:SetText(string.format("<color=#%s>%s%s", mapWordData.Color, mapWordData.Title, mapWordData.TitleIcon))
end
function PerkTipsCtrl:OnBtnClick_CloseWord(btn)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
end
function PerkTipsCtrl:OnBtnClick_ClosePanel(btn)
if self.rtTarget ~= nil then
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = true
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", false)
end
EventManager.Hit(EventId.ClosePanel, PanelId.PerkTips)
end
return PerkTipsCtrl
@@ -0,0 +1,21 @@
local PerkTipsPanel = class("PerkTipsPanel", BasePanel)
PerkTipsPanel._bIsMainPanel = false
PerkTipsPanel._bAddToBackHistory = false
PerkTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
PerkTipsPanel._tbDefine = {
{
sPrefabPath = "CommonTipsEx/PerkTips.prefab",
sCtrlName = "Game.UI.CommonTipsEx.PerkTipsCtrl"
}
}
function PerkTipsPanel:Awake()
end
function PerkTipsPanel:OnEnable()
end
function PerkTipsPanel:OnDisable()
end
function PerkTipsPanel:OnDestroy()
end
function PerkTipsPanel:OnRelease()
end
return PerkTipsPanel
@@ -0,0 +1,31 @@
local PerkTipsParamCtrl = class("PerkTipsParamCtrl", BaseCtrl)
local color_singular = "#e8eef2"
local color_even = "#ffffff"
PerkTipsParamCtrl._mapNodeConfig = {
imgBg = {nCount = 4, sComponentName = "Image"},
txtParamName = {sComponentName = "TMP_Text"},
txtParamValue = {sComponentName = "TMP_Text"}
}
PerkTipsParamCtrl._mapEventConfig = {}
function PerkTipsParamCtrl:RefreshParam(nIndex, nAllCount, sName, sValue)
local sColor = nIndex % 2 == 0 and color_even or color_singular
local _b, _color = ColorUtility.TryParseHtmlString(sColor)
for _, v in ipairs(self._mapNode.imgBg) do
NovaAPI.SetImageColor(v, _color)
v.gameObject:SetActive(false)
end
if nIndex == 1 then
if nAllCount == 1 then
self._mapNode.imgBg[1].gameObject:SetActive(true)
else
self._mapNode.imgBg[2].gameObject:SetActive(true)
end
elseif nIndex == nAllCount then
self._mapNode.imgBg[4].gameObject:SetActive(true)
else
self._mapNode.imgBg[3].gameObject:SetActive(true)
end
NovaAPI.SetTMPText(self._mapNode.txtParamName, sName)
NovaAPI.SetTMPText(self._mapNode.txtParamValue, sValue)
end
return PerkTipsParamCtrl
+444
View File
@@ -0,0 +1,444 @@
local PopupSkillCtrl = class("PopupSkillCtrl", BaseCtrl)
local ConfigData = require("GameCore.Data.ConfigData")
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local LocalSettingData = require("GameCore.Data.LocalSettingData")
local nMaxHeight = 395
PopupSkillCtrl._mapNodeConfig = {
btnCloseScreen = {
sComponentName = "Button",
callback = "OnBtnClick_Close"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btnSuportSkill1 = {
sComponentName = "UIButton",
callback = "OnBtnClick_Skill"
},
btnSuportSkill2 = {
sComponentName = "UIButton",
callback = "OnBtnClick_Skill"
},
btnSupportUltra1 = {
sComponentName = "UIButton",
callback = "OnBtnClick_Skill"
},
btnSupportUltra2 = {
sComponentName = "UIButton",
callback = "OnBtnClick_Skill"
},
btnSkill = {
sComponentName = "UIButton",
callback = "OnBtnClick_Skill"
},
btnUltra = {
sComponentName = "UIButton",
callback = "OnBtnClick_Skill"
},
btnTarget = {
sComponentName = "ButtonEx",
callback = "OnBtnClick_Skill"
},
btnDodge = {
sComponentName = "UIButton",
callback = "OnBtnClick_Skill"
},
type_s1 = {sComponentName = "Image"},
type_s2 = {sComponentName = "Image"},
type_u1 = {sComponentName = "Image"},
type_u2 = {sComponentName = "Image"},
imgSubSkillIcon = {nCount = 2, sComponentName = "Image"},
imgRoleHeadIcon = {
nCount = 2,
sNodeName = "suportRole",
sComponentName = "Image"
},
imgUltraSkillIcon = {nCount = 2, sComponentName = "Image"},
EmptySupportSkill = {nCount = 2},
EmptySupportUltra = {nCount = 2},
mainSupportSkill = {nCount = 2},
mainSupportUltra = {nCount = 2},
imgUltraIcon = {sComponentName = "Image"},
imgSkillIcon = {sComponentName = "Image"},
imgDodgeIcon = {sComponentName = "Image"},
type_u0 = {sComponentName = "Image"},
imgType0 = {sComponentName = "Image"},
imgSkillIconBg = {sComponentName = "Image"},
imgzsIcon = {sComponentName = "Image"},
imgIconSkill = {sComponentName = "Image"},
imgSkillTypeBg = {sComponentName = "Image"},
txtSkillType = {sComponentName = "TMP_Text"},
imgSkillType = {sComponentName = "Image"},
TMPTitle = {sComponentName = "TMP_Text"},
txtSkillLevel = {sComponentName = "TMP_Text"},
imgEnergyInfoBg = {},
imgCDInfoBg = {},
srSkillDesc = {
sComponentName = "RectTransform"
},
TMP_Link = {
sNodeName = "TMPDesc",
sComponentName = "TMPHyperLink",
callback = "OnLinkClick_Word"
},
TMPCDTitle = {sComponentName = "TMP_Text", sLanguageId = "Talent_CD"},
TMPCD = {sComponentName = "TMP_Text"},
TMPEnergyTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Talent_Cost"
},
TMPEnergy = {sComponentName = "TMP_Text"},
TMPDesc = {sComponentName = "TMP_Text"},
rtTMPDesc = {
sComponentName = "RectTransform",
sNodeName = "TMPDesc"
},
aniBlur = {sComponentName = "Animator"},
aniBlur2 = {sComponentName = "Animator"},
aniImgBg = {sComponentName = "Animator"},
ActionBar = {
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
},
btnShortcutClose = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Close"
},
txtTitleSkill = {
sComponentName = "TMP_Text",
sLanguageId = "Skill_Branch_SkillInfo"
},
TMPHint = {
sComponentName = "TMP_Text",
sLanguageId = "PopupSkill_Hint"
},
switch_name = {
sComponentName = "TMP_Text",
sLanguageId = "CharSkillDescType"
},
btnSwitch_on = {
sComponentName = "UIButton",
callback = "OnEvent_SetDesc"
},
btnSwitch_off = {
sComponentName = "UIButton",
callback = "OnEvent_SetSimpleDesc"
},
go_Simple = {
sComponentName = "RectTransform"
},
imgBg_SupportRole = {},
SupSkill1_Pos = {sComponentName = "Transform"},
SupUltra1_Pos = {sComponentName = "Transform"},
SupRole1_Pos = {sComponentName = "Transform"},
SupSkill2_Pos = {sComponentName = "Transform"},
SupUltra2_Pos = {sComponentName = "Transform"},
SupRole2_Pos = {sComponentName = "Transform"},
MainDodge_Pos = {sComponentName = "Transform"},
MainSkill_Pos = {sComponentName = "Transform"},
MainUltra_Pos = {sComponentName = "Transform"},
SupSkill1_Pos_Hor = {sComponentName = "Transform"},
SupUltra1_Pos_Hor = {sComponentName = "Transform"},
SupRole1_Pos_Hor = {sComponentName = "Transform"},
SupSkill2_Pos_Hor = {sComponentName = "Transform"},
SupUltra2_Pos_Hor = {sComponentName = "Transform"},
SupRole2_Pos_Hor = {sComponentName = "Transform"},
MainDodge_Pos_Hor = {sComponentName = "Transform"},
MainSkill_Pos_Hor = {sComponentName = "Transform"},
MainUltra_Pos_Hor = {sComponentName = "Transform"}
}
PopupSkillCtrl._mapEventConfig = {}
function PopupSkillCtrl:Awake()
self._mapNode.btnShortcutClose.gameObject:SetActive(GamepadUIManager.GetInputState())
if GamepadUIManager.GetInputState() then
local tbConfig = {
{
sAction = "Back",
sLang = "ActionBar_Back"
}
}
self._mapNode.ActionBar:InitActionBar(tbConfig)
end
end
function PopupSkillCtrl:FadeIn()
end
function PopupSkillCtrl:FadeOut()
end
function PopupSkillCtrl:OnEnable()
self._mapNode.aniImgBg:Play("t_window_04_t_in")
local tbParam = self:GetPanelParam()
self.tbChar = tbParam[1]
local bNoMask = tbParam[2]
local tbTrialId = tbParam[3]
self.mapCharInfo = tbParam[4]
local nSelectCharId = tbParam[5]
self._mapNode.aniBlur.gameObject:SetActive(not bNoMask)
self._mapNode.aniBlur2.gameObject:SetActive(bNoMask)
self.mapCharSkill = {}
local bTrial = tbTrialId and 0 < #tbTrialId
for k, nCharId in ipairs(self.tbChar) do
if bTrial then
self.mapCharSkill[nCharId] = PlayerData.Char:GetTrialCharSkillAddedLevel(tbTrialId[k])
elseif self.mapCharInfo == nil then
self.mapCharSkill[nCharId] = PlayerData.Char:GetCharSkillAddedLevel(nCharId)
else
self.mapCharSkill[nCharId] = clone(self.mapCharInfo[nCharId].tbSkillLvs)
table.insert(self.mapCharSkill[nCharId], 3, self.mapCharSkill[nCharId][2])
end
end
self.mapBtnFunc = {}
local mapCfgDataMain = ConfigTable.GetData_Character(self.tbChar[1])
local mapSkillMain = ConfigTable.GetData_Skill(mapCfgDataMain.SkillId)
local mapSkillUltra = ConfigTable.GetData_Skill(mapCfgDataMain.UltimateId)
local mapSkillDodge = ConfigTable.GetData_Skill(mapCfgDataMain.DodgeId)
self:SetPngSprite(self._mapNode.imgUltraIcon, mapSkillUltra.Icon)
self:SetPngSprite(self._mapNode.imgSkillIcon, mapSkillMain.Icon)
self:SetPngSprite(self._mapNode.imgDodgeIcon, mapSkillDodge.Icon)
self:SetAtlasSprite(self._mapNode.type_u0, "15_battle", "skill_btn_b_type_" .. mapCfgDataMain.EET)
self:SetAtlasSprite(self._mapNode.imgType0, "15_battle", "skill_btn_b_type_" .. mapCfgDataMain.EET)
if self.tbChar[2] then
local mapCfgDataSub1 = ConfigTable.GetData_Character(self.tbChar[2])
local mapSkillSub1 = ConfigTable.GetData_Skill(mapCfgDataSub1.AssistSkillId)
local mapSkillUltraSub1 = ConfigTable.GetData_Skill(mapCfgDataSub1.UltimateId)
self:SetPngSprite(self._mapNode.imgSubSkillIcon[1], mapSkillSub1.Icon)
self:SetPngSprite(self._mapNode.imgUltraSkillIcon[1], mapSkillUltraSub1.Icon)
local nCharSkinId1 = PlayerData.Char:GetCharSkinId(self.tbChar[2])
local mapCharSkin1 = ConfigTable.GetData_CharacterSkin(nCharSkinId1)
self:SetPngSprite(self._mapNode.imgRoleHeadIcon[1], mapCharSkin1.Icon .. AllEnum.CharHeadIconSurfix.L)
self:SetAtlasSprite(self._mapNode.type_u1, "15_battle", "skill_btn_b_type_" .. mapCfgDataSub1.EET)
self:SetAtlasSprite(self._mapNode.type_s1, "15_battle", "skill_btn_b_type_" .. mapCfgDataSub1.EET)
self._mapNode.EmptySupportSkill[1]:SetActive(false)
self._mapNode.EmptySupportUltra[1]:SetActive(false)
self._mapNode.mainSupportSkill[1]:SetActive(true)
self._mapNode.mainSupportUltra[1]:SetActive(true)
self._mapNode.imgRoleHeadIcon[1].gameObject:SetActive(true)
self.mapBtnFunc[self._mapNode.btnSuportSkill1] = {
mapCfgDataSub1.AssistSkillId,
self.mapCharSkill[self.tbChar[2]][3],
self.tbChar[2],
3
}
self.mapBtnFunc[self._mapNode.btnSupportUltra1] = {
mapCfgDataSub1.UltimateId,
self.mapCharSkill[self.tbChar[2]][4],
self.tbChar[2],
4
}
else
self._mapNode.EmptySupportSkill[1]:SetActive(true)
self._mapNode.EmptySupportUltra[1]:SetActive(true)
self._mapNode.mainSupportSkill[1]:SetActive(false)
self._mapNode.mainSupportUltra[1]:SetActive(false)
self._mapNode.imgRoleHeadIcon[1].gameObject:SetActive(false)
end
if self.tbChar[3] then
local mapCfgDataSub2 = ConfigTable.GetData_Character(self.tbChar[3])
local mapSkillSub2 = ConfigTable.GetData_Skill(mapCfgDataSub2.AssistSkillId)
local mapSkillUltraSub2 = ConfigTable.GetData_Skill(mapCfgDataSub2.UltimateId)
self:SetPngSprite(self._mapNode.imgSubSkillIcon[2], mapSkillSub2.Icon)
self:SetPngSprite(self._mapNode.imgUltraSkillIcon[2], mapSkillUltraSub2.Icon)
local nCharSkinId2 = PlayerData.Char:GetCharSkinId(self.tbChar[3])
local mapCharSkin2 = ConfigTable.GetData_CharacterSkin(nCharSkinId2)
self:SetPngSprite(self._mapNode.imgRoleHeadIcon[2], mapCharSkin2.Icon .. AllEnum.CharHeadIconSurfix.L)
self:SetAtlasSprite(self._mapNode.type_u2, "15_battle", "skill_btn_b_type_" .. mapCfgDataSub2.EET)
self:SetAtlasSprite(self._mapNode.type_s2, "15_battle", "skill_btn_b_type_" .. mapCfgDataSub2.EET)
self._mapNode.EmptySupportSkill[2]:SetActive(false)
self._mapNode.EmptySupportUltra[2]:SetActive(false)
self._mapNode.mainSupportSkill[2]:SetActive(true)
self._mapNode.mainSupportUltra[2]:SetActive(true)
self._mapNode.imgRoleHeadIcon[2].gameObject:SetActive(true)
self.mapBtnFunc[self._mapNode.btnSuportSkill2] = {
mapCfgDataSub2.AssistSkillId,
self.mapCharSkill[self.tbChar[3]][3],
self.tbChar[3],
3
}
self.mapBtnFunc[self._mapNode.btnSupportUltra2] = {
mapCfgDataSub2.UltimateId,
self.mapCharSkill[self.tbChar[3]][4],
self.tbChar[3],
4
}
else
self._mapNode.EmptySupportSkill[2]:SetActive(true)
self._mapNode.EmptySupportUltra[2]:SetActive(true)
self._mapNode.mainSupportSkill[2]:SetActive(false)
self._mapNode.mainSupportUltra[2]:SetActive(false)
self._mapNode.imgRoleHeadIcon[2].gameObject:SetActive(false)
end
self.mapBtnFunc[self._mapNode.btnSkill] = {
mapCfgDataMain.SkillId,
self.mapCharSkill[self.tbChar[1]][2],
self.tbChar[1],
2
}
self.mapBtnFunc[self._mapNode.btnUltra] = {
mapCfgDataMain.UltimateId,
self.mapCharSkill[self.tbChar[1]][4],
self.tbChar[1],
4
}
self.mapBtnFunc[self._mapNode.btnTarget] = {"MsgTarget"}
self.mapBtnFunc[self._mapNode.btnDodge] = {"MsgDodge"}
if GamepadUIManager.GetInputState() then
GamepadUIManager.EnableGamepadUI("PopupSkillCtrl", self:GetGamepadUINode(), nil, true)
end
self:SetKeyLayout()
if nSelectCharId ~= nil then
for k, v in ipairs(self.tbChar) do
if v == nSelectCharId then
if k == 1 then
self:OnBtnClick_Skill(self._mapNode.btnSkill)
elseif k == 2 then
self:OnBtnClick_Skill(self._mapNode.btnSuportSkill1)
elseif k == 3 then
self:OnBtnClick_Skill(self._mapNode.btnSuportSkill2)
end
end
end
else
self.curButton = self._mapNode.btnSkill
self:SetSkill(mapCfgDataMain.SkillId, self.mapCharSkill[self.tbChar[1]][2], self.tbChar[1], 2)
self:SetSelect(self._mapNode.btnSkill, true)
end
end
function PopupSkillCtrl:SetSelect(goTarget, bSelect)
local goSelect = goTarget.transform:Find("imgSelect")
if goSelect ~= nil then
goSelect.gameObject:SetActive(bSelect)
end
end
function PopupSkillCtrl:OnDisable()
if GamepadUIManager.GetInputState() then
GamepadUIManager.DisableGamepadUI("PopupSkillCtrl")
end
end
function PopupSkillCtrl:OnDestroy()
end
function PopupSkillCtrl:OnRelease()
end
function PopupSkillCtrl:SetSkill(nSkillId, nLevel, nCharId, nType)
self.nLevel = nLevel
local mapCharCfgData = ConfigTable.GetData_Character(nCharId)
local mapCfgDataSkill = ConfigTable.GetData_Skill(nSkillId)
local nCD = FormatNum(mapCfgDataSkill.SkillCD * ConfigData.IntFloatPrecision)
local nCost = FormatNum(mapCfgDataSkill.UltraEnergy * ConfigData.IntFloatPrecision)
NovaAPI.SetTMPText(self._mapNode.txtSkillLevel, ConfigTable.GetUIText("Skill_Level") .. nLevel)
self:SetAtlasSprite(self._mapNode.imgSkillIconBg, "12_rare", AllEnum.ElementIconType.SkillEx .. mapCharCfgData.EET)
self:SetPngSprite(self._mapNode.imgIconSkill, mapCfgDataSkill.Icon)
local skillShowCfg = AllEnum.SkillTypeShow[nType]
NovaAPI.SetTMPText(self._mapNode.txtSkillType, ConfigTable.GetUIText(skillShowCfg.sLanguageId))
self:SetAtlasSprite(self._mapNode.imgzsIcon, "10_ico", "zs_character_skill_" .. skillShowCfg.bgIconIndex)
local _, color = ColorUtility.TryParseHtmlString(AllEnum.SkillElementBgColor[mapCharCfgData.EET])
NovaAPI.SetImageColor(self._mapNode.imgzsIcon, Color(color.r, color.g, color.b, 0.19607843137254902))
local skillTypeIconIdx = skillShowCfg.iconIndex
self:SetAtlasSprite(self._mapNode.imgSkillType, "05_language", "zs_character_skill_text_" .. skillTypeIconIdx)
NovaAPI.SetImageNativeSize(self._mapNode.imgSkillType)
local _, _color = ColorUtility.TryParseHtmlString(skillShowCfg.bgColor)
NovaAPI.SetImageColor(self._mapNode.imgSkillTypeBg, _color)
NovaAPI.SetTMPText(self._mapNode.TMPTitle, string.format("%s·%s", mapCharCfgData.Name, mapCfgDataSkill.Title))
local sCD = tostring(nCD) .. ConfigTable.GetUIText("Talent_Sec")
local sCost = tostring(nCost)
if nCD <= 0 then
sCD = ConfigTable.GetUIText("Skill_NoCD")
end
if nCost <= 0 then
sCost = ConfigTable.GetUIText("Skill_NoCost")
end
NovaAPI.SetTMPText(self._mapNode.TMPCD, sCD)
NovaAPI.SetTMPText(self._mapNode.TMPEnergy, sCost)
local bVisibleCD, bVisibleCost = false, false
if mapCfgDataSkill.Type == GameEnum.skillType.NORMAL then
bVisibleCD, bVisibleCost = false, false
elseif mapCfgDataSkill.Type == GameEnum.skillType.SKILL or mapCfgDataSkill.Type == GameEnum.skillType.SUPPORT then
bVisibleCD, bVisibleCost = true, false
elseif mapCfgDataSkill.Type == GameEnum.skillType.ULTIMATE then
bVisibleCD, bVisibleCost = true, true
end
self._mapNode.imgEnergyInfoBg:SetActive(bVisibleCD or bVisibleCost)
self._mapNode.imgCDInfoBg:SetActive(bVisibleCD)
local bIsSimpleDescType = PlayerData.Char:GetTipsPanelSkillDescType()
self._mapNode.btnSwitch_on.gameObject:SetActive(bIsSimpleDescType)
self._mapNode.btnSwitch_off.gameObject:SetActive(not bIsSimpleDescType)
local sDesc = ""
if bIsSimpleDescType then
sDesc = UTILS.ParseDesc(mapCfgDataSkill, nil, nil, true)
else
sDesc = UTILS.ParseDesc(mapCfgDataSkill)
end
NovaAPI.SetTMPText(self._mapNode.TMPDesc, sDesc)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local nHeight = self._mapNode.rtTMPDesc.sizeDelta.y + 12
if nHeight > nMaxHeight then
nHeight = nMaxHeight
end
self._mapNode.srSkillDesc.sizeDelta = Vector2(self._mapNode.srSkillDesc.sizeDelta.x, nHeight)
self._mapNode.go_Simple.anchoredPosition = Vector2(self._mapNode.go_Simple.anchoredPosition.x, self._mapNode.srSkillDesc.anchoredPosition.y - nHeight - 33)
end
cs_coroutine.start(wait)
end
function PopupSkillCtrl:DelayAnimClose()
EventManager.Hit(EventId.ClosePanel, PanelId.PopupSkillPanel)
end
function PopupSkillCtrl:OnBtnClick_Close(btn)
self._mapNode.aniImgBg:Play("t_window_04_t_out")
self._mapNode.aniBlur:SetTrigger("tOut")
self:AddTimer(1, 0.3, "DelayAnimClose", true, true, true, false)
end
function PopupSkillCtrl:OnBtnClick_Skill(btn)
if self.mapBtnFunc[btn] ~= nil then
if type(self.mapBtnFunc[btn][1]) == "string" then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PopupSkill_" .. self.mapBtnFunc[btn][1]))
else
self:SetSkill(self.mapBtnFunc[btn][1], self.mapBtnFunc[btn][2], self.mapBtnFunc[btn][3], self.mapBtnFunc[btn][4])
if self.curButton ~= nil then
self:SetSelect(self.curButton, false)
end
self:SetSelect(btn, true)
self.curButton = btn
end
end
end
function PopupSkillCtrl:OnLinkClick_Word(link, sWordId)
UTILS.ClickWordLink(link, sWordId)
end
function PopupSkillCtrl:SetKeyLayout()
local nType = LocalSettingData.GetLocalSettingData("BattleHUD")
if nType == AllEnum.BattleHudType.Horizontal then
self:SetKeyPos(self._mapNode.btnSuportSkill1.gameObject:GetComponent("RectTransform"), self._mapNode.SupSkill1_Pos_Hor)
self:SetKeyPos(self._mapNode.btnSupportUltra1.gameObject:GetComponent("RectTransform"), self._mapNode.SupUltra1_Pos_Hor)
self:SetKeyPos(self._mapNode.imgRoleHeadIcon[1].gameObject:GetComponent("RectTransform"), self._mapNode.SupRole1_Pos_Hor)
self:SetKeyPos(self._mapNode.btnSuportSkill2.gameObject:GetComponent("RectTransform"), self._mapNode.SupSkill2_Pos_Hor)
self:SetKeyPos(self._mapNode.btnSupportUltra2.gameObject:GetComponent("RectTransform"), self._mapNode.SupUltra2_Pos_Hor)
self:SetKeyPos(self._mapNode.imgRoleHeadIcon[2].gameObject:GetComponent("RectTransform"), self._mapNode.SupRole2_Pos_Hor)
self:SetKeyPos(self._mapNode.btnDodge.gameObject:GetComponent("RectTransform"), self._mapNode.MainDodge_Pos_Hor)
self:SetKeyPos(self._mapNode.btnSkill.gameObject:GetComponent("RectTransform"), self._mapNode.MainSkill_Pos_Hor)
self:SetKeyPos(self._mapNode.btnUltra.gameObject:GetComponent("RectTransform"), self._mapNode.MainUltra_Pos_Hor)
else
self:SetKeyPos(self._mapNode.btnSuportSkill1.gameObject:GetComponent("RectTransform"), self._mapNode.SupSkill1_Pos)
self:SetKeyPos(self._mapNode.btnSupportUltra1.gameObject:GetComponent("RectTransform"), self._mapNode.SupUltra1_Pos)
self:SetKeyPos(self._mapNode.imgRoleHeadIcon[1].gameObject:GetComponent("RectTransform"), self._mapNode.SupRole1_Pos)
self:SetKeyPos(self._mapNode.btnSuportSkill2.gameObject:GetComponent("RectTransform"), self._mapNode.SupSkill2_Pos)
self:SetKeyPos(self._mapNode.btnSupportUltra2.gameObject:GetComponent("RectTransform"), self._mapNode.SupUltra2_Pos)
self:SetKeyPos(self._mapNode.imgRoleHeadIcon[2].gameObject:GetComponent("RectTransform"), self._mapNode.SupRole2_Pos)
self:SetKeyPos(self._mapNode.btnDodge.gameObject:GetComponent("RectTransform"), self._mapNode.MainDodge_Pos)
self:SetKeyPos(self._mapNode.btnSkill.gameObject:GetComponent("RectTransform"), self._mapNode.MainSkill_Pos)
self:SetKeyPos(self._mapNode.btnUltra.gameObject:GetComponent("RectTransform"), self._mapNode.MainUltra_Pos)
end
self._mapNode.imgBg_SupportRole:SetActive(nType == AllEnum.BattleHudType.Sector)
end
function PopupSkillCtrl:SetKeyPos(btnTra, parentTra)
btnTra:SetParent(parentTra)
btnTra.anchoredPosition = Vector2.zero
btnTra.localScale = Vector3.one
end
function PopupSkillCtrl:OnEvent_SetSimpleDesc()
PlayerData.Char:SetTipsPanelSkillDescType(true)
self:SetSkill(self.mapBtnFunc[self.curButton][1], self.mapBtnFunc[self.curButton][2], self.mapBtnFunc[self.curButton][3], self.mapBtnFunc[self.curButton][4])
end
function PopupSkillCtrl:OnEvent_SetDesc()
PlayerData.Char:SetTipsPanelSkillDescType(false)
self:SetSkill(self.mapBtnFunc[self.curButton][1], self.mapBtnFunc[self.curButton][2], self.mapBtnFunc[self.curButton][3], self.mapBtnFunc[self.curButton][4])
end
return PopupSkillCtrl
@@ -0,0 +1,21 @@
local PopupSkillPanel = class("PopupSkillPanel", BasePanel)
PopupSkillPanel._bIsMainPanel = false
PopupSkillPanel._bAddToBackHistory = false
PopupSkillPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
PopupSkillPanel._tbDefine = {
{
sPrefabPath = "CommonTipsEx/PopupSkillPanel/PopupSkillPanel.prefab",
sCtrlName = "Game.UI.CommonTipsEx.PopupSkillCtrl"
}
}
function PopupSkillPanel:Awake()
end
function PopupSkillPanel:OnEnable()
end
function PopupSkillPanel:OnDisable()
end
function PopupSkillPanel:OnDestroy()
end
function PopupSkillPanel:OnRelease()
end
return PopupSkillPanel
+384
View File
@@ -0,0 +1,384 @@
local BaseCtrl = require("Game.UI.CommonTipsEx.CommonTipsBaseCtrl")
local SkillTipsCtrl = class("SkillTipsCtrl", BaseCtrl)
local ConfigData = require("GameCore.Data.ConfigData")
SkillTipsCtrl.minTipHeight = 87
SkillTipsCtrl.maxTipHeight = 557
local titleHeight = 175
SkillTipsCtrl._mapNodeConfig = {
btnCloseTips = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClosePanel"
},
btnCloseWordTip = {
sComponentName = "Button",
callback = "OnBtnClick_CloseWord"
},
imgWordTipBg = {},
TMPWordDesc = {sComponentName = "TMP_Text"},
TMPWordTipsTitle = {sComponentName = "TMP_Text"},
imgTipsBg = {
sComponentName = "RectTransform"
},
rtContent = {
sComponentName = "RectTransform"
},
TipsContent = {
sComponentName = "RectTransform"
},
safeAreaRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "RectTransform"
},
srDesc = {
sComponentName = "RectTransform"
},
imgBranchSkillBg = {
sComponentName = "RectTransform"
},
BranchTipsContent = {
sComponentName = "RectTransform"
},
TMPBranchTitle = {sComponentName = "TMP_Text"},
imgBranchBg = {sComponentName = "Image"},
imgBranchIcon = {sComponentName = "Image"},
txtTalentRank = {sComponentName = "TMP_Text"},
TMPBranchDesc = {sComponentName = "TMP_Text"},
TMP_LinkBranch = {
sNodeName = "TMPBranchDesc",
sComponentName = "TMPHyperLink",
callback = "OnBtnClick_Word"
},
rtDescContent = {
sComponentName = "RectTransform"
},
TMPSkillTitle = {sComponentName = "TMP_Text"},
TMPSkillLevel = {sComponentName = "TMP_Text"},
imgSkillBg = {sComponentName = "Image"},
imgSkillIcon = {sComponentName = "Image"},
TMPSkillDesc = {sComponentName = "TMP_Text"},
imgCDInfoBg = {},
imgEnergyInfoBg = {},
rtSkillInfo = {},
TMPEnergy = {sComponentName = "TMP_Text"},
TMPCD = {sComponentName = "TMP_Text"},
TMP_Link = {
sNodeName = "TMPSkillDesc",
sComponentName = "TMPHyperLink",
callback = "OnBtnClick_Word"
},
RelatedSkillBg = {
sComponentName = "RectTransform"
},
RelatedTipsContent = {
sComponentName = "RectTransform"
},
RelatedSkillGrid = {},
btnShortcutClose = {
sComponentName = "NaviButton",
callback = "OnBtnClick_ClosePanel"
}
}
SkillTipsCtrl._mapEventConfig = {}
function SkillTipsCtrl:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.rtTarget = tbParam[1]
self.mapData = tbParam[2]
end
self._mapNode.RelatedSkillBg.gameObject:SetActive(false)
self._mapNode.RelatedSkillGrid:SetActive(false)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.rtContent:GetComponent("CanvasGroup"), 0)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.imgBranchSkillBg:GetComponent("CanvasGroup"), 0)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.RelatedSkillBg:GetComponent("CanvasGroup"), 0)
end
function SkillTipsCtrl:FadeIn()
end
function SkillTipsCtrl:FadeOut()
end
function SkillTipsCtrl:OnEnable()
self:EnableGamepadUI(self._mapNode.btnShortcutClose)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
self.sortingOrder = NovaAPI.GetCanvasSortingOrder(self.gameObject:GetComponent("Canvas"))
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = false
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", true)
NovaAPI.SetTopGridCanvasSorting(self.rtTarget.gameObject, self.sortingOrder)
if self.mapData.bTravelerDuel then
self:ShowTravelerDuelSkill()
elseif self.mapData.bMonster then
self:ShowMonsterSkill()
elseif self.mapData.bJointDrill then
self:ShowJointDrillBossSkill()
else
self:ShowCharacterSkill()
end
if self.mapData.bBranch then
local nBranchId = self.mapData.nBranchId
local nBranchLevel = self.mapData.nBranchLevel
local mapBranch = ConfigTable.GetData("RoguelikeTalentSkill", nBranchId)
if mapBranch ~= nil then
local sDesc = UTILS.ParseDesc(mapBranch)
NovaAPI.SetTMPText(self._mapNode.TMPBranchDesc, sDesc)
NovaAPI.SetTMPText(self._mapNode.txtTalentRank, ConfigTable.GetUIText("RomanNumeral_" .. nBranchLevel == 0 and 1 or nBranchLevel))
NovaAPI.SetTMPText(self._mapNode.TMPBranchTitle, mapBranch.Title)
self:SetPngSprite(self._mapNode.imgBranchIcon, mapBranch.Icon)
local nRare = nBranchId % 100 > 10 and GameEnum.itemRarity.SSR or GameEnum.itemRarity.SR
self:SetPngSprite(self._mapNode.imgBranchBg, "UI/big_sprites/rare_talent_" .. AllEnum.FrameColor_New[nRare])
self.bShowBranch = true
end
end
local wait = function()
if self.bShowBranch then
self._mapNode.imgBranchSkillBg.gameObject:SetActive(true)
local sortingOrder = NovaAPI.GetCanvasSortingOrder(self.gameObject:GetComponent("Canvas"))
NovaAPI.SetComponentEnableByName(self._mapNode.imgBranchSkillBg.gameObject, "TopGridCanvas", true)
NovaAPI.SetTopGridCanvasSorting(self._mapNode.imgBranchSkillBg.gameObject, sortingOrder)
else
self._mapNode.imgBranchSkillBg.gameObject:SetActive(false)
end
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local nContentHeight = self._mapNode.rtDescContent.sizeDelta.y
print(nContentHeight)
if nContentHeight > self.maxTipHeight then
nContentHeight = self.maxTipHeight
end
if nContentHeight < self.minTipHeight then
nContentHeight = self.minTipHeight
end
self._mapNode.srDesc.sizeDelta = Vector2(self._mapNode.srDesc.sizeDelta.x, nContentHeight + 4)
self._mapNode.imgTipsBg.sizeDelta = Vector2(self._mapNode.imgTipsBg.sizeDelta.x, nContentHeight + titleHeight)
if self.bShowBranch then
local nBrenchHeight = self._mapNode.BranchTipsContent.sizeDelta.y + 40
if nBrenchHeight > self.maxTipHeight then
nBrenchHeight = self.maxTipHeight
end
if nBrenchHeight < self.minTipHeight then
nBrenchHeight = self.minTipHeight
end
self._mapNode.imgBranchSkillBg.sizeDelta = Vector2(self._mapNode.imgBranchSkillBg.sizeDelta.x, nBrenchHeight)
end
self:SetTipsPosition(self.rtTarget, self._mapNode.rtContent, self._mapNode.safeAreaRoot)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
if self.bShowBranch then
local screenWidth = self._mapNode.safeAreaRoot.rect.size.x
if self._mapNode.rtContent.anchoredPosition.x - 2 * self._mapNode.imgBranchSkillBg.sizeDelta.x > -0.5 * screenWidth then
local anchors = Vector2(0, 1)
local Pivot = Vector2(1, 1)
self._mapNode.imgBranchSkillBg.anchorMax = anchors
self._mapNode.imgBranchSkillBg.anchorMin = anchors
self._mapNode.imgBranchSkillBg.pivot = Pivot
self._mapNode.imgBranchSkillBg.anchoredPosition = Vector2(24, 0)
else
local anchors = Vector2(1, 1)
local Pivot = Vector2(0, 1)
self._mapNode.imgBranchSkillBg.anchorMax = anchors
self._mapNode.imgBranchSkillBg.anchorMin = anchors
self._mapNode.imgBranchSkillBg.pivot = Pivot
self._mapNode.imgBranchSkillBg.anchoredPosition = Vector2(-24, 0)
end
NovaAPI.SetCanvasGroupAlpha(self._mapNode.imgBranchSkillBg:GetComponent("CanvasGroup"), 1)
end
end
cs_coroutine.start(wait)
end
function SkillTipsCtrl:OnDisable()
self:DisableGamepadUI()
end
function SkillTipsCtrl:OnDestroy()
end
function SkillTipsCtrl:OnRelease()
end
function SkillTipsCtrl:ShowCharacterSkill()
local mapSkill = ConfigTable.GetData_Skill(self.mapData.nSkillId)
if mapSkill == nil then
printError("SkillId未找到:" .. self.mapData.nSkillId)
return
end
self:SetPngSprite(self._mapNode.imgSkillIcon, mapSkill.Icon)
print(self.mapData.nSkillId)
print(self.mapData.nElementType)
self:SetAtlasSprite(self._mapNode.imgSkillBg, "12_rare", AllEnum.ElementIconType.Skill .. self.mapData.nElementType, true)
NovaAPI.SetTMPText(self._mapNode.TMPSkillTitle, mapSkill.Title)
NovaAPI.SetTMPText(self._mapNode.TMPSkillLevel, orderedFormat(ConfigTable.GetUIText("CommonTips_LevelFormat"), self.mapData.nLevel))
if mapSkill.Type == GameEnum.skillType.SKILL or mapSkill.Type == GameEnum.skillType.SUPPORT then
self._mapNode.imgCDInfoBg:SetActive(true)
self._mapNode.imgEnergyInfoBg:SetActive(false)
elseif mapSkill.Type == GameEnum.skillType.ULTIMATE then
self._mapNode.imgCDInfoBg:SetActive(true)
self._mapNode.imgEnergyInfoBg:SetActive(true)
else
self._mapNode.imgCDInfoBg:SetActive(false)
self._mapNode.imgEnergyInfoBg:SetActive(false)
self._mapNode.rtSkillInfo:SetActive(false)
end
local bHasSectionResumeTime = mapSkill.SectionResumeTime and mapSkill.SectionResumeTime ~= "" and mapSkill.SectionResumeTime ~= 0
local nCd = bHasSectionResumeTime and mapSkill.SectionResumeTime or mapSkill.SkillCD
local sCd = tostring(FormatNum(nCd * ConfigData.IntFloatPrecision)) .. ConfigTable.GetUIText("Talent_Sec")
if nCd <= 0 then
sCd = ConfigTable.GetUIText("Skill_NoCD")
end
NovaAPI.SetTMPText(self._mapNode.TMPCD, sCd)
NovaAPI.SetTMPText(self._mapNode.TMPEnergy, FormatNum(mapSkill.UltraEnergy * ConfigData.IntFloatPrecision))
local sDesc = UTILS.ParseDesc(mapSkill)
NovaAPI.SetTMPSourceText(self._mapNode.TMPSkillDesc, sDesc)
if not self.mapData.bBranch then
local rapidjson = require("rapidjson")
local tbRelatedSkill = rapidjson.decode(mapSkill.RelatedSkill)
if tbRelatedSkill ~= nil and 0 < #tbRelatedSkill then
self._mapNode.RelatedSkillBg.gameObject:SetActive(true)
self:SetRelatedSkill(tbRelatedSkill)
return
end
end
self._mapNode.RelatedSkillBg.gameObject:SetActive(false)
end
function SkillTipsCtrl:SetRelatedSkill(tbRelatedSkill)
self:ClearRelatedSkill()
local nCount = #tbRelatedSkill
for idx, tbParam in ipairs(tbRelatedSkill) do
local goGrid = instantiate(self._mapNode.RelatedSkillGrid, self._mapNode.RelatedTipsContent)
goGrid:SetActive(true)
local goCtrl = self:BindCtrlByNode(goGrid, "Game.UI.CommonTipsEx.SkillTipsRelatedGridCtrl")
goCtrl:SetParent(self)
table.insert(goCtrl, self.tbRelatedSkillCtrl)
local nLevel = self.mapData.nLevel
if tbParam[2] ~= nil and tbParam[2] ~= 0 then
nLevel = tbParam[2]
end
goCtrl:Refresh(tbParam[1], nLevel, self.mapData.nElementType, idx == nCount)
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local nContentHeight = self._mapNode.RelatedTipsContent.sizeDelta.y + 50
if 932 < nContentHeight then
nContentHeight = 932
end
self._mapNode.RelatedSkillBg.sizeDelta = Vector2(self._mapNode.imgTipsBg.sizeDelta.x, nContentHeight)
local screenWidth = self._mapNode.safeAreaRoot.rect.size.x
local screenHeight = self._mapNode.safeAreaRoot.rect.size.y
local tipsPosition = self._mapNode.rtContent.anchoredPosition.y + self._mapNode.imgTipsBg.anchoredPosition.y + self._mapNode.imgTipsBg.sizeDelta.y
local offsetY = 0
if tipsPosition - nContentHeight < -screenHeight * 0.5 + 60 then
offsetY = -screenHeight * 0.5 + 60 - (tipsPosition - nContentHeight)
end
if self._mapNode.rtContent.anchoredPosition.x - 2 * self._mapNode.RelatedSkillBg.sizeDelta.x > -0.5 * screenWidth then
local anchors = Vector2(0, 1)
local Pivot = Vector2(1, 1)
self._mapNode.RelatedSkillBg.anchorMax = anchors
self._mapNode.RelatedSkillBg.anchorMin = anchors
self._mapNode.RelatedSkillBg.pivot = Pivot
self._mapNode.RelatedSkillBg.anchoredPosition = Vector2(24, offsetY)
else
local anchors = Vector2(1, 1)
local Pivot = Vector2(0, 1)
self._mapNode.RelatedSkillBg.anchorMax = anchors
self._mapNode.RelatedSkillBg.anchorMin = anchors
self._mapNode.RelatedSkillBg.pivot = Pivot
self._mapNode.RelatedSkillBg.anchoredPosition = Vector2(-24, offsetY)
end
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
NovaAPI.SetCanvasGroupAlpha(self._mapNode.RelatedSkillBg:GetComponent("CanvasGroup"), 1)
end
cs_coroutine.start(wait)
end
function SkillTipsCtrl:ClearRelatedSkill()
if self.tbRelatedSkillCtrl ~= nil then
for _, relatedSkillCtrl in ipairs(self.tbRelatedSkillCtrl) do
local go = relatedSkillCtrl.gameObject
self:UnbindCtrlByNode(relatedSkillCtrl)
destroy(go)
end
end
delChildren(self._mapNode.RelatedTipsContent)
self.tbRelatedSkillCtrl = {}
end
function SkillTipsCtrl:ShowMonsterSkill()
local isWeeklyCopies = PlayerData.RogueBoss:GetIsWeeklyCopies()
local mapSkill = {}
if isWeeklyCopies then
mapSkill = ConfigTable.GetData("WeekBossAffix", self.mapData.nSkillId)
else
mapSkill = ConfigTable.GetData("RegionBossAffix", self.mapData.nSkillId)
end
if mapSkill == nil then
EventManager.Hit(EventId.CloesCurPanel)
return
end
NovaAPI.SetTMPText(self._mapNode.TMPSkillLevel, orderedFormat(ConfigTable.GetUIText("CommonTips_LevelFormat"), mapSkill.Level))
self:SetPngSprite(self._mapNode.imgSkillIcon, mapSkill.Icon)
self:SetAtlasSprite(self._mapNode.imgSkillBg, "12_rare", AllEnum.ElementIconType.Skill .. mapSkill.Element, true)
NovaAPI.SetTMPText(self._mapNode.TMPSkillTitle, mapSkill.Name)
local sDesc = UTILS.SubDesc(mapSkill.Desc)
NovaAPI.SetTMPSourceText(self._mapNode.TMPSkillDesc, sDesc)
self._mapNode.TMPSkillLevel.gameObject:SetActive(self.mapData.bBoss ~= true)
self._mapNode.imgCDInfoBg:SetActive(false)
self._mapNode.imgEnergyInfoBg:SetActive(false)
self._mapNode.rtSkillInfo:SetActive(false)
end
function SkillTipsCtrl:ShowTravelerDuelSkill()
local mapSkill = ConfigTable.GetData("TravelerDuelChallengeAffix", self.mapData.nSkillId)
if mapSkill == nil then
EventManager.Hit(EventId.CloesCurPanel)
return
end
self:SetPngSprite(self._mapNode.imgSkillIcon, mapSkill.Icon)
self:SetAtlasSprite(self._mapNode.imgSkillBg, "12_rare", AllEnum.ElementIconType.Skill .. mapSkill.Element, true)
NovaAPI.SetTMPText(self._mapNode.TMPSkillTitle, mapSkill.Name)
NovaAPI.SetTMPText(self._mapNode.TMPSkillLevel, "")
self._mapNode.imgCDInfoBg:SetActive(false)
self._mapNode.imgEnergyInfoBg:SetActive(false)
self._mapNode.rtSkillInfo:SetActive(false)
local sDesc = UTILS.SubDesc(mapSkill.Desc)
NovaAPI.SetTMPSourceText(self._mapNode.TMPSkillDesc, sDesc)
end
function SkillTipsCtrl:ShowJointDrillBossSkill()
local mapSkill = ConfigTable.GetData("JointDrillAffix", self.mapData.nSkillId)
if mapSkill == nil then
EventManager.Hit(EventId.CloesCurPanel)
return
end
self._mapNode.TMPSkillLevel.gameObject:SetActive(false)
self:SetPngSprite(self._mapNode.imgSkillIcon, mapSkill.Icon)
NovaAPI.SetTMPText(self._mapNode.TMPSkillTitle, mapSkill.Name)
local sDesc = UTILS.SubDesc(mapSkill.Desc)
NovaAPI.SetTMPSourceText(self._mapNode.TMPSkillDesc, sDesc)
self._mapNode.imgCDInfoBg:SetActive(false)
self._mapNode.imgEnergyInfoBg:SetActive(false)
self._mapNode.rtSkillInfo:SetActive(false)
end
function SkillTipsCtrl:OnBtnClick_Word(link, _, sWordId)
local nWordId = tonumber(sWordId)
local mapWordData = ConfigTable.GetData_World(nWordId)
if mapWordData == nil then
return
end
if link ~= nil then
local vX = NovaAPI.GetViewPointX(link.gameObject)
if 0.5 < vX then
self._mapNode.imgWordTipBg.transform.localPosition = Vector3(-self._mapNode.imgWordTipBg.transform.localPosition.x, self._mapNode.imgWordTipBg.transform.localPosition.y, self._mapNode.imgWordTipBg.transform.localPosition.z)
end
end
self._mapNode.btnCloseWordTip.gameObject:SetActive(true)
self._mapNode.imgWordTipBg:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.TMPWordDesc, mapWordData.Desc)
NovaAPI.SetTMPSourceText(self._mapNode.TMPWordTipsTitle, mapWordData.Title)
end
function SkillTipsCtrl:OnBtnClick_CloseWord(btn)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
end
function SkillTipsCtrl:OnBtnClick_ClosePanel(btn)
local btnComp = self.rtTarget:GetComponent("Button")
if btnComp ~= nil then
btnComp.interactable = true
end
NovaAPI.SetComponentEnableByName(self.rtTarget.gameObject, "TopGridCanvas", false)
NovaAPI.SetComponentEnableByName(self._mapNode.imgBranchSkillBg.gameObject, "TopGridCanvas", false)
EventManager.Hit(EventId.ClosePanel, PanelId.SkillTips)
end
return SkillTipsCtrl
@@ -0,0 +1,21 @@
local SkillTipsPanel = class("SkillTipsPanel", BasePanel)
SkillTipsPanel._bIsMainPanel = false
SkillTipsPanel._bAddToBackHistory = false
SkillTipsPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
SkillTipsPanel._tbDefine = {
{
sPrefabPath = "CommonTipsEx/SkillTips.prefab",
sCtrlName = "Game.UI.CommonTipsEx.SkillTipsCtrl"
}
}
function SkillTipsPanel:Awake()
end
function SkillTipsPanel:OnEnable()
end
function SkillTipsPanel:OnDisable()
end
function SkillTipsPanel:OnDestroy()
end
function SkillTipsPanel:OnRelease()
end
return SkillTipsPanel
@@ -0,0 +1,63 @@
local ConfigData = require("GameCore.Data.ConfigData")
local SkillTipsRelatedGridCtrl = class("SkillTipsRelatedGridCtrl", BaseCtrl)
SkillTipsRelatedGridCtrl._mapNodeConfig = {
TMPRelatedSkillTitle = {sComponentName = "TMP_Text"},
TMPRelatedSkillLevel = {sComponentName = "TMP_Text"},
imgRelatedSkillBg = {sComponentName = "Image"},
imgRelatedSkillIcon = {sComponentName = "Image"},
TMPRelatedSkillDesc = {sComponentName = "TMP_Text"},
imgRelatedCDInfoBg = {},
imgRelatedEnergyInfoBg = {},
rtRelatedSkillInfo = {},
TMPRelatedEnergy = {sComponentName = "TMP_Text"},
TMPRelatedCD = {sComponentName = "TMP_Text"},
imgLine = {},
TMP_LinkRelatedSkill = {
sNodeName = "TMPRelatedSkillDesc",
sComponentName = "TMPHyperLink",
callback = "OnBtnClick_Word"
}
}
SkillTipsRelatedGridCtrl._mapEventConfig = {}
function SkillTipsRelatedGridCtrl:Refresh(nSkillId, nLevel, nElement, bLast)
local mapSkill = ConfigTable.GetData_Skill(nSkillId)
if mapSkill == nil then
printError("SkillId未找到:" .. nSkillId)
return
end
self:SetPngSprite(self._mapNode.imgRelatedSkillIcon, ConfigTable.GetData_Skill(nSkillId).Icon)
self:SetAtlasSprite(self._mapNode.imgRelatedSkillBg, "12_rare", AllEnum.ElementIconType.Skill .. nElement)
NovaAPI.SetTMPText(self._mapNode.TMPRelatedSkillTitle, mapSkill.Title)
NovaAPI.SetTMPText(self._mapNode.TMPRelatedSkillLevel, orderedFormat(ConfigTable.GetUIText("CommonTips_LevelFormat"), nLevel))
if mapSkill.Type == GameEnum.skillType.SKILL or mapSkill.Type == GameEnum.skillType.SUPPORT then
self._mapNode.imgRelatedCDInfoBg:SetActive(true)
self._mapNode.imgRelatedEnergyInfoBg:SetActive(false)
elseif mapSkill.Type == GameEnum.skillType.ULTIMATE then
self._mapNode.imgRelatedCDInfoBg:SetActive(true)
self._mapNode.imgRelatedEnergyInfoBg:SetActive(true)
else
self._mapNode.imgRelatedCDInfoBg:SetActive(false)
self._mapNode.imgRelatedEnergyInfoBg:SetActive(false)
self._mapNode.rtRelatedSkillInfo:SetActive(false)
end
local bHasSectionResumeTime = mapSkill.SectionResumeTime and mapSkill.SectionResumeTime ~= "" and mapSkill.SectionResumeTime ~= 0
local nCd = bHasSectionResumeTime and mapSkill.SectionResumeTime or mapSkill.SkillCD
local sCd = tostring(FormatNum(nCd * ConfigData.IntFloatPrecision)) .. ConfigTable.GetUIText("Talent_Sec")
if nCd <= 0 then
sCd = ConfigTable.GetUIText("Skill_NoCD")
end
NovaAPI.SetTMPText(self._mapNode.TMPRelatedCD, sCd)
NovaAPI.SetTMPText(self._mapNode.TMPRelatedEnergy, FormatNum(mapSkill.UltraEnergy * ConfigData.IntFloatPrecision))
local sDesc = UTILS.ParseDesc(mapSkill)
NovaAPI.SetTMPSourceText(self._mapNode.TMPRelatedSkillDesc, sDesc)
self._mapNode.imgLine:SetActive(not bLast)
end
function SkillTipsRelatedGridCtrl:OnBtnClick_Word(link, _, sWordId)
if self.parent ~= nil then
self.parent:OnBtnClick_Word(link, _, sWordId)
end
end
function SkillTipsRelatedGridCtrl:SetParent(parent)
self.parent = parent
end
return SkillTipsRelatedGridCtrl
+80
View File
@@ -0,0 +1,80 @@
local TemplateTips = class("TemplateTips", BaseCtrl)
TemplateTips._mapNodeConfig = {
btnCloseTips = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClosePanel"
},
btnCloseWordTip = {
sComponentName = "Button",
callback = "OnBtnClick_CloseWord"
},
imgWordTipBg = {},
TMPWordDesc = {sComponentName = "TMP_Text"},
TMPWordTipsTitle = {sComponentName = "TMP_Text"},
imgTipsBg = {
sComponentName = "RectTransform"
},
rtConetnt = {
sComponentName = "RectTransform"
},
TipsContent = {
sComponentName = "RectTransform"
}
}
TemplateTips._mapEventConfig = {}
function TemplateTips:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.rtTarget = tbParam[1]
self.mapData = tbParam[2]
end
end
function TemplateTips:FadeIn()
end
function TemplateTips:FadeOut()
end
function TemplateTips:OnEnable()
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local nContentHeight = self._mapNode.TipsContent.sizeDelta.y
if nContentHeight > self.maxTipHeight then
nContentHeight = self.maxTipHeight
end
if nContentHeight < self.minTipHeight then
nContentHeight = self.minTipHeight
end
self._mapNode.imgTipsBg.sizeDelta = Vector2(self._mapNode.imgTipsBg.sizeDelta.x, nContentHeight)
self:SetTipsPosition(self.rtTarget, self._mapNdoe.rtContent)
end
cs_coroutine.start(wait)
end
function TemplateTips:OnDisable()
end
function TemplateTips:OnDestroy()
end
function TemplateTips:OnRelease()
end
function TemplateTips:OnBtnClick_Word(sWordId)
local nWordId = tonumber(sWordId)
local mapWordData = ConfigTable.GetData("Word", nWordId)
if mapWordData == nil then
printError("wordId error:" .. sWordId)
return
end
self._mapNode.btnCloseWordTip.gameObject:SetActive(true)
self._mapNode.imgWordTipBg:SetActive(true)
NovaAPI.SetTMPText(self._mapNode.TMPWordDesc, mapWordData.Desc)
NovaAPI.SetTMPSourceText(self._mapNode.TMPWordTipsTitle, mapWordData.Title)
self:SetWordTipsSize()
end
function TemplateTips:OnBtnClick_CloseWord(btn)
self._mapNode.btnCloseWordTip.gameObject:SetActive(false)
self._mapNode.imgWordTipBg:SetActive(false)
end
function TemplateTips:OnBtnClick_ClosePanel(btn)
EventManager.Hit(EventId.CloesCurPanel)
end
return TemplateTips