Ejemplo n.º 1
0
 internal static void OnItemInstalled(ItemInstalled_t result)
 {
     if (Workshop.IsOurAppId(result.m_unAppID))
     {
         if (Prefs.LogVerbose)
         {
             Log.Message("Workshop: Item installed: " + result.m_nPublishedFileId);
         }
         WorkshopItems.Notify_Installed(result.m_nPublishedFileId);
     }
 }
Ejemplo n.º 2
0
 internal static void OnItemSubscribed(RemoteStoragePublishedFileSubscribed_t result)
 {
     if (Workshop.IsOurAppId(result.m_nAppID))
     {
         if (Prefs.LogVerbose)
         {
             Log.Message("Workshop: Item subscribed: " + result.m_nPublishedFileId);
         }
         WorkshopItems.Notify_Subscribed(result.m_nPublishedFileId);
     }
 }
Ejemplo n.º 3
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());
            }
        }
Ejemplo n.º 4
0
 private static void RebuildItemsList()
 {
     if (SteamManager.Initialized)
     {
         WorkshopItems.subbedItems.Clear();
         foreach (PublishedFileId_t pfid in Workshop.AllSubscribedItems())
         {
             WorkshopItems.subbedItems.Add(WorkshopItem.MakeFrom(pfid));
         }
         ModLister.RebuildModList();
         ScenarioLister.MarkDirty();
     }
 }
 public static void InitIfNeeded()
 {
     if (SteamManager.initializedInt)
     {
         return;
     }
     if (!Packsize.Test())
     {
         Log.Error("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.", false);
     }
     if (!DllCheck.Test())
     {
         Log.Error("[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.", false);
     }
     try
     {
         if (SteamAPI.RestartAppIfNecessary(AppId_t.Invalid))
         {
             Application.Quit();
             return;
         }
     }
     catch (DllNotFoundException arg)
     {
         Log.Error("[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + arg, false);
         Application.Quit();
         return;
     }
     SteamManager.initializedInt = SteamAPI.Init();
     if (!SteamManager.initializedInt)
     {
         Log.Warning("[Steamworks.NET] SteamAPI.Init() failed. Possible causes: Steam client not running, launched from outside Steam without steam_appid.txt in place, running with different privileges than Steam client (e.g. \"as administrator\")", false);
     }
     else
     {
         if (SteamManager.steamAPIWarningMessageHook == null)
         {
             SteamManager.steamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamManager.SteamAPIDebugTextHook);
             SteamClient.SetWarningMessageHook(SteamManager.steamAPIWarningMessageHook);
         }
         Workshop.Init();
     }
 }
Ejemplo n.º 6
0
 internal static void OnItemUnsubscribed(RemoteStoragePublishedFileUnsubscribed_t result)
 {
     if (Workshop.IsOurAppId(result.m_nAppID))
     {
         if (Prefs.LogVerbose)
         {
             Log.Message("Workshop: Item unsubscribed: " + result.m_nPublishedFileId);
         }
         Page_ModsConfig page_ModsConfig = Find.WindowStack.WindowOfType <Page_ModsConfig>();
         if (page_ModsConfig != null)
         {
             page_ModsConfig.Notify_SteamItemUnsubscribed(result.m_nPublishedFileId);
         }
         Page_SelectScenario page_SelectScenario = Find.WindowStack.WindowOfType <Page_SelectScenario>();
         if (page_SelectScenario != null)
         {
             page_SelectScenario.Notify_SteamItemUnsubscribed(result.m_nPublishedFileId);
         }
         WorkshopItems.Notify_Unsubscribed(result.m_nPublishedFileId);
     }
 }
Ejemplo n.º 7
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;
            }
        }