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);
            }
        }
    }
}
