Exemplo n.º 1
0
 public AVGChara(string resName, int x, int y,
         int w, int h)
 {
     string path = resName;
     if (Loon.Utils.StringUtils.StartsWith(path,'"'))
     {
         path = resName.Replace("\"", "");
     }
     if (path.EndsWith(".an"))
     {
         this.x = x;
         this.y = y;
         this.isAnimation = true;
         try
         {
             this.anm = new AVGAnm(path);
         }
         catch (IOException e)
         {
             Loon.Utils.Debugging.Log.Exception(e.StackTrace);
         }
         this.maxWidth = w;
         this.maxHeight = h;
     }
     else
     {
         this.Load(LTextures.LoadTexture(path), x, y);
     }
 }
Exemplo n.º 2
0
        public AVGChara(string resName, int x, int y,
                        int w, int h)
        {
            string path = resName;

            if (path.StartsWith("\""))
            {
                path = resName.Replace("\"", "");
            }
            if (path.EndsWith(".an"))
            {
                this.x           = x;
                this.y           = y;
                this.isAnimation = true;
                try
                {
                    this.anm = new AVGAnm(path);
                }
                catch (IOException e)
                {
                    Log.Exception(e.StackTrace);
                }
                this.maxWidth  = w;
                this.maxHeight = h;
            }
            else
            {
                this.Load(LTextures.LoadTexture(path), x, y);
            }
        }
Exemplo n.º 3
0
 public void Dispose()
 {
     this.isVisible = false;
     if (characterCG != null)
     {
         characterCG.Destroy();
         characterCG = null;
     }
     if (anm != null)
     {
         anm.Dispose();
         anm         = null;
         isAnimation = false;
     }
 }
Exemplo n.º 4
0
 public void Dispose()
 {
     this.isVisible = false;
     if (characterCG != null)
     {
         characterCG.Destroy();
         characterCG = null;
     }
     if (anm != null)
     {
         anm.Dispose();
         anm = null;
         isAnimation = false;
     }
 }
Exemplo n.º 5
0
 public void Paint(GLEx g)
 {
     if (background != null)
     {
         if (shakeNumber > 0)
         {
             g.DrawTexture(background,
                           shakeNumber / 2 - LSystem.random.Next(shakeNumber),
                           shakeNumber / 2 - LSystem.random.Next(shakeNumber));
         }
         else
         {
             g.DrawTexture(background, 0, 0);
         }
     }
     lock (charas)
     {
         for (int i = 0; i < charas.Size(); i++)
         {
             AVGChara chara = (AVGChara)charas.Get(i);
             if (chara == null || !chara.isVisible)
             {
                 continue;
             }
             if (style)
             {
                 if (chara.flag != -1)
                 {
                     if (chara.flag == FadeEffect.TYPE_FADE_IN)
                     {
                         chara.currentFrame--;
                         if (chara.currentFrame == 0)
                         {
                             chara.opacity = 0;
                             chara.flag    = -1;
                             chara.Dispose();
                             charas.Remove(chara);
                         }
                     }
                     else
                     {
                         chara.currentFrame++;
                         if (chara.currentFrame == chara.time)
                         {
                             chara.opacity = 0;
                             chara.flag    = -1;
                         }
                     }
                     chara.opacity = (chara.currentFrame / chara.time) * 255;
                     if (chara.opacity > 0)
                     {
                         g.SetAlpha(chara.opacity / 255);
                     }
                 }
             }
             if (chara.isAnimation)
             {
                 AVGAnm animation = chara.anm;
                 if (animation.load)
                 {
                     if (animation.loop && animation.startTime == -1)
                     {
                         animation.Start(0, loop);
                     }
                     Point.Point2i point = animation.GetPos(JavaRuntime
                                                            .CurrentTimeMillis());
                     if (animation.alpha != 1f)
                     {
                         g.SetAlpha(animation.alpha);
                     }
                     g.DrawTexture(animation.texture, chara.x, chara.y,
                                   animation.width, animation.height, point.x,
                                   point.y, point.x + animation.imageWidth,
                                   point.y + animation.imageHeight,
                                   animation.angle, animation.color);
                     if (animation.alpha != 1f)
                     {
                         g.SetAlpha(1f);
                     }
                 }
             }
             else
             {
                 chara.Next();
                 chara.draw(g);
             }
             if (style)
             {
                 if (chara.flag != -1 && chara.opacity > 0)
                 {
                     g.SetAlpha(1f);
                 }
             }
         }
     }
 }