示例#1
0
        public override void Init(ModData modData, Dictionary <string, string> info)
        {
            // TODO this is for MAPD only.
            Game.Settings.Graphics.SheetSize = 8192;

            if (!InstallationFinder.FindInstallation(modData, Generation1.AppIdSteam, Generation1.AppIdGog))
            {
                throw new Exception("NO GAME INSTALLATION FOUND");
            }

            base.Init(modData, info);

            renderer = Game.Renderer;
            if (renderer == null)
            {
                return;
            }

            sheet1 = new Sheet(SheetType.BGRA, modData.DefaultFileSystem.Open("uibits/loading_game.png"));
            sheet2 = new Sheet(SheetType.BGRA, modData.DefaultFileSystem.Open("uibits/loading_map.png"));
            logo1  = new Sprite(sheet1, new Rectangle(0, 0, 640, 480), TextureChannel.RGBA);
            logo2  = new Sprite(sheet2, new Rectangle(0, 0, 640, 480), TextureChannel.RGBA);
        }
示例#2
0
        public override void Init(ModData modData, Dictionary <string, string> info)
        {
            // TODO this is for MAPD only.
            Game.Settings.Graphics.SheetSize = 8192;

            this.gen1 = InstallationFinder.RegisterInstallation(modData, new Generation1());
            this.gen2 = InstallationFinder.RegisterInstallation(modData, new Generation2());

            var game = modData.Manifest.Id switch
            {
                "openkrush_gen1" => this.gen1,
                "openkrush_gen2" => this.gen2,
                _ => null
            };

            if (game == null)
            {
                var manifestType = modData.Manifest.GetType();
                manifestType.GetField(nameof(Manifest.Cursors))?.SetValue(modData.Manifest, new[] { "openkrush|cursors.yaml" });
            }
            else
            {
                this.canRun = true;
            }

            base.Init(modData, info);

            this.renderer = Game.Renderer;

            if (this.renderer == null)
            {
                return;
            }

            this.sheet = new(SheetType.BGRA, modData.DefaultFileSystem.Open(this.canRun ? "uibits/loading_game.png" : "uibits/missing_installation.png"));
            this.logo  = new(this.sheet, new(0, 0, 640, 480), TextureChannel.RGBA);
        }