34 lines
911 B
C#
34 lines
911 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class UISafeAreaRightController : MyCoroutine
|
|
{
|
|
public bool BasePosisLeft;
|
|
public float xMul = 1f;
|
|
private UIRoot m_cUIRoot = null;
|
|
private float Ori_x = 0f;
|
|
|
|
void Awake()
|
|
{
|
|
if (null == m_cUIRoot)
|
|
m_cUIRoot = GetComponentInParent<UIRoot>();
|
|
|
|
Ori_x = transform.localPosition.x;
|
|
|
|
Act_Repeat_for1sec = ComputeSafeAreaOffest;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
ComputeSafeAreaOffest();
|
|
}
|
|
|
|
void ComputeSafeAreaOffest()
|
|
{
|
|
if (BasePosisLeft)
|
|
transform.localPosition = new Vector3(Ori_x + Screen.safeArea.y * xMul, transform.localPosition.y, transform.localPosition.z);
|
|
else
|
|
transform.localPosition = new Vector3(Ori_x - Screen.safeArea.y * xMul, transform.localPosition.y, transform.localPosition.z);
|
|
}
|
|
} |