1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
local g_loggingEnabled = false
EVENT_MANAGER : RegisterForEvent ( "SceneManager" , EVENT_LEADER_TO_FOLLOWER_SYNC , function ( eventId , ... ) self : OnLeaderToFollowerSync ( ... ) end )
end
function ZO_SceneManager_Follower : OnLeaderToFollowerSync ( messageOrigin , syncType , currentSceneName , nextSceneName , sequenceNumber , currentSceneFragmentsComplete )
if messageOrigin ~= ZO_REMOTE_SCENE_CHANGE_ORIGIN then
--This case is just updating the destination for a show in progress
if syncType == REMOTE_SCENE_SYNC_TYPE_CHANGE_NEXT_SCENE then
if nextScene == nil then
--if the next scene is a scene that we don't know then use the base scene instead
self : Log ( string . format ( "Sync Next Scene (%s) Unknown. Setting Next to Base Scene" , nextSceneName ) , self . baseScene : GetName ( ) )
end
-- When we start hiding the current scene we update its fragments based on what the next scene is
-- If the next scene has the fragments then we will not hide them because they will be showing
-- However, it is possible that the next scene is changed before we fully hide the current scene
-- so we need to refresh the current scene's fragments so they hide/show as appropriate for the next scene
end
else
--This case is for a new hide or show, and also updating the fragment complete state of the current scene
local syncTypeName = syncType == REMOTE_SCENE_SYNC_TYPE_SHOW_SCENE and "Show" or "Hide"
self : Log ( string . format ( "Sync %s: Current(%s) Next(%s) FragsDone(%s) Seq(%d)" , syncTypeName , currentSceneName , nextSceneName , currentSceneFragmentsComplete and "T" or "F" , sequenceNumber ) )
-- set current scene
if currentSceneName == ZO_REMOTE_SCENE_NO_SCENE_IDENTIFIER then
else
local currentSceneToSet = currentScene
if currentSceneToSet == nil then
--if the current scene is a scene that we don't know then use the base scene instead
self : Log ( string . format ( "Sync Current Scene (%s) Unknown. Setting Current to Base Scene" , currentSceneName ) , self . baseScene : GetName ( ) )
end
end
-- set next scene
if nextSceneName == ZO_REMOTE_SCENE_NO_SCENE_IDENTIFIER then
else
if nextScene == nil then
--if the next scene is a scene that we don't know then use the base scene instead
self : Log ( string . format ( "Sync Next Scene (%s) Unknown. Setting Next to Base Scene" , nextSceneName ) , self . baseScene : GetName ( ) )
end
end
-- determine if we need to show/hide the current scene
if syncType == REMOTE_SCENE_SYNC_TYPE_SHOW_SCENE then
if currentScene == nil then
--It's likely we were told about a scene changing that we don't have in our SceneManager,
--so we will use our base scene (the empty scene) so we don't interfere with the unknown scene.
--This is basically deactivating the scene manager until we hear about something we know.
self : Log ( string . format ( "Sync Show Scene (%s) Unknown. Showing Base Scene" , currentSceneName ) , self . baseScene : GetName ( ) )
else
self : Log ( string . format ( "Sync Show Scene (%s) Unknown. Base Scene Already Shown" , currentSceneName ) , self . baseScene : GetName ( ) )
end
else
--We were just told to show a scene we do know about. First get the base scene (the empty scene) out of the way
--then show the requested scene. The empty scene will hide instantly. This is like reactivating the scene manager.
end
end
end
elseif syncType == REMOTE_SCENE_SYNC_TYPE_HIDE_SCENE then
if currentScene then
end
else
--Ignore any hides that we don't know about. The shows we don't know about control the activate/deactivate.
end
end
-- update scene if its remote scene has finished it fragment transition
if currentSceneFragmentsComplete then
end
end
end
end
local nextSceneGroup
end
if lastSceneGroup ~= nextSceneGroup then
if lastSceneGroup ~= nil then
end
if nextSceneGroup ~= nil then
end
end
end
-- We don't have a stack, so we can only really check if it's the current scene
return true
end
return false
end
-- Without our own stack we don't know if a scene was ever on it, so return false
return false
end
-- Without a stack we can only really check if the scene is the current scene
-- and is being replaced
end
return false
end
end
MakeRemoteSceneRequest ( ZO_REMOTE_SCENE_CHANGE_ORIGIN , REMOTE_SCENE_REQUEST_TYPE_SWAP , newCurrentSceneName )
end
end
end
MakeRemoteSceneRequest ( ZO_REMOTE_SCENE_CHANGE_ORIGIN , REMOTE_SCENE_REQUEST_TYPE_SHOW_BASE_SCENE , "" )
end
NotifyThatFollowerFinishedFragmentTransition ( ZO_REMOTE_SCENE_CHANGE_ORIGIN , currentSceneName , currentScene : GetSequenceNumber ( ) )
end
if sceneName then
WriteToInterfaceLog ( string . format ( "%s - %s - %s" , ZO_Scene_GetOriginColor ( ) : Colorize ( GetString ( "SI_SCENEMANAGERMESSAGEORIGIN" , ZO_REMOTE_SCENE_CHANGE_ORIGIN ) ) , message , sceneName ) )
else
WriteToInterfaceLog ( string . format ( "%s - %s" , ZO_Scene_GetOriginColor ( ) : Colorize ( GetString ( "SI_SCENEMANAGERMESSAGEORIGIN" , ZO_REMOTE_SCENE_CHANGE_ORIGIN ) ) , message ) )
end
end
end |