public void sendClick (GPSDefinition.GPSPoint point) { //Pass it on
		cameraObject.SendMessage("moveToObserve", point);
		TextEditor te = new TextEditor ();
		te.content = new GUIContent (point.originalGPS);
		te.SelectAll ();
		te.Copy ();
	}
 public void copyText()
 {
     TextEditor text = new TextEditor();
     text.content = new GUIContent(custom.exportSong());
     text.SelectAll();
     text.Copy();
 }
		protected override Window CreateTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
		{
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null)
				return null;

			var titem = item.Item as TTI;

			if (titem == null)
				return null;

			var result = new TooltipInformationWindow ();
			result.ShowArrow = true;

			foreach(var i in AmbiguousType.TryDissolve(titem.t))
			{
				if (i == null)
					continue;
				var tooltipInformation = TooltipInfoGen.Create(i, editor.ColorStyle);
				if (tooltipInformation != null && !string.IsNullOrEmpty(tooltipInformation.SignatureMarkup))
					result.AddOverload(tooltipInformation);
			}

			if (result.Overloads < 1) {
				result.Dispose ();
				return null;
			}

			result.RepositionWindow ();
			return result;
		}
		public double GetLineHeight (TextEditor editor)
		{
			return editor.LineHeight;
			/*
			if (!IsVisible || DebuggingService.IsDebugging)
				return editor.LineHeight;
			
			if (editorAllocHeight == editor.Allocation.Width && lastLineLength == lineSegment.EditableLength)
				return lastHeight;
			
			CalculateLineFit (editor, lineSegment);
			double height;
			if (CollapseExtendedErrors) {
				height = editor.LineHeight;
			} else {
				// TODO: Insert virtual lines, if required
				height = UseVirtualLines ? editor.LineHeight * errors.Count : editor.LineHeight;
			}
			
			if (!fitsInSameLine)
				height += editor.LineHeight;
			
			editorAllocHeight = editor.Allocation.Height;
			lastLineLength = lineSegment.EditableLength;
			lastHeight = height;
			
			return height;*/
		}
		protected override void CorrectIndentingImplementation (PolicyContainer policyParent, TextEditor editor, int line)
		{
			var lineSegment = editor.GetLine (line);
			if (lineSegment == null)
				return;

			try {
				var policy = policyParent.Get<CSharpFormattingPolicy> (MimeType);
				var textpolicy = policyParent.Get<TextStylePolicy> (MimeType);
				var tracker = new CSharpIndentEngine (policy.CreateOptions (textpolicy));

				tracker.Update (IdeApp.Workbench.ActiveDocument.Editor, lineSegment.Offset);
				for (int i = lineSegment.Offset; i < lineSegment.Offset + lineSegment.Length; i++) {
					tracker.Push (editor.GetCharAt (i));
				}

				string curIndent = lineSegment.GetIndentation (editor);

				int nlwsp = curIndent.Length;
				if (!tracker.LineBeganInsideMultiLineComment || (nlwsp < lineSegment.LengthIncludingDelimiter && editor.GetCharAt (lineSegment.Offset + nlwsp) == '*')) {
					// Possibly replace the indent
					string newIndent = tracker.ThisLineIndent;
					if (newIndent != curIndent) 
						editor.ReplaceText (lineSegment.Offset, nlwsp, newIndent);
				}
			} catch (Exception e) {
				LoggingService.LogError ("Error while indenting", e);
			}
		}
		public static bool IsContext(TextEditor editor, DocumentContext ctx, int position, CancellationToken cancellationToken)
		{
			// Check to see if we're to the right of an $ or an @$
			var start = position - 1;
			if (start < 0)
			{
				return false;
			}

			if (editor[start] == '@')
			{
				start--;

				if (start < 0)
				{
					return false;
				}
			}

			if (editor[start] != '$')
			{
				return false;
			}

			var tree = ctx.AnalysisDocument.GetSyntaxTreeAsync (cancellationToken).WaitAndGetResult(cancellationToken);
			var token = tree.GetRoot(cancellationToken).FindTokenOnLeftOfPosition(start);

			return tree.IsExpressionContext(start, token, attributes: false, cancellationToken: cancellationToken)
				       || tree.IsStatementContext(start, token, cancellationToken);
		}
		public ColorShemeEditor (HighlightingPanel panel)
		{
			this.panel = panel;
			this.Build ();
			textEditor = new TextEditor ();
			textEditor.Options = DefaultSourceEditorOptions.Instance;
			this.scrolledwindowTextEditor.Child = textEditor;
			textEditor.ShowAll ();
			
			this.treeviewColors.AppendColumn (GettextCatalog.GetString ("Name"), new Gtk.CellRendererText (), new CellLayoutDataFunc (SyntaxCellRenderer));
			this.treeviewColors.HeadersVisible = false;
			this.treeviewColors.Model = colorStore;
			this.treeviewColors.Selection.Changed += HandleTreeviewColorsSelectionChanged;
			this.colorbuttonFg.ColorSet += Stylechanged;
			this.colorbuttonBg.ColorSet += Stylechanged;
			this.colorbuttonPrimary.ColorSet += Stylechanged;
			this.colorbuttonSecondary.ColorSet += Stylechanged;
			this.colorbuttonBorder.ColorSet += Stylechanged;
			colorbuttonBg.UseAlpha = true;
			this.checkbuttonBold.Toggled += Stylechanged;
			this.checkbuttonItalic.Toggled += Stylechanged;
			
			this.buttonOk.Clicked += HandleButtonOkClicked;
			HandleTreeviewColorsSelectionChanged (null, null);
			notebookColorChooser.ShowTabs = false;
		}
		public override async Task<TooltipItem> GetItem (TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default(CancellationToken))
		{
			if (ctx == null)
				return null;
			var analysisDocument = ctx.ParsedDocument;
			if (analysisDocument == null)
				return null;
			var unit = analysisDocument.GetAst<SemanticModel> ();
			if (unit == null)
				return null;
			
			var root = unit.SyntaxTree.GetRoot (token);
			SyntaxToken syntaxToken;
			try {
				syntaxToken = root.FindToken (offset);
			} catch (ArgumentOutOfRangeException) {
				return null;
			}
			if (!syntaxToken.Span.IntersectsWith (offset))
				return null;
			var symbolInfo = unit.GetSymbolInfo (syntaxToken.Parent, token);
			var symbol = symbolInfo.Symbol ?? unit.GetDeclaredSymbol (syntaxToken.Parent, token);
			var tooltipInformation = await CreateTooltip (symbol, syntaxToken, editor, ctx, offset);
			if (tooltipInformation == null || string.IsNullOrEmpty (tooltipInformation.SignatureMarkup))
				return null;
			return new TooltipItem (tooltipInformation, syntaxToken.Span.Start, syntaxToken.Span.Length);
		}
Exemple #9
0
		/// <summary>
		/// Copies editor options and default element customizations.
		/// Does not copy the syntax highlighting.
		/// </summary>
		public static void CopySettingsFrom(this TextEditor editor, TextEditor source)
		{
			editor.Options = source.Options;
			string language = source.SyntaxHighlighting != null ? source.SyntaxHighlighting.Name : null;
			CustomizingHighlighter.ApplyCustomizationsToDefaultElements(editor, CustomizedHighlightingColor.FetchCustomizations(language));
			HighlightingOptions.ApplyToRendering(editor, CustomizedHighlightingColor.FetchCustomizations(language));
		}
		public BounceFadePopupWindow (TextEditor editor) : base (Gtk.WindowType.Popup)
		{
			if (!IsComposited)
				throw new InvalidOperationException ("Only works with composited screen. Check Widget.IsComposited.");
			if (editor == null)
				throw new ArgumentNullException ("Editor");
			DoubleBuffered = true;
			Decorated = false;
			BorderWidth = 0;
			HasFrame = true;
			this.editor = editor;
			Events = Gdk.EventMask.ExposureMask;
			Duration = 500;
			ExpandWidth = 12;
			ExpandHeight = 2;
			BounceEasing = Easing.Sine;
			
			var rgbaColormap = Screen.RgbaColormap;
			if (rgbaColormap == null)
				return;
			Colormap = rgbaColormap;

			stage.ActorStep += OnAnimationActorStep;
			stage.Iteration += OnAnimationIteration;
			stage.UpdateFrequency = 10;
		}
		public CodeSegmentPreviewWindow (TextEditor editor, bool hideCodeSegmentPreviewInformString, ISegment segment, int width, int height) : base (Gtk.WindowType.Popup)
		{
			this.HideCodeSegmentPreviewInformString = hideCodeSegmentPreviewInformString;
			this.editor = editor;
			this.AppPaintable = true;
			layout = PangoUtil.CreateLayout (this);
			informLayout = PangoUtil.CreateLayout (this);
			informLayout.SetText (CodeSegmentPreviewInformString);
			
			fontDescription = Pango.FontDescription.FromString (editor.Options.FontName);
			fontDescription.Size = (int)(fontDescription.Size * 0.8f);
			layout.FontDescription = fontDescription;
			layout.Ellipsize = Pango.EllipsizeMode.End;
			// setting a max size for the segment (40 lines should be enough), 
			// no need to markup thousands of lines for a preview window
			int startLine = editor.Document.OffsetToLineNumber (segment.Offset);
			int endLine = editor.Document.OffsetToLineNumber (segment.EndOffset);
			const int maxLines = 40;
			bool pushedLineLimit = endLine - startLine > maxLines;
			if (pushedLineLimit)
				segment = new Segment (segment.Offset, editor.Document.GetLine (startLine + maxLines).Offset - segment.Offset);
			layout.Ellipsize = Pango.EllipsizeMode.End;
			layout.SetMarkup (editor.Document.SyntaxMode.GetMarkup (editor.Document,
			                                                        editor.Options,
			                                                        editor.ColorStyle,
			                                                        segment.Offset,
			                                                        segment.Length,
			                                                        true) + (pushedLineLimit ? Environment.NewLine + "..." : ""));
			CalculateSize ();
		}
		public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
		{
			var result = new LanguageItemWindow (GetExtensibleTextEditor (editor), modifierState, null, (string)item.Item, null);
			if (result.IsEmpty)
				return null;
			return result;
		}
		internal static ExtensibleTextEditor GetExtensibleTextEditor (TextEditor editor)
		{
			var view = editor.GetContent<SourceEditorView> ();
			if (view == null)
				return null;
			return view.TextEditor;
		}
 void CopyText(string pText)
 {
     TextEditor editor = new TextEditor();
     editor.content = new GUIContent(pText);
     editor.SelectAll();
     editor.Copy();
 }
