public override void SetTarget(LNNode node) { base._firstTick = true; base._isEnd = false; base._target = node; _startPosition = node.GetPosition(); }
public override void SetTarget(LNNode node) { base._firstTick = true; base._isEnd = false; base._target = node; _from = node.GetColor(); }
public static LNFollow Action(LNNode followedNode, RectBox rect) { LNFollow follow = new LNFollow(); follow._followedNode = followedNode; follow._boundarySet = true; follow._boundaryFullyCovered = false; follow.winRect = LSystem.screenRect; follow.fullScreenSize = new Vector2f(follow.winRect.width, follow.winRect.height); follow.halfScreenSize = follow.fullScreenSize.Mul(0.5f); follow.leftBoundary = -((rect.x + rect.width) - follow.fullScreenSize.x); follow.rightBoundary = -rect.x; follow.topBoundary = -rect.y; follow.bottomBoundary = -((rect.y + rect.height) - follow.fullScreenSize.y); if (follow.rightBoundary < follow.leftBoundary) { follow.rightBoundary = follow.leftBoundary = (follow.leftBoundary + follow.rightBoundary) / 2; } if (follow.topBoundary < follow.bottomBoundary) { follow.topBoundary = follow.bottomBoundary = (follow.topBoundary + follow.bottomBoundary) / 2; } if ((follow.topBoundary == follow.bottomBoundary) && (follow.leftBoundary == follow.rightBoundary)) { follow._boundaryFullyCovered = true; } return(follow); }
public virtual void SendToFront(LNNode node) { if (this.childs == null) { return; } if (this._childCount <= 1 || this.childs[0] == node) { return; } if (childs[0] == node) { return; } for (int i = 0; i < this._childCount; i++) { if (this.childs[i] == node) { this.childs = (LNNode[])CollectionUtils.Cut(this.childs, i); this.childs = (LNNode[])CollectionUtils.Expand(this.childs, 1, false); this.childs[0] = node; this.SortComponents(); break; } } }
public virtual void Add(LNNode node, int index) { if (node.GetContainer() != null) { throw new InvalidOperationException(node + " already reside in another node!!!"); } node.SetContainer(this); LNNode[] newChilds = new LNNode[this.childs.Length + 1]; this._childCount++; int ctr = 0; for (int i = 0; i < this._childCount; i++) { if (i != index) { newChilds[i] = this.childs[ctr]; ctr++; } } this.childs = newChilds; this.childs[index] = node; node.SetScreen(_screen); this.SortComponents(); this.latestInserted = node; }
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 override void SetTarget(LNNode node) { base._firstTick = true; base._isEnd = false; base._target = node; this._orgPos = node.GetPosition(); this._diff = this._pos.Sub(this._orgPos); }
public override void SetTarget(LNNode node) { base._firstTick = true; base._isEnd = false; base._target = node; base._orgPos = node.GetPosition(); base._pos = base._orgPos.Add(base._diff); }
public override void SetTarget(LNNode node) { base._firstTick = true; base._isEnd = false; base._target = node; base._orgPos = node.GetPosition(); base._delta.Set(this._delta.x - this._orgPos.x, this._delta.y - this._orgPos.y); }
public override void SetTarget(LNNode node) { base.SetTarget(node); _config.controlPoint_1 = _originalconfig.controlPoint_1 .Sub(_startPosition); _config.controlPoint_2 = _originalconfig.controlPoint_2 .Sub(_startPosition); _config.endPosition = _originalconfig.endPosition.Sub(_startPosition); }
public override void SetAlpha(float a) { base._alpha = a; base._color.a = a; foreach (string name in this._buttonElement.Keys) { LNNode node = (LNNode)CollectionUtils.Get(this._buttonElement, name); node.SetAlpha(a); } }
public virtual LNNode RemoveNode(int index) { LNNode node = this.childs[index]; this._screen.SetNodeStat(node, false); node.SetContainer(null); this.childs = (LNNode[])CollectionUtils.Cut(this.childs, index); this._childCount--; return(node); }
public override void SetTarget(LNNode node) { base._firstTick = true; base._isEnd = false; base._target = node; _startX = base._target.GetScaleX(); _startY = base._target.GetScaleY(); _deltaX = _endX - _startX; _deltaY = _endY - _startY; }
public virtual bool Intersects(LNNode node) { float[] nodePos = node.ConvertToWorldPos(); return((this._visible) && (node._visible) && (pos[0] + GetWidth() >= nodePos[0] && pos[0] <= nodePos[0] + node.GetWidth() && pos[1] + GetWidth() >= nodePos[1] && pos[1] <= nodePos[1] + node.GetHeight())); }
public override void SetTarget(LNNode node) { base._firstTick = true; this._index = 0; base._isEnd = false; base._target = node; if (this._actionList.Count > 0) { this._actionList[0].SetTarget(base._target); } }
public virtual int RemoveNode(LNNode node) { for (int i = 0; i < this._childCount; i++) { if (this.childs[i] == node) { this.RemoveNode(i); return(i); } } return(-1); }
public override void SetTarget(LNNode node) { base._firstTick = true; base._isEnd = false; base._target = node; this._startPosition = base._target._position; this._a = ((this._refPoint.y / this._refPoint.x) - (this._delta.y / this._delta.x)) / (this._refPoint.x - this._delta.x); this._b = (this._delta.y / this._delta.x) - ((this._delta.x + (2f * this._startPosition.x)) * this._a); this._c = (this._startPosition.y - ((this._a * this._startPosition.x) * this._startPosition.x)) - (this._b * this._startPosition.x); }
public bool GetClicked() { if (this._buttonElement.ContainsKey("ImageOn")) { LNNode node = (LNNode)CollectionUtils.Get(this._buttonElement, "ImageOn"); return(node._visible); } if (this._buttonElement.ContainsKey("ImageOff")) { LNNode node2 = (LNNode)CollectionUtils.Get(this._buttonElement, "ImageOff"); return(!node2._visible); } return(true); }
public override void ProcessTouchDragged() { base.ProcessTouchDragged(); foreach (string key in this._buttonElement.Keys) { LNNode node = (LNNode)CollectionUtils.Get(this._buttonElement, key); node.StopAllAction(); if (this._touchBeganAction.ContainsKey(key)) { node.RunAction((LNAction)CollectionUtils.Get(this._touchBeganAction, key)); } } isDraging = true; }
public static LNFollow Action(LNNode followedNode) { LNFollow follow = new LNFollow(); follow._followedNode = followedNode; follow._boundarySet = false; follow._boundaryFullyCovered = false; follow.winRect = LSystem.screenRect; follow.fullScreenSize = new Vector2f(follow.winRect.width, follow.winRect.height); follow.halfScreenSize = Vector2f.Mul(follow.fullScreenSize, 0.5f); return(follow); }
public virtual void AddNode(LNNode node, int z) { if (this.Contains(node)) { return; } if (node.GetContainer() != null) { node.SetContainer(null); } node.SetContainer(this); int index = 0; bool flag = false; for (int i = 0; i < this._childCount; i++) { LNNode node2 = this.childs[i]; int zd = 0; if (node2 != null) { zd = node2.GetZOrder(); } if (zd > z) { flag = true; this.childs = (LNNode[])CollectionUtils.Expand(this.childs, 1, false); childs[index] = node; _childCount++; node.SetScreen(_screen); this.latestInserted = node; break; } index++; } if (!flag) { this.childs = (LNNode[])CollectionUtils.Expand(this.childs, 1, false); this.childs[0] = node; this._childCount++; node.SetScreen(_screen); this.latestInserted = node; } node.SetZOrder(z); node.SetParent(this); Arrays.Sort(childs, comparator); }
public override void Update(float dt) { base.Update(dt); if (isDraging && !Touch.IsDrag()) { foreach (string key in this._buttonElement.Keys) { LNNode node = (LNNode)CollectionUtils.Get(this._buttonElement, key); node.StopAllAction(); if (this._touchMoveOutAction.ContainsKey(key)) { node.RunAction((LNAction)CollectionUtils.Get(this._touchMoveOutAction, key)); } } isDraging = false; } }
public override void ProcessTouchPressed() { if (!isPressed) { base.ProcessTouchPressed(); foreach (string str in this._buttonElement.Keys) { LNNode node = (LNNode)CollectionUtils.Get(this._buttonElement, str); node.StopAllAction(); if (this._touchBeganAction.ContainsKey(str)) { node.RunAction((LNAction)CollectionUtils.Get(this._touchBeganAction, str)); } } isPressed = true; } }
public virtual bool Contains(LNNode node) { if (node == null) { return(false); } if (childs == null) { return(false); } for (int i = 0; i < this._childCount; i++) { if (childs[i] != null && node.Equals(childs[i])) { return(true); } } return(false); }
public virtual LNNode FindNode(int x1, int y1) { if (!this.Intersects(x1, y1)) { return(null); } for (int i = 0; i < this._childCount; i++) { if (childs[i] != null) { if (this.childs[i].Intersects(x1, y1)) { LNNode node = (IsContainer()) ? this.childs[i] : (this.childs[i]).FindNode(x1, y1); return(node); } } } return(this); }
public virtual void DrawNode(SpriteBatch batch) { if (_isClose) { return; } if (!this._visible) { return; } for (int i = this._childCount - 1; i >= 0; i--) { if (childs[i] != null && childs[i].GetZOrder() < 0) { childs[i].DrawNode(batch); } } this.Draw(batch); int zOrder = 0; for (int i = this._childCount - 1; i >= 0; i--) { LNNode o = this.childs[i]; if (o != null) { if (o.GetZOrder() >= 0) { if (zOrder == 0) { zOrder = o.GetZOrder(); } else { zOrder = o.GetZOrder(); } o.DrawNode(batch); } } } }
public virtual int RemoveNode(Type clazz) { if (clazz == null) { return(-1); } int count = 0; for (int i = _childCount; i > 0; i--) { int index = i - 1; LNNode node = this.childs[index]; Type cls = node.GetType(); if (clazz == null || clazz == cls || clazz.IsInstanceOfType(node) || clazz.Equals(cls)) { this.RemoveNode(index); count++; } } return(count); }
protected virtual internal void TransferFocusBackward(LNNode component) { for (int i = 0; i < this._childCount; i++) { if (component == this.childs[i]) { int j = i; do { if (++i >= this._childCount) { i = 0; } if (i == j) { return; } } while (!this.childs[i].RequestFocus()); break; } } }
public virtual void SetTarget(LNNode node) { this._firstTick = true; this._isEnd = false; this._target = node; }
public void AssignTarget(LNNode node) { this._target = node; }