Newer
Older
Plot_On_Reality / Assets / Originals / Scripts / General / BackButton.cs
t-nagao on 1 Feb 2023 1 KB first
using Microsoft.MixedReality.Toolkit.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BackButton : MonoBehaviour
{
    [SerializeField] List<GameObject> wantToCloseByPressedBack;
    [SerializeField] GameObject nextScreenByPressedBack;

    [SerializeField] List<GameObject> wantToCloseByButtonAction;
    [SerializeField] GameObject nextScreenByButtonAction;
    public virtual void pressedBackButton()
    {
        if(nextScreenByPressedBack!= null)
        {
            nextScreenByPressedBack.SetActive(true);
        }

        if (wantToCloseByPressedBack != null)
        {
            foreach (GameObject go in wantToCloseByPressedBack)
            {
                go.SetActive(false);
            }
        }

    }

    public virtual void anotherButtonAction()
    {
        if (nextScreenByButtonAction != null)
        {
            nextScreenByButtonAction.SetActive(true);
        }

        if (wantToCloseByButtonAction != null)
        {
            foreach (GameObject go in wantToCloseByButtonAction)
            {
                go.SetActive(false);
            }
        }

    }

    public virtual void setGameObjectListAllActiveFalse(List<GameObject> list)
    {
        foreach (GameObject go in list)
        {
            if (go != null)
            {
                go.SetActive(false);
            }
        }
    }
}