public void LoadPage()
        {
            var obpg = MGOnlineBookPages.FetchObjectByPage(int.Parse(CurrPage.Text), int.Parse(OBID.Text));

            if (obpg == null)
            {
                //((Minigame)Parent.Parent).CompleteGamePlay();
                try { ((Minigame)Parent.Parent.Parent.Parent).CompleteGamePlay(); return; } catch {}
                try { ((STG.SRP.ControlRoom.Controls.MinigamePreview)((Panel)Parent).Parent.Parent.Parent).CompleteGamePlay(); return; } catch { }
                //((Minigame)Parent.Parent.Parent.Parent).CompleteGamePlay(); return;
            }
            //       return "/images/games/books/e_" + obpg.OBPGID.ToString();
            imgSlide.ImageUrl = "/images/games/books/" + obpg.OBPGID.ToString() + ".png";
            lblEasy.Text      = obpg.TextEasy;
            lblMedium.Text    = obpg.TextMedium;
            lblHard.Text      = obpg.TextHard;
            var difficulty = int.Parse(Difficulty.Text);

            if (difficulty == 1)
            {
                pnlAudioEasy.Visible = System.IO.File.Exists(Server.MapPath(AudioEasy));
            }
            if (difficulty == 2)
            {
                pnlAudioMedium.Visible = System.IO.File.Exists(Server.MapPath(AudioMedium));
            }
            if (difficulty == 3)
            {
                pnlAudioHard.Visible = System.IO.File.Exists(Server.MapPath(AudioHard));
            }
        }
Example #2
0
        public void LoadPage()
        {
            var obpg = MGOnlineBookPages.FetchObjectByPage(int.Parse(CurrPage.Text), int.Parse(OBID.Text));

            if (obpg == null)
            {
                //((Minigame)Parent.Parent).CompleteGamePlay();
                try { ((Minigame)Parent.Parent.Parent.Parent).CompleteGamePlay(); return; } catch { }
                try { ((GRA.SRP.ControlRoom.Controls.MinigamePreview)((Panel)Parent).Parent.Parent.Parent).CompleteGamePlay(); return; } catch { }
                //((Minigame)Parent.Parent.Parent.Parent).CompleteGamePlay(); return;
            }
            imgSlide.ImageUrl = string.Format("~/images/games/books/{0}.png", obpg.OBPGID);
            var           difficulty = int.Parse(Difficulty.Text);
            StringBuilder audio      = new StringBuilder("~/images/games/books/");

            switch (difficulty)
            {
            case 2:
                //medium
                lblText.Text = obpg.TextMedium;
                audio.AppendFormat("m_{0}.mp3", obpg.OBPGID);
                break;

            case 3:
                //hard
                lblText.Text = obpg.TextHard;
                audio.AppendFormat("h_{0}.mp3", obpg.OBPGID);
                break;

            default:
                // 1 or anything else (shouldn't happen) is easy
                lblText.Text = obpg.TextEasy;
                audio.AppendFormat("e_{0}.mp3", obpg.OBPGID);
                break;
            }

            if (System.IO.File.Exists(Server.MapPath(audio.ToString())))
            {
                lblSound.Text = string.Format(
                    "<audio controls><source src='{0}' type='audio/mpeg'>Your browser does not support this audio format.</audio>",
                    VirtualPathUtility.ToAbsolute(audio.ToString()));
                pnlAudio.Visible = true;
            }
        }