private void Update() { if (OptionsKeyBinding.doingKeyListen != this.keyOne && OptionsKeyBinding.doingKeyListen != this.keyTwo) { return; } if (!Input.anyKeyDown) { return; } KeyCode keyCode = this.FetchKey(); if (keyCode == KeyCode.None) { return; } if (keyCode != KeyCode.Escape) { OptionsKeyBinding.doingKeyListen.Text = keyCode.ToString(); } else { OptionsKeyBinding.doingKeyListen.Text = " "; } OptionsKeyBinding.doingKeyListen = null; }
public void OnLinkClicked( dfRichTextLabel sender, dfMarkupTagAnchor tag ) { var href = tag.HRef; if( href.ToLowerInvariant().StartsWith( "http:" ) ) { Application.OpenURL( href ); } }
private void StartKeyListen(dfRichTextLabel key) { if (doingKeyListen == null) { strPreviousValue = key.Text; key.Text = "..."; doingKeyListen = key; } }
public void OnLinkClicked(dfRichTextLabel sender, dfMarkupTagAnchor tag) { var href = tag.HRef; if (href.ToLowerInvariant().StartsWith("http:")) { Application.OpenURL(href); } }
void Awake() { mMyPlayerInfoPrefab = (GameObject)Resources.Load("Lobby/Prefabs/MyPlayerInfoBox"); mPlayerInfoPrefab = (GameObject)Resources.Load("Lobby/Prefabs/PlayerInfoBox"); mPlayersList = (dfScrollPanel)GameObject.FindObjectOfType(typeof(dfScrollPanel)); mChat = (dfRichTextLabel)GameObject.FindObjectOfType(typeof(dfRichTextLabel)); mLoadingPanel = (LoadingPanel)GameObject.FindObjectOfType(typeof(LoadingPanel)); mNetworkManager = (NetworkManager)GameObject.FindObjectOfType(typeof(NetworkManager)); }
private void StartKeyListen(dfRichTextLabel key) { if (OptionsKeyBinding.doingKeyListen != null) { return; } OptionsKeyBinding.strPreviousValue = key.Text; key.Text = "..."; OptionsKeyBinding.doingKeyListen = key; }
public static dfList <dfMarkupElement> Parse(dfRichTextLabel owner, string source) { try { parserInstance.owner = owner; return(parserInstance.parseMarkup(source)); } finally { } }
public override void Update() { base.Update(); if (this.useScrollMomentum && !this.isMouseDown && this.scrollMomentum.magnitude > 0.1f) { dfRichTextLabel scrollPosition = this; scrollPosition.ScrollPosition = scrollPosition.ScrollPosition + this.scrollMomentum; dfRichTextLabel _dfRichTextLabel = this; _dfRichTextLabel.scrollMomentum = _dfRichTextLabel.scrollMomentum * (0.95f - Time.deltaTime); } }
public static dfList<dfMarkupElement> Parse(dfRichTextLabel owner, string source) { dfList<dfMarkupElement> dfMarkupElements; try { dfMarkupParser.parserInstance.owner = owner; dfMarkupElements = dfMarkupParser.parserInstance.parseMarkup(source); } finally { } return dfMarkupElements; }
public static dfList <dfMarkupElement> Parse(dfRichTextLabel owner, string source) { dfList <dfMarkupElement> dfMarkupElements; try { dfMarkupParser.parserInstance.owner = owner; dfMarkupElements = dfMarkupParser.parserInstance.parseMarkup(source); } finally { } return(dfMarkupElements); }
protected internal override void OnMouseMove(dfMouseEventArgs args) { base.OnMouseMove(args); if (!this.allowScrolling) { return; } if ((args is dfTouchEventArgs ? true : this.isMouseDown) && (args.Position - this.touchStartPosition).magnitude > 5f) { Vector2 vector2 = args.MoveDelta.Scale(-1f, 1f); dfRichTextLabel scrollPosition = this; scrollPosition.ScrollPosition = scrollPosition.ScrollPosition + vector2; this.scrollMomentum = (this.scrollMomentum + vector2) * 0.5f; } }
/// <summary> /// Parses pseudo-HTML markup into a list of dfMarkupElement instances /// </summary> public static dfList <dfMarkupElement> Parse(dfRichTextLabel owner, string source) { try { //@Profiler.BeginSample( "Parse markup" ); parserInstance.owner = owner; var result = parserInstance.parseMarkup(source); return(result); } finally { //@Profiler.EndSample(); } }
public dfMarkupStyle(dfDynamicFont Font, int FontSize, UnityEngine.FontStyle FontStyle) { this.Host = null; this.Atlas = null; this.Font = Font; this.FontSize = FontSize; this.FontStyle = FontStyle; this.Align = dfMarkupTextAlign.Left; this.VerticalAlign = dfMarkupVerticalAlign.Baseline; this.Color = UnityEngine.Color.white; this.BackgroundColor = UnityEngine.Color.clear; this.TextDecoration = dfMarkupTextDecoration.None; this.PreserveWhitespace = false; this.Preformatted = false; this.WordSpacing = 0; this.CharacterSpacing = 0; this.lineHeight = 0; this.Opacity = 1f; }
/// <summary> /// Parses pseudo-HTML markup into a list of dfMarkupElement instances /// </summary> public static dfList<dfMarkupElement> Parse( dfRichTextLabel owner, string source ) { try { //@Profiler.BeginSample( "Parse markup" ); parserInstance.owner = owner; var result = parserInstance.parseMarkup( source ); return result; } finally { //@Profiler.EndSample(); } }
private void Update() { if (((doingKeyListen == this.keyOne) || (doingKeyListen == this.keyTwo)) && Input.anyKeyDown) { KeyCode code = this.FetchKey(); switch (code) { case KeyCode.None: return; case KeyCode.Escape: doingKeyListen.Text = " "; break; default: doingKeyListen.Text = code.ToString(); break; } doingKeyListen = null; } }
protected internal override void OnKeyDown(dfKeyEventArgs args) { if (args.Used) { base.OnKeyDown(args); return; } int fontSize = this.FontSize; int num = this.FontSize; if (args.KeyCode == KeyCode.LeftArrow) { dfRichTextLabel scrollPosition = this; scrollPosition.ScrollPosition = scrollPosition.ScrollPosition + new Vector2((float)(-fontSize), 0f); args.Use(); } else if (args.KeyCode == KeyCode.RightArrow) { dfRichTextLabel _dfRichTextLabel = this; _dfRichTextLabel.ScrollPosition = _dfRichTextLabel.ScrollPosition + new Vector2((float)fontSize, 0f); args.Use(); } else if (args.KeyCode == KeyCode.UpArrow) { dfRichTextLabel scrollPosition1 = this; scrollPosition1.ScrollPosition = scrollPosition1.ScrollPosition + new Vector2(0f, (float)(-num)); args.Use(); } else if (args.KeyCode == KeyCode.DownArrow) { dfRichTextLabel _dfRichTextLabel1 = this; _dfRichTextLabel1.ScrollPosition = _dfRichTextLabel1.ScrollPosition + new Vector2(0f, (float)num); args.Use(); } base.OnKeyDown(args); }
private static void inspectFont( dfRichTextLabel control ) { dfPrefabSelectionDialog.SelectionCallback selectionCallback = delegate( GameObject item ) { var font = ( item == null ) ? null : item.GetComponent<dfDynamicFont>(); dfEditorUtil.MarkUndo( control, "Assign Dynamic Font" ); control.Font = font; }; var value = control.Font; EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField( "Default Font", "", GUILayout.Width( dfEditorUtil.LabelWidth ) ); var displayText = value == null ? "[none]" : value.name; GUILayout.Label( displayText, "TextField" ); var evt = Event.current; if( evt != null ) { Rect textRect = GUILayoutUtility.GetLastRect(); if( evt.type == EventType.mouseDown && evt.clickCount == 2 ) { if( textRect.Contains( evt.mousePosition ) ) { if( GUI.enabled && value != null ) { Selection.activeObject = value; EditorGUIUtility.PingObject( value ); } } } else if( evt.type == EventType.DragUpdated || evt.type == EventType.DragPerform ) { if( textRect.Contains( evt.mousePosition ) ) { var draggedObject = DragAndDrop.objectReferences.First() as GameObject; var draggedFont = draggedObject != null ? draggedObject.GetComponent<dfDynamicFont>() : null; DragAndDrop.visualMode = ( draggedFont != null ) ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.None; if( evt.type == EventType.DragPerform ) { selectionCallback( draggedObject ); } evt.Use(); } } } if( GUI.enabled && GUILayout.Button( new GUIContent( " ", "Select Font" ), "IN ObjectField", GUILayout.Width( 14 ) ) ) { dfEditorUtil.DelayedInvoke( (System.Action)( () => { var dialog = dfPrefabSelectionDialog.Show( "Select Dynamic Font", typeof( dfDynamicFont ), selectionCallback, dfFontDefinitionInspector.DrawFontPreview, null ); dialog.previewSize = 200; } ) ); } } EditorGUILayout.EndHorizontal(); GUILayout.Space( 2 ); }
public dfMarkupStyle( dfDynamicFont Font, int FontSize, FontStyle FontStyle ) { Host = null; Atlas = null; this.Font = Font; this.FontSize = FontSize; this.FontStyle = FontStyle; Align = dfMarkupTextAlign.Left; VerticalAlign = dfMarkupVerticalAlign.Baseline; Color = UnityEngine.Color.white; BackgroundColor = UnityEngine.Color.clear; TextDecoration = dfMarkupTextDecoration.None; PreserveWhitespace = false; Preformatted = false; WordSpacing = 0; CharacterSpacing = 0; lineHeight = 0; Opacity = 1f; }
private static void inspectFont(dfRichTextLabel control) { dfPrefabSelectionDialog.SelectionCallback selectionCallback = delegate(GameObject item) { var font = (item == null) ? null : item.GetComponent <dfDynamicFont>(); dfEditorUtil.MarkUndo(control, "Assign Dynamic Font"); control.Font = font; }; var value = control.Font; EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Default Font", "", GUILayout.Width(dfEditorUtil.LabelWidth)); var displayText = value == null ? "[none]" : value.name; GUILayout.Label(displayText, "TextField"); var evt = Event.current; if (evt != null) { Rect textRect = GUILayoutUtility.GetLastRect(); if (evt.type == EventType.mouseDown && evt.clickCount == 2) { if (textRect.Contains(evt.mousePosition)) { if (GUI.enabled && value != null) { Selection.activeObject = value; EditorGUIUtility.PingObject(value); } } } else if (evt.type == EventType.DragUpdated || evt.type == EventType.DragPerform) { if (textRect.Contains(evt.mousePosition)) { var draggedObject = DragAndDrop.objectReferences.First() as GameObject; var draggedFont = draggedObject != null?draggedObject.GetComponent <dfDynamicFont>() : null; DragAndDrop.visualMode = (draggedFont != null) ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.None; if (evt.type == EventType.DragPerform) { selectionCallback(draggedObject); } evt.Use(); } } } if (GUI.enabled && GUILayout.Button(new GUIContent(" ", "Select Font"), "IN ObjectField", GUILayout.Width(14))) { dfEditorUtil.DelayedInvoke((System.Action)(() => { var dialog = dfPrefabSelectionDialog.Show("Select Dynamic Font", typeof(dfDynamicFont), selectionCallback, dfFontDefinitionInspector.DrawFontPreview, null); dialog.previewSize = 200; })); } } EditorGUILayout.EndHorizontal(); GUILayout.Space(2); }