private void OnLeaderboardSuccess(GetLeaderboardResult obj)
    {
        UIParent = GameObject.FindGameObjectWithTag("pame").transform;
        ScoreRecord temp;         // temp variable for a scoreRecord

        for (int i = 0; i < obj.Leaderboard.Count; i++)
        {
            temp = GetRecord(obj.Leaderboard[i].DisplayName);
            //create a new entry
            if (temp == null)
            {
                //create a new ScoreRecord
                temp = Instantiate(ScoreRecordPrefab, transform.position, transform.rotation, UIParent).GetComponent <ScoreRecord>();
                temp.WriteRecord(obj.Leaderboard[i].DisplayName, obj.Leaderboard[i].StatValue.ToString());
            }
            else
            {
                //just set the score, it might have updated :shrug:
                temp.Score.text = obj.Leaderboard[i].StatValue.ToString();
            }
            //add it to the score list
            ScoreRecords.Add(temp);

            //debug the value
            Debug.Log(temp.Name.text + " " + temp.Score.text);
        }
    }
Exemple #2
0
        private void GetClientLbCallback(GetLeaderboardResult result)
        {
            var testContext = (UUnitTestContext)result.CustomData;

            testContext.True(result.Leaderboard.Count > 0, "Client leaderboard should not be empty");
            testContext.EndTest(UUnitFinishState.PASSED, null);
        }
Exemple #3
0
    void OnGetLeaderBoard(GetLeaderboardResult result)
    {
        LeaderboardRaw[] allLBObjects = LeaderBoardRawParent.GetComponentsInChildren <LeaderboardRaw>();

        for (int n = 0; n < allLBObjects.Length; n++)
        {
            Destroy(allLBObjects[n].gameObject);
        }

        int  i  = 0;
        bool me = false;

        foreach (var playerData in result.Leaderboard)
        {
            if (playerData.DisplayName == nameInField.text)
            {
                me = true;
            }
            else
            {
                me = false;
            }
            LeaderboardRaw lbObj = Instantiate(LeaderBoardRaw, LeaderBoardRawParent).GetComponent <LeaderboardRaw>();
            lbObj.SetInfo(playerData.DisplayName, playerData.StatValue.ToString(), me);
            i++;
        }
    }
Exemple #4
0
 void OnLeaderboardGet(GetLeaderboardResult result)
 {
     foreach (var item in result.Leaderboard)
     {
         Debug.Log(item.Position + " | " + item.PlayFabId + " | " + item.StatValue);
     }
 }
Exemple #5
0
 void OnSuccessGetLeaderboard(GetLeaderboardResult result)
 {
     foreach (PlayerLeaderboardEntry player in result.Leaderboard)
     {
         Debug.Log(player.DisplayName + ": " + player.StatValue);
     }
 }
Exemple #6
0
    void OnGetLeaderboardCoinz(GetLeaderboardResult result)
    {
        //Debug.Log(result.Leaderboard[0].StatValue);
        name2.text  = username;
        coinz_.text = ((int)PlayerPrefs.GetFloat("DriftCoin")).ToString();
        foreach (PlayerLeaderboardEntry player in result.Leaderboard)
        {
            GameObject      tempListing = Instantiate(listingCoinzPrefab, listingCoinzContainer);
            LeaderBoardList LL          = tempListing.GetComponent <LeaderBoardList>();
            LL.playerName.text  = player.DisplayName;
            LL.playerScore.text = player.StatValue.ToString();
            LL.pos.text         = "#" + (player.Position + 1).ToString();
            if (LL.pos.text == "#1")
            {
                LL.pos.color        = Color.green;
                LL.playerName.color = Color.green;
                LL.crown_ico.SetActive(true);
            }

            if (LL.pos.text == "#2")
            {
                LL.pos.color        = Color.yellow;
                LL.playerName.color = Color.yellow;
                LL.crown_ico.SetActive(false);
            }

            if (LL.pos.text == "#3")
            {
                LL.pos.color        = Color.red;
                LL.playerName.color = Color.red;
                LL.crown_ico.SetActive(false);
            }
        }
    }
    public void Fill(GetLeaderboardResult result)
    {
        var leaderboard = result.Leaderboard;
        int n           = leaderBoardUsername.Length;

        if (leaderboard.Count < leaderBoardUsername.Length)
        {
            n = leaderboard.Count;
        }

        for (int i = 0; i < leaderBoardUsername.Length; i++)
        {
            if (i < n)
            {
                StartCoroutine(fillText(leaderBoardUsername[i], leaderboard[i].DisplayName));
                StartCoroutine(fillText(leaderboardPoints[i], leaderboard[i].StatValue.ToString()));
            }
            else
            {
                leaderBoardUsername[i].text = defaultUsername;
                leaderboardPoints[i].text   = defaultPoints;
            }
        }

        menuEvent.SetLoadingAnimActive(false);
    }
