private void ProcessSequenceCompleted() { StoredMoves.Add(CurrentPieces.Select(x => x).ToList()); if (StoredMoves.Count >= MovesAllowedPerTurn) { foreach (var currentMoves in StoredMoves) { SequenceCompleted?.Invoke(currentMoves.ToArray()); LogUsedPieces(currentMoves); foreach (var square in currentMoves) { if (square.OnCollection != null) { square.OnCollection.OnCollection(); } square.DestroyPiece(); } } MoveCompleted?.Invoke(); StoredMoves.Clear(); ResetMovesAllowedPerTurn(); } CurrentPieces.Clear(); SelectedPiecesChanged?.Invoke(CurrentPieces); }
private void Printer_PrintFinished(object sender, PrintFinishedEventArgs e) { if (isPrinting) { PrintFinished?.Invoke(this, e); isPrinting = false; isHomed = false; } if (isFilamentChanging && filamentChangeBegin) { FilamentChangeBegin?.Invoke(this, e); filamentChangeBegin = false; videoIsPlaying = true; isHomed = false; } if (isFilamentChanging && filamentChangeEnd) { FilamentChangeEnd?.Invoke(this, e); filamentChangeEnd = false; isHomed = false; } if (isMovedManually) { isMovedManually = false; MoveCompleted?.Invoke(this, null); } }
public void Move(int discs, Stack <int> from, Stack <int> to, Stack <int> auxilary) { if (discs > 0) { Move(discs - 1, from, auxilary, to); to.Push(from.Pop()); MovesCount++; MoveCompleted?.Invoke(this, EventArgs.Empty); Move(discs - 1, auxilary, to, from); } }
private void Move(int discs, Stack <int> from, Stack <int> to, Stack <int> temp) { if (discs > 0) { Move(discs - 1, from, temp, to); to.Push(from.Pop()); MovesCount++; MoveCompleted?.Invoke(this, EventArgs.Empty); Move(discs - 1, temp, to, from); } }
protected void FireMoveCompleted() { MoveCompleted?.Invoke(this); }