Major Update - 2.0.0.143
EN: 2.0.0.143 CN: 2.0.0.142 JP: 2.0.0.145 KR: 2.0.0.150
This commit is contained in:
@@ -4,6 +4,7 @@ local AvgManager = {}
|
||||
local objAvgPanel, objAvgBubblePanel
|
||||
local nTransitionType = 0
|
||||
local bInAvg = false
|
||||
local bKeepEndTransition = false
|
||||
local OnEvent_AvgBBEnd = function(_)
|
||||
if objAvgBubblePanel ~= nil then
|
||||
objAvgBubblePanel:_PreExit()
|
||||
@@ -30,8 +31,9 @@ local OnEvent_AvgBBStart = function(_, sAvgId, sGroupId, sLanguage, sVoLan)
|
||||
objAvgBubblePanel:_PreEnter()
|
||||
objAvgBubblePanel:_Enter()
|
||||
end
|
||||
local OnEvent_AvgSTStart = function(_, sAvgId, sLanguage, sVoLan, sGroupId, nStartCMDID, sTransStyle)
|
||||
local OnEvent_AvgSTStart = function(_, sAvgId, sLanguage, sVoLan, sGroupId, nStartCMDID, sTransStyle, bKeepTransitionOnEnd)
|
||||
local nStyle = 11
|
||||
bKeepEndTransition = bKeepTransitionOnEnd == true
|
||||
if type(sTransStyle) == "string" and sTransStyle ~= "" then
|
||||
local sStyle = string.gsub(sTransStyle, "style_", "")
|
||||
local _n = tonumber(sStyle)
|
||||
@@ -98,7 +100,10 @@ local OnEvent_AvgSTEnd = function(_)
|
||||
bInAvg = false
|
||||
end
|
||||
local func_OnEvent_TransAnimInClear = function()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
if bKeepEndTransition ~= true then
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
bKeepEndTransition = false
|
||||
func_DoEnd()
|
||||
func_AvgSTEnd()
|
||||
end
|
||||
@@ -106,6 +111,7 @@ local OnEvent_AvgSTEnd = function(_)
|
||||
EventManager.Hit(EventId.SetTransition, nTransitionType, func_OnEvent_TransAnimInClear)
|
||||
nTransitionType = 0
|
||||
else
|
||||
bKeepEndTransition = false
|
||||
func_DoEnd()
|
||||
func_AvgSTEnd()
|
||||
end
|
||||
@@ -120,6 +126,7 @@ function AvgManager.ForceCloseAll(_)
|
||||
OnEvent_AvgBBEnd(_)
|
||||
bInAvg = false
|
||||
nTransitionType = 0
|
||||
bKeepEndTransition = false
|
||||
NovaAPI.SetScreenSleepTimeout(false)
|
||||
end
|
||||
local function Uninit(_)
|
||||
|
||||
@@ -7,9 +7,18 @@ local sCurUIName
|
||||
local tbHistory = {}
|
||||
local mapGamepadUI = {}
|
||||
local mapMouseConfig = {}
|
||||
local mapUIOrder = {}
|
||||
local bEnableInput = false
|
||||
local bBlockUI = false
|
||||
local bFirstInputEnable = false
|
||||
local bVirtualMouseStickEnable = true
|
||||
local ApplyVirtualMouseStickEnableDelay = function()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
InputManager.Instance:SetVirtualMouseStickEnable(bVirtualMouseStickEnable)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
local SetGamepadIcon = function(img, sAction, sIconType)
|
||||
local sIcon
|
||||
if nCurUIType == AllEnum.GamepadUIType.PS then
|
||||
@@ -102,6 +111,14 @@ local RefreshCurTypeUINode = function(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
local FindHistoryInsertIndex = function(nOrder)
|
||||
for i = #tbHistory, 1, -1 do
|
||||
if nOrder >= mapUIOrder[tbHistory[i]] then
|
||||
return i + 1
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
local RefreshCurTypeUI = function()
|
||||
if not sCurUIName then
|
||||
return
|
||||
@@ -154,6 +171,7 @@ local OnEvent_LastInputDeviceChange = function(_, nType)
|
||||
nAfterType = AllEnum.GamepadUIType.Other
|
||||
end
|
||||
ChangeUIType(nAfterType)
|
||||
ApplyVirtualMouseStickEnableDelay()
|
||||
end
|
||||
local GetUITypeByInputDevice = function()
|
||||
local bMobile = NovaAPI.IsMobilePlatform()
|
||||
@@ -211,7 +229,7 @@ local EnableNode = function(sCtrlName)
|
||||
printLog("GamepadUIManager:Enable UI " .. sCtrlName)
|
||||
end
|
||||
local tbNode = mapGamepadUI[sCtrlName]
|
||||
if (tbNode == nil or next(tbNode) == nil) and mapMouseConfig[sCurUIName] == nil then
|
||||
if (tbNode == nil or next(tbNode) == nil) and mapMouseConfig[sCtrlName] == nil then
|
||||
printWarn("GamepadUIManager:当前UI内节点打开失败,可能该UI从来没有打开过:" .. sCtrlName)
|
||||
return
|
||||
end
|
||||
@@ -239,7 +257,7 @@ local DisableNode = function(sCtrlName)
|
||||
printLog("GamepadUIManager:Disable UI " .. sCtrlName)
|
||||
end
|
||||
local tbNode = mapGamepadUI[sCtrlName]
|
||||
if (tbNode == nil or next(tbNode) == nil) and mapMouseConfig[sCurUIName] == nil then
|
||||
if (tbNode == nil or next(tbNode) == nil) and mapMouseConfig[sCtrlName] == nil then
|
||||
printWarn("GamepadUIManager:当前UI内节点关闭失败,可能该UI从来没有打开过:" .. sCtrlName)
|
||||
return
|
||||
end
|
||||
@@ -282,7 +300,7 @@ local OnEvent_OpenBuiltinAlert = function(_, bOpen, _okBtn, _confirmBtn, _cancel
|
||||
sAction = "buttonEast"
|
||||
}
|
||||
}
|
||||
GamepadUIManager.EnableGamepadUI("BuiltinUI", tbGamepadUINode)
|
||||
GamepadUIManager.EnableGamepadUI("BuiltinUI", tbGamepadUINode, nil, nil, nil, AllEnum.UI_SORTING_ORDER.BuiltIn_Alert)
|
||||
NovaAPI.SetNaviButtonAction(_okBtn, true)
|
||||
NovaAPI.SetNaviButtonAction(_confirmBtn, true)
|
||||
NovaAPI.SetNaviButtonAction(_cancelBtn, true)
|
||||
@@ -307,11 +325,32 @@ function GamepadUIManager.Init()
|
||||
EventManager.Add("__OpenBuiltinAlert", GamepadUIManager, OnEvent_OpenBuiltinAlert)
|
||||
EventManager.Add(EventId.CSLuaManagerShutdown, GamepadUIManager, Uninit)
|
||||
end
|
||||
function GamepadUIManager.EnableGamepadUI(sCtrlName, tbNode, goDefaultSelected, bEnableVirtualMouse, bBlockCursor)
|
||||
function GamepadUIManager.EnableGamepadUI(sCtrlName, tbNode, goDefaultSelected, bEnableVirtualMouse, bBlockCursor, nPanelIndex)
|
||||
if sCurUIName == sCtrlName then
|
||||
printWarn("GamepadUIManager:重复打开Gamepad UI:" .. sCtrlName)
|
||||
return
|
||||
end
|
||||
mapGamepadUI[sCtrlName] = clone(tbNode)
|
||||
if not mapMouseConfig[sCtrlName] then
|
||||
mapMouseConfig[sCtrlName] = {}
|
||||
end
|
||||
mapMouseConfig[sCtrlName].VirtualMouse = bEnableVirtualMouse == true
|
||||
mapMouseConfig[sCtrlName].BlockCursor = bBlockCursor == true
|
||||
nPanelIndex = nPanelIndex or 0
|
||||
mapUIOrder[sCtrlName] = nPanelIndex
|
||||
local nOldIndex = table.indexof(tbHistory, sCtrlName)
|
||||
if nOldIndex ~= 0 then
|
||||
table.remove(tbHistory, nOldIndex)
|
||||
end
|
||||
local nIndex = FindHistoryInsertIndex(nPanelIndex)
|
||||
table.insert(tbHistory, nIndex, sCtrlName)
|
||||
if nIndex ~= #tbHistory then
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
printLog(string.format("GamepadUIManager:%s 层级(%s)低于当前 %s(%s),不抢焦点,等上层关闭后唤醒", sCtrlName, tostring(nPanelIndex), tostring(sCurUIName), tostring(mapUIOrder[sCurUIName])))
|
||||
end
|
||||
DisableNode(sCtrlName)
|
||||
return
|
||||
end
|
||||
NovaAPI.ClearSelectedUI()
|
||||
if goDefaultSelected then
|
||||
NovaAPI.SetSelectedUI(goDefaultSelected)
|
||||
@@ -324,13 +363,6 @@ function GamepadUIManager.EnableGamepadUI(sCtrlName, tbNode, goDefaultSelected,
|
||||
bSwitch = true
|
||||
end
|
||||
sCurUIName = sCtrlName
|
||||
mapGamepadUI[sCurUIName] = clone(tbNode)
|
||||
if not mapMouseConfig[sCurUIName] then
|
||||
mapMouseConfig[sCurUIName] = {}
|
||||
end
|
||||
mapMouseConfig[sCurUIName].VirtualMouse = bEnableVirtualMouse == true
|
||||
mapMouseConfig[sCurUIName].BlockCursor = bBlockCursor == true
|
||||
table.insert(tbHistory, sCurUIName)
|
||||
RefreshCurTypeUI()
|
||||
if bSwitch then
|
||||
local wait = function()
|
||||
@@ -351,6 +383,7 @@ function GamepadUIManager.DisableGamepadUI(sCtrlName)
|
||||
DisableNode(sCtrlName)
|
||||
mapGamepadUI[sCtrlName] = nil
|
||||
mapMouseConfig[sCtrlName] = nil
|
||||
mapUIOrder[sCtrlName] = nil
|
||||
table.remove(tbHistory, nIndex)
|
||||
sCurUIName = nil
|
||||
if next(tbHistory) ~= nil then
|
||||
@@ -378,6 +411,7 @@ function GamepadUIManager.DisableGamepadUI(sCtrlName)
|
||||
else
|
||||
mapGamepadUI[sCtrlName] = nil
|
||||
mapMouseConfig[sCtrlName] = nil
|
||||
mapUIOrder[sCtrlName] = nil
|
||||
table.remove(tbHistory, nIndex)
|
||||
end
|
||||
end
|
||||
@@ -439,6 +473,7 @@ function GamepadUIManager.EnterAdventure(bSkipFirstInputEnable)
|
||||
tbHistory = {}
|
||||
mapGamepadUI = {}
|
||||
mapMouseConfig = {}
|
||||
mapUIOrder = {}
|
||||
bEnableInput = true
|
||||
bFirstInputEnable = bSkipFirstInputEnable
|
||||
end
|
||||
@@ -450,9 +485,14 @@ function GamepadUIManager.QuitAdventure()
|
||||
tbHistory = {}
|
||||
mapGamepadUI = {}
|
||||
mapMouseConfig = {}
|
||||
mapUIOrder = {}
|
||||
bEnableInput = false
|
||||
bFirstInputEnable = false
|
||||
end
|
||||
function GamepadUIManager.SetVirtualMouseStickEnable(bEnable)
|
||||
bVirtualMouseStickEnable = bEnable ~= false
|
||||
InputManager.Instance:SetVirtualMouseStickEnable(bVirtualMouseStickEnable)
|
||||
end
|
||||
function GamepadUIManager.GetInputName(mapInput)
|
||||
if not mapInput.name or not mapInput.displayName then
|
||||
return
|
||||
|
||||
@@ -27,6 +27,9 @@ end
|
||||
local OnEvent_ExitModule = function(moduleMgr, sExitModuleName, sEnterModuleName)
|
||||
if sExitModuleName == "AdventureModuleScene" then
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.Hud)
|
||||
if PlayerData.Build ~= nil then
|
||||
PlayerData.Build:ClearBattleCharSkinIds()
|
||||
end
|
||||
end
|
||||
end
|
||||
local OnEvent_AfterEnterModule = function(moduleMgr, sEnterModuleName)
|
||||
|
||||
Reference in New Issue
Block a user