Esempio n. 1
0
        public FormCaro(string playerName1, string playerName2, string IP, bool isServer)
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;

            chessBoard               = new ChessBoardManager(pnlChessBoard, this.pctbMark, this.lblLuotDanh);
            chessBoard.EndedGame    += ChessBoard_EndedGame;
            chessBoard.PlayerMarked += ChessBoard_PlayerMarked;

            prcbCoolDown.Step    = Cons.COUNT_DOWN_STEP;
            prcbCoolDown.Maximum = Cons.COUNT_DOWN_TIME;
            prcbCoolDown.Value   = 0;
            tmCountDown.Interval = Cons.COUNT_DOWN_INTERVAL;
            socket = new SocketManager();

            this.isServer             = isServer;
            chessBoard.Player[0].Name = playerName1;
            chessBoard.Player[1].Name = playerName2;
            lblLuotDanh.Text          = "Lượt đánh của " + playerName1;
            socket.IP = IP;

            NewGame();
            tmCountDown.Stop();

            Connect();
        }
    private List <int[]> storedNextCouldStep; // 暂存的下一步可走格,用于下棋后重置棋盘颜色

    // Start is called before the first frame update
    void Start()
    {
        chessBoardManager  = GameObject.Find("BoardPlane").GetComponent <ChessBoardManager>();
        piecesLogicManager = gameObject.GetComponent <PiecesLogicManager>();
        cameraManager      = GameObject.Find("Main Camera").GetComponent <CameraManager>();
        m_Transform        = gameObject.GetComponent <Transform>();
        selectedMaterial   = Resources.Load <Material>("Materials/ChessBoard/Board_Selecting_Standard");
        killMaterial       = Resources.Load <Material>("Materials/ChessBoard/Board_Kill_Standard");
    }
Esempio n. 3
0
 public virtual void OnStart()
 {
     if(mainGameManager==null)
     {
         mainGameManager = MainGameManager.Instance;
         chessBoardManager = MainGameManager.Instance.ChessBoardManager;
         chessManager = MainGameManager.Instance.ChessManager;
     }
 }
    private void Awake()
    {
        Instance          = this;
        ChessBoardManager = GameObject.Find("ChessBoard").GetComponent <ChessBoardManager>();
        ChessManager      = GameObject.Find("ChessManager").GetComponent <ChessManager>();
        MainUIManager     = GameObject.Find("UIRoot").GetComponent <MainUIManager>();

        switch (PlayerInfo.gameModel)
        {
        case PlayerInfo.GameModel.ManMachine:
            bool playerFirst = PlayerInfo.isPlayerFirst;
            Player1 = new Player().OnInit(playerFirst ? ChessType.White: ChessType.Black);
            switch (PlayerInfo.aiLevel)
            {
            case PlayerInfo.AILevel.Primary:
                Player2 = new AILevelOne();
                break;

            case PlayerInfo.AILevel.Intermediate:
                Player2 = new AILevelTwo();
                break;

            case PlayerInfo.AILevel.Senior:
                Player2 = new AILevelThree();
                break;

            default:
                break;
            }
            Player2.OnInit(playerFirst ? ChessType.Black : ChessType.White);
            NowPlayer = playerFirst? Player1:Player2;
            break;

        case PlayerInfo.GameModel.DoubleMan:
            Player1   = new Player().OnInit(ChessType.White);
            Player2   = new Player().OnInit(ChessType.Black);
            NowPlayer = Player1;
            break;

        case PlayerInfo.GameModel.Net:
            Debug.Log("还没有做");
            break;

        default:
            break;
        }

        ChessBoardManager.OnAwake();
        ChessManager.OnAwake();
        MainUIManager.OnAwake();
        Player1.OnAwake();
        Player2.OnAwake();
    }
Esempio n. 5
0
 private void Awake()
 {
     //Set this as the instance
     if (Instance == null)
     {
         Instance = this;
     }
     //If there is another, destroy this one
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 6
0
    // Start is called before the first frame update
    void Start()
    {
        chessBoardManager = GameObject.Find("BoardPlane").GetComponent <ChessBoardManager>();
        m_transform       = gameObject.GetComponent <Transform>();

        m_rotParent        = GameObject.Find("CameraRot").GetComponent <Transform>();
        m_transform.parent = m_rotParent;

        m_position[0]     = new Vector3(0, 145, -120);
        m_position[1]     = new Vector3(0, 145, 120);
        m_rotation[0]     = new Vector3(52, 0, 0);
        m_rotation[1]     = new Vector3(52, 180, 0);
        light_transform   = GameObject.Find("Directional Light").transform;
        light_rotation[0] = new Vector3(50, 0, 0);
        light_rotation[1] = new Vector3(130, 0, 0);
    }
 // Start is called before the first frame update
 void Start()
 {
     chessBoardManager   = GameObject.Find("BoardPlane").GetComponent <ChessBoardManager>();
     manipulationManager = GameObject.Find("BoardPlane").GetComponent <ManipulationManager>();
 }
Esempio n. 8
0
 private void OnTriggerEnter(Collider other)
 {
     ChessBoardManager.CheckerOutOfGame(other.gameObject);
 }