Ejemplo n.º 1
0
    private void Awake()
    {
        if (!"BOARD_CONFIG".TryGetValue(out go.Board.Config c) || c.core == null)
        {
            "BOARD_CONFIG".SetValue(new go.Board.Config
            {
                size = size
            });
        }

        var config = new OfflineTurnManager.Config();
        var dict   = config.isHumanPlayer as Dictionary <int, bool>;

        foreach (var kvp in isHumanPlayer)
        {
            dict[(int)kvp.Key] = kvp.Value;
        }
        "TURNBASE_CONFIG".SetValue(config);

        ////"AI_CONFIG".SetValue(new BoardGames.AIAgent.Config { level = BoardGames.AIAgent.Level.Easy });
        //"TURNBASE_CONFIG".SetValue(new P2PTurnManager.Config());

        //User.local = new User();
        //TablePlayer.local = new TablePlayer { user = User.local };
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        var bc = new c.Board.Config();

        bc.mailBox = Core.CloneDefaultMailBox();
        for (int x = 0; x < 9; ++x)
        {
            for (int y = 0; y < 10; ++y)
            {
                var piece = bc.mailBox[x][y];
                if (piece == null || piece.Value.name == PieceName.General)
                {
                    continue;
                }
                bc.mailBox[x][y] = new Piece(piece.Value.color, piece.Value.name, true);
            }
        }


        if (!"BOARD_CONFIG".TryGetValue(out Board.Config c) || c.core == null)
        {
            "BOARD_CONFIG".SetValue(bc);
        }

        var config = new OfflineTurnManager.Config();
        var dict   = config.isHumanPlayer as Dictionary <int, bool>;

        foreach (var kvp in isHumanPlayer)
        {
            dict[(int)kvp.Key] = kvp.Value;
        }
        "TURNBASE_CONFIG".SetValue(config);

        //"AI_CONFIG".SetValue(new BoardGames.AIAgent.Config { level = BoardGames.AIAgent.Level.Easy });
        //"TURNBASE_CONFIG".SetValue(new P2PTurnManager.Config());

        //User.local = new User();
        //TablePlayer.local = new TablePlayer { user = User.local };
    }
Ejemplo n.º 3
0
    private void Awake()
    {
        if (!"BOARD_CONFIG".TryGetValue(out Board.Config c) || c.core == null)
        {
            "BOARD_CONFIG".SetValue(new Board.Config
            {
                size = size,
            });
        }

        var config = new OfflineTurnManager.Config();
        var dict   = config.isHumanPlayer as Dictionary <int, bool>;

        foreach (var kvp in isHumanPlayer)
        {
            dict[(int)kvp.Key] = kvp.Value;
        }
        if (!online)
        {
            "TURNBASE_CONFIG".SetValue(config);
        }

        "TURNBASE_CONFIG".SetValue(new P2PTurnManager.Config
        {
            playerCount   = 2,
            maxTurnTime   = maxTurnTime,
            maxPlayerTime = maxPlayerTime
        });

        // test
        Table.current = new Table {
            chair = 2, game = MiniGame.Gomoku, localID = 0, isPlaying = true
        };

        for (int i = 0; i < 2; ++i)
        {
            // cài local
            var user = new User
            {
                id     = i,
                avatar = playerInfos[i].avatar,
                money  = playerInfos[i].money,
                name   = playerInfos[i].name,
                sex    = playerInfos[i].sex
            };

            var player = new TablePlayer
            {
                id       = i,
                betMoney = playerInfos[i].betMoney,
                table    = Table.current,
                user     = user
            };

            (Table.current.players as List <TablePlayer>).Add(player);
            if (i == 0)
            {
                Table.current.host = player;
            }
        }

        PhotonNetwork.AddCallbackTarget(this);
    }