public void SetUser(uint userId)
 {
     if (user == null || user.GetIdUInt32() != userId)
     {
         user = SteamController.steamInScene.GetFriendWithAccountId(userId);
         SteamController.steamInScene.RequestFriendChatHistory(user.GetIdUInt64());
     }
 }
Example #2
0
        /// <summary>
        /// Sets and registeres for the provided <see cref="HeathenEngineering.SteamApi.Foundation.SteamUserData"/> object.
        /// </summary>
        /// <param name="newUserData">The user to connect to and to display the avatar for.</param>
        /// <example>
        /// <list type="bullet">
        /// <item>
        /// <description>Set the icon to display the current user as read from the SteamSettings settings member.</description>
        /// <code>
        /// myUserFullIcon.LinkSteamUser(settings.UserData);
        /// </code>
        /// </item>
        /// </list>
        /// </example>
        public void LinkSteamUser(SteamUserData newUserData)
        {
            if (userData != null)
            {
                if (userData.OnAvatarChanged != null)
                {
                    userData.OnAvatarChanged.RemoveListener(handleAvatarChange);
                }
                if (userData.OnStateChange != null)
                {
                    userData.OnStateChange.RemoveListener(handleStateChange);
                }
                if (userData.OnNameChanged != null)
                {
                    userData.OnNameChanged.RemoveListener(handleNameChanged);
                }
                if (userData.OnAvatarLoaded != null)
                {
                    userData.OnAvatarLoaded.RemoveListener(handleAvatarChange);
                }
            }

            userData = newUserData;
            handleAvatarChange();
            handleNameChanged();
            handleStateChange();

            if (userData != null)
            {
                if (!userData.iconLoaded)
                {
                    steamSettings.client.RefreshAvatar(userData);
                }

                avatar.texture = userData.avatar;
                if (userData.OnAvatarChanged == null)
                {
                    userData.OnAvatarChanged = new UnityEngine.Events.UnityEvent();
                }
                userData.OnAvatarChanged.AddListener(handleAvatarChange);
                if (userData.OnStateChange == null)
                {
                    userData.OnStateChange = new UnityEngine.Events.UnityEvent();
                }
                userData.OnStateChange.AddListener(handleStateChange);
                if (userData.OnNameChanged == null)
                {
                    userData.OnNameChanged = new UnityEngine.Events.UnityEvent();
                }
                userData.OnNameChanged.AddListener(handleNameChanged);
                if (userData.OnAvatarLoaded == null)
                {
                    userData.OnAvatarLoaded = new UnityEngine.Events.UnityEvent();
                }
                userData.OnAvatarLoaded.AddListener(handleAvatarChange);
            }
        }
Example #3
0
 private void RpcUpdateSteamUserData(ulong SteamId)
 {
     //The server recieved the Steam ID
     SteamUser = steamSettings.client.GetUserData(new CSteamID(SteamId));
     //This is the Steam User's name as it appears in Steam social contexts
     UserName = SteamUser.DisplayName;
     //This is the Steam User's avatar e.g. the profile image
     Avatar           = SteamUser.avatar;
     rawImage.texture = SteamUser.avatar;
     //And this is the Steam User's ID e.g the number which represents the profile
     this.SteamId = SteamUser.id.m_SteamID;
 }
        /// <summary>
        /// This is called when the SteamId updates for this user
        /// The HandleSteamIdUpdate method calls it and that method is called by the network system when the steamId field is updated.
        /// </summary>
        private void SetSteamIconData()
        {
            //If its an invalid ID dont bother doign anything
            if (steamId == CSteamID.Nil.m_SteamID)
            {
                return;
            }

            authorityUser = steamSettings.client.GetUserData(new CSteamID(steamId));
            SteamIcon.LinkSteamUser(authorityUser);

            Debug.Log("Linking persona data for: [" + steamId.ToString() + "] " + (string.IsNullOrEmpty(authorityUser.DisplayName) ? "Unknown User" : authorityUser.DisplayName));
        }
Example #5
0
        /// <summary>
        /// Creates a new editor tool to update a given UGC item.
        /// This will assume the file ID and AppID of the itemDetails provided.
        /// </summary>
        /// <param name="itemDetails">The details of the item to update</param>
        public SteamworksWorkshopItemEditorTool(HeathenWorkshopReadCommunityItem itemDetails)
        {
            m_SubmitItemUpdateResult = CallResult <SubmitItemUpdateResult_t> .Create(HandleItemUpdated);

            m_CreatedItem = CallResult <CreateItemResult_t> .Create(HandleItemCreate);

            m_RemoteStorageDownloadUGCResult = CallResult <RemoteStorageDownloadUGCResult_t> .Create(HandleUGCDownload);

            TargetApp            = itemDetails.TargetApp;
            FileId               = itemDetails.FileId;
            Title                = itemDetails.Title;
            Description          = itemDetails.Description;
            Visibility           = itemDetails.Visibility;
            Author               = SteamSettings.current.client.GetUserData(itemDetails.Author);
            previewImage         = itemDetails.previewImage;
            PreviewImageLocation = itemDetails.PreviewImageLocation;
        }
