예제 #1
0
 public WorkshopItem(SteamUGCDetails_t details)
 {
     //details.m_bAcceptedForUse;
     //details.m_bBanned;
     //details.m_bTagsTruncated;
     //details.m_eFileType;
     //details.m_eResult;
     //details.m_eVisibility;
     //details.m_flScore;
     //details.m_hFile;
     //details.m_hPreviewFile;
     //details.m_nConsumerAppID;
     //details.m_nCreatorAppID;
     //details.m_nFileSize;
     //details.m_nPreviewFileSize;
     //details.m_nPublishedFileId;
     //details.m_pchFileName;
     this.description = details.m_rgchDescription;
     //details.m_rgchTags;
     this.title = details.m_rgchTitle;
     this.url   = details.m_rgchURL;
     //details.m_rtimeAddedToUserList;
     //details.m_rtimeCreated;
     //details.m_rtimeUpdated;
     //details.m_ulSteamIDOwner;
     //details.m_unNumChildren;
     //details.m_unVotesDown;
     //details.m_unVotesUp;
 }
예제 #2
0
 /// <summary>
 /// Fills in the required mod info from Steam.
 /// </summary>
 /// <param name="details">The mod details.</param>
 internal void Populate(SteamUGCDetails_t details)
 {
     state     = SteamModState.DetailsDirty;
     ugcMod    = new SteamUGCService.Mod(details, ugcMod?.previewImage);
     fileId    = details.m_hFile;
     previewId = details.m_hPreviewFile;
 }
    public void CallBackSendQuery(SteamUGCQueryCompleted_t pCallback, bool bIOFailure)
    {
        try
        {
            if (pCallback.m_eResult == EResult.k_EResultOK)
            {
                uint count = pCallback.m_unNumResultsReturned;
                uint index = _StartIndex % 50;
                if (count - index > _Count)
                {
                    count = _Count;
                }
                SteamUGCDetails_t detail = new SteamUGCDetails_t();
                for (uint i = index; i < count + index; i++)
                {
                    SteamUGC.GetQueryUGCResult(_UGCQueryHandle, i, out detail);
                    _FileIDLsit.Add(detail.m_nPublishedFileId);
                    Debug.LogWarning("CallBackSendQuery PublishedFileId_t " + i.ToString() + " = " + detail.m_nPublishedFileId);
                }

                Finish(_FileIDLsit, (int)pCallback.m_unTotalMatchingResults, _StartIndex, true);
            }
            else
            {
                Finish(null, 0, _StartIndex, false);
            }
        }
        catch (Exception)
        {
            Finish(null, 0, _StartIndex, false);
        }
    }
예제 #4
0
 public WorkshopLevel(SteamUGCDetails_t details)
 {
     this.displayName = details.m_rgchTitle;
     this.url         = details.m_rgchURL;
     this.description = details.m_rgchDescription;
     this.author      = new SteamUser(details.m_ulSteamIDOwner);
     this.fileName    = details.m_pchFileName;
     this.fileName    = this.fileName.Substring(0, fileName.Length - 6);
 }
예제 #5
0
        internal static Item From(SteamUGCDetails_t details)
        {
            Item item = new Item()
            {
                _id     = details.PublishedFileId,
                details = details,
                Tags    = details.Tags.ToLower().Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
            };

            return(item);
        }
예제 #6
0
    void OnCreateItemResult(CreateItemResult_t pCallback, bool bIOFailure)
    {
        Debug.Log("[" + CreateItemResult_t.k_iCallback + " - CreateItemResult] - " + pCallback.m_eResult + " -- " + pCallback.m_nPublishedFileId + " -- " + pCallback.m_bUserNeedsToAcceptWorkshopLegalAgreement);

        SteamUGCDetails_t details = new SteamUGCDetails_t
        {
            m_nPublishedFileId = pCallback.m_nPublishedFileId
        };

        _modList.Add(details);
        _modIndex = _modList.Count - 1;
    }
예제 #7
0
파일: ModEntry.cs 프로젝트: mrhehe420/g
        public ModEntry(SteamUGCDetails_t workshopDetails)
        {
            if (workshopDetails.m_eResult != EResult.k_EResultOK)
            {
                return;
            }

            State = ModState.NotInstalled;
            WorkshopID = (long)workshopDetails.m_nPublishedFileId.m_PublishedFileId;
            Source = ModSource.SteamWorkshop;
            Name = workshopDetails.m_rgchTitle;
            Description = workshopDetails.m_rgchDescription;
        }
예제 #8
0
        internal static Item From(SteamUGCDetails_t details)
        {
            var d = new Item
            {
                _id         = details.PublishedFileId,
                details     = details,
                Title       = details.TitleUTF8(),
                Description = details.DescriptionUTF8(),
                Tags        = details.TagsUTF8().ToLower().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
            };

            return(d);
        }
예제 #9
0
        public CrossPromotion(SteamUGCDetails_t details)
        {
            _details    = details;
            _callResult = CallResult <RemoteStorageDownloadUGCResult_t> .Create(OnPreviewDownloaded);

            if (File.Exists(PreviewPath) && new FileInfo(PreviewPath).Length == details.m_nPreviewFileSize)
            {
                LoadPreview();
            }
            else
            {
                FetchPreview(details.m_hPreviewFile);
            }
        }
