Exemplo n.º 1
0
 public static void Unload(Scene scene)
 {
     PendingScene pending;
     lock (loadedScenes) {
         if (loadedScenes.TryGetValue(scene, out pending)) {
             pending.cancelSource.Cancel(true);
             pending.pool.Release();
             loadedScenes.Remove(scene);
             scene.OnUnload(scene);
         }
     }
 }
Exemplo n.º 2
0
 private static Task _Load(Scene scene, ResourcePool pool)
 {
     PendingScene pendingScene;
     lock (loadedScenes) {
         if (loadedScenes.TryGetValue(scene, out pendingScene)) {
             return pendingScene.task;
         }
         else {
             return (loadedScenes[scene] = new PendingScene(scene, pool)).task;
         }
     }
 }
Exemplo n.º 3
0
 public PendingScene(Scene s, ResourcePool p)
 {
     pool = p.Copy();
     task = s.Load(pool, cancelSource.Token);
 }
Exemplo n.º 4
0
 public static Task Load(Scene scene, ResourcePool pool)
 {
     return Task.Run(() => _Load(scene, pool).Wait());
 }