private async void GameInit() { punchManager = new PunchManager(); punchKeyStorageManager = new PunchKeySotrageManager(); musicStorageManager = new MusicStorageManager(); playerPrefStorageManager = new PlayerPrefStorageManager(); gameState = GameState.Unavaliable; //UI InitLayer.Visibility = Visibility.Visible; LayerMain.Visibility = Visibility.Visible; PauseLayer.Visibility = Visibility.Collapsed; EndLayer.Visibility = Visibility.Collapsed; InputPanel.Visibility = Visibility.Collapsed; ChallengeHud.Visibility = Visibility.Collapsed; MultiplayerHud.Visibility = Visibility.Collapsed; //multiplayer activePlayer = new Player[] { new Player(), new Player() }; //loading player Player loadedPlayer = await playerPrefStorageManager.LoadPlayerPref(); if (selectedGameMode != MusicSelect.GameMode.Multiplayer && Definitions.usingPlayerPref) { if (loadedPlayer != null) { activePlayer[0] = loadedPlayer; } activePlayer[0].ActivingPlayerAvatar(); } BGMPlayer.Volume = (double)activePlayer[0].volumePref * 0.1; activePlayer[0].comboTextBlock = FirstPlayerComboText; activePlayer[0].scoreTextBlock = FirstPlayerScoreText; activePlayer[0].comboTextBlock.Text = ""; activePlayer[0].scoreTextBlock.Text = activePlayer[0].currentScore.ToString(); if (selectedGameMode == MusicSelect.GameMode.Multiplayer) { activePlayer[1].comboTextBlock = SecondPlayerComboText; activePlayer[1].scoreTextBlock = SecondPlayerScoreText; activePlayer[1].comboTextBlock.Text = ""; activePlayer[1].scoreTextBlock.Text = activePlayer[1].currentScore.ToString(); SecondPlayerHud.Visibility = Visibility.Visible; MultiplayerHud.Visibility = Visibility.Visible; //MultiplayerHud.DataContext = this; //foreach (var avaImage in activePlayer[1].activeAvatar.avaImages) //{ // gameCanvas.Children.Add(avaImage); //} } else { SecondPlayerHud.Visibility = Windows.UI.Xaml.Visibility.Collapsed; } if (selectedGameMode == MusicSelect.GameMode.Challenge) { ChallengeHud.Visibility = Visibility.Visible; challengeFullGauge = 0; if (activeMusic.selectedMusicMode == Music.MusicMode.EasyChallenge) { challengeFullGauge = Definitions.EasyChallengeFullGauge; } else if (activeMusic.selectedMusicMode == Music.MusicMode.NormalChallenge) { challengeFullGauge = Definitions.NormalChallengeFullGauge; } else if (activeMusic.selectedMusicMode == Music.MusicMode.HardChallenge) { challengeFullGauge = Definitions.HardChallengeFullGauge; } challengeGauge = challengeFullGauge; //ChallengeHud.DataContext = this; } if (activeMusic.selectedMusicMode == Music.MusicMode.InputMode) { FirstPlayerHud.Visibility = Visibility.Collapsed; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { //init player pref playerPrefStorageManager = new PlayerPrefStorageManager(); //init ava source TODO : FIND a better way doing this !!!!!!!!!!!!!!!!!!!!!!!!! headAvaList.Add(new AvatarSource("None", "None", 0, true)); headAvaList.Add(new AvatarSource("Head000", "Neko Ears", 3092, true)); headAvaList.Add(new AvatarSource("Head001", "Neko Ears", 3092, true)); headAvaList.Add(new AvatarSource("Head002", "Neko Ears", 3092, true)); headAvaList.Add(new AvatarSource("Head003", "Neko Ears", 3092, true)); topAvaList.Add(new AvatarSource("None", "None", 0, true)); topAvaList.Add(new AvatarSource("HandUp000", "Neko Paws", 678, true)); topAvaList.Add(new AvatarSource("HandUp002", "Neko Paws", 678, true)); topAvaList.Add(new AvatarSource("HandUp003", "Neko Paws", 678, true)); topAvaList.Add(new AvatarSource("HandUp004", "Neko Paws", 678, true)); bottomAvaList.Add(new AvatarSource("None", "None", 0, true)); bottomAvaList.Add(new AvatarSource("Foot001", "Neko Legs", 678, true)); bottomAvaList.Add(new AvatarSource("Foot000", "Neko Legs", 678, true)); bottomAvaList.Add(new AvatarSource("Foot002", "Neko Legs", 678, true)); bottomAvaList.Add(new AvatarSource("Foot003", "Neko Legs", 678, true)); HeadAvaListView.DataContext = this; TopAvaListView.DataContext = this; BottomAvaListView.DataContext = this; //init player pref dependencies activePlayer = new Player(); PlayerPrefInit(); AvaGrid.DataContext = this; //init UI Window.Current.Content.Visibility = Windows.UI.Xaml.Visibility.Visible; BackButton.Visibility = Windows.UI.Xaml.Visibility.Collapsed; var destinationMenu = e.Parameter as Nullable <MenuPage>; switch (destinationMenu) { case MenuPage.playMenu: OnClickPlay(null, null); break; case MenuPage.helpMenu: OnClickHelp(null, null); break; case MenuPage.settingMenu: OnClickSetting(null, null); break; case MenuPage.creditMenu: OnClickCredit(null, null); break; case MenuPage.shopMenu: OnClickShop(null, null); break; } }