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; } }
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); }
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); }
public static LNSequence Action(List<LNAction> actions) { LNSequence sequence = new LNSequence(); sequence._actionList = actions; sequence._duration = 0f; sequence._index = 0; for (int i = 0; i < actions.Count; i++) { sequence._duration += actions[i].GetDuration(); } return sequence; }
public static LNSequence Action(params LNAction[] actions) { int size = actions.Length; LNSequence sequence = new LNSequence(); sequence._actionList = new List<LNAction>(size); sequence._actionList.AddRange(Arrays.AsList<Node.LNAction>(actions)); sequence._duration = 0f; sequence._index = 0; for (int i = 0; i < size; i++) { sequence._duration += actions[i].GetDuration(); } return sequence; }
public static LNSequence Action(List <LNAction> actions) { LNSequence sequence = new LNSequence(); sequence._actionList = actions; sequence._duration = 0f; sequence._index = 0; for (int i = 0; i < actions.Count; i++) { sequence._duration += actions[i].GetDuration(); } return(sequence); }
public static LNSequence Action(params LNAction[] actions) { int size = actions.Length; LNSequence sequence = new LNSequence(); sequence._actionList = new List <LNAction>(size); sequence._actionList.AddRange(Arrays.AsList <Node.LNAction>(actions)); sequence._duration = 0f; sequence._index = 0; for (int i = 0; i < size; i++) { sequence._duration += actions[i].GetDuration(); } return(sequence); }
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); } }