public void ChangeSelectedGame(UserGameInfo userGame)
        {
            this.userGame = userGame;

            panel_steps.Controls.Clear();
            string gameId = userGame.GameID;

            if (mainForm == null)
            {
                mainForm = MainForm.Instance;
                mainForm.BrowserBtns.OnBrowse += BrowserBtns_OnBrowse;
            }

            currentHandlers = GameManager.Instance.PackageManager.GetInstalledHandlers(gameId);
            if (currentHandlers.Length == 0)
            {
                // uninstalled package perhaps?
                return;
            }

            if (currentHandlers.Length > 1)
            {
                MainForm.Instance.ChangeTitle("Choose one handler to run game",
                                              FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "⤷"));

                panel_steps.Controls.Add(list_handlers);

                list_handlers.Width  = panel_steps.Width;
                list_handlers.Height = panel_steps.Height;
                list_handlers.Left   = 1;
                list_handlers.Controls.Clear();

                for (var i = 0; i < currentHandlers.Length; i++)
                {
                    GameHandlerMetadata metadata = currentHandlers[i];

                    GameControl handlerControl = new GameControl();
                    handlerControl.Width  = list_handlers.Width;
                    handlerControl.Click += HandlerControl_Click;

                    handlerControl.SetHandlerMetadata(metadata);
                    list_handlers.Controls.Add(handlerControl);
                }
            }
            else
            {
                // create first step
                SetupSteps(currentHandlers[0]);
                GoToStep(0);
            }

            DPIManager.ForceUpdate();
        }
Exemple #2
0
        private void LoadInstalled()
        {
            var gm = GameManager.Instance;

            interrobang = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🗋");
            list_left.Controls.Clear();

            //HorizontalLineControl line = new HorizontalLineControl();
            //list_left.Controls.Add(line);
            //line.LineHorizontalPc = 100;
            //line.Width = list_left.Width;
            //line.LineHeight = 1;
            //line.LineColor = Color.FromArgb(255, 41, 45, 47);

            TitleSeparator appSettings = new TitleSeparator();

            appSettings.SetTitle("APP SETTINGS");
            appSettings.Height = 20;
            this.list_left.Controls.Add(appSettings);

            GameControl hotkeySettings = new GameControl();

            hotkeySettings.Width = list_left.Width;
            hotkeySettings.UpdateTitleText("Hotkeys");
            hotkeySettings.Image = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "☒");
            //hotkeySettings.Click += InstallGame_Click;
            list_left.Controls.Add(hotkeySettings);

            GameControl controllerSettings = new GameControl();

            controllerSettings.Width = list_left.Width;
            controllerSettings.UpdateTitleText("Controllers");
            controllerSettings.Image = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🎮");
            //controllerSettings.Click += InstallGame_Click;
            list_left.Controls.Add(controllerSettings);

            GameControl customPositionLayoutSettings = new GameControl();

            customPositionLayoutSettings.Width = list_left.Width;
            customPositionLayoutSettings.UpdateTitleText("Custom Position Layout");
            customPositionLayoutSettings.Image = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "📁");
            //controllerSettings.Click += InstallGame_Click;
            list_left.Controls.Add(customPositionLayoutSettings);

            GameControl miscelaneousSettings = new GameControl();

            miscelaneousSettings.Width = list_left.Width;
            miscelaneousSettings.UpdateTitleText("Miscelaneous");
            miscelaneousSettings.Image = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "⛏");
            //controllerSettings.Click += InstallGame_Click;
            list_left.Controls.Add(miscelaneousSettings);

            TitleSeparator gamesSep = new TitleSeparator();

            gamesSep.SetTitle("GAMES");
            gamesSep.Height = 20;
            this.list_left.Controls.Add(gamesSep);

            GameControl installGame = new GameControl();

            installGame.Width = list_left.Width;
            installGame.UpdateTitleText("Install game from exe");
            installGame.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "📁");
            installGame.Click += InstallGame_Click;
            list_left.Controls.Add(installGame);

            scanGames       = new GameControl();
            scanGames.Width = list_left.Width;
            scanGames.UpdateTitleText("Scan for game exes");
            scanGames.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🔍");
            scanGames.Click += ScanGames_Click;
            list_left.Controls.Add(scanGames);

            listInstalled       = new GameControl();
            listInstalled.Width = list_left.Width;
            listInstalled.UpdateTitleText("Remove games from list");
            listInstalled.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "⌫", 0, 8);
            listInstalled.Click += ListInstalled_Click;
            list_left.Controls.Add(listInstalled);

            TitleSeparator sep = new TitleSeparator();

            sep.SetTitle("HANDLERS");
            sep.Height = 20;
            this.list_left.Controls.Add(sep);

            GameControl installFile = new GameControl();

            installFile.Width = list_left.Width;
            installFile.UpdateTitleText("Install handler from file");
            installFile.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🔍");
            installFile.Click += InstallFile_Click;
            list_left.Controls.Add(installFile);

