| | |
| | | using UnityEditor; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | [CustomEditor(typeof(UIBase),true),CanEditMultipleObjects] |
| | | using UnityEditor;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | [CustomEditor(typeof(UIBase),true),CanEditMultipleObjects]
|
| | | public class UIBaseEditor: Editor
|
| | | { |
| | | {
|
| | | public override void OnInspectorGUI() {
|
| | | UIBase ui = target as UIBase;
|
| | | //增加个按钮 点击生成一个新的遮罩
|
| | |
| | | GameObject.DestroyImmediate(ui.screenMask);
|
| | | ui.screenMask = null;
|
| | | }
|
| | | } |
| | | base.OnInspectorGUI(); |
| | | }
|
| | | base.OnInspectorGUI();
|
| | | EditorGUILayout.Space();
|
| | |
|
| | |
|
| | |
| | | if (ui.openMask)
|
| | | {
|
| | | CreateScreen(ui);
|
| | | ui.screenMask.GetComponent<Image>().color = new Color32(0, 0, 0, 226);
|
| | | ui.screenMask.GetComponent<Image>().color = new Color(0, 0, 0, 0.7f);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | |
|
| | |
|
| | |
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | void CreateScreen(UIBase ui)
|
| | | {
|
| | | if (ui.screenMask == null)
|
| | |
| | | ui.screenMask.transform.localPosition = Vector3.zero;
|
| | | ui.screenMask.transform.localScale = Vector3.one;
|
| | | ui.screenMask.transform.localRotation = Quaternion.identity;
|
| | | ui.screenMask.transform.SetAsFirstSibling(); |
| | | } |
| | | } |
| | | |
| | | ui.screenMask.transform.SetAsFirstSibling();
|
| | | }
|
| | | }
|
| | |
|