private void startbtn_Click(object sender, EventArgs e) { try { ExitAllPlayer(); Task.WaitAll(Task.Delay(TimeSpan.FromSeconds(1))); var processes = StartPlayersByConsole(); var l = processes.Length; for (var i = 0; i < l; i++) { var process = processes[i]; var index = i; var thread = new Thread(() => { var opera = new GameOperator(process, index); }); thread.Start(); _threads.Add(thread); } } catch (Exception ex) { ExitAllPlayer(); MessageBox.Show(ex.Message); LogHelper.LogError(ex); } }
void Awake() { if (Instance == null) { Instance = this; } }
public Match() { gameOperator = new GameOperator(); spriteBatch = new SpriteBatch(Global.Instance.Graphics); returnToMenu = new Button(); continueGame = new Button(); setting = new Button(); save = new Button(); pauseScreen = new BasicEntity(); playerOneInstruction = new TextEntity(); playerTwoInstruction = new TextEntity(); }
public Match() { gameOperator = new GameOperator(); returnToMenu = new Button(); }
public bool PlayMove(int column, int line, bool isWhite) { Dictionary <Tuple <int, int>, HashSet <Tuple <int, int> > > listPossibleMoves = GameOperator.GetPossibleMoves(board, isWhite); Tuple <int, int> position = new Tuple <int, int>(column, line); if (!listPossibleMoves.ContainsKey(position)) { return(false); } HashSet <Tuple <int, int> > discsToFlip = listPossibleMoves[position]; int value = isWhite ? GameProperties.WHITE : GameProperties.BLACK; foreach (Tuple <int, int> disc in discsToFlip) { board[disc.Item1, disc.Item2] = value; } return(true); }
public bool IsPlayable(int column, int line, bool isWhite) { return(GameOperator.ValidateMove(board, new Tuple <int, int>(column, line), isWhite?GameProperties.WHITE:GameProperties.BLACK)); }
public int GetWhiteScore() { return(GameOperator.GetDiscs(board, GameProperties.WHITE).Count); }
public int GetBlackScore() { return(GameOperator.GetDiscs(board, GameProperties.BLACK).Count); }
// Use this for initialization void Start() { GameOperator.instance = this.gameObject.GetComponent<GameOperator>(); this.Mode = OperatorMode.IDLE; }