static Native() { //RuntimeCil.Generate(typeof(MemoryMapped).Assembly); Create = Marshal.GetDelegateForFunctionPointer <CreateDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Create")); CreateAndOpen = Marshal.GetDelegateForFunctionPointer <CreateAndOpenDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "CreateAndOpen")); Destory = Marshal.GetDelegateForFunctionPointer <DestoryDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Destory")); Open = Marshal.GetDelegateForFunctionPointer <OpenDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Open")); Close = Marshal.GetDelegateForFunctionPointer <CloseDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Close")); At = Marshal.GetDelegateForFunctionPointer <AtDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "At")); GetData = Marshal.GetDelegateForFunctionPointer <GetDataDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "GetData")); IsValid = Marshal.GetDelegateForFunctionPointer <IsValidDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "IsValid")); Size = Marshal.GetDelegateForFunctionPointer <SizeDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Size")); MappedSize = Marshal.GetDelegateForFunctionPointer <MappedSizeDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "MappedSize")); Remap = Marshal.GetDelegateForFunctionPointer <RemapDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Remap")); }
public void Unload <T>(DestoryDelegate callback) where T : Scene { var sceneType = typeof(T); _loadedScenes.RemoveAll(m => m.GetType() == sceneType); var sceneName = sceneType.Name; var asyncOperation = UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(sceneName); System.Action <AsyncOperation> task = async => { if (callback != null) { callback(); } }; if (asyncOperation.isDone) { task(asyncOperation); } else { asyncOperation.completed += task; } }
public void Unload(Scene scene, DestoryDelegate callback) { _loadedScenes.RemoveAll(m => m.sceneFile == scene.sceneFile); var asyncOperation = UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(scene.sceneFile); System.Action <AsyncOperation> task = async => { if (callback != null) { callback(); } }; if (asyncOperation.isDone) { task(asyncOperation); } else { asyncOperation.completed += task; } }