Пример #1
0
        void OnGUI()
        {
            // if the hash is empty, that means we reset.
            init();
            float tocWidth = 200;

            GUILayout.BeginHorizontal();
            GUILayout.Space(10);
            GUILayout.BeginVertical(GUILayout.Width(tocWidth));
            GUILayout.Space(5);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Box(icon, new GUIStyle());
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(5);
            GUILayout.Label("Project Search & Replace\nVersion " + SRVersion.GetVersion() + "\n© 2020 Enemy Hideout LLC\n");

            GUIStyle sectionButtonStyle         = new GUIStyle((GUIStyle)"TE toolbarbutton");
            GUIStyle sectionButtonStyleSelected = new GUIStyle((GUIStyle)"TE toolbarbutton");
            float    gray = EditorGUIUtility.isProSkin ? 0.8f : 0.2f;

            sectionButtonStyle.normal.textColor         = new Color(gray, gray, gray, 1.0f);
            sectionButtonStyleSelected.normal.textColor = new Color(0.2f, 0.5f, 0.2f, 1.0f);
            sectionButtonStyleSelected.fontStyle        = FontStyle.Bold;
            foreach (SRHelpSection section in sections)
            {
                GUIStyle buttonStyle = section == currentSection ? sectionButtonStyleSelected : sectionButtonStyle;
                if (GUILayout.Button(SRLoc.L(section.label), buttonStyle, GUILayout.Width(tocWidth)))
                {
                    SetSection(section.key);
                }
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical();

            scrollViewPos = EditorGUILayout.BeginScrollView(scrollViewPos);
            GUIStyle wrappingStyle = new GUIStyle(GUI.skin.label);

            wrappingStyle.wordWrap = true;
            wrappingStyle.richText = true;
            GUIContent content    = new GUIContent(SRLoc.L(currentSection.contents));
            float      labelWidth = EditorGUIUtility.currentViewWidth - tocWidth - 37;

            float size         = wrappingStyle.CalcHeight(content, labelWidth);
            float bottomMargin = 100;

            EditorGUILayout.SelectableLabel(content.text, wrappingStyle, GUILayout.Height(size + bottomMargin), GUILayout.Width(labelWidth));
            EditorGUILayout.EndScrollView();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
Пример #2
0
        public void drawAbout()
        {
            if (GUILayout.Button(new GUIContent(EditorGUIUtility.FindTexture("d_UnityEditor.InspectorWindow")), SRWindow.richTextStyle, GUILayout.Width(20)))
            {
#if PSR_FULL
                EditorUtility.DisplayDialog("About", productName + " Tool for Unity\nVersion " + SRVersion.GetVersion() + "\n© 2018 Enemy Hideout LLC\n", "OK");
#else
                if (EditorUtility.DisplayDialog("About", productName + " Tool for Unity\nVersion " + SRVersion.GetVersion() + "\n© 2018 Enemy Hideout LLC\n", "Unlock Full Version", "Close"))
                {
                    Application.OpenURL(fullVersionURL);
                }
#endif
            }
        }