예제 #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);
        }
예제 #2
0
 public void InitCheckboxWithPrssingTexture(string fsName1, string fsName2,
                                            string fsName3, string fsName4)
 {
     if ((fsName3.Equals("")) && (fsName4.Equals("")))
     {
         LNSprite node    = new LNSprite(fsName1);
         LNSprite sprite2 = new LNSprite(fsName2);
         sprite2.SetVisible(false);
         base.AddNode(node, 0);
         base.AddNode(sprite2, 0);
         CollectionUtils.Put(this._buttonElement, "ImageOn", node);
         CollectionUtils.Put(this._buttonElement, "ImageOff", sprite2);
         base.SetNodeSize(node.GetWidth(), node.GetHeight());
         base.SetAnchor(new Vector2f(base.GetWidth() / 2f, base.GetHeight() / 2f));
         LNAction action = LNSequence.Action(LNToggleVisibility.Action());
         action.AssignTarget(node);
         CollectionUtils.Put(this._touchClickedAction, "ImageOn", action);
         LNAction action2 = LNSequence.Action(LNToggleVisibility.Action());
         action2.AssignTarget(sprite2);
         CollectionUtils.Put(this._touchClickedAction, "ImageOff", action2);
     }
     else
     {
         LNAnimation anim = new LNAnimation("Frame", 0.1f, new string[] {
             fsName1, fsName3
         });
         LNAnimation animation2 = new LNAnimation("Frame", 0.1f,
                                                  new string[] { fsName2, fsName4 });
         LNSprite sprite3 = new LNSprite();
         LNSprite sprite4 = new LNSprite();
         sprite3.AddAnimation(anim);
         sprite4.AddAnimation(animation2);
         sprite3.SetFrame("Frame", 0);
         sprite4.SetFrame("Frame", 0);
         base.AddNode(sprite3, 0);
         base.AddNode(sprite4, 0);
         sprite4.SetVisible(false);
         CollectionUtils.Put(this._buttonElement, "ImageOn", sprite3);
         CollectionUtils.Put(this._buttonElement, "ImageOff", sprite4);
         base.SetNodeSize(sprite3.GetWidth(), sprite3.GetHeight());
         base.SetAnchor(new Vector2f(base.GetWidth() / 2f, base.GetHeight() / 2f));
         LNAction action3 = LNSequence.Action(LNFrameAction.Action("Frame",
                                                                   1));
         action3.AssignTarget(sprite3);
         LNAction action4 = LNSequence.Action(LNFrameAction.Action("Frame",
                                                                   0));
         action4.AssignTarget(sprite3);
         LNAction action5 = LNSequence.Action(LNToggleVisibility.Action(),
                                              LNFrameAction.Action("Frame", 0));
         action5.AssignTarget(sprite3);
         CollectionUtils.Put(this._touchBeganAction, "ImageOn", action3);
         CollectionUtils.Put(this._touchMoveOutAction, "ImageOn", action4);
         CollectionUtils.Put(this._touchClickedAction, "ImageOn", action5);
         LNAction action6 = LNSequence.Action(LNFrameAction.Action("Frame",
                                                                   1));
         action6.AssignTarget(sprite4);
         LNAction action7 = LNSequence.Action(LNFrameAction.Action("Frame",
                                                                   0));
         action7.AssignTarget(sprite4);
         LNAction action8 = LNSequence.Action(LNToggleVisibility.Action(),
                                              LNFrameAction.Action("Frame", 0));
         action8.AssignTarget(sprite4);
         CollectionUtils.Put(this._touchBeganAction, "ImageOff", action6);
         CollectionUtils.Put(this._touchMoveOutAction, "ImageOff", action7);
         CollectionUtils.Put(this._touchClickedAction, "ImageOff", action8);
     }
 }