コード例 #1
0
ファイル: Support.cs プロジェクト: samtovar/AsiSupport
        private void Initialize()
        {
            Game.FadeScreenOut(0);
            GameFiber.Wait(1000);

            Log.Info("Intializing AsiSupport version " + this.Version + "...");
            Log.Info("Using PursuitLib " + typeof(Log).GetVersion());
            Log.Info("Using PursuitLib.RPH " + typeof(RPHPlugin).GetVersion());

            ResourceManager.RegisterProvider("data", new DirectoryResourceProvider(this.DataDirectory));
            this.EnsureResourcesAvailable();
            if (this.IsStopped)
            {
                return;
            }

            ManifestFile gameVersions = new ManifestFile(Path.Combine(this.DataDirectory, "Versions.manifest"));
            string       versionStr   = Game.ProductVersion.ToString();
            bool         isSteamVer   = File.Exists("steam_api64.dll");

            for (int i = 0; i < gameVersions.Entries.Count; i++)
            {
                string entry   = gameVersions.Entries[i];
                bool   isSteam = entry[0] == 's';
                string version = entry.Substring(1);

                if (isSteam == isSteamVer && versionStr == version)
                {
                    this.GameVersion = i;
                    break;
                }
            }

            this.Loader          = new AsiLoader(Path.Combine("", "AsiPlugins"));
            this.TextureManager  = new TextureManager();
            this.KeyboardManager = new KeyboardManager();
            AsiInterface.Initialize();

            Log.Info("AsiSupport initialized.");

            if (this.Config.LoadAllPluginsOnStartup)
            {
                this.Loader.LoadAllPlugins();
            }

            if (this.Config.EnableSHVDNSupport)
            {
                SHVDN.Init();
            }

            Log.Info("All scripts are loaded. Fading screen back in...");

            Game.FadeScreenIn(1000);
            this.initialized = true;
        }
コード例 #2
0
ファイル: Support.cs プロジェクト: samtovar/AsiSupport
        public override void Unload(bool canSleep)
        {
            this.Loader?.UnloadAllPlugins();

            if (SHVDN.IsActive)
            {
                Log.Info("Disposing SHVDN support...");
                SHVDN.Dispose();
            }

            Log.Info("Disposing KeyboardManager...");
            this.KeyboardManager?.ReleaseHandle();

            Log.Info("Disposing AsiInterface...");
            AsiInterface.Dispose();

            base.Unload(canSleep);
            Log.Info("AsiSupport unloaded successfully.");
        }