public ShenmueLauncherWindow() { this.InitializeComponent(); if (AutoLaunch == null) { this.mController = new Controller[] { new Controller(UserIndex.One), new Controller(UserIndex.Two), new Controller(UserIndex.Three), new Controller(UserIndex.Four) }; if ((this.mController[0].IsConnected || this.mController[1].IsConnected || this.mController[2].IsConnected ? true : this.mController[3].IsConnected)) { this.mControllerTimer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(16) }; this.mControllerTimer.Tick += new EventHandler(this.Controller_Tick); this.mControllerTimer.Start(); } for (int i = 0; i < 3; i++) { this.mSounds[i] = new MediaPlayer(); } this.mSounds[0].Open(new Uri("bg_music.wav", UriKind.RelativeOrAbsolute)); this.PlaySound(ShenmueLauncherWindow.SoundIndex.Background); this.mSounds[0].MediaEnded += new EventHandler(this.MediaPlayer_MediaEnded); this.mSounds[1].Open(new Uri("menu_move.wav", UriKind.RelativeOrAbsolute)); this.mSounds[2].Open(new Uri("menu_select.wav", UriKind.RelativeOrAbsolute)); this.mSounds[1].Volume = 0.1; this.mSounds[2].Volume = 0.1; } this.LoadUserSettings(); if (AutoLaunch != null) { mLastGamePlayed = AutoLaunch.Value; Launch_Anim_Complete(this, null); } }
private void LoadUserSettings() { int lastLaunched = 0; try { lastLaunched = Settings.Default.LastLaunched; } catch (Exception exception) { Console.WriteLine("Failed to load user settings"); } this.mLastGamePlayed = (ShenmueLauncherWindow.GameType)lastLaunched; ShenmueLauncherWindow.GameType gameType = this.mLastGamePlayed; if (gameType == ShenmueLauncherWindow.GameType.SM1 || gameType != ShenmueLauncherWindow.GameType.SM2) { this.button_sm1.Focus(); this.FadeButton(0.65, this.button_sm1, ShenmueLauncherWindow.NextTask.None); this.FadeButton(0.2, this.button_sm2, ShenmueLauncherWindow.NextTask.None); } else { this.button_sm2.Focus(); this.FadeButton(0.2, this.button_sm1, ShenmueLauncherWindow.NextTask.None); this.FadeButton(0.65, this.button_sm2, ShenmueLauncherWindow.NextTask.None); } Console.WriteLine(string.Concat("Last Game was: ", this.mLastGamePlayed.ToString())); }
private void MoveRight() { if (!this.mGameLaunching && this.mLastGamePlayed == ShenmueLauncherWindow.GameType.SM1) { this.PlaySound(ShenmueLauncherWindow.SoundIndex.MenuMove); this.mLastGamePlayed = ShenmueLauncherWindow.GameType.SM2; this.FadeButton(0.2, this.button_sm1, ShenmueLauncherWindow.NextTask.None); this.FadeButton(0.65, this.button_sm2, ShenmueLauncherWindow.NextTask.None); } }
private void PrepareLaunchGame(ShenmueLauncherWindow.GameType lastGamePlayed) { if (this.mGameLaunching) { return; } this.mGameLaunching = true; this.PlaySound(ShenmueLauncherWindow.SoundIndex.MenuSelect); this.mLastGamePlayed = lastGamePlayed; this.SaveUserSettings(); if (this.mLastGamePlayed == ShenmueLauncherWindow.GameType.SM1) { this.FadeButton(1, this.button_sm1, ShenmueLauncherWindow.NextTask.FadeToBlack); return; } this.FadeButton(1, this.button_sm2, ShenmueLauncherWindow.NextTask.FadeToBlack); }