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); }
public void PopulateFromJson(string json) { PlayerBidAction parsedAction = JsonUtility.FromJson <PlayerBidAction>(json); PlayerIndex = parsedAction.PlayerIndex; PlayerBid = parsedAction.PlayerBid; }
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); }