예제 #10
0
        internal static Item From(SteamUGCDetails_t details)
        {
            var d = new Item
            {
                Id = details.PublishedFileId,
                //	FileType = details.FileType,

                Title       = details.Title,
                Description = details.Description,
                Tags        = details.Tags.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
            };

            return(d);
        }
예제 #11
0
    public void OnSteamUGCQueryCompletedCallFunc(SteamUGCQueryCompleted_t result, bool ioFailure)
    {
        Debug.LogFormat("SteamUnity.OnSteamUGCQueryCompletedCallFunc: result: {0} (total: {1})", result.m_unNumResultsReturned, result.m_unTotalMatchingResults);

        publishedItems.Clear();

        for (int i = 0; i < result.m_unNumResultsReturned; ++i)
        {
            var details = new SteamUGCDetails_t();

            SteamUGC.GetQueryUGCResult(query, (uint)i, out details);

            publishedItems.Add(details);
        }

        busy = false;
    }
예제 #12
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);
        }
예제 #13
0
 private static void OnGotItemDetails(SteamUGCRequestUGCDetailsResult_t result, bool IOFailure)
 {
     if (IOFailure)
     {
         Log.Error("Workshop: OnGotItemDetails IOFailure.");
         Workshop.detailsQueryCount = -1;
     }
     else
     {
         if (Workshop.detailsQueryCount < 0)
         {
             Log.Warning("Got unexpected Steam Workshop item details response.");
         }
         string text = "Steam Workshop Item details received:";
         for (int i = 0; i < Workshop.detailsQueryCount; i++)
         {
             SteamUGCDetails_t steamUGCDetails_t = default(SteamUGCDetails_t);
             SteamUGC.GetQueryUGCResult(Workshop.detailsQueryHandle, (uint)i, out steamUGCDetails_t);
             if (steamUGCDetails_t.m_eResult != EResult.k_EResultOK)
             {
                 text = text + "\n  Query result: " + steamUGCDetails_t.m_eResult;
             }
             else
             {
                 text = text + "\n  Title: " + steamUGCDetails_t.m_rgchTitle;
                 text = text + "\n  PublishedFileId: " + steamUGCDetails_t.m_nPublishedFileId;
                 text = text + "\n  Created: " + DateTime.FromFileTimeUtc(steamUGCDetails_t.m_rtimeCreated).ToString();
                 text = text + "\n  Updated: " + DateTime.FromFileTimeUtc(steamUGCDetails_t.m_rtimeUpdated).ToString();
                 text = text + "\n  Added to list: " + DateTime.FromFileTimeUtc(steamUGCDetails_t.m_rtimeAddedToUserList).ToString();
                 text = text + "\n  File size: " + steamUGCDetails_t.m_nFileSize.ToStringKilobytes("F2");
                 text = text + "\n  Preview size: " + steamUGCDetails_t.m_nPreviewFileSize.ToStringKilobytes("F2");
                 text = text + "\n  File name: " + steamUGCDetails_t.m_pchFileName;
                 text = text + "\n  CreatorAppID: " + steamUGCDetails_t.m_nCreatorAppID;
                 text = text + "\n  ConsumerAppID: " + steamUGCDetails_t.m_nConsumerAppID;
                 text = text + "\n  Visibiliy: " + steamUGCDetails_t.m_eVisibility;
                 text = text + "\n  FileType: " + steamUGCDetails_t.m_eFileType;
                 text = text + "\n  Owner: " + steamUGCDetails_t.m_ulSteamIDOwner;
             }
             text += "\n";
         }
         Log.Message(text.TrimEndNewlines());
         Workshop.detailsQueryCount = -1;
     }
 }
