Example #1
0
        public void ChangeServer(string worldName)
        {
            ZoneTransitionService zoneTransitionService = Service.Get <ZoneTransitionService>();
            PresenceData          component;
            string sceneName = ((!dataEntityCollection.TryGetComponent <PresenceData>(dataEntityCollection.LocalPlayerHandle, out component)) ? GetZoneToLoad() : component.Room);

            Service.Get <LoadingController>().ClearAllLoadingSystems();
            zoneTransitionService.LoadZone(sceneName, SceneConfig.TransitionSceneName, worldName);
            gameStateMachine.SendEvent(ZoneConnectingEvent);
        }
Example #2
0
        public void ReconnectFromHome()
        {
            ZoneTransitionService zoneTransitionService = Service.Get <ZoneTransitionService>();
            string text = zoneTransitionService.CurrentZone.SceneName;

            if (text == null)
            {
                text = GetZoneToLoad();
            }
            zoneTransitionService.LoadZone(text);
        }
Example #3
0
        public void RetryConnection(string roomName, string worldName = null)
        {
            ZoneTransitionService zoneTransitionService = Service.Get <ZoneTransitionService>();

            zoneTransitionService.LoadZone(zoneTransitionService.CurrentZone, SceneConfig.TransitionSceneName);
        }
        public void ResumeGameServer()
        {
            ZoneTransitionService zoneTransitionService = Service.Get <ZoneTransitionService>();

            zoneTransitionService.LoadZone(zoneTransitionService.CurrentZone);
        }
Example #5
0
        public void SpawnPlayer(SpawnPlayerParams spawnPlayerParams)
        {
            if (spawnPlayerParams.Zone != null || !string.IsNullOrEmpty(spawnPlayerParams.SceneName))
            {
                bool                  flag                  = false;
                PresenceData          component             = dataEntityCollection.GetComponent <PresenceData>(dataEntityCollection.LocalPlayerHandle);
                ZoneTransitionService zoneTransitionService = Service.Get <ZoneTransitionService>();
                if (spawnPlayerParams.Zone != null)
                {
                    ZoneDefinition zoneBySceneName = zoneTransitionService.GetZoneBySceneName(component.Room);
                    flag = zoneBySceneName != null && string.Equals(spawnPlayerParams.Zone.ZoneName, zoneBySceneName.ZoneName);
                }
                else if (!string.IsNullOrEmpty(spawnPlayerParams.SceneName))
                {
                    flag = ((!zoneTransitionService.IsInIgloo) ? string.Equals(component.Room, spawnPlayerParams.SceneName) : string.Equals(zoneTransitionService.CurrentZone.SceneName, spawnPlayerParams.SceneName));
                }
                if (!flag)
                {
                    if (!dataEntityCollection.TryGetComponent <SpawnData>(dataEntityCollection.LocalPlayerHandle, out var component2))
                    {
                        component2 = dataEntityCollection.AddComponent <SpawnData>(dataEntityCollection.LocalPlayerHandle);
                    }
                    if (spawnPlayerParams.SpawnedAction != null)
                    {
                        component2.SpawnedAction = spawnPlayerParams.SpawnedAction;
                    }
                    component2.Position      = spawnPlayerParams.Position;
                    component2.Rotation      = spawnPlayerParams.Rotation;
                    component2.PendingReward = spawnPlayerParams.PendingReward;
                    if (spawnPlayerParams.Zone != null)
                    {
                        zoneTransitionService.LoadZone(spawnPlayerParams.Zone, "Loading");
                    }
                    else
                    {
                        zoneTransitionService.LoadZone(spawnPlayerParams.SceneName, "Loading");
                    }
                    return;
                }
            }
            if (spawnPlayerParams.PendingReward != null)
            {
                Service.Get <EventDispatcher>().DispatchEvent(new RewardServiceEvents.MyRewardEarned(RewardSource.QUICK_NOTIFICATION, "", spawnPlayerParams.PendingReward));
            }
            if (Vector3.Distance(base.transform.position, spawnPlayerParams.Position) <= 3f)
            {
                if (spawnPlayerParams.SpawnedAction != null)
                {
                    executeSpawedAction(spawnPlayerParams.SpawnedAction);
                }
                return;
            }
            LocomotionTracker component3 = base.gameObject.GetComponent <LocomotionTracker>();

            if (component3.IsCurrentControllerOfType <SlideController>())
            {
                component3.SetCurrentController <RunController>();
            }
            else if (spawnPlayerParams.GetOutOfSwimming && component3.IsCurrentControllerOfType <SwimController>())
            {
                Animator component4 = base.gameObject.GetComponent <Animator>();
                component4.SetTrigger(AnimationHashes.Params.SwimToWalk);
                component3.SetCurrentController <RunController>();
            }
            Vector3 zero = Vector3.zero;

            if (spawnPlayerParams.NudgePlayer && component3.IsCurrentControllerOfType <RunController>())
            {
                zero.y = 0.5f;
            }
            base.transform.position = spawnPlayerParams.Position + zero;
            ClubPenguin.Core.SceneRefs.Get <BaseCamera>().Snap();
            if (spawnPlayerParams.NudgePlayer)
            {
                actionOnSpawned = spawnPlayerParams.SpawnedAction;
                CoroutineRunner.Start(LocomotionUtils.nudgePlayer(component3, onNudgePlayerDone), component3.gameObject, "MoveAfterJump");
            }
            else if (spawnPlayerParams.SpawnedAction != null)
            {
                executeSpawedAction(spawnPlayerParams.SpawnedAction);
            }
        }