Beispiel #1
0
    void Start()
    {
        this.pokerProvider = new PokerProvider();

        // 绑定 Player 和 GameObject
        List <LeanCloud.Player> playerList = Play.Players.ToList();
        int myIndex = playerList.FindIndex(p => p.IsLocal);
        int offset  = -myIndex;

        for (int i = 0; i < playerList.Count; i++)
        {
            LeanCloud.Player lcPlayer = playerList[i];
            int index = (i + offset + 4) % 4;
            scene.bind(lcPlayer, index);
            ui.bind(lcPlayer, index);
            ui.setPlayerName(lcPlayer, lcPlayer.UserID);
            if (lcPlayer.CustomProperties.ContainsKey(Constants.PROP_STATUS))
            {
                int status = (int)lcPlayer.CustomProperties[Constants.PROP_STATUS];
                ui.setPlayerStatus(lcPlayer, status);
            }
        }
        ui.setUI(Play.Player);

        if (Play.Player.IsMasterClient)
        {
            var p = new Hashtable();
            p.Add(Constants.PROP_STATUS, Constants.PLAYER_STATUS_READY);
            Play.Player.CustomProperties = p;
        }
    }