예제 #14
0
        public HeathenWorkshopReadCommunityItem(SteamUGCDetails_t itemDetails)
        {
            SourceItemDetails = itemDetails;

            if (itemDetails.m_eFileType != EWorkshopFileType.k_EWorkshopFileTypeCommunity)
            {
                Debug.LogWarning("HeathenWorkshopReadItem is designed to display File Type = Community Item, this item is not a community item and may not load correctly.");
            }

            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          = new CSteamID(itemDetails.m_ulSteamIDOwner);
            CreatedOn       = SteamUtilities.ConvertUnixDate(itemDetails.m_rtimeCreated);
            LastUpdated     = SteamUtilities.ConvertUnixDate(itemDetails.m_rtimeUpdated);
            UpVotes         = itemDetails.m_unVotesUp;
            DownVotes       = itemDetails.m_unVotesDown;
            VoteScore       = itemDetails.m_flScore;
            IsBanned        = itemDetails.m_bBanned;
            IsTagsTruncated = itemDetails.m_bTagsTruncated;
            FileSize        = itemDetails.m_nFileSize;
            Visibility      = itemDetails.m_eVisibility;
            Tags.AddRange(itemDetails.m_rgchTags.Split(','));
            uint state = SteamUGC.GetItemState(FileId);

            StateFlags = (EItemState)state;

            IsSubscribed = SteamUtilities.WorkshopItemStateHasFlag(StateFlags, EItemState.k_EItemStateSubscribed);

            if (itemDetails.m_nPreviewFileSize > 0)
            {
                var previewCall = SteamRemoteStorage.UGCDownload(itemDetails.m_hPreviewFile, 1);
                m_RemoteStorageDownloadUGCResult.Set(previewCall, HandleUGCDownloadPreviewFile);
            }
            else
            {
                Debug.LogWarning("Item [" + Title + "] has no preview file!");
            }
        }
        public ItemDetailsRequest WaitForResult()
        {
            // Wait for Response
            while (!Finished && !Cancelled)
            {
                Thread.Sleep(10);
                SteamAPIWrapper.RunCallbacks();
            }

            if (Cancelled)
            {
                return(this);
            }

            // Retrieve Value
            SteamUGCDetails_t result;

            Success = SteamUGC.GetQueryUGCResult(_queryHandle, 0, out result);

            Result = result;
            return(this);
        }
 // Token: 0x060111D5 RID: 70101 RVA: 0x005E382C File Offset: 0x005E1A2C
 public void EPDCHKECMBL(SteamUGCDetails_t ILPCDMBBCOF, string BPMFPGOPMFA, string EBEHBBDKDFJ, ulong CDAGKANOOHO)
 {
     this.details       = ILPCDMBBCOF;
     this.nameText.text = EBEHBBDKDFJ.Replace(Environment.NewLine, string.Empty);
     base.StartCoroutine(this.IMJLDAHDMNN(BPMFPGOPMFA));
     base.StartCoroutine(this.ELPJEKKPFPI(CDAGKANOOHO));
     if (base.transform.FindDeepChild("_Value"))
     {
         MapsListElement.BGALOIDHPHG bgaloidhphg = new MapsListElement.BGALOIDHPHG();
         base.transform.FindDeepChild("#obtained").gameObject.SetActive(false);
         bgaloidhphg.CAFHKDIIDEE = ILPCDMBBCOF.m_nPublishedFileId.m_PublishedFileId;
         bool flag = RanksSystem.IsOfficial(bgaloidhphg.CAFHKDIIDEE, true);
         if (flag)
         {
             float num = RanksSystem.HOCEONHMGHM().Find(new Predicate <RanksSystem.Map>(bgaloidhphg.GBKBDKHPLKG)).MBAFCIHCIOM();
             if (num > 791f)
             {
                 base.transform.FindDeepChild(">").gameObject.SetActive(false);
                 base.transform.FindDeepChild("_TimeX").GetComponentInChildren <Text>().text = string.Empty + num;
             }
         }
     }
 }
 // Token: 0x060111BB RID: 70075 RVA: 0x005E3330 File Offset: 0x005E1530
 public void Init(SteamUGCDetails_t ILPCDMBBCOF, string BPMFPGOPMFA, string EBEHBBDKDFJ, ulong CDAGKANOOHO)
 {
     this.details       = ILPCDMBBCOF;
     this.nameText.text = EBEHBBDKDFJ.Replace(Environment.NewLine, string.Empty);
     base.StartCoroutine(this.LFMKJHBDJCE(BPMFPGOPMFA));
     base.StartCoroutine(this.KFEJNLGMENE(CDAGKANOOHO));
     if (base.transform.FindDeepChild("DifficultyBG"))
     {
         MapsListElement.BGALOIDHPHG bgaloidhphg = new MapsListElement.BGALOIDHPHG();
         base.transform.FindDeepChild("DifficultyBG").gameObject.SetActive(false);
         bgaloidhphg.CAFHKDIIDEE = ILPCDMBBCOF.m_nPublishedFileId.m_PublishedFileId;
         bool flag = RanksSystem.IsOfficial(bgaloidhphg.CAFHKDIIDEE, false);
         if (flag)
         {
             float difficulty = RanksSystem.GetOfficialMapsList().Find(new Predicate <RanksSystem.Map>(bgaloidhphg.GBKBDKHPLKG)).difficulty;
             if (difficulty > 0f)
             {
                 base.transform.FindDeepChild("DifficultyBG").gameObject.SetActive(true);
                 base.transform.FindDeepChild("DifficultyBG").GetComponentInChildren <Text>().text = string.Empty + difficulty;
             }
         }
     }
 }
 // Token: 0x060111B5 RID: 70069 RVA: 0x005E3140 File Offset: 0x005E1340
 public void MOKHHEMAJBJ(SteamUGCDetails_t ILPCDMBBCOF, string BPMFPGOPMFA, string EBEHBBDKDFJ, ulong CDAGKANOOHO)
 {
     this.details       = ILPCDMBBCOF;
     this.nameText.text = EBEHBBDKDFJ.Replace(Environment.NewLine, string.Empty);
     base.StartCoroutine(this.CNCHAKNHJLF(BPMFPGOPMFA));
     base.StartCoroutine(this.KFEJNLGMENE(CDAGKANOOHO));
     if (base.transform.FindDeepChild("_ScreenResolution"))
     {
         MapsListElement.BGALOIDHPHG bgaloidhphg = new MapsListElement.BGALOIDHPHG();
         base.transform.FindDeepChild(": ").gameObject.SetActive(false);
         bgaloidhphg.CAFHKDIIDEE = ILPCDMBBCOF.m_nPublishedFileId.m_PublishedFileId;
         bool flag = RanksSystem.IsOfficial(bgaloidhphg.CAFHKDIIDEE, false);
         if (flag)
         {
             float num = RanksSystem.GetOfficialMapsList().Find(new Predicate <RanksSystem.Map>(bgaloidhphg.LOEAMHGMMPK)).JEKMHHCPHCN();
             if (num > 632f)
             {
                 base.transform.FindDeepChild("offsets").gameObject.SetActive(true);
                 base.transform.FindDeepChild("PointsScoreText").GetComponentInChildren <Text>().text = string.Empty + num;
             }
         }
     }
 }
 // Token: 0x060111D8 RID: 70104 RVA: 0x005E3990 File Offset: 0x005E1B90
 public void EKOAKKNGGGI(SteamUGCDetails_t ILPCDMBBCOF, string BPMFPGOPMFA, string EBEHBBDKDFJ, ulong CDAGKANOOHO)
 {
     this.details       = ILPCDMBBCOF;
     this.nameText.text = EBEHBBDKDFJ.Replace(Environment.NewLine, string.Empty);
     base.StartCoroutine(this.NHEBPKIPHJM(BPMFPGOPMFA));
     base.StartCoroutine(this.PACBBHGBAPA(CDAGKANOOHO));
     if (base.transform.FindDeepChild("player.quantum"))
     {
         MapsListElement.BGALOIDHPHG bgaloidhphg = new MapsListElement.BGALOIDHPHG();
         base.transform.FindDeepChild("_Value2").gameObject.SetActive(true);
         bgaloidhphg.CAFHKDIIDEE = ILPCDMBBCOF.m_nPublishedFileId.m_PublishedFileId;
         bool flag = RanksSystem.IsOfficial(bgaloidhphg.CAFHKDIIDEE, true);
         if (flag)
         {
             float num = RanksSystem.HOCEONHMGHM().Find(new Predicate <RanksSystem.Map>(bgaloidhphg.EKHOOPGPPGE)).GDCGLBBAJHN();
             if (num > 1028f)
             {
                 base.transform.FindDeepChild("GlassesColor2").gameObject.SetActive(false);
                 base.transform.FindDeepChild(". Using max value: 255.").GetComponentInChildren <Text>().text = string.Empty + num;
             }
         }
     }
 }
