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:
@@ -0,0 +1,18 @@
|
||||
local TemplateAffinityLevelCtrl = class("TemplateAffinityLevelCtrl", BaseCtrl)
|
||||
TemplateAffinityLevelCtrl._mapNodeConfig = {
|
||||
imgHeart = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplateAffinityLevelCtrl._mapEventConfig = {}
|
||||
function TemplateAffinityLevelCtrl:SetInfo(nLevel)
|
||||
local data = {}
|
||||
local forEachAffinityLevel = function(mapData)
|
||||
if mapData.AffinityLevel == nLevel then
|
||||
data = mapData
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.AffinityLevel, forEachAffinityLevel)
|
||||
self:SetPngSprite(self._mapNode.imgHeart, data.AffinityLevelIcon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, nLevel)
|
||||
end
|
||||
return TemplateAffinityLevelCtrl
|
||||
@@ -0,0 +1,29 @@
|
||||
local TemplateAffixCtrl = class("TemplateAffixCtrl", BaseCtrl)
|
||||
local _, Gray = ColorUtility.TryParseHtmlString("#B5C3D0")
|
||||
TemplateAffixCtrl._mapNodeConfig = {
|
||||
imgBgNormal = {},
|
||||
imgBgActive = {},
|
||||
txtActive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Template_Active"
|
||||
},
|
||||
imgAffixIcon = {sComponentName = "Image"},
|
||||
txtAffixUnlock = {sComponentName = "TMP_Text"},
|
||||
txtAffixDesc = {sComponentName = "TMP_Text"},
|
||||
imgAffixLock = {}
|
||||
}
|
||||
TemplateAffixCtrl._mapEventConfig = {}
|
||||
function TemplateAffixCtrl:SetAffix(sDesc, sIcon, bNew, bLock, nLimit)
|
||||
self._mapNode.imgBgNormal:SetActive(not bNew)
|
||||
self._mapNode.imgBgActive:SetActive(bNew)
|
||||
self:SetPngSprite(self._mapNode.imgAffixIcon, sIcon)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgAffixIcon, bLock and Gray or Blue_Normal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAffixDesc, sDesc)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtAffixDesc, bLock and Gray or Blue_Normal)
|
||||
self._mapNode.imgAffixLock:SetActive(bLock)
|
||||
self._mapNode.txtAffixUnlock.gameObject:SetActive(bLock)
|
||||
if bLock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAffixUnlock, nLimit)
|
||||
end
|
||||
end
|
||||
return TemplateAffixCtrl
|
||||
@@ -0,0 +1,86 @@
|
||||
local TemplateArtWordsCtrl = class("TemplateArtWordsCtrl", BaseCtrl)
|
||||
local NumberEnum = {
|
||||
[0] = {
|
||||
level = "zs_vestige_level_0"
|
||||
},
|
||||
[1] = {
|
||||
level = "zs_vestige_level_1"
|
||||
},
|
||||
[2] = {
|
||||
level = "zs_vestige_level_2"
|
||||
},
|
||||
[3] = {
|
||||
level = "zs_vestige_level_3"
|
||||
},
|
||||
[4] = {
|
||||
level = "zs_vestige_level_4"
|
||||
},
|
||||
[5] = {
|
||||
level = "zs_vestige_level_5"
|
||||
},
|
||||
[6] = {
|
||||
level = "zs_vestige_level_6"
|
||||
},
|
||||
[7] = {
|
||||
level = "zs_vestige_level_7"
|
||||
},
|
||||
[8] = {
|
||||
level = "zs_vestige_level_8"
|
||||
},
|
||||
[9] = {
|
||||
level = "zs_vestige_level_9"
|
||||
}
|
||||
}
|
||||
local FontType = {Bold = 1, Level = 2}
|
||||
TemplateArtWordsCtrl._mapNodeConfig = {
|
||||
imgNum = {sComponentName = "Image", nCount = 3}
|
||||
}
|
||||
TemplateArtWordsCtrl._mapEventConfig = {}
|
||||
function TemplateArtWordsCtrl:SetText(nCount, nType)
|
||||
if nCount == nil then
|
||||
printError("设置失败, 内容为nil")
|
||||
return
|
||||
end
|
||||
if type(nCount) == "number" then
|
||||
self:SetNum(nCount, nType)
|
||||
else
|
||||
self:SetPunctuation(nCount, nType)
|
||||
end
|
||||
end
|
||||
function TemplateArtWordsCtrl:SetNum(nCount, nType)
|
||||
if nCount < 0 or 999 < nCount then
|
||||
printError("设置数字失败, 数字区间0~999, 当前数字: " .. nCount)
|
||||
return
|
||||
end
|
||||
local nHundreds, _ = math.modf(nCount / 100 % 10)
|
||||
local nTens, _ = math.modf(nCount / 10 % 10)
|
||||
local nOnes, _ = math.modf(nCount % 10)
|
||||
if 0 < nHundreds then
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgNum[1], self:GetSpriteByFontStyle(nType, nHundreds))
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgNum[1])
|
||||
self._mapNode.imgNum[1].gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.imgNum[1].gameObject:SetActive(false)
|
||||
end
|
||||
if 0 < nHundreds or 0 < nTens then
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgNum[2], self:GetSpriteByFontStyle(nType, nTens))
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgNum[2])
|
||||
self._mapNode.imgNum[2].gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.imgNum[2].gameObject:SetActive(false)
|
||||
end
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgNum[3], self:GetSpriteByFontStyle(nType, nOnes))
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgNum[3])
|
||||
self._mapNode.imgNum[3].gameObject:SetActive(true)
|
||||
end
|
||||
function TemplateArtWordsCtrl:SetPunctuation(sText, nType)
|
||||
self._mapNode.imgNum[1].gameObject:SetActive(false)
|
||||
self._mapNode.imgNum[2].gameObject:SetActive(false)
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgNum[3], self:GetSpriteByFontStyle(nType, sText))
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgNum[3])
|
||||
self._mapNode.imgNum[3].gameObject:SetActive(true)
|
||||
end
|
||||
function TemplateArtWordsCtrl:GetSpriteByFontStyle(nType, nNumber)
|
||||
return self:GetAtlasSprite("05_number", NumberEnum[nNumber].Level)
|
||||
end
|
||||
return TemplateArtWordsCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local TemplateBattleAssetBarCtrl = class("TemplateBattleAssetBarCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
TemplateBattleAssetBarCtrl._mapNodeConfig = {
|
||||
imgCoinIcon = {sComponentName = "Image"},
|
||||
txtCoinCount = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
function TemplateBattleAssetBarCtrl:Awake()
|
||||
self.rtObj = self.gameObject:GetComponent("RectTransform")
|
||||
end
|
||||
function TemplateBattleAssetBarCtrl:RefreshBar(assetId, assetCount)
|
||||
self:SetSprite_Coin(self._mapNode.imgCoinIcon, assetId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, assetCount)
|
||||
if nil ~= self.rtObj then
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self.rtObj)
|
||||
end
|
||||
end
|
||||
return TemplateBattleAssetBarCtrl
|
||||
@@ -0,0 +1,147 @@
|
||||
local TemplateCharCtrl = class("TemplateCharCtrl", BaseCtrl)
|
||||
TemplateCharCtrl._mapNodeConfig = {
|
||||
imgRareFrame = {sComponentName = "Image"},
|
||||
imgHead = {sComponentName = "Image"},
|
||||
imgRareName = {sComponentName = "Image"},
|
||||
imgElement = {sComponentName = "Image"},
|
||||
txtCharName = {sComponentName = "TMP_Text"},
|
||||
txtRank = {sComponentName = "TMP_Text"},
|
||||
txtLv = {sComponentName = "TMP_Text", sLanguageId = "Lv"},
|
||||
imgSelected = {},
|
||||
redDotChar = {},
|
||||
imgBg = {},
|
||||
imgElementMask = {},
|
||||
txtCharClass = {sComponentName = "TMP_Text"},
|
||||
imgAttackType = {sComponentName = "Image"},
|
||||
imgClassBg = {sComponentName = "Image"},
|
||||
imgRankBg = {},
|
||||
imgAttackTypeBg = {},
|
||||
goSkills = {},
|
||||
imgSkill = {nCount = 4, sComponentName = "Image"},
|
||||
txtSkill = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
imgAffinity = {sComponentName = "Image"},
|
||||
txtAffinity = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplateCharCtrl._mapEventConfig = {}
|
||||
function TemplateCharCtrl:SetChar(nCharId, bShowRedDot, bLocked, nTrialId, nSortType)
|
||||
self.nCharId = nCharId
|
||||
self._mapNode.imgSelected:SetActive(false)
|
||||
local mapTrial
|
||||
if nTrialId then
|
||||
mapTrial = ConfigTable.GetData("TrialCharacter", nTrialId)
|
||||
end
|
||||
local mapChar = ConfigTable.GetData_Character(nCharId)
|
||||
if mapChar == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharName, mapTrial and mapTrial.Name or mapChar.Name)
|
||||
local nLv = bLocked and 1 or PlayerData.Char:GetCharLv(nCharId)
|
||||
if mapTrial then
|
||||
nLv = mapTrial.Level
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank, nLv)
|
||||
local nSkinId = bLocked and ConfigTable.GetData_Character(nCharId).DefaultSkinId or PlayerData.Char:GetCharSkinId(nCharId)
|
||||
if mapTrial then
|
||||
nSkinId = mapTrial.CharacterSkin
|
||||
end
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
|
||||
if mapCharSkin == nil then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgHead, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XL)
|
||||
local nRarity = mapChar.Grade
|
||||
self:SetSprite_FrameColor(self._mapNode.imgRareFrame, nRarity == GameEnum.characterGrade.R and GameEnum.characterGrade.SR or nRarity, AllEnum.FrameType_New.CharFrame, true)
|
||||
self:SetSprite_FrameColor(self._mapNode.imgRareName, nRarity, AllEnum.FrameType_New.Text)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgRareName)
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapChar.EET
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", sName)
|
||||
self._mapNode.imgElementMask:SetActive(bLocked)
|
||||
self._mapNode.imgBg:SetActive(bLocked)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharClass, ConfigTable.GetUIText("Char_JobClass_" .. mapChar.Class))
|
||||
if mapChar.CharacterAttackType == GameEnum.characterAttackType.MELEE then
|
||||
self:SetAtlasSprite(self._mapNode.imgAttackType, "10_ico", "zs_list_near")
|
||||
elseif mapChar.CharacterAttackType == GameEnum.characterAttackType.RANGED then
|
||||
self:SetAtlasSprite(self._mapNode.imgAttackType, "10_ico", "zs_list_far")
|
||||
end
|
||||
if mapChar.Class == GameEnum.characterJobClass.Vanguard then
|
||||
self:SetAtlasSprite(self._mapNode.imgClassBg, "08_db", "db_list_herald")
|
||||
elseif mapChar.Class == GameEnum.characterJobClass.Balance then
|
||||
self:SetAtlasSprite(self._mapNode.imgClassBg, "08_db", "db_list_equal")
|
||||
elseif mapChar.Class == GameEnum.characterJobClass.Support then
|
||||
self:SetAtlasSprite(self._mapNode.imgClassBg, "08_db", "db_list_assist")
|
||||
end
|
||||
if bShowRedDot then
|
||||
self:RegisterRedDot()
|
||||
else
|
||||
self._mapNode.redDotChar.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.imgAffinity.gameObject:SetActive(nSortType == AllEnum.SortType.Affinity)
|
||||
self._mapNode.goSkills:SetActive(nSortType == AllEnum.SortType.Skill)
|
||||
if nSortType then
|
||||
if nSortType == AllEnum.SortType.Affinity then
|
||||
local mapCharAffinity = ConfigTable.GetData("CharAffinityTemplate", nCharId)
|
||||
if mapCharAffinity == nil then
|
||||
return
|
||||
end
|
||||
local templateId = mapCharAffinity.TemplateId
|
||||
local tbCharData = PlayerData.Char:GetCharDataById(nCharId)
|
||||
local curData = CacheTable.GetData("_AffinityLevel", templateId)[tbCharData.Favorability]
|
||||
if curData ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgAffinity, curData.AffinityLevelIcon)
|
||||
else
|
||||
self._mapNode.imgAffinity.gameObject:SetActive(false)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAffinity, tbCharData.Favorability)
|
||||
elseif nSortType == AllEnum.SortType.Skill then
|
||||
local mapCharSkill = PlayerData.Char:GetCharSkillUpgradeData(nCharId)
|
||||
if mapCharSkill ~= nil and not bLocked then
|
||||
for i = 1, 4 do
|
||||
local skillShowCfg = AllEnum.SkillTypeShow[i]
|
||||
local skillTypeIconIdx = skillShowCfg.iconIndex
|
||||
self:SetAtlasSprite(self._mapNode.imgSkill[i], "05_language", "zs_character_skill_text_" .. skillTypeIconIdx)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkill[i], mapCharSkill[i].nLv)
|
||||
end
|
||||
else
|
||||
self._mapNode.goSkills:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function TemplateCharCtrl:SetSpecificChar(nCharId, nLv, nSkinId)
|
||||
self._mapNode.imgSelected:SetActive(false)
|
||||
local mapChar = ConfigTable.GetData_Character(nCharId)
|
||||
if mapChar == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharName, mapChar.Name)
|
||||
self._mapNode.imgRankBg:SetActive(nLv)
|
||||
if nLv then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank, nLv)
|
||||
end
|
||||
nSkinId = nSkinId or ConfigTable.GetData_Character(nCharId).DefaultSkinId
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
|
||||
if mapCharSkin == nil then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgHead, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XL)
|
||||
local nRarity = mapChar.Grade
|
||||
self:SetSprite_FrameColor(self._mapNode.imgRareFrame, nRarity == GameEnum.characterGrade.R and GameEnum.characterGrade.SR or nRarity, AllEnum.FrameType_New.CharFrame, true)
|
||||
self:SetSprite_FrameColor(self._mapNode.imgRareName, nRarity, AllEnum.FrameType_New.Text)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgRareName)
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapChar.EET
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", sName)
|
||||
self._mapNode.imgElementMask:SetActive(false)
|
||||
self._mapNode.imgBg:SetActive(false)
|
||||
self._mapNode.imgAttackTypeBg:SetActive(false)
|
||||
self._mapNode.imgClassBg.gameObject:SetActive(false)
|
||||
self._mapNode.redDotChar.gameObject:SetActive(false)
|
||||
end
|
||||
function TemplateCharCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgSelected:SetActive(bSelect)
|
||||
end
|
||||
function TemplateCharCtrl:RegisterRedDot()
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_Item, self.nCharId, self._mapNode.redDotChar)
|
||||
end
|
||||
function TemplateCharCtrl:OnDisable()
|
||||
end
|
||||
return TemplateCharCtrl
|
||||
@@ -0,0 +1,48 @@
|
||||
local TemplateCharInfoCtrl = class("TemplateCharInfoCtrl", BaseCtrl)
|
||||
local ElementColor = {
|
||||
[GameEnum.elementType.WE] = Color(0.3058823529411765, 0.6235294117647059, 0.8470588235294118),
|
||||
[GameEnum.elementType.FE] = Color(0.9372549019607843, 0.3215686274509804, 0.1803921568627451),
|
||||
[GameEnum.elementType.SE] = Color(0.6313725490196078, 0.403921568627451, 0.23921568627450981),
|
||||
[GameEnum.elementType.AE] = Color(0.5294117647058824, 0.7490196078431373, 0.06274509803921569),
|
||||
[GameEnum.elementType.LE] = Color(0.9529411764705882, 0.7098039215686275, 0.12941176470588237),
|
||||
[GameEnum.elementType.DE] = Color(0.6941176470588235, 0.37254901960784315, 0.6235294117647059)
|
||||
}
|
||||
TemplateCharInfoCtrl._mapNodeConfig = {
|
||||
imgElementBg = {sComponentName = "Image"},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "T_Element_Property"
|
||||
},
|
||||
txtElement = {sComponentName = "TMP_Text"},
|
||||
imgElementIcon = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
imgRareName = {sComponentName = "Image"},
|
||||
imgCharColor = {sComponentName = "Image"},
|
||||
txtLv = {sComponentName = "TMP_Text", sLanguageId = "Lv"},
|
||||
txtLevel = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplateCharInfoCtrl._mapEventConfig = {}
|
||||
function TemplateCharInfoCtrl:Refresh(mapChar, configData, mapTrailCfg)
|
||||
local nLv = mapTrailCfg and mapTrailCfg.Level or mapChar.nLevel
|
||||
local nEET = configData.EET
|
||||
local sName = configData.Name
|
||||
local Grade = configData.Grade
|
||||
local CharColor
|
||||
local mapCharDescCfg = ConfigTable.GetData("CharacterDes", mapTrailCfg and mapTrailCfg.CharId or mapChar.nId)
|
||||
if mapCharDescCfg ~= nil then
|
||||
CharColor = mapCharDescCfg.CharColor
|
||||
else
|
||||
CharColor = ""
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, nLv)
|
||||
local Name = AllEnum.ElementIconType.Icon .. nEET
|
||||
self:SetAtlasSprite(self._mapNode.imgElementIcon, "12_rare", Name)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgElementBg, ElementColor[nEET])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtElement, ConfigTable.GetUIText("T_Element_Attr_" .. nEET))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapTrailCfg and mapTrailCfg.Name or sName)
|
||||
self:SetSprite_FrameColor(self._mapNode.imgRareName, Grade, AllEnum.FrameType_New.Text)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgRareName)
|
||||
local _, colorChar = ColorUtility.TryParseHtmlString(CharColor)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgCharColor, colorChar)
|
||||
end
|
||||
return TemplateCharInfoCtrl
|
||||
@@ -0,0 +1,35 @@
|
||||
local TemplateCoinCtrl = class("TemplateCoinCtrl", BaseCtrl)
|
||||
TemplateCoinCtrl._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplateCoinCtrl._mapEventConfig = {}
|
||||
function TemplateCoinCtrl:SetCoin(nTid, nCount, bThousands, nMaxCount)
|
||||
if nTid then
|
||||
self:SetSprite_Coin(self._mapNode.imgIcon, nTid)
|
||||
end
|
||||
if nCount then
|
||||
if bThousands then
|
||||
if nMaxCount < nCount then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, self:ThousandsNumber(nMaxCount) .. "+")
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, self:ThousandsNumber(nCount))
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, nCount)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TemplateCoinCtrl:SetCoinWithColor(nTid, nCount, bThousands, bEnough)
|
||||
if nTid then
|
||||
self:SetSprite_Coin(self._mapNode.imgIcon, nTid)
|
||||
end
|
||||
if nCount then
|
||||
local txt = bThousands and self:ThousandsNumber(nCount) or nCount
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, txt)
|
||||
if not bEnough then
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCount, Red_Unable)
|
||||
end
|
||||
end
|
||||
end
|
||||
return TemplateCoinCtrl
|
||||
@@ -0,0 +1,41 @@
|
||||
local TemplateDiscCtrl = class("TemplateDiscCtrl", BaseCtrl)
|
||||
TemplateDiscCtrl._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgFrame = {sComponentName = "Image"},
|
||||
imgEET = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtLv = {sComponentName = "TMP_Text", sLanguageId = "Lv"},
|
||||
imgDiscStar = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
redDotDisc = {}
|
||||
}
|
||||
TemplateDiscCtrl._mapEventConfig = {}
|
||||
function TemplateDiscCtrl:Refresh(nId)
|
||||
self.nId = nId
|
||||
local mapCfg = ConfigTable.GetData("Disc", nId)
|
||||
local mapItem = ConfigTable.GetData_Item(nId)
|
||||
if not mapCfg or not mapItem then
|
||||
return
|
||||
end
|
||||
local mapData = PlayerData.Disc:GetDiscById(nId)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItem.Icon)
|
||||
self:SetSprite_FrameColor(self._mapNode.imgFrame, mapData.nRarity, AllEnum.FrameType_New.DiscList)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, mapData.nLevel)
|
||||
self:SetAtlasSprite(self._mapNode.imgDiscStar, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[mapData.nRarity] .. "_0" .. mapData.nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgDiscStar)
|
||||
local nStar = 6 - mapData.nRarity
|
||||
self._mapNode.goStar:SetStar(nStar, nStar)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapData.sName)
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapCfg.EET
|
||||
self:SetAtlasSprite(self._mapNode.imgEET, "12_rare", sName)
|
||||
self:RegisterRedDot()
|
||||
end
|
||||
function TemplateDiscCtrl:RegisterRedDot()
|
||||
RedDotManager.RegisterNode(RedDotDefine.Disc_Item, self.nId, self._mapNode.redDotDisc)
|
||||
end
|
||||
function TemplateDiscCtrl:OnDisable()
|
||||
end
|
||||
return TemplateDiscCtrl
|
||||
@@ -0,0 +1,64 @@
|
||||
local TemplateDiscItemCtrl = class("TemplateDiscItemCtrl", BaseCtrl)
|
||||
TemplateDiscItemCtrl._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtLv = {sComponentName = "TMP_Text", sLanguageId = "Lv"},
|
||||
goStar = {sComponentName = "Image"},
|
||||
imgNoteBg = {nCount = 3, sComponentName = "Image"},
|
||||
Select = {},
|
||||
imgEET = {sComponentName = "Image"},
|
||||
txtDiscTag = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgRareBg = {sComponentName = "Image"}
|
||||
}
|
||||
TemplateDiscItemCtrl._mapEventConfig = {}
|
||||
function TemplateDiscItemCtrl:Refresh(nId, nStar, nMaxStar, nLevel, tbNote)
|
||||
local mapCfg = ConfigTable.GetData("Disc", nId)
|
||||
local mapItem = ConfigTable.GetData_Item(nId)
|
||||
if not mapCfg or not mapItem then
|
||||
return
|
||||
end
|
||||
self:SetAtlasSprite(self._mapNode.imgRareBg, "12_rare", AllEnum.FrameType_New.DiscFrameS .. AllEnum.FrameColor_New[mapItem.Rarity])
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItem.Icon .. AllEnum.OutfitIconSurfix.OutInfo)
|
||||
local sName = AllEnum.ElementIconType.Icon .. mapCfg.EET
|
||||
self:SetAtlasSprite(self._mapNode.imgEET, "12_rare", sName)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(nLevel)
|
||||
if nLevel then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, nLevel)
|
||||
end
|
||||
self._mapNode.goStar.gameObject:SetActive(nStar)
|
||||
if nStar then
|
||||
self:SetAtlasSprite(self._mapNode.goStar, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[mapItem.Rarity] .. "_0" .. nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.goStar)
|
||||
end
|
||||
if tbNote then
|
||||
for i = 1, 3 do
|
||||
self._mapNode.imgNoteBg[i].gameObject:SetActive(tbNote[i])
|
||||
if tbNote[i] then
|
||||
local mapNote = ConfigTable.GetData("SubNoteSkill", tbNote[i])
|
||||
if mapNote then
|
||||
self:SetPngSprite(self._mapNode.imgNoteBg[i], mapNote.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, 3 do
|
||||
self._mapNode.imgNoteBg[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
for i = 1, 3 do
|
||||
local nTag = mapCfg.Tags[i]
|
||||
if nTag then
|
||||
self._mapNode.txtDiscTag[i].gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiscTag[i], ConfigTable.GetData("DiscTag", nTag).Title)
|
||||
else
|
||||
self._mapNode.txtDiscTag[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TemplateDiscItemCtrl:SetSelect(bSelect)
|
||||
self._mapNode.Select:SetActive(bSelect)
|
||||
end
|
||||
function TemplateDiscItemCtrl:Awake()
|
||||
self._mapNode.Select:SetActive(false)
|
||||
end
|
||||
return TemplateDiscItemCtrl
|
||||
@@ -0,0 +1,27 @@
|
||||
local TemplateDiscLimitCtrl = class("TemplateDiscLimitCtrl", BaseCtrl)
|
||||
TemplateDiscLimitCtrl._mapNodeConfig = {
|
||||
tbCurrentLimit = {
|
||||
sNodeName = "imgDiscLimit",
|
||||
nCount = 6,
|
||||
sComponentName = "Image"
|
||||
},
|
||||
tbNextLimit = {
|
||||
sNodeName = "imgDiscUpgrade",
|
||||
nCount = 6,
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
TemplateDiscLimitCtrl._mapEventConfig = {}
|
||||
function TemplateDiscLimitCtrl:SetLimit(nCurrentLimit, nNextLimit, nDiscRarity)
|
||||
if nNextLimit <= nCurrentLimit then
|
||||
nNextLimit = 0
|
||||
end
|
||||
for i = 1, 6 do
|
||||
self._mapNode.tbCurrentLimit[i].gameObject:SetActive(i <= nCurrentLimit or i == 1)
|
||||
self:SetAtlasSprite(self._mapNode.tbCurrentLimit[i], "12_rare", AllEnum.FrameType_New.DiscLimitL .. AllEnum.FrameColor_New[nDiscRarity])
|
||||
local imgDiscUpgrade = self._mapNode.tbNextLimit[i]:GetChild(0):GetComponent("Image")
|
||||
imgDiscUpgrade.gameObject:SetActive(nCurrentLimit < i and i <= nNextLimit)
|
||||
self:SetAtlasSprite(imgDiscUpgrade, "12_rare", AllEnum.FrameType_New.DiscLimitL .. AllEnum.FrameColor_New[nDiscRarity])
|
||||
end
|
||||
end
|
||||
return TemplateDiscLimitCtrl
|
||||
@@ -0,0 +1,56 @@
|
||||
local TemplateDiscMultiNoteCtrl = class("TemplateDiscMultiNoteCtrl", BaseCtrl)
|
||||
TemplateDiscMultiNoteCtrl._mapNodeConfig = {
|
||||
imgNoteBg = {nCount = 2, sComponentName = "Image"},
|
||||
NoteMask = {},
|
||||
imgNoteIcon = {nCount = 2, sComponentName = "Image"},
|
||||
txtNoteCount = {sComponentName = "TMP_Text"},
|
||||
cgNoteCount = {
|
||||
sNodeName = "txtNoteCount",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
cgNoteIcon = {
|
||||
sNodeName = "goNoteIcon",
|
||||
sComponentName = "CanvasGroup"
|
||||
}
|
||||
}
|
||||
TemplateDiscMultiNoteCtrl._mapEventConfig = {}
|
||||
function TemplateDiscMultiNoteCtrl:SetNoteItem(tbNoteId, nCount, bLock)
|
||||
if next(tbNoteId) == nil then
|
||||
return
|
||||
end
|
||||
if #tbNoteId == 1 then
|
||||
self._mapNode.NoteMask:SetActive(false)
|
||||
self._mapNode.imgNoteIcon[2].gameObject:SetActive(false)
|
||||
local noteConfig = ConfigTable.GetData("Note", tbNoteId[1])
|
||||
if noteConfig ~= nil then
|
||||
local _, _color = ColorUtility.TryParseHtmlString(noteConfig.Color)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtNoteCount, _color)
|
||||
end
|
||||
else
|
||||
self._mapNode.NoteMask:SetActive(true)
|
||||
self._mapNode.imgNoteIcon[2].gameObject:SetActive(true)
|
||||
local _, _color = ColorUtility.TryParseHtmlString("#264278")
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtNoteCount, _color)
|
||||
end
|
||||
table.sort(tbNoteId)
|
||||
for i, nNoteId in ipairs(tbNoteId) do
|
||||
if 2 < i then
|
||||
printError("混色音符种类配出超过2个")
|
||||
break
|
||||
end
|
||||
local noteConfig = ConfigTable.GetData("Note", nNoteId)
|
||||
if noteConfig ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgNoteBg[i], noteConfig.Style4)
|
||||
self:SetPngSprite(self._mapNode.imgNoteIcon[i], noteConfig.Style7)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteCount, nCount)
|
||||
if bLock then
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgNoteCount, 0.4)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgNoteIcon, 0.4)
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgNoteCount, 1)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgNoteIcon, 1)
|
||||
end
|
||||
end
|
||||
return TemplateDiscMultiNoteCtrl
|
||||
@@ -0,0 +1,22 @@
|
||||
local TemplateDiscNoteCtrl = class("TemplateDiscNoteCtrl", BaseCtrl)
|
||||
TemplateDiscNoteCtrl._mapNodeConfig = {
|
||||
imgNoteBg = {sComponentName = "Image"},
|
||||
txtNoteCount = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplateDiscNoteCtrl._mapEventConfig = {}
|
||||
function TemplateDiscNoteCtrl:SetNoteItem(nNoteId, nCount, bMain)
|
||||
local noteConfig = ConfigTable.GetData("Note", nNoteId)
|
||||
if noteConfig ~= nil then
|
||||
if nCount == nil then
|
||||
self:SetPngSprite(self._mapNode.imgNoteBg, bMain and noteConfig.Style6 or noteConfig.Style8)
|
||||
self._mapNode.txtNoteCount.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.txtNoteCount.gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgNoteBg, noteConfig.Style4)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtNoteCount, nCount)
|
||||
local _, _color = ColorUtility.TryParseHtmlString(noteConfig.Color)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtNoteCount, _color)
|
||||
end
|
||||
end
|
||||
end
|
||||
return TemplateDiscNoteCtrl
|
||||
@@ -0,0 +1,63 @@
|
||||
local TemplateDiscSkillCardCtrl = class("TemplateDiscSkillCardCtrl", BaseCtrl)
|
||||
TemplateDiscSkillCardCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgIconBg = {sComponentName = "Image"},
|
||||
imgCornerBg = {sComponentName = "Image"},
|
||||
imgCornerIcon = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
goStar = {sComponentName = "Image"},
|
||||
goStarEmpty = {},
|
||||
Content = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txtDesc",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
}
|
||||
}
|
||||
TemplateDiscSkillCardCtrl._mapEventConfig = {}
|
||||
function TemplateDiscSkillCardCtrl:Refresh(nDiscId, nMainSkillId, nSubSkillId, nStar)
|
||||
local mapItem = ConfigTable.GetData("Item", nDiscId)
|
||||
if not mapItem then
|
||||
return
|
||||
end
|
||||
self._mapNode.goStar.gameObject:SetActive(nMainSkillId)
|
||||
self._mapNode.goStarEmpty.gameObject:SetActive(nMainSkillId)
|
||||
self._mapNode.txtLevel.gameObject:SetActive(nSubSkillId)
|
||||
if nMainSkillId ~= nil then
|
||||
self:SetAtlasSprite(self._mapNode.goStar, "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[mapItem.Rarity] .. "_0" .. nStar + 1)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.goStar)
|
||||
local mapSkillCfg = ConfigTable.GetData("MainSkill", nMainSkillId)
|
||||
if mapSkillCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapSkillCfg.Name)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapSkillCfg.Icon)
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, mapSkillCfg.IconBg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, UTILS.ParseParamDesc(mapSkillCfg.Desc, mapSkillCfg))
|
||||
end
|
||||
elseif nSubSkillId ~= nil then
|
||||
local mapSkillCfg = ConfigTable.GetData("SecondarySkill", nSubSkillId)
|
||||
if mapSkillCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("Disc_Skill_Level") or "", mapSkillCfg.Level))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapSkillCfg.Name)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapSkillCfg.Icon)
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, mapSkillCfg.IconBg)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, UTILS.ParseParamDesc(mapSkillCfg.Desc, mapSkillCfg))
|
||||
end
|
||||
end
|
||||
local sFrame = AllEnum.FrameType_New.HarmonySkillL .. AllEnum.FrameColor_New[mapItem.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sFrame)
|
||||
self._mapNode.imgCornerBg.gameObject:SetActive(false)
|
||||
self._mapNode.Content.anchoredPosition = Vector2(0, 0)
|
||||
self:ChangeWordRaycast(false)
|
||||
end
|
||||
function TemplateDiscSkillCardCtrl:ChangeWordRaycast(bEnable)
|
||||
self._mapNode.txtDesc.raycastTarget = bEnable
|
||||
end
|
||||
function TemplateDiscSkillCardCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId)
|
||||
end
|
||||
return TemplateDiscSkillCardCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local TemplateDiscStarCtrl = class("TemplateDiscStarCtrl", BaseCtrl)
|
||||
TemplateDiscStarCtrl._mapNodeConfig = {
|
||||
tbStar = {
|
||||
sNodeName = "btnStar",
|
||||
nCount = 6,
|
||||
sComponentName = "Image"
|
||||
}
|
||||
}
|
||||
TemplateDiscStarCtrl._mapEventConfig = {}
|
||||
function TemplateDiscStarCtrl:SetStar(nStar, nRare)
|
||||
if nStar ~= nil then
|
||||
self.gameObject:SetActive(true)
|
||||
for i = 1, 6 do
|
||||
self._mapNode.tbStar[i].gameObject:SetActive(i <= nStar + 1)
|
||||
if i <= nStar + 1 then
|
||||
self:SetAtlasSprite(self._mapNode.tbStar[i], "12_rare", AllEnum.FrameType_New.DiscLimitS .. AllEnum.FrameColor_New[nRare])
|
||||
end
|
||||
end
|
||||
else
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
return TemplateDiscStarCtrl
|
||||
@@ -0,0 +1,44 @@
|
||||
local TemplateDropdownCtrl = class("TemplateDropdownCtrl", BaseCtrl)
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
TemplateDropdownCtrl._mapNodeConfig = {
|
||||
imgUp = {},
|
||||
imgDown = {},
|
||||
Dropdown = {
|
||||
sComponentName = "TMP_Dropdown",
|
||||
callback = "OnDD_Select"
|
||||
}
|
||||
}
|
||||
TemplateDropdownCtrl._mapEventConfig = {
|
||||
DropdownOpenState = "OnEvent_Open"
|
||||
}
|
||||
function TemplateDropdownCtrl:SetList(tbLanguageId, nDefualtValue, bText)
|
||||
self._mapNode.Dropdown:ClearOptions()
|
||||
local List_String = CS.System.Collections.Generic.List(CS.System.String)
|
||||
local lst = List_String()
|
||||
for _, value in pairs(tbLanguageId) do
|
||||
if not bText then
|
||||
lst:Add(ConfigTable.GetUIText(value))
|
||||
else
|
||||
lst:Add(value)
|
||||
end
|
||||
end
|
||||
self._mapNode.Dropdown:AddOptions(lst)
|
||||
self._mapNode.Dropdown.value = nDefualtValue or 0
|
||||
end
|
||||
function TemplateDropdownCtrl:GetValue()
|
||||
return self._mapNode.Dropdown.value
|
||||
end
|
||||
function TemplateDropdownCtrl:Awake()
|
||||
self._mapNode.imgUp:SetActive(true)
|
||||
self._mapNode.imgDown:SetActive(false)
|
||||
end
|
||||
function TemplateDropdownCtrl:OnEvent_Open(bOpen)
|
||||
self._mapNode.imgUp:SetActive(not bOpen)
|
||||
self._mapNode.imgDown:SetActive(bOpen)
|
||||
local sSound = bOpen and "ui_common_menu_open" or "ui_common_menu_close"
|
||||
CS.WwiseAudioManager.Instance:PlaySound(sSound)
|
||||
end
|
||||
function TemplateDropdownCtrl:OnDD_Select(dd)
|
||||
EventManager.Hit("SelectTemplateDD", self._mapNode.Dropdown.value)
|
||||
end
|
||||
return TemplateDropdownCtrl
|
||||
@@ -0,0 +1,26 @@
|
||||
local TemplateElementCtrl = class("TemplateElementCtrl", BaseCtrl)
|
||||
local ElementColor = {
|
||||
[GameEnum.elementType.WE] = Color(0.3058823529411765, 0.6235294117647059, 0.8470588235294118),
|
||||
[GameEnum.elementType.FE] = Color(0.9372549019607843, 0.3215686274509804, 0.1803921568627451),
|
||||
[GameEnum.elementType.SE] = Color(0.6313725490196078, 0.403921568627451, 0.23921568627450981),
|
||||
[GameEnum.elementType.AE] = Color(0.5294117647058824, 0.7490196078431373, 0.06274509803921569),
|
||||
[GameEnum.elementType.LE] = Color(0.9529411764705882, 0.7098039215686275, 0.12941176470588237),
|
||||
[GameEnum.elementType.DE] = Color(0.6941176470588235, 0.37254901960784315, 0.6235294117647059)
|
||||
}
|
||||
TemplateElementCtrl._mapNodeConfig = {
|
||||
imgElementBg = {sComponentName = "Image"},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "T_Element_Property"
|
||||
},
|
||||
txtElement = {sComponentName = "TMP_Text"},
|
||||
imgElementIcon = {sComponentName = "Image"}
|
||||
}
|
||||
TemplateElementCtrl._mapEventConfig = {}
|
||||
function TemplateElementCtrl:Refresh(nEET)
|
||||
local sName = AllEnum.ElementIconType.Icon .. nEET
|
||||
self:SetAtlasSprite(self._mapNode.imgElementIcon, "12_rare", sName)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgElementBg, ElementColor[nEET])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtElement, ConfigTable.GetUIText("T_Element_Attr_" .. nEET))
|
||||
end
|
||||
return TemplateElementCtrl
|
||||
@@ -0,0 +1,31 @@
|
||||
local TemplateEnemyElementCtrl = class("TemplateEnemyElementCtrl", BaseCtrl)
|
||||
local ElementColor = {
|
||||
[GameEnum.elementType.WE] = Color(0.3058823529411765, 0.6235294117647059, 0.8470588235294118),
|
||||
[GameEnum.elementType.FE] = Color(0.9372549019607843, 0.3215686274509804, 0.1803921568627451),
|
||||
[GameEnum.elementType.SE] = Color(0.6313725490196078, 0.403921568627451, 0.23921568627450981),
|
||||
[GameEnum.elementType.AE] = Color(0.5294117647058824, 0.7490196078431373, 0.06274509803921569),
|
||||
[GameEnum.elementType.LE] = Color(0.9529411764705882, 0.7098039215686275, 0.12941176470588237),
|
||||
[GameEnum.elementType.DE] = Color(0.6941176470588235, 0.37254901960784315, 0.6235294117647059)
|
||||
}
|
||||
TemplateEnemyElementCtrl._mapNodeConfig = {
|
||||
imgElementBg = {sComponentName = "Image"},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "T_Element_Weakness"
|
||||
},
|
||||
imgElementIcon = {nCount = 3, sComponentName = "Image"}
|
||||
}
|
||||
TemplateEnemyElementCtrl._mapEventConfig = {}
|
||||
function TemplateEnemyElementCtrl:Refresh(tbEETList)
|
||||
for _, v in ipairs(self._mapNode.imgElementIcon) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
for k, nEET in ipairs(tbEETList) do
|
||||
if nil ~= nEET and 0 ~= nEET and nil ~= self._mapNode.imgElementIcon[k] then
|
||||
self._mapNode.imgElementIcon[k].gameObject:SetActive(true)
|
||||
local sName = AllEnum.ElementIconType.Icon .. nEET
|
||||
self:SetAtlasSprite(self._mapNode.imgElementIcon[k], "12_rare", sName)
|
||||
end
|
||||
end
|
||||
end
|
||||
return TemplateEnemyElementCtrl
|
||||
@@ -0,0 +1,29 @@
|
||||
local TemplateExclusiveItemCtrl = class("TemplateExclusiveItemCtrl", BaseCtrl)
|
||||
TemplateExclusiveItemCtrl._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgSelect = {},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
imgMask = {sComponentName = "Image"}
|
||||
}
|
||||
TemplateExclusiveItemCtrl._mapEventConfig = {}
|
||||
function TemplateExclusiveItemCtrl:SetPerk(nTid, nStar, nMaxStar, bHas)
|
||||
local mapCfg = ConfigTable.GetData_Item(nTid)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon)
|
||||
self._mapNode.goStar:SetStar(nStar, nMaxStar)
|
||||
self._mapNode.imgSelect:SetActive(false)
|
||||
local sPath = AllEnum.FrameType_New.ExclusivePerk .. AllEnum.FrameColor_New[mapCfg.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sPath)
|
||||
if bHas == false then
|
||||
self._mapNode.imgMask.gameObject:SetActive(true)
|
||||
self:SetAtlasSprite(self._mapNode.imgMask, "12_rare", sPath)
|
||||
else
|
||||
self._mapNode.imgMask.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function TemplateExclusiveItemCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgSelect:SetActive(bSelect)
|
||||
end
|
||||
return TemplateExclusiveItemCtrl
|
||||
@@ -0,0 +1,114 @@
|
||||
local TemplateExpBarCtrl = class("TemplateExpBarCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
TemplateExpBarCtrl._mapNodeConfig = {
|
||||
imgBar = {sComponentName = "Image"},
|
||||
imgBarAdd = {sComponentName = "Image"},
|
||||
txtCurExp = {sComponentName = "TMP_Text"},
|
||||
txtMaxCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Template_ExpBar_Max"
|
||||
}
|
||||
}
|
||||
TemplateExpBarCtrl._mapEventConfig = {}
|
||||
function TemplateExpBarCtrl:Refresh(mapBefore, mapAfter)
|
||||
if not mapAfter then
|
||||
local bMaxLv = mapBefore.nLevel == mapBefore.nMaxLevel
|
||||
self._mapNode.imgBarAdd.gameObject:SetActive(false)
|
||||
self._mapNode.imgBar.gameObject:SetActive(true)
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgBar, bMaxLv and 1 or mapBefore.nExp / mapBefore.nMaxExp)
|
||||
self._mapNode.txtMaxCn.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtCurExp.gameObject:SetActive(not bMaxLv)
|
||||
if not bMaxLv then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCurExp, mapBefore.nExp .. "/" .. mapBefore.nMaxExp)
|
||||
end
|
||||
else
|
||||
local bMaxLv = mapAfter.nLevel == mapAfter.nMaxLevel
|
||||
self._mapNode.imgBarAdd.gameObject:SetActive(true)
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgBarAdd, bMaxLv and 1 or mapAfter.nExp / mapAfter.nMaxExp)
|
||||
self._mapNode.imgBar.gameObject:SetActive(mapBefore.nLevel == mapAfter.nLevel)
|
||||
if mapBefore.nLevel == mapAfter.nLevel then
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgBar, bMaxLv and 1 or mapBefore.nExp / mapBefore.nMaxExp)
|
||||
self._mapNode.imgBarAdd.gameObject:SetActive(mapAfter.nExp > mapBefore.nExp)
|
||||
end
|
||||
self._mapNode.txtMaxCn.gameObject:SetActive(bMaxLv)
|
||||
self._mapNode.txtCurExp.gameObject:SetActive(not bMaxLv)
|
||||
if not bMaxLv then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCurExp, mapAfter.nExp .. "/" .. mapAfter.nMaxExp)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TemplateExpBarCtrl:PlayAni(mapBefore, mapAfter, callback, txt)
|
||||
local bMaxLv = mapAfter.nLevel == mapAfter.nMaxLevel
|
||||
local nAddLevel = mapAfter.nLevel - mapBefore.nLevel
|
||||
local nAddCount = 0
|
||||
if nAddLevel == 0 then
|
||||
nAddCount = 1
|
||||
elseif 0 < mapAfter.nExp then
|
||||
nAddCount = nAddLevel + 1
|
||||
else
|
||||
nAddCount = nAddLevel
|
||||
end
|
||||
local nAniTime = 0.2
|
||||
if nAddCount < 6 then
|
||||
nAniTime = 0.2
|
||||
elseif 6 <= nAddCount and nAddCount < 11 then
|
||||
nAniTime = 0.06
|
||||
elseif 11 <= nAddCount then
|
||||
nAniTime = 0.03
|
||||
end
|
||||
local nBeforeToMaxTime = nAniTime * (1 - mapBefore.nExp / mapBefore.nMaxExp)
|
||||
local nBeforeToAfterTime = nAniTime * ((mapAfter.nExp - mapBefore.nExp) / mapAfter.nMaxExp)
|
||||
local nZeroToAfterTime = nAniTime * mapAfter.nExp / mapAfter.nMaxExp
|
||||
local nAllTime = 0
|
||||
local sequence = DOTween.Sequence()
|
||||
for i = 1, nAddCount - 1 do
|
||||
local nTime = i == 1 and nBeforeToMaxTime or nAniTime
|
||||
nAllTime = nAllTime + nTime
|
||||
sequence:AppendCallback(function()
|
||||
WwiseAudioMgr:PlaySound("ui_common_levelUp")
|
||||
end)
|
||||
sequence:Append(NovaAPI.ImageDoFillAmount(self._mapNode.imgBar, 1, nTime, false))
|
||||
sequence:AppendCallback(function()
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgBar, 0)
|
||||
NovaAPI.SetTMPText(txt, mapBefore.nLevel + i)
|
||||
end)
|
||||
end
|
||||
if bMaxLv then
|
||||
local nTime = 1 < nAddCount and nAniTime or nBeforeToMaxTime
|
||||
nAllTime = nAllTime + nTime
|
||||
sequence:AppendCallback(function()
|
||||
WwiseAudioMgr:PlaySound("ui_common_levelUp")
|
||||
end)
|
||||
sequence:Append(NovaAPI.ImageDoFillAmount(self._mapNode.imgBar, 1, nTime, false))
|
||||
elseif mapAfter.nExp > 0 then
|
||||
local nTime = 1 < nAddCount and nZeroToAfterTime or nBeforeToAfterTime
|
||||
nAllTime = nAllTime + nTime
|
||||
sequence:AppendCallback(function()
|
||||
WwiseAudioMgr:PlaySound("ui_common_levelUp")
|
||||
end)
|
||||
sequence:Append(NovaAPI.ImageDoFillAmount(self._mapNode.imgBar, mapAfter.nExp / mapAfter.nMaxExp, nTime, false))
|
||||
elseif mapAfter.nExp == 0 then
|
||||
local nTime = 1 < nAddCount and nAniTime or nBeforeToMaxTime
|
||||
nAllTime = nAllTime + nTime
|
||||
sequence:AppendCallback(function()
|
||||
WwiseAudioMgr:PlaySound("ui_common_levelUp")
|
||||
end)
|
||||
sequence:Append(NovaAPI.ImageDoFillAmount(self._mapNode.imgBar, 1, nTime, false))
|
||||
sequence:AppendCallback(function()
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgBar, 0)
|
||||
end)
|
||||
end
|
||||
sequence:SetUpdate(true)
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
local _cb = function()
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
if txt then
|
||||
NovaAPI.SetTMPText(txt, mapAfter.nLevel)
|
||||
end
|
||||
end
|
||||
sequence.onComplete = dotween_callback_handler(self, _cb)
|
||||
end
|
||||
return TemplateExpBarCtrl
|
||||
@@ -0,0 +1,36 @@
|
||||
local TemplateHarmonySkillItemCtrl = class("TemplateHarmonySkillItemCtrl", BaseCtrl)
|
||||
TemplateHarmonySkillItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgIconBg = {sComponentName = "Image"},
|
||||
imgCornerBg = {sComponentName = "Image"},
|
||||
imgCornerIcon = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtTag = {sComponentName = "TMP_Text"},
|
||||
Select = {}
|
||||
}
|
||||
TemplateHarmonySkillItemCtrl._mapEventConfig = {}
|
||||
function TemplateHarmonySkillItemCtrl:Refresh(nId)
|
||||
local mapCfg = ConfigTable.GetData("StarTowerHarmonySkill", nId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
local mapTag = ConfigTable.GetData("DiscTag", mapCfg.Tag)
|
||||
if mapTag then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTag, mapTag.Title)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapCfg.Name)
|
||||
local sFrame = AllEnum.FrameType_New.HarmonySkillS .. AllEnum.FrameColor_New[mapCfg.Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sFrame)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon)
|
||||
self:SetPngSprite(self._mapNode.imgIconBg, mapCfg.IconBg)
|
||||
self._mapNode.imgCornerBg.gameObject:SetActive(mapCfg.IconCorner ~= "")
|
||||
if mapCfg.IconCorner ~= "" then
|
||||
self:SetPngSprite(self._mapNode.imgCornerBg, mapCfg.IconBg .. AllEnum.DiscSkillIconSurfix.Corner)
|
||||
self:SetPngSprite(self._mapNode.imgCornerIcon, mapCfg.IconCorner)
|
||||
end
|
||||
end
|
||||
function TemplateHarmonySkillItemCtrl:SetSelect(bSelect)
|
||||
self._mapNode.Select:SetActive(bSelect)
|
||||
end
|
||||
return TemplateHarmonySkillItemCtrl
|
||||
@@ -0,0 +1,44 @@
|
||||
local TemplateHeadCtrl = class("TemplateHeadCtrl", BaseCtrl)
|
||||
local HeadType = {Monster = 1, Char = 2}
|
||||
TemplateHeadCtrl._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgSelect = {},
|
||||
Monster = {
|
||||
sNodeName = "--Monster--"
|
||||
},
|
||||
goBoss = {},
|
||||
goElite = {}
|
||||
}
|
||||
TemplateHeadCtrl._mapEventConfig = {}
|
||||
function TemplateHeadCtrl:SetMonsterHead(nMonsterId)
|
||||
self:_SwitchType(HeadType.Monster)
|
||||
local mapMonster = ConfigTable.GetData("Monster", nMonsterId)
|
||||
if mapMonster == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local mapSkin = ConfigTable.GetData("MonsterSkin", mapMonster.FAId)
|
||||
if mapSkin == nil then
|
||||
return
|
||||
end
|
||||
local mapMonsterManual = ConfigTable.GetData("MonsterManual", mapSkin.MonsterManual)
|
||||
if mapMonsterManual == nil then
|
||||
return
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapMonsterManual.Icon)
|
||||
if mapMonster.EpicLv == GameEnum.monsterEpicType.LORD then
|
||||
self._mapNode.goBoss:SetActive(true)
|
||||
self._mapNode.goElite:SetActive(false)
|
||||
elseif mapMonster.EpicLv == GameEnum.monsterEpicType.LEADER or mapMonster.EpicLv == GameEnum.monsterEpicType.ELITE then
|
||||
self._mapNode.goBoss:SetActive(false)
|
||||
self._mapNode.goElite:SetActive(true)
|
||||
else
|
||||
self._mapNode.goBoss:SetActive(false)
|
||||
self._mapNode.goElite:SetActive(false)
|
||||
end
|
||||
end
|
||||
function TemplateHeadCtrl:_SwitchType(enumType)
|
||||
self._mapNode.Monster:SetActive(enumType == HeadType.Monster)
|
||||
end
|
||||
return TemplateHeadCtrl
|
||||
@@ -0,0 +1,216 @@
|
||||
local TemplateItemCtrl = class("TemplateItemCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local _, Gray = ColorUtility.TryParseHtmlString("#5E89B4")
|
||||
TemplateItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
Basic = {sNodeName = "--Basic--"},
|
||||
Item = {sNodeName = "--Item--"},
|
||||
Char = {sNodeName = "--Char--"},
|
||||
imgTimeLimit = {},
|
||||
imgBasicCharIcon = {sComponentName = "Image"},
|
||||
imgCharRare = {sComponentName = "Image"},
|
||||
imgTimeBg = {},
|
||||
rtImgTimeBg = {
|
||||
sNodeName = "imgTimeBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgTime = {nCount = 3},
|
||||
txtItemTime = {sComponentName = "TMP_Text"},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
Select = {},
|
||||
imgMultiSelected1 = {},
|
||||
imgMultiSelected2 = {},
|
||||
imgMultiSelectedMask1 = {},
|
||||
imgMultiSelectedMask2 = {},
|
||||
imgCharIcon = {sComponentName = "Image"},
|
||||
goReceived = {},
|
||||
txtReceived = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RogueBoss_Receive_Tip"
|
||||
},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
txtX = {sComponentName = "TMP_Text"},
|
||||
imgFirstPass = {},
|
||||
imgThreePass = {},
|
||||
imgExtra = {},
|
||||
imgElement = {sComponentName = "Image"}
|
||||
}
|
||||
TemplateItemCtrl._mapEventConfig = {}
|
||||
function TemplateItemCtrl:SetItem(nItemId, nRarity, nCount, nExpire, bReceived, bFirstPass, bThreePass, bFullShow, bMat, bHideTime, bExtraDrop)
|
||||
local nStar = 0
|
||||
if nItemId and nItemId ~= 0 then
|
||||
local mapCfg = ConfigTable.GetData_Item(nItemId)
|
||||
if mapCfg == nil then
|
||||
printError("Item CfgData Missing:" .. nItemId)
|
||||
end
|
||||
if mapCfg.Type == GameEnum.itemType.Char then
|
||||
self:SetChar(nItemId, nCount, bReceived)
|
||||
return
|
||||
end
|
||||
if mapCfg.Type == GameEnum.itemType.Disc then
|
||||
nStar = 6 - mapCfg.Rarity
|
||||
end
|
||||
end
|
||||
self:_SwitchType(GameEnum.itemType.Item)
|
||||
self:_SetCommon(nItemId, nRarity, 0, nStar, nil, nExpire, bReceived, bHideTime)
|
||||
self:_SetCount(nCount, bFullShow, bMat)
|
||||
self:_SetPassState(bFirstPass, bThreePass, bExtraDrop)
|
||||
end
|
||||
function TemplateItemCtrl:SetChar(nItemId, nCount, bReceived, nRewardType)
|
||||
self:_SwitchType(GameEnum.itemType.Char)
|
||||
local itemCfg = ConfigTable.GetData_Item(nItemId)
|
||||
local nMaxStar = 6 - itemCfg.Rarity
|
||||
self:SetAtlasSprite(self._mapNode.imgCharRare, "12_rare", AllEnum.FrameType_New.Item .. AllEnum.FrameColor_New[itemCfg.Rarity])
|
||||
self:_SetCommon(nItemId, nil, 0, nMaxStar, nil, nil, bReceived)
|
||||
if nCount and 1 < nCount then
|
||||
self:_SetCount(nCount)
|
||||
else
|
||||
self:_SetCount()
|
||||
end
|
||||
self:_SetPassState(nRewardType and nRewardType == AllEnum.RewardType.First, nRewardType and nRewardType == AllEnum.RewardType.Three, false)
|
||||
end
|
||||
function TemplateItemCtrl:SetSelect(bSelect)
|
||||
self._mapNode.Select:SetActive(bSelect)
|
||||
end
|
||||
function TemplateItemCtrl:SetMultiSelected_Blue(bSelect)
|
||||
self._mapNode.imgMultiSelected1:SetActive(bSelect)
|
||||
self._mapNode.imgMultiSelectedMask1:SetActive(bSelect)
|
||||
end
|
||||
function TemplateItemCtrl:SetMultiSelected_Red(bSelect)
|
||||
self._mapNode.imgMultiSelected2:SetActive(bSelect)
|
||||
self._mapNode.imgMultiSelectedMask2:SetActive(bSelect)
|
||||
end
|
||||
function TemplateItemCtrl:SetLock(bLock)
|
||||
end
|
||||
function TemplateItemCtrl:_SetChar(nCharId)
|
||||
if nCharId and nCharId ~= 0 then
|
||||
self._mapNode.imgCharIcon.gameObject:SetActive(true)
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharId)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgCharIcon, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.S)
|
||||
else
|
||||
self._mapNode.imgCharIcon.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function TemplateItemCtrl:_SetCommon(nItemId, nRarity, nStar, nMaxStar, nCharId, nExpire, bReceived, bHideTime)
|
||||
self:_SetChar(nCharId)
|
||||
self._mapNode.Select:SetActive(false)
|
||||
self._mapNode.imgMultiSelected1:SetActive(false)
|
||||
self._mapNode.imgMultiSelectedMask1:SetActive(false)
|
||||
self._mapNode.imgMultiSelected2:SetActive(false)
|
||||
self._mapNode.imgMultiSelectedMask2:SetActive(false)
|
||||
self._mapNode.goStar:SetStar(nStar, nMaxStar)
|
||||
self._mapNode.goReceived:SetActive(bReceived)
|
||||
self._mapNode.imgTimeLimit.gameObject:SetActive(false)
|
||||
if not nItemId or nItemId == 0 then
|
||||
self._mapNode.imgIcon.gameObject:SetActive(false)
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", AllEnum.FrameType_New.Item .. AllEnum.FrameColor_New[0])
|
||||
self._mapNode.imgTimeBg:SetActive(false)
|
||||
return
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData_Item(nItemId)
|
||||
self._mapNode.imgIcon.gameObject:SetActive(true)
|
||||
if mapCfg.Type == GameEnum.itemType.Disc then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
local mapDiscCfgData = ConfigTable.GetData("Disc", nItemId)
|
||||
if mapDiscCfgData ~= nil then
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
|
||||
self._mapNode.imgElement.gameObject:SetActive(true)
|
||||
end
|
||||
elseif mapCfg.Type == GameEnum.itemType.Char then
|
||||
self:SetPngSprite(self._mapNode.imgBasicCharIcon, mapCfg.Icon)
|
||||
local mapCharCfgData = ConfigTable.GetData("Character", nItemId)
|
||||
if mapCharCfgData ~= nil then
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Char_Element[mapCharCfgData.EET].icon)
|
||||
self._mapNode.imgElement.gameObject:SetActive(true)
|
||||
end
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon)
|
||||
self._mapNode.imgElement.gameObject:SetActive(false)
|
||||
end
|
||||
if not nRarity and nItemId then
|
||||
nRarity = mapCfg.Rarity
|
||||
end
|
||||
local sPath = AllEnum.FrameType_New.Item .. AllEnum.FrameColor_New[nRarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sPath)
|
||||
local nTimeType
|
||||
local sTimeStr = ""
|
||||
if nExpire and nExpire ~= 0 then
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = nExpire - curTime
|
||||
if 86400 <= remainTime then
|
||||
sTimeStr = math.floor(remainTime / 86400) .. ConfigTable.GetUIText("Depot_Item_LeftTime_Day")
|
||||
nTimeType = 1
|
||||
elseif 3600 <= remainTime then
|
||||
sTimeStr = math.floor(remainTime / 3600) .. ConfigTable.GetUIText("Depot_Item_LeftTime_Hour")
|
||||
nTimeType = 2
|
||||
else
|
||||
local nMin = math.max(math.floor(remainTime / 60), 1)
|
||||
sTimeStr = nMin .. ConfigTable.GetUIText("Depot_LeftTime_Min")
|
||||
nTimeType = 3
|
||||
end
|
||||
end
|
||||
self._mapNode.imgTimeBg:SetActive(nTimeType ~= nil)
|
||||
if nTimeType then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemTime, sTimeStr)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtImgTimeBg)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.imgTime[i]:SetActive(i == nTimeType)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgTimeLimit.gameObject:SetActive(mapCfg and mapCfg.ExpireType ~= 0 and nTimeType == nil and not bHideTime)
|
||||
end
|
||||
function TemplateItemCtrl:_SetCount(nCount, bFullShow, bMat)
|
||||
if nCount and type(nCount) == "string" and nCount ~= "" then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, nCount)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCount, Blue_Normal)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtX, Blue_Normal)
|
||||
self._mapNode.txtX.gameObject:SetActive(true)
|
||||
self._mapNode.txtCount.gameObject:SetActive(true)
|
||||
elseif nCount and 1 < nCount then
|
||||
if 999999 < nCount then
|
||||
local nFloor = math.floor(nCount / 100)
|
||||
local nK = string.format("%.0f", nFloor / 10)
|
||||
local sCount = nK .. "k"
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, sCount)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, nCount)
|
||||
end
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCount, Blue_Normal)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtX, Blue_Normal)
|
||||
self._mapNode.txtX.gameObject:SetActive(true)
|
||||
self._mapNode.txtCount.gameObject:SetActive(true)
|
||||
elseif nCount and nCount == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, nCount)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCount, Gray)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtX, Gray)
|
||||
self._mapNode.txtX.gameObject:SetActive(true)
|
||||
self._mapNode.txtCount.gameObject:SetActive(true)
|
||||
elseif nCount and nCount == 1 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, nCount)
|
||||
if bMat then
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCount, Blue_Normal)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtX, Blue_Normal)
|
||||
end
|
||||
self._mapNode.txtX.gameObject:SetActive(true)
|
||||
self._mapNode.txtCount.gameObject:SetActive(true)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, "")
|
||||
self._mapNode.txtX.gameObject:SetActive(false)
|
||||
self._mapNode.txtCount.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function TemplateItemCtrl:_SetPassState(bFirstPass, bThreePass, bExtraDrop)
|
||||
self._mapNode.imgFirstPass:SetActive(bFirstPass)
|
||||
self._mapNode.imgThreePass:SetActive(bThreePass)
|
||||
self._mapNode.imgExtra:SetActive(bExtraDrop)
|
||||
end
|
||||
function TemplateItemCtrl:_SwitchType(enumType)
|
||||
self._mapNode.Item:SetActive(enumType == GameEnum.itemType.Item)
|
||||
self._mapNode.Char:SetActive(enumType == GameEnum.itemType.Char)
|
||||
self._mapNode.Basic:SetActive(enumType ~= GameEnum.itemType.Char)
|
||||
end
|
||||
return TemplateItemCtrl
|
||||
@@ -0,0 +1,47 @@
|
||||
local TemplateJumptoCtrl = class("TemplateJumptoCtrl", BaseCtrl)
|
||||
TemplateJumptoCtrl._mapNodeConfig = {
|
||||
imgArrow = {},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
btnJump = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Jump"
|
||||
}
|
||||
}
|
||||
TemplateJumptoCtrl._mapEventConfig = {}
|
||||
function TemplateJumptoCtrl:Refresh(nSourceId, sourceData)
|
||||
self.nSourceId = nSourceId
|
||||
self.sourceData = sourceData
|
||||
self.bClickAble = true
|
||||
if nSourceId == 1 then
|
||||
self._mapNode.imgArrow:SetActive(true)
|
||||
local tbData = string.split(sourceData, "_")
|
||||
local nId = tonumber(tbData[1])
|
||||
local nprobID = tonumber(tbData[2])
|
||||
local sprob = ""
|
||||
if nprobID ~= nil then
|
||||
local sDropRate = "DropRate_" .. nprobID
|
||||
sprob = ConfigTable.GetUIText(sDropRate)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, ConfigTable.GetData_Mainline(nId).Num .. sprob)
|
||||
local stars = PlayerData.Mainline:GetMainlineStar(nId)
|
||||
if stars == nil then
|
||||
self._mapNode.btnJump.gameObject:SetActive(false)
|
||||
end
|
||||
elseif nSourceId == 2 then
|
||||
self._mapNode.imgArrow:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, orderedFormat(ConfigTable.GetUIText("Obtainway_Sale"), sourceData))
|
||||
elseif nSourceId == 3 then
|
||||
self._mapNode.imgArrow:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, orderedFormat(ConfigTable.GetUIText("Obtainway_Func"), sourceData))
|
||||
elseif nSourceId == 4 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, sourceData)
|
||||
self._mapNode.imgArrow:SetActive(false)
|
||||
self.bClickAble = false
|
||||
end
|
||||
end
|
||||
function TemplateJumptoCtrl:OnBtnClick_Jump()
|
||||
if self.bClickAble then
|
||||
EventManager.Hit("OnEvent_DepotJumpToSource", self.nSourceId, self.sourceData)
|
||||
end
|
||||
end
|
||||
return TemplateJumptoCtrl
|
||||
@@ -0,0 +1,75 @@
|
||||
local TemplateMatCtrl = class("TemplateMatCtrl", BaseCtrl)
|
||||
local _, Green = ColorUtility.TryParseHtmlString("#0ABEC5")
|
||||
TemplateMatCtrl._mapNodeConfig = {
|
||||
goItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
txtCost = {sComponentName = "TMP_Text"},
|
||||
rtSelect = {},
|
||||
txtHas = {sComponentName = "TMP_Text"},
|
||||
txtRequire = {sComponentName = "TMP_Text"},
|
||||
goReduce = {},
|
||||
imgMask = {}
|
||||
}
|
||||
TemplateMatCtrl._mapEventConfig = {}
|
||||
function TemplateMatCtrl:SetEmpty(nItemId)
|
||||
self._mapNode.goItem:SetItem(nItemId)
|
||||
self._mapNode.rtSelect:SetActive(false)
|
||||
self._mapNode.imgMask:SetActive(false)
|
||||
self._mapNode.txtRequire.gameObject:SetActive(false)
|
||||
end
|
||||
function TemplateMatCtrl:SetMat(nItemId, nRequireCount, nCustomHas)
|
||||
self.nHasCount = nCustomHas and nCustomHas or PlayerData.Item:GetItemCountByID(nItemId)
|
||||
self.nItemId = nItemId
|
||||
self:SetSelectCount()
|
||||
if 0 == nItemId then
|
||||
self:SetEmpty()
|
||||
elseif nRequireCount then
|
||||
self._mapNode.goItem:SetItem(nItemId)
|
||||
self._mapNode.txtRequire.gameObject:SetActive(true)
|
||||
self._mapNode.rtSelect:SetActive(false)
|
||||
if self.nHasCount > 1000 then
|
||||
local nFloor = math.floor(self.nHasCount / 100)
|
||||
local nK = string.format("%.1f", nFloor / 10)
|
||||
local sHas = nK .. "k"
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas, sHas)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtHas, self.nHasCount)
|
||||
end
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtHas, nRequireCount <= self.nHasCount and Green or Red_Unable)
|
||||
if 1000 < nRequireCount then
|
||||
local nFloor = math.floor(nRequireCount / 100)
|
||||
local nK = string.format("%.1f", nFloor / 10)
|
||||
local sRequire = nK .. "k"
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRequire, "/" .. sRequire)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRequire, "/" .. nRequireCount)
|
||||
end
|
||||
self._mapNode.imgMask:SetActive(false)
|
||||
else
|
||||
self._mapNode.imgMask:SetActive(self.nHasCount <= 0)
|
||||
self._mapNode.txtRequire.gameObject:SetActive(false)
|
||||
self._mapNode.rtSelect:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCost, self.nHasCount)
|
||||
self._mapNode.goItem:SetItem(nItemId)
|
||||
end
|
||||
end
|
||||
function TemplateMatCtrl:SetSelectCount(nCount)
|
||||
if nCount and 0 < nCount then
|
||||
self._mapNode.goReduce:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCost, self.nHasCount - nCount)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtCost, Blue_Normal)
|
||||
self._mapNode.goItem:SetItem(self.nItemId, nil, nCount, nil, nil, nil, nil, true, true)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCost, self.nHasCount)
|
||||
self._mapNode.goReduce:SetActive(false)
|
||||
self._mapNode.goItem:SetItem(self.nItemId)
|
||||
end
|
||||
end
|
||||
function TemplateMatCtrl:SetSelect(flage)
|
||||
if self.nItemId == 0 then
|
||||
return
|
||||
end
|
||||
self._mapNode.goItem:SetMultiSelected_Blue(flage)
|
||||
end
|
||||
return TemplateMatCtrl
|
||||
@@ -0,0 +1,73 @@
|
||||
local TemplateMatGridCtrl = class("TemplateMatGridCtrl", BaseCtrl)
|
||||
TemplateMatGridCtrl._mapNodeConfig = {
|
||||
goItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
goEmpty = {},
|
||||
txtCost = {sComponentName = "TMP_Text"},
|
||||
rtSelect = {},
|
||||
goReduce = {}
|
||||
}
|
||||
TemplateMatGridCtrl._mapEventConfig = {}
|
||||
function TemplateMatGridCtrl:RerfeshGrid(mapData)
|
||||
self._mapNode.goReduce:SetActive(false)
|
||||
self._mapNode.rtSelect:SetActive(false)
|
||||
self._mapNode.goItem.gameObject:SetActive(true)
|
||||
self._mapNode.goEmpty:SetActive(false)
|
||||
self.nType = mapData.nType
|
||||
if self.nType == GameEnum.itemStype.DiscLimitBreak then
|
||||
self._mapNode.goItem:SetItem(mapData.nId, nil, nil, nil, nil, nil, nil, true, true)
|
||||
else
|
||||
self.nHasCount = PlayerData.Item:GetItemCountByID(mapData.nId)
|
||||
self.nItemId = mapData.nId
|
||||
self._mapNode.goItem:SetItem(mapData.nId, nil, self.nHasCount, nil, nil, nil, nil, true, true)
|
||||
end
|
||||
end
|
||||
function TemplateMatGridCtrl:RerfeshSelected(mapData)
|
||||
self._mapNode.goReduce:SetActive(false)
|
||||
self._mapNode.rtSelect:SetActive(false)
|
||||
self._mapNode.goItem.gameObject:SetActive(mapData)
|
||||
self._mapNode.goEmpty:SetActive(not mapData)
|
||||
if not mapData then
|
||||
return
|
||||
end
|
||||
self.nType = mapData.nType
|
||||
if self.nType == GameEnum.itemStype.DiscLimitBreak then
|
||||
self._mapNode.goItem:SetItem(mapData.nId, nil, nil, nil, nil, nil, nil, true, true)
|
||||
else
|
||||
self.nHasCount = mapData.nCost
|
||||
self.nItemId = mapData.nId
|
||||
self._mapNode.goItem:SetItem(mapData.nId, nil, self.nHasCount, nil, nil, nil, nil, true, true)
|
||||
end
|
||||
end
|
||||
function TemplateMatGridCtrl:SetGridCount(nCount)
|
||||
if self.nType ~= GameEnum.itemStype.DiscLimitBreak then
|
||||
if nCount and 0 < nCount then
|
||||
self._mapNode.goReduce:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCost, nCount)
|
||||
self._mapNode.rtSelect:SetActive(true)
|
||||
self._mapNode.goItem:SetItem(self.nItemId, nil, self.nHasCount - nCount, nil, nil, nil, nil, true, true)
|
||||
else
|
||||
self._mapNode.rtSelect:SetActive(false)
|
||||
self._mapNode.goReduce:SetActive(false)
|
||||
self._mapNode.goItem:SetItem(self.nItemId, nil, self.nHasCount, nil, nil, nil, nil, true, true)
|
||||
end
|
||||
end
|
||||
self:SetMultiSelected_Blue(nCount and 0 < nCount)
|
||||
end
|
||||
function TemplateMatGridCtrl:SetSelectedCount(nCount)
|
||||
self._mapNode.goReduce:SetActive(true)
|
||||
if self.nType ~= GameEnum.itemStype.DiscLimitBreak then
|
||||
self._mapNode.goItem:SetItem(self.nItemId, nil, nCount, nil, nil, nil, nil, true)
|
||||
end
|
||||
end
|
||||
function TemplateMatGridCtrl:SetSelect(bSelect)
|
||||
self._mapNode.goItem:SetSelect(bSelect)
|
||||
end
|
||||
function TemplateMatGridCtrl:SetLock(bLock)
|
||||
self._mapNode.goItem:SetLock(bLock)
|
||||
end
|
||||
function TemplateMatGridCtrl:SetMultiSelected_Blue(bSelect)
|
||||
self._mapNode.goItem:SetMultiSelected_Blue(bSelect)
|
||||
end
|
||||
return TemplateMatGridCtrl
|
||||
@@ -0,0 +1,61 @@
|
||||
local TemplatePerkItemCtrl = class("TemplatePerkItemCtrl", BaseCtrl)
|
||||
TemplatePerkItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgSelect = {},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
imgMask = {nCount = 2, sComponentName = "Image"},
|
||||
Enhanced = {},
|
||||
imgEnhancedNone = {},
|
||||
imgEnhancedBar = {nCount = 2},
|
||||
txtEnhancedState1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerkQuest_State_Doing"
|
||||
},
|
||||
txtEnhancedState2 = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplatePerkItemCtrl._mapEventConfig = {}
|
||||
function TemplatePerkItemCtrl:SetPerk(nTid, nStar, nMaxStar, bHas, nState)
|
||||
local mapCfg = ConfigTable.GetData_Item(nTid)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon)
|
||||
local mapPerk = ConfigTable.GetData_Perk(nTid)
|
||||
local bEnhanced = mapPerk.PerkType == GameEnum.perkType.Strengthen
|
||||
local sPath = ""
|
||||
if mapPerk.Slot ~= 0 then
|
||||
sPath = AllEnum.FrameType_New.SlotPerk .. 4
|
||||
elseif bEnhanced then
|
||||
sPath = AllEnum.FrameType_New.SlotPerk .. 5
|
||||
else
|
||||
sPath = AllEnum.FrameType_New.ThemePerk .. AllEnum.FrameColor_New[mapCfg.Rarity]
|
||||
end
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sPath)
|
||||
self._mapNode.goStar:SetStar(nStar, nMaxStar)
|
||||
self._mapNode.imgSelect:SetActive(false)
|
||||
if bHas == false then
|
||||
if bEnhanced then
|
||||
self._mapNode.Enhanced:SetActive(true)
|
||||
self._mapNode.imgMask[2].gameObject:SetActive(nState ~= AllEnum.EnhancedPerkState.Off)
|
||||
self._mapNode.imgEnhancedBar[1]:SetActive(nState == AllEnum.EnhancedPerkState.On)
|
||||
self._mapNode.imgEnhancedBar[2]:SetActive(nState ~= AllEnum.EnhancedPerkState.On)
|
||||
self._mapNode.imgEnhancedNone:SetActive(nState == AllEnum.EnhancedPerkState.Off)
|
||||
self._mapNode.imgIcon.gameObject:SetActive(nState ~= AllEnum.EnhancedPerkState.Off)
|
||||
if nState == AllEnum.EnhancedPerkState.Off then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEnhancedState2, ConfigTable.GetUIText("PerkQuest_State_Off"))
|
||||
elseif nState == AllEnum.EnhancedPerkState.Lock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEnhancedState2, ConfigTable.GetUIText("PerkQuest_State_Stop"))
|
||||
end
|
||||
else
|
||||
self._mapNode.imgMask[1].gameObject:SetActive(true)
|
||||
self:SetAtlasSprite(self._mapNode.imgMask[1], "12_rare", sPath)
|
||||
end
|
||||
else
|
||||
self._mapNode.imgMask[1].gameObject:SetActive(false)
|
||||
self._mapNode.Enhanced:SetActive(false)
|
||||
end
|
||||
end
|
||||
function TemplatePerkItemCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgSelect:SetActive(bSelect)
|
||||
end
|
||||
return TemplatePerkItemCtrl
|
||||
@@ -0,0 +1,122 @@
|
||||
local TemplatePropertyCtrl = class("TemplatePropertyCtrl", BaseCtrl)
|
||||
local ValueColor = {
|
||||
up = Color(0.5490196078431373, 0.6745098039215687, 0.34901960784313724, 1),
|
||||
down = Color(0.3764705882352941, 0.6901960784313725, 0.050980392156862744, 1),
|
||||
black = Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764, 1)
|
||||
}
|
||||
TemplatePropertyCtrl._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtProperty = {sComponentName = "TMP_Text"},
|
||||
txtValue1 = {sComponentName = "TMP_Text"},
|
||||
imgUp = {},
|
||||
imgDown = {},
|
||||
txtValue2 = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplatePropertyCtrl._mapEventConfig = {}
|
||||
function TemplatePropertyCtrl:SetItemProperty(sKey, nValue, nValueAfter, bAdditionDesc)
|
||||
local mapAttributeDesc = self:_GetAttributeDesc(sKey)
|
||||
if not mapAttributeDesc then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtValue2, ValueColor.black)
|
||||
self._mapNode.imgUp:SetActive(false)
|
||||
self._mapNode.imgDown:SetActive(false)
|
||||
local sValue, sValueAfter = "", ""
|
||||
sValue = self:_TransValueFormat(nValue, mapAttributeDesc.isPercent, mapAttributeDesc.Format)
|
||||
if nValueAfter then
|
||||
sValueAfter = self:_TransValueFormat(nValueAfter, mapAttributeDesc.isPercent, mapAttributeDesc.Format)
|
||||
if nValueAfter < nValue then
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtValue2, ValueColor.down)
|
||||
self._mapNode.imgDown:SetActive(true)
|
||||
elseif nValue < nValueAfter then
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtValue2, ValueColor.up)
|
||||
self._mapNode.imgUp:SetActive(true)
|
||||
end
|
||||
end
|
||||
if bAdditionDesc then
|
||||
self:_RefreshContent(mapAttributeDesc.Icon, mapAttributeDesc.RandomAttrDesc, sValue, sValueAfter)
|
||||
else
|
||||
self:_RefreshContent(mapAttributeDesc.Icon, mapAttributeDesc.Desc, sValue, sValueAfter)
|
||||
end
|
||||
end
|
||||
function TemplatePropertyCtrl:SetCharProperty(mapCharAttr, mapAttrData, bSimple, nMaxVal)
|
||||
local mapAttributeDesc = self:_GetAttributeDesc(mapCharAttr.sKey)
|
||||
if not mapAttributeDesc then
|
||||
return
|
||||
end
|
||||
local sValue, sValueAdd = "", ""
|
||||
if bSimple then
|
||||
sValue = self:_TransValueFormat(mapAttrData.totalValue, mapAttributeDesc.isPercent, mapAttributeDesc.Format)
|
||||
self:_RefreshContent(mapAttributeDesc.Icon, ConfigTable.GetUIText(mapCharAttr.sLanguageId_Simple), sValue)
|
||||
else
|
||||
local nBaseValue = mapAttrData.baseValue
|
||||
local nAddValue = mapAttrData.totalValue - mapAttrData.baseValue
|
||||
sValue = self:_TransValueFormat(nBaseValue, mapCharAttr.bPercent, mapAttributeDesc.Format)
|
||||
sValueAdd = self:_TransValueFormat(nAddValue, mapCharAttr.bPercent, mapAttributeDesc.Format, true)
|
||||
if nAddValue <= 0 then
|
||||
sValueAdd = ""
|
||||
end
|
||||
self:_RefreshContent(mapAttributeDesc.Icon, mapAttributeDesc.Desc, sValue, sValueAdd)
|
||||
end
|
||||
if nMaxVal and nMaxVal ~= "" then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtValue2, NovaAPI.GetTMPText(self._mapNode.txtValue2) .. "/" .. nMaxVal)
|
||||
end
|
||||
end
|
||||
function TemplatePropertyCtrl:SetNote(nNoteId, nLevel1, nLevel2, bShowArrow)
|
||||
self._mapNode.imgUp:SetActive(false)
|
||||
self._mapNode.imgDown:SetActive(false)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, "Icon/ZZZOther/icon_common_chainfo_note")
|
||||
local mapNote = ConfigTable.GetData("SubNoteSkill", nNoteId)
|
||||
if mapNote then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProperty, orderedFormat(ConfigTable.GetUIText("Disc_Advance_NoteSkill_UpDesc"), mapNote.Name))
|
||||
end
|
||||
if nLevel2 then
|
||||
self._mapNode.txtValue1.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtValue1, orderedFormat(ConfigTable.GetUIText("Disc_Advance_NoteSkill_SkillLevel"), nLevel1))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtValue2, orderedFormat(ConfigTable.GetUIText("Disc_Advance_NoteSkill_SkillLevel"), nLevel2))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtValue2, ValueColor.up)
|
||||
if bShowArrow then
|
||||
self._mapNode.imgUp:SetActive(true)
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtValue2, orderedFormat(ConfigTable.GetUIText("Disc_Advance_NoteSkill_SkillLevel"), nLevel1))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtValue2, ValueColor.black)
|
||||
self._mapNode.txtValue1.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function TemplatePropertyCtrl:_GetAttributeDesc(sKey)
|
||||
local mapAttributeDesc = CacheTable.GetData("_AttributeDesc", sKey)
|
||||
if mapAttributeDesc == nil then
|
||||
printError("EffectType未配置:" .. sKey)
|
||||
self:_RefreshContent(nil, "", "")
|
||||
return false
|
||||
else
|
||||
return mapAttributeDesc
|
||||
end
|
||||
end
|
||||
function TemplatePropertyCtrl:_RefreshContent(sIcon, sName, sValue1, sValue2)
|
||||
if sIcon then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, sIcon)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProperty, sName)
|
||||
if sValue2 and sValue2 ~= "" then
|
||||
self._mapNode.txtValue1.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtValue1, sValue1)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtValue2, sValue2)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtValue2, sValue1)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtValue2, ValueColor.black)
|
||||
self._mapNode.txtValue1.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function TemplatePropertyCtrl:_TransValueFormat(nValue, bPercent, nFormat, bAdd)
|
||||
if bPercent then
|
||||
nValue = nValue / 100
|
||||
end
|
||||
local sValue = FormatEffectValue(nValue, bPercent, nFormat)
|
||||
if bAdd then
|
||||
sValue = "+" .. sValue
|
||||
end
|
||||
return sValue
|
||||
end
|
||||
return TemplatePropertyCtrl
|
||||
@@ -0,0 +1,143 @@
|
||||
local TemplateQuantitySelectorCtrl = class("TemplateQuantitySelectorCtrl", BaseCtrl)
|
||||
TemplateQuantitySelectorCtrl._mapNodeConfig = {
|
||||
btnReduce = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reduce"
|
||||
},
|
||||
btnAdd = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Add"
|
||||
},
|
||||
btnMax = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Max"
|
||||
},
|
||||
btnMin = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Min"
|
||||
},
|
||||
btnGrayAdd = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MaxGray"
|
||||
},
|
||||
btnGrayReduce = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MinGray"
|
||||
},
|
||||
inputCount = {
|
||||
sComponentName = "TMP_InputField"
|
||||
},
|
||||
Placeholder = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplateQuantitySelectorCtrl._mapEventConfig = {}
|
||||
function TemplateQuantitySelectorCtrl:Init(funcRefresh, nDefaultCount, nMax, bHideSide)
|
||||
self.callback = funcRefresh
|
||||
self.nMax = nMax
|
||||
self.nBuyCount = nDefaultCount
|
||||
self.bAble = nDefaultCount ~= 0
|
||||
self.bHideSide = bHideSide
|
||||
NovaAPI.SetTMPInputFieldInteractable(self._mapNode.inputCount, self.bAble)
|
||||
self:RefreshCount()
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:RefreshCount()
|
||||
NovaAPI.SetTMPInputFieldText(self._mapNode.inputCount, self.nBuyCount)
|
||||
NovaAPI.SetTMPInputFieldPlaceholderText(self._mapNode.inputCount, self.nBuyCount)
|
||||
self:RefreshAddButton(self.nBuyCount < self.nMax and self.bAble)
|
||||
self:RefreshReduceButton(self.nBuyCount > 1 and self.bAble)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:RefreshAddButton(bAble)
|
||||
self._mapNode.btnGrayAdd[1].gameObject:SetActive(not bAble and not self.bHideSide)
|
||||
self._mapNode.btnGrayAdd[2].gameObject:SetActive(not bAble)
|
||||
self._mapNode.btnAdd.gameObject:SetActive(bAble)
|
||||
self._mapNode.btnMax.gameObject:SetActive(bAble and not self.bHideSide)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:RefreshReduceButton(bAble)
|
||||
self._mapNode.btnGrayReduce[1].gameObject:SetActive(not bAble)
|
||||
self._mapNode.btnGrayReduce[2].gameObject:SetActive(not bAble and not self.bHideSide)
|
||||
self._mapNode.btnReduce.gameObject:SetActive(bAble)
|
||||
self._mapNode.btnMin.gameObject:SetActive(bAble and not self.bHideSide)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:Awake()
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnEnable()
|
||||
self.handler = ui_handler(self, self.OnInputEndEdit, self._mapNode.inputCount)
|
||||
NovaAPI.AddTMPEndEditListener(self._mapNode.inputCount, self.handler)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnDisable()
|
||||
NovaAPI.RemoveTMPEndEditListener(self._mapNode.inputCount, self.handler)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnDestroy()
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnBtnClick_Add(btn)
|
||||
local nRemain = self.nMax - self.nBuyCount
|
||||
if nRemain <= 0 then
|
||||
return
|
||||
end
|
||||
if btn.Operate_Type == 0 then
|
||||
self.nBuyCount = self.nBuyCount + 1
|
||||
elseif btn.Operate_Type == 3 then
|
||||
local nAdd = 2 ^ btn.CurrentGear
|
||||
local nAfterRemain = nRemain - nAdd
|
||||
if nAfterRemain < 0 then
|
||||
nAdd = nRemain
|
||||
end
|
||||
self.nBuyCount = math.floor(self.nBuyCount + nAdd)
|
||||
end
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnBtnClick_Reduce(btn)
|
||||
if self.nBuyCount <= 1 then
|
||||
return
|
||||
end
|
||||
if btn.Operate_Type == 0 then
|
||||
self.nBuyCount = self.nBuyCount - 1
|
||||
elseif btn.Operate_Type == 3 then
|
||||
self.nBuyCount = math.floor(self.nBuyCount - 2 ^ btn.CurrentGear)
|
||||
end
|
||||
if self.nBuyCount < 1 then
|
||||
self.nBuyCount = 1
|
||||
end
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnBtnClick_Max()
|
||||
if self.nBuyCount == self.nMax then
|
||||
return
|
||||
end
|
||||
self.nBuyCount = self.nMax
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnBtnClick_Min()
|
||||
if self.nBuyCount <= 1 then
|
||||
return
|
||||
end
|
||||
self.nBuyCount = 1
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnInputEndEdit()
|
||||
local nValue = tonumber(NovaAPI.GetTMPInputFieldText(self._mapNode.inputCount))
|
||||
if not nValue then
|
||||
nValue = self.nBuyCount
|
||||
elseif nValue < 1 then
|
||||
nValue = 1
|
||||
elseif nValue > self.nMax then
|
||||
nValue = self.nMax
|
||||
end
|
||||
self.nBuyCount = nValue
|
||||
NovaAPI.SetTMPInputFieldText(self._mapNode.inputCount, nValue)
|
||||
NovaAPI.SetTMPInputFieldPlaceholderText(self._mapNode.inputCount, nValue)
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnBtnClick_MinGray()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("QuantitySelector_Min"))
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnBtnClick_MaxGray()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("QuantitySelector_Max"))
|
||||
end
|
||||
return TemplateQuantitySelectorCtrl
|
||||
@@ -0,0 +1,129 @@
|
||||
local TemplateQuantitySliderCtrl = class("TemplateQuantitySliderCtrl", BaseCtrl)
|
||||
TemplateQuantitySliderCtrl._mapNodeConfig = {
|
||||
imgCountSlider = {
|
||||
sComponentName = "Slider",
|
||||
callback = "OnSliderValueChange"
|
||||
},
|
||||
btnReduce = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reduce"
|
||||
},
|
||||
btnAdd = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Add"
|
||||
},
|
||||
btnMax = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Max"
|
||||
},
|
||||
btnMin = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Min"
|
||||
},
|
||||
btnGrayAdd = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MaxGray"
|
||||
},
|
||||
btnGrayReduce = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MinGray"
|
||||
}
|
||||
}
|
||||
TemplateQuantitySliderCtrl._mapEventConfig = {}
|
||||
function TemplateQuantitySliderCtrl:Init(funcRefresh, nDefaultCount, nMax, bHideSide)
|
||||
self.callback = funcRefresh
|
||||
self.nMax = nMax
|
||||
self._mapNode.imgCountSlider.maxValue = nMax
|
||||
self.nBuyCount = nDefaultCount
|
||||
self.bAble = nDefaultCount ~= 0
|
||||
self.bHideSide = bHideSide
|
||||
self:RefreshCount()
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:RefreshCount()
|
||||
NovaAPI.SetSliderValue(self._mapNode.imgCountSlider, self.nBuyCount)
|
||||
self:RefreshAddButton(self.nBuyCount < self.nMax and self.bAble)
|
||||
self:RefreshReduceButton(self.nBuyCount > 1 and self.bAble)
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:RefreshAddButton(bAble)
|
||||
self._mapNode.btnGrayAdd[1].gameObject:SetActive(not bAble and not self.bHideSide)
|
||||
self._mapNode.btnGrayAdd[2].gameObject:SetActive(not bAble)
|
||||
self._mapNode.btnAdd.gameObject:SetActive(bAble)
|
||||
self._mapNode.btnMax.gameObject:SetActive(bAble and not self.bHideSide)
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:RefreshReduceButton(bAble)
|
||||
self._mapNode.btnGrayReduce[1].gameObject:SetActive(not bAble)
|
||||
self._mapNode.btnGrayReduce[2].gameObject:SetActive(not bAble and not self.bHideSide)
|
||||
self._mapNode.btnReduce.gameObject:SetActive(bAble)
|
||||
self._mapNode.btnMin.gameObject:SetActive(bAble and not self.bHideSide)
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:Awake()
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnEnable()
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnDisable()
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnDestroy()
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnBtnClick_Add(btn)
|
||||
local nRemain = self.nMax - self.nBuyCount
|
||||
if nRemain <= 0 then
|
||||
return
|
||||
end
|
||||
if btn.Operate_Type == 0 then
|
||||
self.nBuyCount = self.nBuyCount + 1
|
||||
elseif btn.Operate_Type == 3 then
|
||||
local nAdd = 2 ^ btn.CurrentGear
|
||||
local nAfterRemain = nRemain - nAdd
|
||||
if nAfterRemain < 0 then
|
||||
nAdd = nRemain
|
||||
end
|
||||
self.nBuyCount = math.floor(self.nBuyCount + nAdd)
|
||||
end
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnBtnClick_Reduce(btn)
|
||||
if self.nBuyCount <= 1 then
|
||||
return
|
||||
end
|
||||
if btn.Operate_Type == 0 then
|
||||
self.nBuyCount = self.nBuyCount - 1
|
||||
elseif btn.Operate_Type == 3 then
|
||||
self.nBuyCount = math.floor(self.nBuyCount - 2 ^ btn.CurrentGear)
|
||||
end
|
||||
if self.nBuyCount < 1 then
|
||||
self.nBuyCount = 1
|
||||
end
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnBtnClick_Max()
|
||||
if self.nBuyCount == self.nMax then
|
||||
return
|
||||
end
|
||||
self.nBuyCount = self.nMax
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnBtnClick_Min()
|
||||
if self.nBuyCount <= 1 then
|
||||
return
|
||||
end
|
||||
self.nBuyCount = 1
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnSliderValueChange(_, value)
|
||||
self.nBuyCount = math.ceil(value)
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnBtnClick_MinGray()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("QuantitySelector_Min"))
|
||||
end
|
||||
function TemplateQuantitySliderCtrl:OnBtnClick_MaxGray()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("QuantitySelector_Max"))
|
||||
end
|
||||
return TemplateQuantitySliderCtrl
|
||||
@@ -0,0 +1,70 @@
|
||||
local TemplateRandomPropertyCtrl = class("TemplateRandomPropertyCtrl", BaseCtrl)
|
||||
TemplateRandomPropertyCtrl._mapNodeConfig = {
|
||||
imgBg = {sComponentName = "Image"},
|
||||
txtTag = {sComponentName = "TMP_Text"},
|
||||
txtProperty = {sComponentName = "TMP_Text"},
|
||||
txtPropertyValue = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txtProperty",
|
||||
sComponentName = "TMPHyperLink",
|
||||
callback = "OnLinkClick_Word"
|
||||
}
|
||||
}
|
||||
TemplateRandomPropertyCtrl._mapEventConfig = {}
|
||||
function TemplateRandomPropertyCtrl:SetProperty(nAttrId, nCharId, bLock)
|
||||
self.nCharId = nCharId
|
||||
self.mapCfg = ConfigTable.GetData("CharGemAttrValue", nAttrId)
|
||||
if not self.mapCfg then
|
||||
return
|
||||
end
|
||||
local mapAttributeDesc = self:_GetAttributeDesc()
|
||||
if not mapAttributeDesc then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTag, ConfigTable.GetUIText("Equipment_AttrTag_" .. self.mapCfg.Tag))
|
||||
local sValue = ""
|
||||
sValue = self:_TransValueFormat(tonumber(self.mapCfg.Value), mapAttributeDesc.isPercent, mapAttributeDesc.Format, self.mapCfg.Tag ~= GameEnum.CharGemAttrTag.ATTR)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProperty, UTILS.SubDesc(mapAttributeDesc.RandomAttrDesc, nil, nil, {nCharId = nCharId}))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPropertyValue, sValue)
|
||||
self:SetAttrLock(bLock)
|
||||
end
|
||||
function TemplateRandomPropertyCtrl:SetAttrLock(bLock)
|
||||
if bLock then
|
||||
self:SetSprite_FrameColor(self._mapNode.imgBg, self.mapCfg.Rarity, AllEnum.FrameType_New.RandomPropertyLock)
|
||||
else
|
||||
self:SetSprite_FrameColor(self._mapNode.imgBg, self.mapCfg.Rarity, AllEnum.FrameType_New.RandomProperty)
|
||||
end
|
||||
end
|
||||
function TemplateRandomPropertyCtrl:_GetAttributeDesc()
|
||||
local attrType = self.mapCfg.AttrType
|
||||
local attrSubType1 = self.mapCfg.AttrTypeFirstSubtype
|
||||
local attrSubType2 = self.mapCfg.AttrTypeSecondSubtype
|
||||
local nEffectDescId = self:GetEffectDescId(attrType, attrSubType1, attrSubType2)
|
||||
local mapAttributeDesc = ConfigTable.GetData("EffectDesc", nEffectDescId)
|
||||
if mapAttributeDesc == nil then
|
||||
printError("找不到EffectDesc对应配置,id = " .. nEffectDescId)
|
||||
return false
|
||||
else
|
||||
return mapAttributeDesc
|
||||
end
|
||||
end
|
||||
function TemplateRandomPropertyCtrl:_TransValueFormat(nValue, bPercent, nFormat, bAdd)
|
||||
local sValue = ""
|
||||
if bAdd then
|
||||
sValue = orderedFormat(ConfigTable.GetUIText("Equipment_AttrDesc_PlusLevel"), nValue)
|
||||
else
|
||||
sValue = FormatEffectValue(nValue, bPercent, nFormat)
|
||||
end
|
||||
return sValue
|
||||
end
|
||||
function TemplateRandomPropertyCtrl:GetEffectDescId(attrType, attrSubType1, attrSubType2)
|
||||
return attrType * 10000 + attrSubType1 * 10 + attrSubType2
|
||||
end
|
||||
function TemplateRandomPropertyCtrl:OnLinkClick_Word(link, sWordId)
|
||||
UTILS.ClickWordLink(link, sWordId, {
|
||||
nCharId = self.nCharId,
|
||||
nLevel = 1,
|
||||
nAddLv = tonumber(self.mapCfg.Value)
|
||||
})
|
||||
end
|
||||
return TemplateRandomPropertyCtrl
|
||||
@@ -0,0 +1,43 @@
|
||||
local TemplateSkillCharCtrl = class("TemplateSkillCharCtrl", BaseCtrl)
|
||||
TemplateSkillCharCtrl._mapNodeConfig = {
|
||||
imgBg = {nCount = 2, sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgType = {sComponentName = "Image"},
|
||||
txtSkillLevel = {sComponentName = "TMP_Text"},
|
||||
Select = {}
|
||||
}
|
||||
TemplateSkillCharCtrl._mapEventConfig = {}
|
||||
function TemplateSkillCharCtrl:SetSkill(nSkillId, nSkillIndex, nSkillLevel, nElementType, isCircle)
|
||||
if isCircle == nil then
|
||||
isCircle = false
|
||||
end
|
||||
self._mapNode.Select:SetActive(false)
|
||||
local skillCfg = ConfigTable.GetData_Skill(nSkillId)
|
||||
if nil == skillCfg then
|
||||
printError("找不到技能配置!!技能id = " .. nSkillId)
|
||||
return
|
||||
end
|
||||
local sName = AllEnum.ElementIconType.SkillEx .. nElementType
|
||||
if isCircle then
|
||||
sName = AllEnum.ElementIconType.VestigeSkill .. nElementType
|
||||
end
|
||||
local skillShowCfg = AllEnum.SkillTypeShow[nSkillIndex]
|
||||
self:SetAtlasSprite(self._mapNode.imgBg[1], "12_rare", sName)
|
||||
local bgIconIndex = skillShowCfg.bgIconIndex
|
||||
self:SetAtlasSprite(self._mapNode.imgBg[2], "10_ico", "zs_character_skill_" .. bgIconIndex)
|
||||
local _, color = ColorUtility.TryParseHtmlString(AllEnum.SkillElementBgColor[nElementType])
|
||||
NovaAPI.SetImageColor(self._mapNode.imgBg[2], Color(color.r, color.g, color.b, 0.19607843137254902))
|
||||
local skillTypeIconIdx = skillShowCfg.iconIndex
|
||||
self:SetAtlasSprite(self._mapNode.imgType, "05_language", "zs_character_skill_text_" .. skillTypeIconIdx)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgType)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillLevel, nSkillLevel)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, skillCfg.Icon)
|
||||
end
|
||||
function TemplateSkillCharCtrl:SetSelect(bSelect)
|
||||
self._mapNode.Select:SetActive(bSelect)
|
||||
end
|
||||
function TemplateSkillCharCtrl:Awake()
|
||||
end
|
||||
function TemplateSkillCharCtrl:OnDestroy()
|
||||
end
|
||||
return TemplateSkillCharCtrl
|
||||
@@ -0,0 +1,129 @@
|
||||
local TemplateSkillCtrl = class("TemplateSkillCtrl", BaseCtrl)
|
||||
local TipsType = {
|
||||
CharSkill = 1,
|
||||
Talent = 2,
|
||||
TalentSkill = 3,
|
||||
MonsterSkill = 4
|
||||
}
|
||||
TemplateSkillCtrl._mapNodeConfig = {
|
||||
imgElementBg = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
btnSkill = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
rtSkill = {
|
||||
sNodeName = "btnSkill",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
TopGridCanvas = {sNodeName = "btnSkill"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtLv = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Character_Skill_Lv"
|
||||
}
|
||||
}
|
||||
TemplateSkillCtrl._mapEventConfig = {}
|
||||
function TemplateSkillCtrl:SetCharSkill(nSkillId, nSkillLevel, nElementType)
|
||||
self.nTipsType = TipsType.CharSkill
|
||||
self.nSkillId = nSkillId
|
||||
self.nSkillLevel = nSkillLevel
|
||||
self.nElementType = nElementType
|
||||
self:_RefreshSkillContent()
|
||||
end
|
||||
function TemplateSkillCtrl:SetTalent(nRoguelikeTalentSkill)
|
||||
self.nTipsType = TipsType.Talent
|
||||
self.nTalentSkillId = nRoguelikeTalentSkill
|
||||
self:_RefreshTalentContent()
|
||||
end
|
||||
function TemplateSkillCtrl:SetTalentSkill(nSkillLevel, nTalentSkillId, nTalentLevel)
|
||||
local nCharId = math.floor(nTalentSkillId / 1000)
|
||||
nSkillLevel = nSkillLevel or 0
|
||||
self.nTipsType = TipsType.TalentSkill
|
||||
self.nSkillId = CacheTable.GetData("_TalentSkillAI", nCharId)[nTalentSkillId].SpecialSkillId
|
||||
self.nSkillLevel = nSkillLevel
|
||||
self.nTalentSkillId = nTalentSkillId
|
||||
self.nTalentLevel = nTalentLevel
|
||||
self.nElementType = ConfigTable.GetData_Character(nCharId).EET
|
||||
self:_RefreshSkillContent()
|
||||
end
|
||||
function TemplateSkillCtrl:SetMonsterSkill(nSkillId, nDiffLv)
|
||||
self.nTipsType = TipsType.MonsterSkill
|
||||
self.nSkillId = nSkillId
|
||||
self:_RefreshMonsterContent(nDiffLv)
|
||||
end
|
||||
function TemplateSkillCtrl:SetTravelerDuelSkill(nSkillId)
|
||||
self.nTipsType = TipsType.MonsterSkill
|
||||
self.nSkillId = nSkillId
|
||||
self:_RefreshTravelerDuelContent()
|
||||
end
|
||||
function TemplateSkillCtrl:_RefreshSkillContent()
|
||||
self:SetAtlasSprite(self._mapNode.imgElementBg, "12_rare", AllEnum.ElementIconType.Skill .. self.nElementType)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, ConfigTable.GetData_Skill(self.nSkillId).Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, ConfigTable.GetData_Skill(self.nSkillId).Title)
|
||||
if self.nSkillLevel then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, self.nSkillLevel)
|
||||
end
|
||||
end
|
||||
function TemplateSkillCtrl:_RefreshTalentContent()
|
||||
local nRare = self.nTalentSkillId % 100 > 10 and GameEnum.itemRarity.SSR or GameEnum.itemRarity.SR
|
||||
self:SetSprite_FrameColor(self._mapNode.imgElementBg, nRare, AllEnum.FrameType_New.Talent)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, self.nTalentSkillId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, ConfigTable.GetData("RoguelikeTalentSkill", self.nTalentSkillId).Title)
|
||||
end
|
||||
function TemplateSkillCtrl:_RefreshMonsterContent(nDiffLv)
|
||||
local isWeeklyCopies = PlayerData.RogueBoss:GetIsWeeklyCopies()
|
||||
if isWeeklyCopies then
|
||||
local mapSkill = ConfigTable.GetData("WeekBossAffix", self.nSkillId)
|
||||
self:SetAtlasSprite(self._mapNode.imgElementBg, "12_rare", AllEnum.ElementIconType.Skill .. mapSkill.Element)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapSkill.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapSkill.name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, mapSkill.Level)
|
||||
else
|
||||
local mapSkill = ConfigTable.GetData("RegionBossAffix", self.nSkillId)
|
||||
self:SetAtlasSprite(self._mapNode.imgElementBg, "12_rare", AllEnum.ElementIconType.Skill .. mapSkill.Element)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapSkill.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapSkill.name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, mapSkill.Level)
|
||||
end
|
||||
local goMask = self.gameObject.transform:Find("imgMask").gameObject
|
||||
goMask:SetActive(nDiffLv and 0 < nDiffLv)
|
||||
end
|
||||
function TemplateSkillCtrl:_RefreshTravelerDuelContent()
|
||||
local mapSkill = ConfigTable.GetData("TravelerDuelChallengeAffix", self.nSkillId)
|
||||
self:SetAtlasSprite(self._mapNode.imgElementBg, "12_rare", AllEnum.ElementIconType.Skill .. mapSkill.Element)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapSkill.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapSkill.name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, "")
|
||||
local goMask = self.gameObject.transform:Find("imgMask").gameObject
|
||||
goMask:SetActive(false)
|
||||
end
|
||||
function TemplateSkillCtrl:Awake()
|
||||
self.nTipsType = TipsType.CharSkill
|
||||
self.nSkillId = nil
|
||||
self.nSkillLevel = nil
|
||||
self.nTalentSkillId = nil
|
||||
self.nTalentLevel = nil
|
||||
self.nElementType = nil
|
||||
NovaAPI.SetComponentEnableByName(self._mapNode.TopGridCanvas.gameObject, "TopGridCanvas", false)
|
||||
end
|
||||
function TemplateSkillCtrl:OnDestroy()
|
||||
self.nSkillId = nil
|
||||
self.nSkillLevel = nil
|
||||
self.nTalentSkillId = nil
|
||||
self.nTalentLevel = nil
|
||||
self.nElementType = nil
|
||||
end
|
||||
function TemplateSkillCtrl:OnBtnClick_Skill(btn)
|
||||
if self.nTipsType == TipsType.CharSkill then
|
||||
EventManager.Hit(EventId.ShowCharacterSkillTips, self.nSkillId, self.nSkillLevel, self.nElementType, self._mapNode.rtSkill)
|
||||
elseif self.nTipsType == TipsType.Talent then
|
||||
EventManager.Hit(EventId.ShowCharacterTalentTips, self.nTalentSkillId, 0, GameEnum.itemRarity.SR, self._mapNode.rtSkill)
|
||||
elseif self.nTipsType == TipsType.TalentSkill then
|
||||
EventManager.Hit(EventId.ShowTalentSkillTips, self.nTalentSkillId, self.nSkillLevel, self.nElementType, self.nTalentLevel)
|
||||
elseif self.nTipsType == TipsType.MonsterSkill then
|
||||
EventManager.Hit(EventId.ShowMonsterSkillTips, self.nSkillId, self._mapNode.rtSkill)
|
||||
end
|
||||
end
|
||||
return TemplateSkillCtrl
|
||||
@@ -0,0 +1,70 @@
|
||||
local TemplateSkillSelectCtrl = class("TemplateSkillSelectCtrl", BaseCtrl)
|
||||
TemplateSkillSelectCtrl._mapNodeConfig = {
|
||||
imgBg = {nCount = 2, sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgType = {sComponentName = "Image"},
|
||||
txtSkillLevelTxt = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "CharacterSkill_Level"
|
||||
},
|
||||
txtSkillLevel = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtAddLv = {sComponentName = "TMP_Text"},
|
||||
imgLv = {},
|
||||
Select = {},
|
||||
imgSelect = {},
|
||||
animRoot = {sNodeName = "AnimRoot", sComponentName = "Animator"},
|
||||
txtSkillName = {sComponentName = "TMP_Text"},
|
||||
imgSkillTypeBg = {sComponentName = "Image"},
|
||||
txtSkillType = {sComponentName = "TMP_Text"},
|
||||
imgSkillType = {sComponentName = "Image"}
|
||||
}
|
||||
TemplateSkillSelectCtrl._mapEventConfig = {}
|
||||
function TemplateSkillSelectCtrl:SetSkill(nSkillId, nSkillIndex, nSkillLevel, nElementType, nAddLv)
|
||||
self._mapNode.Select:SetActive(false)
|
||||
self._mapNode.imgLv.gameObject:SetActive(true)
|
||||
self._mapNode.imgType.gameObject:SetActive(true)
|
||||
local skillCfg = ConfigTable.GetData_Skill(nSkillId)
|
||||
if nil == skillCfg then
|
||||
printError("找不到技能配置!!技能id = " .. nSkillId)
|
||||
return
|
||||
end
|
||||
local sName = AllEnum.ElementIconType.SkillEx .. nElementType
|
||||
self:SetAtlasSprite(self._mapNode.imgBg[1], "12_rare", sName)
|
||||
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(AllEnum.SkillElementBgColor[nElementType])
|
||||
NovaAPI.SetImageColor(self._mapNode.imgBg[2], Color(color.r, color.g, color.b, 0.19607843137254902))
|
||||
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)
|
||||
local _, _color = ColorUtility.TryParseHtmlString(skillShowCfg.bgColor)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgSkillTypeBg, _color)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillLevel[1], nSkillLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillLevel[2], nSkillLevel + nAddLv)
|
||||
self._mapNode.txtAddLv.gameObject:SetActive(0 < nAddLv)
|
||||
if 0 < nAddLv then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAddLv, "(+" .. nAddLv .. ")")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillName, skillCfg.Title)
|
||||
self:SetAtlasSprite(self._mapNode.imgSkillType, "05_language", "zs_character_skill_text_" .. skillTypeIconIdx)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgSkillType)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSkillType, ConfigTable.GetUIText(skillShowCfg.sLanguageId))
|
||||
end
|
||||
function TemplateSkillSelectCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgSelect.gameObject:SetActive(bSelect)
|
||||
self._mapNode.imgLv:SetActive(not bSelect)
|
||||
self._mapNode.imgType.gameObject:SetActive(not bSelect)
|
||||
if bSelect then
|
||||
self._mapNode.Select:SetActive(true)
|
||||
self._mapNode.animRoot:Play("tc_skill_char_select")
|
||||
else
|
||||
self._mapNode.animRoot:Play("tc_skill_char_close")
|
||||
end
|
||||
end
|
||||
function TemplateSkillSelectCtrl:Awake()
|
||||
end
|
||||
function TemplateSkillSelectCtrl:OnDestroy()
|
||||
end
|
||||
return TemplateSkillSelectCtrl
|
||||
@@ -0,0 +1,74 @@
|
||||
local TemplateSkinCtrl = class("TemplateSkinCtrl", BaseCtrl)
|
||||
TemplateSkinCtrl._mapNodeConfig = {
|
||||
imgChose = {},
|
||||
imgItemIcon = {sComponentName = "Image"},
|
||||
imgFavorite = {},
|
||||
goChoseTop = {},
|
||||
txtChooseTxt = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Skin_Choose"
|
||||
},
|
||||
goLock = {},
|
||||
goAccessChannel = {},
|
||||
imgShopBg = {},
|
||||
imgActivityBg = {},
|
||||
imgAdvanceBg = {},
|
||||
txtChannel = {sComponentName = "TMP_Text"},
|
||||
imgSelect = {},
|
||||
img3D = {},
|
||||
imgCG = {},
|
||||
imgMusic = {},
|
||||
img2D = {},
|
||||
btnGrid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnItemClick"
|
||||
}
|
||||
}
|
||||
TemplateSkinCtrl._mapEventConfig = {
|
||||
[EventId.CharacterSkinChange] = "OnCharacterSkinChange"
|
||||
}
|
||||
function TemplateSkinCtrl:SetSkinData(skinData, bShowFavorite, bPreview)
|
||||
local skinCfg = skinData:GetCfgData()
|
||||
self.nCharId = skinData:GetCharId()
|
||||
self.nSkinId = skinData:GetId()
|
||||
self:RefreshChoseSkin()
|
||||
self._mapNode.imgSelect.gameObject:SetActive(false)
|
||||
self._mapNode.imgFavorite.gameObject:SetActive(bShowFavorite and skinData:CheckUnlock() and skinData:CheckFavorCG())
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon, skinCfg.Icon .. AllEnum.CharHeadIconSurfix.SK)
|
||||
self._mapNode.goLock.gameObject:SetActive(not skinData:CheckUnlock() and not bPreview)
|
||||
self._mapNode.imgShopBg.gameObject:SetActive(skinCfg.SourceDesc == GameEnum.skinSourceType.TIMELIMIT or skinCfg.SourceDesc == GameEnum.skinSourceType.BATTLEPASS)
|
||||
self._mapNode.imgActivityBg.gameObject:SetActive(skinCfg.SourceDesc == GameEnum.skinSourceType.ACTIVITY)
|
||||
self._mapNode.imgAdvanceBg.gameObject:SetActive(skinCfg.SourceDesc == GameEnum.skinSourceType.ADVANCE)
|
||||
local sText = AllEnum.CharSkinSource[skinCfg.SourceDesc]
|
||||
if sText ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChannel, ConfigTable.GetUIText(sText))
|
||||
end
|
||||
local tbSkinTags = skinData:GetSkinExtraTags()
|
||||
for k, v in pairs(tbSkinTags) do
|
||||
if v == GameEnum.skinExtraTag.MODEL then
|
||||
self._mapNode.img3D:SetActive(true)
|
||||
elseif v == GameEnum.skinExtraTag.IMAGE then
|
||||
self._mapNode.imgCG:SetActive(true)
|
||||
elseif v == GameEnum.skinExtraTag.MUSIC then
|
||||
self._mapNode.imgMusic:SetActive(true)
|
||||
elseif v == GameEnum.skinExtraTag.TWOD then
|
||||
self._mapNode.img2D:SetActive(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TemplateSkinCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgSelect:SetActive(bSelect)
|
||||
end
|
||||
function TemplateSkinCtrl:RefreshChoseSkin(usingSkinId)
|
||||
if nil == usingSkinId then
|
||||
usingSkinId = PlayerData.Char:GetCharUsedSkinId(self.nCharId)
|
||||
end
|
||||
self._mapNode.imgChose.gameObject:SetActive(self.nSkinId == usingSkinId)
|
||||
self._mapNode.goChoseTop.gameObject:SetActive(self.nSkinId == usingSkinId)
|
||||
end
|
||||
function TemplateSkinCtrl:OnCharacterSkinChange()
|
||||
self:RefreshChoseSkin()
|
||||
end
|
||||
function TemplateSkinCtrl:OnBtnItemClick()
|
||||
end
|
||||
return TemplateSkinCtrl
|
||||
@@ -0,0 +1,35 @@
|
||||
local TemplateSlotPerkCtrl = class("TemplateSlotPerkCtrl", BaseCtrl)
|
||||
local _, Gray = ColorUtility.TryParseHtmlString("#A0A9B2")
|
||||
TemplateSlotPerkCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgSelect = {},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
imgSlot = {sComponentName = "Image"},
|
||||
rtOn = {},
|
||||
txtSlot = {sComponentName = "TMP_Text"},
|
||||
imgDescBg = {sComponentName = "Image"}
|
||||
}
|
||||
TemplateSlotPerkCtrl._mapEventConfig = {}
|
||||
function TemplateSlotPerkCtrl:SetSlotPerk(nTid, nIndex, nStar, nMaxStar)
|
||||
self._mapNode.rtOn:SetActive(nTid ~= nil)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgDescBg, nTid ~= nil and White_Dark or Gray_Dark)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgSlot, nTid ~= nil and White_Normal or Gray)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtSlot, nTid ~= nil and White_Normal or Gray)
|
||||
self:SetAtlasSprite(self._mapNode.imgSlot, "10_ico", "zs_vestige_icon_" .. nIndex)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgSlot)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSlot, ConfigTable.GetUIText("Slot_Title_" .. nIndex))
|
||||
if nTid then
|
||||
local sPath = AllEnum.FrameType_New.SlotPerk .. AllEnum.FrameColor_New[ConfigTable.GetData_Item(nTid).Rarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgRare, "12_rare", sPath)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, ConfigTable.GetData_Item(nTid).Icon)
|
||||
self._mapNode.goStar:SetStar(nStar, nMaxStar)
|
||||
self:SetSelect(false)
|
||||
end
|
||||
end
|
||||
function TemplateSlotPerkCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgSelect:SetActive(bSelect)
|
||||
end
|
||||
return TemplateSlotPerkCtrl
|
||||
@@ -0,0 +1,26 @@
|
||||
local TemplateSortBtnCtrl = class("TemplateSortBtnCtrl", BaseCtrl)
|
||||
local SortColor = {
|
||||
Enabled = Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764),
|
||||
Disabled = Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882)
|
||||
}
|
||||
TemplateSortBtnCtrl._mapNodeConfig = {
|
||||
txtSort = {sComponentName = "TMP_Text"},
|
||||
imgUp = {sComponentName = "Image"},
|
||||
imgDown = {sComponentName = "Image"}
|
||||
}
|
||||
TemplateSortBtnCtrl._mapEventConfig = {}
|
||||
function TemplateSortBtnCtrl:SetText(sLanguageId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSort, ConfigTable.GetUIText(sLanguageId))
|
||||
end
|
||||
function TemplateSortBtnCtrl:Refresh(bEnabled, bOrder)
|
||||
if bEnabled then
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtSort, SortColor.Enabled)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgUp, bOrder and SortColor.Disabled or SortColor.Enabled)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgDown, bOrder and SortColor.Enabled or SortColor.Disabled)
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtSort, SortColor.Disabled)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgUp, SortColor.Disabled)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgDown, SortColor.Disabled)
|
||||
end
|
||||
end
|
||||
return TemplateSortBtnCtrl
|
||||
@@ -0,0 +1,22 @@
|
||||
local TemplateSpecialExclusiveItemCtrl = class("TemplateSpecialExclusiveItemCtrl", BaseCtrl)
|
||||
TemplateSpecialExclusiveItemCtrl._mapNodeConfig = {
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgSelect = {},
|
||||
imgMask = {sComponentName = "Image"}
|
||||
}
|
||||
TemplateSpecialExclusiveItemCtrl._mapEventConfig = {}
|
||||
function TemplateSpecialExclusiveItemCtrl:SetPerk(nTid, bHas)
|
||||
local mapCfg = ConfigTable.GetData_Item(nTid)
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapCfg.Icon)
|
||||
self._mapNode.imgSelect:SetActive(false)
|
||||
if bHas == false then
|
||||
self._mapNode.imgMask.gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgMask, mapCfg.Icon)
|
||||
else
|
||||
self._mapNode.imgMask.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function TemplateSpecialExclusiveItemCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgSelect:SetActive(bSelect)
|
||||
end
|
||||
return TemplateSpecialExclusiveItemCtrl
|
||||
@@ -0,0 +1,28 @@
|
||||
local TemplateStarAdvanceCtrl = class("TemplateStarAdvanceCtrl", BaseCtrl)
|
||||
TemplateStarAdvanceCtrl._mapNodeConfig = {
|
||||
star = {nCount = 8},
|
||||
imgStarOn = {nCount = 8},
|
||||
imgStarOff = {nCount = 8},
|
||||
imgStarCur = {nCount = 8}
|
||||
}
|
||||
TemplateStarAdvanceCtrl._mapEventConfig = {}
|
||||
function TemplateStarAdvanceCtrl:SetStar(nStar, nMaxStar, nCurStar)
|
||||
if nStar ~= nil and nMaxStar ~= nil then
|
||||
self.gameObject:SetActive(true)
|
||||
for i = 1, 8 do
|
||||
self._mapNode.star[i]:SetActive(i <= nMaxStar)
|
||||
if nCurStar and nCurStar == i then
|
||||
self._mapNode.imgStarCur[i]:SetActive(true)
|
||||
self._mapNode.imgStarOff[i]:SetActive(false)
|
||||
self._mapNode.imgStarOn[i]:SetActive(false)
|
||||
else
|
||||
self._mapNode.imgStarCur[i]:SetActive(false)
|
||||
self._mapNode.imgStarOff[i]:SetActive(nStar < i)
|
||||
self._mapNode.imgStarOn[i]:SetActive(i <= nStar)
|
||||
end
|
||||
end
|
||||
else
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
return TemplateStarAdvanceCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local TemplateStarCtrl = class("TemplateStarCtrl", BaseCtrl)
|
||||
TemplateStarCtrl._mapNodeConfig = {
|
||||
tbStar = {
|
||||
sNodeName = "btnStar",
|
||||
nCount = 5,
|
||||
sComponentName = "Button"
|
||||
}
|
||||
}
|
||||
TemplateStarCtrl._mapEventConfig = {}
|
||||
function TemplateStarCtrl:SetStar(nStar, nMaxStar)
|
||||
if nStar ~= nil and nMaxStar ~= nil then
|
||||
self.gameObject:SetActive(true)
|
||||
for i = 1, 5 do
|
||||
self._mapNode.tbStar[i].interactable = i <= nStar
|
||||
self._mapNode.tbStar[i].gameObject:SetActive(i <= nMaxStar)
|
||||
end
|
||||
else
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
return TemplateStarCtrl
|
||||
@@ -0,0 +1,37 @@
|
||||
local TemplateTabCtrl = class("TemplateTabCtrl", BaseCtrl)
|
||||
local State = {
|
||||
First = 1,
|
||||
Middle = 2,
|
||||
Last = 3
|
||||
}
|
||||
TemplateTabCtrl._mapNodeConfig = {
|
||||
txtTabOn = {sComponentName = "TMP_Text"},
|
||||
txtTabOff = {sComponentName = "TMP_Text"},
|
||||
imgLine = {},
|
||||
imgOn = {nCount = 3}
|
||||
}
|
||||
TemplateTabCtrl._mapEventConfig = {}
|
||||
function TemplateTabCtrl:SetText(sText)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTabOn, sText)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTabOff, sText)
|
||||
end
|
||||
function TemplateTabCtrl:SetSelect(bOn, nState)
|
||||
self._mapNode.txtTabOn.gameObject:SetActive(bOn)
|
||||
self._mapNode.txtTabOff.gameObject:SetActive(not bOn)
|
||||
if nState == State.Last then
|
||||
self._mapNode.imgLine:SetActive(false)
|
||||
else
|
||||
self._mapNode.imgLine:SetActive(not bOn)
|
||||
end
|
||||
for i = 1, 3 do
|
||||
if bOn then
|
||||
self._mapNode.imgOn[i]:SetActive(i == nState)
|
||||
else
|
||||
self._mapNode.imgOn[i]:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TemplateTabCtrl:SetLine(bOn)
|
||||
self._mapNode.imgLine:SetActive(bOn)
|
||||
end
|
||||
return TemplateTabCtrl
|
||||
@@ -0,0 +1,55 @@
|
||||
local TemplateToggleCtrl = class("TemplateToggleCtrl", BaseCtrl)
|
||||
TemplateToggleCtrl._mapNodeConfig = {
|
||||
AnimSwitch = {sComponentName = "Animator"},
|
||||
txt_Select = {sComponentName = "TMP_Text"},
|
||||
txt_unSelect = {sComponentName = "TMP_Text"},
|
||||
Select = {},
|
||||
unSelect = {}
|
||||
}
|
||||
TemplateToggleCtrl._mapEventConfig = {}
|
||||
function TemplateToggleCtrl:SetText(sText)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Select, sText)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, sText)
|
||||
end
|
||||
function TemplateToggleCtrl:SetDefault(bOn)
|
||||
if self._mapNode.AnimSwitch.enabled == true then
|
||||
self._mapNode.AnimSwitch.enabled = false
|
||||
end
|
||||
self._mapNode.Select:SetActive(bOn)
|
||||
self._mapNode.unSelect:SetActive(not bOn)
|
||||
self._mapNode.txt_Select.gameObject:SetActive(bOn)
|
||||
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_Select, White_Normal)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, Blue_Normal)
|
||||
end
|
||||
function TemplateToggleCtrl:SetDefaultAct10101(bOn)
|
||||
if self._mapNode.AnimSwitch.enabled == true then
|
||||
self._mapNode.AnimSwitch.enabled = false
|
||||
end
|
||||
self._mapNode.Select:SetActive(bOn)
|
||||
self._mapNode.unSelect:SetActive(not bOn)
|
||||
self._mapNode.txt_Select.gameObject:SetActive(bOn)
|
||||
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_Select, Color(1, 1, 1, 1))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, Color(0.2196078431372549, 0.1803921568627451, 0.1450980392156863, 1))
|
||||
end
|
||||
function TemplateToggleCtrl:SetDefaultActivity(bOn)
|
||||
if self._mapNode.AnimSwitch.enabled == true then
|
||||
self._mapNode.AnimSwitch.enabled = false
|
||||
end
|
||||
self._mapNode.Select:SetActive(bOn)
|
||||
self._mapNode.unSelect:SetActive(not bOn)
|
||||
self._mapNode.txt_Select.gameObject:SetActive(bOn)
|
||||
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
|
||||
end
|
||||
function TemplateToggleCtrl:SetTrigger(bOn)
|
||||
if self._mapNode.AnimSwitch.enabled == false then
|
||||
self._mapNode.AnimSwitch.enabled = true
|
||||
end
|
||||
if bOn then
|
||||
self._mapNode.AnimSwitch:SetTrigger("tOn")
|
||||
else
|
||||
self._mapNode.AnimSwitch:SetTrigger("tOff")
|
||||
end
|
||||
end
|
||||
return TemplateToggleCtrl
|
||||
@@ -0,0 +1,36 @@
|
||||
local TemplateTogTabCtrl = class("TemplateTogTabCtrl", BaseCtrl)
|
||||
TemplateTogTabCtrl._mapNodeConfig = {
|
||||
imgOff = {nCount = 2},
|
||||
imgOn = {nCount = 2},
|
||||
txtLeft = {sComponentName = "TMP_Text", nCount = 2},
|
||||
txtRight = {sComponentName = "TMP_Text", nCount = 2}
|
||||
}
|
||||
TemplateTogTabCtrl._mapEventConfig = {}
|
||||
TemplateTogTabCtrl._mapRedDotConfig = {}
|
||||
function TemplateTogTabCtrl:Awake()
|
||||
end
|
||||
function TemplateTogTabCtrl:FadeIn()
|
||||
end
|
||||
function TemplateTogTabCtrl:FadeOut()
|
||||
end
|
||||
function TemplateTogTabCtrl:OnEnable()
|
||||
end
|
||||
function TemplateTogTabCtrl:OnDisable()
|
||||
end
|
||||
function TemplateTogTabCtrl:OnDestroy()
|
||||
end
|
||||
function TemplateTogTabCtrl:OnRelease()
|
||||
end
|
||||
function TemplateTogTabCtrl:SetText(sRight, sLeft)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft[1], sLeft)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft[2], sLeft)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRight[1], sRight)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRight[2], sRight)
|
||||
end
|
||||
function TemplateTogTabCtrl:SetState(bRight)
|
||||
self._mapNode.imgOff[1]:SetActive(bRight)
|
||||
self._mapNode.imgOff[2]:SetActive(not bRight)
|
||||
self._mapNode.imgOn[1]:SetActive(not bRight)
|
||||
self._mapNode.imgOn[2]:SetActive(bRight)
|
||||
end
|
||||
return TemplateTogTabCtrl
|
||||
@@ -0,0 +1,33 @@
|
||||
local TemplateTopEnergyCtrl = class("TemplateTopEnergyCtrl", BaseCtrl)
|
||||
TemplateTopEnergyCtrl._mapNodeConfig = {
|
||||
imgBar = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
btnAdd = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_AddEnergy"
|
||||
}
|
||||
}
|
||||
TemplateTopEnergyCtrl._mapEventConfig = {
|
||||
[EventId.UpdateEnergy] = "Refresh",
|
||||
[EventId.UpdateWorldClass] = "Refresh"
|
||||
}
|
||||
function TemplateTopEnergyCtrl:Refresh()
|
||||
local nMaxEnergy = ConfigTable.GetConfigNumber("EnergyMaxLimit")
|
||||
local nCurEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, nCurEnergy .. "/" .. nMaxEnergy)
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgBar, nMaxEnergy < nCurEnergy and 1 or nCurEnergy / nMaxEnergy)
|
||||
end
|
||||
function TemplateTopEnergyCtrl:AddCallBack(callback)
|
||||
self.callBack = callback
|
||||
end
|
||||
function TemplateTopEnergyCtrl:OnBtnClick_AddEnergy(btn)
|
||||
self._panel._nFadeInType = 2
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EnergyBuy)
|
||||
if self.callBack ~= nil then
|
||||
self.callBack()
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EnergyBuy, AllEnum.EnergyPanelType.Main, {}, true, callback)
|
||||
end
|
||||
return TemplateTopEnergyCtrl
|
||||
Reference in New Issue
Block a user