private void ApplySafeArea() { int num = (int)this.root.rect.height; int num2 = SafeLayout.GetMaxBottomCanvasOffset(num); int num3 = SafeLayout.GetMinTopCanvasOffset(num); bool flag = false; bool flag2 = false; if (num2 > 0 && num3 > 0) { for (int i = 0; i < this.notchCovers.Length; i++) { this.notchCovers[i].gameObject.SetActive(true); } flag = true; } bool flag3 = !GeneralSettings.AdsDisabled && AdsManager.Instance.GetBannerPosition() != BannerPosition.None && AdsManager.Instance.HasBannerPlacement(BannerPlacement.Menu); if (flag3) { num3 = ((AdsManager.Instance.GetBannerPosition() != BannerPosition.Top) ? SafeLayout.GetMinTopCanvasOffset(num) : SafeLayout.GetMaxTopCanvasOffset(num)); BannerPosition bannerPosition = AdsManager.Instance.GetBannerPosition(); int num4 = AdsManager.Instance.CalcBannerHeight(num); if (bannerPosition == BannerPosition.Bottom) { this.bannerBottomBackground.gameObject.SetActive(true); this.bannerBottomBackground.anchoredPosition = new Vector2(this.bannerBottomBackground.anchoredPosition.x, this.bannerBottomBackground.anchoredPosition.y + (float)num2); this.bannerBottomBackground.sizeDelta = new Vector2(this.bannerBottomBackground.sizeDelta.x, (float)num4); num2 += num4; } else if (bannerPosition == BannerPosition.Top) { flag2 = true; this.bannerTopBackground.gameObject.SetActive(true); int num5 = (!flag) ? 0 : num3; this.bannerTopBackground.sizeDelta = new Vector2(this.bannerTopBackground.sizeDelta.x, (float)(num4 + num5)); num3 += num4; } } this.root.offsetMin = new Vector2(this.root.offsetMin.x, (float)num2); this.root.offsetMax = new Vector2(this.root.offsetMax.x, (float)(-(float)num3)); for (int j = 0; j < this.bgExt.Length; j++) { this.bgExt[j].offsetMin += new Vector2(0f, (float)(-(float)num2)); this.bgExt[j].offsetMax += new Vector2(0f, (float)num3); } if (num3 > 0) { this.settingsPopup.SetSafeLayoutOffset(num3); } if (num2 > 0) { this.startGameSlidePopup.SetSafeLayoutOffset(num2); } if (flag && !flag2) { this.catFilterBackground.offsetMax = new Vector2(this.root.offsetMax.x, (float)num3); } }
private void Awake() { this.DummyTest(); GeneralSettings.AppLaunchCounter++; this.InitDesign(); SafeLayout.Init(); Application.targetFrameRate = 60; }
private void Awake() { SafeLayout.Init(); if (SafeLayout.IsTablet) { CanvasScaler component = base.transform.parent.GetComponent <CanvasScaler>(); component.referenceResolution = new Vector2(1654f, 2927f); } }
public void ApplySafeArea() { int num = (int)this.root.rect.height; bool flag = !GeneralSettings.AdsDisabled && AdsManager.Instance.GetBannerPosition() != BannerPosition.None && (AdsManager.Instance.HasBannerPlacement(BannerPlacement.Gameboard) || AdsManager.Instance.HasBannerPlacement(BannerPlacement.Solved)); int num2 = SafeLayout.GetMaxBottomCanvasOffset(num); int num3 = SafeLayout.GetMinTopCanvasOffset(num); bool flag2 = num2 > 0 && num3 > 0; int num4 = AdsManager.Instance.CalcBannerHeight(num); if (flag) { num3 = ((AdsManager.Instance.GetBannerPosition() != BannerPosition.Top) ? SafeLayout.GetMinTopCanvasOffset(num) : SafeLayout.GetMaxTopCanvasOffset(num)); if (AdsManager.Instance.GetBannerPosition() == BannerPosition.Bottom) { this.bannerBottomBackground.anchoredPosition = new Vector2(this.bannerBottomBackground.anchoredPosition.x, this.bannerBottomBackground.anchoredPosition.y + (float)num2); this.bannerBottomBackground.sizeDelta = new Vector2(this.bannerBottomBackground.sizeDelta.x, (float)num4); num2 += num4; if (AdsManager.Instance.HasBannerPlacement(BannerPlacement.Gameboard)) { this.bottomControls.anchoredPosition += new Vector2(0f, (float)num2); } } else if (AdsManager.Instance.GetBannerPosition() == BannerPosition.Top) { int num5 = (!flag2) ? 0 : num3; this.bannerTopBackground.sizeDelta = new Vector2(this.bannerTopBackground.sizeDelta.x, (float)(num4 + num5)); num3 += num4; if (AdsManager.Instance.HasBannerPlacement(BannerPlacement.Gameboard)) { this.topControls.anchoredPosition += new Vector2(0f, (float)(-(float)num3)); } if (AdsManager.Instance.HasBannerPlacement(BannerPlacement.Gameboard) || AdsManager.Instance.HasBannerPlacement(BannerPlacement.Solved)) { this.toastRoot.offsetMax = new Vector2(this.root.offsetMax.x, (float)(-(float)((int)((float)num3 * 0.5f)))); } } if (AdsManager.Instance.HasBannerPlacement(BannerPlacement.Solved)) { this.solvedPageControls.SetSafeLayoutOffset(AdsManager.Instance.GetBannerPosition(), num3, num2); } } else { this.bottomControls.anchoredPosition += new Vector2(0f, (float)num2); } if (flag2) { int num6 = 10; if (GeneralSettings.IsOldDesign) { for (int i = 0; i < this.topLeftButtons.Length; i++) { if (this.topLeftButtons[i] != null) { this.topLeftButtons[i].anchoredPosition += new Vector2((float)num6, (float)(-(float)num6)); } } for (int j = 0; j < this.topRightButtons.Length; j++) { if (this.topRightButtons[j] != null) { this.topRightButtons[j].anchoredPosition += new Vector2((float)(-(float)num6), (float)(-(float)num6)); } } } if (!flag || !AdsManager.Instance.HasBannerPlacement(BannerPlacement.Solved) || AdsManager.Instance.GetBannerPosition() != BannerPosition.Bottom) { this.solvedPageControls.SetSafeLayoutExtraBottomOffset(SafeLayout.GetMaxBottomCanvasOffset(num) + 30); } } }
public static void Init() { SafeLayout.ScreenSize = SafeLayout.GetScreenSize(); SafeLayout.IsTablet = SafeLayout.IsTabletDevice(SafeLayout.ScreenSize); FMLogger.vCore("tablet:" + SafeLayout.IsTablet); }