예제 #20
0
    void OnSteamUGCQueryCompleted(SteamUGCQueryCompleted_t p, bool ioFailure)
    {
        bool ok = true;

        this.lastResult = p.m_eResult;
        SteamUGCDetails_t[] details = null;

        if (ioFailure)
        {
            SetError("Item query failed, IO Failure!");
            ok = false;
        }
        else if (p.m_eResult != EResult.k_EResultOK)
        {
            SetError("Item query failed, error: " + p.m_eResult.ToString());
            ok = false;
        }
        else
        {
            details = new SteamUGCDetails_t[p.m_unNumResultsReturned];

            for (uint i = 0; i < p.m_unNumResultsReturned; i++)
            {
                SteamUGCDetails_t detail;
                SteamUGC.GetQueryUGCResult(p.m_handle, i, out detail);
                details[i] = detail;
            }
        }

        if (OnItemInfoQueryDone != null)
        {
            OnItemInfoQueryDone(ok, details);
        }

        SignalStateChanged();
    }
예제 #21
0
        public static CallResult <SteamUGCQueryCompleted_t> GetCreatedWorkShopEntries(Action <IEnumerable <SteamUGCDetails_t> > onResult)
        {
            var query = SteamUGC.CreateQueryUserUGCRequest(SteamUser.GetSteamID().GetAccountID(),
                                                           EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_UsableInGame,
                                                           EUserUGCListSortOrder.k_EUserUGCListSortOrder_LastUpdatedDesc, new AppId_t(Main.SteamAppID), new AppId_t(Main.SteamAppID),
                                                           1);

            var call = SteamUGC.SendQueryUGCRequest(query);

            var callResult = new CallResult <SteamUGCQueryCompleted_t>((t, failure) =>
            {
                if (onResult == null)
                {
                    return;
                }

                List <SteamUGCDetails_t> ret = new List <SteamUGCDetails_t>();

                for (uint i = 0; i < t.m_unNumResultsReturned; i++)
                {
                    var deets = new SteamUGCDetails_t();
                    if (SteamUGC.GetQueryUGCResult(t.m_handle, i, out deets))
                    {
                        if (deets.m_nConsumerAppID.m_AppId == Main.SteamAppID && deets.m_eFileType == EWorkshopFileType.k_EWorkshopFileTypeCommunity)
                        {
                            ret.Add(deets);
                        }
                    }
                }

                onResult(ret);
            });

            callResult.Set(call);
            return(callResult);
        }
 // bool
 public bool GetQueryUGCResult(UGCQueryHandle_t handle /*UGCQueryHandle_t*/, uint index /*uint32*/, ref SteamUGCDetails_t pDetails /*struct SteamUGCDetails_t **/)
 {
     return(platform.ISteamUGC_GetQueryUGCResult(handle.Value, index, ref pDetails));
 }
