private void onObjectRemoved(GameObject obj, bool deleteChildren) { DecorationLayoutData decorationLayoutData = default(DecorationLayoutData); decorationLayoutData.Id = DecorationLayoutData.ID.FromFullPath(GetRelativeGameObjectPath(obj)); DecorationLayoutData decoration = decorationLayoutData; SceneLayoutData.RemoveDecoration(decoration, deleteChildren); if (selectedObjectStartingId == decoration.Id.GetFullPath()) { selectedObjectStartingId = null; ObjectManipulator component = obj.GetComponent <ObjectManipulator>(); if (component != null) { for (int i = 0; i < sceneModifiers.Length; i++) { sceneModifiers[i].AfterObjectDeselected(component); } } } decorationInventoryService.MarkStructuresDirty(); decorationInventoryService.MarkDecorationsDirty(); if (this.ObjectRemoved != null) { ManipulatableObject component2 = obj.GetComponent <ManipulatableObject>(); this.ObjectRemoved.InvokeSafe(component2); } UnityEngine.Object.Destroy(obj); removePartneredObject(obj); }
private void onLayoutAdded(SceneLayoutData sceneLayoutData) { sceneLayoutData.DecorationAdded += onDecorationAdded; sceneLayoutData.DecorationRemoved += onDecorationRemoved; sceneLayoutData.MaxLayoutItemsReached += onMaxLayoutItemsReached; setSceneLayoutDataItemLimit(sceneLayoutData); }
private void logBIForSavingIglooLayout(SceneLayoutData sceneLayoutData) { if (sceneLayoutData != null) { Service.Get <ICPSwrveService>().Action("igloo", "save", sceneLayoutData.LayoutCount.ToString()); } }
public void TransitionFromCreateToEdit(SceneLayoutData sceneLayoutData, PrefabContentKey loadingScreenPrefab) { string sceneNameFromZoneName = IglooMediator.GetSceneNameFromZoneName(sceneLayoutData.LotZoneName); if (DataManager.LayoutManager.HasCachedLayoutData()) { DataManager.LayoutManager.RemoveCachedSceneLayout(); } DataManager.LayoutManager.RemoveActiveSceneLayout(); if (previouslyPublishedLotName != sceneLayoutData.LotZoneName) { ZoneId zoneId = new ZoneId(); zoneId.name = sceneLayoutData.LotZoneName; zoneId.instanceId = Service.Get <ZoneTransitionService>().CurrentInstanceId; Service.Get <ZoneTransitionService>().LoadIgloo(zoneId, Service.Get <Localizer>().Language, SceneStateData.SceneState.Edit); return; } Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add(SceneTransitionService.SceneArgs.LoadingScreenOverride.ToString(), loadingScreenPrefab.Key); SceneSwapper.SwapScene(sceneNameFromZoneName, dictionary, delegate { SetState(SceneStateData.SceneState.Edit); ResetUI(); DataManager.LayoutManager.AddNewSceneLayoutData(sceneLayoutData); CloseManageIglooPopup(); }); }
private void onLayoutRemoved(SceneLayoutData sceneLayoutData) { currentMusicTrackDefinition = null; currentPreviewingTrackDefinition = null; stopMusicTrack(); stopPreviewTrack(); }
public void LoadIglooLayout(long layoutId, Action <bool, SceneLayoutData, SceneLayoutData> callback) { loadLayoutCallback = callback; SceneLayout sceneLayout = null; if (layoutId != savedIgloosMetaData.ActiveIglooId) { for (int i = 0; i < savedIgloosMetaData.SavedIgloos.Count; i++) { if (savedIgloosMetaData.SavedIgloos[i].LayoutId == layoutId) { sceneLayout = savedIgloosMetaData.SavedIgloos[i].SceneLayout; break; } } } if (sceneLayout != null) { SceneLayoutData sceneLayoutData = new SceneLayoutData(); layoutManager.UpdateSceneLayoutData(layoutId, sceneLayout, sceneLayoutData); if (loadLayoutCallback != null) { loadLayoutCallback.InvokeSafe(arg1: true, sceneLayoutData, null); loadLayoutCallback = null; } } else { eventChannel.AddListener <IglooServiceEvents.IglooLayoutLoaded>(onIglooLayoutLoaded); iglooService.GetIglooLayout(layoutId); } }
private bool onIglooDataUpdated(IglooServiceEvents.IglooDataUpdated evt) { eventChannel.RemoveListener <IglooServiceEvents.IglooDataUpdated>(onIglooDataUpdated); SceneLayoutData sceneLayoutData = new SceneLayoutData(); if (evt.SignedIglooData.Data.activeLayoutId.HasValue) { layoutManager.UpdateSceneLayoutData(evt.SignedIglooData.Data.activeLayoutId.Value, evt.SignedIglooData.Data.activeLayout, sceneLayoutData); } else { Log.LogError(this, "Null layoutId returned, it's possible membership exipired at this point"); if (layoutManager.HasCachedLayoutData()) { sceneLayoutData = layoutManager.GetCachedSceneLayoutData(); } } logBIForSavingIglooLayout(sceneLayoutData); if (updateDataCallback != null) { updateDataCallback.InvokeSafe(arg1: true, sceneLayoutData); updateDataCallback = null; } return(false); }
private void onLayoutAdded(SceneLayoutData obj) { if (obj.MusicTrackId != 0) { setMusicTrackData(obj.MusicTrackId); showNowPlaying(); } }
private void onLayoutAdded(SceneLayoutData sceneLayoutData) { layout = sceneLayoutData; layout.LightingIdUpdated += onLightingIdUpdated; skipUnloadUnusedResources = false; Service.Get <LoadingController>().AddLoadingSystem(this); ProcessLayout(); }
public void StartSyncingSceneLayoutData(SceneLayoutData sceneLayoutData) { if (!sceneLayoutDataModified.ContainsKey(sceneLayoutData)) { sceneLayoutDataModified[sceneLayoutData] = false; sceneLayoutData.SceneLayoutDataUpdated += onSceneLayoutDataUpdated; } }
public void UpdateSceneLayoutData(long layoutId, SceneLayout sceneLayout, SceneLayoutData sceneLayoutData) { long createdDate = (sceneLayout.createdDate.HasValue ? sceneLayout.createdDate.Value : 0); long lastModifiedDate = (sceneLayout.lastModifiedDate.HasValue ? sceneLayout.lastModifiedDate.Value : 0); List <DecorationLayoutData> layout = ToDecorationLayoutData(sceneLayout.decorationsLayout); sceneLayoutData.UpdateData(layoutId, sceneLayout.zoneId, createdDate, lastModifiedDate, sceneLayout.memberOnly, sceneLayout.lightingId, sceneLayout.musicId, sceneLayout.extraInfo, layout); sceneLayoutData.IsDirty = false; }
public bool TryRestoreCachedLayout(out SceneLayoutData sceneLayoutData) { sceneLayoutData = RestoreCachedLayout(); if (sceneLayoutData != null) { return(true); } return(false); }
private void onUpdateIglooDataFromCloseButton(bool success, SceneLayoutData sceneLayoutData) { stateController.HideLoadingModalPopup(); if (!success) { stateController.IglooSaveStatusNotification(IglooUIStateController.IglooSaveStatus.GeneralError, showAfterSceneLoad: true); } stateController.TransitionFromCreateToPlay(checkAndCacheSceneLayoutData(sceneLayoutData)); }
public InMyIglooDecorationCategoryFilter(Dictionary <int, DecorationDefinition> dictionaryOfDecorationDefinitions, DecorationInventoryService decorationInventoryService, SceneLayoutData sceneLayoutData) : base(dictionaryOfDecorationDefinitions, decorationInventoryService) { this.sceneLayoutData = sceneLayoutData; if (this.sceneLayoutData == null) { Log.LogErrorFormatted(this, "The layout data is null"); } }
public SceneLayoutData GetCachedSceneLayoutData() { DataEntityHandle cacheHandle = GetCacheHandle(); SceneLayoutData component = null; if (!dataEntityCollection.TryGetComponent <SceneLayoutData>(cacheHandle, out component)) { } return(component); }
private void onUpdateIglooDataFromCreateButton(bool success, SceneLayoutData sceneLayoutData) { stateController.HideLoadingModalPopup(); if (!success) { stateController.IglooSaveStatusNotification(IglooUIStateController.IglooSaveStatus.GeneralError, showAfterSceneLoad: true); sceneLayoutData = stateController.DataManager.LayoutManager.GetActiveSceneLayoutData(); } stateController.TransitionFromPlayToCreate(sceneLayoutData); }
private void setSceneLayoutDataItemLimit(SceneLayoutData sceneLayoutData) { sceneLayoutData.ItemLimitWarningShown = false; LotDefinition lotDefinitionFromZoneName = GetLotDefinitionFromZoneName(sceneLayoutData.LotZoneName); if (lotDefinitionFromZoneName != null) { sceneLayoutData.MaxLayoutItems = lotDefinitionFromZoneName.MaxItems; } }
public void StopSyncingSceneLayoutData(SceneLayoutData sceneLayoutData, System.Action onSyncStopped, IIglooUpdateLayoutErrorHandler errorHandler = null) { if (!sceneLayoutDataModified.ContainsKey(sceneLayoutData)) { onSyncStopped.InvokeSafe(); return; } saveIglooLayoutChanges(onSyncStopped, errorHandler); sceneLayoutData.SceneLayoutDataUpdated -= onSceneLayoutDataUpdated; sceneLayoutDataModified.Remove(sceneLayoutData); }
private void onActiveLayoutLoaded(bool success, SceneLayoutData publishedLayout, SceneLayoutData unpublishedLayout) { if (success) { transitionToPlayFromAnyState(publishedLayout); return; } Log.LogError(this, "Unknown Error. Cannot return back to the play state as expected"); IglooSaveStatusNotification(IglooSaveStatus.GeneralError, showAfterSceneLoad: true); ExitIgloos(); }
private void onDecorationRemoved(SceneLayoutData sceneLayoutData) { if (sceneLayoutData.ItemLimitWarningShown) { float num = (float)sceneLayoutData.LayoutCount / ((float)sceneLayoutData.MaxLayoutItems * 1f); if (num < 0.85f) { sceneLayoutData.ItemLimitWarningShown = false; } } }
public bool AddNewSceneLayoutData(SceneLayoutData sceneLayoutData) { DataEntityHandle activeHandle = GetActiveHandle(); if (dataEntityCollection.HasComponent <SceneLayoutData>(activeHandle)) { Log.LogError(this, "Cannot add SceneLayoutData as one already exists. Remove the exiting one first"); return(false); } dataEntityCollection.AddComponent(activeHandle, sceneLayoutData); return(true); }
public bool IsLayoutAtMaxItemLimit() { if (ObjectManipulationInputController != null && ObjectManipulationInputController.CurrentlySelectedObject != null) { DecorationLayoutData selectedItem = default(DecorationLayoutData); selectedItem.Id.Name = ObjectManipulationInputController.CurrentlySelectedObject.name; selectedItem.Id.ParentPath = GetRelativeGameObjectPath(ObjectManipulationInputController.CurrentlySelectedObject.transform.parent.gameObject); bool selectedItemIsAPair = ObjectManipulationInputController.CurrentlySelectedObject.GetComponent <SplittableObject>() != null; return(SceneLayoutData.IsLayoutAtMaxItemLimit(selectedItem, selectedItemIsAPair)); } return(SceneLayoutData.IsLayoutAtMaxItemLimit()); }
private void onUpdateIglooDataFromCreateButton(bool success, SceneLayoutData sceneLayoutData) { stateController.HideLoadingModalPopup(); if (success) { checkAndCacheSceneLayoutData(sceneLayoutData); } else { stateController.IglooSaveStatusNotification(IglooUIStateController.IglooSaveStatus.GeneralError, showAfterSceneLoad: false); } }
private void onLayoutAdded(SceneLayoutData sceneLayoutData) { layout = sceneLayoutData; if (sceneLayoutData.MusicTrackId != 0) { if (musicDefs.TryGetValue(sceneLayoutData.MusicTrackId, out var value)) { currentMusicTrackDefinition = value; return; } Log.LogErrorFormatted(this, "Unable to find MusicTrackDefinition with id {0}", sceneLayoutData.MusicTrackId); } }
public void CacheLayoutFromSceneLayoutData(SceneLayoutData sceneLayoutData) { DataEntityHandle cacheHandle = GetCacheHandle(); if (dataEntityCollection.HasComponent <SceneLayoutData>(cacheHandle)) { Log.LogErrorFormatted(this, "Cannot add SceneLayoutData to {0} as one already exists. Remove the exiting one first.", cacheHandle); } else { dataEntityCollection.AddComponent(cacheHandle, sceneLayoutData); } }
private void modifyObjectManipulators(Action <GameObject, DecorationLayoutData> modify) { foreach (DecorationLayoutData item in SceneLayoutData.GetLayoutEnumerator()) { Transform obj = sceneLayoutContainer; DecorationLayoutData.ID id = item.Id; Transform transform = obj.Find(id.GetFullPath()); if (!(transform == null)) { modify(transform.gameObject, item); } } }
private void initActiveIglooLayoutData(SceneStateData.SceneState state) { if (layoutManager.HasCachedLayoutData()) { SceneLayoutData cachedSceneLayoutData = layoutManager.GetCachedSceneLayoutData(); layoutManager.AddNewSceneLayoutData(cachedSceneLayoutData); layoutManager.RemoveCachedSceneLayout(); } else { loadIglooInCreateState(); } }
private void onDecorationAdded(SceneLayoutData sceneLayoutData, DecorationLayoutData decoration) { if (!sceneLayoutData.ItemLimitWarningShown && sceneLayoutData.LayoutCount < sceneLayoutData.MaxLayoutItems) { float num = (float)sceneLayoutData.LayoutCount / ((float)sceneLayoutData.MaxLayoutItems * 1f); if (num >= 0.85f) { string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Igloos.ItemLimit.Banner"); Service.Get <EventDispatcher>().DispatchEvent(new IglooUIEvents.ShowNotification(tokenTranslation, 5f, null, adjustRectPositionForNotification: true, showAfterSceneLoad: false)); sceneLayoutData.ItemLimitWarningShown = true; } } }
public void TransitionFromPlayToCreate(SceneLayoutData sceneLayoutData) { eventDispatcher.DispatchEvent(default(SceneTransitionEvents.SceneSwapLoadStarted)); DataManager.LayoutManager.CacheLayoutFromSceneLayoutData(sceneLayoutData); DataManager.LayoutManager.RemoveActiveSceneLayout(); CloseManageIglooPopup(); StopListeningToStateChange(); SetState(SceneStateData.SceneState.Create); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add(SceneTransitionService.SceneArgs.LoadingScreenOverride.ToString(), DefaultLoadingScreen.Key); SceneSwapper.LoadScene("DefaultIgloo", dictionary); }
public bool UpdateActiveLayoutFromData(long layoutId, SceneLayout sceneLayout) { try { SceneLayoutData activeSceneLayoutData = GetActiveSceneLayoutData(); UpdateSceneLayoutData(layoutId, sceneLayout, activeSceneLayoutData); } catch (Exception) { return(false); } return(true); }