Exemple #8
0
 private void OnLeaderboardSuccess(GetLeaderboardResult obj)
 {
     foreach (var value in obj.Leaderboard)
     {
         print(value.StatValue + " " + value.DisplayName);
     }
 }
    private void OnPlayersReceived(GetLeaderboardResult obj)
    {
        m_dropdown.ClearOptions();
        m_players.Clear();

        List <string> result = new List <string>();

        foreach (var user in obj.Leaderboard)
        {
            if (user.PlayFabId == GameManager.m_playfabID)
            {
                continue;
            }

            if (user.Profile.Tags.Count == 0)
            {
                continue;
            }

            string tagIP = user.Profile.Tags[0].TagValue.Remove(0, 12);
            m_players[user.DisplayName] = tagIP;
            result.Add(user.DisplayName);
        }
        m_dropdown.AddOptions(result);
        OnValueChanged();
    }
Exemple #10
0
 void OnGetWinLeaderboard(GetLeaderboardResult result)
 {
     leaderboard = new List <Leaderboard>();
     foreach (PlayerLeaderboardEntry player in result.Leaderboard)
     {
         leaderboard.Add(new Leaderboard(player.Profile.DisplayName, player.StatValue));
     }
 }
    private void OnLeaderboardReceived(GetLeaderboardResult obj)
    {
        m_loadingText.SetActive(false);

        foreach (var user in obj.Leaderboard)
        {
            AddLeaderboardField(user.Position, user.DisplayName, user.StatValue);
        }
    }
Exemple #12
0
 private void OnGetLeaderboardSuccess(GetLeaderboardResult leaderboardResult)
 {
     ClearLeaderboard();
     informationText.text = "";
     foreach (var entry in leaderboardResult.Leaderboard)
     {
         GameObject newEntry = Instantiate(LeaderboardEntryPrefab, entriesContainer.transform);
         newEntry.GetComponent <LeaderboardEntry>().Init(entry.Position + 1, entry.DisplayName, entry.StatValue);
     }
 }
Exemple #13
0
    void DebugLogLeaderboard(GetLeaderboardResult result)
    {
        var stringBuilder = new StringBuilder();

        foreach (var entry in result.Leaderboard)
        {
            stringBuilder.AppendFormat("{0}:{1}:{2}:{3}\n", entry.Position, entry.StatValue, entry.PlayFabId, entry.DisplayName);
        }
        Debug.Log(stringBuilder);
    }
 //排行榜数据获取成功后调用此函数,在界面显示排行榜信息
 void OnGetLeaderboard(GetLeaderboardResult result)
 {
     leaderboard.Clear();            //清空排行榜数据
     //填入排行榜数据
     foreach (PlayerLeaderboardEntry entry in result.Leaderboard)
     {
         leaderboard.Add(entry.DisplayName, (uint)entry.StatValue);
     }
     SetLeadboard();                 //设置排行榜界面
 }
    public void GetLeaderboardCallback(GetLeaderboardResult result)
    {
        _scrollRect.vertical = true;
        //_filterSlider.interactable = true; // this version doesn't need slider

        if (result.Leaderboard.Count < _maxResultsCount)
        {
            _canLoadMoreEntries = false;
        }

        foreach (PlayerLeaderboardEntry playerEntry in result.Leaderboard)
        {
            LeaderboardEntry entry = Instantiate(_entryPrefab.gameObject, _leaderboardEntryParent)
                                     .GetComponent <LeaderboardEntry>();

            int width  = 100;
            int height = 100;

            entry.SetUserPosition(playerEntry.Position + 1);
            entry.SetUserScore(playerEntry.StatValue.ToString());

            if (playerEntry.DisplayName == FacebookAndPlayFabManager.Instance.FacebookUserId)
            {
                //entry.SetUserName(FacebookAndPlayFabManager.Instance.FacebookUserName);
                entry.SetUserName("Yongxuan Li");
                entry.SetUserPictureSprite(FacebookAndPlayFabManager.Instance.FacebookUserPictureSprite);
            }
            else
            {
                FacebookAndPlayFabManager.Instance.GetFacebookUserName(playerEntry.DisplayName,
                                                                       res => { entry.SetUserName(res.ResultDictionary["name"].ToString()); });

                FacebookAndPlayFabManager.Instance.GetFacebookUserPicture(playerEntry.DisplayName, width, height,
                                                                          res =>
                {
                    entry.SetUserPictureSprite(ImageUtils.CreateSprite(res.Texture,
                                                                       new Rect(0, 0, width, height), Vector2.zero));
                });

                // ATTENTION:
                // If you're having trouble getting the profile picture please comment the call above and uncomment the following.

                //FacebookAndPlayFabManager.Instance.GetFacebookUserPictureFromUrl(playerEntry.DisplayName, width, height, res =>
                //{
                //    StartCoroutine(FacebookAndPlayFabManager.Instance.GetTextureFromGraphResult(res, tex =>
                //    {
                //        entry.SetUserPictureSprite(Sprite.Create(tex, new Rect(0, 0, width, height), Vector2.zero));
                //    }));
                //});
            }

            _entries++;
        }
    }
 private void OnGetLeaderboard(GetLeaderboardResult result)
 {
     _leaderboardView.Clear();
     for (int i = 0; i < result.Leaderboard.Count; i++)
     {
         PlayerLeaderboardEntry entry = result.Leaderboard[i];
         int             position     = entry.Position + 1;
         LeaderboardItem item         = new LeaderboardItem(position, entry.DisplayName, entry.StatValue);
         _leaderboardView.AddItem(item);
     }
 }
