public void ConnectTo(ConnectionNode endNode) { AutoComplete(); EndNode = endNode; if (startNode is InputNode) { (startNode as InputNode).ConnectedCable = this; (startNode as InputNode).OnPositionChanged += OnPointsChanged; } if (startNode is OutputNode) { (startNode as OutputNode).ConnectedCables.Add(this); (startNode as OutputNode).OnPositionChanged += OnPointsChanged; } if (endNode is InputNode) { (endNode as InputNode).ConnectedCable = this; (endNode as InputNode).OnPositionChanged += OnPointsChanged; } if (endNode is OutputNode) { (endNode as OutputNode).ConnectedCables.Add(this); (endNode as OutputNode).OnPositionChanged += OnPointsChanged; } IsCompleted = true; OnPointsChanged?.Invoke(); }
/// <summary>Adds X (<paramref name="value"/>) points to this PointSystem's Current Points.</summary> /// <remarks> /// If, after the calculation, the amount /// of points is less then MaxPoints, then it triggers OnPointsIncreased and OnPointsChanged events. However if, after the calculation, the amount /// of points is greater or equal to MaxPoints, then it triggers OnPointsIncreased, OnPointsChanged and OnPointsMax events. ///</remarks> /// <param name="value">value to be summed to this PointSystem's Current Points.</param> public void AddPoints(int value) { if (value > 0) { int aux = currentPoints + value;// Propriedade auxiliar para não precisar repetir função if (aux >= maxPoints) { currentPoints = maxPoints; OnPointsDataEventArgs EventArgsData = new OnPointsDataEventArgs { CurrentPointsEventArgs = currentPoints }; OnPointsMax?.Invoke(this, EventArgsData); OnPointsIncreased?.Invoke(this, EventArgsData); OnPointsChanged?.Invoke(this, EventArgsData); } else { currentPoints = aux; OnPointsDataEventArgs EventArgsData = new OnPointsDataEventArgs { CurrentPointsEventArgs = currentPoints }; OnPointsIncreased?.Invoke(this, EventArgsData); OnPointsChanged?.Invoke(this, EventArgsData); } } else { Debug.LogError("value can't be negative nor zero!"); } }
/// <summary>Removes X (<paramref name="value"/>) points from this PointSystem's Current Points (always use positive values, the calculation is made within the function).</summary> /// <remarks> /// If, after the calculation, the amount /// of points is greater then 0, then it triggers OnPointsDecreased and OnPointsChanged events. However if, after the calculation, the amount /// of points is less or equal to 0 then it triggers OnPointsDecreased, OnPointsChanged and OnPointsZero events. ///</remarks> /// <param name="value">value to be subtracted from this PointSystem 's Current Points.</param> public void RemovePoints(int value) { if (value > 0) { int aux = currentPoints - value; if (aux > 0) { currentPoints = aux; OnPointsDataEventArgs EventArgsData = new OnPointsDataEventArgs { CurrentPointsEventArgs = currentPoints }; OnPointsDecreased?.Invoke(this, EventArgsData); OnPointsChanged?.Invoke(this, EventArgsData); } else { currentPoints = 0; OnPointsDataEventArgs EventArgsData = new OnPointsDataEventArgs { CurrentPointsEventArgs = currentPoints }; OnPointsDecreased?.Invoke(this, EventArgsData); OnPointsChanged?.Invoke(this, EventArgsData); OnPointsZero?.Invoke(this, EventArgsData); } } else { Debug.LogError("value can't be negative nor zero!"); } }
private IEnumerator SetPoints() { yield return(0); points = PlayerPrefs.GetInt("InGamePoints") | 0; OnPointsChanged.Invoke(points); }
public void Clear() { lock (this) { points.Clear(); } OnPointsChanged?.Invoke(); }
public void AddSegment(Point point) { Points.Add(MainWindow.Self.Round(point, 0.5)); Segments.Add(new CableSegment(this, Segments.Count)); OnPointsChanged?.Invoke(); }
public void MovePoint(int index, Vector vector) { if (index > 0 && index < Points.Count + 1) { Points[index - 1] += vector; } OnPointsChanged?.Invoke(); }
public void AddPoint(Point point) { lock (this) { points.AddLast(point); while (points.Count > 0 && (points.Count > Limit || (DropOldestCondition?.Invoke(points.First.Value) ?? false))) { points.RemoveFirst(); } } OnPointsChanged?.Invoke(); }
public void SetPoints(List <Point> list) { lock (this) { points.Clear(); foreach (var p in list) { points.AddLast(p); } } OnPointsChanged?.Invoke(); }
/// <summary> /// Set CurrentPoints variable to 0 /// </summary> /// <remarks>Triggers the OnPointsChanged and OnPointsZero events</remarks> public void ResetPoints() { currentPoints = 0; OnPointsDataEventArgs EventArgsData = new OnPointsDataEventArgs { CurrentPointsEventArgs = currentPoints }; OnPointsChanged?.Invoke(this, EventArgsData); OnPointsZero?.Invoke(this, EventArgsData); }
/// <inheritdoc/> public void AddPoints(int guildId, short points) { if (!GuildPoints.ContainsKey(guildId)) { GuildPoints[guildId] = points; } else { GuildPoints[guildId] += points; } OnPointsChanged?.Invoke(guildId, GuildPoints[guildId]); }
public void AddSegment(int index, Point point) { Points.Insert(index - 1, MainWindow.Self.Round(point, 0.5)); Segments.Insert(index, new CableSegment(this, index)); for (int i = index + 1; i < Segments.Count; i++) { Segments[i].Index++; } OnPointsChanged?.Invoke(); }
public void RemoveSegment(int index) { if (index > 0 && index <= Points.Count) { Points.RemoveAt(index - 1); Segments.RemoveAt(index); for (int i = index; i < Segments.Count; i++) { Segments[i].Index--; } OnPointsChanged?.Invoke(); } }
public void AddSegment(Point point) { if (startNode != null) { startNode.OnPositionChanged += OnPointsChanged; } if (endNode != null) { endNode.OnPositionChanged += OnPointsChanged; } Points.Add(MainWindow.Self.Round(point, 0.5)); Segments.Add(new CableSegment(this, Segments.Count)); OnPointsChanged?.Invoke(); }
/// <summary> /// Set currentPoints in the PointsSystem instance /// </summary> public void SetCurrentPoints(int currentpoints) { if (currentpoints > 0 && currentpoints <= maxPoints) { OnPointsDataEventArgs EventArgsData = new OnPointsDataEventArgs { CurrentPointsEventArgs = currentPoints }; if (currentpoints == maxPoints) { OnPointsMax?.Invoke(this, EventArgsData); } currentPoints = currentpoints; OnPointsChanged?.Invoke(this, EventArgsData); } else { Debug.LogError("value can't be negative, zero nor greater then MaxPoints!"); } }
public void AddSegment(int index, Point point) { if (startNode != null) { startNode.OnPositionChanged += OnPointsChanged; } if (endNode != null) { endNode.OnPositionChanged += OnPointsChanged; } Points.Insert(index - 1, MainWindow.Self.Round(point, 0.5)); Segments.Insert(index, new CableSegment(this, index)); for (int i = index + 1; i < Segments.Count; i++) { Segments[i].Index++; } OnPointsChanged?.Invoke(); }
private void MainWindow_MouseMove(object sender, MouseEventArgs e) { if (currentMode == ManipulateMode.All) { Cursor = Cursors.Arrow; } CustomPoint over = GetPointAt(e.GetPosition(this)); if (over != null) { Cursor = Cursors.SizeAll; } if (e.LeftButton == MouseButtonState.Pressed) { if (selectedPoint != null) { Cursor = Cursors.SizeAll; HandleMovement(e.GetPosition(this)); InvalidateVisual(); OnPointsChanged?.Invoke(); UpdateRawPoints(); } else { double deltaX = e.GetPosition(this).X - prevMouseX; double deltaY = e.GetPosition(this).Y - prevMouseY; Cursor = Cursors.Hand; translateTransform.X += deltaX; translateTransform.Y -= deltaY; InvalidateVisual(); } } prevMouseX = e.GetPosition(this).X; prevMouseY = e.GetPosition(this).Y; }
public void AddPoints(int amount) { points += amount; OnPointsChanged.Invoke(points); // return points; }
public void AddPoints(int pointsToAdd) { _points += pointsToAdd; OnPointsChanged.Invoke(_points); }
private void OnPointsChangedEvent() { OnPointsChanged?.Invoke(points); }
public void Move(Vector vector) { Parent.MovePoint(Index, vector); OnPointsChanged?.Invoke(); }
public void IncreasePoints(int value = 1) { points += value; OnPointsChanged?.Invoke(value); }