예제 #1
0
            public static bool Prefix(PublishedFileId_t pfid)
            {
                // TODO: display some sort of in-progress indicator
                Debug.Log("Notify_Subscribed");

                // check if item was already present.
                var item = WorkshopItem.MakeFrom(pfid);

                if (item is WorkshopItem_Mod item_installed)
                {
                    // register item in WorkshopItems
                    workshopitems.Add(item_installed);

                    // register item in ModLister
                    var mod = new ModMetaData(item_installed);
                    modlister.Add(mod);

                    // show a message
                    Messages.Message(I18n.ModInstalled(mod.Name), MessageTypeDefOf.PositiveEvent, false);

                    // notify button manager that we done stuff.
                    ModButtonManager.Notify_DownloadCompleted(mod);
                }
                else
                {
                    // add dowloading item to MBM
                    var button = new ModButton_Downloading(pfid);
                    ModButtonManager.TryAdd(button);
                    Page_BetterModConfig.Instance.Selected = button;
                }

                // do whatever needs doing for ScenarioLister.
                ScenarioLister.MarkDirty();
                return(false);
            }
예제 #2
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();
     }
 }
예제 #3
0
            public static bool Prefix(PublishedFileId_t pfid)
            {
                Debug.Log("Notify_Unsubscribed");

                // deregister item in WorkshopItems
                var item = workshopitems.FirstOrDefault(i => i.PublishedFileId == pfid);

                workshopitems.TryRemove(item);

                // deregister item in ModLister
                var mod = modlister.FirstOrDefault(m => m.Source == ContentSource.SteamWorkshop &&
                                                   m.Identifier == pfid.ToString());

                modlister.TryRemove(mod);

                // remove button
                ModButtonManager.Notify_Unsubscribed(pfid.ToString());

                ScenarioLister.MarkDirty();
                return(false);
            }
예제 #4
0
            public static bool Prefix(PublishedFileId_t pfid)
            {
                Debug.Log("Notify_Installed");

                // register item in WorkshopItems
                var item = WorkshopItem.MakeFrom(pfid);

                workshopitems.Add(item);

                // register item in ModLister
                var mod = new ModMetaData(item);

                modlister.Add(mod);

                // show a message
                Messages.Message(I18n.ModInstalled(mod.Name), MessageTypeDefOf.PositiveEvent, false);

                // notify button manager that we done stuff.
                ModButtonManager.Notify_DownloadCompleted(mod);

                ScenarioLister.MarkDirty();
                return(false);
            }