Exemple #17
0
 void OnGetLeaderboard(GetLeaderboardResult result)
 {
     foreach (PlayerLeaderboardEntry player in result.Leaderboard)
     {
         GameObject tempListing = Instantiate(listingPrefab, listingContainer);
         Listening  LL          = tempListing.GetComponent <Listening>();
         LL.Name.text  = player.DisplayName;
         LL.Score.text = player.StatValue.ToString();
         Debug.Log(player.DisplayName + ": " + player.StatValue);
     }
 }
    private void OnLeaderboardGet(GetLeaderboardResult result)
    {
        List <PlayerResult> leaderboard = new List <PlayerResult>();

        foreach (var item in result.Leaderboard)
        {
            leaderboard.Add(new PlayerResult(item.DisplayName, item.StatValue));
        }

        OnLeaderboardDataFormed.Invoke(leaderboard);
    }
 private void GetLeaderboard(GetLeaderboardResult result)
 {
     leadeboardPanel.SetActive(true);
     foreach (var player in result.Leaderboard)
     {
         var tempMember = Instantiate(leadeboardMemberPrefab, membersGroup);
         var lmemb      = tempMember.GetComponent <LeaderboardMember>();
         lmemb.PlayerNameText.text = player.DisplayName;
         lmemb.PlayerScore.text    = player.StatValue.ToString();
     }
 }
 public void GetClientLbCallback(GetLeaderboardResult result)
 {
     if (result.Leaderboard.Count > 0)
     {
         lastReceivedMessage = "Get Client Leaderboard Successful";
     }
     else
     {
         lastReceivedMessage = "Get Client Leaderboard, empty";
     }
 }
Exemple #21
0
    private void OnGetLeaderboardSuccess(GetLeaderboardResult result)
    {
        Debug.Log($"ランキング(リーダーボード)の取得に成功しました");

        //result.Leaderboardに各順位の情報(PlayerLeaderboardEntry)が入っている
        _rankingText.text = "";
        foreach (var entry in result.Leaderboard)
        {
            _rankingText.text += $"\n順位 : {entry.Position}, スコア : {entry.StatValue}, 名前 : {entry.DisplayName}";
        }
    }
 private void leaderboardresult(GetLeaderboardResult result)
 {
     Leaderboard.SetActive(true);
     maincanvas.SetActive(false);
     foreach (PlayerLeaderboardEntry player in result.Leaderboard)
     {
         GameObject      templisting = Instantiate(LeaderboardListing, ListingContainer);
         LeaderboardList LL          = templisting.GetComponent <LeaderboardList>();
         LL.playername.text = player.DisplayName;
         LL.score.text      = player.StatValue.ToString();
     }
 }
