private void onLobbyEnded()
 {
     if (spawnedLobby != null)
     {
         UnityEngine.Object.Destroy(spawnedLobby.gameObject);
     }
     if (currentState == DanceBattleVisualsState.Lobby)
     {
         turnOffEffects();
         if (localPlayerIsInGame && (numPlayersInLobby < partyGameDefinition.MinPlayerCount || redTeamLobbyCount == 0 || blueTeamLobbyCount == 0))
         {
             Service.Get <PromptManager>().ShowPrompt("PartyGameNotEnoughPlayersPrompt", null);
             DanceBattleUtils.LogNotEnoughPlayersBI();
             PartyGameUtils.EnableMainNavigation();
         }
         localPlayerIsInGame = false;
         EventManager.Instance.PostEvent("MUS/Town/DJCadence", EventAction.SetSwitch, "Evergreen", musicTargetObject);
     }
     if (topHud != null)
     {
         RemoveTopHud();
     }
     numPlayersInLobby = 0;
     LobbyCamera.gameObject.SetActive(value: false);
 }
Beispiel #2
0
 protected override void endGame(Dictionary <long, int> playerSessionIdToPlacement)
 {
     if (playerSessionIdToPlacement.ContainsKey(localPlayerSessionId))
     {
         this.playerSessionIdToPlacement = playerSessionIdToPlacement;
         Content.LoadAsync(onEndGamePopupLoadComplete, endGamePopupContentKey);
         if (scoreData == null)
         {
             scoreData            = new DanceBattleScoreData();
             scoreData.Team1Score = 0f;
             scoreData.Team2Score = 0f;
         }
         DanceBattleUtils.LogGameEndBI((!(scoreData.Team1Score > scoreData.Team2Score)) ? 1 : 0);
     }
 }
 private void onGameStarted()
 {
     dispatcher.DispatchEvent(new DanceBattleEvents.DanceBattleStart(this));
     isFirstTurn = true;
     setState(DanceBattleVisualsState.Intro);
     turnOnEffectsForGame();
     if (localPlayerIsInGame)
     {
         DanceBattleUtils.LogDanceStartBI(numPlayersInLobby);
     }
     EventManager.Instance.PostEvent("MUS/Town/DJCadence/IntroAdvance", EventAction.PlaySound, null, musicTargetObject);
     if (topHud != null)
     {
         RemoveTopHud();
     }
 }
        private void onLobbyPlayersUpdated(PartyGamePlayerCollection players)
        {
            bool flag = false;

            redTeamLobbyCount  = 0;
            blueTeamLobbyCount = 0;
            for (int i = 0; i < players.Players.Count; i++)
            {
                PartyGamePlayer partyGamePlayer = players.Players[i];
                if (partyGamePlayer.UserSessionId == localPlayerSessionId)
                {
                    flag = true;
                    localPlayerTeamId = partyGamePlayer.TeamId;
                    if (!localPlayerIsInGame)
                    {
                        moveLocalPlayerToPosition(spawnedLobby.GetPlayerPosition(partyGamePlayer.TeamId, partyGamePlayer.RoleId));
                        CoroutineRunner.Start(createTopHud(), this, "createTopHud");
                        DanceBattleUtils.LogPlayerJoinDanceBI(players.Players.Count);
                    }
                }
                if (partyGamePlayer.TeamId == 1)
                {
                    redTeamLobbyCount++;
                }
                else
                {
                    blueTeamLobbyCount++;
                }
            }
            if (localPlayerIsInGame && !flag)
            {
                if (topHud != null)
                {
                    RemoveTopHud();
                }
                PartyGameUtils.EnableMainNavigation();
            }
            else if (!localPlayerIsInGame && flag)
            {
                PartyGameUtils.DisableMainNavigation();
            }
            numPlayersInLobby   = players.Players.Count;
            localPlayerIsInGame = flag;
            LobbyCamera.gameObject.SetActive(localPlayerIsInGame);
        }
 private void onScoresUpdated(DanceBattleScoreData scoreData)
 {
     if (currentState == DanceBattleVisualsState.PerformingMoves)
     {
         currentScoreData   = scoreData;
         lastScoreRedDelta  = scoreData.Team2Score - lastScoreRed;
         lastScoreRed       = scoreData.Team2Score;
         lastScoreBlueDelta = scoreData.Team1Score - lastScoreBlue;
         lastScoreBlue      = scoreData.Team1Score;
         if (localPlayerIsInGame)
         {
             DanceBattleUtils.LogRoundEndBI(currentTurnData.RoundNum, (localPlayerTeamId == 0) ? lastScoreBlueDelta : lastScoreRedDelta, localPlayerTeamId);
         }
         RedScoreBar.SetBarValue(scoreData.Team2Score / (float)danceBattleDefinition.NumberOfRounds);
         BlueScoreBar.SetBarValue(scoreData.Team1Score / (float)danceBattleDefinition.NumberOfRounds);
         setState(DanceBattleVisualsState.RoundResults);
         dispatcher.DispatchEvent(new DanceBattleEvents.TurnEnd(this, currentTurnData, currentScoreData));
     }
 }