Пример #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
            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);
            }