Exemple #15
0
		public override void Draw (TextEditor editor, Cairo.Context cr, Pango.Layout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos)
		{
			int markerStart = LineSegment.Offset + System.Math.Max (StartCol - 1, 0);
			int markerEnd = LineSegment.Offset + (EndCol < 1 ? LineSegment.Length : EndCol - 1);
			if (markerEnd < startOffset || markerStart > endOffset) 
				return;
			
			bool drawOverlay = result.InspectionMark == IssueMarker.GrayOut;
			
			if (drawOverlay && editor.IsSomethingSelected) {
				var selectionRange = editor.SelectionRange;
				if (selectionRange.Contains (markerStart) && selectionRange.Contains (markerEnd))
					return;
				if (selectionRange.Contains (markerEnd))
					markerEnd = selectionRange.Offset;
				if (selectionRange.Contains (markerStart))
					markerStart = selectionRange.EndOffset;
				if (markerEnd <= markerStart)
					return;
			}
			
			double drawFrom;
			double drawTo;
				
			if (markerStart < startOffset && endOffset < markerEnd) {
				drawFrom = startXPos;
				drawTo = endXPos;
			} else {
				int start = startOffset < markerStart ? markerStart : startOffset;
				int end = endOffset < markerEnd ? endOffset : markerEnd;
				int /*lineNr,*/ x_pos;
				
				x_pos = layout.IndexToPos (start - startOffset).X;
				drawFrom = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
				x_pos = layout.IndexToPos (end - startOffset).X;
	
				drawTo = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
			}
			
			drawFrom = System.Math.Max (drawFrom, editor.TextViewMargin.XOffset);
			drawTo = System.Math.Max (drawTo, editor.TextViewMargin.XOffset);
			if (drawFrom >= drawTo)
				return;
			
			double height = editor.LineHeight / 5;
			cr.Color = ColorName == null ? Color : editor.ColorStyle.GetColorFromDefinition (ColorName);
			if (drawOverlay) {
				cr.Rectangle (drawFrom, y, drawTo - drawFrom, editor.LineHeight);
				var color = editor.ColorStyle.Default.CairoBackgroundColor;
				color.A = 0.6;
				cr.Color = color;
				cr.Fill ();
			} else if (Wave) {	
				Pango.CairoHelper.ShowErrorUnderline (cr, drawFrom, y + editor.LineHeight - height, drawTo - drawFrom, height);
			} else {
				cr.MoveTo (drawFrom, y + editor.LineHeight - 1);
				cr.LineTo (drawTo, y + editor.LineHeight - 1);
				cr.Stroke ();
			}
		}
Exemple #16
0
	static void CopyTR()
	{

		var sels = Selection.GetFiltered(typeof(Transform), SelectionMode.Unfiltered);

		string info = "";
		int index = 0;
		sels = SortSels(sels);
		
		foreach (var s in sels)
		{
			Transform t = s as Transform;
			Vector3 pos = t.position;
			Vector3 rot = t.rotation.eulerAngles;
			if (index != 0)
			{
				info += "\n";
			}
			info += string.Format("{1:F2}\t{2:F2}\t{3:F2}\t", info, pos.x, pos.y, pos.z);
			info += string.Format("{1:F2}\t {2:F2}\t{3:F2}", info, rot.x, rot.y, rot.z);
			index++;
		}
		
		TextEditor tempEditor = new TextEditor();
		tempEditor.content = new GUIContent(info);
		tempEditor.SelectAll();
		tempEditor.Copy();
		tempEditor = null;

		Debug.Log("Copy TR");
	}
		public PinnedWatchWidget (TextEditor editor, PinnedWatch watch)
		{
			objectValue = watch.Value;
			Editor = editor;
			Watch = watch;

			valueTree = new ObjectValueTreeView ();
			valueTree.AllowAdding = false;
			valueTree.AllowEditing = true;
			valueTree.AllowPinning = true;
			valueTree.HeadersVisible = false;
			valueTree.CompactView = true;
			valueTree.PinnedWatch = watch;
			if (objectValue != null)
				valueTree.AddValue (objectValue);
			
			valueTree.ButtonPressEvent += HandleValueTreeButtonPressEvent;
			valueTree.ButtonReleaseEvent += HandleValueTreeButtonReleaseEvent;
			valueTree.MotionNotifyEvent += HandleValueTreeMotionNotifyEvent;
			
			Gtk.Frame fr = new Gtk.Frame ();
			fr.ShadowType = Gtk.ShadowType.Out;
			fr.Add (valueTree);
			Add (fr);
			HandleEditorOptionsChanged (null, null);
			ShowAll ();
			//unpin.Hide ();
			Editor.EditorOptionsChanged += HandleEditorOptionsChanged;
			
			DebuggingService.PausedEvent += HandleDebuggingServicePausedEvent;
			DebuggingService.ResumedEvent += HandleDebuggingServiceResumedEvent;
		}
Exemple #18
0
		public FoldMarkerMargin (TextEditor editor)
		{
			this.editor = editor;
			layout = PangoUtil.CreateLayout (editor);
			editor.Caret.PositionChanged += HandleEditorCaretPositionChanged;
			editor.Document.FoldTreeUpdated += HandleEditorDocumentFoldTreeUpdated;
		}
Exemple #19
0
 public void CopyToClipBoard()
 {
     TextEditor te = new TextEditor();
     te.text = seedValue.Seed;
     te.SelectAll();
     te.Copy();
 }
Exemple #20
0
 private static string GetWordBeforeCaret(TextEditor textEditor)
 {
     TextDocument document = textEditor.Document;
     int caretOffset = textEditor.CaretOffset;
     int startOfWord = TextUtilities.GetNextCaretPosition(document, caretOffset, LogicalDirection.Backward, CaretPositioningMode.WordStart);
     return (startOfWord >= 0) ? document.GetText(startOfWord, caretOffset - startOfWord) : string.Empty;
 }
Exemple #21
0
    //Switches the GUI on and off
    //*******************************************************
    void Update()
    {
        if (atWall)
        {
            if (Input.GetKeyDown("e"))
            {
                //			Screen.lockCursor = false;  //Cursor is free to move when user goes into terminal
                if (guiEnabled)
                {
                    resume();
                }
                else
                {
					StartCoroutine(jackin ());
                }
            }
        }
        else
        {
            //Screen.showCursor = false;
            //Screen.lockCursor = true;  //Hiding Cursor means redoing the way the crosshair was implemented -Josephs
            //Screen.lockCursor = false; //Cursor remains locked if not in terminal
        }
        editor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
        editor.MoveLineStart();
    }
		public override bool CheckOpeningPoint(TextEditor editor, DocumentContext ctx, CancellationToken cancellationToken)
		{
			var snapshot = CurrentSnapshot;
			var position = StartOffset;
			var token = FindToken(snapshot, position, cancellationToken);

			// check token at the opening point first
			if (!IsValidToken(token) ||
			    token.RawKind != OpeningTokenKind ||
			    token.SpanStart != position || token.Parent == null)
			{
				return false;
			}

			// now check whether parser think whether there is already counterpart closing parenthesis
			var pair = token.Parent.GetParentheses();

			// if pair is on the same line, then the closing parenthesis must belong to other tracker.
			// let it through
			if (Editor.GetLineByOffset (pair.Item1.SpanStart).LineNumber == Editor.GetLineByOffset(pair.Item2.Span.End).LineNumber)
			{
				return true;
			}

			return (int)pair.Item2.Kind() != ClosingTokenKind || pair.Item2.Span.Length == 0;
		}
 public static void CopyToClipboard(string str)
 {
     TextEditor te = new TextEditor();
     te.text = str;
     te.OnFocus();
     te.Copy();
 }
		public static void FormatStatmentAt (TextEditor editor, DocumentContext context, MonoDevelop.Ide.Editor.DocumentLocation location, OptionSet optionSet = null)
		{
			var offset = editor.LocationToOffset (location);
			var policyParent = context.Project != null ? context.Project.Policies : PolicyService.DefaultPolicies;
			var mimeTypeChain = DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
			Format (policyParent, mimeTypeChain, editor, context, offset, offset, false, true, optionSet: optionSet);
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="Trilogic.CompareWindow"/> class.
        /// </summary>
        /// <param name="parent">The parent window.</param>
        /// <param name="compareName">Compare name.</param>
        /// <param name="fileSide">File side.</param>
        /// <param name="databaseSide">Database side.</param>
        public CompareWindow(MainWindow parent, string compareName, SchemaData fileSide, SchemaData databaseSide)
            : base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            this.parent = parent;

            this.docLocal = new TextDocument();
            this.docDB = new TextDocument();

            this.editorLocal = new TextEditor(this.docLocal);
            this.editorDB = new TextEditor(this.docDB);

            Gtk.ScrolledWindow scrollLocal = new Gtk.ScrolledWindow();
            Gtk.ScrolledWindow scrollDB = new Gtk.ScrolledWindow();
            scrollLocal.Add(this.editorLocal);
            scrollDB.Add(this.editorDB);

            this.hbox1.Add(scrollDB);
            this.hbox1.Add(scrollLocal);

            Gtk.Box.BoxChild childLocal = (Gtk.Box.BoxChild)this.hbox1[scrollLocal];
            childLocal.Position = 2;

            Gtk.Box.BoxChild childDB = (Gtk.Box.BoxChild)this.hbox1[scrollDB];
            childDB.Position = 0;

            this.ShowAll();

            this.Title += " - " + compareName;

            this.fileSide = fileSide;
            this.databaseSide = databaseSide;

            this.ShowSchema();
        }
Exemple #26
0
 public void CopyText()
 {
     TextEditor te = new TextEditor();
     te.content = new GUIContent(ToCSV());
     te.SelectAll();
     te.Copy();
 }
