示例#1
0
文件: Column.cs 项目: T-era/HanoiGUI
        internal void AddPlate(Plate plate)
        {
            plate.NowOn = this;
            plate.SetMoving(false);

            plates.AddFirst(plate);
            this.Controls.Add(plate);
            ResetPosition();
        }
示例#2
0
文件: Column.cs 项目: T-era/HanoiGUI
 internal IEnumerable<Plate> MovingPlateOver(Plate temp)
 {
     foreach (var plate in plates)
     {
         plate.SetMoving(true);
         yield return plate;
         if (plate == temp)
         {
             break;
         }
     }
 }
示例#3
0
文件: Plate.cs 项目: T-era/HanoiGUI
 internal static Plate[] CreatePlates(int num)
 {
     if (num == 1)
     {
         return new[] { new Plate() { Width = MAX_WIDTH, PlateNo = 1 } };
     }
     else
     {
         int d = (MAX_WIDTH - MIN_WIDTH) / (num - 1);
         Plate[] ret = new Plate[num];
         for (int i = 0; i < num; i++)
         {
             ret[i] = new Plate() { Width = MAX_WIDTH - d * i, PlateNo = num - i };
         }
         return ret;
     }
 }