コード例 #1
0
 private void UpdateSteamAvatar(ulong steamID)
 {
     if (!isServer)
     {
         SteamID = steamID;
     }
     Debug.Log($"SetSteamAvatar {steamID}");
     _avatar.SteamId = steamID;
     _avatar.Size    = Friends.AvatarSize.Large;
     _avatar.Fetch(steamID);
 }
コード例 #2
0
    IEnumerator Start()
    {
        //
        // Wait for client to start up
        //
        while (Client.Instance == null)
        {
            yield return(null);
        }


        Client.Instance.OnAnyCallback += DebugPrintSteamCallback;

        YourAvatar.Fetch(Client.Instance.SteamId);

        //
        // Request a list of servers
        //
        {
            serverRequest = Client.Instance.ServerList.Internet();
        }

        //
        // Request a leaderboard
        //
        {
            leaderBoard = Client.Instance.GetLeaderboard("TestLeaderboard", Client.LeaderboardSortMethod.Ascending, Client.LeaderboardDisplayType.Numeric);
        }

        //
        // Chang to random avatar every 20 seconds, to test callbacks
        //
        while (true)
        {
            ulong steamid = 76561197960279927 + (ulong)UnityEngine.Random.Range(0, 100000);

            foreach (var a in RandomAvatar)
            {
                a.Fetch(steamid);
            }

            yield return(new WaitForSeconds(11));
        }
    }