public DecorationInventoryService() { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); decorationDefinitions = Service.Get <IGameData>().Get <Dictionary <int, DecorationDefinition> >(); structureDefinitions = Service.Get <IGameData>().Get <Dictionary <int, StructureDefinition> >(); cPDataEntityCollection.Whenever <DecorationInventoryData>("LocalPlayer", onDecorationsLoaded, onDecorationsUnLoaded); cPDataEntityCollection.Whenever <StructureInventoryData>("LocalPlayer", onStructuresLoaded, onStructuresUnLoaded); cPDataEntityCollection.Whenever <SceneLayoutData>("ActiveSceneData", onSceneLayoutLoaded, onSceneLayoutUnLoaded); Service.Get <EventDispatcher>().AddListener <IglooServiceEvents.DecorationsLoaded>(onIglooServiceEventsDecorationsLoaded); Service.Get <EventDispatcher>().AddListener <IglooServiceEvents.DecorationUpdated>(onDecorationUpdated); }
public IglooMediator(EventDispatcher eventDispatcher, CPDataEntityCollection dataEntityCollection, SceneLayoutDataManager sceneLayoutDataManager, SceneLayoutSyncService sceneLayoutSyncService, INetworkServicesManager networkServicesManager) { this.dataEntityCollection = dataEntityCollection; this.networkServicesManager = networkServicesManager; eventDispatcher.AddListener <PlayerStateServiceEvents.LocalPlayerDataReceived>(onLocalPlayerDataReceived); eventDispatcher.AddListener <IglooUIEvents.AddNewDecoration>(onAddNewDecoration); eventDispatcher.AddListener <IglooUIEvents.AddNewStructure>(onAddNewStructure); eventDispatcher.AddListener <IglooUIEvents.DuplicateSelectedObject>(onDuplicateSelectedObject); eventDispatcher.AddListener <IglooUIEvents.ClearCurrentLayout>(onClearCurrentLayout); layoutManager = sceneLayoutDataManager; layoutSyncService = sceneLayoutSyncService; layoutSyncService.AddExtraLayoutInfoLoader(loadSittingLocations); eventDispatcher.AddListener <ZoneTransitionEvents.ZoneTransition>(onZoneTransition); eventDispatcher.AddListener <WorldServiceEvents.SelfRoomJoinedEvent>(onIglooJoined); eventDispatcher.AddListener <IglooServiceEvents.ForceLeave>(onForceLeave, EventDispatcher.Priority.FIRST); eventDispatcher.AddListener <IglooServiceEvents.IglooLayoutCreated>(onIglooCreated, EventDispatcher.Priority.FIRST); eventDispatcher.AddListener <IglooServiceEvents.IglooDataUpdated>(onIglooDataUpdated, EventDispatcher.Priority.FIRST); eventDispatcher.AddListener <IglooServiceEvents.IglooLayoutUpdated>(onIglooLayoutUpdated, EventDispatcher.Priority.FIRST); eventDispatcher.AddListener <IglooServiceEvents.IglooLayoutDeleted>(onIglooLayoutDeleted, EventDispatcher.Priority.FIRST); eventDispatcher.AddListener <ObjectManipulationEvents.RemovingStructureWithItemsEvent>(onRemovingStructureWithItems); eventDispatcher.AddListener <IglooEvents.ChangeZone>(onChangeZone); eventDispatcher.AddListener <IglooEvents.ReloadLayout>(onReloadLayout); eventDispatcher.AddListener <IglooEvents.PlayIglooSound>(onPlayPlacedDecorationSoundEffect); eventDispatcher.AddListener <SceneLayoutEvents.SceneMaxItemsEvent>(onSceneMaxItemsEncountered); eventDispatcher.AddListener <IglooUIEvents.MaxItemsLimitReached>(onMaxLayoutItemsReached); DataEntityHandle activeHandle = layoutManager.GetActiveHandle(); dataEntityCollection.Whenever <SceneLayoutData>(activeHandle, onLayoutAdded, onLayoutRemoved); }
private void Awake() { musicDefs = Service.Get <IGameData>().Get <Dictionary <int, MusicTrackDefinition> >(); setupEventListeners(); CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); sceneLayoutListener = cPDataEntityCollection.Whenever <SceneLayoutData>("ActiveSceneData", onLayoutAdded, onLayoutRemoved); }
protected virtual void Awake() { eventDispatcher = Service.Get <EventDispatcher>(); dataEntityCollection = Service.Get <CPDataEntityCollection>(); sceneDataHandle = dataEntityCollection.FindEntityByName("ActiveSceneData"); sceneStateDataListener = dataEntityCollection.When <SceneStateData>("ActiveSceneData", onSceneDataAdded); sceneLayoutDataListener = dataEntityCollection.Whenever <SceneLayoutData>("ActiveSceneData", onSceneLayoutDataAdded, onSceneLayoutDataRemoved); }
private void Awake() { initStandardButtons(); dictionaryOfDecorationDefinitions = Service.Get <IGameData>().Get <Dictionary <int, DecorationDefinition> >(); decorationInventoryService = Service.Get <DecorationInventoryService>(); CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle handle = cPDataEntityCollection.FindEntityByName("ActiveSceneData"); sceneLayoutListener = cPDataEntityCollection.Whenever <SceneLayoutData>(handle, onLayoutAdded, onLayoutRemoved); }
private void Awake() { Assert.IsNotNull(EditCameraTarget, "EditCameraTarget required."); eventDispatcher = Service.Get <EventDispatcher>(); eventDispatcher.AddListener <InputEvents.ZoomEvent>(onInputZoom); boundsForCameraTarget = BoundsForCameraTarget.bounds; BoundsForCameraTarget.enabled = false; dataEntityCollection = Service.Get <CPDataEntityCollection>(); iglooCameraLotStateListener = dataEntityCollection.Whenever <IglooCameraOverrideStateData>("ActiveSceneData", onOverrideStateDataAdded, onOverrideStateDataRemoved); sceneStateDataListener = dataEntityCollection.When <SceneStateData>("ActiveSceneData", onSceneDataAdded); wasCameraTargetReset = false; }
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 void Start() { prefabCacheTracker = SceneRefs.Get <PrefabCacheTracker>(); sceneLayoutListener = dataEntityCollection.Whenever <SceneLayoutData>(sceneDataEntityHandle, onLayoutAdded, onLayoutRemoved); }