Esempio n. 1
0
 public PresetsForm(UserGameInfo info, List <PlayerInfo> playas, Dictionary <string, GameOption> options)
 {
     this.info    = info;
     this.players = playas;
     this.options = options;
     InitializeComponent();
 }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        private void list_Games_SelectedChanged(Control arg1, Control arg2)
        {
            selectedControl = (GameControl)arg1;

            if (selectedControl.UserGameInfo == null)
            {
                return;
            }

            panel_Steps.Visible = true;

            UserGameInfo userGameInfo = selectedControl.UserGameInfo;
            string       gameId       = selectedControl.UserGameInfo.GameID;

            GameHandlerMetadata[] handlers = gameManager.RepoManager.GetInstalledHandlers(gameId);
            if (handlers.Length == 0)
            {
                // uninstalled package perhaps?
                return;
            }

            currentHandlers = handlers;

            combo_Handlers.DataSource    = handlers;
            combo_Handlers.SelectedIndex = 0;
        }
Esempio n. 4
0
        private void ScanDrivesThread(object state)
        {
            List <SearchStorageInfo> storage = (List <SearchStorageInfo>)state;

            string[] result = StartGameUtil.ScanGames(storage.ToArray());

            bool shouldUpdate = false;

            for (int i = 0; i < result.Length; i++)
            {
                string path = result[i];

#if false
                UserGameInfo uinfo = GameManager.Instance.TryAddGame(path);

                if (uinfo != null)
                {
                    Log.WriteLine($"> Found new game ID {uinfo.GameID}");
                    shouldUpdate = true;
                }
#endif
            }

            if (shouldUpdate)
            {
                MainForm.Instance.Invoke((Action)MainForm.Instance.RefreshGames);
            }

            Invoke(new Action(() => {
                btn_search.Text    = "Scan";
                btn_search.Enabled = true;
            }));
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
0
        private void btn_Browse_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog open = new OpenFileDialog())
            {
                open.Filter = "Game Executable Files|*.exe";
                if (open.ShowDialog() == DialogResult.OK)
                {
                    string path = open.FileName;

                    List <GameHandlerMetadata> allGames = gameManager.User.InstalledHandlers;

                    GameList list = new GameList(allGames);
                    DPIManager.ForceUpdate();

                    if (list.ShowDialog() == DialogResult.OK)
                    {
                        GameHandlerMetadata selected = list.Selected;
                        UserGameInfo        game     = gameManager.TryAddGame(path, list.Selected);

                        if (game == null)
                        {
                            MessageBox.Show("Game already in your library!");
                        }
                        else
                        {
                            MessageBox.Show("Game accepted as ID " + game.GameID);
                            RefreshGames();
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        public bool Initialize(HandlerData handlerData, UserGameInfo userGameInfo, GameProfile profile)
        {
            this._handlerData = handlerData;
            this._userGame    = userGameInfo;
            this._profile     = profile;

            modules = new List <HandlerModule>();
            foreach (ModuleInfo info in GameManager.Instance.ModuleManager.Modules)
            {
                if (info.IsNeeded(handlerData))
                {
                    modules.Add((HandlerModule)Activator.CreateInstance(info.ModuleType));
                }
            }

            // order modules
            modules = modules.OrderBy(c => c.Order).ToList();

            for (int i = 0; i < modules.Count; i++)
            {
                modules[i].Initialize(this, handlerData, userGameInfo, profile);
            }

            return(true);
        }
Esempio n. 8
0
        public override void Initialize(UserGameInfo game, GameProfile profile)
        {
            base.Initialize(game, profile);

            gamepadTimer.Enabled = true;
            UpdatePlayers();
        }
        public IList <UserGameInfo> PullUserGameInfo(string userId)
        {
            //Pulls all games associated with user
            IList <UserGameInfo> userGameInfos = new List <UserGameInfo>();

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand cmd = connection.CreateCommand();
                connection.Open();
                cmd.CommandText = @"Select * from UserGameInfo where userName = @userID";
                cmd.Parameters.AddWithValue("@userID", userId);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    UserGameInfo newGameInfo = new UserGameInfo
                    {
                        User_name     = userId,
                        Game_Id       = (int)reader["game_Id"],
                        Game_isOwned  = (bool)reader["owned"],
                        Game_onWish   = (bool)reader["wishlist"],
                        Game_Progress = Convert.ToDouble(reader["progress"]),
                        Entry_Id      = (int)reader["EntryId"]
                    };
                    userGameInfos.Add(newGameInfo);
                }
            }
            return(userGameInfos);
        }
Esempio n. 10
0
        public GameControl(GenericGameInfo game, UserGameInfo userGame)
        {
            GameInfo     = game;
            UserGameInfo = userGame;

            picture          = new PictureBox();
            picture.SizeMode = PictureBoxSizeMode.StretchImage;

            title = new Label();
            if (game == null)
            {
                title.Text = "No games";
            }
            else
            {
                title.Text = GameInfo.GameName;
            }

            BackColor = Color.FromArgb(30, 30, 30);
            Size      = new Size(200, 52);

            Controls.Add(picture);
            Controls.Add(title);

            DPIManager.Register(this);
        }
Esempio n. 11
0
        private void selectGameFolderPageControl_SelectedGame(UserGameInfo obj)
        {
            gamePageControl.ChangeSelectedGame(obj);

            appPage = AppPage.GameHandler;
            UpdatePage();
        }
        public UserGameInfo PullSingleUserGameInfo(string userId, int gameId)
        {
            //Pulls a single game associated with user and the specific game ID
            UserGameInfo pulledUserGame = new UserGameInfo();

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand cmd = connection.CreateCommand();
                connection.Open();
                cmd.CommandText = @"select * from UserGameInfo where userName = @userID and game_id = @gameId";
                cmd.Parameters.AddWithValue("@userID", userId);
                cmd.Parameters.AddWithValue("@gameId", gameId);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    pulledUserGame.Entry_Id      = (int)reader["EntryId"];
                    pulledUserGame.Game_Id       = (int)reader["game_id"];
                    pulledUserGame.Game_isOwned  = (bool)reader["owned"];
                    pulledUserGame.Game_onWish   = (bool)reader["wishlist"];
                    pulledUserGame.Game_Progress = (int)reader["progress"];
                    pulledUserGame.User_name     = userId;
                }
            }
            return(pulledUserGame);
        }
