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);
 }
예제 #2
0
        protected override void startGame()
        {
            hideRemotePlayers();
            loadAudioPrefab(partyGameDefinition);
            changeState(FindFourState.Intro);
            PartyGameUtils.AddParticipationFilter(localPlayerParticipationController);
            PartyGameUtils.AddActionConfirmationFilter(partyGameDefinition);
            PartyGameUtils.DisableMainNavigation();
            PartyGameUtils.DisableLocomotionControls();
            Vector3          position = default(Vector3);
            DataEntityHandle handle   = Service.Get <CPDataEntityCollection>().FindEntity <SessionIdData, long>(base.players[0].UserSessionId);

            if (dataEntityCollection.TryGetComponent <GameObjectReferenceData>(handle, out var component))
            {
                position = component.GameObject.transform.position;
            }
            CoroutineRunner.Start(createBoard(position), this, "CreateFindFourBoard");
            Content.LoadAsync(onHudPrefabLoaded, HUD_UI_PREFAB_KEY);
            dispatcher.AddListener <InputEvents.ActionEvent>(onActionEvent);
            changeControlState(ControlsState.Disabled);
            if (base.players[0].UserSessionId == localPlayerSessionId)
            {
                PartyGameUtils.LogGameStartBi(partyGameDefinition.name, base.players.Count);
                PartyGameUtils.StartBiTimer(partyGameDefinition.name, base.sessionId);
            }
            if (!disablerManager.IsUIElementDisabled("CellphoneButton"))
            {
                PartyGameUtils.DisableCellPhoneButton();
            }
            Service.Get <EventDispatcher>().DispatchEvent(new PartyGameEvents.PartyGameStarted(partyGameDefinition));
            dispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: false));
        }
예제 #3
0
 protected override void destroy()
 {
     itemIdToItemGameObject.Clear();
     removeListeners();
     PartyGameUtils.RemoveParticipationFilter(localPlayerParticipationController);
     enableLocomotionControls();
     changeToDefaultCamera();
     PartyGameUtils.RemoveActionConfirmationFilter();
     enableMainNavigation();
     resetPropControls();
     if (playerIdToRoleIndicators.Count > 0)
     {
         foreach (KeyValuePair <long, GameObject> playerIdToRoleIndicator in playerIdToRoleIndicators)
         {
             Service.Get <EventDispatcher>().DispatchEvent(new PlayerIndicatorEvents.RemovePlayerIndicator(playerIdToRoleIndicator.Key, isStored: false));
         }
         playerIdToRoleIndicators.Clear();
     }
     if (hudUI != null)
     {
         Object.Destroy(hudUI.gameObject);
     }
     Object.Destroy(parentTransform.gameObject);
     CoroutineRunner.StopAllForOwner(this);
     Service.Get <EventDispatcher>().DispatchEvent(new PartyGameEvents.PartyGameEnded(partyGameDefinition));
 }
예제 #4
0
 protected override void endGame(Dictionary <long, int> playerSessionIdToPlacement)
 {
     if (playerSessionIdToPlacement.ContainsKey(localPlayerSessionId))
     {
         didWin = false;
         if (playerSessionIdToPlacement[localPlayerSessionId] == 0)
         {
             didWin = true;
         }
         showEndGameUI();
         if (didWin)
         {
             logWinBi();
         }
         if (currentState != ScavengerHuntState.Hiding)
         {
             PartyGameUtils.LogBalkBi(partyGameDefinition.name);
         }
         if (base.players[0].UserSessionId == localPlayerSessionId)
         {
             PartyGameUtils.StopBiTimer(base.sessionId);
             PartyGameUtils.LogGameEndBi(partyGameDefinition.name, playerSessionIdToPlacement.Count);
         }
         EventManager.Instance.PostEvent("SFX/AO/MarbleHunt/TimeRunningOut", EventAction.StopSound);
         EventManager.Instance.PostEvent("SFX/AO/MarbleHunt/ClockLoop", EventAction.StopSound);
     }
 }
예제 #5
0
 private void OnDestroy()
 {
     if (!partyGameStarted)
     {
         PartyGameUtils.EnableCellPhoneButton();
     }
     Service.Get <EventDispatcher>().RemoveListener <PartyGameEvents.PartyGameStarted>(onPartyGameStarted);
 }
