using UnityEditor; using UnityEngine; namespace TyphoonUnitySDK { public class PublishVivoBatSettingWindow : EditorWindow { [MenuItem("临时发布/发布vivo", priority = 10000)] public static void Open() { var win = GetWindow(); win.titleContent = new GUIContent("临时发布vivo"); win.minSize = new Vector2(650, 500); win.Show(); } private Editor _editor; public Editor Editor { get { if (_editor != null && _editor.target != PublishVivoBatSetting.Default) { DestroyImmediate(_editor); } if (_editor == null) { _editor = Editor.CreateEditor(PublishVivoBatSetting.Default, typeof(PublishVivoBatSettingInspector)); } return _editor; } } protected void OnGUI() { var rect = new Rect(0, 0, position.width, position.height); var area = rect; area.height -= 8; area.width -= 12; area.center = rect.center; GUILayout.BeginArea(area); var rectSave = new Rect(0, 0, area.width, area.height); rectSave.width = 100; rectSave.height = 32; rectSave.x = area.width - rectSave.width; rectSave.x -= 4; GUILayout.Space(36); Editor.OnInspectorGUI(); if (GUI.Button(rectSave, new GUIContent("保存配置", EditorIcons.icon_save))) { EditorUtility.SetDirty(PublishVivoBatSetting.Default); AssetDatabase.SaveAssets(); Debug.Log("保存完毕"); } GUILayout.EndArea(); Repaint(); } } }