Ejemplo n.º 1
0
 public override void ProcessTouchReleased()
 {
     if (isPressed)
     {
         base.ProcessTouchReleased();
         float num = 0f;
         foreach (string str  in  this._buttonElement.Keys)
         {
             LNNode node = (LNNode)CollectionUtils.Get(this._buttonElement, str);
             node.StopAllAction();
             if (this._touchClickedAction.ContainsKey(str))
             {
                 num = MathUtils.Max(num, ((LNAction)CollectionUtils.Get(this._touchClickedAction, str))
                                     .GetDuration());
                 node.RunAction((LNAction)CollectionUtils.Get(this._touchClickedAction, str));
             }
         }
         if (ActionCallBack != null)
         {
             if (num > 0f)
             {
                 base.RunAction(LNSequence.Action(LNDelay.Action(num),
                                                  LNCallFunc.Action(ActionCallBack)));
             }
             else
             {
                 base.RunAction(LNCallFunc.Action(ActionCallBack));
             }
         }
         isPressed = false;
     }
 }
Ejemplo n.º 2
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);
        }