Esempio n. 13
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog open = new OpenFileDialog())
            {
                open.Filter = "Game Executable Files|*.exe";
                if (open.ShowDialog() == DialogResult.OK)
                {
                    string path = open.FileName;

                    IGameInfo info = gameManager.GetGame(path);
                    GameList  list = new GameList(info);
                    if (list.ShowDialog() == DialogResult.OK)
                    {
                        UserGameInfo game = gameManager.TryAddGame(path, info);

                        if (game == null)
                        {
                            MessageBox.Show("Game already in your library!");
                        }
                        else
                        {
                            MessageBox.Show("Game accepted as " + game.Game.GameName);
                            RefreshGames();
                        }
                    }
                }
            }
        }
Esempio n. 14
0
        public void NewUserGame(UserGameInfo game)
        {
            if (noGamesPresent)
            {
                this.list_Games.Controls.Clear();
                noGamesPresent = false;
            }

            if (game.Game == null)
            {
                return;
            }

            GameControl con = new GameControl();

            con.Game  = game;
            con.Width = list_Games.Width;

            controls.Add(game, con);

            con.Text = game.Game.GameName;
            this.list_Games.Controls.Add(con);

            ThreadPool.QueueUserWorkItem(GetIcon, game);
        }
Esempio n. 15
0
        public void RefreshGames()
        {
            lock (controls)
            {
                foreach (var con in controls)
                {
                    if (con.Value != null)
                    {
                        con.Value.Dispose();
                    }
                }
                this.list_Games.Controls.Clear();
                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(null, null);
                    con.Width = list_Games.Width;
                    con.Text  = "No games";
                    this.list_Games.Controls.Add(con);
                }
            }

            DPIManager.ForceUpdate();
            GameManager.Instance.SaveUserProfile();
        }