예제 #6
0
 private bool onSceneTransition(SceneTransitionEvents.TransitionStart evt)
 {
     dispatcher.RemoveListener <SceneTransitionEvents.TransitionStart>(onSceneTransition);
     PartyGameUtils.EnableMainNavigation();
     PartyGameUtils.EnableLocomotionControls();
     PartyGameUtils.EnableCellPhoneButton();
     enableDanceMoveControls();
     dispatcher.RemoveListener <ControlsScreenEvents.ControlLayoutLoadComplete>(onControlLayoutLoadComplete);
     return(false);
 }
예제 #7
0
 protected override void startGame()
 {
     addEventListeners();
     localPlayer = getPartyGamePlayerById(Service.Get <CPDataEntityCollection>().LocalPlayerSessionId);
     PartyGameUtils.AddParticipationFilter(localPlayerParticipationController);
     PartyGameUtils.AddActionConfirmationFilter(partyGameDefinition, "DanceBattleExitPrompt");
     Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.DisableUIElement("ChatButtons", hideElement: true));
     PartyGameUtils.DisableCellPhoneButton(hide: true);
     changeControlState(ControlsState.Disabled);
 }
        private void getDefinitions()
        {
            Dictionary <int, PartyGameDefinition> dictionary = Service.Get <IGameData>().Get <Dictionary <int, PartyGameDefinition> >();

            if (dictionary.ContainsKey(3))
            {
                partyGameDefinition   = dictionary[3];
                danceBattleDefinition = (DanceBattleDefinition)partyGameDefinition.GameData;
                lobbyDefinition       = (PartyGameLobbyMmoItemTeamDefinition)partyGameDefinition.LobbyData;
                launcherDefinition    = PartyGameUtils.GetPartyGameLauncherForPartyGameId(partyGameDefinition.Id);
            }
        }
예제 #9
0
 private void handleLocalPlayerLeftLobby()
 {
     isLocalPlayerInLobby = false;
     Service.Get <EventDispatcher>().DispatchEvent(default(TubeRaceEvents.LocalPlayerLeftLobby));
     moveLocalPlayerToPosition(LobbyExitPosition.position);
     LocomotionHelper.SetCurrentController <RunController>(SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject);
     Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.EnableUIElement("ControlsButton2"));
     Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.EnableUIElement("ActionButton"));
     PartyGameUtils.EnableMainNavigation();
     PartyGameUtils.EnableCellPhoneButton();
     Service.Get <EventDispatcher>().DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: true));
     Service.Get <QuestService>().SendEvent($"Cancel{RaceDefinition.QuestEventIdentifier}Race");
 }
        private void getPartyGameDefinitionForLocalPlayerPropExperience()
        {
            PropExperience componentInChildren = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponentInChildren <PropExperience>();

            if (componentInChildren == null)
            {
                UnityEngine.Object.Destroy(this);
            }
            partyGameDefinition = PartyGameUtils.GetPartyGameForTriggerProp(componentInChildren.PropDef.Id);
            if (partyGameDefinition == null)
            {
                UnityEngine.Object.Destroy(this);
            }
        }
예제 #11
0
 protected override void destroy()
 {
     PartyGameUtils.EnableMainNavigation();
     PartyGameUtils.RemoveParticipationFilter(localPlayerParticipationController);
     PartyGameUtils.RemoveActionConfirmationFilter();
     PartyGameUtils.EnableCellPhoneButton();
     removeEventListeners();
     changeToDefaultCamera();
     changeControlState(ControlsState.Enabled);
     Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.EnableUIElement("ChatButtons"));
     if (danceBattleVisualsController != null)
     {
         danceBattleVisualsController.RemoveTopHud();
     }
 }
예제 #12
0
 private void handleLocalPlayerJoinedLobby()
 {
     isLocalPlayerInLobby = true;
     Service.Get <EventDispatcher>().DispatchEvent(default(TubeRaceEvents.LocalPlayerJoinedLobby));
     moveLocalPlayerToPosition(LobbyPosition.position);
     LocomotionHelper.SetCurrentController <SlideController>(SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject);
     Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.DisableUIElement("ControlsButton2"));
     Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.DisableUIElement("ActionButton"));
     PartyGameUtils.DisableMainNavigation();
     PartyGameUtils.DisableCellPhoneButton(hide: true);
     Service.Get <EventDispatcher>().DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: false));
     Service.Get <EventDispatcher>().DispatchEvent(default(PlayerCardEvents.DismissPlayerCard));
     Service.Get <QuestService>().SendEvent($"Join{RaceDefinition.QuestEventIdentifier}Race");
     Service.Get <ICPSwrveService>().Action("tube_race", "lobby");
 }
