49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class BannerSpace : MonoBehaviour
|
|
{
|
|
[SerializeField] private RectTransform rect;
|
|
|
|
private void Awake()
|
|
{
|
|
GameManager.ADS.OnDestroyBannerAd += OnDestroyBannerAd;
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (rect == null)
|
|
{
|
|
rect = GetComponent<RectTransform>();
|
|
}
|
|
|
|
if (rect != null)
|
|
{
|
|
if (GameManager.DB.IsRemoveADS == true)
|
|
{
|
|
rect.offsetMax = new Vector2(rect.offsetMax.x, 0);
|
|
}
|
|
else
|
|
{
|
|
rect.offsetMax = new Vector2(rect.offsetMax.x, -150f - (Screen.height - Screen.safeArea.height));
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnDestroyBannerAd(bool isDestroy)
|
|
{
|
|
if (rect != null)
|
|
{
|
|
if (isDestroy == true)
|
|
{
|
|
rect.offsetMax = new Vector2(rect.offsetMax.x, 0);
|
|
}
|
|
else
|
|
{
|
|
rect.offsetMax = new Vector2(rect.offsetMax.x, -150f - (Screen.height - Screen.safeArea.height));
|
|
}
|
|
}
|
|
}
|
|
}
|