private void saveIglooLayoutChanges(System.Action onSyncStopped = null, IIglooUpdateLayoutErrorHandler errorHandler = null) { bool flag = false; foreach (SceneLayoutData item in sceneLayoutDataModified.Keys.ToList()) { if (!sceneLayoutDataModified[item]) { continue; } MutableSceneLayout mutableSceneLayout = new MutableSceneLayout(); ConvertToMutableSceneLayout(mutableSceneLayout, item); foreach (ExtraLayoutInfoLoader extraLayoutInfoLoader in extraLayoutInfoLoaders) { ExtraLayoutInfo extraLayoutInfo = extraLayoutInfoLoader(); mutableSceneLayout.extraInfo[extraLayoutInfo.Key] = extraLayoutInfo.Value; } EventHandlerDelegate <IglooServiceEvents.IglooLayoutUpdated> successHandler = null; successHandler = delegate { Service.Get <EventDispatcher>().RemoveListener(successHandler); onSyncStopped.InvokeSafe(); return(false); }; Service.Get <EventDispatcher>().AddListener(successHandler); IIglooUpdateLayoutErrorHandlerWrapper errorHandler2 = new IIglooUpdateLayoutErrorHandlerWrapper(successHandler, errorHandler); Service.Get <INetworkServicesManager>().IglooService.UpdateIglooLayout(item.LayoutId, mutableSceneLayout, errorHandler2); sceneLayoutDataModified[item] = false; flag = true; } if (!flag) { onSyncStopped.InvokeSafe(); } }
private static IEnumerator rotateDisplay(bool isLandscape, System.Action onComplete) { if ((isLandscape && Screen.orientation == ScreenOrientation.LandscapeLeft) || (!isLandscape && Screen.orientation == ScreenOrientation.Portrait)) { onComplete.InvokeSafe(); yield break; } if (IsBlackScreenFixFlagSet(BlackScreenFix.DisableAutoRotation)) { Screen.orientation = ((!isLandscape) ? ScreenOrientation.Portrait : ScreenOrientation.LandscapeLeft); } else { Screen.autorotateToLandscapeLeft = isLandscape; Screen.autorotateToLandscapeRight = isLandscape; Screen.autorotateToPortrait = !isLandscape; Screen.autorotateToPortraitUpsideDown = !isLandscape; if (!IsBlackScreenFixFlagSet(BlackScreenFix.DontForceRotate)) { ScreenOrientation prevOrientation = Screen.orientation; Screen.orientation = ((!isLandscape) ? ScreenOrientation.Portrait : ScreenOrientation.LandscapeLeft); yield return(WaitForRotationAnimation(prevOrientation)); } Screen.orientation = ScreenOrientation.AutoRotation; } onComplete.InvokeSafe(); }
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); }