private void GetPlayers() { StartCoroutine(Network.GetRequest(URL.GetPlayers, response => { response = "{\"otherPlayers\":" + response + "}"; Players = JsonUtility.FromJson <Players>(response); var index = 0; foreach (var player in _playersScoreboard) { Debug.Log(Players.otherPlayers[index].player); if (Players.otherPlayers[index].player == ThisPlayerID) { ThisPlayerPlayerColor = (PlayerColors)index; _myPlayer.UpdateColor(ThisPlayerPlayerColor); index++; } Players.otherPlayers[index].Color = (PlayerColors)index; player.InitViews(Players.otherPlayers[index]); index++; } UpdateTurn(22); }, URL.Headers())); }
public void UpdatePlayer() { StartCoroutine(Network.GetRequest(URL.Personal, response => { var personal = JsonUtility.FromJson <Personal>(response); Personal = personal; brick.text = personal.brick_count.ToString(); longestArmy.text = personal.has_largest_army ? "2" : "0"; playedSoldiers.text = personal.knight_card_played.ToString(); soldiers.text = personal.knight.ToString(); longestRoad.text = personal.has_long_road_card ? "2" : "0"; yearOfPlenty.text = personal.year_of_plenty.ToString(); monopoly.text = personal.monopoly_count.ToString(); roadBuilding.text = personal.road_building_count.ToString(); wheat.text = personal.wheat_count.ToString(); wood.text = personal.wood_count.ToString(); stone.text = personal.stone_count.ToString(); sheep.text = personal.sheep_count.ToString(); victoryPoint.text = personal.victory_point.ToString(); totalPoint.text = $"امتیاز کل: {personal.point}"; username.text = personal.player_username; MainScreen.ThisPlayerID = personal.player; StartCoroutine(Network.GetTexture(personal.player_avatar, texture => { profileImage.sprite = texture.ToSprite(); }, URL.Headers())); }, URL.Headers())); }
private void GetBoardInfo() { StartCoroutine(Network.GetRequest(URL.GetBoard, response => { response = $"{{\"board\":{response}}}"; _catanBoard = JsonUtility.FromJson <Tiles>(response); InitBoard(); }, URL.Headers())); }