private void RotationFinished(RotationInfo move) { ResetLayerRotation(); foreach (AnimatedLayerMove m in move.Moves) { this.Rubik.RotateLayer(new LayerMove(m.Move.Layer, m.Move.Direction, m.Move.Twice)); } _selections.Reset(); this.State = Moves.Count > 0 ? string.Format("Rotating {0}", Moves.Peek().Name) : "Ready"; if (Moves.Count < 1) { this.MouseHandling = true; } }
private void Update(int bufferIndex) { _renderHandle[bufferIndex].WaitOne(); if (this.Moves.Count > 0) { RotationInfo currentRotation = this.Moves.Peek(); foreach (AnimatedLayerMove rotation in currentRotation.Moves) { double step = (double)rotation.Target / (double)((double)(currentRotation.Milliseconds / 1000.0) * (double)(this.Fps)); this.LayerRotation[rotation.Move.Layer] += step; } if (RotationIsFinished(currentRotation.Moves)) { this.RotationFinished(this.Moves.Dequeue()); } } if (this.DrawingMode == RubiksCubeLib.CubeModel.DrawingMode.ThreeDimensional) { _buffer[bufferIndex] = this.GenFacesProjected(this.Screen, this.zoom); } else { List <Face3D> faces = new List <Face3D>(); foreach (Cube c in this.Rubik.Cubes) { faces.AddRange(c.Faces.Where(f => c.Position.Flags.HasFlag(CubeFlagService.FromFacePosition(f.Position))).Select(f => new Face3D(null, f.Color, f.Position, c.Position.Flags))); } _buffer[bufferIndex] = faces; } _updateHandle[bufferIndex].Set(); }
/// <summary> /// Initializes a new instance of the RotationFinishedEventArgs /// </summary> /// <param name="info">Rotation info</param> public RotationFinishedEventArgs(RotationInfo info) { this.Info = info; }
/// <summary> /// Initializes a new instance of the RotationFinishedEventArgs /// </summary> /// <param name="info">Rotation info</param> public RotationFinishedEventArgs(RotationInfo info) { Info = info; }
private void RotationFinished(RotationInfo move) { ResetLayerRotation(); foreach (AnimatedLayerMove m in move.Moves) { this.Rubik.RotateLayer(new LayerMove(m.Move.Layer, m.Move.Direction, m.Move.Twice)); } _selections.Reset(); this.State = Moves.Count > 0 ? string.Format("Rotating {0}", Moves.Peek().Name) : "Ready"; if (Moves.Count < 1) this.MouseHandling = true; }
private void RotationFinished(RotationInfo move) { this.ResetLayerRotation(); foreach (var m in move.Moves) { this.Rubik.RotateLayer(new LayerMove(m.Move.Layer, m.Move.Direction, m.Move.Twice)); } this._selections.Reset(); this.State = this.Moves.Count > 0 ? $"Rotating {this.Moves.Peek().Name}" : "Ready"; if (this.Moves.Count < 1) this.MouseHandling = true; }