Beispiel #1
0
        public void InitButtonWithToggleTwinkle(string fsName1)
        {
            LNSprite sprite = new LNSprite(fsName1);

            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(LNAlphaAction.Action(0.8f));

            action.AssignTarget(sprite);
            LNAction action2 = LNSequence.Action(LNAlphaAction.Action(1f));

            action2.AssignTarget(sprite);
            LNSequence sequence = LNSequence.Action(LNToggleVisibility.Action(),
                                                    LNDelay.Action(0.1f), LNToggleVisibility.Action(),
                                                    LNDelay.Action(0.1f));
            LNAction action3 = LNSequence.Action(LNAlphaAction.Action(1f),
                                                 LNRepeat.Action(sequence, 1), LNShow.Action(),
                                                 LNAlphaAction.Action(1f));

            action3.AssignTarget(sprite);
            CollectionUtils.Put(this._touchBeganAction, "Image", action);
            CollectionUtils.Put(this._touchMoveOutAction, "Image", action2);
            CollectionUtils.Put(this._touchClickedAction, "Image", action3);
        }
Beispiel #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);
        }