Esempio n. 1
0
        void Start()
        {
            _defaultScene = SceneManager.GetActiveScene();

            _modItems = new Dictionary <Mod, ModItem>();

            _modManager = ModManager.instance;

#if UNITY_EDITOR
            _modManager.AddSearchDirectory(Path.Combine(Application.dataPath, @"..\Builds\StandaloneWindows\Mods"));
#endif

            _modManager.refreshInterval = 2;

            foreach (Mod mod in _modManager.mods)
            {
                OnModFound(mod);
            }

            _modManager.ModFound    += OnModFound;
            _modManager.ModRemoved  += OnModRemoved;
            _modManager.ModLoaded   += OnModLoaded;
            _modManager.ModUnloaded += OnModUnloaded;

            Application.runInBackground = true;
        }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        baseTitle       = titleText.text;
        baseDescription = descriptionText.text;
        baseBanner      = banner.sprite;

#if !UNITY_WEBGL
        mods       = new List <Mod>();
        modManager = ModManager.instance;

        var path = Application.dataPath;
        if (Application.platform == RuntimePlatform.OSXPlayer)
        {
            path += "/../../Mods";
        }
        else if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.LinuxPlayer)
        {
            path += "/../Mods";
        }

#if !UNITY_ANDROID
        modManager.AddSearchDirectory(path);
#endif
#if UNITY_ANDROID
        var addonAppManager = new ModAppManager();
        addonAppManager.RefreshMods();
#endif
        startState.Enter();
        modManager.refreshInterval = 1;

        foreach (Mod mod in modManager.mods)
        {
            OnModFound(mod);
        }

        modManager.ModFound   += OnModFound;
        modManager.ModRemoved += OnModRemoved;
        modManager.ModLoaded  += OnModLoaded;
        foreach (var m in mods)
        {
            m.Unload();
        }
#endif
    }