コード例 #1
0
ファイル: CodeEditor.cs プロジェクト: Heartstop/Limbie
        private void ApplyTheme()
        {
            // Check for missing references
            if (AllReferencesAssigned() == false)
            {
                throw new MissingReferenceException("Cannot apply theme because one or more required component references are missing. Make sure all references under the 'Elements' header are assigned");
            }

            bool nullTheme = false;

            // Check for no theme
            if (editorTheme == null)
            {
                // Get the default theme
                editorTheme = CodeEditorTheme.DefaultTheme;
                nullTheme   = true;
            }

            // Apply theme colors
            inputField.caretColor      = editorTheme.caretColor;
            inputText.color            = editorTheme.textColor;
            inputHighlightText.color   = editorTheme.textColor;
            background.color           = editorTheme.backgroundColor;
            lineHighlight.color        = editorTheme.lineHighlightColor;
            lineNumberBackground.color = editorTheme.lineNumberBackgroundColor;
            lineText.color             = editorTheme.lineNumberTextColor;
            scrollbar.color            = editorTheme.scrollbarColor;

            // Set active to null
            if (nullTheme == true)
            {
                editorTheme = null;
            }
        }
コード例 #2
0
ファイル: CodeEditor.cs プロジェクト: Heartstop/Limbie
        /// <summary>
        /// Called by Unity.
        /// </summary>
        public void Start()
        {
            // Load default theme
            if (editorTheme == null)
            {
                editorTheme = CodeEditorTheme.DefaultTheme;
            }

            // Apply the theme
            ApplyTheme();
            ApplyLanguage();
        }