public static void LoadScene(Ref.SceneType sceneToLoad) { MySceneChangeHook mySceneChangeHook = MyHookSystem.executeHook <MySceneChangeHook>(new MySceneChangeHook(Ref.lastScene, sceneToLoad)); bool flag = mySceneChangeHook.isCanceled(); if (!flag) { sceneToLoad = mySceneChangeHook.newScene; Ref.SceneType current = Ref.lastScene; Ref.lastScene = Ref.currentScene; SceneManager.LoadScene(sceneToLoad.ToString(), LoadSceneMode.Single); MyHookSystem.executeHook <MySceneChangedHook>(new MySceneChangedHook(current, sceneToLoad)); } }
public static void LoadScene(Ref.SceneType sceneToLoad) { MySceneChangeHook res = MyHookSystem.executeHook <MySceneChangeHook>(new MySceneChangeHook(Ref.lastScene, sceneToLoad)); if (res.isCanceled()) { return; } sceneToLoad = res.newScene; Ref.SceneType oldScene = Ref.lastScene; Ref.lastScene = Ref.currentScene; SceneManager.LoadScene(sceneToLoad.ToString(), LoadSceneMode.Single); MyHookSystem.executeHook <MySceneChangedHook>(new MySceneChangedHook(oldScene, sceneToLoad)); }