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,199 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local CharacterPlotCtrl = class("CharacterPlotCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
CharacterPlotCtrl._mapNodeConfig = {
|
||||
loopsv = {
|
||||
sNodeName = "sv",
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
CharacterPlotCtrl._mapEventConfig = {
|
||||
[EventId.CharRelatePanelAdvance] = "OnEvent_PanelAdvance",
|
||||
Enter_CharPlot = "OnEvent_Enter_CharPlot",
|
||||
[EventId.TransAnimOutClear] = "OnEvent_TransAnimOutClear",
|
||||
RefreshCharPlotContent = "OnEvent_RefreshCharPlotContent"
|
||||
}
|
||||
function CharacterPlotCtrl:Awake()
|
||||
end
|
||||
function CharacterPlotCtrl:OnEnable()
|
||||
end
|
||||
function CharacterPlotCtrl:OnDisable()
|
||||
end
|
||||
function CharacterPlotCtrl:OnDestroy()
|
||||
end
|
||||
function CharacterPlotCtrl:RegisterRedDot(plotId, redDot, bRebind)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_AffinityPlotItem, {
|
||||
self.characterId,
|
||||
plotId
|
||||
}, redDot, nil, nil, bRebind)
|
||||
end
|
||||
function CharacterPlotCtrl:RefreshContent(nCharId)
|
||||
self.tbReward = {}
|
||||
self:RefreshPlotList(nCharId)
|
||||
PlayerData.Phone:TrySendAddressListReq()
|
||||
end
|
||||
function CharacterPlotCtrl:RefreshPlotList(nCharId)
|
||||
self.characterId = nCharId
|
||||
self.PlotData = PlayerData.Char:GetCharPlotDataById(self.characterId)
|
||||
table.sort(self.PlotData, function(a, b)
|
||||
return a.Id < b.Id
|
||||
end)
|
||||
if self._mapNode ~= nil then
|
||||
self._mapNode.loopsv:Init(#self.PlotData, self, self.RefreshPlotItem)
|
||||
end
|
||||
end
|
||||
function CharacterPlotCtrl:RefreshPlotItem(go)
|
||||
local index = tonumber(go.name) + 1
|
||||
local data = self.PlotData[index]
|
||||
if data == nil then
|
||||
go:SetActive(false)
|
||||
return
|
||||
end
|
||||
local txtLockStr = ""
|
||||
local bLock = false
|
||||
local favourLevel = 0
|
||||
local favourData = PlayerData.Char:GetAdvanceLevelTable(self.curCharId)
|
||||
favourLevel = favourData ~= nil and favourData.Level or 0
|
||||
bLock, txtLockStr = PlayerData.Char:IsPlotUnlock(data.Id, self.characterId)
|
||||
local goLock = go.transform:Find("btnGrid/Lock")
|
||||
local root = go.transform:Find("btnGrid/AnimRoot")
|
||||
goLock.gameObject:SetActive(bLock)
|
||||
root.gameObject:SetActive(not bLock)
|
||||
local rewardData = decodeJson(data.Rewards)
|
||||
local itemId, itemCount
|
||||
for id, count in pairs(rewardData) do
|
||||
itemId = tonumber(id)
|
||||
itemCount = tonumber(count)
|
||||
end
|
||||
if bLock then
|
||||
local txtLock = goLock.transform:Find("txtLock"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtLock, txtLockStr)
|
||||
local txtLockReward = goLock:Find("txtLockReward"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtLockReward, ConfigTable.GetUIText("CharacterRelation_Plot_Reward"))
|
||||
local goReward = goLock:Find("txtLockReward/goJade")
|
||||
if itemId ~= nil then
|
||||
local imgReward = goReward:Find("goJadeImg/imgJade"):GetComponent("Image")
|
||||
self:SetPngSprite(imgReward, ConfigTable.GetData_Item(itemId).Icon)
|
||||
end
|
||||
if itemCount ~= nil then
|
||||
local txtRewardCount = goReward:Find("txtCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtRewardCount, "×" .. itemCount)
|
||||
LayoutRebuilder:ForceRebuildLayoutImmediate(txtRewardCount.transform)
|
||||
LayoutRebuilder:ForceRebuildLayoutImmediate(goReward)
|
||||
end
|
||||
local hasCG = nil ~= CacheTable.GetData("_CharacterCG", data.Id)
|
||||
local goFavorCg = goReward:Find("goFavorCg")
|
||||
goFavorCg.gameObject:SetActive(hasCG)
|
||||
local txtFavorCg = goFavorCg:Find("txtFavorCg"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtFavorCg, ConfigTable.GetUIText("CharacterRelation_CG_Reward"))
|
||||
return
|
||||
end
|
||||
local txtLevelIndex = root:Find("txtLevelIndex"):GetComponent("TMP_Text")
|
||||
local txtLevelName = root:Find("txtLevelName"):GetComponent("TMP_Text")
|
||||
local btnSelect = root:Find("btnSelect"):GetComponent("UIButton")
|
||||
local imgLevel = root:Find("goAvg/imgLevel"):GetComponent("Image")
|
||||
local goReward = root:Find("goJade")
|
||||
local redDot = root:Find("RedDot")
|
||||
NovaAPI.SetTMPText(txtLevelIndex, orderedFormat(ConfigTable.GetUIText("Plot_Index"), index))
|
||||
NovaAPI.SetTMPText(txtLevelName, data.Name)
|
||||
if data.PicSource ~= "" then
|
||||
self:SetPngSprite(imgLevel, data.PicSource)
|
||||
end
|
||||
btnSelect.onClick:AddListener(function()
|
||||
self.curSelectIndex = index
|
||||
self:OnBtnClick_Select()
|
||||
end)
|
||||
local bGetReward = PlayerData.Char:IsCharPlotFinish(self.characterId, data.Id)
|
||||
local hasCG = nil ~= CacheTable.GetData("_CharacterCG", data.Id)
|
||||
goReward.gameObject:SetActive(not bGetReward or hasCG)
|
||||
self.tbReward[index] = {nId = itemId, bReceive = bGetReward}
|
||||
if itemId ~= nil then
|
||||
local imgReward = goReward:Find("goJadeImg/imgJade"):GetComponent("Image")
|
||||
self:SetPngSprite(imgReward, ConfigTable.GetData_Item(itemId).Icon)
|
||||
imgReward.gameObject:SetActive(not bGetReward)
|
||||
end
|
||||
if itemCount ~= nil then
|
||||
local txtRewardCount = goReward:Find("txtCount"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtRewardCount, "×" .. itemCount)
|
||||
txtRewardCount.gameObject:SetActive(not bGetReward)
|
||||
LayoutRebuilder:ForceRebuildLayoutImmediate(txtRewardCount.transform)
|
||||
LayoutRebuilder:ForceRebuildLayoutImmediate(goReward)
|
||||
end
|
||||
local goFavorCg = goReward:Find("goFavorCg")
|
||||
goFavorCg.gameObject:SetActive(hasCG)
|
||||
self:RegisterRedDot(data.Id, redDot, true)
|
||||
end
|
||||
function CharacterPlotCtrl:ShowReward()
|
||||
local mapPlot = self.PlotData[self.curSelectIndex]
|
||||
local mapMsgData = self.PlotRewardData
|
||||
local rewardFunc = function()
|
||||
local bHasReward = mapMsgData and mapMsgData.Props and #mapMsgData.Props > 0
|
||||
local tbItem = {}
|
||||
if bHasReward then
|
||||
local sRewardDisplay = mapPlot.Rewards
|
||||
local tbRewardDisplay = decodeJson(sRewardDisplay)
|
||||
for k, v in pairs(tbRewardDisplay) do
|
||||
table.insert(tbItem, {
|
||||
Tid = tonumber(k),
|
||||
Qty = v,
|
||||
rewardType = AllEnum.RewardType.First
|
||||
})
|
||||
end
|
||||
UTILS.OpenReceiveByDisplayItem(tbItem, mapMsgData)
|
||||
end
|
||||
end
|
||||
if nil ~= CacheTable.GetData("_CharacterCG", mapPlot.Id) then
|
||||
local tbRewardList = {}
|
||||
table.insert(tbRewardList, {
|
||||
nId = CacheTable.GetData("_CharacterCG", mapPlot.Id),
|
||||
nCharId = self.characterId,
|
||||
bNew = true,
|
||||
tbItemList = {},
|
||||
bCG = true,
|
||||
callBack = rewardFunc
|
||||
})
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ReceiveSpecialReward, tbRewardList)
|
||||
else
|
||||
rewardFunc()
|
||||
end
|
||||
self.PlotRewardData = nil
|
||||
end
|
||||
function CharacterPlotCtrl:OnBtnClick_Select()
|
||||
local data = self.PlotData[self.curSelectIndex]
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharPlot, data, self.tbReward, self.curSelectIndex)
|
||||
end
|
||||
function CharacterPlotCtrl:OnBtnClick_EnterPlot()
|
||||
if self.PlotData == nil then
|
||||
return
|
||||
end
|
||||
local mapPlot = self.PlotData[self.curSelectIndex]
|
||||
if mapPlot.ConnectChatId ~= 0 and not PlayerData.Phone:CheckChatComplete(mapPlot.ConnectChatId) then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PhonePopUp, mapPlot.ConnectChatId, true)
|
||||
return
|
||||
end
|
||||
local bGetReward = PlayerData.Char:IsCharPlotFinish(self.characterId, mapPlot.Id)
|
||||
local finishCallback = function(nCharId)
|
||||
if not bGetReward then
|
||||
EventManager.Hit("RefreshCharPlotContent", nCharId)
|
||||
else
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.PureAvgStory)
|
||||
end
|
||||
end
|
||||
PlayerData.Char:EnterCharPlotAvg(self.characterId, mapPlot.Id, finishCallback, true)
|
||||
end
|
||||
function CharacterPlotCtrl:OnBtnClick_Reward(btn)
|
||||
if self.tbReward ~= nil then
|
||||
local nTid = self.tbReward.nId
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.transform, false, true, false)
|
||||
end
|
||||
end
|
||||
function CharacterPlotCtrl:OnEvent_Enter_CharPlot(...)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.CharPlot)
|
||||
self:OnBtnClick_EnterPlot()
|
||||
end
|
||||
function CharacterPlotCtrl:OnEvent_TransAnimOutClear(...)
|
||||
end
|
||||
function CharacterPlotCtrl:OnEvent_RefreshCharPlotContent(nCharId)
|
||||
self:RefreshContent(nCharId)
|
||||
end
|
||||
return CharacterPlotCtrl
|
||||
@@ -0,0 +1,505 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local CharacterRecordCtrl = class("CharacterRecordCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local BubbleVoiceManager = require("Game.Actor2D.BubbleVoiceManager")
|
||||
CharacterRecordCtrl._mapNodeConfig = {
|
||||
txtCalInfoHeight = {sComponentName = "TMP_Text"},
|
||||
rtTxtCalInfoHeight = {
|
||||
sNodeName = "txtCalInfoHeight",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtCalInfoWidth = {sComponentName = "TMP_Text"},
|
||||
rtTxtCalInfoWidth = {
|
||||
sNodeName = "txtCalInfoWidth",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
loopRecordList = {
|
||||
sNodeName = "RecordList",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
goRecordList = {sNodeName = "RecordList", sComponentName = "GameObject"},
|
||||
goVoice = {sNodeName = "Voice", sComponentName = "GameObject"},
|
||||
goPlotRoot = {sNodeName = "PlotRoot", sComponentName = "GameObject"},
|
||||
ctlPlotRoot = {
|
||||
sNodeName = "PlotRoot",
|
||||
sCtrlName = "Game.UI.CharacterRecord.CharacterPlotCtrl"
|
||||
},
|
||||
loopscVoice = {
|
||||
sNodeName = "scVoice",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
recordTog = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ChangeTab"
|
||||
},
|
||||
ctrlTog = {
|
||||
nCount = 3,
|
||||
sNodeName = "recordTog",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
togRedDot = {nCount = 4},
|
||||
txtContentSize = {sComponentName = "TMP_Text"},
|
||||
rectContentSize = {
|
||||
sNodeName = "txtContentSize",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goBubbleRoot = {
|
||||
sNodeName = "----fixed_bubble----"
|
||||
}
|
||||
}
|
||||
CharacterRecordCtrl._mapEventConfig = {
|
||||
[EventId.CharRelatePanelAdvance] = "OnEvent_PanelAdvance",
|
||||
[EventId.LookUpCharStory] = "OnEvent_OpenStoryPanel",
|
||||
[EventId.AffinityChange] = "OnEvent_AffinityChange",
|
||||
[EventId.WWiseVoiceEnd] = "OnEvent_WWiseVoiceEnd"
|
||||
}
|
||||
local RecordTogType = {
|
||||
RecordInfo = 1,
|
||||
Voice = 2,
|
||||
Plot = 3
|
||||
}
|
||||
local InfoGridSize = {
|
||||
Info = 88,
|
||||
InfoSpacing = 7,
|
||||
InfoGrid = 50,
|
||||
Lock = 60,
|
||||
Special = 137,
|
||||
Normal = 124
|
||||
}
|
||||
local VoiceGridSize = {Title = 50, Voice = 118.5}
|
||||
local gridBottom = 42
|
||||
local nInfoContentMaxWidth = 860
|
||||
function CharacterRecordCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function CharacterRecordCtrl:OnEnable()
|
||||
self.tbGridCtrl = {}
|
||||
self.InitState = {}
|
||||
self.InfoGrid = self._mapNode.goRecordList.transform:Find("grid")
|
||||
self.curPlayingId = 0
|
||||
self.tbVoicePlayingObj = {}
|
||||
self:InitTog()
|
||||
end
|
||||
function CharacterRecordCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
self.tbVoicePlayingObj = {}
|
||||
self.curPlayingId = 0
|
||||
if self.curCharId == nil then
|
||||
return
|
||||
end
|
||||
PlayerData.Char:UpdateCharVoiceReddot(self.curCharId, true)
|
||||
PlayerData.Char:UpdateCharRecordReddot(self.curCharId, true)
|
||||
PlayerData.Char:ResetArchiveContentUpdateRedDot(self.curCharId)
|
||||
self:OnStopCharVoice()
|
||||
end
|
||||
function CharacterRecordCtrl:RegisterTogRedDot(nCharId)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_Record_Info, nCharId, self._mapNode.togRedDot[1])
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_Record_Voice, nCharId, self._mapNode.togRedDot[2])
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_AffinityPlot, nCharId, self._mapNode.togRedDot[3])
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_RecordReward, nCharId, self._mapNode.togRedDot[4])
|
||||
end
|
||||
function CharacterRecordCtrl:RegisterInfoRedDot(charId, characterArchiveId, redDot, bRebind)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_Record_Info_Item, {charId, characterArchiveId}, redDot, nil, nil, bRebind)
|
||||
end
|
||||
function CharacterRecordCtrl:RegisterInfoUpdateRedDot(charId, characterArchiveId, redDot, bRebind)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_Record_InfoUpdate_Item, {charId, characterArchiveId}, redDot, nil, nil, bRebind)
|
||||
end
|
||||
function CharacterRecordCtrl:RegisterBaseInfoUpdateRedDot(charId, redDot, bRebind)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_Record_BaseInfoUpdate_Item, charId, redDot, nil, nil, bRebind)
|
||||
end
|
||||
function CharacterRecordCtrl:RegisterVoiceRedDot(charId, characterArchiveId, redDot, bRebind)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_Record_Voice_Item, {charId, characterArchiveId}, redDot, nil, nil, bRebind)
|
||||
end
|
||||
function CharacterRecordCtrl:RegisterRewardRedDot(nCharId, characterArchiveId, redDot, bRebind)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Role_RecordRewardItem, {nCharId, characterArchiveId}, redDot, nil, nil, bRebind)
|
||||
end
|
||||
function CharacterRecordCtrl:InitTog()
|
||||
self._mapNode.ctrlTog[1]:SetText(ConfigTable.GetUIText("CharacterRelation_Tog_1"))
|
||||
self._mapNode.ctrlTog[2]:SetText(ConfigTable.GetUIText("CharacterRelation_Tog_2"))
|
||||
self._mapNode.ctrlTog[3]:SetText(ConfigTable.GetUIText("CharacterRelation_Tog_3"))
|
||||
end
|
||||
function CharacterRecordCtrl:Refresh(nCharId)
|
||||
if nil ~= self.curCharId and self.curCharId ~= nCharId then
|
||||
self.InitState = {}
|
||||
self:OnStopCharVoice()
|
||||
self:OnStopCharVoiceBubble()
|
||||
end
|
||||
local bReset = self.nCurTog == nil or self.nCurTog ~= RecordTogType.RecordInfo
|
||||
if self.nCurTog == nil or self.curCharId ~= nCharId then
|
||||
self.nCurTog = RecordTogType.RecordInfo
|
||||
end
|
||||
if bReset then
|
||||
for k, v in ipairs(self._mapNode.ctrlTog) do
|
||||
v:SetTrigger(k == self.nCurTog)
|
||||
end
|
||||
end
|
||||
self.ClickedRecordInfoTog = false
|
||||
self.ClickedVoiceTog = false
|
||||
self.bLevelChanged = true
|
||||
self.curCharId = nCharId
|
||||
self:OnRefreshPanel()
|
||||
self:RegisterTogRedDot(self.curCharId)
|
||||
end
|
||||
function CharacterRecordCtrl:OnRefreshPanel()
|
||||
local data = PlayerData.Char:GetCharAffinityData(self.curCharId)
|
||||
if data == nil then
|
||||
return
|
||||
end
|
||||
self.curFavourLevel = data.Level
|
||||
self:SwitchTog()
|
||||
end
|
||||
function CharacterRecordCtrl:OnRefreshRecordInfo()
|
||||
self.CharRecordInfoList = {}
|
||||
self.tbGridSize = {}
|
||||
self.curCharBaseInfoList = {}
|
||||
local foreachCharRecord = function(mapData)
|
||||
if mapData.CharacterId == self.curCharId then
|
||||
table.insert(self.CharRecordInfoList, mapData)
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.CharacterArchive, foreachCharRecord)
|
||||
table.sort(self.CharRecordInfoList, function(a, b)
|
||||
return a.Sort < b.Sort
|
||||
end)
|
||||
for k, v in ipairs(self.CharRecordInfoList) do
|
||||
if v.ArchType == GameEnum.ArchType.BaseType then
|
||||
local nHeight = 0
|
||||
local foreachCharacterArchiveBaseInfo = function(mapData)
|
||||
if mapData.CharacterId == self.curCharId then
|
||||
table.insert(self.curCharBaseInfoList, mapData)
|
||||
local nWidth = self:CalRecordInfoBaseWidth(mapData.Title)
|
||||
nHeight = nHeight + self:CalRecordInfoBaseHeight(mapData.Content, nInfoContentMaxWidth - nWidth - 10)
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.CharacterArchiveBaseInfo, foreachCharacterArchiveBaseInfo)
|
||||
nHeight = nHeight + InfoGridSize.Info + (#self.curCharBaseInfoList - 1) * InfoGridSize.InfoSpacing + gridBottom
|
||||
table.insert(self.tbGridSize, nHeight)
|
||||
elseif v.UnlockAffinityLevel > self.curFavourLevel then
|
||||
if v.ArchType == GameEnum.ArchType.SpecialType then
|
||||
table.insert(self.tbGridSize, InfoGridSize.Special)
|
||||
else
|
||||
table.insert(self.tbGridSize, InfoGridSize.Lock)
|
||||
end
|
||||
elseif v.ArchType == GameEnum.ArchType.SpecialType then
|
||||
table.insert(self.tbGridSize, InfoGridSize.Special)
|
||||
else
|
||||
local height = self:CalRecordInfoGridSize(k)
|
||||
table.insert(self.tbGridSize, height)
|
||||
end
|
||||
end
|
||||
if #self.tbGridSize > 0 then
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.loopRecordList.gameObject:SetActive(true)
|
||||
self._mapNode.loopRecordList:InitEx(self.tbGridSize, self, self.RefreshRecordInfoGrid)
|
||||
else
|
||||
self._mapNode.loopRecordList.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function CharacterRecordCtrl:RefreshRecordInfoGrid(go, index)
|
||||
local index = index + 1
|
||||
local nInstanceId = go:GetInstanceID()
|
||||
if self.tbGridCtrl == nil then
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
if not self.tbGridCtrl[nInstanceId] then
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(go, "Game.UI.CharacterRecord.CharRecordInfoItemCtrl")
|
||||
end
|
||||
local redDot = go.transform:Find("RedDotRoot/RedDot")
|
||||
if self.CharRecordInfoList[index].ArchType == GameEnum.ArchType.SpecialType then
|
||||
self:RegisterRewardRedDot(self.curCharId, self.CharRecordInfoList[index].Id, redDot, true)
|
||||
else
|
||||
self:RegisterInfoRedDot(self.curCharId, self.CharRecordInfoList[index].Id, redDot, true)
|
||||
end
|
||||
local updateRedDot = go.transform:Find("RedDotRoot/UpdateRedDot")
|
||||
if self.CharRecordInfoList[index].ArchType == GameEnum.ArchType.BaseType then
|
||||
self:RegisterBaseInfoUpdateRedDot(self.curCharId, updateRedDot, true)
|
||||
else
|
||||
self:RegisterInfoUpdateRedDot(self.curCharId, self.CharRecordInfoList[index].Id, updateRedDot, true)
|
||||
end
|
||||
self.tbGridCtrl[nInstanceId]:RefreshGrid(self.CharRecordInfoList[index], self.curCharBaseInfoList)
|
||||
end
|
||||
function CharacterRecordCtrl:CalRecordInfoGridSize(index)
|
||||
local contentData = ConfigTable.GetData("CharacterArchiveContent", self.CharRecordInfoList[index].RecordId)
|
||||
if contentData ~= nil then
|
||||
local bUpdate = PlayerData.Char:CheckCharArchiveContentUpdate(self.curCharId, self.CharRecordInfoList[index].RecordId)
|
||||
local sContent = bUpdate and contentData.UpdateContent1 or contentData.Content
|
||||
sContent = ProcAvgTextContent(sContent, GetLanguageIndex(Settings.sCurrentTxtLanguage))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtContentSize, sContent)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rectContentSize)
|
||||
end
|
||||
self._mapNode.txtContentSize.gameObject:SetActive(false)
|
||||
self._mapNode.txtContentSize.gameObject:SetActive(true)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rectContentSize)
|
||||
return self._mapNode.rectContentSize.rect.height + InfoGridSize.Normal
|
||||
end
|
||||
function CharacterRecordCtrl:CalRecordInfoBaseHeight(sContent, nWidth)
|
||||
self._mapNode.rtTxtCalInfoHeight.sizeDelta = Vector2(nWidth, 100)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCalInfoHeight, sContent)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtTxtCalInfoHeight)
|
||||
local nHeight = self._mapNode.rtTxtCalInfoHeight.rect.height
|
||||
return nHeight
|
||||
end
|
||||
function CharacterRecordCtrl:CalRecordInfoBaseWidth(sContent)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCalInfoWidth, sContent)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtTxtCalInfoWidth)
|
||||
local nWidth = self._mapNode.rtTxtCalInfoWidth.rect.width
|
||||
return nWidth
|
||||
end
|
||||
function CharacterRecordCtrl:OnRefreshVoice()
|
||||
if self.InitState[RecordTogType.Voice] == nil then
|
||||
self.InitState[RecordTogType.Voice] = 1
|
||||
elseif self.InitState[RecordTogType.Voice] == 1 then
|
||||
return
|
||||
end
|
||||
self.DailyVoiceData = {}
|
||||
self.BattleVoiceData = {}
|
||||
local tbVoiceGirdHeight = {}
|
||||
local foreachLineCharVoice = function(mapData)
|
||||
if mapData.CharacterId == self.curCharId then
|
||||
if mapData.ArchVoiceType == GameEnum.ArchVoiceType.DailyVoice then
|
||||
table.insert(self.DailyVoiceData, mapData)
|
||||
else
|
||||
table.insert(self.BattleVoiceData, mapData)
|
||||
end
|
||||
tbVoiceGirdHeight[#tbVoiceGirdHeight + 1] = VoiceGridSize.Voice
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.CharacterArchiveVoice, foreachLineCharVoice)
|
||||
if #self.DailyVoiceData > 0 then
|
||||
tbVoiceGirdHeight[1] = VoiceGridSize.Title
|
||||
tbVoiceGirdHeight[#tbVoiceGirdHeight + 1] = VoiceGridSize.Voice
|
||||
end
|
||||
if 0 < #self.BattleVoiceData then
|
||||
tbVoiceGirdHeight[#tbVoiceGirdHeight - #self.BattleVoiceData + 1] = VoiceGridSize.Title
|
||||
tbVoiceGirdHeight[#tbVoiceGirdHeight + 1] = VoiceGridSize.Voice
|
||||
end
|
||||
table.sort(self.DailyVoiceData, function(a, b)
|
||||
return a.Sort < b.Sort
|
||||
end)
|
||||
table.sort(self.BattleVoiceData, function(a, b)
|
||||
return a.Sort < b.Sort
|
||||
end)
|
||||
if 0 < #tbVoiceGirdHeight then
|
||||
self._mapNode.loopscVoice.gameObject:SetActive(true)
|
||||
self._mapNode.loopscVoice:InitEx(tbVoiceGirdHeight, self, self.RefreshVoiceGrid)
|
||||
else
|
||||
self._mapNode.loopscVoice.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function CharacterRecordCtrl:RefreshVoiceGrid(go, index)
|
||||
local index = index + 1
|
||||
local trans = go.transform
|
||||
local titleRoot = trans:Find("DescRoot")
|
||||
local voiceRoot = trans:Find("VoiceRoot")
|
||||
local redDot = trans:Find("RedDot")
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(trans)
|
||||
if index == 1 or index - 2 == #self.DailyVoiceData then
|
||||
titleRoot.gameObject:SetActive(true)
|
||||
voiceRoot.gameObject:SetActive(false)
|
||||
local voiceTitle = titleRoot:Find("t_common_04/imgBg/txtTitle"):GetComponent("TMP_Text")
|
||||
if index == 1 then
|
||||
NovaAPI.SetTMPText(voiceTitle, ConfigTable.GetUIText("Daily_Voice"))
|
||||
else
|
||||
NovaAPI.SetTMPText(voiceTitle, ConfigTable.GetUIText("Battle_Voice"))
|
||||
end
|
||||
redDot.gameObject:SetActive(false)
|
||||
else
|
||||
titleRoot.gameObject:SetActive(false)
|
||||
voiceRoot.gameObject:SetActive(true)
|
||||
local goUnlock = voiceRoot:Find("Unlock")
|
||||
local goLock = voiceRoot:Find("Lock")
|
||||
local data = {}
|
||||
if index > 1 + #self.DailyVoiceData then
|
||||
data = self.BattleVoiceData[index - 2 - #self.DailyVoiceData]
|
||||
else
|
||||
data = self.DailyVoiceData[index - 1]
|
||||
end
|
||||
local bLock, lockTxt = self:IsVoiceLock(data)
|
||||
goUnlock.gameObject:SetActive(not bLock)
|
||||
goLock.gameObject:SetActive(bLock)
|
||||
local imgVoice = voiceRoot:GetComponent("Image")
|
||||
local color = NovaAPI.GetImageColor(imgVoice)
|
||||
color.a = bLock and 0.85 or 1
|
||||
NovaAPI.SetImageColor(imgVoice, color)
|
||||
local btnPlay = goUnlock:Find("btnPlay"):GetComponent("UIButton")
|
||||
local imgPlay = btnPlay.transform:Find("AnimRoot/imgPlay")
|
||||
local imgPlaying = btnPlay.transform:Find("AnimRoot/imgPlaying")
|
||||
imgPlay.gameObject:SetActive(self.curPlayingId ~= data.Id)
|
||||
imgPlaying.gameObject:SetActive(self.curPlayingId == data.Id)
|
||||
btnPlay.onClick:RemoveAllListeners()
|
||||
self.tbVoicePlayingObj[data.Id] = btnPlay
|
||||
if bLock then
|
||||
local txtVoiceLockCondition = goLock:Find("txtVoiceLockCondition"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtVoiceLockCondition, lockTxt)
|
||||
else
|
||||
local txtVoiceTitle = goUnlock:Find("VoiceTitle"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtVoiceTitle, data.Title)
|
||||
btnPlay.onClick:AddListener(function()
|
||||
RedDotManager.SetValid(RedDotDefine.Role_Record_Voice_Item, {
|
||||
self.curCharId,
|
||||
data.Id
|
||||
}, false)
|
||||
if WwiseAudioMgr.VoiceVolume <= 0 or not WwiseAudioMgr.m_voice then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Sound_Voice_Closed"))
|
||||
return
|
||||
end
|
||||
if self.curPlayingId ~= data.Id then
|
||||
imgPlay.gameObject:SetActive(false)
|
||||
imgPlaying.gameObject:SetActive(true)
|
||||
end
|
||||
self:OnBtn_ClickPlayVoice(btnPlay, data.Id)
|
||||
end)
|
||||
end
|
||||
self:RegisterVoiceRedDot(self.curCharId, data.Id, redDot, true)
|
||||
end
|
||||
end
|
||||
function CharacterRecordCtrl:IsVoiceLock(voiceData)
|
||||
if self.curFavourLevel < voiceData.UnlockAffinityLevel then
|
||||
return true, orderedFormat(ConfigTable.GetUIText("Affinity_UnLock_Level"), voiceData.UnlockAffinityLevel)
|
||||
end
|
||||
if voiceData.UnlockPlot ~= 0 and ConfigTable.GetData("Plot", voiceData.UnlockPlot) ~= nil then
|
||||
local bFinish = PlayerData.Char:IsCharPlotFinish(self.curCharId, voiceData.UnlockPlot)
|
||||
if bFinish then
|
||||
return false
|
||||
else
|
||||
local data = ConfigTable.GetData("Plot", voiceData.UnlockPlot)
|
||||
return true, orderedFormat(ConfigTable.GetUIText("Plot_Unlock_Condition"), data.Name)
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function CharacterRecordCtrl:OnBtn_ClickPlayVoice(btnPlay, id)
|
||||
if self.curPlayingId ~= 0 and self.tbVoicePlayingObj[self.curPlayingId] ~= nil then
|
||||
local imgPlay = self.tbVoicePlayingObj[self.curPlayingId].transform:Find("AnimRoot/imgPlay")
|
||||
local imgPlaying = self.tbVoicePlayingObj[self.curPlayingId].transform:Find("AnimRoot/imgPlaying")
|
||||
imgPlay.gameObject:SetActive(true)
|
||||
imgPlaying.gameObject:SetActive(false)
|
||||
self.bActivePause = true
|
||||
self:OnStopCharVoice()
|
||||
end
|
||||
if self.curPlayingId ~= id then
|
||||
local data = ConfigTable.GetData("CharacterArchiveVoice", id)
|
||||
self:OnPlayCharVoice(self.curCharId, data.Source)
|
||||
self.curPlayingId = id
|
||||
else
|
||||
self.curPlayingId = 0
|
||||
BubbleVoiceManager.StopBubbleAnim()
|
||||
end
|
||||
end
|
||||
function CharacterRecordCtrl:OnPlayCharVoice(nCharId, sVoiceKey)
|
||||
if nil ~= sVoiceKey then
|
||||
local tbKey = string.split(sVoiceKey, "_")
|
||||
local sVoiceRes
|
||||
if 1 < #tbKey then
|
||||
sVoiceRes = WwiseAudioMgr:WwiseVoice_PlayEndCallback(nCharId, tbKey[1], tonumber(tbKey[2]))
|
||||
else
|
||||
sVoiceRes = WwiseAudioMgr:WwiseVoice_PlayEndCallback(nCharId, sVoiceKey)
|
||||
end
|
||||
if nil ~= sVoiceRes then
|
||||
if 1 < #tbKey then
|
||||
self.sCurVoiceKey = tbKey[1]
|
||||
else
|
||||
self.sCurVoiceKey = sVoiceKey
|
||||
end
|
||||
self:OnPlayCharVoiceBubble(sVoiceRes)
|
||||
end
|
||||
end
|
||||
end
|
||||
function CharacterRecordCtrl:OnStopCharVoice()
|
||||
if nil ~= self.sCurVoiceKey then
|
||||
local tbCfg = ConfigTable.GetData("CharacterVoiceControl", self.sCurVoiceKey)
|
||||
if nil ~= tbCfg then
|
||||
WwiseAudioMgr:WwiseVoice_Stop(tbCfg.voPlayer - 1)
|
||||
end
|
||||
end
|
||||
BubbleVoiceManager.StopBubbleAnim()
|
||||
end
|
||||
function CharacterRecordCtrl:OnPlayCharVoiceBubble(sVoiceRes)
|
||||
if nil ~= sVoiceRes then
|
||||
local tbCfg = ConfigTable.GetData("VoDirectory", sVoiceRes)
|
||||
if nil ~= tbCfg then
|
||||
BubbleVoiceManager.PlayFixedBubbleAnim(self._mapNode.goBubbleRoot, tbCfg.voResource)
|
||||
end
|
||||
end
|
||||
end
|
||||
function CharacterRecordCtrl:OnStopCharVoiceBubble()
|
||||
BubbleVoiceManager.StopBubbleAnim()
|
||||
end
|
||||
function CharacterRecordCtrl:OnRefreshPlot()
|
||||
if self.InitState[RecordTogType.Plot] == nil then
|
||||
self.InitState[RecordTogType.Plot] = 1
|
||||
elseif self.InitState[RecordTogType.Plot] == 1 then
|
||||
return
|
||||
end
|
||||
self._mapNode.ctlPlotRoot:RefreshContent(self.curCharId)
|
||||
end
|
||||
function CharacterRecordCtrl:SwitchTog()
|
||||
self._mapNode.goRecordList:SetActive(self.nCurTog == RecordTogType.RecordInfo)
|
||||
self._mapNode.goVoice:SetActive(self.nCurTog == RecordTogType.Voice)
|
||||
self._mapNode.goPlotRoot:SetActive(self.nCurTog == RecordTogType.Plot)
|
||||
if self.nCurTog == RecordTogType.RecordInfo then
|
||||
self:OnRefreshRecordInfo()
|
||||
elseif self.nCurTog == RecordTogType.Voice then
|
||||
self:OnRefreshVoice()
|
||||
elseif self.nCurTog == RecordTogType.Plot then
|
||||
self:OnRefreshPlot()
|
||||
end
|
||||
end
|
||||
function CharacterRecordCtrl:OnBtnClick_ChangeTab(btn, nIndex)
|
||||
if nIndex == self.nCurTog then
|
||||
return
|
||||
end
|
||||
self._mapNode.ctrlTog[nIndex]:SetTrigger(true)
|
||||
self._mapNode.ctrlTog[self.nCurTog]:SetTrigger(false)
|
||||
if self.nCurTog == RecordTogType.Voice then
|
||||
if self.bLevelChanged == true or self.ClickedVoiceTog ~= true then
|
||||
PlayerData.Char:UpdateCharVoiceReddot(self.curCharId, true)
|
||||
self.bLevelChanged = false
|
||||
self.ClickedVoiceTog = true
|
||||
end
|
||||
elseif self.nCurTog == RecordTogType.RecordInfo and (self.bLevelChanged == true or self.ClickedRecordInfoTog ~= true) then
|
||||
PlayerData.Char:UpdateCharRecordReddot(self.curCharId, true)
|
||||
PlayerData.Char:ResetArchiveContentUpdateRedDot(self.curCharId)
|
||||
self.bLevelChanged = false
|
||||
self.ClickedRecordInfoTog = true
|
||||
end
|
||||
self.nCurTog = nIndex
|
||||
self:SwitchTog()
|
||||
end
|
||||
function CharacterRecordCtrl:OnEvent_OpenStoryPanel(id)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharacterStory, self.curCharId, id)
|
||||
end
|
||||
function CharacterRecordCtrl:OnEvent_AffinityChange(charId, curLevel, lastFavourLevel)
|
||||
if lastFavourLevel < curLevel then
|
||||
self.InitState = {}
|
||||
self:OnRefreshPanel()
|
||||
self.ClickedRecordInfoTog = false
|
||||
self.ClickedVoiceTog = false
|
||||
self.bLevelChanged = true
|
||||
end
|
||||
end
|
||||
function CharacterRecordCtrl:OnEvent_WWiseVoiceEnd()
|
||||
if not self.bActivePause and self.curPlayingId ~= 0 and self.tbVoicePlayingObj[self.curPlayingId] ~= nil then
|
||||
local imgPlay = self.tbVoicePlayingObj[self.curPlayingId].transform:Find("AnimRoot/imgPlay")
|
||||
local imgPlaying = self.tbVoicePlayingObj[self.curPlayingId].transform:Find("AnimRoot/imgPlaying")
|
||||
imgPlay.gameObject:SetActive(true)
|
||||
imgPlaying.gameObject:SetActive(false)
|
||||
self.curPlayingId = 0
|
||||
end
|
||||
self.bActivePause = false
|
||||
end
|
||||
function CharacterRecordCtrl:OnEvent_PanelAdvance(nClosePanelId, nOpenPanelId)
|
||||
if nOpenPanelId ~= PanelId.CharacterRelation then
|
||||
self.nCurTog = nil
|
||||
end
|
||||
end
|
||||
return CharacterRecordCtrl
|
||||
@@ -0,0 +1,74 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local CharacterStoryCtrl = class("CharacterStoryCtrl", BaseCtrl)
|
||||
CharacterStoryCtrl._mapNodeConfig = {
|
||||
goCharacterStory = {
|
||||
sNodeName = "CharacterStory",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
got_fullscreen_story = {
|
||||
sNodeName = "t_fullscreen_story",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
btnsnapshot_story = {
|
||||
sNodeName = "snapshot_story",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickCloseStory"
|
||||
},
|
||||
txtStory = {sNodeName = "txtStory", sComponentName = "TMP_Text"},
|
||||
btn_CloseStory = {
|
||||
sNodeName = "btn_CloseStory",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickCloseStory"
|
||||
},
|
||||
txtBtnCloseStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Confirm"
|
||||
},
|
||||
txtStoryName = {
|
||||
sNodeName = "txtStoryName",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
btnReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
animWindow = {sNodeName = "goWindow", sComponentName = "Animator"}
|
||||
}
|
||||
CharacterStoryCtrl._mapEventConfig = {}
|
||||
function CharacterStoryCtrl:Awake()
|
||||
end
|
||||
function CharacterStoryCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nCharId = tbParam[1]
|
||||
self.nArchiveId = tbParam[2]
|
||||
local data = ConfigTable.GetData("CharacterArchiveContent", self.nArchiveId)
|
||||
if data ~= nil then
|
||||
local bUpdate = PlayerData.Char:CheckCharArchiveContentUpdate(self.nCharId, self.nArchiveId)
|
||||
local sContent = bUpdate and data.UpdateContent1 or data.Content
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStory, ProcAvgTextContent(sContent, GetLanguageIndex(Settings.sCurrentTxtLanguage)))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStoryName, data.Title)
|
||||
local bReceived = PlayerData.Char:CheckCharArchiveReward(self.nCharId, self.nArchiveId)
|
||||
self._mapNode.btnReward.gameObject:SetActive(not bReceived)
|
||||
end
|
||||
self._mapNode.got_fullscreen_story:SetActive(true)
|
||||
self._mapNode.goCharacterStory:SetActive(true)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function CharacterStoryCtrl:OnPanelClose()
|
||||
self._mapNode.goCharacterStory:SetActive(false)
|
||||
self._mapNode.got_fullscreen_story:SetActive(false)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.CharacterStory)
|
||||
end
|
||||
function CharacterStoryCtrl:OnBtn_ClickCloseStory()
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, "OnPanelClose", true, true, true)
|
||||
end
|
||||
function CharacterStoryCtrl:OnBtnClick_Reward()
|
||||
local callbackFunc = function()
|
||||
self._mapNode.btnReward.gameObject:SetActive(false)
|
||||
end
|
||||
PlayerData.Char:SendCharArchiveRewardReceive(self.nCharId, self.nArchiveId, callbackFunc)
|
||||
end
|
||||
return CharacterStoryCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local CharacterStoryPanel = class("CharacterStoryPanel", BasePanel)
|
||||
CharacterStoryPanel._bIsMainPanel = false
|
||||
CharacterStoryPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "CharacterInfoEx/CharacterStoryPanel.prefab",
|
||||
sCtrlName = "Game.UI.CharacterRecord.CharacterStoryCtrl"
|
||||
}
|
||||
}
|
||||
function CharacterStoryPanel:Awake()
|
||||
end
|
||||
function CharacterStoryPanel:OnEnable()
|
||||
end
|
||||
function CharacterStoryPanel:OnDisable()
|
||||
end
|
||||
function CharacterStoryPanel:OnDestroy()
|
||||
end
|
||||
function CharacterStoryPanel:OnRelease()
|
||||
end
|
||||
return CharacterStoryPanel
|
||||
@@ -0,0 +1,114 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local CharPlotCtrl = class("CharPlotCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
CharPlotCtrl._mapNodeConfig = {
|
||||
got_fullscreen_blur_blue = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "CharPlot_Title"
|
||||
},
|
||||
txtTitleAvgReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "CharPlot_BaseInfo"
|
||||
},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_CloseAvgRoot"
|
||||
},
|
||||
goMainLineAvgRoot = {
|
||||
sNodeName = "goMainLineAvgRoot",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
anit_window_01 = {
|
||||
sNodeName = "t_window_01",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgAVGLevelIcon = {
|
||||
sNodeName = "imgAVGLevelIcon",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
btnClose = {
|
||||
sNodeName = "btnClose",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseAvgRoot"
|
||||
},
|
||||
btnCancel = {
|
||||
sNodeName = "btnCancel",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseAvgRoot"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "CharPlot_Cancel"
|
||||
},
|
||||
mainLineAvgBtn = {
|
||||
sNodeName = "mainLineAvgBtn",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_EnterPlot"
|
||||
},
|
||||
mainLineAvgBtnTex = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "CharPlot_Goto"
|
||||
},
|
||||
avgItemBtn1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
tcAvgItem1 = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
txtmainLineAvgLvName = {
|
||||
sNodeName = "mainLineAvgLvName",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtmainLineAvgLvDes = {
|
||||
sNodeName = "mainLineAvgLvDes",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtmainLineAvgLvNum = {
|
||||
sNodeName = "mainLineAvgLvNum",
|
||||
sComponentName = "TMP_Text"
|
||||
}
|
||||
}
|
||||
CharPlotCtrl._mapEventConfig = {}
|
||||
function CharPlotCtrl:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.plotData = tbParam[1]
|
||||
self.tbReward = tbParam[2]
|
||||
self.curSelectIndex = tbParam[3]
|
||||
end
|
||||
function CharPlotCtrl:OnEnable()
|
||||
self._mapNode.got_fullscreen_blur_blue:SetActive(true)
|
||||
self._mapNode.goMainLineAvgRoot:SetActive(true)
|
||||
self._mapNode.anit_window_01:Play("t_window_04_t_in")
|
||||
local data = self.plotData
|
||||
local rewardData = self.tbReward[self.curSelectIndex]
|
||||
NovaAPI.SetTMPText(self._mapNode.txtmainLineAvgLvName, data.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtmainLineAvgLvDes, data.Desc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtmainLineAvgLvNum, orderedFormat(ConfigTable.GetUIText("Plot_Index"), self.curSelectIndex))
|
||||
self:SetPngSprite(self._mapNode.imgAVGLevelIcon, data.PicSource)
|
||||
self._mapNode.tcAvgItem1:SetItem(rewardData.nId, nil, nil, nil, rewardData.bReceive, not rewardData.bReceive)
|
||||
end
|
||||
function CharPlotCtrl:OnDisable()
|
||||
end
|
||||
function CharPlotCtrl:OnBtnClick_CloseAvgRoot()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.CharPlot)
|
||||
end
|
||||
function CharPlotCtrl:OnBtnClick_EnterPlot()
|
||||
self._mapNode.goMainLineAvgRoot:SetActive(false)
|
||||
self._mapNode.got_fullscreen_blur_blue:SetActive(false)
|
||||
self:AddTimer(0, 1, function()
|
||||
EventManager.Hit("Enter_CharPlot")
|
||||
end)
|
||||
end
|
||||
function CharPlotCtrl:OnBtnClick_Reward(btn)
|
||||
if self.tbReward ~= nil then
|
||||
local nTid = self.tbReward[self.curSelectIndex].nId
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.transform, false, true, false)
|
||||
end
|
||||
end
|
||||
return CharPlotCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local CharPlotPanel = class("CharPlotPanel", BasePanel)
|
||||
CharPlotPanel._bIsMainPanel = false
|
||||
CharPlotPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "CharacterInfoEx/CharPlotPanel.prefab",
|
||||
sCtrlName = "Game.UI.CharacterRecord.CharPlotCtrl"
|
||||
}
|
||||
}
|
||||
function CharPlotPanel:Awake()
|
||||
end
|
||||
function CharPlotPanel:OnEnable()
|
||||
end
|
||||
function CharPlotPanel:OnDisable()
|
||||
end
|
||||
function CharPlotPanel:OnDestroy()
|
||||
end
|
||||
function CharPlotPanel:OnRelease()
|
||||
end
|
||||
return CharPlotPanel
|
||||
@@ -0,0 +1,167 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local CharRecordInfoItemCtrl = class("CharRecordInfoItemCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
CharRecordInfoItemCtrl._mapNodeConfig = {
|
||||
goInfoRoot = {
|
||||
sNodeName = "InfoRoot",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "CharacterRelation_Base_Info"
|
||||
},
|
||||
goNormalRoot = {sNodeName = "NormalRoot", sComponentName = "GameObject"},
|
||||
goLockNormal = {sNodeName = "LockNormal", sComponentName = "GameObject"},
|
||||
goSpecialRoot = {
|
||||
sNodeName = "SpecialRoot",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
transInfoContent = {
|
||||
nCount = 8,
|
||||
sNodeName = "infoContentGrid",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
transInfoContentRoot = {
|
||||
sNodeName = "infoContent",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtTittle = {sNodeName = "txtTittle", sComponentName = "TMP_Text"},
|
||||
txtContent = {sNodeName = "txtContent", sComponentName = "TMP_Text"},
|
||||
txtLockTitle = {
|
||||
sNodeName = "txtLockTitle",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtLockCondition = {
|
||||
sNodeName = "txtLockCondition",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
goSpecialUnlockRoot = {
|
||||
sNodeName = "SpecialUnlockRoot",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
goSpecialLockRoot = {
|
||||
sNodeName = "SpecialLockRoot",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
imgContent = {sNodeName = "imgContent", sComponentName = "Image"},
|
||||
imgBgForce = {sNodeName = "imgBgForce", sComponentName = "Image"},
|
||||
txtSpecialTittle = {
|
||||
sNodeName = "txtSpecialTittle",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
btnStory = {sNodeName = "btnStory", sComponentName = "UIButton"},
|
||||
txtBtnStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Relation_Story_Detail"
|
||||
},
|
||||
txtSpecialCondition = {
|
||||
sNodeName = "txtSpecialCondition",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
RedDot = {},
|
||||
imgLineVertical = {},
|
||||
imgLineHorizontal = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
CharRecordInfoItemCtrl._mapEventConfig = {}
|
||||
local nInfoContentMaxWidth = 860
|
||||
function CharRecordInfoItemCtrl:Awake()
|
||||
end
|
||||
function CharRecordInfoItemCtrl:OnEnable()
|
||||
end
|
||||
function CharRecordInfoItemCtrl:RefreshGrid(data, baseData)
|
||||
self.curFavourLevel = PlayerData.Char:GetCharAffinityData(data.CharacterId).Level
|
||||
self._mapNode.goInfoRoot.gameObject:SetActive(data.ArchType == GameEnum.ArchType.BaseType)
|
||||
self._mapNode.goNormalRoot:SetActive(data.ArchType == GameEnum.ArchType.NormalType and self.curFavourLevel >= data.UnlockAffinityLevel)
|
||||
self._mapNode.goLockNormal:SetActive(data.ArchType == GameEnum.ArchType.NormalType and self.curFavourLevel < data.UnlockAffinityLevel)
|
||||
self._mapNode.goSpecialRoot:SetActive(data.ArchType == GameEnum.ArchType.SpecialType)
|
||||
self.bgImage = self.gameObject:GetComponent("Image")
|
||||
local color = NovaAPI.GetImageColor(self.bgImage)
|
||||
color.a = self.curFavourLevel >= data.UnlockAffinityLevel and 1 or 0.8
|
||||
NovaAPI.SetImageColor(self.bgImage, color)
|
||||
self._mapNode.imgLineHorizontal.gameObject:SetActive(self.curFavourLevel >= data.UnlockAffinityLevel)
|
||||
self._mapNode.imgLineVertical.gameObject:SetActive(self.curFavourLevel >= data.UnlockAffinityLevel)
|
||||
if data.ArchType == GameEnum.ArchType.BaseType then
|
||||
self:RefreshRecordInfo(baseData)
|
||||
local mapCharDes = ConfigTable.GetData("CharacterDes", data.CharacterId)
|
||||
if not mapCharDes then
|
||||
return
|
||||
end
|
||||
local mapForceCfg = ConfigTable.GetData("Force", mapCharDes.Force)
|
||||
if not mapForceCfg then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgBgForce, mapForceCfg.Icon1)
|
||||
elseif data.ArchType == GameEnum.ArchType.NormalType then
|
||||
self:RefreshNormalInfo(data)
|
||||
else
|
||||
self:RefreshSpecialInfo(data)
|
||||
end
|
||||
self:AddTimer(1, 0.1, function()
|
||||
local sizeDelta = self.gameObject:GetComponent("RectTransform").sizeDelta
|
||||
self._mapNode.imgLineHorizontal.sizeDelta = Vector2(sizeDelta.y, sizeDelta.x)
|
||||
end, true, true, true)
|
||||
end
|
||||
function CharRecordInfoItemCtrl:RefreshRecordInfo(baseData)
|
||||
table.sort(baseData, function(a, b)
|
||||
return a.Sort < b.Sort
|
||||
end)
|
||||
for i = 1, #self._mapNode.transInfoContent do
|
||||
local content = self._mapNode.transInfoContent[i]
|
||||
if baseData[i] ~= nil then
|
||||
local title = content:Find("txtInfoTitle"):GetComponent("TMP_Text")
|
||||
local rtTitle = content:Find("txtInfoTitle"):GetComponent("RectTransform")
|
||||
local titleContent = content:Find("txtInfoContent"):GetComponent("TMP_Text")
|
||||
local leContent = content:Find("txtInfoContent"):GetComponent("LayoutElement")
|
||||
local forceImgRoot = content:Find("imgForceRoot")
|
||||
NovaAPI.SetTMPText(title, baseData[i].Title)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(content)
|
||||
local nWidth = rtTitle.rect.width
|
||||
NovaAPI.SetLayoutElementPreferredWidth(leContent, nInfoContentMaxWidth - nWidth - 10)
|
||||
local bUpdate = PlayerData.Char:CheckCharArchiveBaseContentUpdate(baseData[i].CharacterId, baseData[i].Id)
|
||||
local sContent = bUpdate and baseData[i].UpdateContent1 or baseData[i].Content
|
||||
NovaAPI.SetTMPText(titleContent, sContent, GetLanguageIndex(Settings.sCurrentTxtLanguage))
|
||||
forceImgRoot.gameObject:SetActive(false)
|
||||
end
|
||||
content.gameObject:SetActive(i <= #baseData)
|
||||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self.gameObject.transform)
|
||||
end
|
||||
function CharRecordInfoItemCtrl:RefreshNormalInfo(data)
|
||||
if self.curFavourLevel < data.UnlockAffinityLevel then
|
||||
local contentData = ConfigTable.GetData("CharacterArchiveContent", data.RecordId)
|
||||
if contentData ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLockTitle, contentData.Title)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLockCondition, orderedFormat(ConfigTable.GetUIText("Affinity_UnLock_Level"), data.UnlockAffinityLevel))
|
||||
else
|
||||
local contentData = ConfigTable.GetData("CharacterArchiveContent", data.RecordId)
|
||||
if contentData ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTittle, contentData.Title)
|
||||
local bUpdate = PlayerData.Char:CheckCharArchiveContentUpdate(data.CharacterId, data.RecordId)
|
||||
local sContent = bUpdate and contentData.UpdateContent1 or contentData.Content
|
||||
NovaAPI.SetTMPText(self._mapNode.txtContent, ProcAvgTextContent(sContent, GetLanguageIndex(Settings.sCurrentTxtLanguage)))
|
||||
end
|
||||
self._mapNode.imgContent.gameObject:SetActive(false)
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.txtContent.transform)
|
||||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.goNormalRoot.transform)
|
||||
end
|
||||
function CharRecordInfoItemCtrl:RefreshSpecialInfo(data)
|
||||
self._mapNode.goSpecialLockRoot:SetActive(data.UnlockAffinityLevel > self.curFavourLevel)
|
||||
self._mapNode.goSpecialUnlockRoot:SetActive(data.UnlockAffinityLevel <= self.curFavourLevel)
|
||||
if data.UnlockAffinityLevel > self.curFavourLevel then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSpecialCondition, orderedFormat(ConfigTable.GetUIText("Affinity_UnLock_Level"), data.UnlockAffinityLevel))
|
||||
else
|
||||
local contentData = ConfigTable.GetData("CharacterArchiveContent", data.RecordId)
|
||||
if contentData ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtSpecialTittle, contentData.Title)
|
||||
self._mapNode.btnStory.onClick:RemoveAllListeners()
|
||||
self._mapNode.btnStory.onClick:AddListener(function()
|
||||
EventManager.Hit(EventId.LookUpCharStory, contentData.Id)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
return CharRecordInfoItemCtrl
|
||||
Reference in New Issue
Block a user