コード例 #1
0
        public static LNFrameStruct InitWithImageName(string imgName)
        {
            DefImage      image   = LNDataCache.ImageByKey(imgName);
            LNFrameStruct struct2 = new LNFrameStruct();

            if (image.maskColor == null)
            {
                struct2._texture = LTextures.LoadTexture(image.fileName,
                                                         Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR);
            }
            else
            {
                struct2._texture = TextureUtils.FilterColor(image.fileName,
                                                            image.maskColor, Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR);
            }
            struct2._state       = image.blend;
            struct2._textCoords  = image.pos;
            struct2._orig_width  = image.orig.X();
            struct2._orig_height = image.orig.Y();
            struct2._size_width  = image.size.X();
            struct2._size_height = image.size.Y();
            struct2._anchor      = image.anchor;
            struct2._place       = image.place;
            return(struct2);
        }
コード例 #2
0
        public void InitButtonWithTextureTwinkle(string fsName1, string fsName2)
        {
            this.fs = LNDataCache.GetFrameStruct(fsName1);
            LNAnimation anim   = new LNAnimation("Frame", 0.1f, fsName1, fsName2);
            LNSprite    sprite = new LNSprite();

            sprite.AddAnimation(anim);
            sprite.SetFrame("Frame", 0);
            CollectionUtils.Put(this._buttonElement, "Image", sprite);
            base.AddNode(sprite, 0);
            base.SetNodeSize(sprite.GetWidth(), sprite.GetHeight());
            base.SetAnchor(new Vector2f(base.GetWidth() / 2f,
                                        base.GetHeight() / 2f));
            LNAction action = LNSequence.Action(LNFrameAction.Action("Frame", 1));

            action.AssignTarget(sprite);
            LNAction action2 = LNSequence.Action(LNFrameAction.Action("Frame", 0));

            action2.AssignTarget(sprite);
            LNAction action3 = LNSequence.Action(
                LNRepeat.Action(LNAnimate.Action(anim), 1),
                LNFrameAction.Action("Frame", 0));

            action3.AssignTarget(sprite);
            CollectionUtils.Put(this._touchBeganAction, "Image", action);
            CollectionUtils.Put(this._touchMoveOutAction, "Image", action2);
            CollectionUtils.Put(this._touchClickedAction, "Image", action3);
        }
コード例 #3
0
 public override void DefinitionObjectDidFinishParsing()
 {
     base.DefinitionObjectDidFinishParsing();
     if (animation != null)
     {
         LNDataCache.SetAnimation(this, this.uniqueID);
     }
 }
コード例 #4
0
ファイル: DefImage.cs プロジェクト: zx8326123/LGame
 internal DefImage(string uid, string name, Vector2f p, Vector2f o, Vector2f a, Vector2f pl)
 {
     this.uniqueID = uid;
     this.pos      = p;
     this.orig     = o;
     this.anchor   = a;
     this.place    = pl;
     this.fileName = name;
     LNDataCache.SetImage(this, this.uniqueID);
 }
コード例 #5
0
ファイル: LNLabelAtlas.cs プロジェクト: zx8326123/LGame
 public LNLabelAtlas(string fsName, LNLabelAtlas.LabelType type, string text,
                     char startchar, int itemWidth, int itemHeight, int charWidth) : base(fsName, itemWidth, itemHeight)
 {
     this.fs         = LNDataCache.GetFrameStruct(fsName);
     base._left      = (int)this.fs._textCoords.x;
     base._top       = (int)this.fs._textCoords.y;
     this._type      = type;
     this._charWidth = charWidth;
     this._startchar = startchar;
     this.SetString(text);
 }
コード例 #6
0
ファイル: LNAtlasNode.cs プロジェクト: zx8326123/LGame
 public LNAtlasNode(string fsName, int tileWidth, int tileHeight)
 {
     try {
         this._itemWidth  = tileWidth;
         this._itemHeight = tileHeight;
         LTexture texture = LNDataCache.GetFrameStruct(fsName)._texture;
         this._itemsPerRow    = texture.GetWidth() / tileWidth;
         this._itemsPerColumn = texture.GetHeight() / tileHeight;
         this._textureAtlas   = new LNTextureAtlas(texture, this._itemsPerRow
                                                   * this._itemsPerColumn);
     } catch (Exception) {
         throw new Exception(
                   "LNAtlasNode Exception in the data load : " + fsName);
     }
 }
コード例 #7
0
ファイル: LNSprite.cs プロジェクト: zx8326123/LGame
        public LNSprite(string fsName)
            : base()
        {
            this._ans = null;
            LNFrameStruct struc0 = LNDataCache.GetFrameStruct(fsName);

            if (struc0 == null)
            {
                throw new Exception("");
            }
            this._texture     = struc0._texture;
            base._left        = struc0._textCoords.X();
            base._top         = struc0._textCoords.Y();
            base._orig_width  = struc0._orig_width;
            base._orig_height = struc0._orig_height;
            base.SetNodeSize(struc0._size_width, struc0._size_height);
            base._anchor.Set(struc0._anchor);
            blendState = struc0._state;
            if (!struc0._place.Equals(0, 0))
            {
                SetPosition(struc0._place);
            }
        }
コード例 #8
0
ファイル: LNSprite.cs プロジェクト: zx8326123/LGame
 public static LNSprite GInitWithFrameStruct(string fsName)
 {
     return(GInitWithFrameStruct(LNDataCache.GetFrameStruct(fsName)));
 }
コード例 #9
0
ファイル: DefImage.cs プロジェクト: zx8326123/LGame
 public override void DefinitionObjectDidFinishParsing()
 {
     base.DefinitionObjectDidFinishParsing();
     LNDataCache.SetImage(this, this.uniqueID);
 }