Exemple #1
0
        public static void AnalysisRes(GameObject select_go, Dictionary <E_ItemResType, List <ItemRes> > res_map)
        {
            if (select_go == null)
            {
                return;
            }
            Image[]    imgs     = select_go.GetComponentsInChildren <Image>();
            RawImage[] raw_imgs = select_go.GetComponentsInChildren <RawImage>();
            Text[]     texts    = select_go.GetComponentsInChildren <Text>();


            res_map.Clear();
            int length = imgs.Length;

            for (int i = 0; i < length; i++)
            {
                res_map[E_ItemResType.img].Add(EditorItemResHelper.CollectImgRes(imgs[i]));
            }

            length = raw_imgs.Length;
            for (int i = 0; i < length; i++)
            {
                res_map[E_ItemResType.raw_image].Add(EditorItemResHelper.CollectRawImageRes(raw_imgs[i]));
            }


            length = texts.Length;
            for (int i = 0; i < length; i++)
            {
                res_map[E_ItemResType.text].Add(EditorItemResHelper.CollectTextRes(texts[i]));
            }
        }
Exemple #2
0
        //[MenuItem("GameObject/UI辅助工具/本地化/1.置空本地化文本", false, 2)]
        public static void CheckLanguageLoc2()
        {
            List <ItemRes> text_list = new List <ItemRes>();

            EditorItemResHelper.FindAllText(Selection.activeGameObject, text_list);
            int length = text_list.Count;

            for (int i = 0; i < length; i++)
            {
                (text_list[i] as ItemTextRes).SetLanguage(false);
            }
        }
Exemple #3
0
        public static void CheckTextRaycast()
        {
            List <ItemRes> text_list = new List <ItemRes>();

            EditorItemResHelper.FindAllText(Selection.activeGameObject, text_list);
            Debug.Log("----------------字体带碰撞-----------------");
            foreach (var info in text_list)
            {
                if (info.raycast_target)
                {
                    Debug.Log(info.target_gameobject.name, info.target_gameobject);
                }
            }
        }
Exemple #4
0
        public static void SetTextRaycast()
        {
            List <ItemRes> text_list = new List <ItemRes>();

            EditorItemResHelper.FindAllText(Selection.activeGameObject, text_list);
            Debug.Log("----------------字体带碰撞-----------------");
            foreach (var info in text_list)
            {
                if (info.raycast_target)
                {
                    info.raycast_target = false;
                }
            }
            //PrefabUtility.ReplacePrefab(Selection.activeGameObject,)
            //EditorSceneManager.SaveOpenScenes();
            //EditorApplication.SaveScene(EditorApplication.currentScene);
            EditorUtility.DisplayDialog("去掉字体的碰撞框", "自动保存Prefab功能未完成,需要你手动保存prefab,多次点击Apply,然后多次点击control+S", "确定");
        }
Exemple #5
0
        /// <summary>
        /// 验证UI中字体的合格程度
        /// 1.字体是否有碰撞
        /// 2.字体的引用是否符合标准
        /// </summary>
        public static void CheckTextRef()
        {
            List <ItemRes> text_list = new List <ItemRes>();

            EditorItemResHelper.FindAllText(Selection.activeGameObject, text_list);

            Dictionary <string, List <ItemTextRes> > font_map = new Dictionary <string, List <ItemTextRes> >();

            foreach (var info in text_list)
            {
                if (!font_map.ContainsKey(info.ItemName))
                {
                    font_map.Add(info.ItemName, new List <ItemTextRes>());
                }
                font_map[info.ItemName].Add(info as ItemTextRes);
            }

            Debug.Log("----------------字体引用----------------- 一共引用了" + font_map.Count);
            foreach (var info in font_map)
            {
                Debug.LogError(info.Key);
            }
            foreach (var info in font_map)
            {
                List <ItemTextRes> text_res_list = info.Value;
                for (int i = 0; i < text_res_list.Count; i++)
                {
                    Debug.LogError(text_res_list[i].target_gameobject.name + "_" + text_res_list[i].ItemName, text_res_list[i].target_gameobject);
                }
            }

            /*foreach (var info in font_map)
             *  {
             *      if (!font_list.Contains(info.Key))
             *      {
             *          List<ItemTextRes> text_res_list = info.Value;
             *          for (int i = 0; i < text_res_list.Count; i++)
             *          {
             *              Debug.LogError(text_res_list[i].target_gameobject.name + "_" + text_res_list[i].ItemName, text_res_list[i].target_gameobject);
             *          }
             *      }
             *  }*/
        }