Ejemplo n.º 1
0
    private void Start()
    {
        int playerIndex;

        for (playerIndex = 0; playerIndex < MainScreen.Players.otherPlayers.Length; playerIndex++)
        {
            if (MainScreen.Players.otherPlayers[playerIndex].player == MainScreen.ThisPlayerID)
            {
                break;
            }
        }

        int myId;

        if (index < playerIndex)
        {
            myId = index;
        }
        else
        {
            myId = index + 1;
        }

        username.text = MainScreen.Players.otherPlayers[myId].player_username;
        StartCoroutine(Network.GetTexture(MainScreen.Players.otherPlayers[myId].player_avatar,
                                          texture => avatar.sprite = texture.ToSprite(), URL.Headers()));
        foreach (var o in GameObject.FindGameObjectsWithTag("Loading"))
        {
            o.SetActive(false);
        }
    }
Ejemplo n.º 2
0
 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()));
 }
Ejemplo n.º 3
0
 private void GetProfileImage(string url)
 {
     StartCoroutine(Network.GetTexture(url, SetProfileImage, URL.Headers()));
 }