public CodeCompletionListItemProvider(string autoCompleteWord) { _textFormatter = new CodeCompletionTextFormatter(autoCompleteWord); _icons = UnityEditorCompositionContainer.GetExportedValue <IIcons>(); // Todo: Transfer session data to CodeCompletionListItem items if (_debug) { // For test input we use icon names: Icons icons = _icons as Icons; string[] iconFilePaths = icons.GetIconFilePaths(); _items = new List <IListItem>(); for (int i = 0; i < iconFilePaths.Length; i++) { string iconFilename = Path.GetFileNameWithoutExtension(iconFilePaths[i % iconFilePaths.Length]); string iconType = iconFilename.Substring(12, iconFilename.Length - 12); // remove 'Icons.16x16.' string itemText = string.Format("{0}", iconType); if (_textFormatter.CanBeAutoCompleted(itemText)) { _items.Add(new CodeCompletionListItem(itemText, iconFilename, null)); } } } }
void InitIfNeeded() { if (s_Styles == null) { s_Styles = new Styles(); } if (_navigateToItemProvider == null) { _navigateToItemProvider = UnityEditorCompositionContainer.GetExportedValue <INavigateToItemProviderAggregator>(); } }
public CodeCompletionListItemGUI(int itemHeight, CodeCompletionListItemProvider owner) { ItemHeight = itemHeight; _owner = owner; _icons = UnityEditorCompositionContainer.GetExportedValue <IIcons>(); GUISkin skin = UnityEditorCompositionContainer.GetExportedValue <IGUISkinProvider>().GetGUISkin(); _text = skin.GetStyle("ListText"); _textSelected = skin.GetStyle("ListTextSelected"); _text.richText = true; _textSelected.richText = true; }
public ITextViewAppearance AppearanceFor(ITextViewDocument document, IFontManager fontManager) { GUISkin skin = UnityEditorCompositionContainer.GetExportedValue <IGUISkinProvider>().GetGUISkin(); // Make a copy of guistyle to ensure we do not change the guistyle of the skin GUIStyle textStyle = new GUIStyle(skin.label) { richText = true, alignment = TextAnchor.UpperLeft, padding = { left = 0, right = 0 } }; textStyle.normal.textColor = Color.white; GUIStyle backgroundStyle = skin.GetStyle("InnerShadowBg"); Color lineNumberColor = new Color(1, 1, 1, 0.5f); Color selectionColor = new Color(80 / 255f, 80 / 255f, 80 / 255f, 1f); return(new TextViewAppearance(fontManager, textStyle, backgroundStyle, lineNumberColor, selectionColor)); }