Esempio n. 1
0
        public override void DoWindowContents(Rect inRect)
        {
            Workshop.GetUpdateStatus(out EItemUpdateStatus updateStatus, out float progPercent);
            WorkshopInteractStage curStage = Workshop.CurStage;

            if (curStage == WorkshopInteractStage.None && updateStatus == EItemUpdateStatus.k_EItemUpdateStatusInvalid)
            {
                Close();
            }
            else
            {
                string text = string.Empty;
                if (curStage != 0)
                {
                    text += curStage.GetLabel();
                    text += "\n\n";
                }
                if (updateStatus != 0)
                {
                    text += updateStatus.GetLabel();
                    if (progPercent > 0f)
                    {
                        text = text + " (" + progPercent.ToStringPercent() + ")";
                    }
                    text += GenText.MarchingEllipsis();
                }
                Widgets.Label(inRect, text);
            }
        }
Esempio n. 2
0
        public override void DoWindowContents(Rect inRect)
        {
            EItemUpdateStatus eItemUpdateStatus;
            float             num;

            Workshop.GetUpdateStatus(out eItemUpdateStatus, out num);
            WorkshopInteractStage curStage = Workshop.CurStage;

            if (curStage == WorkshopInteractStage.None && eItemUpdateStatus == EItemUpdateStatus.k_EItemUpdateStatusInvalid)
            {
                this.Close(true);
                return;
            }
            string text = string.Empty;

            if (curStage != WorkshopInteractStage.None)
            {
                text += curStage.GetLabel();
                text += "\n\n";
            }
            if (eItemUpdateStatus != EItemUpdateStatus.k_EItemUpdateStatusInvalid)
            {
                text += eItemUpdateStatus.GetLabel();
                if (num > 0f)
                {
                    text = text + " (" + num.ToStringPercent() + ")";
                }
                text += GenText.MarchingEllipsis(0f);
            }
            Widgets.Label(inRect, text);
        }
Esempio n. 3
0
        private static void OnItemCreated(CreateItemResult_t result, bool IOFailure)
        {
            if (IOFailure || result.m_eResult != EResult.k_EResultOK)
            {
                uploadingHook = null;
                Dialog_WorkshopOperationInProgress.CloseAll();
                Log.Error("Workshop: OnItemCreated failure. Result: " + result.m_eResult.GetLabel());
                Find.WindowStack.Add(new Dialog_MessageBox("WorkshopSubmissionFailed".Translate(GenText.SplitCamelCase(result.m_eResult.GetLabel()))));
            }
            else
            {
                uploadingHook.PublishedFileId = result.m_nPublishedFileId;
                if (Prefs.LogVerbose)
                {
                    Log.Message("Workshop: Item created. PublishedFileId: " + uploadingHook.PublishedFileId);
                }
                curUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), uploadingHook.PublishedFileId);
                SetWorkshopItemDataFrom(curUpdateHandle, uploadingHook, creating: true);
                curStage = WorkshopInteractStage.SubmittingItem;
                if (Prefs.LogVerbose)
                {
                    Log.Message("Workshop: Submitting item.");
                }
                SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(curUpdateHandle, "[Auto-generated text]: Initial upload.");
                submitResult = CallResult <SubmitItemUpdateResult_t> .Create(OnItemSubmitted);

                submitResult.Set(hAPICall);
                createResult = null;
            }
        }
Esempio n. 4
0
 private static void OnItemSubmitted(SubmitItemUpdateResult_t result, bool IOFailure)
 {
     if (IOFailure || result.m_eResult != EResult.k_EResultOK)
     {
         Workshop.uploadingHook = null;
         Dialog_WorkshopOperationInProgress.CloseAll();
         Log.Error("Workshop: OnItemSubmitted failure. Result: " + result.m_eResult.GetLabel(), false);
         Find.WindowStack.Add(new Dialog_MessageBox("WorkshopSubmissionFailed".Translate(new object[]
         {
             GenText.SplitCamelCase(result.m_eResult.GetLabel())
         }), null, null, null, null, null, false, null, null));
     }
     else
     {
         SteamUtility.OpenWorkshopPage(Workshop.uploadingHook.PublishedFileId);
         Messages.Message("WorkshopUploadSucceeded".Translate(new object[]
         {
             Workshop.uploadingHook.Name
         }), MessageTypeDefOf.TaskCompletion, false);
         if (Prefs.LogVerbose)
         {
             Log.Message("Workshop: Item submit result: " + result.m_eResult, false);
         }
     }
     Workshop.curStage     = WorkshopInteractStage.None;
     Workshop.submitResult = null;
 }
Esempio n. 5
0
 public static string GetLabel(this WorkshopInteractStage stage)
 {
     if (stage == WorkshopInteractStage.None)
     {
         return("None".Translate());
     }
     return(("WorkshopInteractStage_" + stage.ToString()).Translate());
 }
