Пример #1
0
 public PlayerViewModel()
 {
     othelloManager = OthelloManager.Instance;
     player1        = othelloManager.TabPlayerModel[0];
     player2        = othelloManager.TabPlayerModel[1];
     RotationAngle  = -90;
     playerPlaying  = Player1;
     PlayerPlaying.PropertyChanged += PlayerModel_PropertyChanged;
 }
Пример #2
0
        //*************//
        // Constructor //
        //*************//
        public CaseViewModel(int posX, int posY)
        {
            othelloManager = OthelloManager.Instance;
            CaseBoard      = new CaseModel(posX, posY);
            PathToImage    = CaseBoard.PathImage; //TODO: Exception Generated...if null
            Command        = new CommandeCaseClick(ExecuteCaseClick, CanExecuteCaseClick);
            othelloManager.AddCaseModel(CaseBoard);

            //Subscribe to PropertyChanged of the model
            CaseBoard.PropertyChanged += CaseModel_PropertyChanged;
        }
Пример #3
0
    public static string GetComputerName(OthelloManager.ComputerLevelEnum computerLevel)
    {
        var name = string.Empty;
        var computerNames = new string[]
        {
            "Easy Computer",
            "Normal Computer",
            "Hard Computer",
            "Very Hard Computer",
            "Computer Impossible",
        };
        if (computerNames.Length > (int)computerLevel)
        {
            name = computerNames[(int)computerLevel];
        }
        else
        {
            name = "Computer";
        }

        return name;
    }
Пример #4
0
 public static OthelloPiece GetMove(OthelloPiece[,] bricks, OthelloManager.ComputerLevelEnum computerLevel)
 {
     ArrayList possibleMovesTemp = OthelloRules.GetAllValidMoves(bricks, Othello.CURRENT_PLAYER);
     var possibleMoves = new List<OthelloPiece>();
     foreach (OthelloPiece temp in possibleMovesTemp)
     {
         possibleMoves.Add(temp);
     }
     if (possibleMoves.Count < 1) return null;
     switch (computerLevel)
     {
         case OthelloManager.ComputerLevelEnum.One:
             return LevelOneMove(bricks, possibleMoves);
         case OthelloManager.ComputerLevelEnum.Two:
             return LevelTwoMove(bricks, possibleMoves);
         case OthelloManager.ComputerLevelEnum.Three:
             return LevelThreeMove(bricks, possibleMoves);
         case OthelloManager.ComputerLevelEnum.Four:
             return LevelFourMove(bricks, possibleMoves);
         case OthelloManager.ComputerLevelEnum.Five:
             return LevelFiveMove(bricks, possibleMoves);
     }
     return null;
 }
Пример #5
0
 public static void SetComputerLevel(OthelloManager.ComputerLevelEnum computerLevel)
 {
  
     PlayerPrefs.SetInt(COMPUTER_LEVEL, (int)computerLevel);
 }
Пример #6
0
 public ViewModel()
 {
     othelloManager = OthelloManager.Instance;
     othelloManager.PropertyChanged += OthelloManager_PropertyChanged;
 }
Пример #7
0
 internal void CleanUp()
 {
     _instance = null;
 }
Пример #8
0
 public static void StartVersus()
 {
     _instance = new OthelloManager();
     _instance._playingOnline = false;
     _instance._playAgainstComputer = false;
     StartGame();
 }
Пример #9
0
    public static void StartOnline(bool thisPlayerStarts, string opponentName)
    {
        _instance = new OthelloManager();
        _instance._playingOnline = true;
        _instance._playAgainstComputer = false;
        _instance._opponentName = opponentName;

        if (thisPlayerStarts)
        {
            _instance._playerColor = Othello.PlayerColor.White;
        }
        else
        {
            _instance._playerColor = Othello.PlayerColor.Black;
        }
        StartGame();
    }
Пример #10
0
 public static void StartComputer()
 {
     _instance = new OthelloManager();
     _instance._playingOnline = false;
     _instance._playAgainstComputer = true;
     _instance._playerColor = Othello.PlayerColor.White;
     StartGame();
 }