public void Initialize()
    {
        if (!SteamManager.initializedMain)
        {
            return;
        }

        m_GameRichPresenceJoinRequested = Steamworks.Callback <GameRichPresenceJoinRequested_t> .Create(OnGameRichPresenceJoinRequested);

        m_PersonaStateChange = Steamworks.Callback <PersonaStateChange_t> .Create(OnPersonaStateChange);

        EFriendFlags friendFlags  = EFriendFlags.k_EFriendFlagImmediate;
        int          friendsCount = SteamFriends.GetFriendCount(friendFlags);

        for (int friendIndex = 0; friendIndex < friendsCount; ++friendIndex)
        {
            CSteamID friendSteamId = SteamFriends.GetFriendByIndex(friendIndex, friendFlags);

            if (!friendSteamId.IsValid())
            {
                continue;
            }

            SteamFriend steamFriend = new SteamFriend(friendSteamId);
            m_Friends.Add(friendSteamId, steamFriend);
        }
    }
Exemple #2
0
        public FriendCollection GetFriends()
        {
            EFriendFlags flags = (
                EFriendFlags.k_EFriendFlagImmediate |
                EFriendFlags.k_EFriendFlagRequestingFriendship |
                EFriendFlags.k_EFriendFlagFriendshipRequested
                );
            int friendCount            = SteamFriends.GetFriendCount(flags);
            List <FriendGamer> friends = new List <FriendGamer>(friendCount);

            for (int i = 0; i < friendCount; i += 1)
            {
                CSteamID            id           = SteamFriends.GetFriendByIndex(i, flags);
                EFriendRelationship relationship = SteamFriends.GetFriendRelationship(id);
                EPersonaState       state        = SteamFriends.GetFriendPersonaState(id);
                FriendGameInfo_t    whoCares;
                friends.Add(new FriendGamer(
                                id,
                                SteamFriends.GetFriendPersonaName(id),
                                SteamFriends.GetPlayerNickname(id),
                                state != EPersonaState.k_EPersonaStateOffline,
                                SteamFriends.GetFriendGamePlayed(id, out whoCares),
                                state == EPersonaState.k_EPersonaStateAway,
                                state == EPersonaState.k_EPersonaStateBusy,
                                relationship == EFriendRelationship.k_EFriendRelationshipRequestRecipient,
                                relationship == EFriendRelationship.k_EFriendRelationshipRequestInitiator
                                ));
            }
            return(new FriendCollection(friends));
        }
        void GetFriends(EFriendFlags flags)
        {
            int numFriends = SteamFriends.GetFriendCount(flags);

            for (int i = 0; i < numFriends; ++i)
            {
                var friend = CreateSteamPlayer(SteamFriends.GetFriendByIndex(i, flags));
                _friends.Add(friend);
                _friendSet.Add(friend.id.uuid);
            }
        }
Exemple #4
0
        public override void RequestFriendLobbyData()
        {
            EFriendFlags flags = EFriendFlags.k_EFriendFlagImmediate;
            int          count = SteamFriends.GetFriendCount(flags);

            for (int i = 0; i < count; i++)
            {
                if (SteamFriends.GetFriendGamePlayed(SteamFriends.GetFriendByIndex(i, flags), out FriendGameInfo_t gameInfo) && !(gameInfo.m_gameID.AppID() != SteamUtils.GetAppID()))
                {
                    SteamMatchmaking.RequestLobbyData(gameInfo.m_steamIDLobby);
                }
            }
        }
Exemple #5
0
        internal FriendPages(uint userId)
        {
            var accID = LoginService.SteamId.GetAccountID().m_AccountID;

            if (userId != accID)
            {
                throw new NotSupportedException(
                          "GetFriendsAsync() can currently only check the friends of the LocalPlayer.");
            }

            _steamId = new CSteamID(new AccountID_t(userId), EUniverse.k_EUniversePublic,
                                    EAccountType.k_EAccountTypeIndividual);
            _friendFlags = EFriendFlags.k_EFriendFlagImmediate | EFriendFlags.k_EFriendFlagBlocked;
            if ((_friendCount = SteamFriends.GetFriendCount(_friendFlags)) == 0)
            {
                IsFinished = true;
            }
        }
    void PopulateFriendList()
    {
        for (int i = 0; i < friendDisplayParent.transform.childCount; i++)
        {
            Destroy(friendDisplayParent.transform.GetChild(i).gameObject);
        }

        EFriendFlags flag = EFriendFlags.k_EFriendFlagAll;

        for (int i = 0; i < SteamFriends.GetFriendCount(flag); i++)
        {
            if (SteamFriends.GetFriendPersonaState(SteamFriends.GetFriendByIndex(i, flag)) != EPersonaState.k_EPersonaStateOffline)
            {
                GameObject friendButton = Instantiate(friendDisplayPrefab, friendDisplayParent.transform);
                friendButton.GetComponent <FriendDisplay>().SetFriendName(SteamFriends.GetFriendPersonaName(SteamFriends.GetFriendByIndex(i, flag)), SteamFriends.GetFriendByIndex(i, flag).m_SteamID.ToString());
                //print(SteamFriends.GetFriendPersonaName(SteamFriends.GetFriendByIndex(i, EFriendFlags.k_EFriendFlagAll)) + " " + SteamFriends.GetFriendByIndex(i, EFriendFlags.k_EFriendFlagAll).m_SteamID);
            }
        }
    }
 public CSteamID GetFriendByIndex(Int32 iFriend, EFriendFlags iFriendFlags)
 {
     UInt64 ret = 0; this.GetFunction <NativeGetFriendByIndexIE>(this.Functions.GetFriendByIndex4)(this.ObjectAddress, ref ret, iFriend, iFriendFlags); return(new CSteamID(ret));
 }
