protected void BtnHard_Click(object sender, EventArgs e)
        {
            pnlDifficulty.Visible = false;
            pnlGame.Visible       = true;
            var gs = GamePlayStats.FetchObject(int.Parse(GPSID.Text));

            gs.Difficulty = "Hard";
            gs.Update();

            //ReloadGame(Hard)
            var mg = DAL.Minigame.FetchObject(int.Parse(MGID.Text));

            if (mg.MiniGameType == 1)
            {
                MGBook1.LoadGame(mg.MGID, 3);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 2)
            {
                MGMixMatchPlay1.LoadGame(mg.MGID, 3);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 3)
            {
                MGCodeBreaker1.LoadGame(mg.MGID, 3);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 4)
            {
                MGWordMatch1.LoadGame(mg.MGID, 3);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 5)
            {
                MGMatchingGamePlay1.LoadGame(mg.MGID, 3);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 6)
            {
                MGHiddenPicPlay1.LoadGame(mg.MGID, 3);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 7)
            {
                MGChooseAdvPlay1.LoadGame(mg.MGID, 3);
                pnlGame.Visible = true;
            }
        }
Beispiel #2
0
        protected void BtnMedium_Click(object sender, EventArgs e)
        {
            pnlDifficulty.Visible = false;
            pnlGame.Visible       = true;


            //ReloadGame(Medium)
            var mg = DAL.Minigame.FetchObject(int.Parse(MGID.Text));

            if (mg.MiniGameType == 1)
            {
                MGBook1.LoadGame(mg.MGID, 2);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 2)
            {
                MGMixMatchPlay1.LoadGame(mg.MGID, 2);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 3)
            {
                MGCodeBreaker1.LoadGame(mg.MGID, 2);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 4)
            {
                MGWordMatch1.LoadGame(mg.MGID, 2);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 5)
            {
                MGMatchingGamePlay1.LoadGame(mg.MGID, 2);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 6)
            {
                MGHiddenPicPlay1.LoadGame(mg.MGID, 2);
                pnlGame.Visible = true;
            }
            if (mg.MiniGameType == 7)
            {
                MGChooseAdvPlay1.LoadGame(mg.MGID, 2);
                pnlGame.Visible = true;
            }
        }
        private void LoadMinigame(int mgid, int minigame)
        {
            if (minigame == 1)
            {
                var mg = DAL.MGOnlineBook.FetchObjectByParent(mgid);
                MGBook1.LoadGame(mgid, 1);
                if (mg.EnableMediumDifficulty || mg.EnableHardDifficulty)
                {
                    pnlDifficulty.Visible = true;
                    BtnMedium.Visible     = mg.EnableMediumDifficulty;
                    BtnHard.Visible       = mg.EnableHardDifficulty;

                    pnlGame.Visible = false;
                }
                else
                {
                    pnlDifficulty.Visible = false;
                    pnlGame.Visible       = true;
                }
                MGBook1.Visible = true;
            }

            if (minigame == 2)
            {
                var mg = DAL.MGMixAndMatch.FetchObjectByParent(mgid);
                MGMixMatchPlay1.LoadGame(mgid, 1);
                if (mg.EnableMediumDifficulty || mg.EnableHardDifficulty)
                {
                    pnlDifficulty.Visible = true;
                    BtnMedium.Visible     = mg.EnableMediumDifficulty;
                    BtnHard.Visible       = mg.EnableHardDifficulty;

                    pnlGame.Visible = false;
                }
                else
                {
                    pnlDifficulty.Visible = false;
                    pnlGame.Visible       = true;
                }
                MGMixMatchPlay1.Visible = true;
            }

            if (minigame == 3)
            {
                //var mg = DAL.MGCodeBreaker.FetchObjectByParent(mgid);
                var mg = DAL.MGCodeBreaker.FetchObjectByParent(mgid);
                MGCodeBreaker1.LoadGame(mgid, 1);
                if (mg.EnableMediumDifficulty || mg.EnableHardDifficulty)
                {
                    pnlDifficulty.Visible = true;
                    BtnMedium.Visible     = mg.EnableMediumDifficulty;
                    BtnHard.Visible       = mg.EnableHardDifficulty;

                    pnlGame.Visible = false;
                }
                else
                {
                    pnlDifficulty.Visible = false;
                    pnlGame.Visible       = true;
                }
                MGCodeBreaker1.Visible = true;
            }

            if (minigame == 4)
            {
                var mg = DAL.MGWordMatch.FetchObjectByParent(mgid);
                MGWordMatch1.LoadGame(mgid, 1);
                if (mg.EnableMediumDifficulty || mg.EnableHardDifficulty)
                {
                    pnlDifficulty.Visible = true;
                    BtnMedium.Visible     = mg.EnableMediumDifficulty;
                    BtnHard.Visible       = mg.EnableHardDifficulty;

                    pnlGame.Visible = false;
                }
                else
                {
                    pnlDifficulty.Visible = false;
                    pnlGame.Visible       = true;
                }
                MGWordMatch1.Visible = true;
            }

            if (minigame == 5)
            {
                var mg = DAL.MGMatchingGame.FetchObjectByParent(mgid);
                MGMatchingGamePlay1.LoadGame(mgid, 1);
                if (mg.EnableMediumDifficulty || mg.EnableHardDifficulty)
                {
                    pnlDifficulty.Visible = true;
                    BtnMedium.Visible     = mg.EnableMediumDifficulty;
                    BtnHard.Visible       = mg.EnableHardDifficulty;

                    pnlGame.Visible = false;
                }
                else
                {
                    pnlDifficulty.Visible = false;
                    pnlGame.Visible       = true;
                }
                MGMatchingGamePlay1.Visible = true;
            }

            if (minigame == 6)
            {
                var mg = DAL.MGHiddenPic.FetchObjectByParent(mgid);
                MGHiddenPicPlay1.LoadGame(mgid, 1);
                if (mg.EnableMediumDifficulty || mg.EnableHardDifficulty)
                {
                    pnlDifficulty.Visible = true;
                    BtnMedium.Visible     = mg.EnableMediumDifficulty;
                    BtnHard.Visible       = mg.EnableHardDifficulty;

                    pnlGame.Visible = false;
                }
                else
                {
                    pnlDifficulty.Visible = false;
                    pnlGame.Visible       = true;
                }
                MGHiddenPicPlay1.Visible = true;
            }

            if (minigame == 7)
            {
                var mg = DAL.MGChooseAdv.FetchObjectByParent(mgid);
                MGChooseAdvPlay1.LoadGame(mgid, 1);
                if (mg.EnableMediumDifficulty || mg.EnableHardDifficulty)
                {
                    pnlDifficulty.Visible = true;
                    BtnMedium.Visible     = mg.EnableMediumDifficulty;
                    BtnHard.Visible       = mg.EnableHardDifficulty;

                    pnlGame.Visible = false;
                }
                else
                {
                    pnlDifficulty.Visible = false;
                    pnlGame.Visible       = true;
                }
                MGChooseAdvPlay1.Visible = true;
            }
        }