Esempio n. 1
0
 public PlaceRecordItem(
     OverturnableInfo placeAndTurnableInfo,
     CellState stoneColor)
 {
     PlaceAndTurnableInfo = placeAndTurnableInfo;
     StoneColor = stoneColor;
 }
Esempio n. 2
0
 public void DoTimerTick()
 {
     int sec = (System.Environment.TickCount - _startMilsec) / 1000;
     MainWindow.InfoPanel.SetPlayerMessage(
         String.Format("考え中 {0}秒", sec),
         Game.Instance.PlayerManager.CurrentIdx);
     if (Game.Instance.PhaseManager.ClickInfo == null) { return; }
     var clickPosIdx = Game.Instance.PhaseManager.ClickInfo.Position;
     _overTurnInfo = MainWindow.Board.GetTurnableInfo(
         clickPosIdx.X, clickPosIdx.Y);
     if (_overTurnInfo == null || _overTurnInfo.GetNumberOfTurnable() <= 0)
     {
         return;
     }
     IsComplete = true;
 }
Esempio n. 3
0
 public OverturnableInfo GetTurnableInfo(int idxX, int idxY)
 {
     if (_cellTable[idxY, idxX].State != CellState.None) { return null; }
     var result = new OverturnableInfo();
     result.IdxX = idxX;
     result.IdxY = idxY;
     var range = new Rect(0, 0, 7, 7);
     var myColor = Game.Instance.CurrentStone;
     foreach (Direction direction in Enum.GetValues(typeof(Direction)))
     {
         var targetX = idxX;
         var targetY = idxY;
         int cntTurnable = 0;
         while (true)
         {
             targetX += (int)_increaseTargetPos[direction].X;
             targetY += (int)_increaseTargetPos[direction].Y;
             if ((range.Contains(targetX, targetY) == false) ||
                 (_cellTable[targetY, targetX].State == CellState.None))
             {
                 cntTurnable = 0;
                 break;
             }
             if (_cellTable[targetY, targetX].State == myColor)
             {
                 break;
             }
             cntTurnable += 1;
         }
         result.NumberOfTurnable[direction] = cntTurnable;
         targetX = idxX + (int)_increaseTargetPos[direction].X;
         targetY = idxY + (int)_increaseTargetPos[direction].Y;
         if (range.Contains(targetX, targetY) != false)
         {
             result.ExistStone[direction] =
                 (_cellTable[idxY, idxX].State != CellState.None);
         }
         else
         {
             result.ExistStone[direction] = false;
         }
     }
     return result;
 }
Esempio n. 4
0
 public void OverturnStones(OverturnableInfo info)
 {
     var myColor = _cellTable[info.IdxY, info.IdxX].State;
     foreach (var direction in info.NumberOfTurnable.Keys)
     {
         var targetX = info.IdxX;
         var targetY = info.IdxY;
         for (int i = 0; i < info.NumberOfTurnable[direction]; i++)
         {
             targetX += (int)_increaseTargetPos[direction].X;
             targetY += (int)_increaseTargetPos[direction].Y;
             _cellTable[targetY, targetX].State = myColor;
         }
     }
 }
Esempio n. 5
0
 public UserTurnPhase()
 {
     IsComplete = false;
     _overTurnInfo = null;
 }
Esempio n. 6
0
 public void SetPlayerMessage(OverturnableInfo turnInfo, int playerIdx)
 {
     string msg;
     if (turnInfo != null)
     {
         msg = new string[] { "A", "B", "C", "D", "E", "F", "G", "H" }[turnInfo.IdxX];
         msg += (turnInfo.IdxY + 1).ToString();
     }
     else
     {
         msg = "パス";
     }
     if (playerIdx == 0)
     {
         Player1Message = msg;
     }
     else
     {
         Player2Message = msg;
     }
 }