| | 1 | | using DCL.Helpers; |
| | 2 | | using DCL.Models; |
| | 3 | | using System; |
| | 4 | | using UnityEngine; |
| | 5 | | using UnityEngine.SceneManagement; |
| | 6 | | using Environment = DCL.Environment; |
| | 7 | |
|
| | 8 | | public class SceneControllerBridge : MonoBehaviour |
| | 9 | | { |
| 0 | 10 | | public void LoadParcelScenes(string payload) { Environment.i.world.sceneController.LoadParcelScenes(payload); } |
| | 11 | |
|
| 0 | 12 | | public void SendSceneMessage(string payload) { Environment.i.world.sceneController.SendSceneMessage(payload); } |
| | 13 | |
|
| | 14 | | // sceneNumber comes as a string because WebSocketCommunication can only receive strings as kernel message parameter |
| | 15 | | public void UnloadSceneV2(string sceneNumber) |
| | 16 | | { |
| 0 | 17 | | if (!Int32.TryParse(sceneNumber, out int targetSceneNumber)) |
| | 18 | | { |
| 0 | 19 | | Debug.LogError($"UnloadSceneV2() Int32 failed to parse the received scene number...{sceneNumber}."); |
| 0 | 20 | | return; |
| | 21 | | } |
| | 22 | |
|
| 0 | 23 | | Environment.i.world.sceneController.UnloadScene(targetSceneNumber); |
| 0 | 24 | | } |
| | 25 | |
|
| | 26 | | public void CreateGlobalScene(string payload) |
| | 27 | | { |
| 0 | 28 | | CreateGlobalSceneMessage globalScene = Utils.SafeFromJson<CreateGlobalSceneMessage>(payload); |
| 0 | 29 | | Environment.i.world.sceneController.CreateGlobalScene(globalScene); |
| 0 | 30 | | } |
| | 31 | |
|
| 0 | 32 | | public void UpdateParcelScenes(string payload) { Environment.i.world.sceneController.UpdateParcelScenes(payload); } |
| | 33 | |
|
| | 34 | | // TODO: Move to Builder Bridge |
| 0 | 35 | | public void BuilderReady() { UnityEngine.SceneManagement.SceneManager.LoadScene("BuilderScene", UnityEngine.SceneMan |
| | 36 | | } |