Пример #1
0
 // Use this for initialization
 void Start()
 {
     if (SceneManager.GetActiveScene().name.Contains("Main Menu"))
     {
         TutBut.GetComponent <Button>().onClick.AddListener(delegate { MenuButtons(TutBut.name); });
         LBut.GetComponent <Button>().onClick.AddListener(delegate { MenuButtons(LBut.name); });
         BBut.GetComponent <Button>().onClick.AddListener(delegate { MenuButtons(BBut.name); });
     }
     ExitBut.GetComponent <Button>().onClick.AddListener(delegate { MenuButtons(ExitBut.name); });
 }
Пример #2
0
        public void LoadQuestion()
        {
            this.QuestionText.Text      = q[index].q_name;
            this.AText.Text             = q[index].c_a;
            this.BText.Text             = q[index].c_b;
            this.CText.Text             = q[index].c_c;
            this.DText.Text             = q[index].c_d;
            this.Level1.BackgroundImage = Properties.Resources.课后作业_难度1__2_;
            this.Level2.BackgroundImage = Properties.Resources.课后作业_难度2__2_;
            this.Level3.BackgroundImage = Properties.Resources.课后作业_难度3__2_;
            this.Level4.BackgroundImage = Properties.Resources.课后作业_难度4__2_;
            this.Level5.BackgroundImage = Properties.Resources.课后作业_难度5__2_;
            switch (q[index].hardlevel)
            {
            case 1: this.Level1.BackgroundImage = Properties.Resources.课后作业_难度1; break;

            case 2: this.Level2.BackgroundImage = Properties.Resources.课后作业_难度2; break;

            case 3: this.Level3.BackgroundImage = Properties.Resources.课后作业_难度3; break;

            case 4: this.Level4.BackgroundImage = Properties.Resources.课后作业_难度4; break;

            case 5: this.Level5.BackgroundImage = Properties.Resources.课后作业_难度5; break;

            default: this.Level1.BackgroundImage = Properties.Resources.课后作业_难度1; break;
            }
            if (answer[index] != null)
            {
                if (answer[index] == "A")
                {
                    ABut.Select();
                }
                if (answer[index] == "B")
                {
                    BBut.Select();
                }
                if (answer[index] == "C")
                {
                    CBut.Select();
                }
                if (answer[index] == "D")
                {
                    DBut.Select();
                }
            }
            else
            {
                ABut.Checked = false;
                BBut.Checked = false;
                CBut.Checked = false;
                DBut.Checked = false;
            }
            if (index == 9)
            {
                this.NextBut2.BackgroundImage = Properties.Resources.icon_下一题__1_;
                this.NextBut3.ForeColor       = Color.FromArgb(138, 138, 138);
                this.NextBut1.Cursor          = Cursors.Default;
                this.NextBut2.Cursor          = Cursors.Default;
                this.NextBut3.Cursor          = Cursors.Default;
                choosenextflag = true;
            }
            else if (index == 0)
            {
                this.LastBut2.BackgroundImage = Properties.Resources.icon_上一题__1_;
                this.LastBut3.ForeColor       = Color.FromArgb(138, 138, 138);
                this.LastBut1.Cursor          = Cursors.Default;
                this.LastBut2.Cursor          = Cursors.Default;
                this.LastBut3.Cursor          = Cursors.Default;
                chooselastflag = true;
            }
            else
            {
                if (choosenextflag)
                {
                    this.NextBut2.BackgroundImage = Properties.Resources.icon_下一题;
                    this.NextBut3.ForeColor       = Color.White;
                    this.NextBut1.Cursor          = Cursors.Hand;
                    this.NextBut2.Cursor          = Cursors.Hand;
                    this.NextBut3.Cursor          = Cursors.Hand;
                }
                if (chooselastflag)
                {
                    this.LastBut2.BackgroundImage = Properties.Resources.icon_上一题;
                    this.LastBut3.ForeColor       = Color.White;
                    this.LastBut1.Cursor          = Cursors.Hand;
                    this.LastBut2.Cursor          = Cursors.Hand;
                    this.LastBut3.Cursor          = Cursors.Hand;
                }
            }
            changeNum();
        }