예제 #13
0
        public DanceBattle()
        {
            dataEntityCollection = Service.Get <CPDataEntityCollection>();
            dispatcher           = Service.Get <EventDispatcher>();
            eventChannel         = new EventChannel(dispatcher);
            localPlayerSessionId = dataEntityCollection.LocalPlayerSessionId;
            partyGameDefinition  = getPartyGameDefinition(3);
            localPlayerParticipationController = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <ParticipationController>();
            PartyGameUtils.DisableMainNavigation();
            GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);

            if (gameObject != null)
            {
                trayFSMContext = gameObject.GetComponent <StateMachineContext>();
            }
        }
예제 #14
0
        protected override void endGame(Dictionary <long, int> playerSessionIdToPlacement)
        {
            if (playerSessionIdToPlacement.Count == 0)
            {
                PartyGameUtils.LogBalkBi(partyGameDefinition.name);
                return;
            }
            foreach (FishBucketPlayerData value in playerData.Values)
            {
                if (playerSessionIdToPlacement.ContainsKey(value.PlayerId))
                {
                    value.Placement = playerSessionIdToPlacement[value.PlayerId];
                }
            }
            List <PartyGameEndGamePlayerData> list = new List <PartyGameEndGamePlayerData>();
            bool flag = false;

            foreach (FishBucketPlayerData value2 in playerData.Values)
            {
                PartyGameEndGamePlayerData item = new PartyGameEndGamePlayerData(value2.PlayerId, value2.Placement, value2.PlayerNum, value2.IsLocalPlayer, value2.Score, hasScore: true);
                if (list.Count == 0 || value2.Placement == -1)
                {
                    list.Add(item);
                    continue;
                }
                for (int i = 0; i < list.Count; i++)
                {
                    if (value2.Placement <= list[i].Placement || list[i].Placement == -1)
                    {
                        list.Insert(i, item);
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    list.Add(item);
                }
                flag = false;
            }
            loadEndGameScreen(list.ToArray());
            if (base.players[0].UserSessionId == localPlayerSessionId)
            {
                PartyGameUtils.StopBiTimer(base.sessionId);
                PartyGameUtils.LogGameEndBi(partyGameDefinition.name, playerSessionIdToPlacement.Count);
            }
        }
예제 #15
0
 protected override void destroy()
 {
     dispatcher.RemoveListener <InputEvents.ActionEvent>(onActionEvent);
     ResetCamera();
     showRemotePlayers();
     removeListeners();
     PartyGameUtils.RemoveParticipationFilter(localPlayerParticipationController);
     PartyGameUtils.RemoveActionConfirmationFilter();
     PartyGameUtils.EnableMainNavigation();
     PartyGameUtils.EnableLocomotionControls();
     dispatcher.DispatchEvent(default(ControlsScreenEvents.ReturnToDefaultLeftOption));
     Object.Destroy(boardGameObject);
     Object.Destroy(hudUI.gameObject);
     PartyGameUtils.EnableCellPhoneButton();
     dispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: true));
     CoroutineRunner.StopAllForOwner(this);
 }
        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);
        }
예제 #17
0
 protected override void startGame()
 {
     loadAudioPrefab(partyGameDefinition);
     totalItemsHidden     = 0;
     totalItemsFound      = 0;
     otherPlayerSessionId = ((base.players[0].UserSessionId == localPlayerSessionId) ? base.players[1].UserSessionId : base.players[0].UserSessionId);
     scavengerHuntData    = new ScavengerHuntData(base.sessionId, localPlayerSessionId, otherPlayerSessionId, scavengerHuntDefinition.MaxHiddenItems, partyGameDefinition.Rewards[0].Reward, partyGameDefinition.Rewards[1].Reward);
     changeState(ScavengerHuntState.AwaitingRoles);
     PartyGameUtils.AddParticipationFilter(localPlayerParticipationController);
     PartyGameUtils.AddActionConfirmationFilter(partyGameDefinition);
     disableMainNavigation();
     if (base.players[0].UserSessionId == localPlayerSessionId)
     {
         PartyGameUtils.LogGameStartBi(partyGameDefinition.name, base.players.Count);
         PartyGameUtils.StartBiTimer(partyGameDefinition.name, base.sessionId);
     }
     Service.Get <EventDispatcher>().DispatchEvent(new PartyGameEvents.PartyGameStarted(partyGameDefinition));
 }
