Copy() public method

public Copy ( ) : void
return void
 internal static void CopyTextToClipboard(String CopyText)
 {
     TextEditor t = new TextEditor();
     t.content = new GUIContent(CopyText);
     t.SelectAll();
     t.Copy();
 }
 public void CopyToClipboard(string value)
 {
   TextEditor textEditor = new TextEditor();
   textEditor.text = value;
   textEditor.SelectAll();
   textEditor.Copy();
 }
Exemplo n.º 3
0
 public void OnGUI()
 {
     EditorGUILayout.LabelField(new GUIContent("Insert Thai message here."));
     EditorGUI.BeginChangeCheck();
     message = EditorGUILayout.TextArea(message);
     if (EditorGUI.EndChangeCheck())
     {
         if (!string.IsNullOrEmpty(message))
         {
             thaiMessage = ThaiFontAdjuster.Adjust(message);
         }
         else
         {
             thaiMessage = "";
         }
     }
     EditorGUILayout.LabelField(new GUIContent("Output."));
     EditorGUILayout.TextArea(thaiMessage);
     if (GUILayout.Button("Copy"))
     {
         UnityEngine.TextEditor t = new UnityEngine.TextEditor();
         t.text = thaiMessage;
         t.SelectAll();
         t.Copy();
     }
 }
