コード例 #1
0
ファイル: TaskSlidePanel.cs プロジェクト: furinji/Puzzle15
 public TaskSlidePanel(Point posIdx, Direction direction, Form1 form1)
 {
     _form1 = form1;
     _panel = _form1.PanelTable.GetPanel(posIdx);
     switch (direction)
     {
         case Direction.Up:
             _endX = _panel.X;
             _endY = _panel.Y - Panel.Width;
             _endPosIdx = new Point(_panel.IdxX, _panel.IdxY - 1);
             break;
         case Direction.Down:
             _endX = _panel.X;
             _endY = _panel.Y + Panel.Width;
             _endPosIdx = new Point(_panel.IdxX, _panel.IdxY + 1);
             break;
         case Direction.Left:
             _endX = _panel.X - Panel.Width;
             _endY = _panel.Y;
             _endPosIdx = new Point(_panel.IdxX - 1, _panel.IdxY);
             break;
         case Direction.Right:
             _endX = _panel.X + Panel.Width;
             _endY = _panel.Y;
             _endPosIdx = new Point(_panel.IdxX + 1, _panel.IdxY);
             break;
         default:
             _endX = _panel.X;
             _endY = _panel.Y;
             _endPosIdx = new Point(_panel.IdxX, _panel.IdxY);
             break;
     }
     _isComplete = false;
     _speed = 4;
 }
コード例 #2
0
 public LightState GetLightState(Panel panel)
 {
     if (panel.Number == _number)
     {
         return _lightState;
     }
     else
     {
         return LightState.Off;
     }
 }
コード例 #3
0
 public LightState GetLightState(Panel panel)
 {
     if (panel.IdxX == _position.X && panel.IdxY == _position.Y)
     {
         return _lightState;
     }
     else
     {
         return LightState.Off;
     }
 }
コード例 #4
0
 public LightState GetLightState(Panel panel)
 {
     LightState resultState = LightState.Off;
     foreach (var item in _infoList)
     {
         LightState tpState = item.GetLightState(panel);
         if (tpState == LightState.Hard)
         {
             resultState = LightState.Hard;
             break;
         }
         else if (tpState == LightState.Soft)
         {
             if (resultState != LightState.Hard)
             {
                 resultState = LightState.Soft;
             }
         }
     }
     return resultState;
 }
コード例 #5
0
ファイル: PanelTable.cs プロジェクト: furinji/Puzzle15
 public void Init()
 {
     _tableDic.Clear();
     for (int i = 0; i < 16; i++)
     {
         int n = (i + 1) % 16;
         int idxX = i % 4;
         int idxY = i / 4;
         Panel panel = new Panel(n);
         panel.SetIdxAndPos(new Point(idxX, idxY));
         _tableDic[new Point(idxX, idxY)] = panel;
     }
 }