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,498 @@
local CharacterSkinCtrl = class("CharacterSkinCtrl", BaseCtrl)
local PlayerCharData = PlayerData.Char
local PlayerCharSkinData = PlayerData.CharSkin
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local tableInsert = table.insert
local GameCameraStackManager = CS.GameCameraStackManager
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResType = GameResourceLoader.ResType
local Animator = CS.UnityEngine.Animator
local typeof = typeof
CharacterSkinCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
rawImgActor2D = {
sNodeName = "----Actor2D----",
sComponentName = "RawImage"
},
rtRawImgActor2D = {
sNodeName = "----Actor2D----",
sComponentName = "RectTransform"
},
eventSkinDrag = {
sNodeName = "btnSkin",
sComponentName = "UIDrag",
callback = "OnUIDrag_Drag"
},
eventSkinZoom = {
sNodeName = "btnSkin",
sComponentName = "UIZoom",
callback = "OnUIZoom_Skin"
},
btnSkin = {
sComponentName = "Button",
callback = "OnBtnClick_Skin"
},
goSkinDesc = {},
txtSkinDesc = {sComponentName = "TMP_Text"},
goTheme = {},
imgTheme = {sComponentName = "Image"},
txtTheme = {sComponentName = "TMP_Text"},
goPreview = {},
btnFullScene = {
sComponentName = "UIButton",
callback = "OnBtnClick_FullScene"
},
btnSwitchModel = {
sComponentName = "UIButton",
callback = "OnBtnClick_SwitchModel"
},
goPortrait = {},
go3D = {},
sv = {
sComponentName = "LoopScrollView"
},
trSv = {sNodeName = "sv", sComponentName = "Transform"},
txtSkinName = {sComponentName = "TMP_Text"},
btnGotoBuy = {
sComponentName = "UIButton",
callback = "OnBtnClick_GotoBuy"
},
txtBtnGotoBuy = {
sComponentName = "TMP_Text",
sLanguageId = "CharacterSkin_GotoBuy"
},
btnUseSkin = {
sComponentName = "UIButton",
callback = "OnBtnClick_UseSkin"
},
imgEquipped = {},
txtSkinEquipped = {
sComponentName = "TMP_Text",
sLanguageId = "Skin_Equipped"
},
txtBtnUseSkin = {
sComponentName = "TMP_Text",
sLanguageId = "CharacterSkin_Use_Skin"
},
btnSwitchHalf = {
sComponentName = "UIButton",
callback = "OnBtnClick_SwitchHalf"
},
txtPortrait = {
sComponentName = "TMP_Text",
sLanguageId = "CharacterSkin_Portrait"
},
txt3D = {
sComponentName = "TMP_Text",
sLanguageId = "CharacterSkin_3D"
},
goLeft = {sNodeName = "---Left---"},
goRight = {
sNodeName = "---Right---"
},
canvasGroupRight = {
sNodeName = "---Right---",
sComponentName = "CanvasGroup"
},
UIParallax3DStage = {
sComponentName = "UIParallaxStageCameraController"
},
aniSafeAreaRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "Animator"
},
aniArrow = {sNodeName = "goArrow", sComponentName = "Animator"},
topBarAnim = {sNodeName = "goBack", sComponentName = "Animator"}
}
CharacterSkinCtrl._mapEventConfig = {
[EventId.UIBackConfirm] = "OnBtnClick_Back",
[EventId.UIHomeConfirm] = "OnBtnClick_Home"
}
local show_mode_2d = 1
local show_mode_3d = 2
function CharacterSkinCtrl:SortSkinList()
self.tbSortSkinList = {}
for _, v in pairs(self.tbSkinList) do
if true == v:CheckSkinShow() or true == v:CheckUnlock() then
tableInsert(self.tbSortSkinList, v)
end
end
table.sort(self.tbSortSkinList, function(a, b)
return a:GetId() < b:GetId()
end)
end
function CharacterSkinCtrl:RefreshSelectSkinInfo()
local skinData = self.tbSortSkinList[self.nSelectIndex]
if nil == skinData then
return
end
local usingSkinId = PlayerCharData:GetCharUsedSkinId(self.nCharId)
local skinCfg = skinData:GetCfgData()
self.nSkinId = skinData:GetId()
self._mapNode.goSkinDesc:SetActive(skinCfg.Desc ~= "")
NovaAPI.SetTMPText(self._mapNode.txtSkinDesc, skinCfg.Desc)
NovaAPI.SetTMPText(self._mapNode.txtSkinName, skinCfg.Name)
self._mapNode.btnUseSkin.gameObject:SetActive(self.nSkinId ~= usingSkinId and skinData:CheckUnlock())
local bEquipped = self.nSkinId == usingSkinId and skinData:CheckUnlock()
local bNotHave = not skinData:CheckUnlock() and self.nSkinId ~= usingSkinId and skinCfg.SourceDesc ~= nil
self._mapNode.imgEquipped.gameObject:SetActive(bEquipped or bNotHave)
if bNotHave then
local sText = AllEnum.CharSkinSource[skinCfg.SourceDesc]
if sText ~= nil then
NovaAPI.SetTMPText(self._mapNode.txtSkinEquipped, ConfigTable.GetUIText(sText))
else
self._mapNode.imgEquipped.gameObject:SetActive(false)
end
else
NovaAPI.SetTMPText(self._mapNode.txtSkinEquipped, ConfigTable.GetUIText("Skin_Equipped"))
end
self._mapNode.goTheme.gameObject:SetActive(skinCfg.SkinTheme ~= 0)
if skinCfg.SkinTheme ~= 0 then
local themeCfg = ConfigTable.GetData("CharacterSkinTheme", skinCfg.SkinTheme)
if nil ~= themeCfg then
self:SetPngSprite(self._mapNode.imgTheme, themeCfg.Icon)
NovaAPI.SetTMPText(self._mapNode.txtTheme, themeCfg.Name)
end
end
if self.nShowMode == show_mode_2d then
self:RefreshActor2D()
elseif self.nShowMode == show_mode_3d then
self:LoadCharacter()
end
end
function CharacterSkinCtrl:RefreshActor2D()
Actor2DManager.SetActor2D(self:GetPanelId(), self._mapNode.rawImgActor2D, self.nCharId, self.nSkinId)
end
function CharacterSkinCtrl:RefreshPreviewMode(bPreview)
self.bPreview = bPreview
self._mapNode.goPreview.gameObject:SetActive(true)
self._mapNode.btnSkin.gameObject:SetActive(bPreview)
self._mapNode.eventSkinZoom:SetZoomLock(not bPreview)
if not bPreview then
self:RefreshSelectSkinInfo()
if self.nShowMode == show_mode_3d then
self._mapNode.aniArrow:Play("CharacterSkin_3D_Out")
self.curShowModel.transform.localEulerAngles = Vector3(0, 180, 0)
end
self._mapNode.aniSafeAreaRoot:Play("CharacterSkin_preview_in")
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroupRight, true)
Actor2DManager.ResetActor2DDragOffset(self.v3Offset)
else
if self.bUseFull then
self:OnBtnClick_SwitchHalf()
self:AddTimer(1, 0.7, function()
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroupRight, false)
self.v3Offset = Actor2DManager.SwitchActor2DDragOffset()
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 0.7)
else
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroupRight, false)
self.v3Offset = Actor2DManager.SwitchActor2DDragOffset()
if self.nShowMode == show_mode_3d and self.bDragValid then
self._mapNode.aniArrow:Play("CharacterSkin_3D_In")
end
end
self._mapNode.aniSafeAreaRoot:Play("CharacterSkin_preview_out")
end
end
function CharacterSkinCtrl:RefreshFullScene(bFullScene)
self._mapNode.goPreview.gameObject:SetActive(not bFullScene)
self._mapNode.TopBar.gameObject:SetActive(not bFullScene)
if not bFullScene and self.timerFullScene == nil then
self.timerFullScene = self:AddTimer(1, 5, function()
self._mapNode.TopBar.gameObject:SetActive(false)
self.timerFullScene = nil
end, true, true, true)
end
end
function CharacterSkinCtrl:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local nInstanceId = goGrid:GetInstanceID()
if not self.tbGridCtrl[nInstanceId] then
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.TemplateEx.TemplateSkinCtrl")
end
self.tbGridCtrl[nInstanceId]:SetSkinData(self.tbSortSkinList[nIndex])
if self.nSelectIndex == nil then
local usingSkinId = PlayerCharData:GetCharUsedSkinId(self.nCharId)
if usingSkinId == self.tbSortSkinList[nIndex]:GetId() then
self.nSelectIndex = nIndex
end
end
if nIndex == self.nSelectIndex then
self.tbGridCtrl[nInstanceId]:SetSelect(true)
end
end
function CharacterSkinCtrl:OnGridBtnClick(goGrid, gridIndex)
local nIndex = gridIndex + 1
local nInstanceId = goGrid:GetInstanceID()
local goSelect = self._mapNode.trSv:Find("Viewport/Content/" .. self.nSelectIndex - 1)
if goSelect then
self.tbGridCtrl[goSelect.gameObject:GetInstanceID()]:SetSelect(false)
end
self.tbGridCtrl[nInstanceId]:SetSelect(true)
self._mapNode.sv:SetScrollGridPos(nIndex - 1, 0.1, 0)
self.nSelectIndex = nIndex
self:RefreshSelectSkinInfo()
end
function CharacterSkinCtrl:LoadCharacter()
if self.nShowModelSkinId == self.nSkinId then
return
end
self.nShowModelSkinId = self.nSkinId
local bNeedLoad = true
for skinId, v in pairs(self.tbModelList) do
if skinId == self.nSkinId then
bNeedLoad = false
v.gameObject:SetActive(true)
v.transform.localEulerAngles = Vector3(0, 180, 0)
self.nModelDragRot = v.transform.localEulerAngles.y
self.curShowModel = v
self:WaitReadyClipFinish()
else
v.gameObject:SetActive(false)
end
end
if bNeedLoad then
local mapSkin = ConfigTable.GetData_CharacterSkin(self.nSkinId)
local sFullPath = string.format("%s.prefab", mapSkin.Model_Show)
local LoadModelCallback = function(obj)
local idx = 1
NovaAPI.UnbindUIParallaxStageCameraControllerModel(self._mapNode.UIParallax3DStage, idx - 1)
local go = instantiate(obj, self.rtSceneOriginPos)
self.tbModelList[self.nSkinId] = go
self.curShowModel = go
self:WaitReadyClipFinish()
NovaAPI.BindUIParallaxStageCameraControllerModel(self._mapNode.UIParallax3DStage, idx - 1, go)
if self.rtSceneOriginPos ~= nil then
go.transform.position = self.rtSceneOriginPos.position
go.transform.localEulerAngles = Vector3(0, 180, 0)
self.nModelDragRot = go.transform.localEulerAngles.y
go.transform.localScale = Vector3.zero
local animator = go:GetComponent(typeof(Animator))
if animator ~= nil and animator:IsNull() == false then
animator:SetBool("standby", true)
end
GameUIUtils.SetCustomModelMaterialVariant(go, CS.CustomModelMaterialVariantComponent.VariantNames.FormationView)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
go.transform.localScale = Vector3.one * (mapSkin.ModelShowScale / 10000)
end
cs_coroutine.start(wait)
end
EventManager.Hit(EventId.BlockInput, false)
end
self:LoadAssetAsync(sFullPath, typeof(GameObject), LoadModelCallback)
EventManager.Hit(EventId.BlockInput, true)
end
end
function CharacterSkinCtrl:WaitReadyClipFinish()
if self.waitReadyClipCor ~= nil then
cs_coroutine.stop(self.waitReadyClipCor)
end
if self.curShowModel == nil then
return
end
local director = self.curShowModel:GetComponent("PlayableDirector")
if director == nil then
return
end
local readyClipName = self.nCharId .. "_Ready"
local wait = function()
while CS.AdventureModuleHelper.CheckTimelineClipFinish(director, readyClipName) == false do
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
end
self.bDragValid = true
if self.bPreview and self.nShowMode == show_mode_3d then
self._mapNode.aniArrow:Play("CharacterSkin_3D_In")
end
end
self.bDragValid = false
self.waitReadyClipCor = cs_coroutine.start(wait)
end
function CharacterSkinCtrl:DestroyCharacter()
local sSceneName = ConfigTable.GetConfigValue("CharacterSkin_Scene")
local callback = function()
end
CS.MainMenuModuleHelper.DeActiveScene(sSceneName, callback)
NovaAPI.UnbindUIParallaxStageCameraControllerModel(self._mapNode.UIParallax3DStage, 1)
for _, v in pairs(self.tbModelList) do
destroy(v)
end
self.tbModelList = {}
self.curShowModel = nil
self.nModelDragRot = 0
if nil ~= self.goSelectRolePrefab then
destroy(self.goSelectRolePrefab)
end
self.goSelectRolePrefab = nil
end
function CharacterSkinCtrl:Awake()
self.canvas = self.gameObject:GetComponent("Canvas")
self.gameObject:SetActive(false)
local param = self:GetPanelParam()
if type(param) == "table" then
self.nCharId = param[1]
end
self.tbGridCtrl = {}
self.nSelectIndex = nil
self.nShowModelSkinId = 0
self.tbModelList = {}
self.curShowModel = nil
self.nModelDragRot = 0
self.v3Offset = Vector3.zero
self.nShowMode = show_mode_2d
self.tbZoomRange = ConfigTable.GetConfigArray("SkinZoomRange")
self.bUseFull = false
end
function CharacterSkinCtrl:OnEnable()
self.bPreview = false
self.bStartDrag = false
self.bDragValid = true
self.tbSkinList = PlayerCharSkinData:GetSkinListByCharacterId(self.nCharId)
self:SortSkinList()
self._mapNode.eventSkinZoom:SetZoomLock(true)
self._mapNode.eventSkinZoom:SetZoomLimitValue(tonumber(self.tbZoomRange[1]), tonumber(self.tbZoomRange[2]))
for insId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[insId] = nil
end
self._mapNode.sv:Init(#self.tbSortSkinList, self, self.OnGridRefresh, self.OnGridBtnClick)
self._mapNode.sv:SetScrollGridPos(self.nSelectIndex - 1, 0)
self._mapNode.goPreview.gameObject:SetActive(true)
self._mapNode.btnSkin.gameObject:SetActive(false)
self._mapNode.go3D.gameObject:SetActive(self.nShowMode == show_mode_3d)
self._mapNode.goPortrait.gameObject:SetActive(self.nShowMode == show_mode_2d)
local sSceneName = ConfigTable.GetConfigValue("CharacterSkin_Scene")
NovaAPI.SetComponentEnable(self.canvas, false)
local callback = function(bSuccess)
NovaAPI.SetComponentEnable(self.canvas, true)
if bSuccess == true then
local sceneRoot = CS.MainMenuModuleHelper.GetMainMenuSceneRoot(sSceneName)
self.rtSceneOriginPos = sceneRoot.transform:Find("==== Scene ====")
self.goSelectRolePrefab = self:CreatePrefabInstance("UI/CharacterSkin/CharSkin3DShowPrefab.prefab", self.rtSceneOriginPos)
local goSelectRoleCam = self.goSelectRolePrefab.transform:Find("Camera"):GetComponent("Camera")
NovaAPI.SetupUIParallaxStageCameraControllerForModelView(self._mapNode.UIParallax3DStage, goSelectRoleCam)
else
self._mapNode.UIParallax3DStage.gameObject:SetActive(false)
end
self.gameObject:SetActive(true)
self:RefreshSelectSkinInfo()
EventManager.Hit(EventId.SetTransition)
end
CS.MainMenuModuleHelper.GetActiveScene(sSceneName, callback)
end
function CharacterSkinCtrl:OnDisable()
self.tbSkinList = nil
self.tbSortSkinList = nil
for insId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[insId] = nil
end
self.tbGridCtrl = {}
self.bStartDrag = nil
self.bDragValid = nil
if self.waitReadyClipCor ~= nil then
cs_coroutine.stop(self.waitReadyClipCor)
end
Actor2DManager.UnsetActor2D()
self:DestroyCharacter()
end
function CharacterSkinCtrl:OnDestroy()
end
function CharacterSkinCtrl:OnBtnClick_FullScene()
self:RefreshPreviewMode(true)
self:RefreshFullScene(true)
end
function CharacterSkinCtrl:OnBtnClick_SwitchModel()
self.nShowMode = self.nShowMode == show_mode_2d and show_mode_3d or show_mode_2d
self._mapNode.btnSwitchHalf.gameObject:SetActive(self.nShowMode == show_mode_2d)
self._mapNode.go3D.gameObject:SetActive(self.nShowMode == show_mode_3d)
self._mapNode.goPortrait.gameObject:SetActive(self.nShowMode == show_mode_2d)
if self.nShowMode == show_mode_2d then
local tweener = NovaAPI.DoRawImageColor(self._mapNode.rawImgActor2D, Color(1, 1, 1, 1), 0.5)
tweener:SetUpdate(true)
self._mapNode.rtRawImgActor2D:DOScale(1, 0.5):SetUpdate(true)
elseif self.nShowMode == show_mode_3d then
local tweener = NovaAPI.DoRawImageColor(self._mapNode.rawImgActor2D, Color(1, 1, 1, 0), 0.5)
tweener:SetUpdate(true)
self._mapNode.rtRawImgActor2D:DOScale(1.5, 0.5):SetUpdate(true)
end
self:RefreshSelectSkinInfo()
end
function CharacterSkinCtrl:OnBtnClick_SkinPreview()
self:RefreshPreviewMode(true)
end
function CharacterSkinCtrl:OnBtnClick_Skin()
if not self.bStartDrag then
self:RefreshFullScene(false)
end
end
function CharacterSkinCtrl:OnBtnClick_GotoBuy()
end
function CharacterSkinCtrl:OnBtnClick_UseSkin()
local func_callback = function()
PlayerData.Char:SetCharSkinId(self.nCharId, self.nSkinId)
self:RefreshSelectSkinInfo()
end
local msgSend = {}
msgSend.CharId = self.nCharId
msgSend.SkinId = self.nSkinId
HttpNetHandler.SendMsg(NetMsgId.Id.char_skin_set_req, msgSend, nil, func_callback)
end
function CharacterSkinCtrl:OnBtnClick_Back(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
if self.bPreview then
self:RefreshPreviewMode(false)
if self.timerFullScene ~= nil then
self.timerFullScene:Cancel()
self.timerFullScene = nil
end
else
EventManager.Hit(EventId.CloesCurPanel)
end
end
function CharacterSkinCtrl:OnBtnClick_Home(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
PanelManager.Home()
end
function CharacterSkinCtrl:OnBtnClick_SwitchHalf()
self.bUseFull = not self.bUseFull
Actor2DManager.SwitchFullHalf()
end
function CharacterSkinCtrl:OnUIDrag_Drag(mDrag)
if not self.bDragValid then
return
end
if mDrag.DragEventType == AllEnum.UIDragType.DragStart then
self.bStartDrag = true
elseif mDrag.DragEventType == AllEnum.UIDragType.Drag then
if true == self.bStartDrag then
if self.nShowMode == show_mode_2d then
Actor2DManager.SyncLocalPos(mDrag.EventData.delta.x, mDrag.EventData.delta.y, nil, self._mapNode.rtRawImgActor2D)
elseif self.nShowMode == show_mode_3d and nil ~= self.curShowModel then
self.nModelDragRot = self.nModelDragRot - mDrag.EventData.delta.x * 0.5
self.curShowModel.transform.localEulerAngles = Vector3(0, self.nModelDragRot, 0)
end
end
elseif mDrag.DragEventType == AllEnum.UIDragType.DragEnd then
self.bStartDrag = false
end
end
function CharacterSkinCtrl:OnUIZoom_Skin(mZoom)
if mZoom.InZoom then
if mZoom.ZoomValue ~= 0 then
self.bDragValid = false
Actor2DManager.SyncLocalScale(mZoom.ZoomValue)
end
else
self.bDragValid = true
end
end
return CharacterSkinCtrl
@@ -0,0 +1,8 @@
local CharacterSkinPanel = class("CharacterSkinPanel", BasePanel)
CharacterSkinPanel._tbDefine = {
{
sPrefabPath = "CharacterSkin/CharacterSkinPanel.prefab",
sCtrlName = "Game.UI.CharacterSkin.CharacterSkinCtrl"
}
}
return CharacterSkinPanel
@@ -0,0 +1,476 @@
local ReceiveSpecialRewardCtrl = class("ReceiveSpecialRewardCtrl", BaseCtrl)
local GachaShowResRoot = "UI/GachaEx/Sprites_Show/"
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResTypeAny = GameResourceLoader.ResType.Any
local ResType = GameResourceLoader.ResType
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local BubbleVoiceManager = require("Game.Actor2D.BubbleVoiceManager")
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local Offset = CS.Actor2DOffsetData
local typeof = typeof
ReceiveSpecialRewardCtrl._mapNodeConfig = {
animatorRoot = {sNodeName = "GachaShow", sComponentName = "Animator"},
goCharContent = {
sNodeName = "----Char----",
sComponentName = "RectTransform"
},
BgRare = {
sComponentName = "SpriteRenderer"
},
BgRare1 = {
sComponentName = "SpriteRenderer"
},
rImgL2D = {sComponentName = "RawImage"},
OffScreen2DCamera = {
sNodeName = "OffScreen3DCamera",
sComponentName = "Camera"
},
rtSSRWord = {},
animWord = {sNodeName = "rtSSRWord", sComponentName = "Animator"},
TMP_Word1 = {sComponentName = "TMP_Text"},
TMP_Word = {sComponentName = "TMP_Text"},
goInfoContent = {
sNodeName = "----Info----"
},
animInfoContent = {
sNodeName = "----Info----",
sComponentName = "Animator"
},
btnJumpAll = {
sComponentName = "UIButton",
callback = "OnBtnClick_Jump"
},
goOutfitContent = {
sNodeName = "----Outfit----"
},
rtItemTips = {},
imgItemIcon = {sComponentName = "Image"},
TMP_ItemCount = {sComponentName = "TMP_Text"},
TMP_ItemTitle = {
sComponentName = "TMP_Text",
sLanguageId = "GachaItemTIpsTitle"
},
imgBgRare = {sComponentName = "Image"},
imgTitleRare = {sComponentName = "Image"},
imgTitleBg = {sComponentName = "Image"},
imgRareIcon = {sComponentName = "Image"},
TMP_Title = {sComponentName = "TMP_Text"},
ImgNew = {},
imgBgOutfit = {sComponentName = "Image"},
imgOutfit = {sComponentName = "Image"},
imgOutfitRare = {sComponentName = "Image"},
liveDiscCtrl = {
sNodeName = "goLiveDisc",
sCtrlName = "Game.UI.Disc.LiveDiscCtrl"
},
SSROutfitShow = {},
animSSROutfitShow = {
sNodeName = "SSROutfitShow",
sComponentName = "Animator"
},
imgBgOutfitShow = {sComponentName = "Image"},
btnSkipAnim = {
sComponentName = "UIButton",
callback = "OnBtnClick_SkipAnim"
},
imgOutfitMask = {},
goCGInfoContent = {
sNodeName = "----CGInfo----"
},
animCGInfoContent = {
sNodeName = "----CGInfo----",
sComponentName = "Animator"
},
TMP_CGTitle = {sComponentName = "TMP_Text"},
TMP_CGWord = {sComponentName = "TMP_Text"},
rtOffScreen = {
sNodeName = "Live2D_OffScreen_Renderer",
sComponentName = "Transform"
},
TMP_CGNew = {
sComponentName = "TMP_Text",
sLanguageId = "Receive_Reward_CG"
},
actor2dNode = {
sNodeName = "----Actor2D_Node----",
sComponentName = "Transform"
}
}
local mapOutfitAnimName = {
[1] = "GachaShow_Outfit_SSR",
[2] = "GachaShow_Outfit_SR",
[3] = "GachaShow_Outfit_R",
[4] = "GachaShow_Outfit_N",
[5] = "GachaShow_Outfit_N"
}
local mapOutfitAnimTime = {
[1] = 0.6,
[2] = 0.6,
[3] = 0.6,
[4] = 0.6,
[5] = 0.6
}
local cgVoiceKey = "unlockCG"
function ReceiveSpecialRewardCtrl:SetStep(nStep)
self.curStep = nStep
end
function ReceiveSpecialRewardCtrl:ShowReward()
if #self.tbRewardList == 0 then
EventManager.Hit(EventId.ClosePanel, PanelId.ReceiveSpecialReward)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
if self.callBack then
self.callBack()
end
end
cs_coroutine.start(wait)
return
end
self._mapNode.btnSkipAnim.interactable = false
local delayTime = ConfigTable.GetConfigNumber("DelaySkipSpecialRewardTime")
self:AddTimer(1, delayTime, "DelayEnableSkip", true, true, true)
local curReward = self.tbRewardList[1]
self.bCG = curReward.bCG
if self.bCG then
local charCGCfg = ConfigTable.GetData("CharacterCG", curReward.nId)
if charCGCfg == nil then
printError(string.format("读取CharacterCG配置失败!!!id = [%s]", curReward.nId))
else
self:ShowCharCG()
end
table.remove(self.tbRewardList, 1)
return
end
local itemCfg = ConfigTable.GetData_Item(curReward.nId)
self.bNew = curReward.bNew
self.bChar = itemCfg.Type == GameEnum.itemType.Char or itemCfg.Type == GameEnum.itemType.CharacterSkin
if itemCfg.Type == GameEnum.itemType.Char then
local mapCharCfgData = ConfigTable.GetData_Character(curReward.nId)
local nSkinId = mapCharCfgData.DefaultSkinId
self.nId = curReward.nId
self:ShowTitle()
self:ShowCharSkin(nSkinId, self.bNew)
elseif itemCfg.Type == GameEnum.itemType.CharacterSkin then
self.nId = curReward.nId
self:ShowTitle()
self:ShowCharSkin(curReward.nId)
PlayerData.CharSkin:RemoveSkinQueue(curReward.nId)
elseif itemCfg.Type == GameEnum.itemType.Disc then
self.nId = curReward.nId
self:ShowTitle()
self:ShowOutfit(curReward.nId)
end
self:ShowItem(curReward.tbItemList)
table.remove(self.tbRewardList, 1)
end
function ReceiveSpecialRewardCtrl:ShowCharSkin(nSkinId, bGetNew)
self:SetStep(1)
if self.goL2D ~= nil then
Actor2DManager.UnSetActor2DWithRender(self.goL2D)
self.goL2D = nil
end
self.goL2D = {}
self._mapNode.goCharContent.gameObject:SetActive(true)
self._mapNode.goOutfitContent:SetActive(false)
self._mapNode.goInfoContent:SetActive(false)
self._mapNode.goCGInfoContent:SetActive(false)
self._mapNode.btnJumpAll.gameObject:SetActive(false)
self._mapNode.btnSkipAnim.gameObject:SetActive(true)
local mapSkinData = ConfigTable.GetData_CharacterSkin(nSkinId)
self.nCharId = mapSkinData.CharId
NovaAPI.SetSpriteRendererSprite(self._mapNode.BgRare1, self:LoadPngGacha(mapSkinData.Bg))
local sPath = string.format("Actor2D/Character/%d/atlas_png/a/%d_001.png", nSkinId, nSkinId)
NovaAPI.SetSpriteRendererSprite(self._mapNode.PNG, self:LoadAsset(sPath, typeof(Sprite)))
if mapSkinData.L2D ~= nil and mapSkinData.L2D ~= "" then
local bSetSuccess, nT, nAnimLength, tbRenderer = Actor2DManager.SetActor2DWithRender(PanelId.ReceiveSpecialReward, self._mapNode.rImgL2D, self.nCharId, nSkinId, nil, self._mapNode.actor2dNode)
self.goL2D = tbRenderer
local voice = "unlockLook"
if bGetNew == true then
voice = "gachaNew"
elseif bGetNew == false then
voice = "gacha"
end
self._mapNode.rtSSRWord:SetActive(false)
if mapSkinData.Type ~= GameEnum.skinType.OTHER then
self:ShowSSRWordEnd(0, voice)
else
self:ShowSSRWordEnd(0)
end
if self.goL2D.trL2DIns ~= nil then
Actor2DManager.PlayL2DAnim(self.goL2D.trL2DIns.transform, "idle", true, false)
end
end
end
function ReceiveSpecialRewardCtrl:ShowOutfit(nOutfitTid)
self:SetStep(1)
self._mapNode.goCharContent.gameObject:SetActive(false)
self._mapNode.goOutfitContent:SetActive(true)
self._mapNode.goCGInfoContent:SetActive(false)
self._mapNode.btnSkipAnim.gameObject:SetActive(true)
self._mapNode.btnJumpAll.gameObject:SetActive(false)
local mapItemCfgData = ConfigTable.GetData_Item(nOutfitTid)
local mapOutfitCfgData = ConfigTable.GetData("Disc", nOutfitTid)
self._mapNode.imgOutfitMask:SetActive(false)
self._mapNode.liveDiscCtrl:SetDiscActive(true, mapOutfitCfgData.DiscBg ~= "")
self._mapNode.liveDiscCtrl:SetRawImage(mapOutfitCfgData.DiscBg, mapItemCfgData.Rarity)
if mapItemCfgData.Rarity == GameEnum.itemRarity.SSR then
self:SetPngSprite(self._mapNode.imgBgOutfitShow, mapOutfitCfgData.DiscBg .. AllEnum.DiscBgSurfix.Image)
end
self:SetPngSprite(self._mapNode.imgBgOutfit, mapOutfitCfgData.DiscBg .. AllEnum.DiscBgSurfix.Image)
NovaAPI.SetImageNativeSize(self._mapNode.imgBgOutfit)
self._mapNode.imgBgOutfit.gameObject:SetActive(true)
self._mapNode.goInfoContent:SetActive(false)
if mapItemCfgData.Rarity == GameEnum.itemRarity.SSR and self.bNew then
self:SetStep(2)
self._mapNode.SSROutfitShow:SetActive(true)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.animSSROutfitShow:Play("SSROutfitShow_in")
WwiseAudioMgr:PlaySound("ui_recuit_gacha_disk_SSR_glass")
end
cs_coroutine.start(wait)
self.timerStep = self:AddTimer(1, 2.7, "ShowSSRAnimEndOutfit", true, true, nil, mapItemCfgData.Rarity)
else
self:ShowSSRAnimEndOutfit(0, mapItemCfgData.Rarity)
end
end
function ReceiveSpecialRewardCtrl:ShowSSRAnimEndOutfit(_, nRarity)
self:SetStep(3)
self._mapNode.SSROutfitShow:SetActive(false)
self._mapNode.animatorRoot:Play(mapOutfitAnimName[nRarity])
self.timerStep = self:AddTimer(1, mapOutfitAnimTime[nRarity], "ShowSSRAnimEnd", true, true, nil, nil)
if nRarity == GameEnum.itemRarity.SSR then
WwiseAudioMgr:PlaySound("ui_recuit_gacha_disk_SSR_show")
elseif nRarity == GameEnum.itemRarity.SR then
WwiseAudioMgr:PlaySound("ui_recuit_gacha_disk_SR_show")
else
WwiseAudioMgr:PlaySound("ui_recuit_gacha_N")
end
end
function ReceiveSpecialRewardCtrl:ShowCharCG()
self._mapNode.goCharContent.gameObject:SetActive(true)
self._mapNode.rtSSRWord:SetActive(false)
self._mapNode.goOutfitContent:SetActive(false)
self._mapNode.goInfoContent:SetActive(false)
self._mapNode.imgBgRare.gameObject:SetActive(false)
self._mapNode.btnJumpAll.gameObject:SetActive(false)
self._mapNode.btnSkipAnim.gameObject:SetActive(true)
local curReward = self.tbRewardList[1]
local sAssetPath = ""
local mapCfg = ConfigTable.GetData("CharacterCG", curReward.nId)
if nil == mapCfg then
printError(string.format("读取CharacterCG配置失败!!!id = [%s]", curReward.nId))
else
sAssetPath = mapCfg.FullScreenL2D
end
self.nId = curReward.nId
self.bNew = curReward.bNew
if self.goL2D ~= nil then
Actor2DManager.UnSetActor2DWithRender(self.goL2D)
self.goL2D = nil
end
local bSetSuccess, nT, nAnimLength, tbRenderer = Actor2DManager.SetActor2DWithRender(PanelId.ReceiveSpecialReward, self._mapNode.rImgL2D, self.nCharId, mapCfg.Id, nil, self._mapNode.actor2dNode, AllEnum.Actor2DType.FullScreen)
if bSetSuccess then
self.goL2D = tbRenderer
end
local nDuration = 0
local nId = PlayerData.Voice:PlayCharVoice(cgVoiceKey, curReward.nCharId)
local mapVoiceCfg = ConfigTable.GetData("VoDirectory", nId)
if mapVoiceCfg ~= nil then
local dataText = BubbleVoiceManager.GetBubbleText(mapVoiceCfg.voResource)
if dataText ~= nil then
local sContent = dataText[1] .. dataText[2] .. dataText[3] .. dataText[4]
sContent = string.gsub(sContent, "==RT==", "\n")
sContent = string.gsub(sContent, "==PLAYER_NAME==", PlayerData.Base:GetPlayerNickName())
NovaAPI.SetTMPText(self._mapNode.TMP_CGWord, sContent)
end
end
if nDuration <= 0 then
if self.goL2D ~= nil and self.goL2D.trL2DIns ~= nil then
Actor2DManager.PlayL2DAnim(self.goL2D.trL2DIns.transform, "idle", true, false)
end
self:ShowCGEnd()
end
self.callBack = curReward.callBack
self:AddTimer(1, nDuration, "ShowCGEnd", true, true, true)
end
function ReceiveSpecialRewardCtrl:ShowTitle()
local mapItemCfgData = ConfigTable.GetData_Item(self.nId)
NovaAPI.SetTMPText(self._mapNode.TMP_Title, mapItemCfgData.Title)
local bgSprite = self:LoadPngGacha(GachaShowResRoot .. "bg_gacha_character_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity])
NovaAPI.SetImageSpriteAsset(self._mapNode.imgBgRare, bgSprite)
NovaAPI.SetSpriteRendererSprite(self._mapNode.BgRare, bgSprite)
NovaAPI.SetImageSpriteAsset(self._mapNode.imgRareIcon, self:LoadPngGacha(GachaShowResRoot .. "rare_character_gacha_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity]))
NovaAPI.SetImageNativeSize(self._mapNode.imgRareIcon)
self._mapNode.ImgNew:SetActive(self.bNew)
self._mapNode.TMP_Word.gameObject:SetActive(self.bChar)
if self.bChar then
NovaAPI.SetImageSpriteAsset(self._mapNode.imgTitleBg, self:LoadPngGacha(GachaShowResRoot .. "zs_gacha_name"))
NovaAPI.SetImageSpriteAsset(self._mapNode.imgTitleRare, self:LoadPngGacha(GachaShowResRoot .. "zs_gacha_name_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity]))
else
NovaAPI.SetImageSpriteAsset(self._mapNode.imgTitleBg, self:LoadPngGacha(GachaShowResRoot .. "zs_gacha_name_outfit"))
NovaAPI.SetImageSpriteAsset(self._mapNode.imgTitleRare, self:LoadPngGacha(GachaShowResRoot .. "zs_gacha_name_outfit_" .. AllEnum.FrameColor_New[mapItemCfgData.Rarity]))
end
end
function ReceiveSpecialRewardCtrl:ShowCGTitle()
local mapCGCgfData = ConfigTable.GetData("CharacterCG", self.nId)
if mapCGCgfData == nil then
printError(string.format("读取CharacterCG配置失败!!!id = [%s]", self.nId))
else
NovaAPI.SetTMPText(self._mapNode.TMP_CGTitle, mapCGCgfData.Name)
end
end
function ReceiveSpecialRewardCtrl:ShowSSRWordEnd(_, voice)
self._mapNode.rtSSRWord:SetActive(false)
if self.goL2D.trL2DIns == nil then
self:ShowSSRAnimEnd(_, voice)
return
end
self._mapNode.animatorRoot:Play("GachaShow_SR")
self.timerStep = self:AddTimer(1, 1.2, "ShowSSRAnimEnd", true, true, nil, voice)
local mapCharCfgData = ConfigTable.GetData_Character(self.nCharId)
if mapCharCfgData ~= nil then
if mapCharCfgData.Grade == GameEnum.characterGrade.SSR then
WwiseAudioMgr:PlaySound("ui_recuit_gacha_SSR_show")
else
WwiseAudioMgr:PlaySound("ui_recuit_gacha_SR_long")
end
end
end
function ReceiveSpecialRewardCtrl:ShowSSRAnimEnd(_, voice)
self:SetStep(4)
self._mapNode.TMP_Word.gameObject:SetActive(false)
if voice ~= nil then
local nId = PlayerData.Voice:PlayCharVoice(voice, self.nCharId)
local mapVoiceCfg = ConfigTable.GetData("VoDirectory", nId)
if mapVoiceCfg ~= nil then
local dataText = BubbleVoiceManager.GetBubbleText(mapVoiceCfg.voResource)
if dataText ~= nil then
self._mapNode.TMP_Word.gameObject:SetActive(true)
local sContent = dataText[1] .. dataText[2] .. dataText[3] .. dataText[4]
sContent = string.gsub(sContent, "==RT==", "\n")
sContent = string.gsub(sContent, "==PLAYER_NAME==", PlayerData.Base:GetPlayerNickName())
NovaAPI.SetTMPText(self._mapNode.TMP_Word, sContent)
NovaAPI.SetTMPText(self._mapNode.TMP_Word1, sContent)
end
end
end
self._mapNode.goInfoContent:SetActive(true)
self._mapNode.animInfoContent:Play("Info_rtTitle_in")
local animTime = NovaAPI.GetAnimClipLength(self._mapNode.animInfoContent, {
"Info_rtTitle_in"
})
if self.bNew then
self:AddTimer(1, 0.4, function()
WwiseAudioMgr:PlaySound("ui_recuit_gacha_new")
end, true, true, true)
end
self.timerStep = self:AddTimer(1, animTime, "ShowTitleAnimEnd", true, true, true)
end
function ReceiveSpecialRewardCtrl:ShowCGEnd()
self:ShowCGTitle()
self._mapNode.goInfoContent:SetActive(false)
self._mapNode.goCGInfoContent:SetActive(true)
self._mapNode.animCGInfoContent:Play("CGInfo_in", 0, 0)
self.bPlaySkipVoice = false
local animTime = NovaAPI.GetAnimClipLength(self._mapNode.animCGInfoContent, {"CGInfo_in"})
if self.bNew then
self:AddTimer(1, 0.4, function()
WwiseAudioMgr:PlaySound("ui_recuit_gacha_new")
end, true, true, true)
end
self.timerStep = self:AddTimer(1, animTime, "ShowTitleAnimEnd", true, true, true)
end
function ReceiveSpecialRewardCtrl:ShowTitleAnimEnd()
self:SetStep(5)
if self.bSkipedAnim == nil or not self.bSkipedAnim then
self.bSkipedAnim = true
end
end
function ReceiveSpecialRewardCtrl:ShowItem(tbRewardItem)
if tbRewardItem ~= nil and 0 < #tbRewardItem then
local mapRewardItemCfgData = ConfigTable.GetData_Item(tbRewardItem[1].Tid)
if mapRewardItemCfgData == nil then
printError("item ID missing" .. tbRewardItem[1].Tid)
self._mapNode.rtItemTips:SetActive(false)
else
local nRewardItemCount = tbRewardItem[1].Qty
self._mapNode.rtItemTips:SetActive(true)
self:SetPngSprite(self._mapNode.imgItemIcon, mapRewardItemCfgData.Icon)
NovaAPI.SetTMPText(self._mapNode.TMP_ItemCount, string.format("×%d", tostring(nRewardItemCount)))
end
else
self._mapNode.rtItemTips:SetActive(false)
end
end
function ReceiveSpecialRewardCtrl:DelayEnableSkip()
self._mapNode.btnSkipAnim.interactable = true
end
function ReceiveSpecialRewardCtrl:OnEnable()
self._mapNode.rtOffScreen.localScale = Vector3(1 / Settings.CANVAS_SCALE, 1 / Settings.CANVAS_SCALE, 1 / Settings.CANVAS_SCALE)
self.timerStep = nil
self.bPlaySkipVoice = true
self._mapNode.btnSkipAnim.interactable = false
local tbParam = self:GetPanelParam()
if nil == tbParam or nil == tbParam[1] then
return
end
self.tbRewardList = tbParam[1]
self.callBack = tbParam[2]
self:ShowReward()
if GamepadUIManager.GetInputState() then
GamepadUIManager.EnableGamepadUI("ReceiveSpecialRewardCtrl", self:GetGamepadUINode(), nil, true)
end
end
function ReceiveSpecialRewardCtrl:OnDisable()
self._mapNode.OffScreen2DCamera.targetTexture = nil
NovaAPI.SetTexture(self._mapNode.rImgL2D, nil)
if self.rtCharL2d ~= nil then
GameUIUtils.ReleaseRenderTexture(self.rtCharL2d)
self.rtCharL2d = nil
end
if self.goL2D ~= nil then
Actor2DManager.UnSetActor2DWithRender(self.goL2D)
self.goL2D = nil
end
if self.bCG then
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_ChooseHomePageRole")
end
EventManager.Hit("CharRefreshActor2D")
if GamepadUIManager.GetInputState() then
GamepadUIManager.DisableGamepadUI("ReceiveSpecialRewardCtrl")
end
end
function ReceiveSpecialRewardCtrl:LoadPngGacha(sPath)
return self:LoadAsset(sPath .. ".png", typeof(Sprite))
end
function ReceiveSpecialRewardCtrl:LoadOffset(sPath)
return self:LoadAsset(sPath, typeof(Offset))
end
function ReceiveSpecialRewardCtrl:OnBtnClick_Jump()
WwiseAudioMgr:WwiseVoice_Stop(2)
self._mapNode.animatorRoot.speed = 1
self._mapNode.animInfoContent.speed = 1
self:ShowReward()
end
function ReceiveSpecialRewardCtrl:OnBtnClick_SkipAnim(btn)
if self.bSkipedAnim then
self.bSkipedAnim = false
self:OnBtnClick_Jump()
else
if self.curStep == 4 then
self._mapNode.animatorRoot.speed = 1000
if self.bCG then
self._mapNode.animCGInfoContent.speed = 1000
else
self._mapNode.animInfoContent.speed = 1000
end
end
if self.curStep ~= 5 and self.timerStep ~= nil then
self.timerStep:Cancel(true)
return
end
end
end
return ReceiveSpecialRewardCtrl
@@ -0,0 +1,9 @@
local ReceiveSpecialRewardPanel = class("ReceiveSpecialRewardPanel", BasePanel)
ReceiveSpecialRewardPanel._bIsMainPanel = false
ReceiveSpecialRewardPanel._tbDefine = {
{
sPrefabPath = "CharacterSkin/ReceiveSpecialRewardPanel.prefab",
sCtrlName = "Game.UI.CharacterSkin.ReceiveSpecialRewardCtrl"
}
}
return ReceiveSpecialRewardPanel