Example #6
0
        /// <summary>
        /// Creates a new editor tool to update a given UGC item.
        /// This will assume the file ID and AppID of the itemDetails provided.
        /// </summary>
        /// <param name="itemDetails">The details of the item to update</param>
        public SteamworksWorkshopItemEditorTool(SteamUGCDetails_t itemDetails)
        {
            m_SubmitItemUpdateResult = CallResult <SubmitItemUpdateResult_t> .Create(HandleItemUpdated);

            m_CreatedItem = CallResult <CreateItemResult_t> .Create(HandleItemCreate);

            m_RemoteStorageDownloadUGCResult = CallResult <RemoteStorageDownloadUGCResult_t> .Create(HandleUGCDownload);

            TargetApp   = itemDetails.m_nConsumerAppID;
            FileId      = itemDetails.m_nPublishedFileId;
            Title       = itemDetails.m_rgchTitle;
            Description = itemDetails.m_rgchDescription;
            Visibility  = itemDetails.m_eVisibility;
            Author      = SteamSettings.current.client.GetUserData(itemDetails.m_ulSteamIDOwner);
            var previewCall = SteamRemoteStorage.UGCDownload(itemDetails.m_hPreviewFile, 1);

            m_RemoteStorageDownloadUGCResult.Set(previewCall, HandleUGCDownload);
        }
Example #7
0
        private void HandleItemCreate(CreateItemResult_t param, bool bIOFailure)
        {
            if (bIOFailure)
            {
                CreateFailed.Invoke(param);
            }
            else
            {
                Author = SteamSettings.current.client.GetUserData(SteamUser.GetSteamID());
                FileId = param.m_nPublishedFileId;
                Created.Invoke(param);
            }

            if (processingCreateAndUpdate)
            {
                processingCreateAndUpdate = false;
                Update(processingChangeNote);
                processingChangeNote = string.Empty;
            }
        }
Example #8
0
        /// <summary>
        /// Sets and registeres for the provided <see cref="HeathenEngineering.SteamApi.Foundation.SteamUserData"/> object.
        /// </summary>
        /// <param name="newUserData">The user to connect to and to display the avatar for.</param>
        /// <example>
        /// <list type="bullet">
        /// <item>
        /// <description>Set the icon to display the current user as read from the SteamSettings settings member.</description>
        /// <code>
        /// myAvatarRawImage.LinkSteamUser(settings.UserData);
        /// </code>
        /// </item>
        /// </list>
        /// </example>
        public void LinkSteamUser(SteamUserData newUserData)
        {
            if (userData != null)
            {
                userData.OnAvatarChanged.RemoveListener(handleAvatarChange);
            }

            userData = newUserData;

            if (userData != null)
            {
                if (image == null)
                {
                    image = GetComponent <UnityEngine.UI.RawImage>();
                }

                image.texture = userData.avatar;
                userData.OnAvatarChanged.AddListener(handleAvatarChange);
            }
        }
Example #9
0
        private Applist MapSteamUserDataAppIDsToApplistIDs(SteamUserData userData)
        {
            SetupAppList();
            var appList = new Applist {
                Apps = new List <SteamApp>()
            };
            SteamApp app;

            foreach (var game in userData.Response.Games)
            {
                app = _steamApplist.Apps.FirstOrDefault(item => item.Appid == game.Appid) ?? new SteamApp {
                    Appid = 0, Name = "Not Found"
                };

                appList.Apps.Add(new SteamApp
                {
                    Appid = game.Appid,
                    Name  = app.Name
                });
            }
            return(appList);
        }
Example #10
0
 public SteamworksLobbyMember(CSteamID lobbyId, CSteamID userId)
 {
     this.lobbyId = lobbyId;
     userData     = SteamSettings.current.client.GetUserData(userId);
 }
Example #11
0
 /// <summary>
 /// <para>Determins if the result handle belongs to the user</para>
 /// </summary>
 /// <param name="resultHandle">The inventory result handle to check the user on</param>
 /// <param name="user">The user to check against</param>
 public bool CheckUserResult(SteamInventoryResult_t resultHandle, SteamUserData user)
 {
     return(SteamworksPlayerInventory.CheckResultSteamID(resultHandle, user));
 }
 public void ClearUser()
 {
     user = null;
     avatar.accountImage.sprite = null;
     ChatMessagePool.ReturnAll();
 }
Example #13
0
 private void SteamInScene_onUserStateChanged(SteamUserData user)
 {
     TaskManagerController.RunAction(UpdateFriendList);
 }