public PlayerViewModel() { othelloManager = OthelloManager.Instance; player1 = othelloManager.TabPlayerModel[0]; player2 = othelloManager.TabPlayerModel[1]; RotationAngle = -90; playerPlaying = Player1; PlayerPlaying.PropertyChanged += PlayerModel_PropertyChanged; }
//*************// // 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; }
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; }
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; }
public static void SetComputerLevel(OthelloManager.ComputerLevelEnum computerLevel) { PlayerPrefs.SetInt(COMPUTER_LEVEL, (int)computerLevel); }
public ViewModel() { othelloManager = OthelloManager.Instance; othelloManager.PropertyChanged += OthelloManager_PropertyChanged; }
internal void CleanUp() { _instance = null; }
public static void StartVersus() { _instance = new OthelloManager(); _instance._playingOnline = false; _instance._playAgainstComputer = false; StartGame(); }
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(); }
public static void StartComputer() { _instance = new OthelloManager(); _instance._playingOnline = false; _instance._playAgainstComputer = true; _instance._playerColor = Othello.PlayerColor.White; StartGame(); }