| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [Author]: 玩个游戏 |
| | | // [ Date ]: Tuesday, October 31, 2017 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | |
| | | [MenuItem("GameObject/UI/特效")] |
| | | public static void CreateUIEffect() |
| | | { |
| | | var instance = new GameObject("UIEffect"); |
| | | instance.AddComponent<UIEffect>(); |
| | | var instance = new GameObject("UIEffectPlayer"); |
| | | instance.AddComponent<UIEffectPlayer>(); |
| | | instance.AddComponent<RectTransform>(); |
| | | SetParent(instance); |
| | | } |
| | |
| | | public static void CreateTextEx() |
| | | { |
| | | var instance = new GameObject("TextEx"); |
| | | var text = instance.AddComponent<TextEx>();
|
| | | var text = instance.AddComponent<TextEx>(); |
| | | text.font = FontUtility.preferred; |
| | | text.fontSize = 22; |
| | | text.alignment = TextAnchor.MiddleCenter; |
| | | text.raycastTarget = false; |
| | | text.horizontalOverflow = HorizontalWrapMode.Overflow; |
| | | text.verticalOverflow = VerticalWrapMode.Overflow; |
| | | SetParent(instance); |
| | | } |
| | | |
| | |
| | | SetParent(button); |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/SecondFrameLoad")] |
| | | [MenuItem("GameObject/UI/二级底框")] |
| | | public static void CreateSecondFrameLoad() |
| | | { |
| | | var prefab = LoadUIPattern("SecondFrameLoad"); |
| | |
| | | SetParent(instance); |
| | | } |
| | | |
| | | [MenuItem("GameObject/UI/二级带功能框")] |
| | | public static void CreateSecondLevelWin() |
| | | { |
| | | var prefab = UIUtility.CreateWidget("SecondLevelWin", "Panel"); |
| | | SetParent(prefab); |
| | | var rectTransform = prefab.GetComponent<RectTransform>(); |
| | | // 完全填充父容器 |
| | | rectTransform.anchorMin = Vector2.zero; |
| | | rectTransform.anchorMax = Vector2.one; |
| | | rectTransform.sizeDelta = Vector2.zero; |
| | | |
| | | } |
| | | } |
| | | |
| | | |