Ejemplo n.º 1
0
        private void SetModalState(ModalType type)
        {
            var canClose = false;

            switch (type)
            {
            case ModalType.NormalType:
            {
                break;
            }

            case ModalType.NormalHaveClose:
            {
                canClose = true;
                break;
            }

            case ModalType.TransparentType:
            {
                m_modalAlpha = 0.01f;
                break;
            }

            case ModalType.TransparentHaveClose:
            {
                m_modalAlpha = 0.01f;
                canClose     = true;
                break;
            }

            default:
            {
                m_modalAlpha = 0f;
                break;
            }
            }
            if (m_modalAlpha > 0)
            {
                string     path  = "UI/ModalSprite";
                GameObject modal = ResourceManagr.Instance.GetAssetCache <GameObject>(path);//DResources.AllocGameObject(path);
                modal.transform.SetParent(transform);
                modal.transform.SetAsFirstSibling();
                modal.transform.localScale    = Vector3.one;
                modal.transform.localPosition = Vector3.zero;
                if (canClose)
                {
                    var button = DUnityUtil.AddMonoBehaviour <Button>(modal);
                    button.onClick.AddListener(Close);
                }
                m_modalImage       = DUnityUtil.AddMonoBehaviour <Image>(modal);
                m_modalImage.color = new Color(0, 0, 0, m_modalAlpha);
            }
        }
Ejemplo n.º 2
0
 public T FindChildComponent <T>(Transform _transform, string path) where T : Component
 {
     return(DUnityUtil.FindChildComponent <T>(_transform, path));
 }
Ejemplo n.º 3
0
 public Transform FindChild(Transform _transform, string path)
 {
     return(DUnityUtil.FindChild(_transform, path));
 }