Commits

Paul Barbu - Gheorghe  committed 1be2920

cleanup

  • Participants
  • Parent commits 62ffb62

Comments (0)

Files changed (2)

File magic-cube/MainWindow.xaml.cs

 
         private enum Difficulty {
             Easy = 10,
-            Normal = 2,
+            Normal = 20,
             Hard = 30,
             VeryHard = 40
         }
 
         private void Window_ContentRendered(object sender, EventArgs e) {
             init(currentDifficulty, defaultTitle + "Normal");
-            solveMenu.IsEnabled = true;
         }
 
         private void NewGame_Click(object sender, RoutedEventArgs e) {
-            solveMenu.IsEnabled = false;
             string d = ((MenuItem)sender).Tag.ToString();
 
             switch(d){
             }
 
             init(currentDifficulty, defaultTitle + d);
-            solveMenu.IsEnabled = true;
         }
 
         private void Window_KeyUp(object sender, KeyEventArgs e) {
             if (e.Key == Key.F5) {
-                solveMenu.IsEnabled = false;
                 init(currentDifficulty, this.Title);
-                solveMenu.IsEnabled = true;
             }
         }
 
         private void init(Difficulty d, string title, string file=null) {
-            doneMoves.Clear();
             this.mainViewport.Children.Remove(c);
             this.mainViewport.Children.Remove(touchFaces);
             rotations.Children.Clear();
+            doneMoves.Clear();
+            solveMenu.IsEnabled = false;
             
             if (file != null) {
                 c = new RubikCube(readCube(file, out doneMoves), size, new Point3D(-len / 2, -len / 2, -len / 2), TimeSpan.FromMilliseconds(370), edge_len, space);
 
             this.Title = title;
             saveMenu.IsEnabled = true;
+            solveMenu.IsEnabled = true;
         }
 
         private void enableAnimations_Checked(object sender, RoutedEventArgs e) {
             dlg.Filter = "Magic Cube Save Files (.rubik)|*.rubik";
 
             if (true == dlg.ShowDialog()) {
-                doneMoves.Clear();
-                solveMenu.IsEnabled = false;
-
                 try {
                     init(currentDifficulty, defaultTitle.TrimEnd(new char[] { ' ', '-' }), dlg.FileName);
                 }
                     MessageBox.Show("The file contains a solved cube!\nNew game will start!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
                     init(currentDifficulty, defaultTitle + "Normal");
                 }
-
-                solveMenu.IsEnabled = true;
             }
         }
 

File magic-cube/RubikCube.cs

         public Cube2D projection;
         public TimeSpan animationDuration;
 
+        private List<KeyValuePair<Move, RotationDirection>> moves;
+        int index;
+
         private Dictionary<CubeFace, Material> faceColors = new Dictionary<CubeFace, Material> {
             {CubeFace.L, new DiffuseMaterial(new SolidColorBrush(Colors.Red))},
             {CubeFace.D, new DiffuseMaterial(new SolidColorBrush(Colors.Yellow))},
             return moves;
         }
 
-        private List<KeyValuePair<Move, RotationDirection>> moves;
-        int index;
-
         public void rotate(List<KeyValuePair<Move, RotationDirection>> moves) {
             index = 0;
             this.moves = moves;