Ejemplo n.º 1
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (gameManager.User.Games.Count == 0)
            {
                if (MessageBox.Show("You have no games on your list. Would you like to automatically search your disk?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    ScanExes();
                }
            }

            List<UserGameInfo> games = gameManager.User.Games;
            for (int i = 0; i < games.Count; i++)
            {
                UserGameInfo game = games[i];

                GameControl con = new GameControl();
                con.Game = game;
                con.Width = list_Games.Width;

                controls.Add(game, con);

                con.Text = game.Game.GameName;
                ThreadPool.QueueUserWorkItem(GetIcon, game);

                this.list_Games.Controls.Add(con);
            }
        }
Ejemplo n.º 2
0
        public void NewUserGame(UserGameInfo game)
        {
            if (noGamesPresent)
            {
                this.list_Games.Controls.Clear();
                noGamesPresent = false;
            }

            GameControl con = new GameControl();
            con.Game = game;
            con.Width = list_Games.Width;

            controls.Add(game, con);

            con.Text = game.Game.GameName;
            ThreadPool.QueueUserWorkItem(GetIcon, game);

            this.list_Games.Controls.Add(con);
        }
Ejemplo n.º 3
0
        public void RefreshGames()
        {
            foreach (var con in controls)
            {
                if (con.Value != null)
                {
                    con.Value.Dispose();
                }
            }

            controls.Clear();
            this.list_Games.Controls.Clear();

            List<UserGameInfo> games = gameManager.User.Games;
            for (int i = 0; i < games.Count; i++)
            {
                UserGameInfo game = games[i];
                NewUserGame(game);
            }

            if (games.Count == 0)
            {
                noGamesPresent = true;
                GameControl con = new GameControl();
                con.Width = list_Games.Width;
                con.Text = "No games";
                this.list_Games.Controls.Add(con);
            }
        }
Ejemplo n.º 4
0
        private void list_Games_SelectedChanged(object arg1, Control arg2)
        {
            currentControl = (GameControl)arg1;
            currentGameInfo = currentControl.Game;
            if (currentGameInfo == null)
            {
                return;
            }

            if (!setSize)
            {
                this.Size = defaultSize;
                setSize = true;
            }

            panelGameName.Visible = true;
            label_StepTitle.Visible = true;
            StepPanel.Visible = true;
            btnBack.Visible = true;
            btnNext.Visible = true;

            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();

                btnBack.Visible = false;
                btnNext.Visible = 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);
            }
        }