コード例 #1
0
        private static void OnGUI(string searchContext)
        {
            var style = new GUIStyle(EditorStyles.helpBox);

            style.fontSize = 13;
            style.richText = true;
            EditorGUI.BeginChangeCheck();

            _EnableCustomTitle.value =
                SettingsGUILayout.SettingsToggle("Enable Custom Window Title", _EnableCustomTitle, searchContext);
            using (new EditorGUI.DisabledScope(!_EnableCustomTitle.value))
            {
                _FormatString.value =
                    SettingsGUILayout.SettingsTextField("Window Title Format String", _FormatString, searchContext);
                _RepositoryPath.value =
                    SettingsGUILayout.SettingsTextField(
                        new GUIContent("Git Repository Path", "Git repository root directory"), _RepositoryPath,
                        searchContext);
                var parametersInfoBox = $@"Available title parameters:
    • <Branch> {_DisabledTextColorTag}{TitleFormatter.Format("<Branch>")}</color>
    • <SceneName> {_DisabledTextColorTag}{TitleFormatter.Format("<SceneName>")}</color>
    • <ProjectName> {_DisabledTextColorTag}{TitleFormatter.Format("<ProjectName>")}</color>
    • <RepoDirName> {_DisabledTextColorTag}{TitleFormatter.Format("<RepoDirName>")}</color>
    • <ProjectPath> {_DisabledTextColorTag}{TitleFormatter.Format("<ProjectPath>")}</color>
    • <RepoPath> {_DisabledTextColorTag}{TitleFormatter.Format("<RepoPath>")}</color>
    • <EditorVersion> {_DisabledTextColorTag}{TitleFormatter.Format("<EditorVersion>")}</color>
    • <TargetPlatform> {_DisabledTextColorTag}{TitleFormatter.Format("<TargetPlatform>")}</color>";
                GUILayout.Label(parametersInfoBox, style);
            }

            if (EditorGUI.EndChangeCheck())
            {
                Instance.Save();
                UpdateWindowTitle();
            }
        }