private void sendMockSelfJoinedRoomEvent() { ZoneId zoneId = new ZoneId(); zoneId.name = TestZoneDefinition.ZoneName; WorldServiceEvents.SelfRoomJoinedEvent evt = new WorldServiceEvents.SelfRoomJoinedEvent(1234L, TestZoneDefinition.ZoneName, new RoomIdentifier("TestWorld", Language.en_US, zoneId, ""), null, null, isRoomOwner: false); eventDispatcher.DispatchEvent(evt); }
private bool onRoomJoined(WorldServiceEvents.SelfRoomJoinedEvent evt) { if (reconnectionAttempts > 0) { reconnectionAttempts = 0; } return(false); }
protected virtual bool onRoomJoined(WorldServiceEvents.SelfRoomJoinedEvent evt) { DataEntityHandle localPlayerHandle = dataEntityCollection.LocalPlayerHandle; if (localPlayerHandle.IsNull) { throw new MissingReferenceException("The local player handle does not exist!"); } PlayerDataEntityFactory.AddCommonDataComponents(dataEntityCollection, localPlayerHandle); PlayerDataEntityFactory.AddCommonZoneScopeDataComponents(dataEntityCollection, localPlayerHandle); dataEntityCollection.AddComponent <LocalPlayerInZoneData>(localPlayerHandle); PresenceData component2 = dataEntityCollection.GetComponent <PresenceData>(localPlayerHandle); if (string.IsNullOrEmpty(evt.Room.zoneId.instanceId)) { component2.World = evt.Room.world; component2.Room = evt.Room.zoneId.name; component2.ContentIdentifier = evt.Room.contentIdentifier; component2.InstanceRoom = null; } else { component2.InstanceRoom = evt.Room.zoneId; } DataEntityHandle[] remotePlayerHandles = dataEntityCollection.GetRemotePlayerHandles(); for (int i = 0; i < remotePlayerHandles.Length; i++) { PresenceData component3 = dataEntityCollection.GetComponent <PresenceData>(remotePlayerHandles[i]); if (string.IsNullOrEmpty(evt.Room.zoneId.instanceId)) { component3.World = evt.Room.world; component3.Room = evt.Room.zoneId.name; component3.ContentIdentifier = evt.Room.contentIdentifier; component3.InstanceRoom = null; } else { component3.InstanceRoom = evt.Room.zoneId; } } if (dataEntityCollection.TryGetComponent <SessionIdData>(localPlayerHandle, out var component4)) { component4.SessionId = evt.SessionId; } else { component4 = dataEntityCollection.AddComponent(localPlayerHandle, delegate(SessionIdData component) { component.SessionId = evt.SessionId; }); } eventDispatcher.DispatchEvent(new NetworkControllerEvents.LocalPlayerJoinedRoomEvent(localPlayerHandle, evt.Room.world, evt.Room.zoneId.name)); return(false); }
private void startBIVisitIglooTimer(WorldServiceEvents.SelfRoomJoinedEvent evt) { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out ProfileData component)) { if (!string.IsNullOrEmpty(component.ZoneId.instanceId) && evt.IsRoomOwner) { Service.Get <ICPSwrveService>().StartTimer("igloo", "visit", "player"); return; } Service.Get <EventDispatcher>().AddListener <FriendsServiceEvents.FindUserSent>(onFindUserResponse); Service.Get <INetworkServicesManager>().FriendsService.FindUser(evt.RoomOwnerName, Service.Get <SessionManager>().LocalUser); } else { Service.Get <ICPSwrveService>().StartTimer("igloo", "visit", "unknown"); } }
private bool onIglooJoined(WorldServiceEvents.SelfRoomJoinedEvent evt) { if (!string.IsNullOrEmpty(evt.Room.zoneId.instanceId)) { DataEntityHandle activeHandle = layoutManager.GetActiveHandle(); if (!dataEntityCollection.TryGetComponent <SceneOwnerData>(activeHandle, out var component)) { component = dataEntityCollection.AddComponent <SceneOwnerData>(activeHandle); } component.Name = evt.RoomOwnerName; component.IsOwner = evt.IsRoomOwner; if (layoutManager.IsInOwnIgloo()) { SavedIgloosMetaData savedIgloosMetaData = getSavedIgloosMetaData(); if (savedIgloosMetaData.ActiveIglooId.HasValue) { updateSavedIglooMetaData(savedIgloosMetaData.ActiveIglooId.Value, evt.ExtraLayoutData); } if (savedIgloosMetaData.IsFirstIglooLoad()) { layoutManager.AddNewActiveLayout(); savedIgloosMetaData.IglooVisibility = IglooVisibility.PUBLIC; LocomotionActionEvent locomotionActionEvent = default(LocomotionActionEvent); locomotionActionEvent.Type = LocomotionAction.Move; locomotionActionEvent.Position = Vector3.zero; locomotionActionEvent.Direction = Vector3.zero; LocomotionActionEvent action = locomotionActionEvent; networkServicesManager.PlayerActionService.LocomotionAction(action); } else { layoutManager.CacheLayoutFromSceneLayout(savedIgloosMetaData.ActiveIglooId.Value, evt.ExtraLayoutData); } } else { layoutManager.CacheLayoutFromSceneLayout(0L, evt.ExtraLayoutData); } DataEntityHandle activeHandle2 = layoutManager.GetActiveHandle(); stateListener = dataEntityCollection.Whenever <SceneStateData>(activeHandle2, onStateAdded, onStateRemoved); } return(false); }
private bool onSelfJoinedRoom(WorldServiceEvents.SelfRoomJoinedEvent evt) { IsConnecting = false; dispatcher.RemoveListener <WorldServiceEvents.SelfRoomJoinedEvent>(onSelfJoinedRoom); ZoneDefinition zone = GetZone(evt.Room.zoneId.name); if (zone != null && !zone.IsQuestOnly && zone.Type != ZoneDefinition.ZoneType.Igloo) { Service.Get <GameSettings>().LastZone.SetValue(evt.Room.zoneId.name); IsInIgloo = false; } else if (zone != null) { IsInIgloo = (zone.Type == ZoneDefinition.ZoneType.Igloo); } checkIfZoneTransitionComplete(); checkForLocalizationChange(GetWorld(evt.Room.world)); if (targetWorldToJoin != null && targetWorldToJoin != evt.Room.world) { onJoinNotificationTag = "GlobalUI.Notification.WorldBump"; } if (!string.IsNullOrEmpty(onJoinNotificationTag)) { DNotification dNotification = new DNotification(); dNotification.Message = string.Format(Service.Get <Localizer>().GetTokenTranslation(onJoinNotificationTag), evt.Room.world); dNotification.PopUpDelayTime = 6f; dNotification.WaitForLoading = true; dNotification.PersistBetweenScenes = false; Service.Get <TrayNotificationManager>().ShowNotification(dNotification); onJoinNotificationTag = string.Empty; } Service.Get <ICPSwrveService>().EndTimer("igloo"); if (zone.Type == ZoneDefinition.ZoneType.Igloo) { startBIVisitIglooTimer(evt); } return(false); }
private bool onUserJoined(WorldServiceEvents.SelfRoomJoinedEvent evt) { broadcastingDisabledEvents = 0; return(false); }
private bool onRoomJoined(WorldServiceEvents.SelfRoomJoinedEvent evt) { GetCurrentThemes(); return(false); }