Esempio n. 6
0
        internal static void Upload(WorkshopUploadable item)
        {
            if (Workshop.curStage != WorkshopInteractStage.None)
            {
                Messages.Message("UploadAlreadyInProgress".Translate(), MessageTypeDefOf.RejectInput, false);
            }
            else
            {
                Workshop.uploadingHook = item.GetWorkshopItemHook();
                if (Workshop.uploadingHook.PublishedFileId != PublishedFileId_t.Invalid)
                {
                    if (Prefs.LogVerbose)
                    {
                        Log.Message(string.Concat(new object[]
                        {
                            "Workshop: Starting item update for mod '",
                            Workshop.uploadingHook.Name,
                            "' with PublishedFileId ",
                            Workshop.uploadingHook.PublishedFileId
                        }), false);
                    }
                    Workshop.curStage        = WorkshopInteractStage.SubmittingItem;
                    Workshop.curUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), Workshop.uploadingHook.PublishedFileId);
                    Workshop.SetWorkshopItemDataFrom(Workshop.curUpdateHandle, Workshop.uploadingHook, false);
                    SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(Workshop.curUpdateHandle, "[Auto-generated text]: Update on " + DateTime.Now.ToString() + ".");
                    if (Workshop.< > f__mg$cache3 == null)
                    {
                        Workshop.< > f__mg$cache3 = new CallResult <SubmitItemUpdateResult_t> .APIDispatchDelegate(Workshop.OnItemSubmitted);
                    }
                    Workshop.submitResult = CallResult <SubmitItemUpdateResult_t> .Create(Workshop.< > f__mg$cache3);

                    Workshop.submitResult.Set(hAPICall, null);
                }
                else
                {
                    if (Prefs.LogVerbose)
                    {
                        Log.Message("Workshop: Starting item creation for mod '" + Workshop.uploadingHook.Name + "'.", false);
                    }
                    Workshop.curStage = WorkshopInteractStage.CreatingItem;
                    SteamAPICall_t hAPICall2 = SteamUGC.CreateItem(SteamUtils.GetAppID(), EWorkshopFileType.k_EWorkshopFileTypeFirst);
                    if (Workshop.< > f__mg$cache4 == null)
                    {
                        Workshop.< > f__mg$cache4 = new CallResult <CreateItemResult_t> .APIDispatchDelegate(Workshop.OnItemCreated);
                    }
                    Workshop.createResult = CallResult <CreateItemResult_t> .Create(Workshop.< > f__mg$cache4);

                    Workshop.createResult.Set(hAPICall2, null);
                }
                Find.WindowStack.Add(new Dialog_WorkshopOperationInProgress());
            }
        }
        public static string GetLabel(this WorkshopInteractStage stage)
        {
            string result;

            if (stage == WorkshopInteractStage.None)
            {
                result = "None".Translate();
            }
            else
            {
                result = ("WorkshopInteractStage_" + stage.ToString()).Translate();
            }
            return(result);
        }
Esempio n. 8
0
        internal static void Upload(WorkshopUploadable item)
        {
            if (curStage != 0)
            {
                Messages.Message("UploadAlreadyInProgress".Translate(), MessageTypeDefOf.RejectInput, historical: false);
            }
            else
            {
                uploadingHook = item.GetWorkshopItemHook();
                if (uploadingHook.PublishedFileId != PublishedFileId_t.Invalid)
                {
                    if (Prefs.LogVerbose)
                    {
                        Log.Message("Workshop: Starting item update for mod '" + uploadingHook.Name + "' with PublishedFileId " + uploadingHook.PublishedFileId);
                    }
                    curStage        = WorkshopInteractStage.SubmittingItem;
                    curUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), uploadingHook.PublishedFileId);
                    SetWorkshopItemDataFrom(curUpdateHandle, uploadingHook, creating: false);
                    SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(curUpdateHandle, "[Auto-generated text]: Update on " + DateTime.Now.ToString() + ".");
                    submitResult = CallResult <SubmitItemUpdateResult_t> .Create(OnItemSubmitted);

                    submitResult.Set(hAPICall);
                }
                else
                {
                    if (Prefs.LogVerbose)
                    {
                        Log.Message("Workshop: Starting item creation for mod '" + uploadingHook.Name + "'.");
                    }
                    curStage = WorkshopInteractStage.CreatingItem;
                    SteamAPICall_t hAPICall2 = SteamUGC.CreateItem(SteamUtils.GetAppID(), EWorkshopFileType.k_EWorkshopFileTypeFirst);
                    createResult = CallResult <CreateItemResult_t> .Create(OnItemCreated);

                    createResult.Set(hAPICall2);
                }
                Find.WindowStack.Add(new Dialog_WorkshopOperationInProgress());
            }
        }
Esempio n. 9
0
        private static void OnItemCreated(CreateItemResult_t result, bool IOFailure)
        {
            if (IOFailure || result.m_eResult != EResult.k_EResultOK)
            {
                Workshop.uploadingHook = null;
                Dialog_WorkshopOperationInProgress.CloseAll();
                Log.Error("Workshop: OnItemCreated failure. Result: " + result.m_eResult.GetLabel(), false);
                Find.WindowStack.Add(new Dialog_MessageBox("WorkshopSubmissionFailed".Translate(new object[]
                {
                    GenText.SplitCamelCase(result.m_eResult.GetLabel())
                }), null, null, null, null, null, false, null, null));
            }
            else
            {
                Workshop.uploadingHook.PublishedFileId = result.m_nPublishedFileId;
                if (Prefs.LogVerbose)
                {
                    Log.Message("Workshop: Item created. PublishedFileId: " + Workshop.uploadingHook.PublishedFileId, false);
                }
                Workshop.curUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), Workshop.uploadingHook.PublishedFileId);
                Workshop.SetWorkshopItemDataFrom(Workshop.curUpdateHandle, Workshop.uploadingHook, true);
                Workshop.curStage = WorkshopInteractStage.SubmittingItem;
                if (Prefs.LogVerbose)
                {
                    Log.Message("Workshop: Submitting item.", false);
                }
                SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(Workshop.curUpdateHandle, "[Auto-generated text]: Initial upload.");
                if (Workshop.< > f__mg$cache6 == null)
                {
                    Workshop.< > f__mg$cache6 = new CallResult <SubmitItemUpdateResult_t> .APIDispatchDelegate(Workshop.OnItemSubmitted);
                }
                Workshop.submitResult = CallResult <SubmitItemUpdateResult_t> .Create(Workshop.< > f__mg$cache6);

                Workshop.submitResult.Set(hAPICall, null);
                Workshop.createResult = null;
            }
        }