protected override void Update() { PrefabContentKey prefabContentKey = new PrefabContentKey(PopupContentPath); SceneRefs.FullScreenPopupManager.CreatePopup(prefabContentKey, null); Completed(); }
private IEnumerator loadSceneAudioPrefab(string scene) { if (!sceneDefinitions.TryGetValue(scene, out var sceneDefinition)) { yield break; } PrefabContentKey audioContentKey = sceneDefinition.SceneAudioContentKey; if (audioContentKey == null || string.IsNullOrEmpty(audioContentKey.Key) || !Content.ContainsKey(audioContentKey)) { yield break; } AssetRequest <GameObject> audioRequest = Content.LoadAsync(audioContentKey); yield return(audioRequest); if (audioRequest.Asset != null) { if (sceneAudio.AudioPrefab != null) { Log.LogErrorFormatted(this, "SceneAudio {0} for scene {1} was not properly cleaned up before loading a new one.", sceneAudio.AudioPrefab.name, sceneAudio.SceneName); unpinCurrentAudioPrefab(); } Content.TryPinBundle(audioContentKey.Key); sceneAudio = default(SceneAudio); sceneAudio.SceneName = scene; sceneAudio.AudioPrefabContentKey = audioContentKey.Key; sceneAudio.AudioPrefab = Object.Instantiate(audioRequest.Asset); Object.DontDestroyOnLoad(sceneAudio.AudioPrefab); } else { Log.LogError(this, "Failed to load audio prefab for scene: " + scene); } }
protected void createPopup(PrefabContentKey prefabContentKey, bool destroyPopupOnBackPressed = false, string accessibilityTitleToken = null) { Content.LoadAsync(delegate(string path, GameObject popupPrefab) { onPopupLoaded(popupPrefab, destroyPopupOnBackPressed, accessibilityTitleToken); }, prefabContentKey); }
private void onPrefabLoaded(GameObject popupPrefab, PrefabContentKey prefabContentKey, string accessibilityTitleToken, bool useCameraSpace, PrefabInstantiatedCallback instantiatedCallback) { GameObject gameObject = Object.Instantiate(popupPrefab); if (gameObject.GetComponentInChildren <UIDisabler>() == null) { disableWorldRendering(); } ResourceCleaner resourceCleaner = gameObject.GetComponent <ResourceCleaner>(); if (resourceCleaner == null) { resourceCleaner = gameObject.AddComponent <ResourceCleaner>(); } if (!cleaners.ContainsKey(popupPrefab)) { cleaners.Add(popupPrefab, resourceCleaner); } resourceCleaner.OnDestroyCallback = onFullScreenObjectDestroyed; if (!useCameraSpace) { gameObject.transform.SetParent(base.transform, worldPositionStays: false); playAccessibilityTitle(accessibilityTitleToken); } else { Service.Get <EventDispatcher>().DispatchEvent(new PopupEvents.ShowCameraSpacePopup(gameObject, destroyPopupOnBackPressed: false, scaleToFit: true, accessibilityTitleToken)); } instantiatedCallback?.Invoke(prefabContentKey, gameObject); Service.Get <EventDispatcher>().DispatchEvent(default(PopupEvents.ShowingPopup)); }
private IEnumerator loadPopupFromPrefab(PrefabContentKey popupKey) { AssetRequest <GameObject> assetRequest = Content.LoadAsync(popupKey); yield return(assetRequest); instantiatedPrefab = UnityEngine.Object.Instantiate(assetRequest.Asset); if (parentTransform != null) { instantiatedPrefab.transform.SetParent(parentTransform, worldPositionStays: false); } gatePrefabController = instantiatedPrefab.GetComponent <GatePrefabController>(); try { gatePrefabController.SubmitButton.onClick.AddListener(onSubmitClicked); gatePrefabController.CloseButton.onClick.AddListener(onCloseClicked); gatePrefabController.ErrorIcon.gameObject.SetActive(value: false); prepGate(); gatePrefabController.AnswerInputField.onValueChanged.AddListener(onValueChanged); if ((bool)GameObject.Find("TopCanvas")) { Service.Get <EventDispatcher>().DispatchEvent(new PopupEvents.ShowTopPopup(instantiatedPrefab, destroyPopupOnBackPressed: false, scaleToFit: true, "Accessibility.Popup.Title.AgeGate")); } else { Service.Get <EventDispatcher>().DispatchEvent(new PopupEvents.ShowPopup(instantiatedPrefab, destroyPopupOnBackPressed: false, scaleToFit: true, "Accessibility.Popup.Title.AgeGate")); } } catch { Log.LogErrorFormatted(this, "Missing key elements from prefab for {0}\n CloseButton: {1}\n SubmitButton: {2}\n ErrorIcon: {3}", popupKey, gatePrefabController.CloseButton, gatePrefabController.SubmitButton, gatePrefabController.ErrorIcon); Return(); } yield return(null); }
private IEnumerator loadNotificationPrefab() { PrefabContentKey prefabLocation = notificationData.PrefabLocation; if (prefabLocation == null || string.IsNullOrEmpty(prefabLocation.Key)) { prefabLocation = TrayNotificationManager.NonDisruptiveNotificationContentKey; } AssetRequest <GameObject> asset = Content.LoadAsync(prefabLocation); yield return(asset); GameObject loadedGameObject = UnityEngine.Object.Instantiate(asset.Asset); loadedGameObject.transform.SetParent(notificationParentTransform, worldPositionStays: false); notification = loadedGameObject.GetComponent <TrayNotification>(); if (notification == null) { throw new NullReferenceException("Unable to retrieve TrayNotification component in asset. Please check path: " + notificationData.PrefabLocation); } TrayNotification trayNotification = notification; trayNotification.ENotificationCompleted = (Action <NotificationCompleteEnum>)Delegate.Combine(trayNotification.ENotificationCompleted, new Action <NotificationCompleteEnum>(notificationTrayComplete)); notification.Show(notificationData); if (NotificationCreated != null) { NotificationCreated(notification); } }
private void renderDecoration(DecorationLayoutData decoration) { PrefabContentKey prefabContentKey = null; switch (decoration.Type) { case DecorationLayoutData.DefinitionType.Decoration: if (decorationDefs.TryGetValue(decoration.DefinitionId, out DecorationDefinition value2)) { prefabContentKey = value2.Prefab; } break; case DecorationLayoutData.DefinitionType.Structure: if (structureDefs.TryGetValue(decoration.DefinitionId, out StructureDefinition value)) { prefabContentKey = value.Prefab; } break; } if (prefabContentKey != null) { loadOrder.Enqueue(decoration.Id.GetFullPath()); CoroutineRunner.Start(processDecoration(decoration, prefabContentKey), this, "processDecoration"); } }
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(); }); }
public SetStateButtonPressed(SceneStateData.SceneState sceneState, bool reloadScene, PrefabContentKey splashScreen, long layoutId) { SceneState = sceneState; ReloadScene = reloadScene; SplashScreen = splashScreen; LayoutId = layoutId; }
public void CreatePopup(PrefabContentKey prefabContentKey, string accessibilityTitleToken, bool useCameraSpace = false, PrefabInstantiatedCallback instantiatedCallback = null) { Content.LoadAsync(delegate(string path, GameObject popupPrefab) { onPrefabLoaded(popupPrefab, prefabContentKey, accessibilityTitleToken, useCameraSpace, instantiatedCallback); }, prefabContentKey); }
private IEnumerator loadContent(PrefabContentKey contentKey) { AssetRequest <GameObject> assetRequest = Content.LoadAsync(contentKey); yield return(assetRequest); prefab = assetRequest.Asset; }
private IEnumerator createParticlePrefab(PrefabContentKey prefabContentKey) { AssetRequest <GameObject> assetRequest = Content.LoadAsync(prefabContentKey); yield return(assetRequest); particlePrefab = assetRequest.Asset; }
public ShowNotification(string translatedText, float displayTime, PrefabContentKey prefab, bool adjustRectPositionForNotification, bool showAfterSceneLoad) { TranslatedText = translatedText; DisplayTime = displayTime; Prefab = prefab; AdjustRectPositionForNotification = adjustRectPositionForNotification; ShowAfterSceneLoad = showAfterSceneLoad; }
public void SetLeftOption(PrefabContentKey leftOptionContentKey) { LeftOptionContentKey = leftOptionContentKey; if (this.OnSetLeftOption != null) { this.OnSetLeftOption(leftOptionContentKey); } }
private IEnumerator processDecoration(DecorationLayoutData decoration, PrefabContentKey contentKey) { PrefabCacheTracker.PrefabRequest prefabRequest = prefabCacheTracker.Acquire(contentKey); while (!prefabRequest.IsComplete) { yield return(null); } yield return(new WaitForEndOfFrame()); while (loadOrder.Peek() != decoration.Id.GetFullPath()) { yield return(null); } string idFromQueue = loadOrder.Dequeue(); Assert.IsTrue(idFromQueue == decoration.Id.GetFullPath()); if (prefabRequest != null && prefabRequest.Prefab != null) { bool flag = true; Transform transform = Container.Find(decoration.Id.ParentPath); if (transform == null) { if (string.IsNullOrEmpty(decoration.Id.ParentPath)) { transform = Container; } else { Log.LogErrorFormatted(this, "Invalid path of decoration. Removing from layout: {0}", decoration.Id.GetFullPath()); layout.RemoveDecoration(decoration, deleteChildren: true); flag = false; } } if (flag) { GameObject gameObject = UnityEngine.Object.Instantiate(prefabRequest.Prefab, transform, worldPositionStays: false); SplittableObject component = gameObject.GetComponent <SplittableObject>(); Vector3 localScale = gameObject.transform.localScale; if (component != null) { gameObject = component.ExtractSingleItem(); gameObject.transform.SetParent(transform, worldPositionStays: false); } configurePartneredObject(decoration, gameObject); gameObject.transform.localPosition = decoration.Position; gameObject.transform.localRotation = decoration.Rotation; gameObject.name = decoration.Id.Name; gameObject.transform.localScale = decoration.UniformScale * localScale; prefabCacheTracker.SetCache(gameObject, prefabRequest.ContentKey); } } else { Log.LogErrorFormatted(this, "Something went wrong loading {0}.", contentKey.Key); prefabCacheTracker.Release(contentKey); } checkForLoadComplete(); }
private IEnumerator showPopupScreen(DRewardPopupScreen screenData) { PrefabContentKey screenContentKey = RewardPopupConstants.ScreenSplashContentKey; switch (screenData.ScreenType) { case DRewardPopupScreen.RewardScreenPopupType.splash: screenContentKey = RewardPopupConstants.ScreenSplashContentKey; break; case DRewardPopupScreen.RewardScreenPopupType.splash_levelup: screenContentKey = RewardPopupConstants.ScreenLevelUpContentKey; break; case DRewardPopupScreen.RewardScreenPopupType.splash_replay: screenContentKey = RewardPopupConstants.ScreenReplayContentKey; break; case DRewardPopupScreen.RewardScreenPopupType.items: screenContentKey = RewardPopupConstants.ScreenItemContentKey; break; case DRewardPopupScreen.RewardScreenPopupType.count: screenContentKey = RewardPopupConstants.ScreenCountContentKey; break; case DRewardPopupScreen.RewardScreenPopupType.coinsxp: screenContentKey = RewardPopupConstants.ScreenCoinsXPContentKey; break; case DRewardPopupScreen.RewardScreenPopupType.quests: screenContentKey = RewardPopupConstants.ScreenQuestsContentKey; break; case DRewardPopupScreen.RewardScreenPopupType.custom: { DRewardPopupScreenCustom dRewardPopupScreenCustom = screenData as DRewardPopupScreenCustom; if (dRewardPopupScreenCustom != null) { screenContentKey = dRewardPopupScreenCustom.ScreenKey; } break; } } AssetRequest <GameObject> assetRequest = Content.LoadAsync(screenContentKey); yield return(assetRequest); GameObject screenGO = UnityEngine.Object.Instantiate(assetRequest.Asset); screenGO.transform.SetParent(ScreenParentTransform, worldPositionStays: false); screenGO.GetComponent <RectTransform>().localPosition += new Vector3(0f, 0f, -100f); currentScreen = screenGO.GetComponent <RewardPopupScreen>(); currentScreen.ScreenCompleteAction += onCurrentScreenComplete; currentScreen.Init(screenData, this); }
public TweenContinuousLoop(Vector3 originPosition, Vector3 destinationPosition, PrefabContentKey prefabContentKey, float tweenTime, float tweenInterval) { this.originPosition = originPosition; this.destinationPosition = destinationPosition; this.tweenInterval = tweenInterval; this.prefabContentKey = prefabContentKey; this.tweenTime = tweenTime; objectPool = new List <GameObject>(); CoroutineRunner.Start(startContinuousTween(), this, "TweenCoinCommand.startContinuousTween"); }
public void Initialize(PrefabContentKey contentKey, int max) { if (contentKey == null || string.IsNullOrEmpty(contentKey.Key)) { throw new NullReferenceException("A content key must be assigned"); } MaxCount = max; SpawnCount = 0; CoroutineRunner.Start(loadContent(contentKey), this, "loadContent"); }
private void onPrefabCreated(PrefabContentKey key, GameObject marketplaceObject) { MarketplaceScreenController component = marketplaceObject.GetComponent <MarketplaceScreenController>(); if (component != null) { marketplaceObject.GetComponent <MarketplaceScreenController>().Init(definition); } isLoadingPrefab = false; }
private void loadAppletScene(CellPhoneEvents.ChangeCellPhoneScreen evt, PrefabContentKey prefabKey) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("appletToLaunch", prefabKey); Dictionary <string, object> args = dictionary; loadScene(evt, "CellPhoneApplet", args); Service.Get <LoadingController>().AddLoadingSystem(LoadingSystemObject); }
public RetrievePropCMD(string propId, PrefabContentKey propContentKey, PropUser propUser, long ownerId, bool isOwnerLocalPlayer, Action <Prop> onPropInstantiatedHandler = null, System.Action onCompleteHandler = null) { this.propId = propId; this.propContentKey = propContentKey; this.propUser = propUser; this.ownerId = ownerId; this.isOwnerLocalPlayer = isOwnerLocalPlayer; this.onPropInstantiatedHandler = onPropInstantiatedHandler; this.onCompleteHandler = onCompleteHandler; avatarView = propUser.GetComponent <AvatarView>(); }
private IEnumerator loadAndInitPrefab(PrefabContentKey prefabKey) { AssetRequest <GameObject> request = Content.LoadAsync(prefabKey); yield return(request); UnityEngine.Object.Instantiate(request.Asset, CanvasContainer.transform, worldPositionStays: false); yield return(null); Service.Get <LoadingController>().RemoveLoadingSystem(CellPhoneController.LoadingSystemObject); }
private IEnumerator loadConfirmation(PrefabContentKey prefabKey, IglooCatalogItemData item, Sprite icon, IglooCatalogItem catalogItem) { AssetRequest <GameObject> request = Content.LoadAsync(prefabKey); yield return(request); GameObject newConfirmation = UnityEngine.Object.Instantiate(request.Asset, base.transform, worldPositionStays: false); newConfirmation.GetComponent <IglooCatalogPurchaseConfirmation>().SetItem(item, icon, this, catalogItem, (RectTransform)catalogScrollRect.transform); hideConfirmation(); confirmation = newConfirmation; }
private IEnumerator loadMascotXPPrefab(string mascotName) { PrefabContentKey mascotXPContentKey = Service.Get <MascotService>().GetMascot(mascotName).Definition.RewardPopupXPContentKey; AssetRequest <GameObject> assetRequest = Content.LoadAsync(mascotXPContentKey); yield return(assetRequest); GameObject mascotXPGO = Object.Instantiate(assetRequest.Asset); mascotXPGO.transform.SetParent(XPParent.transform, worldPositionStays: false); mascotXPGO.GetComponentInChildren <Text>().text = string.Format(Service.Get <Localizer>().GetTokenTranslation("GlobalUI.Notification.XP"), screenData.XPCount); }
private void loadApplet(CellPhoneEvents.ChangeCellPhoneScreen evt, PrefabContentKey prefabKey) { ConditionalConfiguration conditionalConfiguration = Service.Get <ConditionalConfiguration>(); int num = conditionalConfiguration.Get("System.Memory.property", 0); if (evt.AppletSceneSystemMemoryThreshold >= 0 && num <= evt.AppletSceneSystemMemoryThreshold) { loadAppletScene(evt, prefabKey); return; } loadScreen(prefabKey, showLoadingScreen: false); CoroutineRunner.Start(runLoadingScreenTimer(), this, "CellPhoneLoadingScreenTimer"); }
private void setupEditState(PrefabContentKey loadingScreenPrefab, long layoutId) { this.loadingScreenPrefab = loadingScreenPrefab ?? stateController.DefaultLoadingScreen; stateController.ShowLoadingModalPopup(); stateController.DataManager.UpdateIglooData(delegate(bool success, SceneLayoutData sceneLayoutData) { if (!success) { stateController.IglooSaveStatusNotification(IglooUIStateController.IglooSaveStatus.GeneralError, showAfterSceneLoad: false); } stateController.DataManager.LoadIglooLayout(layoutId, onLayoutLoaded); }); }
private void loadScreen(PrefabContentKey prefabKey, bool showLoadingScreen = true) { if (currentScreen != null) { Object.Destroy(currentScreen); } if (showLoadingScreen) { LoadingScreen.SetActive(value: true); minLoadingTimeComplete = false; CoroutineRunner.Start(runLoadingScreenTimer(), this, "CellPhoneLoadingScreenTimer"); } Content.LoadAsync(onScreenLoaded, prefabKey); }
public void AddNewObject(PrefabContentKey prefabContentKey, Vector3 worldPosition, Quaternion rotation, Vector3 scale, DecorationLayoutData data, bool setManipulationInputStateToDrag = true) { if (data.Type == DecorationLayoutData.DefinitionType.Decoration) { decorationInventoryService.MarkDecorationsDirty(); } else if (data.Type == DecorationLayoutData.DefinitionType.Structure) { decorationInventoryService.MarkStructuresDirty(); } prefabCacheTracker.Acquire(prefabContentKey, delegate(GameObject prefab, PrefabCacheTracker.PrefabRequest request) { onNewObjectLoaded(prefab, request, worldPosition, rotation, scale, data, setManipulationInputStateToDrag); }); }
private IEnumerator loadConfirmation(PrefabContentKey prefabKey, MarketplaceItem item) { AssetRequest <GameObject> request = Content.LoadAsync(prefabKey); yield return(request); GameObject newConfirmation = UnityEngine.Object.Instantiate(request.Asset, ConfirmationContainer, worldPositionStays: false); newConfirmation.GetComponent <MarketplaceConfirmation>().SetItem(item.ItemDefinition, item.ItemIcon.texture, this, (RectTransform)item.transform, ContentScrollRect.transform as RectTransform); if (confirmation != null) { HideConfirmation(); } confirmation = newConfirmation; }
public void TransitionFromPlayToEdit(SceneLayoutData sceneLayoutData, PrefabContentKey loadingScreenPrefab) { eventDispatcher.DispatchEvent(default(SceneTransitionEvents.SceneSwapLoadStarted)); string sceneNameFromZoneName = IglooMediator.GetSceneNameFromZoneName(sceneLayoutData.LotZoneName); DataManager.LayoutManager.CacheLayoutFromSceneLayoutData(sceneLayoutData); DataManager.LayoutManager.RemoveActiveSceneLayout(); CloseManageIglooPopup(); StopListeningToStateChange(); SetPreviouslyPublishedLotName(); SetState(SceneStateData.SceneState.Edit); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add(SceneTransitionService.SceneArgs.LoadingScreenOverride.ToString(), loadingScreenPrefab.Key); SceneSwapper.LoadScene(sceneNameFromZoneName, dictionary); }