Exemple #27
0
        public void FindTextInTextEditor(TextEditor te)
        {
            if (tbFind.Text.Length == 0) return;
            //         if (cbFindUp.IsChecked == false) G.CurOffset = te.SelectionStart;
            //          else G.CurOffset = te.SelectionStart + te.SelectionLength;
            string stext = tbFind.Text;
            if (cbMatchCase.IsChecked == false) stext = stext.ToLower();
            //    if (cbMatchWholeWord.IsChecked == true) stext = ' ' + stext + ' ';
            if (cbFindUp.IsChecked == false) //Find down
            {
                while (true)
                {
                    DocumentLine dl = te.Document.GetLineByOffset(G.CurOffset);
                    string str = te.Document.GetText(G.CurOffset, dl.Length - (G.CurOffset - dl.Offset));
                    if (cbMatchCase.IsChecked == false) str = str.ToLower();
                    int pos;

                    pos = str.IndexOf(stext);
                    if (pos != -1)
                    {
                    }
                    if (cbMatchWholeWord.IsChecked == true)
                        if (!G.LineConsist(str.Split(' '), stext)) pos = -1;
                    if (pos != -1)
                    {
                        te.ScrollToLine(dl.LineNumber);
                        te.Select(dl.Offset + pos, stext.Length);
                        G.CurOffset = dl.Offset + dl.TotalLength; ;
                        break;
                    }


                    G.CurOffset = dl.Offset + dl.TotalLength;
                    if (G.CurOffset >= te.Document.TextLength) { MessageBox.Show("Reached end of document."); G.CurOffset = 0; break; }
                }//for                             
            }
            else // Find up
            {
                while (true)
                {
                    DocumentLine dl = te.Document.GetLineByOffset(G.CurOffset);
                    string str = te.Document.GetText(dl.Offset, G.CurOffset - dl.Offset);
                    if (cbMatchCase.IsChecked == false) str = str.ToLower();
                    int pos = str.IndexOf(stext);
                    if (pos != -1)
                    {
                        te.ScrollToLine(dl.LineNumber);
                        te.Select(dl.Offset + pos, stext.Length);
                        G.CurOffset = dl.Offset + pos;
                        break;
                    }//if 
                    if (dl.PreviousLine != null)
                        G.CurOffset = dl.PreviousLine.Offset + dl.PreviousLine.Length;
                    else G.CurOffset = 0;
                    if (G.CurOffset <= 0) { MessageBox.Show("Reached begin of document."); G.CurOffset = 0; break; }
                }//for                             

            }
        }//func
		static void Format (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain, TextEditor editor, DocumentContext context, int startOffset, int endOffset, bool exact, bool formatLastStatementOnly = false, OptionSet optionSet = null)
		{
			TextSpan span;
			if (exact) {
				span = new TextSpan (startOffset, endOffset - startOffset);
			} else {
				span = new TextSpan (0, endOffset);
			}

			var analysisDocument = context.AnalysisDocument;
			if (analysisDocument == null)
				return;

			using (var undo = editor.OpenUndoGroup (/*OperationType.Format*/)) {
				try {
					var syntaxTree = analysisDocument.GetSyntaxTreeAsync ().Result;

					if (formatLastStatementOnly) {
						var root = syntaxTree.GetRoot ();
						var token = root.FindToken (endOffset);
						var tokens = ICSharpCode.NRefactory6.CSharp.FormattingRangeHelper.FindAppropriateRange (token);
						if (tokens.HasValue) {
							span = new TextSpan (tokens.Value.Item1.SpanStart, tokens.Value.Item2.Span.End - tokens.Value.Item1.SpanStart);
						} else {
							var parent = token.Parent;
							if (parent != null)
								span = parent.FullSpan;
						}
					}

					if (optionSet == null) {
						var policy = policyParent.Get<CSharpFormattingPolicy> (mimeTypeChain);
						var textPolicy = policyParent.Get<TextStylePolicy> (mimeTypeChain);
						optionSet = policy.CreateOptions (textPolicy);
					}

					var doc = Formatter.FormatAsync (analysisDocument, span, optionSet).Result;
					var newTree = doc.GetSyntaxTreeAsync ().Result;
					var caretOffset = editor.CaretOffset;

					int delta = 0;
					foreach (var change in newTree.GetChanges (syntaxTree)) {
						if (!exact && change.Span.Start + delta >= caretOffset)
							continue;
						var newText = change.NewText;
						editor.ReplaceText (delta + change.Span.Start, change.Span.Length, newText);
						delta = delta - change.Span.Length + newText.Length;
					}

					var caretEndOffset = caretOffset + delta;
					if (0 <= caretEndOffset && caretEndOffset < editor.Length)
						editor.CaretOffset = caretEndOffset;
					if (editor.CaretColumn == 1)
						editor.CaretColumn = editor.GetVirtualIndentationColumn (editor.CaretLine);
				} catch (Exception e) {
					LoggingService.LogError ("Error in on the fly formatter", e);
				}
			}
		}
		public OverridesImplementsDialog (TextEditor editor, IType cls)
		{
			this.Build();
			this.editor = editor;
			this.cls = cls;

			// FIXME: title
			Title = GettextCatalog.GetString ("Override and/or implement members");

			store = new TreeStore (typeof (bool), typeof (Gdk.Pixbuf), typeof (string), typeof (bool), typeof (IMember));

			// Column #1
			TreeViewColumn nameCol = new TreeViewColumn ();
			nameCol.Title = GettextCatalog.GetString ("Name");
			nameCol.Expand = true;
			nameCol.Resizable = true;

			CellRendererToggle cbRenderer = new CellRendererToggle ();
			cbRenderer.Activatable = true;
			cbRenderer.Toggled += OnSelectToggled;
			nameCol.PackStart (cbRenderer, false);
			nameCol.AddAttribute (cbRenderer, "active", colCheckedIndex);

			CellRendererPixbuf iconRenderer = new CellRendererPixbuf ();
			nameCol.PackStart (iconRenderer, false);
			nameCol.AddAttribute (iconRenderer, "pixbuf", colIconIndex);

			CellRendererText nameRenderer = new CellRendererText ();
			nameRenderer.Ellipsize = Pango.EllipsizeMode.End;
			nameCol.PackStart (nameRenderer, true);
			nameCol.AddAttribute (nameRenderer, "text", colNameIndex);

			treeview.AppendColumn (nameCol);

			// Column #2
			CellRendererToggle explicitRenderer = new CellRendererToggle ();
			explicitRenderer.Activatable = true;
			explicitRenderer.Xalign = 0.0f;
			explicitRenderer.Toggled += OnExplicitToggled;
			TreeViewColumn explicitCol = new TreeViewColumn ();
			explicitCol.Title = GettextCatalog.GetString ("Explicit");
			explicitCol.PackStart (explicitRenderer, true);
			explicitCol.SetCellDataFunc (explicitRenderer, new TreeCellDataFunc (RenderExplicitCheckbox));
			explicitCol.AddAttribute (explicitRenderer, "active", colExplicitIndex);
			treeview.AppendColumn (explicitCol);

			store.SetSortColumnId (colNameIndex, SortType.Ascending);
			treeview.Model = store;

			buttonCancel.Clicked += OnCancelClicked;
			buttonOk.Clicked += OnOKClicked;
			buttonSelectAll.Clicked += delegate { SelectAll (true); };
			buttonUnselectAll.Clicked += delegate { SelectAll (false); };

			refactorer = IdeApp.Workspace.GetCodeRefactorer (IdeApp.ProjectOperations.CurrentSelectedSolution);
			ambience = AmbienceService.GetAmbienceForFile (cls.CompilationUnit.FileName);
			PopulateTreeView ();
			UpdateOKButton ();
		}
		public override bool DrawBackground (TextEditor editor, Cairo.Context cr, double y, LineMetrics metrics)
		{
			// check, if a message bubble is active in that line.
			if (LineSegment != null && LineSegment.Markers.Any (m => m != this && (m is IExtendingTextLineMarker)))
				return false;

			return base.DrawBackground (editor, cr, y, metrics);
		}
Exemple #31
0
        public static IEnumerable <string> GetAllSqfIdents(this TextEditor editor, int minLength = 2)
        {
            var  doc                  = editor.Document;
            var  builder              = new StringBuilder();
            bool isString             = false;
            bool isInComment          = false;
            bool isInMultiLineComment = false;
            char stringchar           = '\0';

            for (int i = 0; i < doc.TextLength; i++)
            {
                if (i == editor.CaretOffset)
                {
                    builder.Clear();
                    continue;
                }
                var c = doc.GetCharAt(i);
                if (isInMultiLineComment)
                {
                    if (c == '*' && doc.GetCharAt(i + 1) == '/')
                    {
                        isInMultiLineComment = false;
                    }
                }
                else if (isInComment)
                {
                    if (c == '\n')
                    {
                        isInComment = false;
                    }
                }
                else if (isString)
                {
                    if (c == stringchar)
                    {
                        isString = false;
                    }
                }
                else if ((builder.Length == 0 ? char.IsLetter(c) : char.IsLetterOrDigit(c)) || c == '_')
                {
                    builder.Append(c);
                }
                else if (c == '"' || c == '\'')
                {
                    stringchar = c;
                    isString   = true;
                }
                else if (c == '/' && doc.GetCharAt(i + 1) == '*')
                {
                    isInMultiLineComment = true;
                }
                else if (c == '/' && doc.GetCharAt(i + 1) == '/')
                {
                    isInComment = true;
                }
                else
                {
                    if (builder.Length >= minLength)
                    {
                        yield return(builder.ToString());
                    }
                    builder.Clear();
                }
            }
        }
