Exemplo n.º 1
0
        private void list_Games_SelectedChanged(object arg1, Control arg2)
        {
            currentControl  = (GameControl)arg1;
            currentGameInfo = currentControl.Game;
            currentGame     = currentGameInfo.Game;

            btn_Play.Enabled = false;

            if (currentGame.Steps == null ||
                currentStepIndex == currentGame.Steps.Length)
            {
                // can play
                btn_Play.Enabled = true;

                // remove the current step if there's one
                KillCurrentStep();

                arrow_Back.Enabled = false;
                arrow_Next.Enabled = false;
            }

            currentProfile = new GameProfile();
            currentProfile.InitializeDefault(currentGame);

            this.label_GameTitle.Text = currentGame.GameName;
            this.pic_Game.Image       = currentGameInfo.Icon;

            Type[] steps = currentGame.Steps;
            if (steps != null && steps.Length > 0)
            {
                GoToStep(0);
            }
        }
Exemplo n.º 2
0
        private void SetupSteps(GameHandlerMetadata metadataSelected)
        {
            KillCurrentStep();

            if (handlerDataManager != null)
            {
                // dispose
                handlerDataManager.Dispose();
                handlerDataManager = null;
            }

            selectedHandler    = metadataSelected;
            handlerDataManager = GameManager.Instance.PackageManager.ReadHandlerDataFromInstalledPackage(selectedHandler);
            handlerData        = handlerDataManager.HandlerData;

            BrowserBtns.SetPlayButtonState(false);

            stepsList = new List <UserInputControl>();
            stepsList.Add(positionsControl);
            stepsList.Add(optionsControl);
            if (handlerData.CustomSteps != null)
            {
                for (int i = 0; i < handlerData.CustomSteps.Count; i++)
                {
                    stepsList.Add(jsControl);
                }
            }

            currentProfile = new GameProfile();
            currentProfile.InitializeDefault(handlerData);

            MainForm.Instance.ChangeGameInfo(userGame);
        }
Exemplo n.º 3
0
        private void list_Games_SelectedChanged(object arg1, Control arg2)
        {
            currentControl  = (GameControl)arg1;
            currentGameInfo = currentControl.UserGameInfo;
            if (currentGameInfo == null)
            {
                btn_delete.Visible     = false;
                btn_details.Visible    = false;
                btn_openScript.Visible = false;
                btn_open_data.Visible  = false;
                return;
            }

            StepPanel.Visible = true;

            currentGame = currentGameInfo.Game;

            btn_Play.Enabled = false;

            stepsList = new List <UserInputControl>();
            stepsList.Add(positionsControl);
            stepsList.Add(optionsControl);
            for (int i = 0; i < currentGame.CustomSteps.Count; i++)
            {
                stepsList.Add(jsControl);
            }

            currentProfile = new GameProfile();
            currentProfile.InitializeDefault(currentGame);

            gameNameControl.GameInfo = currentGameInfo;

            btn_delete.Location     = new Point(384 + (gameNameControl.Width - 100), 39);
            btn_delete.Visible      = true;
            btn_details.Location    = new Point(384 + (gameNameControl.Width - 100), 8);
            btn_details.Visible     = true;
            btn_openScript.Location = new Point(450 + (gameNameControl.Width - 100), 8);
            btn_openScript.Visible  = true;
            btn_open_data.Location  = new Point(450 + (gameNameControl.Width - 100), 39);
            btn_open_data.Visible   = true;

            if (content != null)
            {
                content.Dispose();
            }

            // contnet manager is shared withing the same game
            content = new ContentManager(currentGame);
            GoToStep(0);
        }
