Exemplo n.º 1
0
        public static void DrawGUI()
        {
#if UNITY_2018_3_OR_NEWER
            using (new GUILayout.HorizontalScope()) {
                if (GUILayout.Button("add"))
                {
                    var m    = new GenericMenu();
                    var list = AssemblieUtils.SubclassesOf <EditorWindow>()
                               .OrderBy(x => x.Assembly.FullName)
                               .ThenBy(x => x.FullName);
                    foreach (var p in list)
                    {
                        var asmName = p.Assembly.FullName.Split(',')[0];
                        m.AddItem($"{asmName[ 0 ]}/{asmName}/{p.Name}", reg, p);
                    }
                    m.DropDownAtMousePosition();
                    void reg(object context)
                    {
                        var t = (Type)context;

                        if (E.i.utilityWindowSettingsData.Find(x => x.TypeFullName == t.FullName) == null)
                        {
                            E.i.utilityWindowSettingsData.Add(new UtilityWindowSettingsData {
                                Enable = true, TypeFullName = t.FullName
                            });
                        }
                        CheckNullType();
                        E.Save();
                    }
                }

                if (GUILayout.Button("remove"))
                {
                    E.i.utilityWindowSettingsData = new List <UtilityWindowSettingsData>();
                }
            }


            UtilityWindowSettingsData _remove = null;

            foreach (var p in E.i.utilityWindowSettingsData)
            {
                EditorGUI.BeginChangeCheck();
                p.Enable = HEditorGUILayout.ToggleBox($"{p.GetUtilityType().FullName}", p.Enable, EditorIcon.minus, OnButton);
                if (EditorGUI.EndChangeCheck())
                {
                    E.Save();
                }
                void OnButton()
                {
                    _remove = p;
                }
            }
            if (_remove != null)
            {
                E.i.utilityWindowSettingsData.Remove(_remove);
                E.Save();
            }
#endif
        }
Exemplo n.º 2
0
 static __()
 {
     E.Load();
     if (UnitySymbol.UNITY_2019_3_OR_NEWER)
     {
         if (E.i.m_disableSyncVS)
         {
             EditorApplication.update -= KillVSSync;
             EditorApplication.update += KillVSSync;
         }
     }
 }
Exemplo n.º 3
0
        static void OnProjectFolderPreset()
        {
            var m = new GenericMenu();

            m.AddItem(S._Makepackagesettings, () => {
                E.i.projectSettingsPath = "6763de3f012135f439fea4e446738691";
                E.Save();
            });
            m.AddItem(S._UseProjectSettings, () => {
                E.i.projectSettingsPath = "ProjectSettings";
                E.Save();
            });
            m.DropDownAtMousePosition();
        }
Exemplo n.º 4
0
        public static void DrawGUI()
        {
            var method1 = AssemblieUtils.GetAllMethodsWithAttribute <Hananoki_OnOpenAsset>().ToArray();

            Helper.New(ref E.i.m_enableOnOpen);

            foreach (var p in method1)
            {
                var cus = p.GetCustomAttributes(typeof(Hananoki_OnOpenAsset), false).OfType <Hananoki_OnOpenAsset>().ToList();
                //cus.Find(x=>)
                ScopeHorizontal.Begin(EditorStyles.helpBox);
                ScopeVertical.Begin(GUILayout.Height(40), GUILayout.Width(20));
                GUILayout.FlexibleSpace();

                var hash = p.GetHash_OnOpenAsset();
                int idx  = E.i.m_enableOnOpen.IndexOf(hash);

                ScopeChange.Begin();
                var _enable = EditorGUILayout.Toggle(0 <= idx, GUILayout.Width(20));
                if (ScopeChange.End())
                {
                    if (_enable)
                    {
                        E.i.m_enableOnOpen.Add(hash);
                    }
                    else
                    {
                        E.i.m_enableOnOpen.Remove(hash);
                    }
                    E.Save();
                    Association.MakeMethods(true);
                }

                GUILayout.FlexibleSpace();
                ScopeVertical.End();
                ScopeVertical.Begin();


                EditorGUILayout.LabelField(EditorHelper.TempContent($"{p.Name} : { cus[ 0 ].GetName()}", EditorIcon.assetIcon_CsScript));
                EditorGUI.indentLevel++;
                EditorGUILayout.LabelField(EditorHelper.TempContent($"{p.Module.Name}", EditorIcon.icons_processed_assembly_icon_asset));
                EditorGUI.indentLevel--;
                ScopeVertical.End();
                ScopeHorizontal.End();
            }
        }
Exemplo n.º 5
0
        public static void Load()
        {
            if (i != null)
            {
                return;
            }

            i = EditorPrefJson <E> .Get(Package.editorPrefName);

            if (i.LCID.IsEmpty())
            {
                i.LCID = "en-US";
            }
            if (i.projectSettingsPath.IsEmpty())
            {
                i.projectSettingsPath = "6763de3f012135f439fea4e446738691";
            }

            Helper.New(ref i.utilityWindowSettingsData);
            //if( i.utilityWindowSettingsData == null ) i.utilityWindowSettingsData = new List<UtilityWindowSettingsData>();
            s_localizeEvent = null;
            LoadLocalize();
        }
