Update - 1.9.0.103
EN: 1.9.0.103 CN: 1.9.0.104 JP: 1.9.0.106 KR: 1.9.0.108
This commit is contained in:
@@ -20,7 +20,8 @@ TemplateCharCtrl._mapNodeConfig = {
|
||||
imgSkill = {nCount = 4, sComponentName = "Image"},
|
||||
txtSkill = {nCount = 4, sComponentName = "TMP_Text"},
|
||||
imgAffinity = {sComponentName = "Image"},
|
||||
txtAffinity = {sComponentName = "TMP_Text"}
|
||||
txtAffinity = {sComponentName = "TMP_Text"},
|
||||
imgFavorite = {}
|
||||
}
|
||||
TemplateCharCtrl._mapEventConfig = {}
|
||||
function TemplateCharCtrl:SetChar(nCharId, bShowRedDot, bLocked, nTrialId, nSortType)
|
||||
@@ -48,6 +49,7 @@ function TemplateCharCtrl:SetChar(nCharId, bShowRedDot, bLocked, nTrialId, nSort
|
||||
if mapCharSkin == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshCharaIsFavorite()
|
||||
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)
|
||||
@@ -139,6 +141,12 @@ end
|
||||
function TemplateCharCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgSelected:SetActive(bSelect)
|
||||
end
|
||||
function TemplateCharCtrl:RefreshCharaIsFavorite()
|
||||
local bIsFavorite = PlayerData.Char:GetCharFavoriteState(self.nCharId)
|
||||
if bIsFavorite ~= nil then
|
||||
self._mapNode.imgFavorite:SetActive(bIsFavorite)
|
||||
end
|
||||
end
|
||||
function TemplateCharCtrl:RegisterRedDot()
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_Item, self.nCharId, self._mapNode.redDotChar)
|
||||
end
|
||||
|
||||
@@ -32,12 +32,15 @@ TemplateQuantitySelectorCtrl._mapNodeConfig = {
|
||||
Placeholder = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
TemplateQuantitySelectorCtrl._mapEventConfig = {}
|
||||
function TemplateQuantitySelectorCtrl:Init(funcRefresh, nDefaultCount, nMax, bHideSide)
|
||||
function TemplateQuantitySelectorCtrl:Init(funcRefresh, nDefaultCount, nMax, bHideSide, bAllowZero, addCallback)
|
||||
self.callback = funcRefresh
|
||||
self.nMax = nMax
|
||||
self.nBuyCount = nDefaultCount
|
||||
self.bAble = nDefaultCount ~= 0
|
||||
self.bAble = bAllowZero and 0 <= nDefaultCount or nDefaultCount ~= 0
|
||||
self.bHideSide = bHideSide
|
||||
self.bAllowZero = bAllowZero
|
||||
self.nMin = self.bAllowZero and 0 or 1
|
||||
self.addCallback = addCallback
|
||||
NovaAPI.SetTMPInputFieldInteractable(self._mapNode.inputCount, self.bAble)
|
||||
self:RefreshCount()
|
||||
end
|
||||
@@ -45,7 +48,7 @@ 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)
|
||||
self:RefreshReduceButton((self.bAllowZero and self.nBuyCount > 0 or self.nBuyCount > 1) and self.bAble)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:RefreshAddButton(bAble)
|
||||
self._mapNode.btnGrayAdd[1].gameObject:SetActive(not bAble and not self.bHideSide)
|
||||
@@ -75,6 +78,12 @@ function TemplateQuantitySelectorCtrl:OnBtnClick_Add(btn)
|
||||
if nRemain <= 0 then
|
||||
return
|
||||
end
|
||||
if self.addCallback ~= nil then
|
||||
local bCanAdd = self.addCallback()
|
||||
if not bCanAdd then
|
||||
return
|
||||
end
|
||||
end
|
||||
if btn.Operate_Type == 0 then
|
||||
self.nBuyCount = self.nBuyCount + 1
|
||||
elseif btn.Operate_Type == 3 then
|
||||
@@ -89,7 +98,7 @@ function TemplateQuantitySelectorCtrl:OnBtnClick_Add(btn)
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnBtnClick_Reduce(btn)
|
||||
if self.nBuyCount <= 1 then
|
||||
if self.nBuyCount <= self.nMin then
|
||||
return
|
||||
end
|
||||
if btn.Operate_Type == 0 then
|
||||
@@ -97,8 +106,8 @@ function TemplateQuantitySelectorCtrl:OnBtnClick_Reduce(btn)
|
||||
elseif btn.Operate_Type == 3 then
|
||||
self.nBuyCount = math.floor(self.nBuyCount - 2 ^ btn.CurrentGear)
|
||||
end
|
||||
if self.nBuyCount < 1 then
|
||||
self.nBuyCount = 1
|
||||
if self.nBuyCount < self.nMin then
|
||||
self.nBuyCount = self.nMin
|
||||
end
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
@@ -107,15 +116,21 @@ function TemplateQuantitySelectorCtrl:OnBtnClick_Max()
|
||||
if self.nBuyCount == self.nMax then
|
||||
return
|
||||
end
|
||||
if self.addCallback ~= nil then
|
||||
local bCanAdd = self.addCallback()
|
||||
if not bCanAdd then
|
||||
return
|
||||
end
|
||||
end
|
||||
self.nBuyCount = self.nMax
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
function TemplateQuantitySelectorCtrl:OnBtnClick_Min()
|
||||
if self.nBuyCount <= 1 then
|
||||
if self.nBuyCount <= self.nMin then
|
||||
return
|
||||
end
|
||||
self.nBuyCount = 1
|
||||
self.nBuyCount = self.nMin
|
||||
self:RefreshCount()
|
||||
self.callback(self.nBuyCount)
|
||||
end
|
||||
@@ -123,8 +138,8 @@ 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.nMin then
|
||||
nValue = self.nMin
|
||||
elseif nValue > self.nMax then
|
||||
nValue = self.nMax
|
||||
end
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
local TemplateRandomPropertyCtrl = class("TemplateRandomPropertyCtrl", 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)
|
||||
}
|
||||
TemplateRandomPropertyCtrl._mapNodeConfig = {
|
||||
imgBg = {sComponentName = "Image"},
|
||||
imgUp = {},
|
||||
txtTag = {sComponentName = "TMP_Text"},
|
||||
txtProperty = {sComponentName = "TMP_Text"},
|
||||
txtPropertyValue = {sComponentName = "TMP_Text"},
|
||||
txtPropertyValueBefore = {sComponentName = "TMP_Text"},
|
||||
TMP_Link = {
|
||||
sNodeName = "txtProperty",
|
||||
sComponentName = "TMPHyperLink",
|
||||
@@ -11,9 +18,18 @@ TemplateRandomPropertyCtrl._mapNodeConfig = {
|
||||
}
|
||||
}
|
||||
TemplateRandomPropertyCtrl._mapEventConfig = {}
|
||||
function TemplateRandomPropertyCtrl:SetProperty(nAttrId, nCharId, bLock)
|
||||
function TemplateRandomPropertyCtrl:SetProperty(nAttrId, nCharId, bLock, nAddCount, bShowBefore)
|
||||
self.nCharId = nCharId
|
||||
self.mapCfg = ConfigTable.GetData("CharGemAttrValue", nAttrId)
|
||||
self.mapCfg = nil
|
||||
if nAddCount and 0 < nAddCount then
|
||||
local mapCfg = ConfigTable.GetData("CharGemAttrValue", nAttrId)
|
||||
if mapCfg then
|
||||
local nId = mapCfg.TypeId * 100 + nAddCount + mapCfg.Level
|
||||
self.mapCfg = ConfigTable.GetData("CharGemAttrValue", nId)
|
||||
end
|
||||
else
|
||||
self.mapCfg = ConfigTable.GetData("CharGemAttrValue", nAttrId)
|
||||
end
|
||||
if not self.mapCfg then
|
||||
return
|
||||
end
|
||||
@@ -26,7 +42,31 @@ function TemplateRandomPropertyCtrl:SetProperty(nAttrId, nCharId, bLock)
|
||||
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)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtPropertyValue, ValueColor.black)
|
||||
self:SetAttrLock(bLock)
|
||||
self._mapNode.imgUp:SetActive(nAddCount and 0 < nAddCount)
|
||||
self._mapNode.txtPropertyValueBefore.gameObject:SetActive(false)
|
||||
if bShowBefore then
|
||||
local mapBeforeCfg = ConfigTable.GetData("CharGemAttrValue", nAttrId)
|
||||
if nAddCount and 1 < nAddCount then
|
||||
local nId = self.mapCfg.TypeId * 100 + self.mapCfg.Level - 1
|
||||
mapBeforeCfg = ConfigTable.GetData("CharGemAttrValue", nId)
|
||||
end
|
||||
if mapBeforeCfg then
|
||||
self._mapNode.txtPropertyValueBefore.gameObject:SetActive(true)
|
||||
local sValue = ""
|
||||
sValue = self:_TransValueFormat(tonumber(mapBeforeCfg.Value), mapAttributeDesc.isPercent, mapAttributeDesc.Format, self.mapCfg.Tag ~= GameEnum.CharGemAttrTag.ATTR)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPropertyValueBefore, sValue)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtPropertyValue, ValueColor.up)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TemplateRandomPropertyCtrl:PlayUpgradeAni(nAttrId, nCharId, bLock, nAddCount)
|
||||
self.gameObject.transform:Find("AnimRoot"):GetComponent("Animator"):Play("tc_random_property_1_in", 0, 0)
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self:SetProperty(nAttrId, nCharId, bLock, nAddCount, true)
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.1)
|
||||
end
|
||||
function TemplateRandomPropertyCtrl:SetAttrLock(bLock)
|
||||
if bLock then
|
||||
|
||||
Reference in New Issue
Block a user