cocos-engine icon indicating copy to clipboard operation
cocos-engine copied to clipboard

Show correct type for preloadScene

Open MrcSnm opened this issue 1 year ago • 1 comments

Re: #17624

Changelog

The old type was misleading *


Continuous Integration

This pull request:

  • [ ] needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • [ ] does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • [ ] changes public API, and have ensured backward compatibility with deprecated features.
  • [ ] affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • [ ] affects file structure of the build package or build configuration which requires user project upgrade.
  • [ ] introduces breaking changes, please list all changes, affected features and the scope of violation.

MrcSnm avatar Sep 10 '24 20:09 MrcSnm

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -27159,9 +27159,9 @@
          * 就算预加载还没完成,你也可以直接调用 `director.loadScene`,加载完成后场景就会启动。
          * @param sceneName @en The name of the scene to load @zh 场景名称。
          * @param onLoaded @en Callback to execute once the scene is loaded @zh 加载回调。
          */
-        preloadScene(sceneName: string, onLoaded?: Director.OnSceneLoaded): void;
+        preloadScene(sceneName: string, onLoaded?: Director.OnScenePreloaded): void;
         /**
          * @en
          * Pre-loads the scene to reduces loading time. You can call this method at any time you want.<br>
          * After calling this method, you still need to launch the scene by `director.loadScene`.<br>
@@ -27173,9 +27173,9 @@
          * @param sceneName @en The name of scene to load @zh 场景名称。
          * @param onProgress @en Callback to execute when the load progression change.  @zh 加载进度回调。
          * @param onLoaded @en Callback to execute once the scene is loaded @zh 加载回调。
          */
-        preloadScene(sceneName: string, onProgress: Director.OnLoadSceneProgress, onLoaded: Director.OnSceneLoaded): void;
+        preloadScene(sceneName: string, onProgress: Director.OnLoadSceneProgress, onLoaded: Director.OnScenePreloaded): void;
         /**
          * @en Resume game logic execution after pause, if the current scene is not paused, nothing will happen.
          * @zh 恢复暂停场景的游戏逻辑,如果当前场景没有暂停将没任何事情发生。
          */
@@ -27298,8 +27298,9 @@
     }
     export namespace Director {
         export type OnBeforeLoadScene = () => void;
         export type OnUnload = () => void;
+        export type OnScenePreloaded = (error?: Error) => void;
         export type OnSceneLoaded = (error: null | Error, sceneAsset?: SceneAsset) => void;
         export type OnSceneLaunched = (error: null | Error, scene?: Scene) => void;
         /**
          * @param completedCount - The number of the items that are already completed.

github-actions[bot] avatar Sep 10 '24 20:09 github-actions[bot]