Exemple #1
0
 // 获取UI子目录
 public static Transform GetUIRoot(UIViewType uiViewType)
 {
     Transform canvas = GetCanvas().transform;
     Transform root = canvas.Find(uiViewType.ToString());
     if (root == null)
     {
         return CreateUIRoot(uiViewType, canvas);
     }
     return root;
 }
Exemple #2
0
        public static T LoadUI <T>(UIViewType ui, string atlasList)
            where T : UIBaseView
        {
            if (!FindManager())
            {
                return(null);
            }
            string uiTypeName = ui.ToString();

            return(Inst.OnLoadUI <T>(ui, uiTypeName, atlasList));
        }
Exemple #3
0
 // 创建UI子目录
 private static Transform CreateUIRoot(UIViewType uiViewType, Transform transform)
 {
     GameObject gameObject = new GameObject(uiViewType.ToString());
     gameObject.layer = LayerMask.NameToLayer("UI");
     RectTransform rect = gameObject.AddComponent<RectTransform>();
     gameObject.transform.SetParent(transform);
     rect.sizeDelta = Vector2.zero;
     rect.localScale = Vector3.one;
     rect.localPosition = Vector3.zero;
     rect.SetAnchor(AnchorPresets.StretchAll);
     return gameObject.transform;
 }