Initial version - 1.2.0.60

EN: 1.2.0.60
CN: 1.2.0.61
JP: 1.2.0.63
KR: 1.2.0.67
This commit is contained in:
SL1900
2025-12-03 01:00:00 +09:00
commit 5e0d58cfad
3595 changed files with 9373562 additions and 0 deletions
@@ -0,0 +1,97 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local AffinityRewardCtrl = class("AffinityRewardCtrl", BaseCtrl)
AffinityRewardCtrl._mapNodeConfig = {
anit_window_01 = {sNodeName = "t_window", sComponentName = "Animator"},
got_fullscreen_blur_black = {
sNodeName = "t_fullscreen_blur_black",
sComponentName = "GameObject"
},
btnsnapshot = {
sNodeName = "snapshot",
sComponentName = "Button",
callback = "OnBtn_ClickClose"
},
btnClose = {
sNodeName = "btnClose",
sComponentName = "UIButton",
callback = "OnBtn_ClickClose"
},
svList = {
sComponentName = "LoopScrollView"
},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "CharacterRelation_Favour_Reward"
}
}
AffinityRewardCtrl._mapEventConfig = {}
function AffinityRewardCtrl:Awake()
local tbParam = self:GetPanelParam()
self.curNpcId = tbParam[1]
self.curNpcAffinityGroup = 0
self.tbAffinityCfgData = {}
self.mapGridCtrl = {}
self.mapNPCAffinityData = PlayerData.StarTower:GetNpcAffinityData(self.curNpcId)
local mapNpcCfgData = ConfigTable.GetData("StarTowerNPC", self.curNpcId)
if mapNpcCfgData ~= nil then
self.curNpcAffinityGroup = mapNpcCfgData.AffinityGroupId
end
end
function AffinityRewardCtrl:OnEnable()
self._mapNode.anit_window_01:Play("t_window_04_t_in")
self._mapNode.got_fullscreen_blur_black:SetActive(true)
local forEachNpcAffinity = function(mapData)
if mapData.AffinityGroupId == self.curNpcAffinityGroup and mapData.Level > 0 then
table.insert(self.tbAffinityCfgData, mapData)
end
end
ForEachTableLine(DataTable.NPCAffinityGroup, forEachNpcAffinity)
local sort = function(a, b)
return a.Level < b.Level
end
table.sort(self.tbAffinityCfgData, sort)
local nIdx = 1
for i, mapData in ipairs(self.tbAffinityCfgData) do
if self.mapNPCAffinityData.Level < mapData.Level then
nIdx = i
break
end
end
for nInstanceId, objCtrl in pairs(self.mapGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.mapGridCtrl[nInstanceId] = nil
end
self._mapNode.svList:Init(#self.tbAffinityCfgData, self, self.OnRefreshGrid, nil)
if 2 <= nIdx then
nIdx = nIdx - 2
else
nIdx = 0
end
self._mapNode.svList:SetScrollGridPos(nIdx)
end
function AffinityRewardCtrl:OnDisable()
for nInstanceId, objCtrl in pairs(self.mapGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.mapGridCtrl[nInstanceId] = nil
end
self.mapGridCtrl = {}
end
function AffinityRewardCtrl:OnRefreshGrid(goGrid, gridIndex)
local nInstanceId = goGrid:GetInstanceID()
local objCtrl = self.mapGridCtrl[nInstanceId]
if objCtrl == nil then
objCtrl = self:BindCtrlByNode(goGrid, "Game.UI.StarTowerBook.Affinity.AffinityRewardGridCtrl")
self.mapGridCtrl[nInstanceId] = objCtrl
end
local mapCfgData = self.tbAffinityCfgData[gridIndex + 1]
objCtrl:Refresh(mapCfgData, self.mapNPCAffinityData)
end
function AffinityRewardCtrl:OnBtn_ClickClose()
self._mapNode.anit_window_01:Play("t_window_04_t_out")
self._mapNode.got_fullscreen_blur_black:SetActive(false)
self:AddTimer(1, 0.3, "OnCloseAnimFinish", true, true, true)
end
function AffinityRewardCtrl:OnCloseAnimFinish()
EventManager.Hit(EventId.ClosePanel, PanelId.NpcAffinityRewardPanel)
end
return AffinityRewardCtrl
@@ -0,0 +1,77 @@
local AffinityRewardGridCtrl = class("AffinityRewardGridCtrl", BaseCtrl)
AffinityRewardGridCtrl._mapNodeConfig = {
rt_item = {
nCount = 3,
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
rtUnlock = {},
rtLock = {},
imgHead = {sComponentName = "Image"},
TMPUnreceived = {
sComponentName = "TMP_Text",
sLanguageId = "NPCAffinity_Received"
},
TMPReceived = {
sComponentName = "TMP_Text",
sLanguageId = "NPCAffinity_Unreceived"
},
txtLevelName = {
sComponentName = "TMP_Text",
nCount = 2,
sLanguageId = "Dating_Affinity_Level"
},
txtLevel = {sComponentName = "TMP_Text", nCount = 2},
btnItem = {
sComponentName = "UIButton",
nCount = 3,
callback = "OnBtnClick_RewardItem"
}
}
AffinityRewardGridCtrl._mapEventConfig = {}
AffinityRewardGridCtrl._mapRedDotConfig = {}
function AffinityRewardGridCtrl:Awake()
end
function AffinityRewardGridCtrl:FadeIn()
end
function AffinityRewardGridCtrl:FadeOut()
end
function AffinityRewardGridCtrl:OnEnable()
end
function AffinityRewardGridCtrl:OnDisable()
end
function AffinityRewardGridCtrl:OnDestroy()
end
function AffinityRewardGridCtrl:OnRelease()
end
function AffinityRewardGridCtrl:Refresh(mapCfgData, mapAffinity)
NovaAPI.SetTMPText(self._mapNode.txtLevel[1], mapCfgData.Level)
NovaAPI.SetTMPText(self._mapNode.txtLevel[2], mapCfgData.Level)
self:SetPngSprite(self._mapNode.imgHead, mapCfgData.Icon)
local mapReward = decodeJson(mapCfgData.Reward)
local tbReward = {}
for nTid, nCount in pairs(mapReward) do
table.insert(tbReward, {
tonumber(nTid),
tonumber(nCount)
})
end
local sort = function(a, b)
return a[1] < b[1]
end
table.sort(tbReward, sort)
self.tbReward = tbReward
for i = 1, 3 do
if tbReward[i] ~= nil then
self._mapNode.rt_item[i].gameObject:SetActive(true)
self._mapNode.rt_item[i]:SetItem(tbReward[i][1], nil, tbReward[i][2], nil, false, false, false, true, false)
else
self._mapNode.rt_item[i].gameObject:SetActive(false)
end
end
self._mapNode.rtUnlock:SetActive(mapCfgData.Level <= mapAffinity.Level)
self._mapNode.rtLock:SetActive(mapCfgData.Level > mapAffinity.Level)
end
function AffinityRewardGridCtrl:OnBtnClick_RewardItem(btn, nIdx)
UTILS.ClickItemGridWithTips(self.tbReward[nIdx][1], btn.gameObject, true, true, true)
end
return AffinityRewardGridCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local AffinityRewardPanel = class("AffinityRewardPanel", BasePanel)
AffinityRewardPanel._bIsMainPanel = false
AffinityRewardPanel._tbDefine = {
{
sPrefabPath = "StarTowerBook/NpcAffinityRewardPanel.prefab",
sCtrlName = "Game.UI.StarTowerBook.Affinity.AffinityRewardCtrl"
}
}
function AffinityRewardPanel:Awake()
end
function AffinityRewardPanel:OnEnable()
end
function AffinityRewardPanel:OnDisable()
end
function AffinityRewardPanel:OnDestroy()
end
function AffinityRewardPanel:OnRelease()
end
return AffinityRewardPanel
@@ -0,0 +1,65 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local NpcFavorCtrl = class("NpcFavorCtrl", BaseCtrl)
NpcFavorCtrl._mapNodeConfig = {
txtFavourLevel = {
sNodeName = "txtFavourLevel",
sComponentName = "TMP_Text"
},
transFavourBarCenter = {
sNodeName = "FavourBarCenter",
sComponentName = "Transform"
},
txtFavourNum = {sNodeName = "txtFavour", sComponentName = "TMP_Text"},
txtFavourBubble = {
sNodeName = "txtFavourBubble",
sComponentName = "TMP_Text"
},
imgHeart = {sNodeName = "imgHeart", sComponentName = "Image"},
aniFavour = {
sNodeName = "aniFavourRoot",
sComponentName = "Animator"
}
}
NpcFavorCtrl._mapEventConfig = {
[EventId.AffinityChange] = "OnEvent_AffinityChange"
}
function NpcFavorCtrl:Awake()
end
function NpcFavorCtrl:OnEnable()
end
function NpcFavorCtrl:Refresh(nNpcId)
self.curCharId = nNpcId
local affinityData = PlayerData.StarTower:GetNpcAffinityData(nNpcId)
self.curFavourExp = affinityData.Exp
local mapNpc = ConfigTable.GetData("StarTowerNPC", nNpcId)
local nGroupId = mapNpc.AffinityGroupId
local nId = nGroupId * 100 + affinityData.Level
local mapAffinityCfgData = ConfigTable.GetData("NPCAffinityGroup", nId)
local data = mapAffinityCfgData
local needExp = affinityData.nNeed
self.curFavourLevel = data.AffinityLevelStage
NovaAPI.SetTMPText(self._mapNode.txtFavourLevel, ConfigTable.GetUIText("Advance_Level_Name") .. affinityData.Level)
NovaAPI.SetTMPText(self._mapNode.txtFavourNum, self.curFavourExp .. "/" .. needExp)
self._mapNode.txtFavourNum.gameObject:SetActive(needExp ~= 0)
NovaAPI.SetTMPText(self._mapNode.txtFavourBubble, data.RelationshipName)
if data.AffinityLevelIcon ~= "" then
end
self._mapNode.aniFavour.gameObject:SetActive(false)
self._mapNode.aniFavour.gameObject:SetActive(true)
self._mapNode.aniFavour:SetInteger("affinity_lv", self.curFavourLevel)
local percent = 0
if needExp ~= 0 then
percent = self.curFavourExp / needExp
else
percent = 1
end
self:RefreshProgressBar(percent, 0)
end
function NpcFavorCtrl:RefreshProgressBar(nPercent, nDuration)
self._mapNode.transFavourBarCenter.localEulerAngles = Vector3(0, 0, 0)
self._mapNode.transFavourBarCenter:DORotate(Vector3(0, 0, (1 - nPercent) * 102), nDuration, RotateMode.LocalAxisAdd)
end
function NpcFavorCtrl:ResetData()
self._mapNode.transFavourBarCenter.localEulerAngles = Vector3(0, 0, 0)
end
return NpcFavorCtrl
@@ -0,0 +1,44 @@
local NpcRelationGridCtrl = class("NpcRelationGridCtrl", BaseCtrl)
NpcRelationGridCtrl._mapNodeConfig = {
rtUnlock = {},
rtLock = {},
TMPStroyChp = {sComponentName = "TMP_Text"},
TMPStroyName = {sComponentName = "TMP_Text"},
TMPRewardCount = {sComponentName = "TMP_Text"},
imgRewardIcon = {sComponentName = "Image"},
TMPCond = {sComponentName = "TMP_Text"}
}
NpcRelationGridCtrl._mapEventConfig = {}
NpcRelationGridCtrl._mapRedDotConfig = {}
function NpcRelationGridCtrl:Awake()
end
function NpcRelationGridCtrl:FadeIn()
end
function NpcRelationGridCtrl:FadeOut()
end
function NpcRelationGridCtrl:OnEnable()
end
function NpcRelationGridCtrl:OnDisable()
end
function NpcRelationGridCtrl:OnDestroy()
end
function NpcRelationGridCtrl:OnRelease()
end
function NpcRelationGridCtrl:Refresh(mapPlot, mapPlotData)
NovaAPI.SetTMPText(self._mapNode.TMPStroyChp, mapPlot.Name)
NovaAPI.SetTMPText(self._mapNode.TMPStroyName, mapPlot.Desc)
NovaAPI.SetTMPText(self._mapNode.TMPRewardCount, "×" .. mapPlot.ItemQty)
local mapItemCfgData = ConfigTable.GetData_Item(mapPlot.ItemId)
if mapItemCfgData ~= nil then
self._mapNode.imgRewardIcon.gameObject:SetActive(true)
self:SetPngSprite(self._mapNode.imgRewardIcon, mapItemCfgData.Icon)
else
self._mapNode.imgRewardIcon.gameObject:SetActive(false)
end
local str = orderedFormat(ConfigTable.GetUIText("NPCAffinity_UnlockCnd") or "", mapPlot.AffinityLevel)
NovaAPI.SetTMPText(self._mapNode.TMPCond, str)
self._mapNode.TMPRewardCount.gameObject:SetActive(not PlayerData.StarTower:GetNpcPlotReceived(mapPlot.NPCId, mapPlot.Id))
self._mapNode.rtUnlock:SetActive(mapPlot.AffinityLevel <= mapPlotData.Level)
self._mapNode.rtLock:SetActive(mapPlot.AffinityLevel > mapPlotData.Level)
end
return NpcRelationGridCtrl
@@ -0,0 +1,214 @@
local StarTowerNpcAffinityCtrl = class("StarTowerNpcAffinityCtrl", BaseCtrl)
StarTowerNpcAffinityCtrl._mapNodeConfig = {
btnNpc = {
sNodeName = "btnNpcTab",
nCount = 4,
sComponentName = "UIButton",
callback = "OnBtnClick_NPCTab"
},
btnNpcTab = {
nCount = 4,
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
},
redDotAffinityTab = {nCount = 4},
imgNpcHead = {nCount = 4, sComponentName = "Image"},
TMPWeekAffinityCount = {sComponentName = "TMP_Text"},
imgNPC = {sComponentName = "Image"},
goAffinity = {
sCtrlName = "Game.UI.StarTowerBook.Affinity.NpcFavorCtrl"
},
TMPNPCName = {sComponentName = "TMP_Text"},
TMPNpcInfo = {sComponentName = "TMP_Text"},
svAffinityList = {
sComponentName = "LoopScrollView"
},
txtCollect = {sComponentName = "TMP_Text"},
txtCollectCn = {
sComponentName = "TMP_Text",
sLanguageId = "StarTower_Book_Collect"
},
btnAffinityReward = {
sComponentName = "UIButton",
callback = "OnBtnClick_AffinityReward"
},
rtNpcInfo = {sComponentName = "ScrollRect"}
}
StarTowerNpcAffinityCtrl._mapEventConfig = {}
StarTowerNpcAffinityCtrl._mapRedDotConfig = {}
function StarTowerNpcAffinityCtrl:Awake()
self.tbNPC = {}
self.mapNpcPlot = {}
self.mapNpcAffinityData = {}
self.nTotalPlotCount = 0
local forEachStartowerNpc = function(mapData)
table.insert(self.tbNPC, mapData)
end
ForEachTableLine(DataTable.StarTowerNPC, forEachStartowerNpc)
local forEachStartowerNpcPlot = function(mapData)
if self.mapNpcPlot[mapData.NPCId] == nil then
self.mapNpcPlot[mapData.NPCId] = {}
end
self.nTotalPlotCount = self.nTotalPlotCount + 1
table.insert(self.mapNpcPlot[mapData.NPCId], mapData)
end
local sort = function(a, b)
return a.Id < b.Id
end
table.sort(self.tbNPC, sort)
ForEachTableLine(DataTable.NPCAffinityPlot, forEachStartowerNpcPlot)
local sortPlot = function(a, b)
return a.AffinityLevel < b.AffinityLevel
end
for _, tbPlot in pairs(self.mapNpcPlot) do
table.sort(tbPlot, sortPlot)
end
for i = 1, 4 do
self._mapNode.btnNpcTab[i]:SetText(self.tbNPC[i].Name)
self:SetPngSprite(self._mapNode.imgNpcHead[i], self.tbNPC[i].Head)
end
end
function StarTowerNpcAffinityCtrl:FadeIn()
end
function StarTowerNpcAffinityCtrl:FadeOut()
end
function StarTowerNpcAffinityCtrl:OnEnable()
for i = 1, 4 do
RedDotManager.RegisterNode(RedDotDefine.StarTowerBook_Affinity_Reward, self.tbNPC[i].Id, self._mapNode.redDotAffinityTab[i])
end
end
function StarTowerNpcAffinityCtrl:OnDisable()
self:UnbindAllGridNodes()
for i = 1, 4 do
RedDotManager.UnRegisterNode(RedDotDefine.StarTowerBook_Affinity_Reward, self.tbNPC[i].Id, self._mapNode.redDotAffinityTab[i])
end
end
function StarTowerNpcAffinityCtrl:OnDestroy()
end
function StarTowerNpcAffinityCtrl:OnRelease()
end
function StarTowerNpcAffinityCtrl:Init()
self.nCurCount = 0
for _, value in ipairs(self.tbNPC) do
local tbPlotCount = PlayerData.StarTower:GetNpcReceivedPlot(value.Id)
self.nCurCount = self.nCurCount + #tbPlotCount
end
self.mapNpcAffinityData = {}
local forEachStartowerNpc = function(mapData)
self.mapNpcAffinityData[mapData.Id] = PlayerData.StarTower:GetNpcAffinityData(mapData.Id)
end
ForEachTableLine(DataTable.StarTowerNPC, forEachStartowerNpc)
self.mapAffinityGrid = {}
self.nCurNpcId = self.tbNPC[1].Id
if self._panel.nAffinityNpcId ~= 0 and self._panel.nAffinityNpcId ~= nil then
self.nCurNpcId = self._panel.nAffinityNpcId
end
for i = 1, 4 do
self._mapNode.btnNpcTab[i]:SetDefault(self.nCurNpcId == self.tbNPC[i].Id)
end
local nMaxCount = ConfigTable.GetConfigNumber("NPCAffinityNumberOfInteractions")
local curCount = PlayerData.StarTower:GetNpcAffinityWeekCount()
local str = orderedFormat(ConfigTable.GetUIText("NPCAffinity_WeekCnt") or "", curCount, nMaxCount)
NovaAPI.SetTMPText(self._mapNode.TMPWeekAffinityCount, str)
NovaAPI.SetTMPText(self._mapNode.txtCollect, string.format("%d/%d", self.nCurCount, self.nTotalPlotCount))
self:RefreshContent(self.nCurNpcId)
end
function StarTowerNpcAffinityCtrl:RefreshContent(nNpcId)
self.nCurNpcId = nNpcId
local mapNpcCfg = ConfigTable.GetData("StarTowerNPC", nNpcId)
if mapNpcCfg == nil then
return
end
NovaAPI.SetVerticalNormalizedPosition(self._mapNode.rtNpcInfo, 1)
NovaAPI.SetTMPText(self._mapNode.TMPNPCName, mapNpcCfg.Name)
NovaAPI.SetTMPText(self._mapNode.TMPNpcInfo, mapNpcCfg.NPCDesc)
self:SetPngSprite(self._mapNode.imgNPC, mapNpcCfg.Image)
self._mapNode.goAffinity:Refresh(nNpcId)
self._mapNode.svAffinityList:Init(#self.mapNpcPlot[nNpcId], self, self.OnGridRefresh, self.OnGridBtnClick)
end
function StarTowerNpcAffinityCtrl:OnGridRefresh(goGrid, nIdx)
local nInstanceId = goGrid:GetInstanceID()
local objCtrl = self.mapAffinityGrid[nInstanceId]
if objCtrl == nil then
objCtrl = self:BindCtrlByNode(goGrid, "Game.UI.StarTowerBook.Affinity.NpcRelationGridCtrl")
self.mapAffinityGrid[nInstanceId] = objCtrl
end
nIdx = nIdx + 1
local mapPlot = self.mapNpcPlot[self.nCurNpcId][nIdx]
objCtrl:Refresh(mapPlot, self.mapNpcAffinityData[self.nCurNpcId])
end
function StarTowerNpcAffinityCtrl:OnGridBtnClick(goGrid, nIdx)
local mapNpcAffinityData = self.mapNpcAffinityData[self.nCurNpcId]
if mapNpcAffinityData == nil then
return
end
nIdx = nIdx + 1
local mapPlot = self.mapNpcPlot[self.nCurNpcId][nIdx]
if mapPlot.AffinityLevel <= mapNpcAffinityData.Level then
local ReceiveCallback = function(mapShow, mapChange)
EventManager.Hit(EventId.ClosePanel, PanelId.PureAvgStory)
local waitTransition = function()
UTILS.OpenReceiveByDisplayItem(mapShow, mapChange)
end
EventManager.Hit(EventId.TemporaryBlockInput, 1.5)
self:AddTimer(1, 1.5, waitTransition, true, true, true)
end
local AvgCallback = function()
PlayerData.StarTower:ReceiveNpcAffinityReward(self.nCurNpcId, mapPlot.Id, ReceiveCallback)
end
local AvgCallbackReveived = function()
EventManager.Hit(EventId.ClosePanel, PanelId.PureAvgStory)
end
if not PlayerData.StarTower:GetNpcPlotReceived(self.nCurNpcId, mapPlot.Id) then
local mapData = {
nType = AllEnum.StoryAvgType.Plot,
sAvgId = mapPlot.avgId,
nNodeId = nil,
callback = AvgCallback
}
EventManager.Hit(EventId.OpenPanel, PanelId.PureAvgStory, mapData)
else
do
local mapData = {
nType = AllEnum.StoryAvgType.Plot,
sAvgId = mapPlot.avgId,
nNodeId = nil,
callback = AvgCallbackReveived
}
EventManager.Hit(EventId.OpenPanel, PanelId.PureAvgStory, mapData)
end
end
else
local sTip = orderedFormat(ConfigTable.GetUIText("NPCAffinity_UnlockCnd") or "", mapPlot.AffinityLevel)
EventManager.Hit(EventId.OpenMessageBox, sTip)
end
end
function StarTowerNpcAffinityCtrl:UnbindAllGridNodes()
if self.mapAffinityGrid then
for goGrid, mapCtrl in pairs(self.mapAffinityGrid) do
self:UnbindCtrlByNode(mapCtrl)
end
self.mapAffinityGrid = {}
end
end
function StarTowerNpcAffinityCtrl:Back()
self:UnbindAllGridNodes()
EventManager.Hit("ChangeStarTowerBookPanel", AllEnum.StarTowerBookPanelType.Main)
end
function StarTowerNpcAffinityCtrl:OnBtnClick_NPCTab(btn, nIdx)
local nSelectNpcId = self.tbNPC[nIdx].Id
if self.nCurNpcId == nSelectNpcId then
return
end
for i = 1, 4 do
if self.nCurNpcId == self.tbNPC[i].Id then
self._mapNode.btnNpcTab[i]:SetDefault(false)
end
end
self.nCurNpcId = nSelectNpcId
self._mapNode.btnNpcTab[nIdx]:SetDefault(true)
self:RefreshContent(self.nCurNpcId)
end
function StarTowerNpcAffinityCtrl:OnBtnClick_AffinityReward(btn)
EventManager.Hit(EventId.OpenPanel, PanelId.NpcAffinityRewardPanel, self.nCurNpcId)
end
return StarTowerNpcAffinityCtrl