RandomGFGoStop/Assets/Scripts/UI/GamePanel/BannerSpace.cs

49 lines
1.1 KiB
C#
Raw Normal View History

2025-08-27 21:08:17 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BannerSpace : MonoBehaviour
{
[SerializeField] private RectTransform rect;
private void Awake()
2025-08-29 14:50:14 +00:00
{
GameManager.ADS.OnDestroyBannerAd += OnDestroyBannerAd;
}
private void OnEnable()
2025-08-27 21:08:17 +00:00
{
if (rect == null)
{
rect = GetComponent<RectTransform>();
}
2025-08-29 14:50:14 +00:00
if (rect != null)
2025-08-27 21:08:17 +00:00
{
2025-08-29 14:50:14 +00:00
if (GameManager.DB.IsRemoveADS == true)
2025-08-27 21:08:17 +00:00
{
rect.offsetMax = new Vector2(rect.offsetMax.x, 0);
}
else
{
2025-09-17 03:43:23 +00:00
rect.offsetMax = new Vector2(rect.offsetMax.x, -150f - (Screen.height - Screen.safeArea.height));
2025-08-29 14:50:14 +00:00
}
2025-08-27 21:08:17 +00:00
}
}
private void OnDestroyBannerAd(bool isDestroy)
{
if (rect != null)
{
if (isDestroy == true)
{
rect.offsetMax = new Vector2(rect.offsetMax.x, 0);
}
else
{
2025-09-17 03:43:23 +00:00
rect.offsetMax = new Vector2(rect.offsetMax.x, -150f - (Screen.height - Screen.safeArea.height));
2025-08-27 21:08:17 +00:00
}
}
}
}