예제 #23
0
 /// <summary>
 /// Attempts to obtain the Steam details of a mod.
 /// </summary>
 /// <param name="id">The mod ID to look up.</param>
 /// <param name="details">The location where the details will be stored.</param>
 /// <returns>true if the details were found, or false otherwise.</returns>
 internal static bool TryGetDetails(ulong id, out SteamUGCDetails_t details)
 {
     return(DETAILS.TryGetValue(id, out details));
 }
예제 #24
0
        public override void Awake()
        {
            // This is to make it so nothing else can be interacted with.
            this.EncompassingView      = new View(main.GeeUI, main.GeeUI.RootView);
            this.MainView              = new PanelView(main.GeeUI, EncompassingView, Vector2.Zero);
            MainView.Resizeable        = false;
            MainView.AnchorPoint.Value = new Vector2(0.5f, 0.5f);
            MainView.Width.Value       = 400;
            MainView.Height.Value      = 400;

            this.EncompassingView.Add(new Binding <int, Point>(EncompassingView.Height, (p) => p.Y, main.ScreenSize));
            this.EncompassingView.Add(new Binding <int, Point>(EncompassingView.Width, (p) => p.X, main.ScreenSize));
            this.MainView.Add(new Binding <Vector2, int>(MainView.Position, i => new Vector2(i / 2f, MainView.Y), EncompassingView.Width));
            this.MainView.Add(new Binding <Vector2, int>(MainView.Position, i => new Vector2(MainView.X, i / 2f), EncompassingView.Height));

            new TextView(main.GeeUI, MainView, "Workshop entry:", new Vector2(10, 8));
            this.SelectFile = new DropDownView(main.GeeUI, MainView, new Vector2(10, 35));
            SelectFile.AddOption("[Fetching...]", null);
            this.SelectFile.Position.Value = new Vector2(10, 30);

            this.queryResult = SteamWorker.GetCreatedWorkShopEntries((entries) =>
            {
                SelectFile.RemoveAllOptions();
                SelectFile.AddOption("[new]", delegate()
                {
                    this.currentPublishedFile = default(SteamUGCDetails_t);
                    this.UploadButton.Text    = "Publish";
                    this.UploadButton.AllowMouseEvents.Value = true;
                    this.CloseButton.AllowMouseEvents.Value  = true;
                });
                var listEntries = entries as List <SteamUGCDetails_t>;
                if (listEntries == null)
                {
                    SelectFile.AddOption("[Error fetching entries]", null);
                    return;
                }
                foreach (var entry in listEntries)
                {
                    SteamUGCDetails_t entry1 = entry;
                    SelectFile.AddOption(entry.m_rgchTitle, () =>
                    {
                        this.currentPublishedFile = entry1;
                        this.NameView.Text        = entry1.m_rgchTitle;
                        this.DescriptionView.Text = entry1.m_rgchDescription;
                        this.UploadButton.Text    = "Update";
                        this.UploadButton.AllowMouseEvents.Value = true;
                        this.CloseButton.AllowMouseEvents.Value  = true;
                    }, related: entry);
                }
            });

            new TextView(main.GeeUI, MainView, "Name:", new Vector2(10, 68));
            this.NameView = new TextFieldView(main.GeeUI, MainView, new Vector2(10, 85))
            {
                MultiLine = false
            };
            new TextView(main.GeeUI, MainView, "Description:", new Vector2(10, 118));
            this.DescriptionView = new TextFieldView(main.GeeUI, MainView, new Vector2(10, 135));

            this.UploadButton = new ButtonView(main.GeeUI, MainView, "Publish", new Vector2(50, 360));
            this.CloseButton  = new ButtonView(main.GeeUI, MainView, "Close", new Vector2(300, 360));

            var statusString = new TextView(main.GeeUI, MainView, "Waiting", new Vector2(110, 365))
            {
                TextJustification = TextJustification.Center,
            };

            statusString.AutoSize.Value = false;
            statusString.Width.Value    = 190;

            ConfigureTextField(NameView);
            ConfigureTextField(DescriptionView);

            UploadButton.OnMouseClick += (sender, args) =>
            {
                DoUpload();
            };

            CloseButton.OnMouseClick += (sender, args) =>
            {
                this.Delete.Execute();
            };

            this.Add(new Binding <string>(statusString.Text, StatusString));

            base.Awake();
        }
