public void initButtonWithToggleTwinkle(String fsName1) { 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.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); this._touchBeganAction.put("Image", action); this._touchMoveOutAction.put("Image", action2); this._touchClickedAction.put("Image", action3); }
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); super.addNode(node, 0); super.addNode(sprite2, 0); this._buttonElement.put("ImageOn", node); this._buttonElement.put("ImageOff", sprite2); super.setNodeSize(node.getWidth(), node.getHeight()); super.setAnchor(new Vector2f(super.getWidth() / 2f, super.getHeight() / 2f)); LNAction action = LNSequence.Action(LNToggleVisibility.Action()); action.assignTarget(node); this._touchClickedAction.put("ImageOn", action); LNAction action2 = LNSequence.Action(LNToggleVisibility.Action()); action2.assignTarget(sprite2); this._touchClickedAction.put("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); super.addNode(sprite3, 0); super.addNode(sprite4, 0); sprite4.setVisible(false); this._buttonElement.put("ImageOn", sprite3); this._buttonElement.put("ImageOff", sprite4); super.setNodeSize(sprite3.getWidth(), sprite3.getHeight()); super.setAnchor(new Vector2f(super.getWidth() / 2f, super.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); this._touchBeganAction.put("ImageOn", action3); this._touchMoveOutAction.put("ImageOn", action4); this._touchClickedAction.put("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); this._touchBeganAction.put("ImageOff", action6); this._touchMoveOutAction.put("ImageOff", action7); this._touchClickedAction.put("ImageOff", action8); } }