Esempio n. 16
0
        public void Initialize(UserGameInfo game, GameProfile profile)
        {
            string documents    = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string configFolder = Path.Combine(documents, @"My Games\Borderlands 2\WillowGame\SaveData");

            DirectoryInfo[] userDirs = new DirectoryInfo(configFolder).GetDirectories();

            for (int i = 0; i < userDirs.Length; i++)
            {
                DirectoryInfo user = userDirs[i];

                FileInfo[] saves = user.GetFiles("*.sav");
                for (int j = 0; j < saves.Length; j++)
                {
                    FileInfo save = saves[j];

                    BorderlandsSaveControl con = new BorderlandsSaveControl();
                    using (Stream s = save.OpenRead())
                    {
                        con.SaveFile = SaveFile.Deserialize(s, SaveFile.DeserializeSettings.None);
                    }

                    con.UserName = user.Name;
                    //con.SaveName = con.SaveFile.SaveGame.AppliedCustomizations;
                    this.flowLayoutPanel1.Controls.Add(con);
                }
            }
        }
 public PlayerViewModel(List <PaymentMethodViewModel> paymentMethods, UserGameInfo gameInfo, decimal totalSpent)
 {
     PaymentMethods   = paymentMethods;
     Points           = gameInfo.Point;
     IsEnrolledInGame = gameInfo.IsEnrolledInGame;
     UserId           = gameInfo.UserId;
     TotalSpent       = totalSpent.ToString("0.00");
 }
Esempio n. 18
0
        public override bool Initialize(GameHandler handler, HandlerData handlerData, UserGameInfo game, GameProfile profile)
        {
            this.userGame    = game;
            this.profile     = profile;
            this.handlerData = handlerData;

            return(true);
        }
Esempio n. 19
0
        public void PushUserGameInfoTest()
        {
            dao.PushUserGameInfo("testUser", 300, 0, true, false);
            UserGameInfo test = new UserGameInfo();

            test = dao.PullSingleUserGameInfo("testUser", 300);
            Assert.AreEqual(300, test.Game_Id);
            Assert.AreEqual(0, test.Game_Progress);
        }
Esempio n. 20
0
        public void UpdateOwnedorWishListTest()
        {
            dao.UpdateUserGame(200, false, true, "testUser", 50);
            UserGameInfo test = new UserGameInfo();

            test = dao.PullSingleUserGameInfo("testUser", 200);
            Assert.AreEqual(true, test.Game_onWish);
            Assert.AreEqual("testUser", test.User_name);
        }
Esempio n. 21
0
        public void PullUserSingleGameInfoTest()
        {
            UserGameInfo test = new UserGameInfo();

            test = dao.PullSingleUserGameInfo("testUser", 200);
            Assert.AreEqual(false, test.Game_onWish);
            Assert.AreEqual(200, test.Game_Id);
            Assert.AreEqual(true, test.Game_isOwned);
        }
Esempio n. 22
0
        public void ChangeSelectedGame(UserGameInfo userGame)
        {
            this.userGame = userGame;

            panel_steps.Controls.Clear();

#if false
            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();

                //TODO fix
                //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);
            }
#endif

            DPIManager.ForceUpdate();
        }
Esempio n. 23
0
        private void GameContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Control selectedControl = FindControlAtCursor(this);

            if (selectedControl.GetType() == typeof(Label) || selectedControl.GetType() == typeof(PictureBox))
            {
                selectedControl = selectedControl.Parent;
            }

            foreach (Control c in selectedControl.Controls)
            {
                if (c is Label)
                {
                    if (c.Text == "No games")
                    {
                        gameContextMenuStrip.Items[0].Text = "No game selected...";
                        for (int i = 1; i < gameContextMenuStrip.Items.Count; i++)
                        {
                            gameContextMenuStrip.Items[i].Visible = false;
                        }
                        return;
                    }
                }
            }

            if (selectedControl.GetType() == typeof(GameControl))
            {
                currentControl  = (GameControl)selectedControl;
                currentGameInfo = currentControl.UserGameInfo;

                if (string.IsNullOrEmpty(currentGameInfo.GameGuid) || currentGameInfo == null)
                {
                    gameContextMenuStrip.Items[0].Text = "No game selected...";
                    for (int i = 1; i < gameContextMenuStrip.Items.Count; i++)
                    {
                        gameContextMenuStrip.Items[i].Visible = false;
                    }
                }
                else
                {
                    gameContextMenuStrip.Items[0].Text = currentGameInfo.Game.GameName;
                    for (int i = 1; i < gameContextMenuStrip.Items.Count; i++)
                    {
                        gameContextMenuStrip.Items[i].Visible = true;
                    }
                }
            }
            else
            {
                gameContextMenuStrip.Items[0].Text = "No game selected...";
                for (int i = 1; i < gameContextMenuStrip.Items.Count; i++)
                {
                    gameContextMenuStrip.Items[i].Visible = false;
                }
            }
        }
