public Transform GOG_CorssUI;
public Transform GOG_VerticalUI;
void Update()
{
OnScreenChange();
}
private void OnScreenChange()
{
float height = Screen.height;
float width = Screen.width;
if (height> width)
{
bis_vertical = true;
bis_horizontal = false;
}
else
{
bis_vertical = false;
bis_horizontal = true;
}
GOG_CorssUI.gameObject.SetActive(bis_horizontal);
GOG_VerticalUI.gameObject.SetActive(bis_vertical);
for (int i = 0; i < GOG_CorssUI.childCount ; i++)
{
Onbis_verticalOrhorizontal(i, bis_horizontal, bis_vertical);
}
}
private void Onbis_verticalOrhorizontal(int id,bool bis_h,bool bis_v)
{
if (GOG_CorssUI.GetChild(id).gameObject.activeSelf && bis_v)
{
GOG_CorssUI.GetChild(id).gameObject.SetActive(!bis_v);
GOG_VerticalUI.GetChild(id).gameObject.SetActive(bis_v);
}
else if (GOG_VerticalUI.GetChild(id).gameObject.activeSelf && bis_h)
{
GOG_VerticalUI.GetChild(id).gameObject.SetActive(!bis_h);
GOG_CorssUI.GetChild(id).gameObject.SetActive(bis_h);
}
}
|