Exemple #23
0
 public void OngetLederboard(GetLeaderboardResult result)
 {
     // leaderboardpanel.SetActive(true);
     // foreach (PlayerLeaderboardEntry player in result.Leaderboard)
     // {
     //     GameObject templisting = Instantiate(listingprefab, listingcontainer);
     //     Lederboarllisting LL = templisting.GetComponent<Lederboarllisting>();
     //     LL.playernametext.text = player.DisplayName;
     //     LL.playerScore.text = player.StatValue.ToString();
     //     Debug.Log(player.DisplayName + ": " + player.StatValue);
     // }
 }
Exemple #24
0
 void OnGetLeaderboardSuccess(GetLeaderboardResult result)
 {
     foreach (PlayerLeaderboardEntry player in result.Leaderboard)
     {
         GameObject leList = Instantiate(leaderList);
         leList.transform.SetParent(leaderListParent.transform);
         leList.transform.localScale = Vector3.one;
         leList.transform.Find("name-txt").GetComponent <Text>().text  = player.DisplayName;
         leList.transform.Find("score-txt").GetComponent <Text>().text = player.StatValue.ToString();
         Debug.Log(player.DisplayName + " ==== " + player.StatValue + " ===== " + player.Position);
     }
 }
Exemple #25
0
    private static void OnSuccess(GetLeaderboardResult result)
    {
        StringBuilder stringBuilder = new StringBuilder();

        foreach (PlayerLeaderboardEntry playerLeaderboardEntry in result.Leaderboard)
        {
            stringBuilder.Append("********************\n");
            stringBuilder.AppendFormat("Position: {0}\n", playerLeaderboardEntry.Position);
            stringBuilder.AppendFormat("Name: {0}\n", playerLeaderboardEntry.DisplayName);
            stringBuilder.AppendFormat("Score: {0}\n", playerLeaderboardEntry.StatValue);
            stringBuilder.Append("\n");
        }
    }
    void OnGetLeadboard(GetLeaderboardResult result)
    {
        leaderboardPanel.SetActive(true);

        //Debug.Log(result.Leaderboard[0].StatValue);
        foreach (PlayerLeaderboardEntry player in result.Leaderboard)
        {
            //Debug.Log(player.DisplayName + ": " + player.StatValue);

            LeaderboardData leaderboardData = new LeaderboardData(player.DisplayName, player.StatValue);
            LeaderBoardUI.Instance.MyLeaderboards.Add(leaderboardData);
        }
    }
 private static void OnGetLeaderboard(GetLeaderboardResult result, string name)
 {
     Debug.Log("retrieved leaderboard " + name);
     if (name == "Highscore")
     {
         GameManager.manager.c.highscoreLeaderboard = result.Leaderboard;
     }
     if (name == "TotalLinesCleared")
     {
         GameManager.manager.c.totalLinesClearedLeaderboard = result.Leaderboard;
     }
     GameManager.manager.isLoading = false;
 }
Exemple #28
0
 void OnGetLeaderboard(GetLeaderboardResult result)
 {
     //leaderBoardPanel.SetActive(true);
     //Debug.Log(result.Leaderboard[0].StatValue);
     foreach (PlayerLeaderboardEntry player in result.Leaderboard)
     {
         GameObject     tempListing = Instantiate(ListingPrefab, listingContainer);
         ListingPrefabb LL          = tempListing.GetComponent <ListingPrefabb>();
         LL.playerNameText.text  = player.DisplayName;
         LL.playerScoreText.text = player.StatValue.ToString();
         Debug.Log(player.DisplayName + ": " + player.StatValue);
     }
 }
 private void OnLeaderboardGet(GetLeaderboardResult result)
 {
     m_LeaderboardStatistics.Clear();
     foreach (Transform child in content.transform)
     {
         Destroy(child.gameObject);
     }
     foreach (var item in result.Leaderboard)
     {
         m_LeaderboardStatistics.Add(Instantiate(leaderboardStatisticPrefab, content));
         SetLeaderboard(item.Position, item.DisplayName, item.StatValue);
         Debug.Log(string.Format(("{0} {1} {2}"), item.Position, item.DisplayName, item.StatValue));
     }
 }
Exemple #30
0
    void OnGetLeaderboard(GetLeaderboardResult result)
    {
        List <MenuManager.LeaderboardEntry> entries = new List <MenuManager.LeaderboardEntry>();

        foreach (PlayerLeaderboardEntry entry in result.Leaderboard)
        {
            MenuManager.LeaderboardEntry nuEntry = new MenuManager.LeaderboardEntry {
                name = entry.DisplayName, score = entry.StatValue
            };
            entries.Add(nuEntry);
        }

        MenuManager.instance.BuildLeaderboardSuccess(entries.ToArray());
    }