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,80 @@
|
||||
local SkillDisplayCtrl = class("SkillDisplayCtrl", BaseCtrl)
|
||||
SkillDisplayCtrl._mapNodeConfig = {
|
||||
TMP_SkillName = {sComponentName = "TMP_Text"},
|
||||
imgSubSkillIcon = {sComponentName = "Image"}
|
||||
}
|
||||
SkillDisplayCtrl._mapEventConfig = {}
|
||||
function SkillDisplayCtrl:Awake()
|
||||
end
|
||||
function SkillDisplayCtrl:FadeIn()
|
||||
end
|
||||
function SkillDisplayCtrl:FadeOut()
|
||||
end
|
||||
function SkillDisplayCtrl:OnEnable()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.canvasGroup = self.gameObject:GetComponent("CanvasGroup")
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function SkillDisplayCtrl:OnDisable()
|
||||
end
|
||||
function SkillDisplayCtrl:OnDestroy()
|
||||
end
|
||||
function SkillDisplayCtrl:OnRelease()
|
||||
end
|
||||
function SkillDisplayCtrl:ShowSkillTips(nSkillId, nCharId, callback)
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel(false)
|
||||
self.timer = nil
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.animRoot.enabled = true
|
||||
self.animRoot:Play("SubSkillDisplay_skill_1")
|
||||
NovaAPI.SetCanvasGroupAlpha(self.canvasGroup, 1)
|
||||
end
|
||||
self.animRoot.enabled = false
|
||||
NovaAPI.SetCanvasGroupAlpha(self.canvasGroup, 0)
|
||||
cs_coroutine.start(wait)
|
||||
local mapSkillCfgData = ConfigTable.GetData_Skill(nSkillId)
|
||||
if mapSkillCfgData == nil then
|
||||
printError("Skill Data Missing:" .. nSkillId)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_SkillName, "")
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_SkillName, mapSkillCfgData.Title)
|
||||
end
|
||||
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
|
||||
local mapSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgSubSkillIcon, mapSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self.ShowEndCallback = callback
|
||||
self.gameObject:SetActive(true)
|
||||
self.timer = self:AddTimer(1, 1.5, "ShowEnd", true, true, true, true)
|
||||
self.bPlaying = true
|
||||
end
|
||||
function SkillDisplayCtrl:ShowEnd()
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgSubSkillIcon, nil)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_SkillName, "")
|
||||
if self.ShowEndCallback ~= nil and type(self.ShowEndCallback) == "function" then
|
||||
self.ShowEndCallback()
|
||||
end
|
||||
self.ShowEndCallback = nil
|
||||
self.gameObject:SetActive(false)
|
||||
self.timer = nil
|
||||
self.bPlaying = false
|
||||
end
|
||||
function SkillDisplayCtrl:InterrputAnim()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel(false)
|
||||
self.timer = nil
|
||||
end
|
||||
NovaAPI.SetImageSpriteAsset(self._mapNode.imgSubSkillIcon, nil)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMP_SkillName, "")
|
||||
self.ShowEndCallback = nil
|
||||
self.gameObject:SetActive(false)
|
||||
self.timer = nil
|
||||
self.bPlaying = false
|
||||
end
|
||||
return SkillDisplayCtrl
|
||||
@@ -0,0 +1,190 @@
|
||||
local SubSkillDisplayCtrl = class("SubSkillDisplayCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local RapidJson = require("rapidjson")
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
SubSkillDisplayCtrl._mapNodeConfig = {
|
||||
rtDisplay = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.Battle.SubSkillDisplay.UltimateDisplayCtrl"
|
||||
},
|
||||
rtSubSkill = {
|
||||
nCount = 2,
|
||||
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SkillDisplayCtrl"
|
||||
}
|
||||
}
|
||||
SubSkillDisplayCtrl._mapEventConfig = {
|
||||
CastAssistSkill = "OnEvent_CastAssistSkill",
|
||||
[EventId.SubSkillDisplayInit] = "OnEvent_Init",
|
||||
InputEnable = "OnEvent_InputEnable"
|
||||
}
|
||||
function SubSkillDisplayCtrl:Awake()
|
||||
local sSavedDate = LocalData.GetPlayerLocalData("SkillShowDate")
|
||||
local sDate = os.date("%x")
|
||||
self.mapCharShow = {}
|
||||
if sDate ~= sSavedDate then
|
||||
LocalData.SetPlayerLocalData("SkillShowDate", sDate)
|
||||
LocalData.SetPlayerLocalData("SkillShowCount", RapidJson.encode({}))
|
||||
else
|
||||
local sJson = LocalData.GetPlayerLocalData("SkillShowCount")
|
||||
local mapData = decodeJson(sJson)
|
||||
if mapData ~= nil then
|
||||
for _, nCharId in ipairs(mapData) do
|
||||
self.mapCharShow[nCharId] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function SubSkillDisplayCtrl:FadeIn()
|
||||
end
|
||||
function SubSkillDisplayCtrl:FadeOut()
|
||||
end
|
||||
function SubSkillDisplayCtrl:OnEnable()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.ForceUpdateCanvases()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function SubSkillDisplayCtrl:OnDisable()
|
||||
for _, mapData in pairs(self.mapChar) do
|
||||
Actor2DManager.UnsetActor2D(false, mapData.Idx, true)
|
||||
end
|
||||
end
|
||||
function SubSkillDisplayCtrl:OnDestroy()
|
||||
end
|
||||
function SubSkillDisplayCtrl:OnRelease()
|
||||
end
|
||||
function SubSkillDisplayCtrl:OnEvent_Init(tbTeam)
|
||||
self.mapChar = {}
|
||||
if #tbTeam < 3 then
|
||||
printWarn("人数小于3")
|
||||
return
|
||||
end
|
||||
for i = 2, 3 do
|
||||
local charTid = tbTeam[i]
|
||||
if charTid ~= nil and charTid ~= 0 then
|
||||
local nSkillId = ConfigTable.GetData_Character(charTid).AssistSkillId
|
||||
self.mapChar[charTid] = {
|
||||
Idx = i,
|
||||
nSkillId = nSkillId,
|
||||
bPlaying = false,
|
||||
rtIdx = i - 1,
|
||||
nSkillShowIdx = 0
|
||||
}
|
||||
end
|
||||
self._mapNode.rtDisplay[i - 1]:InitL2dRes(charTid, i)
|
||||
end
|
||||
end
|
||||
function SubSkillDisplayCtrl:OnEvent_CastAssistSkill(nCharId)
|
||||
if self.mapChar[nCharId] ~= nil then
|
||||
local nSkillId = self.mapChar[nCharId].nSkillId
|
||||
local checkType = self:CheckPlayType(nCharId)
|
||||
if checkType == 0 then
|
||||
return
|
||||
elseif checkType == 1 then
|
||||
self:UltimateDisplay(nCharId)
|
||||
elseif checkType == 2 then
|
||||
self:SkillDisplay(nCharId, nSkillId)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SubSkillDisplayCtrl:OnEvent_InputEnable(bEnable)
|
||||
if not bEnable then
|
||||
self:InterrputAllDisplay()
|
||||
end
|
||||
end
|
||||
function SubSkillDisplayCtrl:InterrputAllDisplay()
|
||||
self._mapNode.rtDisplay[1]:InterrputAnim()
|
||||
self._mapNode.rtDisplay[2]:InterrputAnim()
|
||||
self._mapNode.rtSubSkill[1]:InterrputAnim()
|
||||
self._mapNode.rtSubSkill[2]:InterrputAnim()
|
||||
for _, mapSkill in pairs(self.mapChar) do
|
||||
mapSkill.bPlaying = false
|
||||
mapSkill.nSkillShowIdx = 0
|
||||
end
|
||||
end
|
||||
function SubSkillDisplayCtrl:SkillDisplay(nCharId, nSkillId)
|
||||
local mapData = self.mapChar[nCharId]
|
||||
if mapData == nil then
|
||||
return
|
||||
end
|
||||
local Callback = function()
|
||||
mapData.nSkillShowIdx = 0
|
||||
end
|
||||
if mapData.nSkillShowIdx == 0 then
|
||||
for nIdx, skillCtrl in ipairs(self._mapNode.rtSubSkill) do
|
||||
if not skillCtrl.bPlaying then
|
||||
skillCtrl:ShowSkillTips(nSkillId, nCharId, Callback)
|
||||
mapData.nSkillShowIdx = nIdx
|
||||
return
|
||||
end
|
||||
end
|
||||
printError("没有槽位播放技能展示")
|
||||
else
|
||||
self._mapNode.rtSubSkill[mapData.nSkillShowIdx]:ShowSkillTips(nSkillId, nCharId, Callback)
|
||||
WwiseAudioMgr:PostEvent("ui_tip_feadback")
|
||||
end
|
||||
end
|
||||
function SubSkillDisplayCtrl:UltimateDisplay(nCharId)
|
||||
local mapData = self.mapChar[nCharId]
|
||||
if mapData == nil then
|
||||
return
|
||||
end
|
||||
local Callback = function()
|
||||
mapData.bPlaying = false
|
||||
end
|
||||
if mapData.bPlaying then
|
||||
self._mapNode.rtDisplay[mapData.rtIdx]:ReShowSkill(Callback, mapData.Idx)
|
||||
else
|
||||
self._mapNode.rtDisplay[mapData.rtIdx]:ShowSkill(nCharId, mapData.Idx, Callback)
|
||||
mapData.bPlaying = true
|
||||
end
|
||||
self._mapNode.rtDisplay[mapData.rtIdx % 2 + 1]:Set2SecondSkill()
|
||||
end
|
||||
function SubSkillDisplayCtrl:CheckPlayType(nCharId)
|
||||
local bForce = self:CheckForcePlay()
|
||||
local nType = LocalSettingData.GetLocalSettingData("AnimationSub")
|
||||
if bForce then
|
||||
nType = 2
|
||||
end
|
||||
if nType == 3 then
|
||||
return 2
|
||||
elseif nType == 2 then
|
||||
if self.mapCharShow[nCharId] == nil then
|
||||
self.mapCharShow[nCharId] = true
|
||||
self:SetLocalData()
|
||||
end
|
||||
return 1
|
||||
elseif nType == 1 then
|
||||
if self.mapCharShow[nCharId] == nil then
|
||||
self.mapCharShow[nCharId] = true
|
||||
self:SetLocalData()
|
||||
return 1
|
||||
else
|
||||
return 2
|
||||
end
|
||||
end
|
||||
end
|
||||
function SubSkillDisplayCtrl:SetLocalData()
|
||||
local jsonData = {}
|
||||
for nCharId, _ in pairs(self.mapCharShow) do
|
||||
table.insert(jsonData, nCharId)
|
||||
end
|
||||
local sJson = RapidJson.encode(jsonData)
|
||||
LocalData.SetPlayerLocalData("SkillShowCount", sJson)
|
||||
return 1
|
||||
end
|
||||
function SubSkillDisplayCtrl:CheckForcePlay()
|
||||
local bUseLive2D = LocalSettingData.mapData.UseLive2D
|
||||
if not bUseLive2D then
|
||||
return false
|
||||
end
|
||||
local tbDynamic = {
|
||||
[GameEnum.dynamicLevelType.Trial] = true
|
||||
}
|
||||
local tbBattle = {}
|
||||
return tbDynamic[self._panel.DynamicType] or tbBattle[self._panel.BattleType]
|
||||
end
|
||||
return SubSkillDisplayCtrl
|
||||
@@ -0,0 +1,27 @@
|
||||
local SubSkillDisplayPanel = class("SubSkillDisplayPanel", BasePanel)
|
||||
SubSkillDisplayPanel._bIsMainPanel = false
|
||||
SubSkillDisplayPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Battle/SubSkillDisplay_forActor2dEditor.prefab"
|
||||
},
|
||||
{
|
||||
sPrefabPath = "Battle/SubSkillDisplay.prefab",
|
||||
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
|
||||
}
|
||||
}
|
||||
if RUNNING_ACTOR2D_EDITOR ~= true then
|
||||
table.remove(SubSkillDisplayPanel._tbDefine, 1)
|
||||
end
|
||||
function SubSkillDisplayPanel:Awake()
|
||||
end
|
||||
function SubSkillDisplayPanel:OnEnable()
|
||||
end
|
||||
function SubSkillDisplayPanel:OnAfterEnter()
|
||||
end
|
||||
function SubSkillDisplayPanel:OnDisable()
|
||||
end
|
||||
function SubSkillDisplayPanel:OnDestroy()
|
||||
end
|
||||
function SubSkillDisplayPanel:OnRelease()
|
||||
end
|
||||
return SubSkillDisplayPanel
|
||||
@@ -0,0 +1,145 @@
|
||||
local UltimateDisplayCtrl = class("UltimateDisplayCtrl", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local Path = require("path")
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
UltimateDisplayCtrl._mapNodeConfig = {
|
||||
imgBgChar = {sComponentName = "Image"},
|
||||
imgBgPortrait = {sComponentName = "Image"},
|
||||
DisplayL2d = {sComponentName = "RawImage"},
|
||||
animRoot = {sComponentName = "Animator", sNodeName = "animove"},
|
||||
imgBgCharL2d = {}
|
||||
}
|
||||
UltimateDisplayCtrl._mapEventConfig = {}
|
||||
function UltimateDisplayCtrl:Awake()
|
||||
end
|
||||
function UltimateDisplayCtrl:FadeIn()
|
||||
end
|
||||
function UltimateDisplayCtrl:FadeOut()
|
||||
end
|
||||
function UltimateDisplayCtrl:OnEnable()
|
||||
self.bPlaying = false
|
||||
self.bSecond = false
|
||||
self.animScale = self.gameObject:GetComponent("Animator")
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.gameObject:SetActive(true)
|
||||
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function UltimateDisplayCtrl:OnDisable()
|
||||
end
|
||||
function UltimateDisplayCtrl:OnDestroy()
|
||||
end
|
||||
function UltimateDisplayCtrl:OnRelease()
|
||||
end
|
||||
function UltimateDisplayCtrl:ShowSkill(nCharId, nIdx, callback)
|
||||
if self.bPlaying then
|
||||
printError("上一个技能未播放完毕")
|
||||
return
|
||||
end
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel(false)
|
||||
self.timer = nil
|
||||
end
|
||||
WwiseAudioMgr:PostEvent("ui_tip_support_ult")
|
||||
self.gameObject:SetActive(true)
|
||||
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
|
||||
self.bSecond = false
|
||||
self.animScale:Play("Empty")
|
||||
self._mapNode.animRoot:Play("SubskillDisplay_moves_1")
|
||||
self.gameObject.transform.localScale = Vector3.one
|
||||
self.gameObject.transform:SetAsFirstSibling()
|
||||
self.nIdx = nIdx
|
||||
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
|
||||
Actor2DManager.SetActor2D_ForSubSKill(PanelId.SubSkillDisplay, self._mapNode.DisplayL2d, nCharId, nSkinId, nil, nIdx)
|
||||
Actor2DManager.PlayAnim("ultra", true, nIdx)
|
||||
self.callback = callback
|
||||
self.timer = self:AddTimer(1, 1.5, "ShowEnd", true, true, true, true)
|
||||
self.bPlaying = true
|
||||
end
|
||||
function UltimateDisplayCtrl:ReShowSkill(callback, nIdx)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.animRoot:Play("SubskillDisplay_moves_1")
|
||||
Actor2DManager.PlayAnim("ultra", true, nIdx)
|
||||
end
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel(false)
|
||||
self.timer = nil
|
||||
end
|
||||
WwiseAudioMgr:PostEvent("ui_tip_support_ult")
|
||||
self.gameObject:SetActive(true)
|
||||
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
|
||||
self.bSecond = false
|
||||
self._mapNode.animRoot:Play("Empty")
|
||||
self.animScale:Play("Empty")
|
||||
cs_coroutine.start(wait)
|
||||
self.gameObject.transform:SetAsFirstSibling()
|
||||
self.gameObject.transform.localScale = Vector3.one
|
||||
self.callback = callback
|
||||
self.timer = self:AddTimer(1, 1.5, "ShowEnd", true, true, true, true)
|
||||
self.bPlaying = true
|
||||
end
|
||||
function UltimateDisplayCtrl:Set2SecondSkill()
|
||||
if self.bSecond then
|
||||
return
|
||||
end
|
||||
self.bSecond = true
|
||||
if self.bPlaying then
|
||||
self.animScale:Play("SubskillDisplay_scale_1")
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
function UltimateDisplayCtrl:ShowEnd()
|
||||
if self.callback ~= nil and type(self.callback) == "function" then
|
||||
self.callback()
|
||||
end
|
||||
Actor2DManager.UnsetActor2D(false, self.nIdx)
|
||||
self.callback = nil
|
||||
self.gameObject:SetActive(false)
|
||||
self.bSecond = false
|
||||
self.timer = nil
|
||||
self.bPlaying = false
|
||||
self.nIdx = 0
|
||||
end
|
||||
function UltimateDisplayCtrl:InterrputAnim()
|
||||
if not self.bPlaying then
|
||||
return
|
||||
end
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel(false)
|
||||
self.timer = nil
|
||||
end
|
||||
Actor2DManager.UnsetActor2D(false, self.nIdx)
|
||||
self.callback = nil
|
||||
self.gameObject:SetActive(false)
|
||||
self.bPlaying = false
|
||||
self.nIdx = 0
|
||||
end
|
||||
function UltimateDisplayCtrl:InitL2dRes(nCharId, nIdx)
|
||||
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
|
||||
local mapSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
|
||||
local sBodyName = string.format("%s_001", nSkinId)
|
||||
local mapCharCfgData = ConfigTable.GetData_Character(nCharId)
|
||||
self.LoadSprite(self._mapNode.imgBgPortrait, mapSkin.Portrait, sBodyName)
|
||||
local mapCharDescCfg = ConfigTable.GetData("CharacterDes", nCharId)
|
||||
local sColor
|
||||
if mapCharDescCfg == nil then
|
||||
sColor = ""
|
||||
else
|
||||
sColor = mapCharDescCfg.CharSkillColor == "" and mapCharDescCfg.CharColor or mapCharDescCfg.CharSkillColor
|
||||
end
|
||||
local _b, _color = ColorUtility.TryParseHtmlString(sColor)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgBgChar, _color)
|
||||
end
|
||||
function UltimateDisplayCtrl.LoadSprite(imgObj, sPath, sName)
|
||||
local _sPath = string.format("%s/atlas_png/a/%s.png", Path.dirname(sPath), sName)
|
||||
NovaAPI.SetImageSprite(imgObj, Settings.AB_ROOT_PATH .. _sPath)
|
||||
end
|
||||
return UltimateDisplayCtrl
|
||||
Reference in New Issue
Block a user