| | |
| | | Selection.activeGameObject = instance; |
| | | } |
| | | |
| | | public static GameObject LoadUIPattern(string name) |
| | | { |
| | | return AssetDatabase.LoadAssetAtPath<GameObject>(string.Format("Assets/Editor/UIPattern/{0}.prefab", name)); |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/FunctionButton")] |
| | | public static void CreateFunctionButton() |
| | |
| | | [MenuItem("GameObject/UI/GeneralWin_1")] |
| | | public static void CreateWindowPattern1() |
| | | { |
| | | var prefab = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Editor/UIPattern/GeneralWin.prefab"); |
| | | var prefab = LoadUIPattern("GeneralWin"); |
| | | var instance = GameObject.Instantiate(prefab) as GameObject; |
| | | instance.name = "GeneralWin"; |
| | | SetParent(instance); |
| | |
| | | [MenuItem("GameObject/UI/RewardGroup")] |
| | | public static void CreateRewardGroup() |
| | | { |
| | | var prefab = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Editor/UIPattern/Container_Rewards.prefab"); |
| | | var prefab = LoadUIPattern("Container_Rewards"); |
| | | var instance = GameObject.Instantiate(prefab) as GameObject; |
| | | instance.name = "Container_Rewards"; |
| | | SetParent(instance); |
| | |
| | | [MenuItem("GameObject/UI/CommonItemCell")] |
| | | public static void CreateCommonItemCell() |
| | | { |
| | | var prefab = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Editor/UIPattern/CommonItemCell.prefab"); |
| | | var prefab = LoadUIPattern("CommonItemCell"); |
| | | var instance = GameObject.Instantiate(prefab) as GameObject; |
| | | instance.name = "CommonItemCell"; |
| | | SetParent(instance); |
| | |
| | | [MenuItem("GameObject/UI/SortTable")] |
| | | public static void CreateSortTable() |
| | | { |
| | | var prefab = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Editor/UIPattern/SortTable.prefab"); |
| | | var prefab = LoadUIPattern("SortTable"); |
| | | var instance = GameObject.Instantiate(prefab) as GameObject; |
| | | instance.name = "SortTable"; |
| | | SetParent(instance); |
| | |
| | | SetParent(instance); |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/ButtonEx")] |
| | | [MenuItem("GameObject/UI/通用按钮")] |
| | | public static void CreateButtonEx() |
| | | { |
| | | var button = new GameObject("ButtonEx"); |
| | | var btnEx = button.AddComponent<ButtonEx>(); |
| | | var imgEx = button.AddComponent<ImageEx>(); |
| | | btnEx.targetGraphic = imgEx; |
| | | var button = UIUtility.CreateWidget("CommonButton", "CommonButton"); |
| | | SetParent(button); |
| | | var text = new GameObject("TextEx"); |
| | | text.AddComponent<TextEx>(); |
| | | SetParent(text, button.transform); |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/SecondFrameLoader")] |
| | | public static void CreateSecondFrameLoader() |
| | | [MenuItem("GameObject/UI/SecondFrame")] |
| | | public static void CreateSecondFrame() |
| | | { |
| | | var go = new GameObject("SecondFrameLoader"); |
| | | go.AddComponent<SecondFrameLoader>(); |
| | | SetParent(go); |
| | | var prefab = LoadUIPattern("SecondFrame"); |
| | | var instance = GameObject.Instantiate(prefab) as GameObject; |
| | | instance.name = "SecondFrame"; |
| | | SetParent(instance); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |