| | |
| | | return AssetDatabase.LoadAssetAtPath<GameObject>(string.Format("Assets/Editor/UIPattern/{0}.prefab", name)); |
| | | } |
| | | |
| | | public static GameObject CreateUIComp(string sourceName, string name) |
| | | { |
| | | var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(string.Format("Assets/ResourcesOut/UIComp/{0}.prefab", sourceName)); |
| | | var instance = GameObject.Instantiate(prefab) as GameObject; |
| | | instance.name = name; |
| | | return instance; |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/FunctionButton")] |
| | | public static async UniTask CreateFunctionButton() |
| | | { |
| | |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/ItemCell")] |
| | | public static async UniTask CreateItemCell() |
| | | public static void CreateItemCell() |
| | | { |
| | | var button = await UIUtility.CreateWidget("ItemCell", "ItemCell"); |
| | | var button = CreateUIComp("ItemCell", "ItemCell"); |
| | | SetParent(button); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/通用按钮")] |
| | | public static async UniTask CreateButtonEx() |
| | | public static void CreateButtonEx() |
| | | { |
| | | var button = await UIUtility.CreateWidget("CommonButton", "CommonButton"); |
| | | var button = CreateUIComp("CommonButton", "CommonButton"); |
| | | var buttonEx = button.GetComponent<ButtonEx>(); |
| | | buttonEx.interval = 0.1f; |
| | | buttonEx.pressedScale = 1.05f; |
| | |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/红点")] |
| | | public static async UniTask CreateRedPoint() |
| | | public static void CreateRedPoint() |
| | | { |
| | | var button = await UIUtility.CreateWidget("RedPoint", "RedPoint"); |
| | | var button = CreateUIComp("RedPoint", "RedPoint"); |
| | | SetParent(button); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/二级带功能框")] |
| | | public static async UniTask CreateSecondLevelWin() |
| | | public static void CreateSecondLevelWin() |
| | | { |
| | | var prefab = await UIUtility.CreateWidget("SecondLevelWin", "Panel"); |
| | | var prefab = CreateUIComp("SecondLevelWin", "Panel"); |
| | | SetParent(prefab); |
| | | var rectTransform = prefab.GetComponent<RectTransform>(); |
| | | // 完全填充父容器 |