Exemplo n.º 4
0
        /// <summary>
        ///     Draws a button that when clicked copies game and add-on details to the clipboard.
        /// </summary>
        private static void CopyToClipboardButton()
        {
            // Draw a GUI button.
            if (GUILayout.Button("Copy to Clipboard"))
            {
                // Create a text string and populate the first line with the game details.
                string copyText = "KSP: " + VersionObject.KspVersion + " - " +
                                  "Unity: " + Application.unityVersion + " - " +
                                  "OS: " + SystemInfo.operatingSystem;

                // Iterate over all the loaded add-ons.
                for (int i = 0; i < AddonLibrary.LoadedAddons.Count; ++i)
                {
                    Addon addon = AddonLibrary.LoadedAddons[i];
                    if (addon != null)
                    {
                        // Append the add-on details to the clipboard string.
                        copyText = copyText + Environment.NewLine + addon.Name + " - " + addon.LocalVersionString;
                    }
                }

                // Create a text editor for use with copying the copy text onto the clipboard.
                TextEditor textEditor = new TextEditor
                {
                    // Set the content of the text editor to the copy text.
                    content = new GUIContent(copyText)
                };

                // Copy text to the clipboard.
                textEditor.SelectAll();
                textEditor.Copy();
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Copies the string to the OS buffer.
 /// </summary>
 /// <param name="copyString">String to copy.</param>
 public static void CopyStringToBuffer(string copyString)
 {
     TextEditor te = new TextEditor();
     te.text = copyString;
     te.SelectAll();
     te.Copy();
 }
Exemplo n.º 6
0
 public void CopyToClipboard(string value)
 {
     TextEditor editor = new TextEditor {
         content = new GUIContent(value)
     };
     editor.SelectAll();
     editor.Copy();
 }
Exemplo n.º 7
0
 public void CopyToClipboard(string value)
 {
     TextEditor editor = new TextEditor {
         text = value
     };
     editor.SelectAll();
     editor.Copy();
 }
Exemplo n.º 8
0
    public static void PutTextToClipboard(string str)
    {
        var te = new UnityEngine.TextEditor();

        te.text = str;
        te.SelectAll();
        te.Copy();
    }
Exemplo n.º 9
0
        public static void SetText(string text)
        {
            if (string.IsNullOrEmpty(text)) return;

            var ed = new TextEditor();
            ed.content = new GUIContent(text);
            ed.SelectAll();
            ed.Copy();
        }
Exemplo n.º 10
0
        private void CopyText(string pText)
        {
            TextEditor editor = new TextEditor();

            editor.content = new GUIContent(pText);

            editor.SelectAll();
            editor.Copy();
        }
Exemplo n.º 11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="textField"></param>
 /// <param name="value"></param>
 public static void OnCopy(InputTextField textField, string value)
 {
     TextEditor te = new TextEditor();
     #if UNITY_5_3_OR_NEWER
     te.text = value;
     #else
     te.content = new GUIContent(value);
     #endif
     te.OnFocus();
     te.Copy();
 }
Exemplo n.º 12
0
 static void OnCopy(EventContext context)
 {
     TextEditor te = new TextEditor();
     #if (UNITY_5_3 || UNITY_5_4)
     te.text = (string)context.data;
     #else
     te.content = new GUIContent((string)context.data);
     #endif
     te.OnFocus();
     te.Copy();
 }
		public static void CopyTextToClipboard(string text)
		{
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBPLAYER
			var textEditor = new TextEditor {content = new GUIContent(text)};
			textEditor.SelectAll();
			textEditor.Copy();
#elif UNITY_IOS 
			_opencodingConsoleCopyToClipboard(text);
#elif UNITY_ANDROID
			AndroidJavaClass androidJavaClass = new AndroidJavaClass("net.opencoding.console.NativeMethods");
			androidJavaClass.CallStatic("copyToClipboard", text);
#else
			Debug.LogError("Copy and paste isn't supported on this platform currently. Please contact [email protected] and I'll do my best to support it!");
#endif
		}
Exemplo n.º 14
0
		/// <summary>Copies the given text onto the system clipboard.</summary>
		public static void Copy(string text){
			TextEditor editor=new TextEditor();
			editor.content.text=text;
			editor.SelectAll();
			editor.Copy();
		}
Exemplo n.º 15
0
        private void BlockInfo(int id)
        {
            BlockBehaviour bb = block.GetComponent<BlockBehaviour>();
            GUILayout.Label("Name: " + block.name);
            GUILayout.Label("ID: " + bb.GetBlockID());
            GUILayout.Label("GUID: " + bb.Guid);
            GUILayout.Space(25.0f);

            if (GUILayout.Button(new GUIContent("Copy to Clipboard", "Copies the GUID to the Clipboard")))
            {
                TextEditor te = new TextEditor {content = new GUIContent(bb.Guid.ToString())};
                te.SelectAll();
                te.Copy();
            }

            if (GUILayout.Button(new GUIContent("Close", "Closes the Block Info Window")))
            {
                _bInfo = false;
            }
            LastTooltip = GUI.tooltip;
            GUI.DragWindow();
        }
Exemplo n.º 16
0
 public void LatLonClipbardCopy()
 {
     if (GUILayout.Button("Copy Lat/Lon/Alt to Clipboard"))
     {
         TextEditor te = new TextEditor();
         string result = "latitude =  " + vesselState.latitude.ToString("F6") + "\nlongitude = " + vesselState.longitude.ToString("F6") +
                         "\naltitude = " + vessel.altitude.ToString("F2") + "\n";
         te.content = new GUIContent(result);
         te.SelectAll();
         te.Copy();
     }
 }
        private void DoWindow(int windowId)
        {
            var index = 0;

            GUI.Label(UIRectangle(index++), "Seed: ");
            _valuestore.Seed =  GUI.TextField(UIRectangle(index++), _valuestore.Seed);

            GUI.Label(UIRectangle(index++), "Plain scale: " + _valuestore.PlainScale);
            _valuestore.PlainScale = GUI.HorizontalSlider(UIRectangle(index++), _valuestore.PlainScale, 0.0005f, 1.0f);

            GUI.Label(UIRectangle(index++), "Max height: " + _valuestore.MaxHeight);
            _valuestore.MaxHeight = GUI.HorizontalSlider(UIRectangle(index++), _valuestore.MaxHeight, 0, 20);

            GUI.Label(UIRectangle(index++), "Max depth: " + _valuestore.MaxDepth);
            _valuestore.MaxDepth = GUI.HorizontalSlider(UIRectangle(index++),_valuestore.MaxDepth, 0, 20);

            GUI.Label(UIRectangle(index++), "Ditch ratio: " + _valuestore.DitchRatio);
            _valuestore.DitchRatio = GUI.HorizontalSlider(UIRectangle(index++), _valuestore.DitchRatio, 0, 1);

            GUI.Label(UIRectangle(index++), "Flood rounds: " + _valuestore.FloodRounds);
            _valuestore.FloodRounds = GUI.HorizontalSlider(UIRectangle(index++), _valuestore.FloodRounds, 0, 100);

            GUI.Label(UIRectangle(index++), "Entrance clearance: " + _valuestore.EntranceClearance);
            _valuestore.EntranceClearance = GUI.HorizontalSlider(UIRectangle(index++), _valuestore.EntranceClearance, 0, 50);

            _valuestore.GenerateTerrainType =  GUI.Toggle(UIRectangle(index++), _valuestore.GenerateTerrainType, "Generate Terrain Type");

            GUI.Label(UIRectangle(index++), "Terrain scale: " + _valuestore.TerrainScale);
            _valuestore.TerrainScale = GUI.HorizontalSlider(UIRectangle(index++), _valuestore.TerrainScale, 0.2f, 5.0f);

            GUI.Label(UIRectangle(index++), "Trees: " + _valuestore.TerrainScale);
            _valuestore.TreeCount =  GUI.HorizontalSlider(UIRectangle(index++), _valuestore.TreeCount, 0, 1000);

            if (GUI.Button(UIRectangle(index++), "Generate"))
            {
                _generator.Generate (_valuestore);
                _isWindowOpen = false;
            }
            if (GUI.Button(UIRectangle(index++), "Reset")) _generator.Reset();
            if (GUI.Button(UIRectangle(index++), "Cancel")) _isWindowOpen = false;

            _displayKey = GUI.TextField(UIRectangle(index++),_displayKey);
            if (_valuestore.hasValueStoreChange) {
                _displayKey = _valuestore.Serialize ();

            } else {
                try {
                    _valuestore.DeSerialize (_displayKey);
                } catch(Exception e) {
                    Debug.Log (e.Message);
                }
            }

            if (GUI.Button(UIRectangle(index++), "clipboard"))
            {
                TextEditor te = new TextEditor();
                te.content = new GUIContent(_displayKey);
                te.SelectAll();
                te.Copy();
            }
            if (GUI.Button(UIRectangle(index++), "Clear"))
            {
                _displayKey = "";

            }

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }
Exemplo n.º 18
0
// ReSharper disable UnusedMember.Local
        void OnGUI()
// ReSharper restore UnusedMember.Local
        {
            if (_doFocusOut)
            {
                _doFocusOut = false;
                GUIUtility.keyboardControl = 0;
            }

            EditorWindowContentWrapper.Start();

            if (null == PanelRenderer.ChromeStyle)
                PanelRenderer.ChromeStyle = StyleCache.Instance.PanelChromeSquared;

            PanelRenderer.RenderStart(GuiContentCache.Instance.PersistenceDebuggerPanelTitle, true);

            PanelContentWrapper.Start();

            if (PanelRenderer.ClickedTools.Count > 0)
            {
                if (PanelRenderer.ClickedTools.Contains("options"))
                {
                    PanelRenderer.ClickedTools.Remove("options");
                }
                ShowHelp = PanelRenderer.ClickedTools.Contains("help");
            }
            else
            {
                ShowHelp = false;
            }

            if (ShowHelp)
            {
                EditorGUILayout.HelpBox(Help.PersistenceDebugWindow, MessageType.Info, true);
            }

            EditorGUILayout.BeginHorizontal(StyleCache.Instance.Toolbar, GUILayout.Height(35));

            #region Refresh

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.Refresh, StyleCache.Instance.Button,
                GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                GUIUtility.keyboardControl = 0;
                ProcessInfo();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Abandon chages

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.AbandonChanges, StyleCache.Instance.Button,
                GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                PersistenceManager.Instance.AbandonChanges();
                HierarchyChangeProcessor.Instance.Reset();
                ProcessInfo();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Copy

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.CopyToClipboard, StyleCache.Instance.Button,
                GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                GUIUtility.keyboardControl = 0;
                TextEditor te = new TextEditor {content = new GUIContent(_text)};
                te.SelectAll();
                te.Copy();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            GUILayout.FlexibleSpace();

            #region Auto-update

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            bool oldAutoUpdate = GUILayout.Toggle(EditorSettings.PersistenceWindowAutoUpdate,
                EditorSettings.PersistenceWindowAutoUpdate ? GuiContentCache.Instance.AutoUpdateOn : GuiContentCache.Instance.AutoUpdateOff, 
                StyleCache.Instance.Toggle,
                GUILayout.ExpandWidth(false), GUILayout.Height(30));

            if (EditorSettings.PersistenceWindowAutoUpdate != oldAutoUpdate)
            {
                GUIUtility.keyboardControl = 0;
                EditorSettings.PersistenceWindowAutoUpdate = oldAutoUpdate;
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Write to log

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            bool oldWriteToLog = GUILayout.Toggle(EditorSettings.PersistenceWindowWriteToLog,
                GuiContentCache.Instance.WriteToLog, StyleCache.Instance.GreenToggle,
                GUILayout.ExpandWidth(false), GUILayout.Height(30));

            if (EditorSettings.PersistenceWindowWriteToLog != oldWriteToLog)
            {
                GUIUtility.keyboardControl = 0;
                EditorSettings.PersistenceWindowWriteToLog = oldWriteToLog;
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion
            
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(1);

            _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            //GUILayout.Label(_text, StyleCache.Instance.NormalLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            GUI.SetNextControlName(TextAreaControlName);
            _textToDisplay = EditorGUILayout.TextArea(_textToDisplay, StyleCache.Instance.RichTextLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            bool isInFocus = GUI.GetNameOfFocusedControl() == TextAreaControlName;
            _textToDisplay = isInFocus ? _text : _richText;
            
            GUILayout.EndScrollView();
            
            RenderStatus(
                EditorSettings.WatchChanges ? 
                    (EditorApplication.isPlaying ? "Monitoring..." : "Will monitor in play mode.") : 
                    "Not monitoring.", 
                EditorSettings.WatchChanges && EditorApplication.isPlaying
            );

            PanelContentWrapper.End();

            PanelRenderer.RenderEnd();

            //GUILayout.Space(3);
            EditorWindowContentWrapper.End();
        }
Exemplo n.º 19
0
		private void Window (int id)
		{
			if (cfgWinData == false) {
				cfgWinData = true;
				newUseBlizzyToolbar = thisCI.configuration.useBlizzyToolbar;
				//newShowDrives = CI.configuration.showDrives;
				//newCkanExecPath = CI.configuration.ckanExecPath;
				craftURL = "";
				m_textPath = "";
				saveInSandbox = false;
				overwriteExisting = false;
				m_textPath = thisCI.configuration.lastImportDir;
				//		#if EXPORT
				//		for (int i = 0; i < actionGroups.Length; i++)
				//			actionGroups [i] = "";
				//		lastSelectedCraft = -1;
				//		#endif

//				byte[] colorPickerFileData = System.IO.File.ReadAllBytes (FileOperations.ROOT_PATH + "GameData/CraftImport/Textures/colorpicker_texture.jpg");

				byte[] colorPickerFileData = System.IO.File.ReadAllBytes (FileOperations.ROOT_PATH + "GameData/" + CI.TEXTURE_DIR + "/colorpicker_texture.jpg");
				colorPicker = new Texture2D (2, 2);
				colorPicker.LoadImage (colorPickerFileData); //..this will auto-resize the texture dimensions.

			} 

			SetVisible (true);
			GUI.enabled = true;

			GUILayout.BeginHorizontal ();
			GUILayout.EndHorizontal ();

			GUILayout.BeginVertical ();

			//	DrawTitle ("Craft Import");

			//Log.Info ("downloadState: " + downloadState.ToString ());
			switch (downloadState) {
#if EXPORT
			case downloadStateType.UPLOAD:
				uploadCase ();

				break;
			case downloadStateType.GET_DUP_CRAFT_LIST:
				getUpdateCraftList ();

				break;

			case downloadStateType.GET_THUMBNAIL:
				getThumbnailcase ();
				break;

			case downloadStateType.SELECT_DUP_CRAFT:
				selectDupCraftCase ();

				break;

			case downloadStateType.ACTIONGROUPS:
				GUILayout.BeginHorizontal ();
				GUILayout.Label ("Action Groups");
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();

				GUILayout.BeginHorizontal ();

				buildMenuScrollPosition = GUILayout.BeginScrollView (buildMenuScrollPosition, GUILayout.Width (WIDTH - 30), GUILayout.Height (HEIGHT * 2 / 3));
				GUILayout.BeginVertical ();


				for (int i = 0; i < 16; i++) {
					GUILayout.BeginHorizontal ();
					if (i < 10) {
						GUILayout.Label ((i + 1).ToString () + ":");
					} else {
						GUILayout.Label (fixedActions [i - 10]);
					}
					GUILayout.FlexibleSpace ();
					actionGroups [i] = GUILayout.TextField (actionGroups [i], GUILayout.MinWidth (50F), GUILayout.MaxWidth (300F));
					actionGroups [i] = actionGroups [i].Replace("\n", "").Replace("\r", "");
					GUILayout.EndHorizontal ();
				}
				GUILayout.EndVertical ();
				GUILayout.EndScrollView (); 
				GUILayout.EndHorizontal ();

				GUILayout.BeginHorizontal ();
				GUILayout.Label ("");
				GUILayout.EndHorizontal ();
				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				if (GUILayout.Button ("OK", GUILayout.Width (125.0f))) {
					
					downloadState = downloadStateType.UPLOAD;
				}
				GUILayout.FlexibleSpace ();

				GUILayout.EndHorizontal ();
				break;
#endif
				
			case downloadStateType.GUI:
				guiCase ();
				break;
#if EXPORT
			case downloadStateType.SHOW_WARNING:
				warningCase ();
				break;

//			case downloadStateType.FILESELECTION:
//				getFile ();
//				break;

			case downloadStateType.UPLOAD_IN_PROGRESS:
#endif
			case downloadStateType.IN_PROGRESS:
				Log.Info ("IN_PROGRESS");
				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				if (downloadState == downloadStateType.IN_PROGRESS)
					GUILayout.Label ("Download in progress");
				else
					GUILayout.Label ("Upload in progress");
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();

				GUILayout.BeginHorizontal ();
				GUILayout.Label ("");
				GUILayout.EndHorizontal ();

				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				if (downloadState == downloadStateType.IN_PROGRESS) {
					if (download != null)
						GUILayout.Label ("Progress: " + (100 * download.progress).ToString () + "%");
				}
				#if EXPORT
				else {
					if (Time.realtimeSinceStartup - lastUpdate > 1) {
						lastUpdate = Time.realtimeSinceStartup;
						uploadProgress++;
					}
					GUILayout.Label ("Upload progress: " + uploadProgress.ToString ());
				}
				#endif
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();

				GUILayout.BeginHorizontal ();
				GUILayout.Label ("");
				GUILayout.EndHorizontal ();

				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				if (GUILayout.Button ("Cancel", GUILayout.Width (125.0f))) {
					resetBeforeExit ();
				}
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();
				break;

				#if EXPORT
			case downloadStateType.UPLOAD_COMPLETED:
				#endif
			case downloadStateType.COMPLETED:
				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				if (downloadState == downloadStateType.COMPLETED)
					GUILayout.Label ("Download completed");
				else
					GUILayout.Label ("Upload completed");
				
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();
				GUILayout.BeginHorizontal ();
				GUILayout.Label ("", GUILayout.Height (10));
				GUILayout.EndHorizontal ();
				GUILayout.BeginHorizontal ();
				if (instructions.Trim () != "") {
					scrollPosition = GUILayout.BeginScrollView (
						scrollPosition, GUILayout.Width (WIDTH - 20), GUILayout.Height (HEIGHT - 100));
					GUILayout.Label (instructions);
					GUILayout.EndScrollView ();
				} else
					GUILayout.Label ("");
				GUILayout.EndHorizontal ();
				GUILayout.BeginHorizontal ();
				GUILayout.Label ("", GUILayout.Height (10));
				GUILayout.EndHorizontal ();
				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				if (GUILayout.Button ("OK", GUILayout.Width (125.0f))) {

					if (downloadState == downloadStateType.COMPLETED && loadAfterImport) {
						Log.Info ("saveFile: " + saveFile);
						if (!subassembly)
							EditorLogic.LoadShipFromFile (saveFile);
						else {
							if (EditorLogic.RootPart) 
								LoadCraftAsSubassembly (saveFile);
						//	ShipConstruct ship = ShipConstruction.LoadShip (craftURL);
						//	EditorLogic.SpawnConstruct (ship);
						}

					}
					resetBeforeExit ();
				}
				GUILayout.FlexibleSpace ();
				if (instructions != "") {
					if (GUILayout.Button ("Copy to clipboard")) {
						TextEditor te = new TextEditor ();
						te.text = instructions;
						te.SelectAll ();
						te.Copy ();
					}
					GUILayout.FlexibleSpace ();
				}
				GUILayout.EndHorizontal ();
				break;

			case downloadStateType.FILE_EXISTS:
				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				GUILayout.Label ("File Exists Error");
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();
				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				GUILayout.Label ("The craft file already exists, will NOT be overwritten");
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();
				GUILayout.BeginHorizontal ();
				if (GUILayout.Button ("OK", GUILayout.Width (125.0f))) {
					resetBeforeExit ();
				}
				GUILayout.EndHorizontal ();
				break;

				#if EXPORT
			case downloadStateType.UPLOAD_ERROR:
				#endif
			case downloadStateType.ERROR:
				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				if (downloadState == downloadStateType.ERROR)
					GUILayout.Label ("Download Error");
				else
					GUILayout.Label ("Upload Error");
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();
				GUILayout.BeginHorizontal ();
				GUILayout.FlexibleSpace ();
				#if EXPORT
				if (downloadState == downloadStateType.UPLOAD_ERROR)
					GUILayout.Label (uploadErrorMessage);
				else
				#endif
				GUILayout.Label (downloadErrorMessage);
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();
				GUILayout.BeginHorizontal ();
		#if EXPORT
				if (GUILayout.Button ("OK", GUILayout.Width (125.0f))) {
					downloadState = downloadStateType.UPLOAD;
				}
		#endif
				GUILayout.FlexibleSpace ();
				if (GUILayout.Button ("Cancel", GUILayout.Width (125.0f))) {
					resetBeforeExit ();
				}
				GUILayout.FlexibleSpace ();
				GUILayout.EndHorizontal ();
				break;

			default:
				break;
			}
			GUILayout.EndVertical ();
			GUI.DragWindow ();
		}
Exemplo n.º 20
0
        public void CopyButtonClicked()
        {
            SeedInputField.text = lastSeed.ToString();
            TextEditor te = new TextEditor();
            string copyText = string.Format(scriptTemplate,
                BoltCountSlider.value,
                DurationSlider.value,
                SeedInputField.text,
                lastStart.x, lastStart.y, lastStart.z,
                lastEnd.x, lastEnd.y, lastEnd.z,                
                GenerationsSlider.value,
                ChaosSlider.value,
                TrunkWidthSlider.value,
                GlowIntensitySlider.value,
                GlowWidthSlider.value,
                ForkednessSlider.value,
                FadePercentSlider.value,
                GrowthMultiplierSlider.value
            );

#if UNITY_4 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2

            // Unity Pre 5.3:
            te.content = new GUIContent(copyText);

#else

            te.text = copyText;

#endif

            te.SelectAll();
            te.Copy();
        }
        private void CopyToClipboard()
        {
            if (!GUILayout.Button("Copy to Clipboard"))
            {
                return;
            }

            var kspVersion = AddonInfo.ActualKspVersion.ToString();
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                if (IntPtr.Size == 8)
                {
                    kspVersion += " (Win64)";
                }
                else
                {
                    kspVersion += " (Win32)";
                }
            }
            else
            {
                kspVersion += " (" + Environment.OSVersion.Platform + ")";
            }

            var copyText = "KSP: " + kspVersion +
                           " - Unity: " + Application.unityVersion +
                           " - OS: " + SystemInfo.operatingSystem +
                           this.addonList;

            var textEditor = new TextEditor
            {
                content = new GUIContent(copyText)
            };
            textEditor.SelectAll();
            textEditor.Copy();
        }
        private void RenderDescription()
        {
            if (null == _type)
            {
                if (!string.IsNullOrEmpty(EditorSettings.ReferenceSelectedType))
                {
                    // get previously selected type

                    if (!GlobalTypeDictionary.Instance.ContainsKey(EditorSettings.ReferenceSelectedType)) {
                        Debug.LogError("Reference window: Unknown selected type: " + EditorSettings.ReferenceSelectedType);
                        EditorSettings.ReferenceSelectedType = null; // reset
                        return;
                    }

                    _type = GlobalTypeDictionary.Instance[EditorSettings.ReferenceSelectedType];
                    RefreshDescription();
                }
                else {
                    EditorSettings.ReferenceTabIndex = 0; // fallback to first tab
                    RefreshComponentList();
                }
            }

            _filterChanged = false;

            EditorGUILayout.BeginHorizontal(StyleCache.Instance.Toolbar, GUILayout.Height(35));
            
            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.Back, StyleCache.Instance.Button, GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                EditorSettings.ReferenceTabIndex = 0;
                _type = null;
                EditorSettings.ReferenceSelectedType = null;
                RefreshComponentList(); // just in case if application recompiled
            }
            
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.CopyToClipboard, StyleCache.Instance.Button, GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                GUI.FocusControl(SearchTextFocusId); // focus out the text area
                TextEditor te = new TextEditor { content = new GUIContent(_componentDescription) };
                te.SelectAll();
                te.Copy();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            GUILayout.FlexibleSpace(); // horizontal

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            EditorGUILayout.BeginHorizontal();

            #region Events

            _state = GUILayout.Toggle(_printEvents,
                new GUIContent(string.Empty,
                    _printEvents ? TextureCache.Instance.EventOn : TextureCache.Instance.EventOff,
                    _printEvents ? "Showing events" : "Hiding events"),
                StyleCache.Instance.ImageOnlyButton, GUILayout.Width(20));
            if (_state != _printEvents)
            {
                _filterChanged = true;
                _printEvents = _state;
            }

            #endregion

            #region Multicast delegates

            _state = GUILayout.Toggle(_printMulticastDelegates,
                new GUIContent(string.Empty,
                    _printMulticastDelegates ? TextureCache.Instance.MulticastDelegateOn : TextureCache.Instance.MulticastDelegateOff,
                    _printMulticastDelegates ? "Showing multicast delegates" : "Hiding multicast delegates"),
                StyleCache.Instance.ImageOnlyButton, GUILayout.Width(20));
            if (_state != _printMulticastDelegates)
            {
                _filterChanged = true;
                _printMulticastDelegates = _state;
            }

            #endregion

            #region Styles

            _state = GUILayout.Toggle(_printStyles,
                new GUIContent(string.Empty,
                    _printStyles ? TextureCache.Instance.StyleOn : TextureCache.Instance.StyleOff,
                    _printStyles ? "Showing styles" : "Hiding styles"),
                StyleCache.Instance.ImageOnlyButton, GUILayout.Width(20));
            if (_state != _printStyles)
            {
                _filterChanged = true;
                _printStyles = _state;
            }

            #endregion

            #region Skins

            _state = GUILayout.Toggle(_printSkins,
                new GUIContent(string.Empty, _printSkins ? TextureCache.Instance.SkinOn : TextureCache.Instance.SkinOff,
                    _printSkins ? "Showing skins" : "Hiding skins"),
                StyleCache.Instance.ImageOnlyButton, GUILayout.Width(20));
            if (_state != _printSkins)
            {
                _filterChanged = true;
                _printSkins = _state;
            }

            #endregion

            #region Skin parts

            _state = GUILayout.Toggle(_printSkinParts,
                new GUIContent(string.Empty,
                    _printSkinParts ? TextureCache.Instance.SkinPartOn : TextureCache.Instance.SkinPartOff,
                    _printSkinParts ? "Showing skin parts" : "Hiding skin parts"),
                StyleCache.Instance.ImageOnlyButton, GUILayout.Width(20));
            if (_state != _printSkinParts)
            {
                _filterChanged = true;
                _printSkinParts = _state;
            }

            #endregion

            #region Skin states

            _state = GUILayout.Toggle(_printSkinStates,
                new GUIContent(string.Empty,
                    _printSkinStates ? TextureCache.Instance.SkinStateOn : TextureCache.Instance.SkinStateOff,
                    _printSkinStates ? "Showing skin states" : "Hiding skin states"),
                StyleCache.Instance.ImageOnlyButton, GUILayout.Width(20));
            if (_state != _printSkinStates)
            {
                _filterChanged = true;
                _printSkinStates = _state;
            }

            #endregion

            #region Signals

            _state = GUILayout.Toggle(_printSignals,
                new GUIContent(string.Empty,
                    _printSignals ? TextureCache.Instance.SignalOn : TextureCache.Instance.SignalOff,
                    _printSignals ? "Showing signals" : "Hiding signals"),
                StyleCache.Instance.ImageOnlyButton, GUILayout.Width(20));
            if (_state != _printSignals)
            {
                _filterChanged = true;
                _printSignals = _state;
            }

            #endregion

            if (_filterChanged)
            {
                EditorSettings.ReferencePrintEvents = _printEvents;
                EditorSettings.ReferencePrintMulticastDelegates = _printMulticastDelegates;
                EditorSettings.ReferencePrintStyles = _printStyles;
                EditorSettings.ReferencePrintSkins = _printSkins;
                EditorSettings.ReferencePrintSkinParts = _printSkinParts;
                EditorSettings.ReferencePrintSkinStates = _printSkinStates;
                EditorSettings.ReferencePrintSignals = _printSignals;
                RefreshDescription();
            }

            EditorGUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();

            _scrollPosition2 = EditorGUILayout.BeginScrollView(_scrollPosition2, GUILayout.ExpandHeight(true));

            /* NOTE: It won't update with new text while focused!!!!! */
            EditorGUILayout.TextArea(_componentDescription, StyleCache.Instance.NormalLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            //GUILayout.Label(_componentDescription, StyleCache.Instance.NormalLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            
            EditorGUILayout.EndScrollView();
        }
Exemplo n.º 23
0
// ReSharper disable UnusedMember.Local
        void OnGUI()
// ReSharper restore UnusedMember.Local
        {
            if (_doFocusOut)
            {
                _doFocusOut = false;
                GUIUtility.keyboardControl = 0;
            }

            EditorWindowContentWrapper.Start();

            if (null == PanelRenderer.ChromeStyle)
                PanelRenderer.ChromeStyle = StyleCache.Instance.PanelChromeSquared;

            PanelRenderer.RenderStart(GuiContentCache.Instance.HierarchyDebuggerPanelTitle, true);

            PanelContentWrapper.Start();

            if (PanelRenderer.ClickedTools.Count > 0)
            {
                if (PanelRenderer.ClickedTools.Contains("options"))
                {
                    PanelRenderer.ClickedTools.Remove("options");
                }
                ShowHelp = PanelRenderer.ClickedTools.Contains("help");
            }
            else
            {
                ShowHelp = false;
            }

            if (ShowHelp)
            {
                EditorGUILayout.HelpBox(Help.HierarchyDebugWindow, MessageType.Info, true);
            }

            EditorGUILayout.BeginHorizontal(StyleCache.Instance.Toolbar, GUILayout.Height(35));

            #region Refresh

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.Refresh, StyleCache.Instance.Button,
                GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                GUIUtility.keyboardControl = 0;
                ProcessInfo();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Fix

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            /*bool oldEnabled = GUI.enabled;
            GUI.enabled = !Application.isPlaying;*/
            if (GUILayout.Button(GuiContentCache.Instance.FixHierarchy, StyleCache.Instance.GreenToggle,
                GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                var text =
                    @"eDriven will look for adapters present in the hierarchy but not listed in any of the order lists, and add them as list children.

It will also remove adapters not present in the hierarchy from all of the order lists.";

                if (EditorApplication.isPlaying)
                {
                    text += @"

Note: The play mode will be stopped in order to fix the hierarchy.";
                }

                text += @"

Are you sure you want to do this?";

                if (EditorUtility.DisplayDialog("Fix hierarchy?", text, "OK", "Cancel"))
                {
                    if (EditorApplication.isPlaying)
                    {
                        // 1. delay fixing to after the stop
                        EditorState.ShouldFixHierarchyAfterStop = true;
                        // 2. stop the play mode
                        EditorApplication.isPlaying = false;
                    }
                    else // fix immediatelly
                    {
                        FixHierarchy();
                    }
                }
            }
            /*GUI.enabled = oldEnabled;*/

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Copy

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.CopyToClipboard, StyleCache.Instance.Button,
                GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                GUIUtility.keyboardControl = 0;
                TextEditor te = new TextEditor {content = new GUIContent(_description)};
                te.SelectAll();
                te.Copy();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            GUILayout.FlexibleSpace();

            #region Auto-update

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            bool oldAutoUpdate = GUILayout.Toggle(EditorSettings.HierarchyWindowAutoUpdate,
                EditorSettings.HierarchyWindowAutoUpdate ? GuiContentCache.Instance.AutoUpdateOn : GuiContentCache.Instance.AutoUpdateOff,
                StyleCache.Instance.Toggle,
                GUILayout.ExpandWidth(false), GUILayout.Height(30));

            if (EditorSettings.HierarchyWindowAutoUpdate != oldAutoUpdate)
            {
                GUIUtility.keyboardControl = 0;
                EditorSettings.HierarchyWindowAutoUpdate = oldAutoUpdate;
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Write to log

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            bool oldWriteToLog = GUILayout.Toggle(EditorSettings.HierarchyWindowWriteToLog,
                GuiContentCache.Instance.WriteToLog, StyleCache.Instance.GreenToggle,
                GUILayout.ExpandWidth(false), GUILayout.Height(30));

            if (EditorSettings.HierarchyWindowWriteToLog != oldWriteToLog)
            {
                GUIUtility.keyboardControl = 0;
                EditorSettings.HierarchyWindowWriteToLog = oldWriteToLog;
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(1);

            _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            //GUILayout.Label(HierarchyState.Instance.State, StyleCache.Instance.NormalLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            //EditorGUILayout.TextArea("<color=#00ff00>miki</color>" + _description, StyleCache.Instance.RichTextLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            EditorGUILayout.TextArea(_descriptionRich, StyleCache.Instance.RichTextLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            GUILayout.EndScrollView();

            PanelContentWrapper.End();

            PanelRenderer.RenderEnd();

            //GUILayout.Space(3);
            EditorWindowContentWrapper.End();
        }