示例#1
0
文件: Plugin.cs 项目: Zyian/Penumbra
        private void OnCommand(string command, string rawArgs)
        {
            var args = rawArgs.Split(' ');

            if (args.Length > 0 && args[0].Length > 0)
            {
                switch (args[0])
                {
                case "reload":
                {
                    ModManager.DiscoverMods();
                    PluginInterface.Framework.Gui.Chat.Print(
                        $"Reloaded Penumbra mods. You have {ModManager.Mods.ModSettings.Count} mods, {ModManager.Mods.EnabledMods.Length} of which are enabled."
                        );
                    break;
                }
                }

                return;
            }

            SettingsInterface.Visible = !SettingsInterface.Visible;
        }
示例#2
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            PluginInterface = pluginInterface;

            Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
            Configuration.Initialize(PluginInterface);

            ModManager = new ModManager(new DirectoryInfo(Configuration.BaseFolder));
            ModManager.DiscoverMods();

            ResourceLoader = new ResourceLoader(this);


            PluginInterface.CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand)
            {
                HelpMessage = "/penumbra 0 will disable penumbra, /penumbra 1 will enable it."
            });

            ResourceLoader.Init();
            ResourceLoader.Enable();

            SettingsInterface = new SettingsInterface(this);
            PluginInterface.UiBuilder.OnBuildUi += SettingsInterface.Draw;
        }