Example #1
0
 public virtual void Destroy()
 {
     lock (this)
     {
         if (useScreenListener)
         {
             foreach (ScreenListener t in screens)
             {
                 t.Dispose();
             }
         }
         useScreenListener = false;
         replaceLoading = false;
         replaceDelay.SetDelay(10);
         tx = ty = 0;
         isClose = true;
         CallEvents(false);
         isTranslate = false;
         isNext = false;
         isGravity = false;
         isNext = false;
         isLock = true;
         if (sprites != null)
         {
             sprites.Dispose();
             sprites = null;
         }
         if (desktop != null)
         {
             desktop.Dispose();
             desktop = null;
         }
         if (currentScreen != null)
         {
             LTexture parent = currentScreen.GetParent();
             if (parent != null)
             {
                 parent.CloseChildAll();
                 parent.Destroy();
             }
             else
             {
                 currentScreen.Destroy();
             }
             currentScreen = null;
         }
         if (gravityHandler != null)
         {
             gravityHandler.Dispose();
             gravityHandler = null;
         }
         if (releases != null)
         {
             foreach (LRelease r in releases)
             {
                 if (r != null)
                 {
                     r.Dispose();
                 }
             }
             CollectionUtils.Clear(releases);
         }
         Dispose();
     }
 }
Example #2
0
 public virtual GravityHandler SetGravity(bool g)
 {
     if (g && gravityHandler == null)
     {
         gravityHandler = new GravityHandler();
     }
     this.isGravity = g;
     return gravityHandler;
 }
Example #3
0
 public void Destroy()
 {
     lock (this)
     {
         useKeyListener = false;
         useTouchListener = false;
         replaceLoading = false;
         replaceDelay.SetDelay(10);
         tx = ty = 0;
         isClose = true;
         CallEvents(false);
         isTranslate = false;
         isNext = false;
         isGravity = false;
         isCamera = false;
         isLock = true;
         if (touchs != null)
         {
             touchs.Clear();
             touchs = null;
         }
         if (keys != null)
         {
             keys.Clear();
             touchs = null;
         }
         if (sprites != null)
         {
             sprites.Dispose();
             sprites = null;
         }
         if (desktop != null)
         {
             desktop.Dispose();
             desktop = null;
         }
         if (currentScreen != null)
         {
             LTexture parent = currentScreen.GetParent();
             if (parent != null)
             {
                 parent.CloseChildAll();
                 parent.Destroy();
             }
             else
             {
                 currentScreen.Destroy();
             }
             currentScreen = null;
         }
         if (gravityHandler != null)
         {
             gravityHandler.Dispose();
             gravityHandler = null;
         }
         camera = null;
         if (releases != null)
         {
             foreach (LRelease r in releases)
             {
                 if (r != null)
                 {
                     r.Dispose();
                 }
             }
             releases.Clear();
         }
         Dispose();
     }
 }