Ejemplo n.º 1
0
        internal void InternalPersonaStateChanged(SteamPlayer player, EOnlinePlayerChangedFlags flags)
        {
            if (player.isUpdatePending)
            {
                return;
            }

            if (DispatchAsyncPlayerGetCallbacks(player))
            {
                player.Dispose();
            }

            player.InvokePlayerChangedCallbacks(flags);

            if (_changedCallbacks != null)
            {
                if (_changedCallbacks.Count > 0)
                {
                    player.CheckDisposed();
                }
                for (int i = _changedCallbacks.Count - 1; i >= 0; --i)
                {
                    _changedCallbacks[i](player, flags);
                }
            }
        }
Ejemplo n.º 2
0
        void FriendshipChanged(SteamPlayer player, EOnlinePlayerChangedFlags flags)
        {
            bool doCallbacks = false;
            bool dispose     = false;

            if ((flags & EOnlinePlayerChangedFlags.FriendAdded) != 0)
            {
                if (!_friends.Contains(player))
                {
                    player.AddRef();
                    _friends.Add(player);
                    _friendSet.Add(player.id.uuid);
                    doCallbacks = true;
                }
            }
            else if (_friends.Remove(player))
            {
                _friendSet.Remove(player.id.uuid);
                doCallbacks = true;
                dispose     = true;
            }

            if (doCallbacks)
            {
                for (int i = _friendChangedCallbacks.Count - 1; i >= 0; --i)
                {
                    _friendChangedCallbacks[i](player, flags);
                }
            }

            if (dispose)
            {
                player.Dispose();
            }
        }
Ejemplo n.º 3
0
 internal void InternalUnregisterPlayer(SteamPlayer player)
 {
     if (player == _localPlayer)
     {
         _localPlayer = null;
     }
     _players.Remove(player.id.uuid);
     _pendingAsyncPlayerGets.Remove(player.id.uuid);
 }
Ejemplo n.º 4
0
        internal bool DispatchAsyncPlayerGetCallbacks(SteamPlayer player)
        {
            List <OnlinePlayerChangedDelegate> callbacks;

            if (_pendingAsyncPlayerGets.TryGetValue(player.id.uuid, out callbacks))
            {
                _pendingAsyncPlayerGets.Remove(player.id.uuid);
                for (int i = 0; i < callbacks.Count; ++i)
                {
                    callbacks[i](player, EOnlinePlayerChangedFlags.Name | EOnlinePlayerChangedFlags.Status);
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 5
0
        internal void GetSmallAvatar(SteamPlayer player, bool raiseEvent)
        {
            var index = SteamFriends.GetSmallFriendAvatar(player.steamID);

            if (index < 1)
            {
                return;
            }
            uint w, h;

            if (SteamUtils.GetImageSize(index, out w, out h))
            {
                LoadPlayerAvatar(player, index, (int)w, (int)h, raiseEvent);
            }
        }
Ejemplo n.º 6
0
        internal SteamPlayer CreateSteamPlayer(CSteamID id)
        {
            var player = GetSteamPlayer(id);

            if (player == null)
            {
                player = new SteamPlayer(this, id, null);
                if (!SteamFriends.RequestUserInformation(id, false))
                {
                    player.InternalPersonaReady();
                }
            }

            return(player);
        }
Ejemplo n.º 7
0
 void LoadPlayerAvatar(SteamPlayer player, int id, int width, int height, bool raiseEvent)
 {
     if (width == 32)
     {
         player.ReleaseSmallAvatar();
         player.smallAvatar = GetSteamAvatar(id, width, height);
         if (raiseEvent && (player.smallAvatar != null))
         {
             InternalPersonaStateChanged(player, EOnlinePlayerChangedFlags.Avatar);
         }
     }
     else
     {
         player.ReleaseLargeAvatar();
         player.largeAvatar = GetSteamAvatar(id, width, height);
         if (raiseEvent && (player.largeAvatar != null))
         {
             InternalPersonaStateChanged(player, EOnlinePlayerChangedFlags.Avatar);
         }
     }
 }
Ejemplo n.º 8
0
 internal void InternalRegisterPlayer(SteamPlayer player)
 {
     _players.Add(player.id.uuid, player);
 }
Ejemplo n.º 9
0
 internal void SendLobbyInvite(SteamPlayer player, uint lobbyID)
 {
     SteamFriends.InviteUserToGame(player.steamID, "+connect_lobby " + lobbyID);
 }