Example #1
0
 /// <summary>
 /// ����������
 /// </summary>
 ///
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="width_0"></param>
 /// <param name="height_1"></param>
 public LComponent(int x, int y, int width_0, int height_1)
 {
     this.alpha = 1.0f;
     this.visible = true;
     this.enabled = true;
     this.focusable = true;
     this.selected = false;
     this.desktop = Desktop.EMPTY_DESKTOP;
     this.SetLocation(x, y);
     this.width = width_0;
     this.height = height_1;
     this.screenRect = LSystem.screenRect;
     if (this.width == 0)
     {
         this.width = 10;
     }
     if (this.height == 0)
     {
         this.height = 10;
     }
 }
Example #2
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 #3
0
 public override void Dispose()
 {
     running = false;
     try
     {
         if (avgThread != null)
         {
             avgThread.Interrupt();
             avgThread = null;
         }
     }
     catch (Exception)
     {
     }
     if (desktop != null)
     {
         desktop.Dispose();
         desktop = null;
     }
     if (sprites != null)
     {
         sprites.Dispose();
         sprites = null;
     }
     if (command != null)
     {
         command = null;
     }
     if (scrCG != null)
     {
         scrCG.Dispose();
         scrCG = null;
     }
     if (dialog != null)
     {
         if (dialog.GetFileName() != null)
         {
             dialog.Destroy();
             dialog = null;
         }
     }
     base.Dispose();
 }
Example #4
0
 private void InitDesktop()
 {
     if (desktop != null && sprites != null)
     {
         return;
     }
     this.desktop = new Desktop(this, GetWidth(), GetHeight());
     this.sprites = new Sprites(GetWidth(), GetHeight());
     if (dialog == null)
     {
         LImage tmp = LImage.CreateImage(GetWidth() - 20,
     GetHeight() / 2 - 20, true);
         LGraphics g = tmp.GetLGraphics();
         g.SetColor(0, 0, 0, 125);
         g.FillRect(0, 0, tmp.GetWidth(), tmp.GetHeight());
         g.Dispose();
         g = null;
         dialog = new LTexture(GLLoader.GetTextureData(tmp));
         if (tmp != null)
         {
             tmp.Dispose();
             tmp = null;
         }
     }
     this.message = new LMessage(dialog, 0, 0);
     this.message.SetFontColor(LColor.white);
     int size = message.GetWidth() / (message.GetMessageFont().GetSize());
     if (LSystem.scaleWidth != 1 || LSystem.scaleHeight != 1)
     {
         if (size % 2 != 0)
         {
             size = size + 2;
         }
         else
         {
             size = size + 3;
         }
     }
     else
     {
         if (size % 2 != 0)
         {
             size = size - 3;
         }
         else
         {
             size = size - 4;
         }
     }
     this.message.SetMessageLength(size);
     this.message.SetLocation((GetWidth() - message.GetWidth()) / 2,
             GetHeight() - message.GetHeight() - 10);
     this.message.SetVisible(false);
     this.select = new LSelect(dialog, 0, 0);
     this.select.SetLocation(message.X(), message.Y());
     this.scrCG = new AVGCG();
     this.desktop.Add(message);
     this.desktop.Add(select);
     this.select.SetVisible(false);
 }
Example #5
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();
     }
 }
Example #6
0
 private void InitDesktop()
 {
     if (desktop != null && sprites != null)
     {
         return;
     }
     this.desktop = new Desktop(this, GetWidth(), GetHeight());
     this.sprites = new Sprites(GetWidth(), GetHeight());
     if (dialog == null)
     {
         LPixmap g = new LPixmap(GetWidth() - 20,
                 GetHeight() / 2 - 20, true);
         g.SetAlphaValue(0, 0, 0, 125);
         g.FillRect(0, 0, g.GetWidth(), g.GetHeight());
         g.Dispose();
         dialog = g.Texture;
         g = null;
     }
     this.message = new LMessage(dialog, 0, 0);
     this.message.SetFontColor(LColor.white);
     int size = message.GetWidth() / (message.GetMessageFont().GetSize());
     if (LSystem.scaleWidth != 1 || LSystem.scaleHeight != 1)
     {
         if (size % 2 != 0)
         {
             size = size + 2;
         }
         else
         {
             size = size + 3;
         }
     }
     else
     {
         if (size % 2 != 0)
         {
             size = size - 3;
         }
         else
         {
             size = size - 4;
         }
     }
     this.message.SetMessageLength(size);
     this.message.SetLocation((GetWidth() - message.GetWidth()) / 2,
             GetHeight() - message.GetHeight() - 10);
     this.message.SetVisible(false);
     this.select = new LSelect(dialog, 0, 0);
     this.select.SetLocation(message.X(), message.Y());
     this.scrCG = new AVGCG();
     this.desktop.Add(message);
     this.desktop.Add(select);
     this.select.SetVisible(false);
 }
Example #7
-1
 public virtual void OnCreate(int width, int height)
 {
     this.mode = SCREEN_CANVAS_REPAINT;
     this.baseInput = this;
     this.width = width;
     this.height = height;
     this.halfWidth = width / 2;
     this.halfHeight = height / 2;
     this.touchX = touchY = lastTouchX = lastTouchY = touchDX = touchDY = 0;
     this.isLoad = isLock = isClose = isTranslate = isGravity = false;
     if (sprites != null)
     {
         sprites.Dispose();
         sprites = null;
     }
     this.sprites = new Sprites(width, height);
     if (desktop != null)
     {
         desktop.Dispose();
         desktop = null;
     }
     this.desktop = new Desktop(baseInput, width, height);
     this.isNext = true;
 }
Example #8
-1
        internal void SetDesktop(Desktop desktop_0)
        {
            if (this.desktop == desktop_0)
            {
                return;
            }

            this.desktop = desktop_0;
            this.input = desktop_0.input;
        }
Example #9
-1
 public virtual void Dispose()
 {
     this.isClose = true;
     this.desktop.SetComponentStat(this, false);
     if (this.parent != null)
     {
         this.parent.Remove(this);
     }
     this.desktop = Desktop.EMPTY_DESKTOP;
     this.input = null;
     this.parent = null;
     if (imageUI != null)
     {
         for (int i = 0; i < imageUI.Length; i++)
         {
             imageUI[i].Destroy();
             imageUI[i] = null;
         }
         this.imageUI = null;
     }
     if (background != null)
     {
         this.background.Destroy();
         this.background = null;
     }
     this.selected = false;
     this.visible = false;
 }