private void buttonPlayBattle_Click(object sender, EventArgs e) { if (playingBattleMusic) { player.Stop(); buttonPlayBattle.Text = "Play battle"; playingBattleMusic = false; return; } string path = HWData.GetFileInDataPaths(Map.MusicBattle + ".wav"); playingDefaultMusic = false; playingBattleMusic = false; buttonPlayDefault.Text = "Play default"; buttonPlayBattle.Text = "Play battle"; player.Stop(); if (!File.Exists(path)) { MessageBox.Show("File \"" + Map.MusicBattle + ".wav\" does not exist in the specified data paths.", "Failed to play music", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } buttonPlayBattle.Text = "Stop"; playingBattleMusic = true; player.SoundLocation = path; player.Play(); }
public void glControl_Load(object sender, EventArgs e) { Log.WriteLine("Initializing..."); Texture.Init(); Importer.Init(); Renderer.Init(); HWData.ParseDataPaths(); Background.LoadBackgroundFades(); Creation.Init(); Selection.Init(); LuaMap.SetupInterpreter(); Application.Idle += glControl_Update; Program.DeltaCounter.Start(); FPSCounter.LabelFPS = labelFPS; Loaded = true; gridProblems.RowTemplate.DefaultCellStyle.WrapMode = DataGridViewTriState.True; gridProblems.DefaultCellStyle.WrapMode = DataGridViewTriState.True; gridProblems.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True; this.WindowState = Settings.LastWindowState; this.Location = Settings.LastWindowLocation; this.Size = Settings.LastWindowSize; Map.Clear(); Program.Camera.ResetCamera(); if (Updater.CheckForUpdatesOnStart) { Updater.CheckForUpdates(); } Program.main.UpdateProblems(); Renderer.InvalidateMeshData(); Renderer.InvalidateView(); Renderer.Invalidate(); }