Exemplo n.º 4
0
        private void list_Games_SelectedChanged(object arg1, Control arg2)
        {
            currentControl  = (GameControl)arg1;
            currentGameInfo = currentControl.Game;
            if (currentGameInfo == null)
            {
                return;
            }

            StepPanel.Visible = true;
            btnBack.Visible   = true;
            btn_Play.Visible  = true;

            currentGame = currentGameInfo.Game;

            btn_Play.Enabled = false;

            if (!currentGame.SupportsPositioning &&
                currentGame.Options.Length == 0)
            {
                // can play
                btn_Play.Enabled = true;

                // remove the current step if there's one
                KillCurrentStep();

                btnBack.Visible = false;
            }

            stepsList = new List <UserInputControl>();
            if (currentGame.SupportsPositioning)
            {
                stepsList.Add(countControl);
                stepsList.Add(positionsControl);
            }
            if (currentGame.Options.Length != 0)
            {
                stepsList.Add(optionsControl);
            }

            currentProfile = new GameProfile();
            currentProfile.InitializeDefault(currentGame);

            this.label_GameTitle.Text = currentGame.GameName;
            this.pic_Game.Image       = currentGameInfo.Icon;

            GoToStep(0);
        }
Exemplo n.º 5
0
        private void combo_Handlers_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (combo_Handlers.SelectedIndex == -1)
            {
                return;
            }

            KillCurrentStep();

            if (handlerDataManager != null)
            {
                // dispose
                handlerDataManager.Dispose();
                handlerDataManager = null;
            }

            try
            {
                selectedHandler    = currentHandlers[combo_Handlers.SelectedIndex];
                handlerDataManager = gameManager.RepoManager.ReadHandlerDataFromInstalledPackage(selectedHandler);
                handlerData        = handlerDataManager.HandlerData;

                btn_Play.Enabled = false;

                stepsList = new List <UserInputControl>();
                stepsList.Add(positionsControl);
                stepsList.Add(optionsControl);
                if (handlerData.CustomSteps != null)
                {
                    for (int i = 0; i < handlerData.CustomSteps.Count; i++)
                    {
                        stepsList.Add(jsControl);
                    }
                }

                currentProfile = new GameProfile();
                currentProfile.InitializeDefault(handlerData);

                gameNameControl.GameInfo = selectedControl.UserGameInfo;

                GoToStep(0);
            }
            catch (Exception ex)
            {
                Debugger.Break();
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            GameManager manager = new GameManager();

            IGameInfo    borderlands2 = manager.Games["720CE71B-FCBF-46C8-AC9D-C4B2BF3169E3"];
            UserGameInfo borderInfo   = manager.AddGame(borderlands2, @"C:\Program Files (x86)\Steam\steamapps\common\Borderlands 2\Binaries\Win32\Borderlands2.exe");

            GameProfile profile = new GameProfile();

            profile.InitializeDefault(borderlands2);

            PlayerInfo p1 = new PlayerInfo();

            p1.MonitorBounds = new Rectangle(0, 0, 960, 540);
            p1.ScreenIndex   = 0;
            profile.PlayerData.Add(p1);

            PlayerInfo p2 = new PlayerInfo();

            p2.MonitorBounds = new Rectangle(0, 540, 960, 540);
            p2.ScreenIndex   = 0;
            profile.PlayerData.Add(p2);

            borderInfo.Profiles.Add(profile);

            manager.WaitSave();

            // try to play game with custom profile
            handler = manager.MakeHandler(borderlands2);

            handler.Initialize(borderInfo, profile);

            ThreadPool.QueueUserWorkItem(Play);
            //handler.Play();

            for (; ;)
            {
                Thread.Sleep(16);
                handler.Update(16);

                if (handler.HasEnded)
                {
                    break;
                }
            }
        }
Exemplo n.º 7
0
        private void combo_Handlers_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (combo_Handlers.SelectedIndex == -1)
            {
                return;
            }

            selectedHandler = currentHandlers[combo_Handlers.SelectedIndex];
            handlerData     = gameManager.RepoManager.ReadHandlerDataFromInstalledPackage(selectedHandler);

            btn_Play.Enabled = false;

            stepsList = new List <UserInputControl>();
            stepsList.Add(positionsControl);
            stepsList.Add(optionsControl);
            if (handlerData.CustomSteps != null)
            {
                for (int i = 0; i < handlerData.CustomSteps.Count; i++)
                {
                    stepsList.Add(jsControl);
                }
            }

            currentProfile = new GameProfile();
            currentProfile.InitializeDefault(handlerData);

            gameNameControl.GameInfo = selectedControl.UserGameInfo;

            if (content != null)
            {
                content.Dispose();
            }

            // content manager is shared withing the same game
            content = new ContentManager(selectedHandler, handlerData);
            GoToStep(0);
        }