Beispiel #1
0
    void Awake()
    {
        PluginConsole.RegisterConsoleCommand("sc_toggle", new PluginConsole.ConsoleCommandCallback(Cmd_Toggle), "Toggles smooth camera movement", this);

        if (bool.TryParse(PluginSettings.Instance.GetSetting("SmoothCameraToggle", smooth), out smooth))
        {
            PluginConsole.WriteLine("Smooth toggle setting loaded from file, smoothing enabled = " + smooth.ToString(), this);
        }
        else
        {
            PluginConsole.WriteLine("Could not load smooth toggle setting from file, using default: true", null);
        }
    }
        public void Initialize()
        {
            pluginContainerObject = new GameObject();
            UnityEngine.Object.DontDestroyOnLoad(pluginContainerObject);

            loadedPlugins = new List <DeadCorePlugin>();
            loadedPlugins.Add(this.pluginContainerObject.AddComponent <PluginConsole>());

            pluginsLocation = GlobalVars.RootFolder + "\\dcpm-plugins\\";

            if (!Directory.Exists(pluginsLocation))
            {
                Directory.CreateDirectory(pluginsLocation);
            }

            PluginConsole.RegisterConsoleCommand("plugins_list", Cmd_ListPlugins, "Lists all automatically loaded plugins", this);
            PluginConsole.RegisterConsoleCommand("plugins_info", Cmd_PluginInfo, "Display more detailed information about a loaded plugin, usage: 'plugins info <plugin id>' get the plugin id by using 'plugins list'", this);

            PluginConsole.WriteLine("Variables Initialized", this);

            LoadAllPlugins();
        }