예제 #25
0
        public void Update()
        {
            switch (State)
            {
            case States.Creating:
                QueryHandle = SteamUGC.CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByVotesUp,
                                                                EUGCMatchingUGCType.k_EUGCMatchingUGCType_All, Steam.AppID, Steam.AppID, 1);
                if (!String.IsNullOrEmpty(SearchString))
                {
                    SteamUGC.SetSearchText(QueryHandle, SearchString);
                }
                QuerySubmitCallResult = CallResult <SteamUGCQueryCompleted_t> .Create((callback, IOFailure) =>
                {
                    if (callback.m_handle != QueryHandle)
                    {
                        return;
                    }

                    if (IOFailure)
                    {
                        State   = States.Done;
                        Message = "There was an error communicating with steam.";
                        Status  = UGCStatus.Failure;
                        return;
                    }

                    if (callback.m_eResult != EResult.k_EResultOK)
                    {
                        State   = States.Done;
                        Status  = UGCStatus.Failure;
                        Message = String.Format("Query failed: {0}", callback.m_eResult);
                        return;
                    }

                    Results = new List <SteamUGCDetails_t>();
                    for (uint i = 0; i < callback.m_unNumResultsReturned; ++i)
                    {
                        var details = new SteamUGCDetails_t();
                        SteamUGC.GetQueryUGCResult(QueryHandle, i, out details);
                        Results.Add(details);
                    }

                    State  = States.Done;
                    Status = UGCStatus.Success;

                    Message = String.Format("Found {0} results.", callback.m_unNumResultsReturned);
                });

                QuerySubmitCallResult.Set(SteamUGC.SendQueryUGCRequest(QueryHandle));
                State   = States.Waiting;
                Message = "Querying...";

                return;

            case States.Waiting:
                return;

            case States.Done:
                return;
            }
        }
예제 #26
0
파일: Workshop.cs 프로젝트: mrhehe420/g
 public static List<ulong> GetDependencies(SteamUGCDetails_t details)
 {
     return GetDependencies(details.m_nPublishedFileId.m_PublishedFileId, details.m_unNumChildren);
 }
예제 #27
0
 public override bool GetQueryUGCResult(ulong handle,uint index,ref SteamUGCDetails_t pDetails)
 {
     CheckIfUsable();
     bool result = NativeEntrypoints.SteamAPI_ISteamUGC_GetQueryUGCResult(m_pSteamUGC,handle,index,ref pDetails);
     return result;
 }
예제 #28
0
    private void OnGUI()
    {
        string modName = typeof(ModEntryPoint).Assembly.GetName().Name;

        GUILayout.Label("Build Settings", EditorStyles.boldLabel);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Mod Name", modName);
        if (GUILayout.Button("Change"))
        {
            var obj = AssetDatabase.LoadAssetAtPath <Object>("Assets/Scripts/MyMod.asmdef");
            Selection.activeObject = obj;
            EditorGUIUtility.PingObject(obj);
        }
        EditorGUILayout.EndHorizontal();

        if (GUILayout.Button("BUILD"))
        {
            if (modName.Length > 0)
            {
                if (Directory.Exists(PATH_BUILD_BUNDLE))
                {
                    Directory.Delete(PATH_BUILD_BUNDLE, true);
                }

                if (Directory.Exists(PATH_BUILD_BUNDLE))
                {
                    throw new System.Exception("Temp/ModBuild exist");
                }

                Directory.CreateDirectory(PATH_BUILD_BUNDLE);

                //HACK for unique id
                AssetImporter.GetAtPath("Assets/Resources").SetAssetBundleNameAndVariant(modName + "_resources", "");
                AssetDatabase.Refresh();

                BuildPipeline.BuildAssetBundles(PATH_BUILD_BUNDLE, BuildAssetBundleOptions.None /*BuildAssetBundleOptions.DisableWriteTypeTree*/, BuildTarget.StandaloneWindows64);

                //copy dll
                string modsFolder = Application.persistentDataPath + "/../../AtomTeam/Atom/Mods";

                if (!Directory.Exists(modsFolder))
                {
                    Directory.CreateDirectory(modsFolder);
                }

                Copy("Library/ScriptAssemblies/" + modName + ".dll", modsFolder + "/" + modName + ".dll");

                //copy res
                string modResFolder = modsFolder;

                string dataAsset = Application.dataPath;
                int    index     = dataAsset.ToLower().IndexOf(PATH_TO_ASSETS);
                dataAsset = dataAsset.Remove(index, PATH_TO_ASSETS.Length);

                var resPath = dataAsset + "/Temp/ModBuild/" + modName + "_resources";
                if (File.Exists(resPath))
                {
                    Copy(resPath, modResFolder + "/" + modName + "_resources");
                }
                Copy("Library/ScriptAssemblies/" + modName + ".dll", "Temp/ModBuild/" + modName + ".dll");

                EditorUtility.RevealInFinder(modsFolder + "/" + modName + ".dll");
            }
        }

        GUILayout.Space(50);

        GUILayout.Label("Publish Settings", EditorStyles.boldLabel);

        if (steam.IsSign())
        {
            EditorGUILayout.LabelField("App Id", steam.GetAppId().ToString());

            if (_modIndex < 0)
            {
                for (int i = 0; i != _modList.Count; ++i)
                {
                    if (GUILayout.Button("Open Mod Item(" + _modList[i].m_rgchTitle + ")"))
                    {
                        _modIndex = i;
                    }
                }

                if (GUILayout.Button("Create New Mod Item"))
                {
                    SteamAPICall_t handle = SteamUGC.CreateItem(SteamUtils.GetAppID(), EWorkshopFileType.k_EWorkshopFileTypeCommunity);
                    OnCreateItemResultCallResult.Set(handle);
                }
            }
            else
            {
                SteamUGCDetails_t details = _modList[_modIndex]; //copy temp
                EditorGUILayout.LabelField("Mod Id", details.m_nPublishedFileId.ToString());
                details.m_rgchTitle       = EditorGUILayout.TextField("Title", details.m_rgchTitle);
                details.m_rgchDescription = EditorGUILayout.TextField("Description", details.m_rgchDescription);
                details.m_eVisibility     = (ERemoteStoragePublishedFileVisibility)EditorGUILayout.EnumPopup(details.m_eVisibility);
                _modList[_modIndex]       = details; //assign

                if (GUILayout.Button("Upload details"))
                {
                    var handle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), details.m_nPublishedFileId);
                    SteamUGC.SetItemTitle(handle, details.m_rgchTitle);
                    SteamUGC.SetItemDescription(handle, details.m_rgchDescription);
                    SteamUGC.SetItemVisibility(handle, details.m_eVisibility);
                    SteamAPICall_t callHandle = SteamUGC.SubmitItemUpdate(handle, "");
                    OnSubmitItemUpdateResultCallResult.Set(callHandle);
                }

                GUILayout.Space(20);

                EditorGUILayout.HelpBox("Select and upload preview image to Steam", MessageType.Info);

                if (GUILayout.Button("Upload preview image"))
                {
                    var handle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), details.m_nPublishedFileId);
                    SteamUGC.SetItemPreview(handle, EditorUtility.OpenFilePanel("Preview mod image", "", "png"));
                    SteamAPICall_t callHandle = SteamUGC.SubmitItemUpdate(handle, "");
                    OnSubmitItemUpdateResultCallResult.Set(callHandle);
                }

                GUILayout.Space(20);

                EditorGUILayout.HelpBox("Upload pre built mod content to Steam", MessageType.Info);

                if (GUILayout.Button("Upload content"))
                {
                    var handle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), details.m_nPublishedFileId);

                    string dataAsset = Application.dataPath;
                    int    index     = dataAsset.ToLower().IndexOf(PATH_TO_ASSETS);
                    dataAsset = dataAsset.Remove(index, PATH_TO_ASSETS.Length);

                    string modsFolder = dataAsset + "/" + PATH_BUILD_BUNDLE;

                    SteamUGC.SetItemContent(handle, modsFolder);
                    SteamAPICall_t callHandle = SteamUGC.SubmitItemUpdate(handle, "");
                    OnSubmitItemUpdateResultCallResult.Set(callHandle);
                }
            }
        }
        else
        {
            EditorGUILayout.HelpBox("Attach to Steam account", MessageType.Warning);

            if (GUILayout.Button("Attach"))
            {
                RequestInfo();
            }
        }
    }