예제 #18
0
 protected override void destroy()
 {
     PartyGameUtils.RemoveParticipationFilter(localPlayerParticipationController);
     PartyGameUtils.RemoveActionConfirmationFilter();
     PartyGameUtils.EnableMainNavigation();
     PartyGameUtils.EnableLocomotionControls();
     animationController.Destroy();
     removeListeners();
     ResetCamera();
     UnityEngine.Object.Destroy(hudUI.gameObject);
     UnityEngine.Object.Destroy(cannonGameObject);
     if (animationController != null)
     {
         FishBucketAnimationController fishBucketAnimationController = animationController;
         fishBucketAnimationController.CannonRotationCompleteAction = (System.Action)Delegate.Remove(fishBucketAnimationController.CannonRotationCompleteAction, new System.Action(onCannonRotationComplete));
     }
     CoroutineRunner.StopAllForOwner(this);
     currentState = FishBucketState.Finished;
     PartyGameUtils.EnableCellPhoneButton();
     Service.Get <EventDispatcher>().DispatchEvent(new PartyGameEvents.PartyGameEnded(partyGameDefinition));
 }
예제 #19
0
 protected override void startGame()
 {
     loadAudioPrefab(partyGameDefinition);
     changeState(FishBucketState.AwaitingPositions);
     PartyGameUtils.AddParticipationFilter(localPlayerParticipationController);
     PartyGameUtils.AddActionConfirmationFilter(partyGameDefinition);
     PartyGameUtils.DisableMainNavigation();
     PartyGameUtils.DisableLocomotionControls();
     initPlayerData();
     Content.LoadAsync(onHudPrefabLoaded, HUD_UI_PREFAB_KEY);
     setAnimationControllerPlayers();
     if (base.players[0].UserSessionId == localPlayerSessionId)
     {
         PartyGameUtils.LogGameStartBi(partyGameDefinition.name, base.players.Count);
         PartyGameUtils.StartBiTimer(partyGameDefinition.name, base.sessionId);
     }
     if (!Service.Get <UIElementDisablerManager>().IsUIElementDisabled("CellphoneButton"))
     {
         PartyGameUtils.DisableCellPhoneButton();
     }
     Service.Get <EventDispatcher>().DispatchEvent(new PartyGameEvents.PartyGameStarted(partyGameDefinition));
 }
예제 #20
0
        protected override void endGame(Dictionary <long, int> playerSessionIdToPlacement)
        {
            if (playerSessionIdToPlacement.Count == 0)
            {
                PartyGameUtils.LogBalkBi(partyGameDefinition.name);
                return;
            }
            List <PartyGameEndGamePlayerData> list = new List <PartyGameEndGamePlayerData>();

            foreach (KeyValuePair <long, int> item in playerSessionIdToPlacement)
            {
                list.Add(new PartyGameEndGamePlayerData(item.Key, item.Value, (item.Key != base.players[0].UserSessionId) ? 1 : 0, item.Key == localPlayerSessionId));
            }
            list.Sort((PartyGameEndGamePlayerData a, PartyGameEndGamePlayerData b) => a.Placement.CompareTo(b.Placement));
            loadEndGameScreen(list.ToArray());
            if (base.players[0].UserSessionId == localPlayerSessionId)
            {
                bool won = playerSessionIdToPlacement[localPlayerSessionId] == 0;
                PartyGameUtils.StopBiTimer(base.sessionId);
                PartyGameUtils.LogGameEndBi(partyGameDefinition.name, playerSessionIdToPlacement.Count, won);
            }
        }
예제 #21
0
 private void Start()
 {
     PartyGameUtils.DisableCellPhoneButton();
 }
 protected override void destroy()
 {
     eventChannel.RemoveAllListeners();
     PartyGameUtils.EnableCellPhoneButton();
     eventDispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: true));
 }