Esempio n. 1
0
 public void initButtonWithFadeoutTwinkle(String fsName1, float Opacity) {
   LNSprite sprite = new LNSprite(fsName1);
   this._buttonElement.put("Image", sprite);
   super.addNode(sprite, 0);
   super.setNodeSize(sprite.getWidth(), sprite.getHeight());
   super.setAnchor(new Vector2f(super.getWidth() / 2f, super.getWidth() / 2f));
   LNAction action = LNSequence.Action(new LNAction[] {LNAlphaAction.Action(Opacity)});
   action.assignTarget(sprite);
   LNAction action2 = LNSequence.Action(new LNAction[] {LNAlphaAction.Action(1f)});
   action2.assignTarget(sprite);
   LNSequence sequence =
       LNSequence.Action(
           new LNAction[] {
             LNAlphaAction.Action(1f), LNDelay.Action(0.1f),
             LNAlphaAction.Action(0.5f), LNDelay.Action(0.1f)
           });
   LNAction action3 =
       LNSequence.Action(
           new LNAction[] {
             LNRepeat.Action(sequence, 3), LNShow.Action(), LNAlphaAction.Action(1f)
           });
   action3.assignTarget(sprite);
   this._touchBeganAction.put("Image", action);
   this._touchMoveOutAction.put("Image", action2);
   this._touchClickedAction.put("Image", action3);
 }
Esempio n. 2
0
 @Override
 public void processTouchReleased() {
   if (isPressed) {
     super.processTouchReleased();
     float num = 0f;
     for (String str : this._buttonElement.keys()) {
       LNNode node = this._buttonElement.get(str);
       node.stopAllAction();
       if (this._touchClickedAction.containsKey(str)) {
         num = MathUtils.max(num, this._touchClickedAction.get(str).getDuration());
         node.runAction(this._touchClickedAction.get(str));
       }
     }
     if (ActionCallBack != null) {
       if (num > 0f) {
         super.runAction(
             LNSequence.Action(LNDelay.Action(num), LNCallFunc.Action(ActionCallBack)));
       } else {
         super.runAction(LNCallFunc.Action(ActionCallBack));
       }
     }
     isPressed = false;
   }
 }