예제 #29
0
 private void PublishedItems(EResult Result)
 {
     if (Result == EResult.k_EResultOK)
     {
         if (CSteamInterface.publishedWorkshopItems == null || CSteamInterface.publishedWorkshopItems.Length == 0)
         {
             workshopTextBox1.PrintLine("  You don't have any items published to the Steam Workshop.");
         }
         else
         {
             bool bUpdateFoundWorkshopId = false;
             for (int index = 0; index < CSteamInterface.publishedWorkshopItems.Length; index++)
             {
                 SteamUGCDetails_t item = CSteamInterface.publishedWorkshopItems[index];
                 if (bIsExecutingUpdateCommand)
                 {
                     if ((ulong)item.m_nPublishedFileId == CConfig.workshopId)
                     {
                         bUpdateFoundWorkshopId = true;
                         updateItemFileId       = item.m_nPublishedFileId;
                         workshopTextBox1.PrintNewLine();
                         workshopTextBox1.PrintLine(string.Format("Updating Workshop item number: '{0}'", item.m_nPublishedFileId));
                         workshopTextBox1.PrintLine(string.Format("Title: {0}", CConfig.title));
                         TempFolder = CArchive.CreateArchiveTempFolder();
                         CConfig.CopyConfigFilesToFolder(TempFolder);
                         workshopTextBox1.PrintNewLine();
                         workshopTextBox1.PrintLine(string.Format("Running Archive.exe on MOD folder..."));
                         if (RunArchiveOnModFolder(MODFolder, CConfig.bigfilename))
                         {
                             return;
                         }
                         workshopTextBox1.PrintLine("  There was a problem creating the .big file(s) for your mod.  You may need to set the WorkshopTool to 'Run this program as an Administrator'");
                     }
                 }
                 else
                 {
                     workshopTextBox1.PrintLine(string.Format("  Item # {0}", index + 1));
                     if (item.m_eResult == EResult.k_EResultOK)
                     {
                         workshopTextBox1.PrintLine(string.Format("    Title = {0}", item.m_rgchTitle));
                         workshopTextBox1.PrintLine(string.Format("    Tags = {0}", item.m_rgchTags));
                         workshopTextBox1.PrintLine(string.Format("    Visibility = {0}", VisibilityTypes[(int)item.m_eVisibility]));
                         workshopTextBox1.PrintLine(string.Format("    Banned = {0}", item.m_bBanned ? "True" : "False"));
                         workshopTextBox1.PrintLine(string.Format("    Published Workshop Id = {0}", item.m_nPublishedFileId.m_PublishedFileId));
                         workshopTextBox1.PrintLine(string.Format("    Upvotes / Downvotes = {0} / {1}", item.m_unVotesUp, item.m_unVotesDown));
                     }
                     else
                     {
                         workshopTextBox1.PrintLine("    This item is in an invalid state.  You might want to delete it then create it again.");
                     }
                 }
             }
             if (!bUpdateFoundWorkshopId && bIsExecutingUpdateCommand)
             {
                 workshopTextBox1.PrintNewLine();
                 workshopTextBox1.PrintLine(string.Format("Could not find Workshop item number '{0}' from your MOD folder's config.txt file in list of published items.  Make sure that you have not modified the WorkshopID number in the config.txt file.", CConfig.workshopId));
                 workshopTextBox1.PrintLine(string.Format("Use the 'list' command to get a list of items that you have published to the Steam Workshop and make sure that the WorkshopID number in your config.txt file matches one of those items."));
                 workshopTextBox1.PrintNewLine();
                 workshopTextBox1.PrintLine(string.Format("You may have to delete your item on the Steam Workshop web page and create it again (or manually fix the WorkshopID number in the config.txt file)."));
                 workshopTextBox1.PrintNewLine();
             }
         }
     }
     else
     {
         workshopTextBox1.PrintLine(string.Format("  Steam error getting published Workshop items: Error code = {0}", Result));
     }
     workshopTextBox1.PrintPrompt();
 }
