123456789101112131415161718 |
- namespace ET.Client
- {
- public static class SceneChangeHelper
- {
- // 场景切换协程
- public static async ETTask SceneChangeTo(Scene clientScene, MapConfig map, long sceneInstanceId)
- {
- CurrentScenesComponent currentScenesComponent = clientScene.GetComponent<CurrentScenesComponent>();
- currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
- SceneFactory.CreateCurrentScene(sceneInstanceId, clientScene.Zone, map.MapName, currentScenesComponent);
-
- // 可以订阅这个事件中创建Loading界面
- EventSystem.Instance.Publish(clientScene, new EventType.SceneChangeStart() { mapId = map.Id});
- await ETTask.CompletedTask;
- }
- }
- }
|