예제 #1
0
    private bool OnRemoteBidPlaced(object cookie)
    {
        PlayerBidAction bidAction = (PlayerBidAction)cookie;
        PlayerData      player    = gameData.Players[bidAction.PlayerIndex];

        if (player.Bids.Count == gameData.CurrentRoundNumber)
        {
            player.CurrentBid = bidAction.PlayerBid;
            player.Bids.Add(bidAction.PlayerBid);
            player.Tricks.Add(0);
            Debug.Log("Player " + player.PlayerName + " placed a bid of " + player.CurrentBid + ". " + gameData.AllBidsPlaced);
        }
        else
        {
            Debug.LogWarning("Player " + player.PlayerName + " tried to bid again: " + bidAction.PlayerBid);
        }

        if (gameData.AllBidsPlaced)
        {
            Debug.Log("All bids placed!");
            gameScreen.EndBidding();
            gameScreen.SyncGameState(gameData, localPlayer, true);
        }
        return(true);
    }
예제 #2
0
    public void PopulateFromJson(string json)
    {
        PlayerBidAction parsedAction = JsonUtility.FromJson <PlayerBidAction>(json);

        PlayerIndex = parsedAction.PlayerIndex;
        PlayerBid   = parsedAction.PlayerBid;
    }
예제 #3
0
    private bool OnLocalBidPlaced(object cookie)
    {
        PlayerBidAction bidAction = new PlayerBidAction();

        bidAction.PlayerBid   = (int)cookie;
        bidAction.PlayerIndex = gameData.Players.IndexOf(localPlayer);
        Service.WebRequests.SendGameAction(gameData, bidAction, (response) => { });
        return(true);
    }