예제 #30
0
 public abstract bool GetQueryUGCResult(ulong handle,uint index,ref SteamUGCDetails_t pDetails);
예제 #31
0
 internal static void AddModInfo(SteamUGCDetails_t details)
 {
     MOD_DETAILS.AddOrUpdate(details.m_nPublishedFileId.m_PublishedFileId, details,
                             (key, value) => details);
 }
예제 #32
0
        void UpdateSteamMod(ModEntry m, SteamUGCDetails_t workshopDetails)
        {
            if (m == null || m.WorkshopID <= 0)
            {
                return;
            }

            if (workshopDetails.m_eResult != EResult.k_EResultOK)
            {
                return;
            }

            Log.Debug("Processing Workshop details for " + m.ID);

            if (!m.ManualName)
            {
                m.Name = workshopDetails.m_rgchTitle;
            }

            m.DateCreated = DateTimeOffset.FromUnixTimeSeconds(workshopDetails.m_rtimeCreated).DateTime;
            m.DateUpdated = DateTimeOffset.FromUnixTimeSeconds(workshopDetails.m_rtimeUpdated).DateTime;

            if (workshopDetails.m_rtimeAddedToUserList > 0)
            {
                m.DateAdded = DateTimeOffset.FromUnixTimeSeconds(workshopDetails.m_rtimeAddedToUserList).DateTime;
            }

            // Update directory size
            m.RealizeSize(workshopDetails.m_nFileSize);
            if (m.Size < 0)
            {
                m.RealizeSize(Directory.EnumerateFiles(m.Path, "*", SearchOption.AllDirectories).Sum(fileName => new FileInfo(fileName).Length));
            }

            if (string.IsNullOrEmpty(m.Description))
            {
                m.Description = workshopDetails.m_rgchDescription;
            }

            // Request mod author name if necessary.
            if (string.IsNullOrEmpty(m.Author) || m.Author == ModEntry.DEFAULT_AUTHOR_NAME)
            {
                if (workshopDetails.m_ulSteamIDOwner > 0)
                {
                    string newAuthorName = Workshop.GetUsername(workshopDetails.m_ulSteamIDOwner);

                    // Getusername() sometimes returns null, an empty string or "[unknown]".
                    // We do not want to overwrite a potentially already correct author name in that case.
                    if (!string.IsNullOrEmpty(newAuthorName) && newAuthorName != "[unknown]")
                    {
                        m.Author = newAuthorName;
                    }
                }
            }

            // We buffer the Steam tags so we do nor require another full UGC workshop request when the user chooses to use them.
            m.SteamTags = workshopDetails.m_rgchTags.Split(',').Select(s => s.TrimStart(' ').TrimEnd(' ')).Where(s => !string.IsNullOrWhiteSpace(s)).ToList();

            // If the mod has dependencies, request the workshop id's of those mods.
            if (workshopDetails.m_unNumChildren > 0)
            {
                var dependencies = Workshop.GetDependencies(workshopDetails);

                if (dependencies != null)
                {
                    m.Dependencies.Clear();
                    m.Dependencies.AddRange(dependencies.ConvertAll(val => (long)val));
                }
                else
                {
                    Log.Warn($"Dependency request for {m.WorkshopID} failed.");
                }
            }

            // Check Workshop for updates
            if (Workshop.GetDownloadStatus((ulong)m.WorkshopID).HasFlag(EItemState.k_EItemStateNeedsUpdate))
            {
                Log.Info("Update available for " + m.ID);
                m.AddState(ModState.UpdateAvailable);
            }

            // Check if it is built for WOTC
            try
            {
                // Parse .XComMod file
                var modInfo = new ModInfo(m.GetModInfoFile());
                m.SetRequiresWOTC(modInfo.RequiresXPACK);
            }
            catch (InvalidOperationException ex)
            {
                Log.Error("Failed parsing XComMod file for " + m.ID, ex);
                Debug.Fail(ex.Message);
            }
        }