コード例 #1
0
        private IEnumerator showTurnSequence()
        {
            dispatcher.DispatchEvent(new DanceBattleEvents.SequenceDisplayStart(this, currentTurnData));
            destroyMoveIcons();
            for (int i = 0; i < currentTurnData.Moves.Count; i++)
            {
                DanceBattleMoveIcon moveIcon = UnityEngine.Object.Instantiate(moveIconPrefab, MoveIconContainer.transform, worldPositionStays: false).GetComponent <DanceBattleMoveIcon>();
                switch (currentTurnData.Moves[i])
                {
                case 1:
                    moveIcon.SetState(DanceBattleMoveIcon.MoveIconState.Icon1);
                    break;

                case 2:
                    moveIcon.SetState(DanceBattleMoveIcon.MoveIconState.Icon2);
                    break;

                case 3:
                    moveIcon.SetState(DanceBattleMoveIcon.MoveIconState.Icon3);
                    break;
                }
                moveIcon.GetComponent <Animator>().SetTrigger("Intro");
                moveIconList.Add(moveIcon);
                EventManager.Instance.PostEvent("SFX/UI/DanceGame/NoteAppear", EventAction.PlaySound, null, null);
                yield return(new WaitForSeconds(1f));
            }
        }
コード例 #2
0
        private void setState(DanceBattleVisualsState newState)
        {
            Screens[(int)currentState].SetActive(value: false);
            if (newState == DanceBattleVisualsState.Off || newState == DanceBattleVisualsState.Lobby || localPlayerIsInGame)
            {
                Screens[(int)newState].SetActive(value: true);
                RemotePenguinScreen.SetActive(value: false);
            }
            else
            {
                RemotePenguinScreen.SetActive(value: true);
            }
            switch (newState)
            {
            case DanceBattleVisualsState.Off:
                startTimerForNextLobbyStart();
                break;

            case DanceBattleVisualsState.Game:
                RedScoreBar.StopBounceAnim();
                BlueScoreBar.StopBounceAnim();
                MoveIconContainer.SetActive(value: true);
                setChatVisible(visible: false);
                if (isFirstTurn)
                {
                    CoroutineRunner.Start(playDanceMusicAfterDelay(DanceMusicStartDelay), this, "");
                    isFirstTurn = false;
                }
                CoroutineRunner.Start(switchStateAfterDelay(currentSequenceSet.SequenceDisplayTimeInSeconds, DanceBattleVisualsState.TurnTimer), this, "DanceBattleTimerWait");
                break;

            case DanceBattleVisualsState.TurnTimer:
            {
                destroyMoveIcons();
                MoveIconInputContainer.SetActive(value: true);
                for (int i = 0; i < currentSequenceSet.SequenceLength; i++)
                {
                    DanceBattleMoveIcon component = UnityEngine.Object.Instantiate(moveIconPrefab, MoveIconInputContainer.transform, worldPositionStays: false).GetComponent <DanceBattleMoveIcon>();
                    component.SetState((localPlayerTeamId != 1) ? DanceBattleMoveIcon.MoveIconState.BlankBlue : DanceBattleMoveIcon.MoveIconState.BlankRed);
                    moveIconList.Add(component);
                }
                dispatcher.DispatchEvent(new DanceBattleEvents.SequenceDisplayEnd(this));
                TurnTimer.StartCountdown(currentSequenceSet.TurnTimeInSeconds);
                CoroutineRunner.Start(switchStateAfterDelay(currentSequenceSet.TurnTimeInSeconds, DanceBattleVisualsState.PerformingMoves), this, "DanceBattleResultsWait");
                break;
            }

            case DanceBattleVisualsState.PerformingMoves:
            {
                destroyMoveIcons();
                setChatVisible(visible: true);
                StageAnimator.SetTrigger("StrobesHigh");
                string parameter = $"High{currentTurnData.RoundNum}";
                EventManager.Instance.PostEvent("MUS/Town/DJCadence/DanceGame", EventAction.SetSwitch, parameter, musicTargetObject);
                dispatcher.DispatchEvent(default(DanceBattleEvents.TurnTimerComplete));
                break;
            }

            case DanceBattleVisualsState.RoundResults:
            {
                StageAnimator.SetTrigger("StrobesLow");
                string trigger = "ResultLow";
                if (lastScoreBlueDelta > lastScoreRedDelta)
                {
                    trigger = "ResultPerfectBlue";
                }
                else if (lastScoreBlueDelta < lastScoreRedDelta)
                {
                    trigger = "ResultPerfectRed";
                }
                else if (lastScoreRedDelta > 0.5f)
                {
                    trigger = "ResultMed";
                }
                StageAnimator.SetTrigger(trigger);
                if (currentTurnData.RoundNum == danceBattleDefinition.NumberOfRounds - 1)
                {
                    CoroutineRunner.Start(switchStateAfterDelay(danceBattleDefinition.TurnStartDelayInSeconds, DanceBattleVisualsState.FinalResults), this, "DanceBattleResultsWait");
                }
                EventManager.Instance.PostEvent("MUS/Town/DJCadence/DanceGame", EventAction.SetSwitch, "Low", musicTargetObject);
                break;
            }

            case DanceBattleVisualsState.FinalResults:
                if (currentScoreData != null)
                {
                    int  num  = ((!(currentScoreData.Team1Score > currentScoreData.Team2Score)) ? 1 : 0);
                    bool flag = currentScoreData.Team1Score == currentScoreData.Team2Score;
                    if (flag)
                    {
                        StageAnimator.SetTrigger("WinTie");
                        WinnerText.text = localizer.GetTokenTranslation("PartyGames.FindFour.Draw");
                        WinnerBG.SelectColor(2);
                        FloorController.SetFloorHighlight(redHighlightOn: true, blueHighlightOn: true);
                        FloorController.SetFloorAnim(redAnimOn: true, blueAnimOn: true);
                    }
                    else if (num == 0)
                    {
                        StageAnimator.SetTrigger("WinBlue");
                        WinnerText.text = localizer.GetTokenTranslation("Activity.DanceBattle.TeamBlueWin");
                        WinnerBG.SelectColor(0);
                        FloorController.SetFloorHighlight(redHighlightOn: false, blueHighlightOn: true);
                        FloorController.SetFloorAnim(redAnimOn: false, blueAnimOn: true);
                    }
                    else
                    {
                        StageAnimator.SetTrigger("WinRed");
                        WinnerText.text = localizer.GetTokenTranslation("Activity.DanceBattle.TeamRedWin");
                        WinnerBG.SelectColor(1);
                        FloorController.SetFloorHighlight(redHighlightOn: true, blueHighlightOn: false);
                        FloorController.SetFloorAnim(redAnimOn: true, blueAnimOn: false);
                    }
                    if (flag || localPlayerTeamId == num)
                    {
                        EventManager.Instance.PostEvent("MUS/Town/DJCadence/DanceGame", EventAction.SetSwitch, "Win", musicTargetObject);
                    }
                    else
                    {
                        EventManager.Instance.PostEvent("MUS/Town/DJCadence/DanceGame", EventAction.SetSwitch, "Lose", musicTargetObject);
                    }
                    dispatcher.DispatchEvent(new DanceBattleEvents.FinalResultsShown(flag, num));
                    if (EndGameParticleSelector != null)
                    {
                        EndGameParticleSelector.SelectGameObject(num);
                    }
                }
                break;
            }
            currentState = newState;
        }