Exemplo n.º 6
0
        public static void DrawGUI()
        {
            E.Load();

            HEditorGUILayout.HeaderTitle(SS._General);

            if (m_localeNames == null)
            {
                m_localeNames = new List <EditorLocalize.LCIDString>();               // EditorLocalize.s_lcidTable.OrderBy( x => x.NAME ).ToList();
                var files = "95cedfc7731853946b0b3650f175d73a".GetFilesFromAssetGUID().Select(x => x.FileNameWithoutExtension()).ToList();
                foreach (var rp in files)
                {
                    var p = EditorLocalize.s_lcidTable.Find(x => x.LCID == rp);
                    if (p == null)
                    {
                        continue;
                    }
                    m_localeNames.Add(p);
                }
                m_localeNames = m_localeNames.OrderBy(x => x.NAME).ToList();
            }

            ScopeChange.Begin();
            var idx = m_localeNames.FindIndex(x => x.LCID == E.i.LCID);

            if (idx < 0)
            {
                idx = m_localeNames.FindIndex(x => x.LCID == "en-US");
            }
            idx = EditorGUILayout.Popup(S._Language, idx, m_localeNames.Select(x => x.NAME).ToArray());
            if (ScopeChange.End())
            {
                E.i.LCID = m_localeNames[idx].LCID;
                E.LoadLocalize();
                E.Save();
            }

            //////////////////////////////////

            ScopeChange.Begin();
            GUILayout.Space(4);
            var _versionTextColor = EditorGUILayout.ColorField(S._VersionTextColor, E.i.versionTextColor.value);

            var _versionBackColor = EditorGUILayout.ColorField(S._VersionBackColor, E.i.versionBackColor.value);

            var _windowShade = HEditorGUILayout.ToggleLeft(S._WindowShade, E.i.m_windowShade);

            var _uielementsFontFix = HEditorGUILayout.ToggleLeft("UIElements Font Fix", E.i.m_uielementsFontFix);

            if (ScopeChange.End())
            {
                E.i.versionTextColor.value = _versionTextColor;
                E.i.versionBackColor.value = _versionBackColor;
                E.i.m_windowShade          = _windowShade;
                E.i.m_uielementsFontFix    = _uielementsFontFix;
                E.Save();
                EditorWindowUtils.RepaintProjectWindow();
            }

            //////////////////////////////////

            ScopeChange.Begin();

            GUILayout.Space(8);

            HEditorGUILayout.HeaderTitle("AssetPostprocessor");

            E.i.m_asmdefNameSync = HEditorGUILayout.ToggleLeft(S._MaketheNamefieldthesameasthefilenamewhenimportingasmdef, E.i.m_asmdefNameSync);
            ScopeDisable.Begin(true);
            E.i.m_asmdefAutoReferenceOFF = HEditorGUILayout.ToggleLeft(S._TurnoffAutoReferencedwhenimportingasmdef, E.i.m_asmdefAutoReferenceOFF);
            if (E.i.m_asmdefAutoReferenceOFF)
            {
                E.i.m_asmdefAutoReferenceOFF = false;
                E.Save();
            }
            ScopeDisable.End();
            //E.i.m_disableSyncVS = HEditorGUILayout.ToggleLeft( "Kill SyncVS", E.i.m_disableSyncVS );
            //E.i.utilityWindow = EditorGUILayout.ToggleLeft( SS._UtilityWindowMode, E.i.utilityWindow );
            if (ScopeChange.End())
            {
                E.Save();
            }

            //////////////////////////////////
            GUILayout.Space(8);

            HEditorGUILayout.HeaderTitle(S._WheretosaveProjectsettings);

            HEditorGUILayout.PreviewFolder(E.i.GetProjectSettingsPath(), OnProjectFolderPreset);

            GUILayout.Space(8f);
            ScopeHorizontal.Begin();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(SS._ReturnToDefault))
            {
                E.i.versionTextColor = new EditorColor(ColorUtils.RGB(72), ColorUtils.RGB(173));
                E.i.versionBackColor = new EditorColor(ColorUtils.RGB(242), ColorUtils.RGB(41));
                //E.i.utilityWindow = false;
                E.Save();
            }
            ScopeHorizontal.End();

            //HGUILayout.LinkLabel( "hoge" );

            //#if ENABLE_HANANOKI_SETTINGS && LOCAL_TEST
            //			using( new GUILayout.HorizontalScope() ) {
            //				GUILayout.FlexibleSpace();
            //				if( GUILayout.Button( "Open Settings" ) ) {
            //					SettingsWindow.Open();
            //				}
            //			}
            //#endif
        }
Exemplo n.º 7
0
 public static EditorWindow ShowWindow(Type editorWindowType)
 {
     return(EditorWindow.GetWindow(editorWindowType, EE.IsUtilityWindow(editorWindowType)));
 }
Exemplo n.º 8
0
 public static T ShowWindow <T>() where T : EditorWindow
 {
     return((T)EditorWindow.GetWindow(typeof(T), EE.IsUtilityWindow(typeof(T))));
 }
Exemplo n.º 9
0
 /*
  * NormalWindow,
  * PopupMenu,
  * Utility,
  * NoShadow,
  * MainWindow,
  * AuxWindow,
  * Tooltip,
  * ModalUtility
  */
 public static T GetWindow <T>() where T : EditorWindow
 {
     return(EditorWindow.GetWindow <T>(EE.IsUtilityWindow(typeof(T))));
 }
Exemplo n.º 10
0
 public static T GetOrCreate()
 {
     return(GetWindow <T>(EE.IsUtilityWindow(typeof(T))));
 }
Exemplo n.º 11
0
 public static void Open()
 {
     var window = GetWindow <BuildAssistWindow>(EE.IsUtilityWindow(typeof(BuildAssistWindow)));
 }