#if false
            var handlers = gm.User.InstalledHandlers;
            if (handlers.Count == 0)
            {
                GameControl noAvailable = new GameControl();
                noAvailable.Width = list_left.Width;
                noAvailable.UpdateTitleText("No installed game handlers");
                noAvailable.Image = interrobang;
                list_left.Controls.Add(noAvailable);
            }
            else
            {
                handlers.Sort(GameHandlerMetadata.CompareHandlerTitle);
                foreach (var handler in handlers)
                {
                    GameControl gameHandler = new GameControl();
                    gameHandler.Width = list_left.Width;
                    gameHandler.SetHandlerMetadata(handler);
                    gameHandler.Click += GameHandler_Click;
                    gameHandler.Image  = interrobang;
                    list_left.Controls.Add(gameHandler);
                }
            }
#endif

            DPI.DPIManager.ForceUpdate();
        }
        private void LoadInstalled()
        {
            var gm       = GameManager.Instance;
            var handlers = gm.User.InstalledHandlers;

            interrobang = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🗋");
            list_left.Controls.Clear();

            //HorizontalLineControl line = new HorizontalLineControl();
            //list_left.Controls.Add(line);
            //line.LineHorizontalPc = 100;
            //line.Width = list_left.Width;
            //line.LineHeight = 1;
            //line.LineColor = Color.FromArgb(255, 41, 45, 47);

            TitleSeparator gamesSep = new TitleSeparator();

            gamesSep.SetTitle("GAMES");
            gamesSep.Height = 20;
            this.list_left.Controls.Add(gamesSep);

            GameControl installGame = new GameControl();

            installGame.Width = list_left.Width;
            installGame.UpdateTitleText("Install game from exe");
            installGame.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "📁");
            installGame.Click += InstallGame_Click;
            list_left.Controls.Add(installGame);

            GameControl scanGames = new GameControl();

            scanGames.Width = list_left.Width;
            scanGames.UpdateTitleText("Scan for game exes");
            scanGames.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🔍");
            scanGames.Click += ScanGames_Click;
            list_left.Controls.Add(scanGames);

            listInstalled       = new GameControl();
            listInstalled.Width = list_left.Width;
            listInstalled.UpdateTitleText("Remove games from list");
            listInstalled.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "⌫", 0, 8);
            listInstalled.Click += ListInstalled_Click;
            list_left.Controls.Add(listInstalled);

            TitleSeparator sep = new TitleSeparator();

            sep.SetTitle("HANDLERS");
            sep.Height = 20;
            this.list_left.Controls.Add(sep);

            GameControl installFile = new GameControl();

            installFile.Width = list_left.Width;
            installFile.UpdateTitleText("Install handler from file");
            //installFile.Image = Resources.nucleus;
            installFile.Image  = FormGraphicsUtil.BuildCharToBitmap(new Size(40, 40), 30, Color.FromArgb(240, 240, 240), "🔍");
            installFile.Click += InstallFile_Click;
            list_left.Controls.Add(installFile);

            if (handlers.Count == 0)
            {
                GameControl noAvailable = new GameControl();
                noAvailable.Width = list_left.Width;
                noAvailable.UpdateTitleText("No installed game handlers");
                noAvailable.Image = interrobang;
                list_left.Controls.Add(noAvailable);
            }
            else
            {
                handlers.Sort(GameHandlerMetadata.CompareHandlerTitle);
                foreach (var handler in handlers)
                {
                    GameControl gameHandler = new GameControl();
                    gameHandler.Width = list_left.Width;
                    gameHandler.SetHandlerMetadata(handler);
                    gameHandler.Click += GameHandler_Click;
                    gameHandler.Image  = interrobang;
                    list_left.Controls.Add(gameHandler);
                }
            }

            DPIManager.ForceUpdate();
        }