Exemplo n.º 1
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));
        }
Exemplo n.º 2
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");
 }
Exemplo n.º 3
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>();
            }
        }
        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);
        }
Exemplo n.º 5
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));
 }