Esempio n. 24
0
        public ActionResult Player(string id)
        {
            string userId = id;
            List <UserPaymentMethod>      userPaymentMethods      = _UserService.GetPaymentMethodsByUser(userId);
            UserGameInfo                  gameInfo                = _GameService.GetGameInfoByUser(userId);
            List <PaymentMethodViewModel> paymentMethodViewModels = userPaymentMethods.ConvertAll(x => new PaymentMethodViewModel(x));
            decimal         totalSpent = _PaymentService.GetTotalSpentByUser(userId);
            PlayerViewModel viewModel  = new PlayerViewModel(paymentMethodViewModels, gameInfo, totalSpent);

            return(View(viewModel));
        }
        /*Frame scoring service*/
        //test strikes for frames 1-8
        //test strikes for frames 9 and 10

        //test spares for frames 1-8
        //test spares for frames 9 and 10

        //test scoring for frames 1-9
        //test scoring for 10th frame

        public FullGameInfo GenerateData()
        {
            FullGameInfo fullGameInfo = new FullGameInfo();

            fullGameInfo.GamePlayers = new List <UserGameInfo>();
            UserGameInfo player1 = new UserGameInfo();

            fullGameInfo.GamePlayers.Add(player1);

            return(fullGameInfo);
        }
Esempio n. 26
0
        public decimal AddProcessingFee(string userId, decimal amount)
        {
            UserGameInfo gameInfo = _GameDataAccess.GetGameInfoByUser(userId);

            if (gameInfo.IsEnrolledInGame)
            {
                decimal processingFee = amount * (decimal)0.0175;
                amount += processingFee;
            }
            return(amount);
        }
Esempio n. 27
0
        public override bool Initialize(GameHandler handler, HandlerData handlerData, UserGameInfo game, GameProfile profile)
        {
            this.handler     = handler;
            this.userGame    = game;
            this.profile     = profile;
            this.handlerData = handlerData;

            attached = new List <Process>();

            return(true);
        }
Esempio n. 28
0
 public UserGameInfo GetGameInfoByUser(string userId)
 {
     using (DataDbContext dbContext = new DataDbContext())
     {
         UserGameInfo gameInfo = dbContext.UserGameInfos.SingleOrDefault(x => x.UserId == userId);
         if (gameInfo == null)
         {
             gameInfo = new UserGameInfo();
         }
         return(gameInfo);
     }
 }
Esempio n. 29
0
 public int EntollIntoGame(string userId)
 {
     using (DataDbContext dbContext = new DataDbContext())
     {
         UserGameInfo gameInfo = dbContext.UserGameInfos.SingleOrDefault(x => x.UserId == userId);
         if (gameInfo != null)
         {
             gameInfo.IsEnrolledInGame = true;
         }
         return(dbContext.SaveChanges());
     }
 }
Esempio n. 30
0
        public override bool Initialize(GameHandler handler, HandlerData handlerData, UserGameInfo game, GameProfile profile)
        {
            this.userGame    = game;
            this.profile     = profile;
            this.handlerData = handlerData;

            handlerData.RegisterAdditional(Folder.Documents.ToString(), Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
            handlerData.RegisterAdditional(Folder.MainGameFolder.ToString(), Path.GetDirectoryName(game.ExePath));
            handlerData.RegisterAdditional(Folder.InstancedGameFolder.ToString(), Path.GetDirectoryName(game.ExePath));

            return(true);
        }