Exemple #32
0
    void OnGUIScene(VRCSDK2.VRC_SceneDescriptor scene)
    {
        string lastUrl          = VRC_SdkBuilder.GetLastUrl();
        bool   lastBuildPresent = lastUrl != null;

        string worldVersion = "-1";

        PipelineManager[] pms = (PipelineManager[])VRC.Tools.FindSceneObjectsOfTypeAll <PipelineManager>();
        if (pms.Length == 1)
        {
            if (scene.apiWorld == null)
            {
                scene.apiWorld = new ApiWorld();
                ApiWorld.Fetch(pms[0].blueprintId, false, delegate(ApiWorld world)
                {
                    scene.apiWorld = world;
                }, delegate(string error) { });
            }
            worldVersion = (scene.apiWorld as ApiWorld).version.ToString();
        }
        EditorGUILayout.LabelField("World Version: " + worldVersion);

        EditorGUILayout.Space();

        if (scene.useAssignedLayers)
        {
            if (!UpdateLayers.AreLayersSetup() && GUILayout.Button("Setup Layers"))
            {
                bool doIt = EditorUtility.DisplayDialog("Setup Layers for VRChat", "This adds all VRChat layers to your project and pushes any custom layers down the layer list. If you have custom layers assigned to gameObjects, you'll need to reassign them. Are you sure you want to continue?", "Do it!", "Don't do it");
                if (doIt)
                {
                    UpdateLayers.SetupEditorLayers();
                }
            }

            if (UpdateLayers.AreLayersSetup() && !UpdateLayers.IsCollisionLayerMatrixSetup() && GUILayout.Button("Setup Collision Layer Matrix"))
            {
                bool doIt = EditorUtility.DisplayDialog("Setup Collision Layer Matrix for VRChat", "This will setup the correct physics collisions in the PhysicsManager for VRChat layers. Are you sure you want to continue?", "Do it!", "Don't do it");
                if (doIt)
                {
                    UpdateLayers.SetupCollisionLayerMatrix();
                }
            }
        }

        scene.autoSpatializeAudioSources = EditorGUILayout.ToggleLeft("Apply 3D spatialization to AudioSources automatically at runtime (override settings by adding an ONSPAudioSource component to game object)", scene.autoSpatializeAudioSources);
        if (GUILayout.Button("Enable 3D spatialization on all 3D AudioSources in scene now"))
        {
            bool doIt = EditorUtility.DisplayDialog("Enable Spatialization", "This will add an ONSPAudioSource script to every 3D AudioSource in the current scene, and enable default settings for spatialization.  Are you sure you want to continue?", "Do it!", "Don't do it");
            if (doIt)
            {
                if (_EnableSpatialization != null)
                {
                    _EnableSpatialization();
                }
                else
                {
                    Debug.LogError("VrcSdkControlPanel: EnableSpatialization callback not found!");
                }
            }
        }

        GUI.enabled = (GUIErrors.Count == 0 && checkedForIssues);
        EditorGUILayout.Space();
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Test", EditorStyles.boldLabel);
        numClients = EditorGUILayout.IntField("Number of Clients", numClients);
        if (lastBuildPresent == false)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Last Build"))
        {
            VRC_SdkBuilder.shouldBuildUnityPackage = false;
            VRC_SdkBuilder.numClientsToLaunch      = numClients;
            VRC_SdkBuilder.RunLastExportedSceneResource();
        }
        if (APIUser.CurrentUser.developerType.HasValue && APIUser.CurrentUser.developerType.Value == APIUser.DeveloperType.Internal)
        {
            if (GUILayout.Button("Copy Test URL"))
            {
                TextEditor te = new TextEditor();
                te.text = lastUrl;
                te.SelectAll();
                te.Copy();
            }
        }
        if (lastBuildPresent == false)
        {
            GUI.enabled = true;
        }
        if (GUILayout.Button("New Build"))
        {
            EnvConfig.ConfigurePlayerSettings();
            VRC_SdkBuilder.shouldBuildUnityPackage = false;
            VRC.AssetExporter.CleanupUnityPackageExport();  // force unity package rebuild on next publish
            VRC_SdkBuilder.numClientsToLaunch = numClients;
            VRC_SdkBuilder.PreBuildBehaviourPackaging();
            VRC_SdkBuilder.ExportSceneResourceAndRun();
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.Space();
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Publish", EditorStyles.boldLabel);
        if (lastBuildPresent == false)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Last Build"))
        {
            VRC_SdkBuilder.shouldBuildUnityPackage = VRC.AccountEditorWindow.FutureProofPublishEnabled;
            VRC_SdkBuilder.UploadLastExportedSceneBlueprint();
        }
        if (lastBuildPresent == false)
        {
            GUI.enabled = true;
        }
        if (GUILayout.Button("New Build"))
        {
            EnvConfig.ConfigurePlayerSettings();
            VRC_SdkBuilder.shouldBuildUnityPackage = VRC.AccountEditorWindow.FutureProofPublishEnabled;
            VRC_SdkBuilder.PreBuildBehaviourPackaging();
            VRC_SdkBuilder.ExportAndUploadSceneBlueprint();
        }
        EditorGUILayout.EndVertical();
        GUI.enabled = true;
    }
Exemple #33
0
 private static TextArea GetTextArea(TextEditor editor)
 {
     return(editor == null ? null : editor.TextArea);
 }
Exemple #34
0
        public int GetLineFromVisualPosY(int visualPosY)
        {
            int index = TextEditor.GetCharIndexFromPosition(new Point(0, visualPosY));

            return(TextEditor.GetLineFromCharIndex(index));
        }
        public MainWindow()
        {
            InitializeComponent();

            _textEditor                 = this.FindControl <TextEditor>("Editor");
            _textEditor.Background      = Brushes.Transparent;
            _textEditor.ShowLineNumbers = true;
            _textEditor.ContextMenu     = new ContextMenu
            {
                Items = new List <MenuItem>
                {
                    new MenuItem {
                        Header = "Copy", InputGesture = new KeyGesture(Key.C, KeyModifiers.Control)
                    },
                    new MenuItem {
                        Header = "Paste", InputGesture = new KeyGesture(Key.V, KeyModifiers.Control)
                    },
                    new MenuItem {
                        Header = "Cut", InputGesture = new KeyGesture(Key.X, KeyModifiers.Control)
                    }
                }
            };
            _textEditor.TextArea.Background    = this.Background;
            _textEditor.TextArea.TextEntered  += textEditor_TextArea_TextEntered;
            _textEditor.TextArea.TextEntering += textEditor_TextArea_TextEntering;
            _textEditor.Options.ShowBoxForControlCharacters = true;
            _textEditor.TextArea.IndentationStrategy        = new Indentation.CSharp.CSharpIndentationStrategy(_textEditor.Options);
            _textEditor.TextArea.Caret.PositionChanged     += Caret_PositionChanged;
            _textEditor.TextArea.RightClickMovesCaret       = true;

            _addControlButton        = this.FindControl <Button>("addControlBtn");
            _addControlButton.Click += AddControlButton_Click;

            _clearControlButton        = this.FindControl <Button>("clearControlBtn");
            _clearControlButton.Click += ClearControlButton_Click;;

            _changeThemeButton        = this.FindControl <Button>("changeThemeBtn");
            _changeThemeButton.Click += ChangeThemeButton_Click;

            _textEditor.TextArea.TextView.ElementGenerators.Add(_generator);

            _registryOptions = new RegistryOptions(
                (ThemeName)_currentTheme);

            _textMateInstallation = _textEditor.InstallTextMate(_registryOptions);

            Language csharpLanguage = _registryOptions.GetLanguageByExtension(".cs");

            _syntaxModeCombo                   = this.FindControl <ComboBox>("syntaxModeCombo");
            _syntaxModeCombo.Items             = _registryOptions.GetAvailableLanguages();
            _syntaxModeCombo.SelectedItem      = csharpLanguage;
            _syntaxModeCombo.SelectionChanged += SyntaxModeCombo_SelectionChanged;

            string scopeName = _registryOptions.GetScopeByLanguageId(csharpLanguage.Id);

            _textEditor.Document = new TextDocument(
                "// AvaloniaEdit supports displaying control chars: \a or \b or \v" + Environment.NewLine +
                ResourceLoader.LoadSampleFile(scopeName));
            _textMateInstallation.SetGrammar(_registryOptions.GetScopeByLanguageId(csharpLanguage.Id));

            _statusTextBlock = this.Find <TextBlock>("StatusText");

            this.AddHandler(PointerWheelChangedEvent, (o, i) =>
            {
                if (i.KeyModifiers != KeyModifiers.Control)
                {
                    return;
                }
                if (i.Delta.Y > 0)
                {
                    _textEditor.FontSize++;
                }
                else
                {
                    _textEditor.FontSize = _textEditor.FontSize > 1 ? _textEditor.FontSize - 1 : 1;
                }
            }, RoutingStrategies.Bubble, true);
        }
Exemple #36
0
    void OnGUI()
    {
        position = new Rect(position.x, position.y, 420, 340);

        switch (_tourStep)
        {
        case 0:
            GUILayout.Label("Thank you for downloading the GameAnalytics Unity3D wrapper", EditorStyles.whiteLargeLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("By using GameAnalytics you will be able to find out what type of players play your game, how they play, and lots more!", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("This Setup Wizard will help you set up GameAnalytics, and teach you how to track system events, crashes, custom events, etc. You will also learn how to use heatmaps to visualize your data!", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Jump to Setup:", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button(_stepOne))
            {
                _tourStep = 1;
            }
            if (GUILayout.Button(_stepTwo))
            {
                _tourStep = 2;
            }
            if (GUILayout.Button(_stepThree))
            {
                _tourStep = 3;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Jump to Tracking:", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button(_stepFour))
            {
                _tourStep = 4;
            }
            if (GUILayout.Button(_stepFive))
            {
                _tourStep = 5;
            }
            if (GUILayout.Button(_stepSix))
            {
                _tourStep = 6;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Jump to Heatmaps:", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button(_stepSeven))
            {
                _tourStep = 7;
            }
            if (GUILayout.Button(_stepEight))
            {
                _tourStep = 8;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Visit the online documentation:", EditorStyles.boldLabel);
            if (GUILayout.Button(_documentationLink, GUILayout.Width(150)))
            {
                Application.OpenURL("http://easy.gameanalytics.com/SupportDocu");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.Space(4);

            break;

        case 1:
            GUILayout.Label("Step 1: Create your GA account and game", EditorStyles.whiteLargeLabel);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("The first thing you should do is create a GameAnalytics account on the GA website. Open the site using the button below, create and verify your GA account, and then you will be able to both create a game studio and add games to it.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Once you have created your first game on the website you will have what you need to continue this tour. If you have already created a GA account and a game you should skip this step.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("GA account creation website:", EditorStyles.boldLabel);
            if (GUILayout.Button(_myHomePage, GUILayout.Width(150)))
            {
                Application.OpenURL("http://easy.gameanalytics.com/CreateGameAnalytics");
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(6);

            EditorGUILayout.HelpBox("The GA website lets you view all the data you have collected in a multitude of ways. Along with the Design, Quality, Business, and User views, which give you quick overviews of these aspects of your game, the GA site also features the Explore tool, Funnels and Cohorts.\n\nUsing the Explore tool you can visualize a ton of standard matrices, such as DAU (daily average users) or ARPU (average revenue per user), or custom matrices based on your own custom events.\nFunnels give you an overview of how users progress through a sequence of events you define, and Cohorts help you keep track of player retention.", MessageType.Info, true);

            GUILayout.Space(4);

            break;

        case 2:
            GUILayout.Label("Step 2: Setup GA settings", EditorStyles.whiteLargeLabel);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Now it's time to copy/paste your Game Key and Secret Key from the website to the fields below. These keys were generated when you created your game on the website. You can also find the keys under the game's settings from your home page.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Your keys are stored in the GA_Settings object, which also contains other useful settings - you can always find it under Window > GameAnalytics > Select GA_Settings.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("GA account home:", EditorStyles.boldLabel);
            if (GUILayout.Button(_myHomePage, GUILayout.Width(150)))
            {
                Application.OpenURL("http://easy.gameanalytics.com/LoginGA");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label(_publicKeyLabel, EditorStyles.boldLabel);
            GA.SettingsGA.GameKey = EditorGUILayout.TextField("", GA.SettingsGA.GameKey);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(_privateKeyLabel, EditorStyles.boldLabel);
            GA.SettingsGA.SecretKey = EditorGUILayout.TextField("", GA.SettingsGA.SecretKey);
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.HelpBox("Your Game Key uniquely identifies your game, so the Unity Package knows where to store your data. Your Secret Key is used for security as message authorization, and makes sure that no-one else gets a hold of your data!", MessageType.Info, true);

            GUILayout.Space(31);

            break;

        case 3:
            GUILayout.Label("Step 3: The GA_Status Window", EditorStyles.whiteLargeLabel);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("A quick tip before we start tracking tons of events; the GA_Status window shows whether the GameAnalytics Unity3D Package has been set up correctly. Both the Game Key and Secret Key must be set up to satisfy the GA_Status window. This window is accessible through Window > GameAnalytics > Open GA_Status.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("The GA_Status window also shows the status of messages sent to the server. You get an overview of the total number of messages sent successfully, and the total number of messages that failed. The GA_Status window also shows you the number of successful/failed messages for each message category.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("To make sure the GA Package is tracking the events you set up it might be a good idea to keep an eye on this window while you play your game. Remember that messages are clustered and sent to the server at certain intervals (you can set this interval on the GA_Settings object, under the Advanced tab).", EditorStyles.wordWrappedLabel);

            GUILayout.Space(46);

            break;

        case 4:
            GUILayout.Label("Step 4: The GA_SystemTracker Prefab (Optional)", EditorStyles.whiteLargeLabel);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("The rest of this tour is completely optional - if you got this far you are ready to track events. Now you just need to set up some events to track!", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("The GA_SystemTracker is useful for tracking system info, errors, performance, etc. To add it to a scene go to Window > GameAnalytics > Create GA_SystemTracker.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("You can add a GA_SystemTracker to each of the scenes you want to track, or you can add a GA_SystemTracker to your first scene. Enable \"Use For Subsequent Levels\", and it will work for any scene that follows.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("It can be very useful to track how many levels players complete, and their completion times. The GA_SystemTracker will help you do this.\n\nThe GA_SystemTracker is also useful for gathering information on your players' system hardware. When you combine this with tracking game performance (average and Critical FPS events), you can get an overview of which system specifications have trouble running your game.\n\nYou can also use the GA_SystemTracker to track exceptions. This feature can generate a lot of data, but it can also be a great way of discovering bugs.", MessageType.Info, true);
            GUILayout.Space(7);

            break;

        case 5:
            GUILayout.Label("Step 5: The GA_Tracker Component (Optional)", EditorStyles.whiteLargeLabel);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("The GA_Tracker component can be added to any game object in a scene from Window > GameAnalytics > Add GA_Tracker to Object. It allows you to easily set up auto-tracking of a bunch of simple, predefined events for that game object.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("The auto-tracked events available through the GA_Tracker component lets you set up some simple tracking for testing, etc. without having to code your own custom events.", MessageType.Info, true);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Using the GA_Tracker you can also enable Track Target for a game object. Some key events used by the GA_SystemTracker will use the location of the game object set up as Track Target - so only one GA_Tracker per scene can have Track Target enabled. Events include Submit Critical FPS, Submit Errors, and GA GUI events.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("You can put a GA_Tracker component on your player or camera object, and enable Track Target. This way you will know the location of the player when a Critical FPS event occurred - there is probably something causing bad performance in that area!", MessageType.Info, true);
            GUILayout.Space(18);

            break;

        case 6:
            GUILayout.Label("Step 6: Tracking your own custom events (Optional)", EditorStyles.whiteLargeLabel);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("It is of course possible to track your own custom events, such as when a player kills an enemy, picks up an item, or dies. Here are a few simple copy/paste code examples, but we recommend you check out the online documentation for a complete overview.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Design examples:", EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.SelectableLabel("GA.API.Design.NewEvent(\"Kill:Robot\", transform.position);", EditorStyles.textField, new GUILayoutOption[] { GUILayout.Height(19) });
            if (GUILayout.Button(_copyCode, GUILayout.MaxWidth(82)))
            {
                TextEditor te = new TextEditor();
                te.content = new GUIContent("GA.API.Design.NewEvent(\"Kill:Robot\", transform.position);");
                te.SelectAll();
                te.Copy();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField("Quality example:", EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.SelectableLabel("GA.API.Quality.NewEvent(\"System:os\");", EditorStyles.textField, new GUILayoutOption[] { GUILayout.Height(19) });
            if (GUILayout.Button(_copyCode, GUILayout.MaxWidth(82)))
            {
                TextEditor te = new TextEditor();
                te.content = new GUIContent("GA.API.Quality.NewEvent(\"System:os\");");
                te.SelectAll();
                te.Copy();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField("Business example:", EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.SelectableLabel("GA.API.Business.NewEvent(\"Buy:PlayerSkin\", \"USD\", 10);", EditorStyles.textField, new GUILayoutOption[] { GUILayout.Height(19) });
            if (GUILayout.Button(_copyCode, GUILayout.MaxWidth(82)))
            {
                TextEditor te = new TextEditor();
                te.content = new GUIContent("GA.API.Business.NewEvent(\"Buy:PlayerSkin\", \"USD\", 10);");
                te.SelectAll();
                te.Copy();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField("User example:", EditorStyles.boldLabel);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.SelectableLabel("GA.API.User.NewUser(GA_User.Gender.Male, 1976, 7);", EditorStyles.textField, new GUILayoutOption[] { GUILayout.Height(19) });
            if (GUILayout.Button(_copyCode, GUILayout.MaxWidth(82)))
            {
                TextEditor te = new TextEditor();
                te.content = new GUIContent("GA.API.User.NewUser(GA_User.Gender.Male, 1976, 7);");
                te.SelectAll();
                te.Copy();
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Visit the online documentation:", EditorStyles.boldLabel);
            if (GUILayout.Button(_documentationLink, GUILayout.Width(150)))
            {
                Application.OpenURL("http://easy.gameanalytics.com/SupportDocu");
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(7);

            break;

        case 7:
            GUILayout.Label("Step 7A: 3D Heatmap data visualization (Optional)", EditorStyles.whiteLargeLabel);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("In order to use the heatmap feature you must first copy/paste your API Key from the website to the field below. You can find the key under your game's settings from your home page. Your API key is stored in the GA_Settings object, under the Advanced tab.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("GA account home:", EditorStyles.boldLabel);
            if (GUILayout.Button(_myHomePage, GUILayout.Width(150)))
            {
                Application.OpenURL("http://easy.gameanalytics.com/LoginGA");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label(_apiKeyLabel, EditorStyles.boldLabel);
            GA.SettingsGA.ApiKey = EditorGUILayout.TextField("", GA.SettingsGA.ApiKey);
            GUILayout.EndHorizontal();

            GUILayout.Space(3);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("To add a heatmap object to a scene go to Window > GameAnalytics > Create GA_Heatmap. Heatmaps. This allows you to visualize the data you have collected inside Unity3D.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("To use the GA_Heatmap prefab you first have to get your data from the GA servers. To do this click the Update Index button. This will update the available builds, areas, and events. After you select the appropriate values, which correspond to the event you want to visualize, you simply click the Download Heatmap button. If any data is present for the combination of values you have selected, you should now see a heatmap in your scene.", EditorStyles.wordWrappedLabel);

            GUILayout.Space(11);

            break;

        case 8:
            GUILayout.Label("Step 7B: 3D Heatmap data histogram (Optional)", EditorStyles.whiteLargeLabel);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("3D heatmaps come with a histogram of the downloaded dataset, which provides an overview of the data, and allows you to filter and focus on a smaller subset using the slider below the histogram.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("All data collected for heatmaps is aggregated into a grid. Each column in the histogram represents a frequency of occurrence for the event in a grid point. The height of the column indicates the number of grid points with this frequency. The column furthest to the left represents the lowest frequency, i.e. the number of grid points where this event only occurred a few times. The column furthest to the right represents the highest frequency.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Histogram scale switches between a linear and logarithmic view of the histogram, making it easier for you to focus on exactly the data you want.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Transparent render model gives a better overview of clustered data, while solid varies the size of each data point depending on the value. The overlay option allows you to view the heatmap through any other scene objects.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Point radius sets the size of each heatmap data point, and Show values will display the values of each data point (this can be bad for performance).", EditorStyles.wordWrappedLabel);

            GUILayout.Space(11);

            break;

        case 9:
            EditorGUILayout.LabelField("That's it!", EditorStyles.whiteLargeLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Of course, this tour only covered the basics of the Unity3D Package. For a complete overview, as well as examples, please visit our online documentation.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("You might also want to check out the example game included with the GA Package. You can find the scene in the Examples folder.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Once again, thank you for choosing GameAnalytics, and please do not hesitate to use the Support feature on our website (found on left side of the screen when you are logged in) to submit any feedback, or ask any questions you might have.", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Happy tracking!", EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Visit your GA home page:", EditorStyles.boldLabel);
            if (GUILayout.Button(_myHomePage, GUILayout.Width(150)))
            {
                Application.OpenURL("http://easy.gameanalytics.com/LoginGA");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Visit the online documentation:", EditorStyles.boldLabel);
            if (GUILayout.Button(_documentationLink, GUILayout.Width(150)))
            {
                Application.OpenURL("http://easy.gameanalytics.com/SupportDocu");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Open GA example game scene:", EditorStyles.boldLabel);
            if (GUILayout.Button(_openExampleGame, GUILayout.Width(150)))
            {
                if (EditorApplication.SaveCurrentSceneIfUserWantsTo())
                {
                    EditorApplication.OpenScene("Assets/GameAnalytics/Plugins/Examples/ga_example.unity");
                    Close();
                }
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(11);

            break;
        }

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        if (_tourStep > 0 && GUILayout.Button(_backToStart))
        {
            _tourStep = 0;
        }
        if (_tourStep > 0 && GUILayout.Button(_prevTour))
        {
            _tourStep--;
            MoveToNewStepAction();
        }
        if ((_tourStep == 0 || _tourStep == _lastStep) && GUILayout.Button(_closeWizard))
        {
            Close();
        }
        if (_tourStep < _lastStep && GUILayout.Button(_nextTour))
        {
            _tourStep++;
            MoveToNewStepAction();
        }
        EditorGUILayout.EndHorizontal();
    }
Exemple #37
0
 public void FocusTextArea()
 {
     TextEditor.Select();
 }
Exemple #38
0
 public static CodeGenerationOptions CreateCodeGenerationOptions(TextEditor document, DocumentContext ctx)
 {
     return(new CodeGenerationOptions(document, ctx));
 }
        /// <summary>
        /// Don't use this unless you're implementing ICodeTemplateWidget. Use Insert instead.
        /// </summary>
        public TemplateResult InsertTemplateContents(TextEditor editor, DocumentContext context)
        {
            var data = editor;

            int offset = data.CaretOffset;
//			string leadingWhiteSpace = GetLeadingWhiteSpace (editor, editor.CursorLine);

            var templateCtx = new TemplateContext {
                Template        = this,
                DocumentContext = context,
                Editor          = editor,
                //ParsedDocument = context.ParsedDocument != null ? context.ParsedDocument.ParsedFile : null,
                InsertPosition = data.CaretLocation,
                LineIndent     = data.GetLineIndent(data.CaretLocation.Line),
                TemplateCode   = Code
            };

            if (data.IsSomethingSelected)
            {
                int start = data.SelectionRange.Offset;
                while (Char.IsWhiteSpace(data.GetCharAt(start)))
                {
                    start++;
                }
                int end = data.SelectionRange.EndOffset;
                while (Char.IsWhiteSpace(data.GetCharAt(end - 1)))
                {
                    end--;
                }
                templateCtx.LineIndent   = data.GetLineIndent(data.OffsetToLineNumber(start));
                templateCtx.SelectedText = RemoveIndent(data.GetTextBetween(start, end), templateCtx.LineIndent);
                data.RemoveText(start, end - start);
                offset = start;
            }
            else
            {
                string word = GetTemplateShortcutBeforeCaret(data).Trim();
                if (word.Length > 0)
                {
                    offset = DeleteTemplateShortcutBeforeCaret(data);
                }
            }

            TemplateResult template = FillVariables(templateCtx);

            template.InsertPosition = offset;
            editor.InsertText(offset, template.Code);

            int newoffset;

            if (template.CaretEndOffset >= 0)
            {
                newoffset = offset + template.CaretEndOffset;
            }
            else
            {
                newoffset = offset + template.Code.Length;
            }

            editor.CaretLocation = editor.OffsetToLocation(newoffset);

            var prettyPrinter = CodeFormatterService.GetFormatter(data.MimeType);

            if (prettyPrinter != null && prettyPrinter.SupportsOnTheFlyFormatting)
            {
                int endOffset  = template.InsertPosition + template.Code.Length;
                var oldVersion = data.Version;
                prettyPrinter.OnTheFlyFormat(editor, context, TextSegment.FromBounds(template.InsertPosition, editor.CaretOffset));
                if (editor.CaretOffset < endOffset)
                {
                    prettyPrinter.OnTheFlyFormat(editor, context, TextSegment.FromBounds(editor.CaretOffset, endOffset));
                }

                foreach (var textLink in template.TextLinks)
                {
                    for (int i = 0; i < textLink.Links.Count; i++)
                    {
                        var segment          = textLink.Links [i];
                        var translatedOffset = oldVersion.MoveOffsetTo(data.Version, template.InsertPosition + segment.Offset) - template.InsertPosition;
                        textLink.Links [i] = new TextSegment(translatedOffset, segment.Length);
                    }
                }
            }
            return(template);
        }
 public bool MousePressed(TextEditor editor, MarginMouseEventArgs args)
 {
     return(false);
 }
 public TestCompletionWidget(MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext documentContext)
 {
     this.editor          = editor;
     this.documentContext = documentContext;
 }
 public override void Draw(TextEditor editor, Cairo.Context g, double y, LineMetrics metrics)
 {
 }
        public override void DrawAfterEol(TextEditor textEditor, Cairo.Context g, double y, EndOfLineMetrics metrics)
        {
            if (!IsVisible)
            {
                return;
            }
            EnsureLayoutCreated(editor);
            int errorCounterWidth = 0, eh = 0;

            if (errorCountLayout != null)
            {
                errorCountLayout.GetPixelSize(out errorCounterWidth, out eh);
                errorCounterWidth = Math.Max(15, Math.Max(errorCounterWidth + 3, (int)(editor.LineHeight * 3 / 4)));
            }

            var  sx = metrics.TextRenderEndPosition;
            var  width = LayoutWidth + errorCounterWidth + editor.LineHeight;
            var  drawLayout = layouts[0].Layout;
            int  ex = 0, ey = 0;
            bool customLayout = sx + width > editor.Allocation.Width;
            bool hideText     = false;

            bubbleIsReduced = customLayout;
            if (customLayout)
            {
                width = editor.Allocation.Width - sx;
                string text = layouts[0].Layout.Text;
                drawLayout = new Pango.Layout(editor.PangoContext);
                drawLayout.FontDescription = cache.fontDescription;
                for (int j = text.Length - 4; j > 0; j--)
                {
                    drawLayout.SetText(text.Substring(0, j) + "...");
                    drawLayout.GetPixelSize(out ex, out ey);
                    if (ex + (errorCountLayout != null ? errorCounterWidth : 0) + editor.LineHeight < width)
                    {
                        break;
                    }
                }
                if (ex + (errorCountLayout != null ? errorCounterWidth : 0) + editor.LineHeight > width)
                {
                    hideText = true;
                    drawLayout.SetMarkup("<span weight='heavy'>···</span>");
                    width = Math.Max(17, errorCounterWidth) + editor.LineHeight;
                    sx    = Math.Min(sx, editor.Allocation.Width - width);
                }
            }
            bubbleDrawX = sx - editor.TextViewMargin.XOffset;
            bubbleDrawY = y;
            bubbleWidth = width;

            var bubbleHeight = editor.LineHeight - 1;

            g.RoundedRectangle(sx, y + 1, width, bubbleHeight, editor.LineHeight / 2 - 1);
            g.SetSourceColor(TagColor.Color);
            g.Fill();

            // Draw error count icon
            if (errorCounterWidth > 0 && errorCountLayout != null)
            {
                var errorCounterHeight = bubbleHeight - 2;
                var errorCounterX      = sx + width - errorCounterWidth - 3;
                var errorCounterY      = y + 1 + (bubbleHeight - errorCounterHeight) / 2;

                g.RoundedRectangle(
                    errorCounterX - 1,
                    errorCounterY - 1,
                    errorCounterWidth + 2,
                    errorCounterHeight + 2,
                    editor.LineHeight / 2 - 3
                    );

                g.SetSourceColor(new Cairo.Color(0, 0, 0, 0.081));
                g.Fill();

                g.RoundedRectangle(
                    errorCounterX,
                    errorCounterY,
                    errorCounterWidth,
                    errorCounterHeight,
                    editor.LineHeight / 2 - 3
                    );
                using (var lg = new Cairo.LinearGradient(errorCounterX, errorCounterY, errorCounterX, errorCounterY + errorCounterHeight)) {
                    lg.AddColorStop(0, CounterColor.Color);
                    lg.AddColorStop(1, CounterColor.Color.AddLight(-0.1));
                    g.Pattern = lg;
                    g.Fill();
                }

                g.Save();

                int ew;
                errorCountLayout.GetPixelSize(out ew, out eh);

                g.Translate(
                    errorCounterX + (errorCounterWidth - ew) / 2,
                    errorCounterY + (errorCounterHeight - eh) / 2
                    );
                g.SetSourceColor(CounterColor.SecondColor);
                g.ShowLayout(errorCountLayout);
                g.Restore();
            }

            // Draw label text
            if (errorCounterWidth <= 0 || errorCountLayout == null || !hideText)
            {
                g.Save();
                g.Translate(sx + editor.LineHeight / 2, y + (editor.LineHeight - layouts [0].Height) / 2 + 1);

                // draw shadow
                g.SetSourceColor(MessageBubbleCache.ShadowColor);
                g.ShowLayout(drawLayout);
                g.Translate(0, -1);

                g.SetSourceColor(TagColor.SecondColor);
                g.ShowLayout(drawLayout);
                g.Restore();
            }

            if (customLayout)
            {
                drawLayout.Dispose();
            }
        }
        public override bool DrawBackground(TextEditor editor, Cairo.Context g, double y, LineMetrics metrics)
        {
            if (!IsVisible)
            {
                return(false);
            }
            bool markerShouldDrawnAsHidden = cache.CurrentSelectedTextMarker != null && cache.CurrentSelectedTextMarker != this;

            if (metrics.LineSegment.Markers.Any(m => m is DebugTextMarker))
            {
                return(false);
            }

            EnsureLayoutCreated(editor);
            double x                 = editor.TextViewMargin.XOffset;
            int    right             = editor.Allocation.Width;
            bool   isCaretInLine     = metrics.TextStartOffset <= editor.Caret.Offset && editor.Caret.Offset <= metrics.TextEndOffset;
            int    errorCounterWidth = GetErrorCountBounds(metrics).Item1;

            double x2 = System.Math.Max(right - LayoutWidth - border - (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) - errorCounterWidth, editor.TextViewMargin.XOffset + editor.LineHeight / 2);

            bool isEolSelected = editor.IsSomethingSelected && editor.SelectionMode != Mono.TextEditor.SelectionMode.Block ? editor.SelectionRange.Contains(lineSegment.Offset + lineSegment.Length) : false;

            int  active      = editor.Document.GetTextAt(lineSegment) == initialText ? 0 : 1;
            bool highlighted = active == 0 && isCaretInLine;

            // draw background
            if (!markerShouldDrawnAsHidden)
            {
                DrawRectangle(g, x, y, right, editor.LineHeight);
                g.SetSourceColor(LineColor.Color);
                g.Fill();

                if (metrics.Layout.StartSet || metrics.SelectionStart == metrics.TextEndOffset)
                {
                    double startX;
                    double endX;

                    if (metrics.SelectionStart != metrics.TextEndOffset)
                    {
                        var start = metrics.Layout.Layout.IndexToPos((int)metrics.Layout.SelectionStartIndex);
                        startX = (int)(start.X / Pango.Scale.PangoScale);
                        var end = metrics.Layout.Layout.IndexToPos((int)metrics.Layout.SelectionEndIndex);
                        endX = (int)(end.X / Pango.Scale.PangoScale);
                    }
                    else
                    {
                        startX = x2;
                        endX   = startX;
                    }

                    if (editor.MainSelection.SelectionMode == Mono.TextEditor.SelectionMode.Block && startX == endX)
                    {
                        endX = startX + 2;
                    }
                    startX += metrics.TextRenderStartPosition;
                    endX   += metrics.TextRenderStartPosition;
                    startX  = Math.Max(editor.TextViewMargin.XOffset, startX);
                    // clip region to textviewmargin start
                    if (isEolSelected)
                    {
                        endX = editor.Allocation.Width + (int)editor.HAdjustment.Value;
                    }
                    if (startX < endX)
                    {
                        DrawRectangle(g, startX, y, endX - startX, editor.LineHeight);
                        g.SetSourceColor(GetLineColor(highlighted, true));
                        g.Fill();
                    }
                }
                DrawErrorMarkers(editor, g, metrics, y);
            }

            double y2         = y + 0.5;
            double y2Bottom   = y2 + editor.LineHeight - 1;
            var    selected   = isEolSelected;
            var    lineTextPx = editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition + metrics.Layout.Width;

            if (x2 < lineTextPx)
            {
                x2 = lineTextPx;
            }

            if (editor.Options.ShowRuler)
            {
                double divider = Math.Max(editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
                if (divider >= x2)
                {
                    g.MoveTo(new Cairo.PointD(divider + 0.5, y2));
                    g.LineTo(new Cairo.PointD(divider + 0.5, y2Bottom));
                    g.SetSourceColor(GetLineColorBorder(highlighted, selected));
                    g.Stroke();
                }
            }

            return(true);
        }
Exemple #45
0
        public override void OnUI(bool selected)
        {
            BeginUI();

            MoveToTop();
            Move(1, 1);
            MovePixels(1, 1);
            Background(5, 5.55f, 0.5f);

            #region Course Info
            Label("| Info", 3.5f);

            Move(3, 0);
            if (GUI.Button(GetOffsetRect(4, 1), MainToolUI.CommunityMode ? "[Community]" : "[Commerical]", GUI.skin.label))
            {
                count++;
                if (count == 7)
                {
                    count = 0;

                    TextEditor text = new TextEditor();
                    text.Paste();
                    EditorPrefs.SetString("Course Forge/CommunityMode", text.content.text);
                }
            }
            Move(-3, 0);

            Move(0, 0.5f);
            MovePixels(0, 1);
            Background(5, 5.05f, 0.75f);
            {
                Label("  Author", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.author = TextField(CourseBase.Info.author, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Course Name", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.name = TextField(CourseBase.Info.name, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            #endregion

            MoveToTop();
            Move(5, 1);
            MovePixels(1, 1);
            Background(5, 5.55f, 0.5f);

            #region Apperance
            Label("| Course Images", 2.5f);
            Move(0, 0.5f);
            MovePixels(0, 1);
            Background(5, 2.5f, 0.75f);
            {
                Label("  Splash", 2.5f);
                Move(2.5f, 0);
                Label("Cameo", 2.5f);
                Move(-2.5f, 0);
                Move(0, 0.3f);

                Move(0.2f, 0);
                CourseBase.Info.Splash = ObjectField(CourseBase.Info.Splash, 2.3f, 2.3f);
                Move(2.3f, 0);
                CourseBase.Info.Cameo = ObjectField(CourseBase.Info.Cameo, 2.3f, 2.3f);
                Move(-2.5f, 0);
                Move(0, 2.1f);
            }
            #endregion

            #region Location
            Label("| Location", 3.5f);
            Move(0, 0.5f);
            MovePixels(1, 1);
            Background(5, 2.15f, 0.75f);
            {
                Label("  Geo X/West", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.geoX = FloatField(CourseBase.Info.geoX, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Geo Y/North", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.geoY = FloatField(CourseBase.Info.geoY, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Geo Z/Height", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.geoZ = FloatField(CourseBase.Info.geoZ, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("  UTM Zone", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.utmZone = IntField(CourseBase.Info.utmZone, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Mesh", 2.5f);
                Move(2.2f, 0);
                CourseBase.Info.offset = FloatSlider(CourseBase.Info.offset, 0, 2.0f, 2.9f, 0.6f);
                Move(-2.2f, 0);
            }
            Move(0, 0.5f);
            MovePixels(-1, 0);
            #endregion

            MoveToTop();
            Move(5, 1);
            MovePixels(2, 1);
            Background(5, 7.8f, 0.5f);

            #region Tee Markers
            Label("| Tee Markers", 3.5f);
            Move(0, 0.5f);
            MovePixels(0, 1);
            Background(5, 8.5f, 0.75f);
            {
                Label("  Championship", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.championshipTeeMarker = ObjectField <GameObject>(CourseBase.Info.championshipTeeMarker, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Width", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.championshipWidth = FloatSlider(CourseBase.Info.championshipWidth, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Height", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.championshipHeight = FloatSlider(CourseBase.Info.championshipHeight, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Tournament", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.tournamentTeeMarker = ObjectField <GameObject>(CourseBase.Info.tournamentTeeMarker, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Width", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.tournamentWidth = FloatSlider(CourseBase.Info.tournamentWidth, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Height", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.tournamentHeight = FloatSlider(CourseBase.Info.tournamentHeight, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Back", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.backTeeMarker = ObjectField <GameObject>(CourseBase.Info.backTeeMarker, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Width", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.backWidth = FloatSlider(CourseBase.Info.backWidth, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Height", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.backHeight = FloatSlider(CourseBase.Info.backHeight, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Member", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.memberTeeMarker = ObjectField <GameObject>(CourseBase.Info.memberTeeMarker, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Width", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.memberWidth = FloatSlider(CourseBase.Info.memberWidth, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Height", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.memberHeight = FloatSlider(CourseBase.Info.memberHeight, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Forward", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.forwardTeeMarker = ObjectField <GameObject>(CourseBase.Info.forwardTeeMarker, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Width", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.forwardWidth = FloatSlider(CourseBase.Info.forwardWidth, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Height", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.forwardHeight = FloatSlider(CourseBase.Info.forwardHeight, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Ladies", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.ladiesTeeMarker = ObjectField <GameObject>(CourseBase.Info.ladiesTeeMarker, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Width", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.ladiesWidth = FloatSlider(CourseBase.Info.ladiesWidth, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Height", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.ladiesHeight = FloatSlider(CourseBase.Info.ladiesHeight, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("  Challenge", 2.5f);
                Move(2.5f, 0);
                CourseBase.Info.challengeTeeMarker = ObjectField <GameObject>(CourseBase.Info.challengeTeeMarker, 2.5f, 0.6f);
                Move(-2.5f, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Width", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.challengeWidth = FloatSlider(CourseBase.Info.challengeWidth, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            {
                Label("        Height", 2.5f);
                MovePixels(-3, 0);
                Move(2.5f, 0);
                CourseBase.Info.challengeHeight = FloatSlider(CourseBase.Info.challengeHeight, 0.0f, 10, 2.65f, 0.6f);
                Move(-2.5f, 0);
                MovePixels(3, 0);
            }
            Move(0, 0.4f);
            #endregion

            MoveToTop();
            MoveToLeft();
            Move(1, 1);
            Touch(10, 5.15f);
            Move(10, 1);
            Touch(5, 7.8f);

            EndUI();
        }
Exemple #46
0
 void CursorToEnd()
 {
     editor_state = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
     editor_state.MoveCursorToPosition(new Vector2(5555, 5555));
 }
 private void TextEditor_OnTextChanged(object sender, TextChangedEventArgs e)
 {
     TextEditor.InvalidateLayout();
 }
 // Token: 0x06003834 RID: 14388 RVA: 0x000FA972 File Offset: 0x000F8B72
 internal static void _OnApplyProperty(TextEditor This, DependencyProperty formattingProperty, object propertyValue, bool applyToParagraphs)
 {
     TextEditorCharacters._OnApplyProperty(This, formattingProperty, propertyValue, applyToParagraphs, PropertyValueAction.SetValue);
 }
Exemple #49
0
 void TextEditor_MouseDown(object sender, MouseEventArgs e)
 {
     OnSelectedLineChanged(TextEditor.GetLineFromCharIndex(TextEditor.GetCharIndexFromPosition(new Point(e.X, e.Y))));
 }
 // Token: 0x06003833 RID: 14387 RVA: 0x000FA966 File Offset: 0x000F8B66
 internal static void _OnApplyProperty(TextEditor This, DependencyProperty formattingProperty, object propertyValue)
 {
     TextEditorCharacters._OnApplyProperty(This, formattingProperty, propertyValue, false, PropertyValueAction.SetValue);
 }
Exemple #51
0
 public void GoToLine(int lineNumber)
 {
     TextEditor.SelectionStart  = FindLineStartPos(lineNumber);
     TextEditor.SelectionLength = 0;
     TextEditor.ScrollToCaret();
 }
        // Token: 0x06003844 RID: 14404 RVA: 0x000FB0A4 File Offset: 0x000F92A4
        private static void OnApplyInlineFlowDirectionLTR(object target, ExecutedRoutedEventArgs args)
        {
            TextEditor @this = TextEditor._GetTextEditor(target);

            TextEditorCharacters._OnApplyProperty(@this, Inline.FlowDirectionProperty, FlowDirection.LeftToRight);
        }
Exemple #53
0
        public void SetText(string text)
        {
            TextEditor.Clear();

            TextEditor.Text = text;
        }
Exemple #54
0
 public JSonIndentationTracker(TextEditor data, CacheIndentEngine stateTracker)
 {
     this.data         = data;
     this.stateTracker = stateTracker;
 }
Exemple #55
0
    bool OnGUIUserInfo()
    {
        bool updatedContent = false;

        if (!RemoteConfig.IsInitialized())
        {
            RemoteConfig.Init();
        }

        if (APIUser.IsLoggedInWithCredentials && uploadedWorlds != null && uploadedAvatars != null)
        {
            bool expandedLayout = false; // (position.width > MAX_ALL_INFORMATION_WIDTH);    // uncomment for future wide layouts

            if (!expandedLayout)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
            }

            GUILayout.BeginHorizontal();

            GUILayout.BeginVertical(searchBarStyle);

            EditorGUILayout.BeginHorizontal();

            float           searchFieldShrinkOffset = 30f;
            GUILayoutOption layoutOption            = (expandedLayout ? GUILayout.Width(position.width - searchFieldShrinkOffset) : GUILayout.Width(SdkWindowWidth - searchFieldShrinkOffset));
            searchString = EditorGUILayout.TextField(searchString, GUI.skin.FindStyle("SearchTextField"), layoutOption);
            GUIStyle searchButtonStyle = searchString == string.Empty
                ? GUI.skin.FindStyle("SearchCancelButtonEmpty")
                : GUI.skin.FindStyle("SearchCancelButton");
            if (GUILayout.Button(string.Empty, searchButtonStyle))
            {
                searchString = string.Empty;
                GUI.FocusControl(null);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            if (!expandedLayout)
            {
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
            }

            layoutOption     = (expandedLayout ? GUILayout.Width(position.width) : GUILayout.Width(SdkWindowWidth));
            contentScrollPos = EditorGUILayout.BeginScrollView(contentScrollPos, layoutOption);

            GUIStyle descriptionStyle = new GUIStyle(EditorStyles.wordWrappedLabel);
            descriptionStyle.wordWrap = true;

            if (uploadedWorlds.Count > 0)
            {
                EditorGUILayout.Space();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("WORLDS", EditorStyles.boldLabel, GUILayout.ExpandWidth(false), GUILayout.Width(58));
                WorldsToggle = EditorGUILayout.Foldout(WorldsToggle, new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();

                if (WorldsToggle)
                {
                    List <ApiWorld> tmpWorlds = new List <ApiWorld>();

                    if (uploadedWorlds.Count > 0)
                    {
                        tmpWorlds = new List <ApiWorld>(uploadedWorlds);
                    }

                    foreach (ApiWorld w in tmpWorlds)
                    {
                        if (justDeletedContents != null && justDeletedContents.Contains(w.id))
                        {
                            uploadedWorlds.Remove(w);
                            continue;
                        }

                        if (!w.name.ToLowerInvariant().Contains(searchString.ToLowerInvariant()))
                        {
                            continue;
                        }

                        EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                        EditorGUILayout.BeginHorizontal(GUILayout.Width(WORLD_IMAGE_BUTTON_WIDTH));

                        if (ImageCache.ContainsKey(w.id))
                        {
                            if (GUILayout.Button(ImageCache[w.id], GUILayout.Height(WORLD_IMAGE_BUTTON_HEIGHT),
                                                 GUILayout.Width(WORLD_IMAGE_BUTTON_WIDTH)))
                            {
                                Application.OpenURL(w.imageUrl);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("", GUILayout.Height(WORLD_IMAGE_BUTTON_HEIGHT),
                                                 GUILayout.Width(WORLD_IMAGE_BUTTON_WIDTH)))
                            {
                                Application.OpenURL(w.imageUrl);
                            }
                        }

                        if (expandedLayout)
                        {
                            EditorGUILayout.BeginHorizontal();
                            EditorGUILayout.LabelField(w.name, descriptionStyle,
                                                       GUILayout.Width(position.width - MAX_ALL_INFORMATION_WIDTH +
                                                                       WORLD_DESCRIPTION_FIELD_WIDTH));
                        }
                        else
                        {
                            EditorGUILayout.BeginVertical();
                            EditorGUILayout.LabelField(w.name, descriptionStyle);
                        }

                        EditorGUILayout.LabelField("Release Status: " + w.releaseStatus,
                                                   GUILayout.Width(WORLD_RELEASE_STATUS_FIELD_WIDTH));
                        if (GUILayout.Button("Copy ID", GUILayout.Width(COPY_WORLD_ID_BUTTON_WIDTH)))
                        {
                            TextEditor te = new TextEditor();
                            te.text = w.id;
                            te.SelectAll();
                            te.Copy();
                        }

                        if (GUILayout.Button("Delete", GUILayout.Width(DELETE_WORLD_BUTTON_WIDTH)))
                        {
                            if (EditorUtility.DisplayDialog("Delete " + w.name + "?",
                                                            "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete",
                                                            "Cancel"))
                            {
                                foreach (VRC.Core.PipelineManager pm in FindObjectsOfType <VRC.Core.PipelineManager>()
                                         .Where(pm => pm.blueprintId == w.id))
                                {
                                    pm.blueprintId          = "";
                                    pm.completedSDKPipeline = false;

                                    UnityEditor.EditorUtility.SetDirty(pm);
                                    UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(pm.gameObject.scene);
                                    UnityEditor.SceneManagement.EditorSceneManager.SaveScene(pm.gameObject.scene);
                                }

                                API.Delete <ApiWorld>(w.id);
                                uploadedWorlds.RemoveAll(world => world.id == w.id);
                                if (ImageCache.ContainsKey(w.id))
                                {
                                    ImageCache.Remove(w.id);
                                }

                                if (justDeletedContents == null)
                                {
                                    justDeletedContents = new List <string>();
                                }
                                justDeletedContents.Add(w.id);
                                updatedContent = true;
                            }
                        }

                        if (expandedLayout)
                        {
                            EditorGUILayout.EndHorizontal();
                        }
                        else
                        {
                            EditorGUILayout.EndVertical();
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                    }
                }
            }

            if (uploadedAvatars.Count > 0)
            {
                EditorGUILayout.Space();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("AVATARS", EditorStyles.boldLabel, GUILayout.ExpandWidth(false), GUILayout.Width(65));
                AvatarsToggle = EditorGUILayout.Foldout(AvatarsToggle, new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();

                if (AvatarsToggle)
                {
                    List <ApiAvatar> tmpAvatars = new List <ApiAvatar>();

                    if (uploadedAvatars.Count > 0)
                    {
                        tmpAvatars = new List <ApiAvatar>(uploadedAvatars);
                    }

                    if (justUpdatedAvatars != null)
                    {
                        foreach (ApiAvatar a in justUpdatedAvatars)
                        {
                            int index = tmpAvatars.FindIndex((av) => av.id == a.id);
                            if (index != -1)
                            {
                                tmpAvatars[index] = a;
                            }
                        }
                    }

                    foreach (ApiAvatar a in tmpAvatars)
                    {
                        if (justDeletedContents != null && justDeletedContents.Contains(a.id))
                        {
                            uploadedAvatars.Remove(a);
                            continue;
                        }

                        if (!a.name.ToLowerInvariant().Contains(searchString.ToLowerInvariant()))
                        {
                            continue;
                        }

                        EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                        EditorGUILayout.BeginHorizontal(GUILayout.Width(AVATAR_DESCRIPTION_FIELD_WIDTH));
                        if (ImageCache.ContainsKey(a.id))
                        {
                            if (GUILayout.Button(ImageCache[a.id], GUILayout.Height(AVATAR_IMAGE_BUTTON_HEIGHT),
                                                 GUILayout.Width(AVATAR_IMAGE_BUTTON_WIDTH)))
                            {
                                Application.OpenURL(a.imageUrl);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("", GUILayout.Height(AVATAR_IMAGE_BUTTON_HEIGHT),
                                                 GUILayout.Width(AVATAR_IMAGE_BUTTON_WIDTH)))
                            {
                                Application.OpenURL(a.imageUrl);
                            }
                        }

                        if (expandedLayout)
                        {
                            EditorGUILayout.BeginHorizontal();
                        }
                        else
                        {
                            EditorGUILayout.BeginVertical();
                        }

                        EditorGUILayout.LabelField(a.name, descriptionStyle,
                                                   GUILayout.Width(expandedLayout
                                ? position.width - MAX_ALL_INFORMATION_WIDTH + AVATAR_DESCRIPTION_FIELD_WIDTH
                                : AVATAR_DESCRIPTION_FIELD_WIDTH));
                        EditorGUILayout.LabelField("Release Status: " + a.releaseStatus,
                                                   GUILayout.Width(AVATAR_RELEASE_STATUS_FIELD_WIDTH));

                        string oppositeReleaseStatus = a.releaseStatus == "public" ? "private" : "public";
                        if (GUILayout.Button("Make " + oppositeReleaseStatus,
                                             GUILayout.Width(SET_AVATAR_STATUS_BUTTON_WIDTH)))
                        {
                            a.releaseStatus = oppositeReleaseStatus;

                            a.SaveReleaseStatus((c) =>
                            {
                                ApiAvatar savedBP = (ApiAvatar)c.Model;

                                if (justUpdatedAvatars == null)
                                {
                                    justUpdatedAvatars = new List <ApiAvatar>();
                                }
                                justUpdatedAvatars.Add(savedBP);
                            },
                                                (c) =>
                            {
                                Debug.LogError(c.Error);
                                EditorUtility.DisplayDialog("Avatar Updated",
                                                            "Failed to change avatar release status", "OK");
                            });
                        }

                        if (GUILayout.Button("Copy ID", GUILayout.Width(COPY_AVATAR_ID_BUTTON_WIDTH)))
                        {
                            TextEditor te = new TextEditor();
                            te.text = a.id;
                            te.SelectAll();
                            te.Copy();
                        }

                        if (GUILayout.Button("Delete", GUILayout.Width(DELETE_AVATAR_BUTTON_WIDTH)))
                        {
                            if (EditorUtility.DisplayDialog("Delete " + a.name + "?",
                                                            "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete",
                                                            "Cancel"))
                            {
                                foreach (VRC.Core.PipelineManager pm in FindObjectsOfType <VRC.Core.PipelineManager>()
                                         .Where(pm => pm.blueprintId == a.id))
                                {
                                    pm.blueprintId          = "";
                                    pm.completedSDKPipeline = false;

                                    UnityEditor.EditorUtility.SetDirty(pm);
                                    UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(pm.gameObject.scene);
                                    UnityEditor.SceneManagement.EditorSceneManager.SaveScene(pm.gameObject.scene);
                                }

                                API.Delete <ApiAvatar>(a.id);
                                uploadedAvatars.RemoveAll(avatar => avatar.id == a.id);
                                if (ImageCache.ContainsKey(a.id))
                                {
                                    ImageCache.Remove(a.id);
                                }

                                if (justDeletedContents == null)
                                {
                                    justDeletedContents = new List <string>();
                                }
                                justDeletedContents.Add(a.id);
                                updatedContent = true;
                            }
                        }

                        if (expandedLayout)
                        {
                            EditorGUILayout.EndHorizontal();
                        }
                        else
                        {
                            EditorGUILayout.EndVertical();
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                    }
                }
            }

            EditorGUILayout.EndScrollView();
            if (!expandedLayout)
            {
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
            if ((updatedContent) && (null != window))
            {
                window.Reset();
            }

            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemple #56
0
 public MidRiseCommand(TextEditor text)
 {
     Avalon = text;
     tooltip = "Middle rise tone";
 }
Exemple #57
0
 internal static void InformDocumentOpen(Microsoft.CodeAnalysis.DocumentId analysisDocument, TextEditor editor)
 {
     foreach (var w in workspaces)
     {
         if (w.Contains(analysisDocument.ProjectId))
         {
             w.InformDocumentOpen(analysisDocument, editor);
             return;
         }
     }
     if (!gotDocumentRequestError)
     {
         gotDocumentRequestError = true;
         LoggingService.LogWarning("Can't open requested document : " + analysisDocument + ":" + editor.FileName);
     }
 }
 public abstract bool CanHandle(TextEditor editor);
 public abstract bool Handle(TextEditor editor, DocumentContext ctx, KeyDescriptor descriptor);
Exemple #60
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUI.BeginDisabledGroup(isOperationRunning);

            // Unity project id.
            EditorGUILayout.LabelField(new GUIContent("Unity Project ID"));
            GUILayout.BeginVertical();
            GUILayout.Space(2);
            GUILayout.EndVertical();

            using (new EditorGUILayout.VerticalScope("OL Box", GUILayout.Height(AppStoreStyles.kUnityProjectIDBoxHeight)))
            {
                GUILayout.FlexibleSpace();

                string unityProjectID = Application.cloudProjectId;
                if (String.IsNullOrEmpty(unityProjectID))
                {
                    EditorGUILayout.LabelField(new GUIContent(AppStoreStyles.kNoUnityProjectIDErrorMessage));
                    GUILayout.FlexibleSpace();
                    return;
                }
                EditorGUILayout.LabelField(new GUIContent(Application.cloudProjectId));
                GUILayout.FlexibleSpace();
            }

            GUILayout.BeginVertical();
            GUILayout.Space(10);
            GUILayout.EndVertical();

            // Unity client settings.
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Unity Client Settings"));
            bool   clientNotExists   = String.IsNullOrEmpty(unityClientID.stringValue);
            string buttonLableString = "Generate Unity Client";
            string target            = STEP_GET_CLIENT;

            if (!clientNotExists)
            {
                if (String.IsNullOrEmpty(clientSecret_in_memory) || !AppStoreOnboardApi.loaded)
                {
                    buttonLableString = "Load Unity Client";
                }
                else
                {
                    buttonLableString = "Update Client Secret";
                    target            = STEP_UPDATE_CLIENT_SECRET;
                }
            }
            if (GUILayout.Button(buttonLableString, GUILayout.Width(AppStoreStyles.kUnityClientIDButtonWidth)))
            {
                isOperationRunning = true;
                Debug.Log(buttonLableString + "...");
                if (target == STEP_UPDATE_CLIENT_SECRET)
                {
                    clientSecret_in_memory = null;
                }
                callApiAsync(target);

                serializedObject.ApplyModifiedProperties();
                this.Repaint();
                AssetDatabase.SaveAssets();
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.BeginVertical();
            GUILayout.Space(2);
            GUILayout.EndVertical();

            using (new EditorGUILayout.VerticalScope("OL Box", GUILayout.Height(AppStoreStyles.kUnityClientBoxHeight)))
            {
                GUILayout.FlexibleSpace();
                EditorGUILayout.BeginHorizontal();
                if (String.IsNullOrEmpty(unityClientID.stringValue))
                {
                    EditorGUILayout.LabelField("Client ID", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                    EditorGUILayout.LabelField("None");
                }
                else
                {
                    EditorGUILayout.LabelField("Client ID", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                    EditorGUILayout.LabelField(strPrefix(unityClientID.stringValue), GUILayout.Width(AppStoreStyles.kClientLabelWidthShort));
                    if (GUILayout.Button("Copy to Clipboard", GUILayout.Height(AppStoreStyles.kClientLabelHeight)))
                    {
                        TextEditor te = new TextEditor();
                        te.text = unityClientID.stringValue;
                        te.SelectAll();
                        te.Copy();
                    }
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.FlexibleSpace();
                EditorGUILayout.BeginHorizontal();
                if (String.IsNullOrEmpty(unityClientKey.stringValue))
                {
                    EditorGUILayout.LabelField("Client Key", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                    EditorGUILayout.LabelField("None");
                }
                else
                {
                    EditorGUILayout.LabelField("Client Key", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                    EditorGUILayout.LabelField(strPrefix(unityClientKey.stringValue), GUILayout.Width(AppStoreStyles.kClientLabelWidthShort));
                    if (GUILayout.Button("Copy to Clipboard", GUILayout.Height(AppStoreStyles.kClientLabelHeight)))
                    {
                        TextEditor te = new TextEditor();
                        te.text = unityClientKey.stringValue;
                        te.SelectAll();
                        te.Copy();
                    }
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.FlexibleSpace();
                EditorGUILayout.BeginHorizontal();
                if (String.IsNullOrEmpty(unityClientRSAPublicKey.stringValue))
                {
                    EditorGUILayout.LabelField("Client RSA Public Key", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                    EditorGUILayout.LabelField("None");
                }
                else
                {
                    EditorGUILayout.LabelField("Client RSA Public Key", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                    EditorGUILayout.LabelField(strPrefix(unityClientRSAPublicKey.stringValue), GUILayout.Width(AppStoreStyles.kClientLabelWidthShort));
                    if (GUILayout.Button("Copy to Clipboard", GUILayout.Height(AppStoreStyles.kClientLabelHeight)))
                    {
                        TextEditor te = new TextEditor();
                        te.text = unityClientRSAPublicKey.stringValue;
                        te.SelectAll();
                        te.Copy();
                    }
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.FlexibleSpace();
                EditorGUILayout.BeginHorizontal();
                if (String.IsNullOrEmpty(clientSecret_in_memory))
                {
                    EditorGUILayout.LabelField("Client Secret", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                    EditorGUILayout.LabelField("None");
                }
                else
                {
                    EditorGUILayout.LabelField("Client Secret", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                    EditorGUILayout.LabelField(strPrefix(clientSecret_in_memory), GUILayout.Width(AppStoreStyles.kClientLabelWidthShort));
                    if (GUILayout.Button("Copy to Clipboard", GUILayout.Height(AppStoreStyles.kClientLabelHeight)))
                    {
                        TextEditor te = new TextEditor();
                        te.text = clientSecret_in_memory;
                        te.SelectAll();
                        te.Copy();
                    }
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal();
                GUILayout.Label("Callback URL", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                callbackUrl_in_memory = EditorGUILayout.TextField(String.IsNullOrEmpty(callbackUrl_in_memory)? "" : callbackUrl_in_memory);
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
            }

            GUILayout.BeginVertical();
            GUILayout.Space(10);
            GUILayout.EndVertical();

            // Xiaomi application settings.
            EditorGUILayout.LabelField(new GUIContent("Xiaomi App Settings"));

            GUILayout.BeginVertical();
            GUILayout.Space(2);
            GUILayout.EndVertical();

            using (new EditorGUILayout.VerticalScope("OL Box", GUILayout.Height(AppStoreStyles.kXiaomiBoxHeight)))
            {
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal();
                GUILayout.Label("App ID", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                EditorGUILayout.PropertyField(xiaomiAppID, GUIContent.none);
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal();
                GUILayout.Label("App Key", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                EditorGUILayout.PropertyField(xiaomiAppKey, GUIContent.none);
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal();
                GUILayout.Label("App Secret", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                if (appSecret_hidden)
                {
                    GUILayout.Label("App Secret is Hidden");
                }
                else
                {
                    appSecret_in_memory = EditorGUILayout.TextField(String.IsNullOrEmpty(appSecret_in_memory) ? "" : appSecret_in_memory);
                }
                string hiddenButtonLabel = appSecret_hidden ? "Show" : "Hide";
                if (GUILayout.Button(hiddenButtonLabel, GUILayout.Width(AppStoreStyles.kClientLabelWidthShort), GUILayout.Height(AppStoreStyles.kClientLabelHeightShort)))
                {
                    appSecret_hidden = !appSecret_hidden;
                }
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal();
                GUILayout.Label("Test Mode", GUILayout.Width(AppStoreStyles.kClientLabelWidth));
                EditorGUILayout.PropertyField(xiaomiIsTestMode, GUIContent.none);
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
            }

            GUILayout.BeginVertical();
            GUILayout.Space(10);
            GUILayout.EndVertical();

            // Save the settings.
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Save All Settings", GUILayout.Width(AppStoreStyles.kSaveButtonWidth)))
            {
                isOperationRunning = true;
                Debug.Log("Saving...");
                if (clientNotExists)
                {
                    Debug.LogError("Please get/generate Unity Client first.");
                }
                else
                {
                    if (callbackUrl_last != callbackUrl_in_memory ||
                        appId_last != xiaomiAppID.stringValue ||
                        appKey_last != xiaomiAppKey.stringValue ||
                        appSecret_last != appSecret_in_memory)
                    {
                        callApiAsync(STEP_UPDATE_CLIENT);
                    }
                    else
                    {
                        isOperationRunning = false;
                        Debug.Log("Unity Client Refreshed. Finished: " + STEP_UPDATE_CLIENT);
                    }
                }

                serializedObject.ApplyModifiedProperties();
                this.Repaint();
                AssetDatabase.SaveAssets();
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            serializedObject.ApplyModifiedProperties();
            this.Repaint();

            EditorGUI.EndDisabledGroup();
        }