Exemple #8
0
 /// returns true if the specified user meets any of the criteria specified in iFriendFlags
 /// iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values
 public static bool HasFriend(CSteamID steamIDFriend, EFriendFlags iFriendFlags)
 {
     return(false);
 }
Exemple #9
0
 internal Friends(EFriendFlags friendFlags)
 {
     this._friends     = Friends.SteamUnityAPI_SteamFriends();
     this._friendFlags = friendFlags;
 }
Exemple #10
0
 internal Friends()
 {
     this._friends     = Friends.SteamUnityAPI_SteamFriends();
     this._friendFlags = EFriendFlags.k_EFriendFlagImmediate;
 }
 public static int GetFriendCount(EFriendFlags iFriendFlags) => default;                     // 0x000000018094EDE0-0x000000018094EE30
 public static CSteamID GetFriendByIndex(int iFriend, EFriendFlags iFriendFlags) => default; // 0x000000018094EC00-0x000000018094ECA0
Exemple #12
0
 /// <summary>
 /// <para> friend iteration</para>
 /// <para> takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria</para>
 /// <para> then GetFriendByIndex() can then be used to return the id's of each of those users</para>
 /// </summary>
 public static int GetFriendCount(EFriendFlags iFriendFlags)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamFriends_GetFriendCount(iFriendFlags));
 }
		public static extern bool ISteamFriends_HasFriend(CSteamID steamIDFriend, EFriendFlags iFriendFlags);
		public static extern int ISteamFriends_GetFriendCount(EFriendFlags iFriendFlags);
 public bool HasFriend(CSteamID steamIDFriend, EFriendFlags eFriendFlags)
 {
     return(this.GetFunction <NativeHasFriendCE>(this.Functions.HasFriend11)(this.ObjectAddress, steamIDFriend.ConvertToUint64(), eFriendFlags));
 }
Exemple #16
0
 /// friend iteration
 /// takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria
 /// then GetFriendByIndex() can then be used to return the id's of each of those users
 public static int GetFriendCount(EFriendFlags iFriendFlags)
 {
     return(0);
 }
Exemple #17
0
 /// returns the steamID of a user
 /// iFriend is a index of range [0, GetFriendCount())
 /// iFriendsFlags must be the same value as used in GetFriendCount()
 /// the returned CSteamID can then be used by all the functions below to access details about the user
 public static CSteamID GetFriendByIndex(int iFriend, EFriendFlags iFriendFlags)
 {
     return((CSteamID)0);
 }
 public Int32 GetFriendCount(EFriendFlags eFriendFlags)
 {
     return(this.GetFunction <NativeGetFriendCountE>(this.Functions.GetFriendCount3)(this.ObjectAddress, eFriendFlags));
 }
		/// <summary>
		/// <para> returns true if the specified user meets any of the criteria specified in iFriendFlags</para>
		/// <para> iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values</para>
		/// </summary>
		public static bool HasFriend(CSteamID steamIDFriend, EFriendFlags iFriendFlags) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamFriends_HasFriend(steamIDFriend, iFriendFlags);
		}
		public static extern ulong ISteamFriends_GetFriendByIndex(int iFriend, EFriendFlags iFriendFlags);
		/// <summary>
		/// <para> friend iteration</para>
		/// <para> takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria</para>
		/// <para> then GetFriendByIndex() can then be used to return the id's of each of those users</para>
		/// </summary>
		public static int GetFriendCount(EFriendFlags iFriendFlags) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamFriends_GetFriendCount(iFriendFlags);
		}
Exemple #22
0
 /// <summary>
 /// <para> returns true if the specified user meets any of the criteria specified in iFriendFlags</para>
 /// <para> iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values</para>
 /// </summary>
 public static bool HasFriend(CSteamID steamIDFriend, EFriendFlags iFriendFlags)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamFriends_HasFriend(steamIDFriend, iFriendFlags));
 }
		/// <summary>
		/// <para> returns the steamID of a user</para>
		/// <para> iFriend is a index of range [0, GetFriendCount())</para>
		/// <para> iFriendsFlags must be the same value as used in GetFriendCount()</para>
		/// <para> the returned CSteamID can then be used by all the functions below to access details about the user</para>
		/// </summary>
		public static CSteamID GetFriendByIndex(int iFriend, EFriendFlags iFriendFlags) {
			InteropHelp.TestIfAvailableClient();
			return (CSteamID)NativeMethods.ISteamFriends_GetFriendByIndex(iFriend, iFriendFlags);
		}
Exemple #24
0
 /// <summary>
 /// <para> returns the steamID of a user</para>
 /// <para> iFriend is a index of range [0, GetFriendCount())</para>
 /// <para> iFriendsFlags must be the same value as used in GetFriendCount()</para>
 /// <para> the returned CSteamID can then be used by all the functions below to access details about the user</para>
 /// </summary>
 public static CSteamID GetFriendByIndex(int iFriend, EFriendFlags iFriendFlags)
 {
     InteropHelp.TestIfAvailableClient();
     return((CSteamID)NativeMethods.ISteamFriends_GetFriendByIndex(iFriend, iFriendFlags));
 }
 public static EPersonaState GetPersonaState() => default;                                   // 0x000000018094F790-0x000000018094F7E0
 public static int GetFriendCount(EFriendFlags iFriendFlags) => default;                     // 0x000000018094EDE0-0x000000018094EE30