コード例 #1
0
        public Play(string level, Settings settings, Worlds worlds)
        {
            allDone.Reset();
            InitializeComponent();
            Sound_music.CheckMusic(settings);
            Visible  = false;
            readFile = new ReadFile(level);
            string[]     data          = readFile.SearchData().Split('|');
            LoadingLevel loadingScreen = new LoadingLevel("Level " + level, data[0].Split('#')[1], data[1], data[3]);

            loadingScreen.Show();
            new Thread(LoadingScreen).Start();

            this.level      = level;
            this.worlds     = worlds;
            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            this.settings   = settings;
            engine          = new Engine(readFile.InterpretFile(settings), Controls);

            allDone.WaitOne();
            Visible = true;
            loadingScreen.Close();

            Focus();
            engine.Start();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Gnuhry/Mario
 public Form1()
 {
     InitializeComponent();
     settings = ReadFile.GetSettings();
     Sound_music.CheckMusic(settings);
     if (ReadFile.IsFirst())
     {
         btnStart.Enabled = false;
     }
 }
コード例 #3
0
        private void score_KeyDown(object sender, KeyEventArgs e)
        {
            if (realoud)
            {
                return;
            }
            if (e.KeyData == Keys.Space)
            {
                switch (counter)
                {
                case 0:
                    Sound_music.CounterSound(worlds.GetSetting());
                    lbTime.Text = time + " sek";
                    if (time > higscoore)
                    {
                        lbNewRecord.Visible = true;
                    }
                    counter++;
                    break;

                case 1:
                case 2:
                    Sound_music.CounterSound(worlds.GetSetting());
                    lbCoin.Text = coins + " Coins";
                    counter++;
                    break;

                case 3:
                case 4:
                case 5:
                    if (ricecoins[0])
                    {
                        Sound_music.RiceCoinSound(worlds.GetSetting());
                        pcBrCoin1.Image = Properties.Resources.ricecoin;
                    }
                    if (ricecoins[1])
                    {
                        Sound_music.RiceCoinSound(worlds.GetSetting());
                        pcBrCoin2.Image = Properties.Resources.ricecoin;
                    }
                    if (ricecoins[2])
                    {
                        Sound_music.RiceCoinSound(worlds.GetSetting());
                        pcBrCoin3.Image = Properties.Resources.ricecoin;
                    }
                    break;

                default: ToWorld(); break;
                }
            }
            else if (e.KeyData == Keys.Escape)
            {
                ToWorld();
            }
        }
コード例 #4
0
 private void chBmusic_Click(object sender, EventArgs e)
 {
     settings.Music   = !settings.Music;
     chBmusic.Checked = settings.Music;
     Sound_music.CheckMusic(settings);
     if (chBmusic.Checked)
     {
         tBarMusicValue.Enabled = true;
     }
     else
     {
         tBarMusicValue.Enabled = false;
     }
 }
コード例 #5
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (lbNewRecord.Visible && counter % 5 == 0)
            {
                if (lbNewRecord.ForeColor == Color.Yellow)
                {
                    lbNewRecord.ForeColor = Color.OrangeRed;
                }
                else
                {
                    lbNewRecord.ForeColor = Color.Yellow;
                }
            }
            switch (counter)
            {
            case 0:
                if (timecounter < time)
                {
                    Sound_music.CounterSound(worlds.GetSetting());
                    lbTime.Text  = timecounter + " sek";
                    timecounter += 1;
                    break;
                }
                lbTime.Text = time + " sek";
                if (time < higscoore)
                {
                    lbNewRecord.Visible = true;
                }
                counter++;
                break;

            case 1:
                timecounter = 1;
                counter++;
                break;

            case 2:
                if (timecounter < coins)
                {
                    Sound_music.CounterSound(worlds.GetSetting());
                    lbCoin.Text = timecounter + " Coins";
                    timecounter++;
                    break;
                }
                counter++;
                break;

            case 3:
                if (ricecoins[0])
                {
                    Sound_music.RiceCoinSound(worlds.GetSetting());
                    pcBrCoin1.Image = Properties.Resources.ricecoin;
                }
                counter++;
                break;

            case 10:
                if (ricecoins[1])
                {
                    Sound_music.RiceCoinSound(worlds.GetSetting());
                    pcBrCoin2.Image = Properties.Resources.ricecoin;
                }
                counter++;
                break;

            case 17:
                if (ricecoins[2])
                {
                    Sound_music.RiceCoinSound(worlds.GetSetting());
                    pcBrCoin3.Image = Properties.Resources.ricecoin;
                }
                counter++;
                break;

            case 400: ToWorld(); break;

            default: counter++; break;
            }
        }
コード例 #6
0
ファイル: pause.cs プロジェクト: Gnuhry/Mario
 private void btnGoOn_Click(object sender, EventArgs e)
 {
     play.Enabled = true;
     Sound_music.CheckMusic(settings);
     Close();
 }
コード例 #7
0
 private void tBarMusicValue_Scroll(object sender, EventArgs e)
 {
     settings.Volume = tBarMusicValue.Value / 100.0;
     Sound_music.ChangeVolume(settings);
 }