Exemplo n.º 1
0
    void Awake()
    {
#if UNITY_STANDALONE
        _mobile = false;
#else
        if (Application.isEditor)
        {
            _mobile = false;
        }
#endif
        if (Popup != null)
        {
            _popupScript = Popup.GetComponent <AutosizedPopup>();
        }
    }
Exemplo n.º 2
0
    private void CheckPopup()
    {
        if (Popup == null)
        {
            // create popup
            //			if (PopupPrefab == null)
            //			{
            //				Debug.Log ("-----------------------------1 " + gameObject.name);
            //				Debug.Log ("-----------------------------2 " + gameObject.transform.parent.gameObject.name);
            //				Debug.Log ("-----------------------------3 " + TextId);
            //				Debug.Log ("-----------------------------4 " + gameObject.transform.parent.parent.gameObject.name);
            //			}
            Popup = (GameObject)Instantiate(PopupPrefab);
            if (_parentForPopup != null)
            {
                Popup.transform.SetParent(_parentForPopup, false);
            }
            else
            {
                Transform trans = transform;
                for (int i = 0; i < ParentForPopupCascade; ++i)
                {
                    trans = trans.parent;
                }
                Popup.transform.SetParent(trans);
            }

            if (CanvasLayer != "")
            {
                Canvas cnvs = Popup.AddComponent <Canvas>();
                cnvs.overrideSorting  = true;
                cnvs.sortingLayerName = CanvasLayer;
                cnvs.sortingOrder     = CanvasSortingOrder;
            }

            Popup.transform.SetAsLastSibling();
            _popupScript = Popup.GetComponent <AutosizedPopup>();
            _popupScript.HidePopupForce();
        }
    }