Esempio n. 1
0
    public void CreatePopupLayer <Type>() where Type : LayerBase
    {
        isParent   = true;
        childLayer = SceneManager.Instance.CreateStateByType <Type>();
        if (childLayer != null)
        {
            SceneManager.Instance.PopupList.Add((PopupBase)childLayer);

            Canvas childCanvs = childLayer.GetComponentInChildren <Canvas>();
            childCanvs.sortingOrder = 9999 + SceneManager.Instance.PopupList.Count;

            LayerUnfocused();
        }
    }
Esempio n. 2
0
    public void ExchangeLayer <Type>() where Type : LayerBase
    {
        SceneManager.Instance.CloseAllPopup();

        LayerBase anotherLayer = SceneManager.Instance.CreateStateByType <Type>();

        if (anotherLayer != null)
        {
            if (this == SceneManager.Instance.RootLayer)
            {
                SceneManager.Instance.RootLayer = anotherLayer;
            }

            anotherLayer.transform.parent = transform.parent;

            Canvas anotherCanvas = anotherLayer.GetComponentInChildren <Canvas>();
            anotherCanvas.sortingOrder = canvas.sortingOrder;

            Destroy(gameObject);
        }
    }
Esempio n. 3
0
    public void CreateChildLayer <Type>() where Type : LayerBase
    {
        isParent   = true;
        childLayer = SceneManager.Instance.CreateStateByType <Type>();
        if (childLayer != null)
        {
            if (SceneManager.Instance.RootLayer == null)
            {
                SceneManager.Instance.RootLayer = childLayer;
            }
            else
            {
                childLayer.transform.parent = transform;
            }

            Canvas childCanvs = childLayer.GetComponentInChildren <Canvas>();
            childCanvs.sortingOrder = canvas.sortingOrder + 1;

            LayerUnfocused();
        }
    }