UnityEngine.GUILayout.EndHorizontal()

Here are the examples of the csharp api UnityEngine.GUILayout.EndHorizontal() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

906 Examples 7

19 View Source File : SteamVR_Settings.cs
License : MIT License
Project Creator : dag10

public void OnGUI()
	{
		var resourcePath = GetResourcePath();
		var logo = replacedetDatabase.LoadreplacedetAtPath<Texture2D>(resourcePath + "logo.png");
		var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box);
		if (logo)
			GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);

		EditorGUILayout.HelpBox("Recommended project settings for SteamVR:", MessageType.Warning);

		scrollPosition = GUILayout.BeginScrollView(scrollPosition);

		int numItems = 0;

		if (!EditorPrefs.HasKey(ignore + buildTarget) &&
			EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
		{
			++numItems;

			GUILayout.Label(buildTarget + string.Format(currentValue, EditorUserBuildSettings.activeBuildTarget));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_BuildTarget)))
			{
#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
				EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
#else
				EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
#endif
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + buildTarget, true);
			}

			GUILayout.EndHorizontal();
		}

#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
		if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
			PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
		{
			++numItems;

			GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.showUnitySplashScreen));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
			{
				PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
			}

			GUILayout.EndHorizontal();
		}
#else
		if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
			PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
		{
			++numItems;

			GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
			{
				PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
			}

			GUILayout.EndHorizontal();
		}
#endif
		if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
			PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
		{
			++numItems;

			GUILayout.Label(defaultIsFullScreen + string.Format(currentValue, PlayerSettings.defaultIsFullScreen));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_DefaultIsFullScreen)))
			{
				PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
			}

			GUILayout.EndHorizontal();
		}

		if (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
			(PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
			PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight))
		{
			++numItems;

			GUILayout.Label(defaultScreenSize + string.Format(" ({0}x{1})", PlayerSettings.defaultScreenWidth, PlayerSettings.defaultScreenHeight));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format("Use recommended ({0}x{1})", recommended_DefaultScreenWidth, recommended_DefaultScreenHeight)))
			{
				PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
				PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + defaultScreenSize, true);
			}

			GUILayout.EndHorizontal();
		}

		if (!EditorPrefs.HasKey(ignore + runInBackground) &&
			PlayerSettings.runInBackground != recommended_RunInBackground)
		{
			++numItems;

			GUILayout.Label(runInBackground + string.Format(currentValue, PlayerSettings.runInBackground));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_RunInBackground)))
			{
				PlayerSettings.runInBackground = recommended_RunInBackground;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + runInBackground, true);
			}

			GUILayout.EndHorizontal();
		}

		if (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
			PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
		{
			++numItems;

			GUILayout.Label(displayResolutionDialog + string.Format(currentValue, PlayerSettings.displayResolutionDialog));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_DisplayResolutionDialog)))
			{
				PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
			}

			GUILayout.EndHorizontal();
		}

		if (!EditorPrefs.HasKey(ignore + resizableWindow) &&
			PlayerSettings.resizableWindow != recommended_ResizableWindow)
		{
			++numItems;

			GUILayout.Label(resizableWindow + string.Format(currentValue, PlayerSettings.resizableWindow));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_ResizableWindow)))
			{
				PlayerSettings.resizableWindow = recommended_ResizableWindow;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + resizableWindow, true);
			}

			GUILayout.EndHorizontal();
		}

		if (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
			PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
		{
			++numItems;

			GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.d3d11FullscreenMode));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_FullscreenMode)))
			{
				PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + fullscreenMode, true);
			}

			GUILayout.EndHorizontal();
		}

		if (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
			PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
		{
			++numItems;

			GUILayout.Label(visibleInBackground + string.Format(currentValue, PlayerSettings.visibleInBackground));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_VisibleInBackground)))
			{
				PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + visibleInBackground, true);
			}

			GUILayout.EndHorizontal();
		}
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
		if (!EditorPrefs.HasKey(ignore + renderingPath) &&
			PlayerSettings.renderingPath != recommended_RenderPath)
		{
			++numItems;

			GUILayout.Label(renderingPath + string.Format(currentValue, PlayerSettings.renderingPath));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_RenderPath) + " - required for MSAA"))
			{
				PlayerSettings.renderingPath = recommended_RenderPath;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + renderingPath, true);
			}

			GUILayout.EndHorizontal();
		}
#endif
		if (!EditorPrefs.HasKey(ignore + colorSpace) &&
			PlayerSettings.colorSpace != recommended_ColorSpace)
		{
			++numItems;

			GUILayout.Label(colorSpace + string.Format(currentValue, PlayerSettings.colorSpace));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_ColorSpace) + " - requires reloading scene"))
			{
				PlayerSettings.colorSpace = recommended_ColorSpace;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + colorSpace, true);
			}

			GUILayout.EndHorizontal();
		}

		if (!EditorPrefs.HasKey(ignore + gpuSkinning) &&
			PlayerSettings.gpuSkinning != recommended_GpuSkinning)
		{
			++numItems;

			GUILayout.Label(gpuSkinning + string.Format(currentValue, PlayerSettings.gpuSkinning));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_GpuSkinning)))
			{
				PlayerSettings.gpuSkinning = recommended_GpuSkinning;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + gpuSkinning, true);
			}

			GUILayout.EndHorizontal();
		}

#if false
		if (!EditorPrefs.HasKey(ignore + singlePreplacedStereoRendering) &&
			PlayerSettings.singlePreplacedStereoRendering != recommended_SinglePreplacedStereoRendering)
		{
			++numItems;

			GUILayout.Label(singlePreplacedStereoRendering + string.Format(currentValue, PlayerSettings.singlePreplacedStereoRendering));

			GUILayout.BeginHorizontal();

			if (GUILayout.Button(string.Format(useRecommended, recommended_SinglePreplacedStereoRendering)))
			{
				PlayerSettings.singlePreplacedStereoRendering = recommended_SinglePreplacedStereoRendering;
			}

			GUILayout.FlexibleSpace();

			if (GUILayout.Button("Ignore"))
			{
				EditorPrefs.SetBool(ignore + singlePreplacedStereoRendering, true);
			}

			GUILayout.EndHorizontal();
		}
#endif

		GUILayout.BeginHorizontal();

		GUILayout.FlexibleSpace();

		if (GUILayout.Button("Clear All Ignores"))
		{
			EditorPrefs.DeleteKey(ignore + buildTarget);
			EditorPrefs.DeleteKey(ignore + showUnitySplashScreen);
			EditorPrefs.DeleteKey(ignore + defaultIsFullScreen);
			EditorPrefs.DeleteKey(ignore + defaultScreenSize);
			EditorPrefs.DeleteKey(ignore + runInBackground);
			EditorPrefs.DeleteKey(ignore + displayResolutionDialog);
			EditorPrefs.DeleteKey(ignore + resizableWindow);
			EditorPrefs.DeleteKey(ignore + fullscreenMode);
			EditorPrefs.DeleteKey(ignore + visibleInBackground);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
			EditorPrefs.DeleteKey(ignore + renderingPath);
#endif
			EditorPrefs.DeleteKey(ignore + colorSpace);
			EditorPrefs.DeleteKey(ignore + gpuSkinning);
#if false
			EditorPrefs.DeleteKey(ignore + singlePreplacedStereoRendering);
#endif
		}

		GUILayout.EndHorizontal();

		GUILayout.EndScrollView();

		GUILayout.FlexibleSpace();

		GUILayout.BeginHorizontal();

		if (numItems > 0)
		{
			if (GUILayout.Button("Accept All"))
			{
				// Only set those that have not been explicitly ignored.
				if (!EditorPrefs.HasKey(ignore + buildTarget))
#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
					EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
#else
					EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
#endif
				if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen))
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
					PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
#else
					PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
#endif
				if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen))
					PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
				if (!EditorPrefs.HasKey(ignore + defaultScreenSize))
				{
					PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
					PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
				}
				if (!EditorPrefs.HasKey(ignore + runInBackground))
					PlayerSettings.runInBackground = recommended_RunInBackground;
				if (!EditorPrefs.HasKey(ignore + displayResolutionDialog))
					PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
				if (!EditorPrefs.HasKey(ignore + resizableWindow))
					PlayerSettings.resizableWindow = recommended_ResizableWindow;
				if (!EditorPrefs.HasKey(ignore + fullscreenMode))
					PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
				if (!EditorPrefs.HasKey(ignore + visibleInBackground))
					PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
				if (!EditorPrefs.HasKey(ignore + renderingPath))
					PlayerSettings.renderingPath = recommended_RenderPath;
#endif
				if (!EditorPrefs.HasKey(ignore + colorSpace))
					PlayerSettings.colorSpace = recommended_ColorSpace;
				if (!EditorPrefs.HasKey(ignore + gpuSkinning))
					PlayerSettings.gpuSkinning = recommended_GpuSkinning;
#if false
				if (!EditorPrefs.HasKey(ignore + singlePreplacedStereoRendering))
					PlayerSettings.singlePreplacedStereoRendering = recommended_SinglePreplacedStereoRendering;
#endif

				EditorUtility.DisplayDialog("Accept All", "You made the right choice!", "Ok");

				Close();
			}

			if (GUILayout.Button("Ignore All"))
			{
				if (EditorUtility.DisplayDialog("Ignore All", "Are you sure?", "Yes, Ignore All", "Cancel"))
				{
					// Only ignore those that do not currently match our recommended settings.
					if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
						EditorPrefs.SetBool(ignore + buildTarget, true);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
					if (PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
#else
					if (PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
#endif
						EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
					if (PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
						EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
					if (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
						PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)
						EditorPrefs.SetBool(ignore + defaultScreenSize, true);
					if (PlayerSettings.runInBackground != recommended_RunInBackground)
						EditorPrefs.SetBool(ignore + runInBackground, true);
					if (PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
						EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
					if (PlayerSettings.resizableWindow != recommended_ResizableWindow)
						EditorPrefs.SetBool(ignore + resizableWindow, true);
					if (PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
						EditorPrefs.SetBool(ignore + fullscreenMode, true);
					if (PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
						EditorPrefs.SetBool(ignore + visibleInBackground, true);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
					if (PlayerSettings.renderingPath != recommended_RenderPath)
						EditorPrefs.SetBool(ignore + renderingPath, true);
#endif
					if (PlayerSettings.colorSpace != recommended_ColorSpace)
						EditorPrefs.SetBool(ignore + colorSpace, true);
					if (PlayerSettings.gpuSkinning != recommended_GpuSkinning)
						EditorPrefs.SetBool(ignore + gpuSkinning, true);
#if false
					if (PlayerSettings.singlePreplacedStereoRendering != recommended_SinglePreplacedStereoRendering)
						EditorPrefs.SetBool(ignore + singlePreplacedStereoRendering, true);
#endif

					Close();
				}
			}
		}
		else if (GUILayout.Button("Close"))
		{
			Close();
		}

		GUILayout.EndHorizontal();
	}

19 View Source File : SteamVR_Menu.cs
License : MIT License
Project Creator : dag10

void OnGUI()
	{
		if (overlay == null)
			return;

		var texture = overlay.texture as RenderTexture;

		var prevActive = RenderTexture.active;
		RenderTexture.active = texture;

		if (Event.current.type == EventType.Repaint)
			GL.Clear(false, true, Color.clear);

		var area = new Rect(0, 0, texture.width, texture.height);

		// Account for screen smaller than texture (since mouse position gets clamped)
		if (Screen.width < texture.width)
		{
			area.width = Screen.width;
			overlay.uvOffset.x = -(float)(texture.width - Screen.width) / (2 * texture.width);
		}
		if (Screen.height < texture.height)
		{
			area.height = Screen.height;
			overlay.uvOffset.y = (float)(texture.height - Screen.height) / (2 * texture.height);
		}

		GUILayout.BeginArea(area);

		if (background != null)
		{
			GUI.DrawTexture(new Rect(
				(area.width - background.width) / 2,
				(area.height - background.height) / 2,
				background.width, background.height), background);
		}

		GUILayout.BeginHorizontal();
		GUILayout.FlexibleSpace();
		GUILayout.BeginVertical();

		if (logo != null)
		{
			GUILayout.Space(area.height / 2 - logoHeight);
			GUILayout.Box(logo);
		}

		GUILayout.Space(menuOffset);

		bool bHideMenu = GUILayout.Button("[Esc] - Close menu");

		GUILayout.BeginHorizontal();
		GUILayout.Label(string.Format("Scale: {0:N4}", scale));
		{
			var result = GUILayout.HorizontalSlider(scale, scaleLimits.x, scaleLimits.y);
			if (result != scale)
			{
				SetScale(result);
			}
		}
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Label(string.Format("Scale limits:"));
		{
			var result = GUILayout.TextField(scaleLimitX);
			if (result != scaleLimitX)
			{
				if (float.TryParse(result, out scaleLimits.x))
					scaleLimitX = result;
			}
		}
		{
			var result = GUILayout.TextField(scaleLimitY);
			if (result != scaleLimitY)
			{
				if (float.TryParse(result, out scaleLimits.y))
					scaleLimitY = result;
			}
		}
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		GUILayout.Label(string.Format("Scale rate:"));
		{
			var result = GUILayout.TextField(scaleRateText);
			if (result != scaleRateText)
			{
				if (float.TryParse(result, out scaleRate))
					scaleRateText = result;
			}
		}
		GUILayout.EndHorizontal();

		if (SteamVR.active)
		{
			var vr = SteamVR.instance;

			GUILayout.BeginHorizontal();
			{
				var t = SteamVR_Camera.sceneResolutionScale;
				int w = (int)(vr.sceneWidth * t);
				int h = (int)(vr.sceneHeight * t);
				int pct = (int)(100.0f * t);
				GUILayout.Label(string.Format("Scene quality: {0}x{1} ({2}%)", w, h, pct));
				var result = Mathf.RoundToInt(GUILayout.HorizontalSlider(pct, 50, 200));
				if (result != pct)
				{
					SteamVR_Camera.sceneResolutionScale = (float)result / 100.0f;
				}
			}
			GUILayout.EndHorizontal();
		}

		overlay.highquality = GUILayout.Toggle(overlay.highquality, "High quality");

		if (overlay.highquality)
		{
			overlay.curved = GUILayout.Toggle(overlay.curved, "Curved overlay");
			overlay.antialias = GUILayout.Toggle(overlay.antialias, "Overlay RGSS(2x2)");
		}
		else
		{
			overlay.curved = false;
			overlay.antialias = false;
		}

		var tracker = SteamVR_Render.Top();
		if (tracker != null)
		{
			tracker.wireframe = GUILayout.Toggle(tracker.wireframe, "Wireframe");

			var render = SteamVR_Render.instance;
			if (render.trackingSpace == ETrackingUniverseOrigin.TrackingUniverseSeated)
			{
				if (GUILayout.Button("Switch to Standing"))
					render.trackingSpace = ETrackingUniverseOrigin.TrackingUniverseStanding;
				if (GUILayout.Button("Center View"))
				{
					var system = OpenVR.System;
					if (system != null)
						system.ResetSeatedZeroPose();
				}
			}
			else
			{
				if (GUILayout.Button("Switch to Seated"))
					render.trackingSpace = ETrackingUniverseOrigin.TrackingUniverseSeated;
			}
		}

#if !UNITY_EDITOR
		if (GUILayout.Button("Exit"))
			Application.Quit();
#endif
		GUILayout.Space(menuOffset);

		var env = System.Environment.GetEnvironmentVariable("VR_OVERRIDE");
		if (env != null)
		{
			GUILayout.Label("VR_OVERRIDE=" + env);
		}

		GUILayout.Label("Graphics device: " + SystemInfo.graphicsDeviceVersion);

		GUILayout.EndVertical();
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		GUILayout.EndArea();

		if (cursor != null)
		{
			float x = Input.mousePosition.x, y = Screen.height - Input.mousePosition.y;
			float w = cursor.width, h = cursor.height;
			GUI.DrawTexture(new Rect(x, y, w, h), cursor);
		}

		RenderTexture.active = prevActive;

		if (bHideMenu)
			HideMenu();
	}

19 View Source File : Editor_HighLevelTaskEditor.cs
License : MIT License
Project Creator : Daimler

public override void OnInspectorGUI()
        {
            serializedObject.Update();
            var HLTE = Selection.activeGameObject.GetComponent<HighLevelTaskEditor>();
            if (HLTE == null)
                return;
            for (int i = 0; i < HLTE.stationsJson.Count; i++)
                if (HLTE.stationsJson[i].id == HLTE.stationID)
                    _stationID = i;

            EditorGUILayout.PropertyField(m_port, new GUIContent("Port"));
            EditorGUILayout.PropertyField(m_useProxy, new GUIContent("Use proxy"));

            if (m_useProxy.boolValue)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(m_useHttpsProxy, new GUIContent("Use HTTPS"));
                EditorGUILayout.PropertyField(m_proxyHttps, new GUIContent("Address"));
                EditorGUILayout.PropertyField(m_proxyPort, new GUIContent("Port"));
                EditorGUILayout.PropertyField(m_useProxyAuthenictation, new GUIContent("Use authentication"));
                if (m_useProxyAuthenictation.boolValue)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(m_proxyUser, new GUIContent("Username"));
                    HLTE.setProxyPreplacedword(EditorGUILayout.PreplacedwordField("Preplacedword", HLTE.getProxyPreplacedword()));
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }

            if (m_connectionEstablished.boolValue)
                EditorGUILayout.LabelField(new GUIContent("Status:  Connected"));
            else
                EditorGUILayout.LabelField(new GUIContent("Status:  Disconnected"));
            EditorGUILayout.PropertyField(m_taskEditorWWW, new GUIContent("API URL"));

            EditorGUILayout.PropertyField(m_accessToken, new GUIContent("Token"));
            if (m_connectionEstablished.boolValue && (HLTE.tasEditorProjectName != ""))
                EditorGUILayout.LabelField(new GUIContent("Project: " + HLTE.tasEditorProjectName));

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Reload tools and stations"))
            {
                HLTE.ReloadTools();
                HLTE.ReloadStations();
                UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
            }

            if ((HLTE.accessToken != "") && (HLTE.taskEditorWWW != "") && (HLTE.connectionEstablished) && (!Application.isPlaying))
                if (GUILayout.Button("Update parts"))
                {
                    var result2 = HLTE.syncGroupsAndStationsToTaskEditor();
                    var result4 = HLTE.syncMMIScenObjectsToTaskEditor();
                    var result5 = HLTE.syncAvatarsToTaskEditor();
                    var result = HLTE.sendDataToTaskEditor();
                    var result1 = HLTE.syncMarkersToTaskEditor();
                    var result3 = HLTE.UploadPictures();
                    UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
                }

            GUILayout.EndHorizontal();

            if (HLTE.PictureUploadProgress >= 0)
                PictureUploadProgressBar(HLTE.PictureUploadProgress, HLTE.FinishedPictureUploading);

            if (m_stationsLoaded.boolValue)
                EditorGUILayout.LabelField(new GUIContent("Stations:  Loaded"));
            else
                EditorGUILayout.LabelField(new GUIContent("Stations:  No connection"));
            if (m_tasksLoaded.boolValue)
                EditorGUILayout.LabelField(new GUIContent("Tasks:  Loaded"));
            else
                EditorGUILayout.LabelField(new GUIContent("Tasks:  No connection"));


            if (m_stationsLoaded.boolValue)
            {
                _stations = new List<string>();

                if (HLTE.stationsJson.Count == 0)
                    EditorGUILayout.LabelField(new GUIContent("Station:  No stations defined"));
                else
                {
                    for (int i = 0; i < HLTE.stationsJson.Count; i++)
                    {
                        _stations.Add(HLTE.stationsJson[i].station);
                    }
                    _stationID = EditorGUILayout.Popup("Station", _stationID, _stations.ToArray());
                    Undo.RecordObject(HLTE, "Update station id");
                    HLTE.stationID = HLTE.stationsJson[_stationID].id;
                    PrefabUtility.RecordPrefabInstancePropertyModifications(HLTE);
                    EditorGUILayout.LabelField(new GUIContent("Workers to simulate:"));
                    EditorGUI.indentLevel++;
                    for (int j = 0; j < HLTE.workersJson.Count; j++)
                        if (HLTE.workersJson[j].stationid==HLTE.stationID)
                            HLTE.workersJson[j].simulate=EditorGUILayout.Toggle(HLTE.workersJson[j].worker,HLTE.workersJson[j].simulate);
                    EditorGUI.indentLevel--;
                }
            }

            List<string> _avatars = new List<string>();
            if (HLTE.defaultAvatar>=HLTE.avatarJson.Count)
                HLTE.defaultAvatar=0;
            for (int i=0; i<HLTE.avatarJson.Count; i++)
                _avatars.Add(HLTE.avatarJson[i].avatar);
            HLTE.defaultAvatar = EditorGUILayout.Popup("Default avatar", HLTE.defaultAvatar, _avatars.ToArray());


            //EditorGUILayout.PropertyField(m_products, new GUIContent("Parts"));
            //EditorGUILayout.PropertyField(m_tools, new GUIContent("Tools"));
            //EditorGUILayout.PropertyField(m_mainCamera, new GUIContent("Main camera"));
            //EditorGUILayout.PropertyField(m_photoCamera, new GUIContent("Photo Camera"));
            //EditorGUILayout.PropertyField(m_target, new GUIContent("Target"));
            //EditorGUILayout.PropertyField(m_parts, new GUIContent("Sync Parts"));

            serializedObject.ApplyModifiedProperties();

            if ((b_useProxy != m_useProxy.boolValue) ||
                (b_useHttpsProxy != m_useHttpsProxy.boolValue) ||
                (b_useProxyAuthenictation != m_useProxyAuthenictation.boolValue) ||
                (b_proxyHttps != m_proxyHttps.stringValue) ||
                (b_proxyPort != m_proxyPort.stringValue) ||
                (b_proxyUser != m_proxyUser.stringValue))
                HLTE.saveProxySettings();

            b_useProxy = m_useProxy.boolValue;
            b_useHttpsProxy = m_useHttpsProxy.boolValue;
            b_useProxyAuthenictation = m_useProxyAuthenictation.boolValue;
            b_proxyHttps = m_proxyHttps.stringValue;
            b_proxyPort = m_proxyPort.stringValue;
            b_proxyUser = m_proxyUser.stringValue;
        }

19 View Source File : RunResults.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

public override void Render() {

			if(_showFileDeletedMessage) {

				if(DateTime.Now.Subtract(_fileDeletedTime).TotalSeconds > 2) {

					_showFileDeletedMessage = false;

				}

			}

			GUIStyle back = new GUIStyle(GUI.skin.button);
			back.fontSize = 20;
			back.margin = new RectOffset(25, 0, 10, 20);

			if(ReDrawAutomationReports) {

				ReDrawAutomationReports = false;

				if(!Directory.Exists(Path.GetDirectoryName(FileBroker.REPORTS_DIRECTORY))) {

					Directory.CreateDirectory(Path.GetDirectoryName(FileBroker.REPORTS_DIRECTORY));

				}

				//Grab any report files.
				List<string> all = Directory.GetFiles(FileBroker.REPORTS_DIRECTORY, "report.html", SearchOption.AllDirectories).ToList();
				automationReports = new List<FileInfo>();

				for (int x = 0; x < all.Count; x++) {

					automationReports.Add(new FileInfo(all[x]));

				}

				//Grab meta files for reports.
				all = Directory.GetFiles(FileBroker.REPORTS_DIRECTORY, "report.meta", SearchOption.AllDirectories).ToList();
				metaData = new List<KeyValuePair<string,List<KeyValuePair<string,string>>>>();
				for(int m = 0; m < all.Count; m++) {

					FileInfo info = new FileInfo(all[m]);
					string[] metaLines = FileBroker.ReadUnboundFile(info.FullName);
					List<KeyValuePair<string,string>> values = new List<KeyValuePair<string,string>>();

					for(int ml = 0; ml < metaLines.Length; ml++) {

						string[] keyVals = metaLines[ml].Split(':');
						values.Add(new KeyValuePair<string,string>(keyVals[0], keyVals[1]));

					}

					metaData.Add(new KeyValuePair<string,List<KeyValuePair<string,string>>>(all[m].Split(new string[] { string.Format("{0}{1}", GameMaster.GAME_NAME, FileBroker.FILE_PATH_SPLIT) }, StringSplitOptions.None)[1].Replace(string.Format("{0}report.meta", FileBroker.FILE_PATH_SPLIT), ".html"), values));
				}

				automationReports.Reverse();

			}

			if(!automationReports.Any()) {

				GUIStyle noResults = new GUIStyle(GUI.skin.label);
				noResults.padding = new RectOffset(10, 0, 0, 0);
				noResults.fontSize = 14;
				noResults.normal.textColor = Color.blue;
				GUILayout.Space(20);
				EditorGUILayout.LabelField("No test reports currently exist.", noResults);
				return;

			}

			Color32 boxGreen = new Color32(20, 175, 0, 255);
			GUIStyle fileLabel = new GUIStyle(GUI.skin.label);
			fileLabel.normal.textColor = boxGreen;
			fileLabel.padding = new RectOffset(32, 0, 0, 1);

			GUIStyle fileNameButton = new GUIStyle(GUI.skin.button);
			fileNameButton.margin = new RectOffset(35, 0, 0, 0);
			fileNameButton.normal.background = fileNameButton.active.background = fileNameButton.focused.background = Swat.TabButtonBackgroundTexture;
			fileNameButton.normal.textColor = Swat.WindowDefaultTextColor;

			GUIStyle deleteFileButton = new GUIStyle(GUI.skin.button);
			deleteFileButton.normal.textColor = Color.red;
			deleteFileButton.fontSize = 14;
			deleteFileButton.margin = new RectOffset(1, 0, 0, 5);
			deleteFileButton.normal.background = deleteFileButton.active.background = deleteFileButton.focused.background = Swat.TabButtonBackgroundTexture;
			deleteFileButton.normal.textColor = Color.red;

			GUIStyle divider = new GUIStyle(GUI.skin.box);
			divider.normal.background = Swat.MakeTextureFromColor(boxGreen);
			divider.margin = new RectOffset(35, 10, 10, 10);

			GUIStyle deleteAllButton = new GUIStyle(GUI.skin.button);
			deleteAllButton.fontSize = 12;
			deleteAllButton.normal.textColor = Color.red;
			deleteAllButton.fontStyle = FontStyle.Bold;
			deleteAllButton.fixedHeight = 38;
			deleteAllButton.margin = new RectOffset(0, 25, 5, 0);
			deleteAllButton.normal.background = deleteAllButton.active.background = deleteAllButton.focused.background = Swat.TabButtonBackgroundTexture;
			deleteAllButton.normal.textColor = Color.red;

			GUILayout.Space(20);

			GUIStyle padding = new GUIStyle();
			padding.margin = new RectOffset(25, 0, 0, 0);
			GUILayout.BeginHorizontal(padding);
			EditorGUILayout.Space();
			if(_showFileDeletedMessage) {

				GUIStyle deleteFileAlert = new GUIStyle(GUI.skin.label);
				deleteFileAlert.normal.textColor = Color.red;
				deleteFileAlert.fontSize = 14;
				deleteFileAlert.fixedHeight = 28;
				deleteFileAlert.padding = new RectOffset(30, 0, 14, 0);
				EditorGUILayout.LabelField("Deleted!", deleteFileAlert);

			}
			EditorGUILayout.Space();
			if(GUILayout.Button("Delete All", deleteAllButton, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(75) })) {

				SimpleAlert.Pop("Are you sure you want to delete all stored test run reports?", new EditorDelegate(DeleteAll));

			}
			GUILayout.EndHorizontal();
			GUILayout.Space(20);

			for(int ar = 0; ar < automationReports.Count; ar++) {

				bool isNewest = ar == 0;
				string[] splitTime = automationReports[ar].CreationTime.ToShortTimeString().Split(':');
				int hour = int.Parse(splitTime[0]);
				bool am = true;
				if(hour >= 12) {
					am = false;
					if(hour != 12) {
						hour -= 12;
					}
				}

				if(!isNewest) {
					fileNameButton.normal.textColor = fileLabel.normal.textColor = Swat.WindowDefaultTextColor;
				} 

				string timeOfDay = string.Format("{0}:{1} {2}", hour.ToString(), splitTime[1], am ? "AM" : "PM");
				if(isNewest) {
					EditorGUILayout.LabelField("-----Newest-----", fileLabel);
				}
				EditorGUILayout.LabelField(string.Format("{0}    {1}", automationReports[ar].CreationTime.ToLongDateString(), timeOfDay), fileLabel);

				List<KeyValuePair<string,List<KeyValuePair<string,string>>>> matchMetaResults = metaData.FindAll(x => automationReports[ar].Directory.ToString().Contains(x.Key.Replace(".html", string.Empty)));

				if(matchMetaResults.Any()) {

					KeyValuePair<string,List<KeyValuePair<string,string>>> matchMeta = matchMetaResults.First();
					EditorGUILayout.LabelField(string.Format("{0}:{1}     {2}:{3}     {4}:{5}     {6}:{7}",
						TestManifest.PreplacedED, matchMeta.Value.Find(x => x.Key == "Preplacedes").Value,
						TestManifest.FAILED, matchMeta.Value.Find(x => x.Key == "Fails").Value,
						TestManifest.SKIPPED, matchMeta.Value.Find(x => x.Key == "Skips").Value,
						TestManifest.IGNORED, matchMeta.Value.Find(x => x.Key == "Ignores").Value), fileLabel);

					if(Nexus.Self.MouseOver()) {

						Nexus.Self.SetToolTip(matchMeta.Value.Find(x => x.Key == "RunCommand").Value.Replace(",", "\n"));

					}

				}

				if(isNewest) {

					GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(180) });

				}

				GUILayout.BeginHorizontal();

				if(GUILayout.Button("Open Report", fileNameButton, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(150) })) {
						
				    System.Diagnostics.Process.Start(automationReports[ar].FullName);

				}
				if(GUILayout.Button("X", deleteFileButton, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(30) })) {

					//Delete report and replacedociated meta file.
					Directory.Delete(automationReports[ar].Directory.ToString().Replace("/report.html", string.Empty), true);
					ReDrawAutomationReports = true;
					_fileDeletedTime = DateTime.Now;
					_showFileDeletedMessage = true;

				}
				GUILayout.EndHorizontal();

				if(isNewest) {

					GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(180) });

				}

				EditorGUILayout.Space();
				EditorGUILayout.Space();

			}


		}

19 View Source File : Generator.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

void Renderreplacedistant() {

			if(!EditorApplication.isPlaying) {

				activateHierarchySelector = false;

			}
			GUILayout.Space(10);
			Nexus.Self.ToggleButton(activateHierarchySelector, "Hierarchy Autoselect", "Automatically select GameObjects in the hierarchy editor window when selecting interactable objects in the game view window.", 
				new Nexus.SwatDelegate(delegate() {  
					if(EditorApplication.isPlaying) {

						activateHierarchySelector = AutomationRecorder.NotRecordingActions = AutomationRecorder.SelectionUpdatesHierarchy = !activateHierarchySelector;
						AutomationRecorder.StaticSelfComponent.Initialize();

					} else {

						SimpleAlert.Pop("The editor must be running to activate this feature.", null);

					}
				}));

			GUILayout.Space(20);

			if(Selection.activeGameObject != null) {

				GUIStyle button = new GUIStyle(GUI.skin.button);
				button.padding = new RectOffset(0, 0, 5, 5);
				button.fontSize = 12;
				button.fontStyle = FontStyle.Bold;

				GUILayout.BeginHorizontal();
				GUILayout.Space(10);
				button.normal.textColor = Selection.activeGameObject.activeSelf ? Swat.ToggleButtonSelectedTextColor : Swat.ToggleButtonTextColor;
				button.normal.background = Selection.activeGameObject.activeSelf ? Swat.ToggleButtonBackgroundSelectedTexture : Swat.ToggleButtonBackgroundTexture;

				Nexus.Self.Button(Selection.activeGameObject.activeSelf ? "Hide" : "Show", "Show/Hide currently-selected game object in hierarchy window.", 
					new Nexus.SwatDelegate(delegate() {
						Selection.activeGameObject.SetActive(!Selection.activeGameObject.activeSelf);
					}), button, new GUILayoutOption[] { GUILayout.Width(120), GUILayout.Height(30) });

				button.normal.textColor = advancedSearch ? Swat.ToggleButtonSelectedTextColor : Swat.ToggleButtonTextColor;
				button.normal.background = advancedSearch ? Swat.ToggleButtonBackgroundSelectedTexture : Swat.ToggleButtonBackgroundTexture;

				Nexus.Self.Button(advancedSearch ? "Default Search" : "Full Search", "Search for references to selected objects in just the current parent-child hierarchy (default), or in all scene game objects (full).", 
					new Nexus.SwatDelegate(delegate() {                
						advancedSearch = !advancedSearch;
						setUpReferences = true;
					}), button, new GUILayoutOption[] { GUILayout.Width(120), GUILayout.Height(30) });

				GUILayout.EndHorizontal();

			}

			GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
			buttonStyle.margin = new RectOffset(20,0,0,0);

			EditorGUILayout.Space();
			EditorGUILayout.Space();

			if(inspectBasedOnSelectedHierarchy) {
				inspectedObject = Selection.activeGameObject;
				if(lastInspectedObject != inspectedObject) {
					NewObjectSelected();
					setUpReferences = true;
					return;
				}
				lastInspectedObject = inspectedObject;
			} else {
				inspectedObject = EditorGUILayout.ObjectField("Inspect Object ", inspectedObject, typeof(GameObject), true, new GUILayoutOption[] { GUILayout.Width(HalfRowLengthElement), GUILayout.MaxWidth(400) }) as GameObject;
			}

			if(inspectedObject != Nexus.Overseer.storedObjectLast) {
				ResetValues();
				breadCrumbTrails = new List<KeyValuePair<int,KeyValuePair<MonoScript,List<KeyValuePair<string,KeyValuePair<GameObject,KeyValuePair<AttributeInfo,Type>>>>>>>();
				GetReferences();
				Nexus.Overseer.storedObjectLast = inspectedObject;
			}
			EditorGUILayout.BeginHorizontal(); // ID 03
			GUILayout.Space(10);

			GUIStyle launchCatLabel = new GUIStyle(GUI.skin.label);
			launchCatLabel.padding = new RectOffset(10, 0, 0, 0);
			launchCatLabel.normal.textColor = Swat.WindowDefaultTextColor;
			EditorGUILayout.LabelField("Master Step Type: ", launchCatLabel);
			Nexus.Overseer.stepMaster = (AutoStepMaster)Nexus.Self.DropDown(Nexus.Overseer.stepMaster, 0, 25, 200);
			EditorGUILayout.EndHorizontal(); // ID 03

			//SimpleWait selection.
			if(Nexus.Overseer.stepMaster == AutoStepMaster.SimpleWait) {

				Nexus.Overseer.waitTime = EditorGUILayout.FloatField("Wait Time (Seconds): ", Nexus.Overseer.waitTime);
				EditorGUILayout.Space();
				if(GUILayout.Button("Generate Code", buttonStyle, new GUILayoutOption[] { GUILayout.Width(100) })) {
					Nexus.Overseer.generate = true;
				}
				EditorGUILayout.Space();
				if(Nexus.Overseer.generate) {
					EditorGUILayout.LabelField("Test Step Code: ");
					Nexus.Overseer.testCodeGenerated = EditorGUILayout.TextArea(string.Format("{0}Q.driver.WaitRealTime({1}));", AutoCreateScript.START_COROUTINE, Nexus.Overseer.waitTime));
				}

			}

			//ObjectAction or AdvancedWait selection without GameObject to inspect.
			if(inspectedObject == null && (Nexus.Overseer.stepMaster == AutoStepMaster.ObjectStep || Nexus.Overseer.stepMaster == AutoStepMaster.WaitFor)) {

				EditorGUILayout.Space();
				GUIStyle s = new GUIStyle(GUI.skin.label);
				s.normal.textColor = Color.red;
				s.wordWrap = true;
				GUILayout.Label("Select a GameObject in the hierarchy window to view automation details.", s);

			}

			//ObjectAction selection with GameObject to inspect.
			if(inspectedObject && (Nexus.Overseer.stepMaster == AutoStepMaster.ObjectStep || Nexus.Overseer.stepMaster == AutoStepMaster.WaitFor)) {

				EditorGUILayout.Space();

				if(Nexus.Overseer.parentObject != null && inspectedObject != null) {

					Nexus.Overseer.showBasic = Nexus.Self.Foldout(Nexus.Overseer.showBasic, "Show Basic GameObject Details", true);
					EditorGUI.indentLevel++;

					if(Nexus.Overseer.showBasic) {

						EditorGUILayout.Space();

						#region Basic GameObject details

						EditorGUIUtility.labelWidth = 225;
						GUI.enabled = false;

						//If a generated object in the hierarchy window is selected in Play Mode, and then Play Mode is stopped, the inspected object will be null. Skip this if it is null.
						Nexus.Overseer.parentObject = EditorGUILayout.ObjectField("Top Parent Object ", Nexus.Overseer.parentObject, typeof(GameObject), true, new GUILayoutOption[] { GUILayout.Width(HalfRowLengthElement), GUILayout.MaxWidth(400) }) as GameObject;
						GUI.enabled = true;
						Nexus.Overseer.objectName = EditorGUILayout.TextField("Object Name: ", inspectedObject.name);
						Nexus.Overseer.countObjectsWithThisName = EditorGUILayout.TextField("# Active Objects w/ This Name: ", objectsWithThisName.Count.ToString());
						if(driver != null) {
							Nexus.Overseer.objectActiveness = EditorGUILayout.TextField("Is Active/Visible/Interactible: ", (driver.IsActiveVisibleAndInteractable(inspectedObject) ? "True" : "False"));
						}
						Nexus.Overseer.objectTag = EditorGUILayout.TextField("Object Tag: ", inspectedObject.tag);
						EditorGUIUtility.labelWidth = 0;

					}

					#endregion

					EditorGUI.indentLevel--;
				}

				EditorGUILayout.Space();
				EditorGUILayout.Space();

				EditorGUILayout.BeginHorizontal(); // ID 04
				GUILayout.Space(10);
				Nexus.Overseer.showAdvanced = Nexus.Self.Foldout(Nexus.Overseer.showAdvanced, "Show Advanced GameObject Details", true);
				EditorGUILayout.EndHorizontal(); // ID 04
				if(Nexus.Overseer.showAdvanced) {

					EditorGUILayout.Space();

					#region Text Details

					Nexus.Overseer.textContainsValue = EditorGUILayout.TextField("Text Value:", Nexus.Overseer.textVal);

					#endregion

					#region Component List

					if(!string.IsNullOrEmpty(thisTestObject)) {
						newTestObjectFilePath = TestMonitorHelpers.GetNewTestObjectPath(thisTestObject);
						if(!FileBroker.Exists(newTestObjectFilePath)) {
							EditorGUILayout.Space();
							EditorGUILayout.LabelField("This Component does not have a Test Object replacedociated with it. Create one now?");
							GUILayout.Space(5);
							if(GUILayout.Button("Create", buttonStyle, new GUILayoutOption[] { GUILayout.Width(100) })) {
								string fileContents = AutoCreateScript.GetFileContentsForNewTestObject(thisTestObject);
								string metaFile = AutoCreateScript.GetMetaFileNewTestObject();
								FileBroker.CreateFileAtPath(newTestObjectFilePath, fileContents);
								FileBroker.CreateFileAtPath(string.Format("{0}.meta", newTestObjectFilePath), metaFile);
								isCreatingTestObject = true;
							}
							EditorGUILayout.Space();
						}
					}

					if(thisType != null && TestMonitorHelpers.Helper.GetComponent(thisType) == null) {
						TestMonitorHelpers.Helper.AddComponent(thisType);               
					}

					if(isCreatingTestObject && thisType == null) {
						Type newType = Type.GetType(string.Format("TrilleonAutomation.{0}", thisTestObject));
						if(newType != null) {
							thisType = newType;
							TestMonitorHelpers.allTestObjects.Add(newType);
							TestMonitorHelpers.Helper.AddComponent(newType);
						}
					}

					//If we do not have a master Test Object from the inspected object, do not attempt this logic.
					if(!string.IsNullOrEmpty(thisTestObject)) {
						if(TestMonitorHelpers.allTestObjects.FindAll(x => x.Name.ToLower() == thisTestObject.ToLower()).Any()) {
							if(TestMonitorHelpers.Helper.GetComponent(thisType) != null) {
								MonoBehaviour thisComponent = TestMonitorHelpers.Helper.GetComponent(thisType) as MonoBehaviour;
								Nexus.Overseer.testObjectFile = MonoScript.FromMonoBehaviour(thisComponent);
								Nexus.Overseer.testObjectFile = EditorGUILayout.ObjectField("Test Object: ", Nexus.Overseer.testObjectFile, thisType, true, new GUILayoutOption[] { GUILayout.Width(HalfRowLengthElement), GUILayout.MaxWidth(400) }) as MonoScript;
								isCreatingTestObject = false;
								Nexus.Overseer.testObject = thisTestObject;
							} else {
								Nexus.Overseer.testObject = EditorGUILayout.TextField("Test Object: ", thisTestObject);
							}
						} else {
							if(isCreatingTestObject) {
								GUIStyle testObjectButton = new GUIStyle(GUI.skin.button);
								testObjectButton.fixedWidth = Nexus.DetermineRectWidthBasedOnLengthOfString(thisTestObject);
								testObjectButton.margin = new RectOffset(20, 0, 8, 8);
								if(GUILayout.Button(thisTestObject, testObjectButton)) {
									System.Diagnostics.Process.Start(TestMonitorHelpers.GetNewTestObjectPath(thisTestObject));
								}
								GUIStyle s = new GUIStyle(EditorStyles.boldLabel);
								s.normal.textColor = Swat.TextGreen;
								EditorGUILayout.LabelField("A monoscript reference will not appear until next compilation.", s);
								EditorGUILayout.Space();
							} else {
								Nexus.Overseer.testObject = EditorGUILayout.TextField("Test Object: ", thisTestObject);
							}
						}
					}

					#endregion

					if(inspectedObject.GetComponent<Button>() != null) {
						Nexus.Overseer.objectType = AutoObjectType.Button;
					} else if(inspectedObject.GetComponent<InputField>() != null) {
						Nexus.Overseer.objectType = AutoObjectType.InputField;
					} else if(!string.IsNullOrEmpty(Nexus.Overseer.textVal)) {
						Nexus.Overseer.objectType = AutoObjectType.Text;
					} else {
						Nexus.Overseer.objectType = AutoObjectType.GameObject;
					}

					Nexus.Overseer.objectType = (AutoObjectType)EditorGUILayout.EnumPopup("Object Type: ", Nexus.Overseer.objectType, new GUILayoutOption[] { GUILayout.Width(275) });
					if(Nexus.Overseer.objectType != lastType) {
						ResetValues();
						lastType = Nexus.Overseer.objectType;
					}

					#region Component List

					EditorGUILayout.Space();
					Nexus.Overseer.showComponents = Nexus.Self.Foldout(Nexus.Overseer.showComponents, "Show Components List", true);
					if(Nexus.Overseer.showComponents) {
						EditorGUI.indentLevel++;
						Nexus.Overseer.componentsList = new string[components.Count];
						for(int i = 0; i < components.Count; i++) {
							Nexus.Overseer.componentsList[i] = EditorGUILayout.TextField(string.Format("Component {0}:", i.ToString()), components[i].GetType().Name);
						}
						EditorGUI.indentLevel--;
					}
					EditorGUILayout.Space();

					#endregion
					/*
               #region Master Script Fields & Properties List

               EditorGUILayout.Space();
               Nexus.Overseer.showFieldsAndProperties = Nexus.Self.Foldout(Nexus.Overseer.showFieldsAndProperties, "Master Script Fields & Properties", true);
               if(Nexus.Overseer.showFieldsAndProperties) {
                  EditorGUI.indentLevel++;
                  Nexus.Overseer.fieldsAndPropertiesList = new string[fieldsAndProperties.Count];
                  for(int i = 0; i < fieldsAndProperties.Count; i++) {
                     Nexus.Overseer.fieldsAndPropertiesList[i] = EditorGUILayout.TextField(string.Format("{0}", i.ToString()), fieldsAndProperties[i].Key);
                  }
                  EditorGUI.indentLevel--;
               }
               EditorGUILayout.Space();

               #endregion
               */
					#region Reference List

					GUIStyle labelRef = new GUIStyle(GUI.skin.label);
					labelRef.padding = new RectOffset(10, 0, 0, 0);
					labelRef.fontStyle = FontStyle.Bold;
					if(!_displayedReferenceNames.Any()){
						if(setUpReferences) {
							RenderReferences();
						}
						labelRef.normal.textColor = Color.red;
						EditorGUILayout.LabelField("- No references found -", labelRef);
					} else {
						EditorGUILayout.LabelField("- References -");
						RenderReferences();
						selectedReferenceChoice = EditorGUILayout.Popup("Use Which Ref?", selectedReferenceChoice, _displayedReferenceNames.ToArray());
					}
					EditorGUILayout.Space();

					#endregion

					//AdvancedWait selection.
					if(/* Temporarily disable else's code generation logic */ true || inspectedObject && Nexus.Overseer.stepMaster == AutoStepMaster.WaitFor) {

						labelRef.normal.textColor = Color.grey;
						labelRef.fontStyle = FontStyle.Italic;
						EditorGUILayout.Space();
						EditorGUILayout.LabelField("Code Stub Generation Logic Is Temporarily Disabled.", labelRef);
						EditorGUILayout.LabelField("Refactoring And Updating In Progress.", labelRef);

					} else {

						//TODO: Update for WAIT FOR logic. EditorGUILayout.TextField();
						Nexus.Overseer.step = (AutoStepType)EditorGUILayout.EnumPopup("Step Type: ", Nexus.Overseer.step, new GUILayoutOption[] { GUILayout.Width(275) });
						if(Nexus.Overseer.step != lastStep) {
							ResetValues();
							lastStep = Nexus.Overseer.step;
						}
						switch(Nexus.Overseer.step) {
						case AutoStepType.Action:
							Nexus.Overseer.action = (AutoAction)EditorGUILayout.EnumPopup("Act On: ", Nexus.Overseer.action, new GUILayoutOption[] { GUILayout.Width(275) });
							break;
						case AutoStepType.Objectreplacedert:
							Nexus.Overseer.replacedertObject = (AutoObjectreplacedert)EditorGUILayout.EnumPopup("Object replacedert: ", Nexus.Overseer.replacedertObject, new GUILayoutOption[] { GUILayout.Width(275) });
							if(Nexus.Overseer.replacedertObject != lastreplacedertObject) {
								ResetValues();
								lastreplacedertObject = Nexus.Overseer.replacedertObject;
							}
							if(Nexus.Overseer.replacedertObject != AutoObjectreplacedert.None) {
								Nexus.Overseer.reverseCondition = EditorGUILayout.Toggle("Reverse Condition? ", Nexus.Overseer.reverseCondition);
							}
							break;
						case AutoStepType.Boolreplacedert:
							//action = (AutoAction)EditorGUILayout.EnumPopup("Act On: ", action);
							break;
						}

					}

					//We do not need to find the object programmatically if we have a reference to it.
					if(_references.Count == 0) {

						if(Nexus.Overseer.action != AutoAction.None) {
							Nexus.Overseer.findBy = (By)EditorGUILayout.EnumPopup("Find By: ", Nexus.Overseer.findBy, new GUILayoutOption[] { GUILayout.Width(275) }); 
							if(Nexus.Overseer.findBy != lastFindBy) {
								ResetValues();
								lastFindBy = Nexus.Overseer.findBy;
							}
						}

						if(Nexus.Overseer.findBy == By.TextContent) {
							Nexus.Overseer.textContainsToUse = EditorGUILayout.TextField("Search Val: ", Nexus.Overseer.textContainsValue.Length > 25 ? Nexus.Overseer.textContainsValue.Substring(0, 25) : Nexus.Overseer.textContainsValue);
						}

					}

					//Show controls for generated code.
					if(Nexus.Overseer.action != AutoAction.None || Nexus.Overseer.replacedertObject != AutoObjectreplacedert.None) {

						GUILayout.Space(5);
						if(GUILayout.Button("Generate Code", buttonStyle, new GUILayoutOption[] { GUILayout.Width(100) })) {
							if(_refParentScriptParameterName.Count > 1) {
								Nexus.Overseer.referencedScript = _refParentScriptParameterName[selectedReferenceChoice];
							} else if(_refParentScriptParameterName.Count == 1) {
								Nexus.Overseer.referencedScript = _refParentScriptParameterName[0];
							}
							Nexus.Overseer.testObjectCodeGenerated = AutoCreateScript.GenerateTestObjectCode();
							Nexus.Overseer.testCodeGenerated = AutoCreateScript.GenerateLineOfTestCode(Nexus.Overseer.textType);
							Nexus.Overseer.generate = true;
						}
						EditorGUILayout.Space();
						if(Nexus.Overseer.generate) {
							EditorGUILayout.LabelField("Test Object Code: ");
							Nexus.Overseer.testObjectCodeGenerated = EditorGUILayout.TextArea(Nexus.Overseer.testObjectCodeGenerated);
							EditorGUILayout.LabelField("Test Step Code: ");
							Nexus.Overseer.testCodeGenerated = EditorGUILayout.TextArea(Nexus.Overseer.testCodeGenerated);
						}

					}

				}

			}

			EditorGUILayout.Space();
			EditorGUILayout.Space();
			EditorGUILayout.Space();
			EditorGUILayout.Space();

		}

19 View Source File : ConsoleMessage.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

public override void OnGUI() {

			if(Nexus.Self == null || Nexus.Self.SelectedTab.Window.GetType() != constraint) {

				Close();
				return;

			}

			if(lastWindowWidth != Nexus.Self.position.width) {

				DoPositionWindow = true;

			}

			if(DoPositionWindow) {

				DoPositionWindow = false;
				lastWindowWidth = Nexus.Self.position.width;
				PositionWindow();

			}

			GUI.skin.textArea.wordWrap = true;

			buttons = new GUIStyle(GUI.skin.button);
			buttons.fixedHeight = buttonHeight;
			buttons.fixedWidth = buttonWidth;
			buttons.margin = new RectOffset(0, 0, 10, 0);
			buttons.normal.textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black;
			buttonGroup = new GUIStyle();

			closeBox = new GUIStyle(GUI.skin.button);
			closeBox.fontSize = 16;
			closeBox.padding = new RectOffset(2, 0, 0, 0);
			closeBox.normal.textColor = Color.red; 

			detailsBox = new GUIStyle(GUI.skin.box);
			detailsBox.margin = new RectOffset(10, 25, 0, 0);
			detailsBox.fixedWidth = minSize.x - 20;
			detailsBox.fixedHeight = minSize.y - 100;

			detailsLabel = new GUIStyle(GUI.skin.label);
			detailsLabel.fontStyle = FontStyle.Bold;
			detailsLabel.fontSize = 12;

			details = new GUIStyle(GUI.skin.textArea);
			details.fixedHeight = detailsBox.fixedHeight - 150;
			details.fixedWidth = detailsBox.fixedWidth - 15;
			details.padding = detailsBox.padding = new RectOffset(5, 5, 5, 5);

			divider = new GUIStyle(GUI.skin.box);
			divider.normal.background = Swat.MakeTextureFromColor(Color.white);
			divider.margin = new RectOffset(25, 0, 10, 20);

			header = new GUIStyle(GUI.skin.label);
			header.fontSize = 14;
			header.fixedHeight = 25;
			header.normal.textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black;
			header.fontStyle = FontStyle.Bold;
			header.alignment = TextAnchor.MiddleCenter;
			header.padding = new RectOffset(0, 0, -20, 0);

			EditorGUILayout.BeginHorizontal();
			EditorGUILayout.Space();
			Nexus.Self.Button("X", "Show/Hide test status details section.", 
				new Nexus.SwatDelegate(delegate() {                
					IsVisible = false;
					Close();
				}), closeBox, new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) });
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.LabelField("Console Message", header);
			GUILayout.Space(10);

			GUILayout.BeginVertical(detailsBox);
			EditorGUILayout.LabelField("Time:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120)});
			EditorGUILayout.SelectableLabel(Timestamp);
			EditorGUILayout.Space();
			EditorGUILayout.LabelField("Type:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120)});
			EditorGUILayout.SelectableLabel(MessageType);
			EditorGUILayout.Space();
			EditorGUILayout.LabelField("Verbosity:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120)});
			EditorGUILayout.SelectableLabel(MessageLevel);
			EditorGUILayout.Space();
			EditorGUILayout.LabelField("Message:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120)});
			GUILayout.BeginHorizontal();
			_scrollConsoleDetails = GUILayout.BeginScrollView(_scrollConsoleDetails, false, true, GUIStyle.none, GUI.skin.verticalScrollbar);
			EditorGUILayout.SelectableLabel(Message, details);
			GUILayout.EndScrollView();
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();

			buttonGroup.margin = new RectOffset(System.Convert.ToInt32(System.Math.Round(position.width / 2)) - 25, 0, 0, 10);
			EditorGUILayout.BeginHorizontal(buttonGroup);
			if(GUILayout.Button("Close", buttons)) {
				IsVisible = false;
				Close();
			}
			EditorGUILayout.EndHorizontal();

		}

19 View Source File : RunnerConsole.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

public override void Render() {

			GUIStyle horizontal = new GUIStyle();
			horizontal.margin = new RectOffset(10, 11, 0, 0);

			GUIStyle statusColor = new GUIStyle(GUI.skin.label);
			statusColor.margin = new RectOffset(0, 0, 3, 0);
			statusColor.normal.textColor = AutoConsole.Paused ? Color.red : Nexus.TextGreen;
			statusColor.fixedWidth = 125;
			statusColor.fontStyle = FontStyle.Bold;

			GUILayout.Space(15);
			EditorGUILayout.BeginHorizontal(horizontal); //For "Running" notification and FPS counter.

			if(Application.isPlaying && AutomationMaster.Busy) {

				EditorGUILayout.LabelField("Running Test(s)", statusColor);

			} else {

				AutomationMaster.Busy = false;
				EditorGUILayout.LabelField(string.Empty, statusColor);

			}
				
			if(Application.isPlaying) {

				if(renderPreplacedes == FPS_SAMPLE_RATE && Application.isPlaying) {

					fpsSample = Math.Round(1 / Time.deltaTime, 0);
					renderPreplacedes = 0;

				}
				GUIStyle fps  = new GUIStyle(GUI.skin.label);
				fps.fontSize = 26;
				fps.padding = new RectOffset(0, 0, -8, 0);
				fps.normal.textColor = GetFpsColor(fpsSample);

				GUILayout.FlexibleSpace();
				EditorGUILayout.LabelField(string.Format("FPS   {0}", fpsSample), new GUILayoutOption[] { GUILayout.Width(50) });
				EditorGUILayout.LabelField(string.Format("◈", fpsSample), fps, new GUILayoutOption[] { GUILayout.Width(35) });
				GUILayout.Space(-18);

				renderPreplacedes++;

			}
			EditorGUILayout.EndHorizontal(); //End for "Running" notification and FPS counter.

			GUIStyle scrollStatus = new GUIStyle(GUI.skin.button);
			scrollStatus.margin = new RectOffset(0, 0, 0, 0);
			scrollStatus.fontStyle = _autoScroll ? FontStyle.Bold : FontStyle.Normal;
			scrollStatus.normal.background = Swat.ToggleButtonBackgroundSelectedTexture;
			scrollStatus.normal.textColor = _pubsubMode ? Nexus.TextGreen : Swat.WindowDefaultTextColor;
			EditorGUILayout.Space();

			GUILayout.BeginHorizontal(horizontal);
			EditorGUILayout.LabelField(string.Format("{0}  -  {1}", AutoConsole.Paused ? "Paused" : "Active", AutoConsole.FilterLevel == MessageLevel.Verbose ? "Verbose" : "Abridged") , statusColor);
			EditorGUILayout.Space();
			GUILayout.Space(-100);
			Nexus.Self.Button("Pubsub", "Show received Pubsub messages.", 
				new Nexus.SwatDelegate(delegate() {                
					_pubsubMode = !_pubsubMode;
				}), scrollStatus, new GUILayoutOption[] { GUILayout.Width(75), GUILayout.Height(22) });
			GUILayout.Space(0.65f);
			scrollStatus.normal.textColor = _autoScroll ? Nexus.TextGreen : Color.red;
			Nexus.Self.Button("Auto Scroll", "Remove all messages in the console.", 
				new Nexus.SwatDelegate(delegate() {                
					_autoScroll = !_autoScroll;
				}), scrollStatus, new GUILayoutOption[] { GUILayout.Width(75), GUILayout.Height(22) });
			GUILayout.EndHorizontal();

			EditorGUILayout.Space();

			GUILayout.BeginHorizontal(horizontal);
			GUIStyle button = new GUIStyle(GUI.skin.button);  
			button.margin = new RectOffset(0, 0, 0, 0);
			button.normal.textColor = Swat.ToggleButtonTextColor;
			button.normal.background = Swat.ToggleButtonBackgroundTexture;

			Nexus.Self.Button("Clear", "Remove all messages in the console.", 
				new Nexus.SwatDelegate(delegate() {                
					FileBroker.SaveUnboundFile(string.Format("{0}{1}{2}/console_before_start.txt", FileBroker.BASE_NON_UNITY_PATH, AutomationMaster.ConfigReader.GetString("EDITOR_RESOURCE_CONSOLE_LOG_DIRECTORY"), GameMaster.GAME_NAME), string.Empty);
					AutoConsole.messageListDisplayed = new List<AutoConsoleMessage>();
					AutoConsole.messageListQueued = new List<AutoConsoleMessage>();
					_selectedConsoleMessage = null;
				}), button, new GUILayoutOption[] { GUILayout.Width(60), GUILayout.Height(22) });

			GUILayout.Space(0.5f);

			Nexus.Self.Button(AutoConsole.Paused ? "Resume" : "Pause", "Pause/Continue rendering of new messages in the console. Messages are still received and stored when paused, and will appear immediately when resuming.", 
				new Nexus.SwatDelegate(delegate() {                
					AutoConsole.Paused = !AutoConsole.Paused;
				}), button, new GUILayoutOption[] { GUILayout.Width(60), GUILayout.Height(22) });

			EditorGUILayout.Space();

			Nexus.Self.Button("Verbose", "Post ALL messages from the automation framework in the console.", 
				new Nexus.SwatDelegate(delegate() {                
					AutoConsole.FilterLevel = MessageLevel.Verbose; 
					if(_autoScroll) {

						_scroll.y = 99999;
						_scroll.x = 0;

					}
				}), button, new GUILayoutOption[] { GUILayout.Width(75), GUILayout.Height(22) });

			GUILayout.Space(0.65f);

			GUIStyle abridged = new GUIStyle(GUI.skin.button);  
			abridged.margin = new RectOffset(0, 0, 0, 0);
			abridged.normal.textColor = Swat.ToggleButtonTextColor;
			abridged.normal.background = Swat.ToggleButtonBackgroundTexture;
			Nexus.Self.Button("Abridged", "Post only automation messages marked as high priority in the console.", 
				new Nexus.SwatDelegate(delegate() {                
					AutoConsole.FilterLevel = MessageLevel.Abridged; 
					if(_autoScroll) {

						_scroll.y = 99999;
						_scroll.x = 0;

					}
				}), abridged, new GUILayoutOption[] { GUILayout.Width(75), GUILayout.Height(22) });

			GUILayout.EndHorizontal();

			float messageHeight = 15;

			GUIStyle consoleBox = new GUIStyle(GUI.skin.box);
			consoleBox.fixedHeight = Nexus.Self.position.height - (Application.isPlaying ? 125 : 105);
			consoleBox.fixedWidth = Nexus.Self.position.width - 20;
			consoleBox.margin = new RectOffset(10, 0, 0, 10);
			consoleBox.normal.background = Swat.TabButtonBackgroundTexture;

			GUILayout.BeginVertical(consoleBox); //Begin box border around console.
			_scroll = GUILayout.BeginScrollView(_scroll);

			GUIStyle messageBox = new GUIStyle(GUI.skin.box);
			messageBox.normal.background = Swat.TabButtonBackgroundSelectedTexture;
			messageBox.margin = new RectOffset(2, 2, 1, 1);
			GUIStyle messageBoxText = new GUIStyle(GUI.skin.label);
			messageBoxText.normal.textColor = Swat.WindowDefaultTextColor;
			messageBox.fixedWidth = consoleBox.fixedWidth - 10;
			messageBoxText.fixedWidth = messageBox.fixedWidth - 5;

			string lastConsoleMessage = string.Empty;
			int duplicateCount = 0;
			List<AutoConsoleMessage> consoleMessages = AutoConsole.messageListDisplayed;
			for(int m = 0; m < consoleMessages.Count; m++) {

				if((_pubsubMode && consoleMessages[m].messageType != ConsoleMessageType.Pubsub) ||(!_pubsubMode && consoleMessages[m].messageType == ConsoleMessageType.Pubsub)) {

					continue;

				}

				//If this is a new console message, and auto scroll is on, scroll down automatically.
				if(_autoScroll && m == _lastPreplacedConsoleMessageCount) {

					_scroll.y = 99999;
					_scroll.x = 0;

				}

				//Render only messages of the requested filter level.
				if(_pubsubMode ||(AutoConsole.FilterLevel == MessageLevel.Abridged && consoleMessages[m].level == MessageLevel.Abridged) || AutoConsole.FilterLevel == MessageLevel.Verbose) {

					messageBoxText.normal.textColor = AutoConsole.MessageColor(consoleMessages[m].messageType);
					GUILayout.BeginHorizontal(messageBox, new GUILayoutOption[] {
						GUILayout.MinWidth(225),
						GUILayout.MaxHeight(messageHeight)
					});

					if(lastConsoleMessage == consoleMessages[m].message) {

						duplicateCount++;
						consoleMessages.RemoveAt(m - 1);

					} else {

						lastConsoleMessage = consoleMessages[m].message;
						duplicateCount = 0;

					}
						
					if(consoleMessages.Count > m) {
						
						if(GUILayout.Button(string.Format("{0} {1}", duplicateCount > 0 ?(duplicateCount + 1).ToString() : string.Empty, consoleMessages[m].message), messageBoxText)) {

							if(_selectedConsoleMessage == consoleMessages[m]) {

								//If the message has been double-clicked, open this test failure as a single-test, temporary report.
								if(DateTime.Now.Subtract(_lastConsoleMessageButtonClick).TotalSeconds < 0.75d && !string.IsNullOrEmpty(consoleMessages[m].testMethod)) {

									if(_consoleAbridgedReportTypes.Contains(consoleMessages[m].messageType)) {

										_selectedConsoleMessage = null; //Prevents details panel from appearing. We only want it to appear for a single click, not a double click.
										AutomationReport.BuildTemporaryReportForSingleConsoleFailure(consoleMessages[m].testMethod);
										System.Diagnostics.Process.Start(string.Format("{0}SingleTestAsReportTemp.html", FileBroker.RESOURCES_DIRECTORY));
										OpenedTestReport = DateTime.UtcNow;

									} 

								} else {

									ConsoleMessage.Pop(_selectedConsoleMessage.message, Enum.GetName(typeof(ConsoleMessageType), _selectedConsoleMessage.messageType), Enum.GetName(typeof(MessageLevel), _selectedConsoleMessage.level), _selectedConsoleMessage.timestamp.ToString());
									_selectedConsoleMessage = null;

								}

							}

							_selectedConsoleMessage = consoleMessages[m];
							_lastConsoleMessageButtonClick = DateTime.Now;

						}

					}
					GUILayout.EndHorizontal();
				}

			}

			_lastPreplacedConsoleMessageCount = consoleMessages.Count;

			GUILayout.EndScrollView();
			GUILayout.EndVertical();

		}

19 View Source File : PluginSettings.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

[SettingsProvider]
    private static SettingsProvider RiderPreferencesItem()
    {
      if (!RiderScriptEditor.IsRiderInstallation(RiderScriptEditor.CurrentEditor))
        return null;
      if (!RiderScriptEditorData.instance.shouldLoadEditorPlugin)
        return null;
      var provider = new SettingsProvider("Preferences/Rider", SettingsScope.User)
      {
        label = "Rider",
        keywords = new[] { "Rider" },
        guiHandler = (searchContext) =>
        {
          EditorGUIUtility.labelWidth = 200f;
          EditorGUILayout.BeginVertical();

          GUILayout.BeginVertical();
          LogEventsCollectorEnabled =
            EditorGUILayout.Toggle(new GUIContent("Preplaced Console to Rider:"), LogEventsCollectorEnabled);

          GUILayout.EndVertical();
          GUILayout.Label("");

          if (!string.IsNullOrEmpty(EditorPluginInterop.LogPath))
          {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Log file:");
            var previous = GUI.enabled;
            GUI.enabled = previous && SelectedLoggingLevel != LoggingLevel.OFF;
            var button = GUILayout.Button(new GUIContent("Open log"));
            if (button)
            {
              //UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(PluginEntryPoint.LogPath, 0);
              // works much faster than the commented code, when Rider is already started
              CodeEditor.CurrentEditor.OpenProject(EditorPluginInterop.LogPath, 0, 0);
            }

            GUI.enabled = previous;
            GUILayout.EndHorizontal();
          }

          var loggingMsg =
            @"Sets the amount of Rider Debug output. If you are about to report an issue, please select Verbose logging level and attach Unity console output to the issue.";
          SelectedLoggingLevel =
            (LoggingLevel) EditorGUILayout.EnumPopup(new GUIContent("Logging Level:", loggingMsg),
              SelectedLoggingLevel);


          EditorGUILayout.HelpBox(loggingMsg, MessageType.None);

          LinkButton("https://github.com/JetBrains/resharper-unity");

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

          GUILayout.FlexibleSpace();
          var replacedembly = EditorPluginInterop.EditorPluginreplacedembly;
          if (replacedembly != null)
          {
            var version = replacedembly.GetName().Version;
            GUILayout.Label("Plugin version: " + version, ourVersionInfoStyle);
          }

          GUILayout.EndHorizontal();

          EditorGUILayout.EndVertical();
        }
      };
      return provider;
    }

19 View Source File : VisualStudioEditor.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

public void OnGUI()
		{
			GUILayout.BeginHorizontal();
			GUILayout.FlexibleSpace();

			var package = UnityEditor.PackageManager.PackageInfo.FindForreplacedembly(GetType().replacedembly);

			var style = new GUIStyle
			{
				richText = true,
				margin = new RectOffset(0, 4, 0, 0)
			};

			GUILayout.Label($"<size=10><color=grey>{package.displayName} v{package.version} enabled</color></size>", style);
			GUILayout.EndHorizontal();

			EditorGUILayout.LabelField("Generate .csproj files for:");
			EditorGUI.indentLevel++;
			SettingsButton(ProjectGenerationFlag.Embedded, "Embedded packages", "");
			SettingsButton(ProjectGenerationFlag.Local, "Local packages", "");
			SettingsButton(ProjectGenerationFlag.Registry, "Registry packages", "");
			SettingsButton(ProjectGenerationFlag.Git, "Git packages", "");
			SettingsButton(ProjectGenerationFlag.BuiltIn, "Built-in packages", "");
			SettingsButton(ProjectGenerationFlag.LocalTarBall, "Local tarball", "");
			SettingsButton(ProjectGenerationFlag.Unknown, "Packages from unknown sources", "");
			SettingsButton(ProjectGenerationFlag.Playerreplacedemblies, "Player projects", "For each player project generate an additional csproj with the name 'project-player.csproj'");
			RegenerateProjectFiles();
			EditorGUI.indentLevel--;
		}

public void OnGUI()
        {
            GUILayout.BeginHorizontal();
            DrawControls();
            if (position.width > position.height && position.width > k_TwoColumnControlsWidth)
            {
                DrawPreview();
            }
            GUILayout.EndHorizontal();
        }

void DrawControls()
        {
            GUILayout.Space(5f);

            if (position.width > position.height && position.width > k_TwoColumnControlsWidth)
            {
                m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition, GUILayout.Width(315));
            }
            else
            {
                m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
            }

            GUILayout.Space(5f);

            GUILayout.Label(m_SelectedFontreplacedet != null ? string.Format("Font Settings [{0}]", m_SelectedFontreplacedet.name) : "Font Settings", EditorStyles.boldLabel);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            EditorGUIUtility.labelWidth = 125f;
            EditorGUIUtility.fieldWidth = 5f;

            // Disable Options if already generating a font atlas texture.
            EditorGUI.BeginDisabledGroup(m_IsProcessing);
            {
                // FONT TTF SELECTION
                EditorGUI.BeginChangeCheck();
                m_SourceFontFile = EditorGUILayout.ObjectField("Source Font File", m_SourceFontFile, typeof(Font), false) as Font;
                if (EditorGUI.EndChangeCheck())
                {
                    m_SelectedFontreplacedet = null;
                    m_IsFontAtlasInvalid = true;
                }

                // FONT SIZING
                EditorGUI.BeginChangeCheck();
                if (m_PointSizeSamplingMode == 0)
                {
                    m_PointSizeSamplingMode = EditorGUILayout.Popup("Sampling Point Size", m_PointSizeSamplingMode, m_FontSizingOptions);
                }
                else
                {
                    GUILayout.BeginHorizontal();
                    m_PointSizeSamplingMode = EditorGUILayout.Popup("Sampling Point Size", m_PointSizeSamplingMode, m_FontSizingOptions, GUILayout.Width(225));
                    m_PointSize = EditorGUILayout.IntField(m_PointSize);
                    GUILayout.EndHorizontal();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    m_IsFontAtlasInvalid = true;
                }

                // FONT PADDING
                EditorGUI.BeginChangeCheck();
                m_Padding = EditorGUILayout.IntField("Padding", m_Padding);
                m_Padding = (int)Mathf.Clamp(m_Padding, 0f, 64f);
                if (EditorGUI.EndChangeCheck())
                {
                    m_IsFontAtlasInvalid = true;
                }

                // FONT PACKING METHOD SELECTION
                EditorGUI.BeginChangeCheck();
                m_PackingMode = (FontPackingModes)EditorGUILayout.EnumPopup("Packing Method", m_PackingMode);
                if (EditorGUI.EndChangeCheck())
                {
                    m_IsFontAtlasInvalid = true;
                }

                // FONT ATLAS RESOLUTION SELECTION
                GUILayout.BeginHorizontal();
                GUI.changed = false;

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PrefixLabel("Atlas Resolution");
                m_AtlasWidth = EditorGUILayout.IntPopup(m_AtlasWidth, m_FontResolutionLabels, m_FontAtlasResolutions);
                m_AtlasHeight = EditorGUILayout.IntPopup(m_AtlasHeight, m_FontResolutionLabels, m_FontAtlasResolutions);
                if (EditorGUI.EndChangeCheck())
                {
                    m_IsFontAtlasInvalid = true;
                }

                GUILayout.EndHorizontal();


                // FONT CHARACTER SET SELECTION
                EditorGUI.BeginChangeCheck();
                bool hreplacedelectionChanged = false;
                m_CharacterSetSelectionMode = EditorGUILayout.Popup("Character Set", m_CharacterSetSelectionMode, m_FontCharacterSets);
                if (EditorGUI.EndChangeCheck())
                {
                    m_CharacterSequence = "";
                    hreplacedelectionChanged = true;
                    m_IsFontAtlasInvalid = true;
                }

                switch (m_CharacterSetSelectionMode)
                {
                    case 0: // ASCII
                        //characterSequence = "32 - 126, 130, 132 - 135, 139, 145 - 151, 153, 155, 161, 166 - 167, 169 - 174, 176, 181 - 183, 186 - 187, 191, 8210 - 8226, 8230, 8240, 8242 - 8244, 8249 - 8250, 8252 - 8254, 8260, 8286";
                        m_CharacterSequence = "32 - 126, 160, 8203, 8230, 9633";
                        break;

                    case 1: // EXTENDED ASCII
                        m_CharacterSequence = "32 - 126, 160 - 255, 8192 - 8303, 8364, 8482, 9633";
                        // Could add 9632 for missing glyph
                        break;

                    case 2: // Lowercase
                        m_CharacterSequence = "32 - 64, 91 - 126, 160";
                        break;

                    case 3: // Uppercase
                        m_CharacterSequence = "32 - 96, 123 - 126, 160";
                        break;

                    case 4: // Numbers & Symbols
                        m_CharacterSequence = "32 - 64, 91 - 96, 123 - 126, 160";
                        break;

                    case 5: // Custom Range
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        GUILayout.Label("Enter a sequence of decimal values to define the characters to be included in the font replacedet or retrieve one from another font replacedet.", TMP_UIStyleManager.label);
                        GUILayout.Space(10f);

                        EditorGUI.BeginChangeCheck();
                        m_ReferencedFontreplacedet = EditorGUILayout.ObjectField("Select Font replacedet", m_ReferencedFontreplacedet, typeof(TMP_Fontreplacedet), false) as TMP_Fontreplacedet;
                        if (EditorGUI.EndChangeCheck() || hreplacedelectionChanged)
                        {
                            if (m_ReferencedFontreplacedet != null)
                                m_CharacterSequence = TMP_EditorUtility.GetDecimalCharacterSequence(TMP_Fontreplacedet.GetCharactersArray(m_ReferencedFontreplacedet));

                            m_IsFontAtlasInvalid = true;
                        }

                        // Filter out unwanted characters.
                        char chr = Event.current.character;
                        if ((chr < '0' || chr > '9') && (chr < ',' || chr > '-'))
                        {
                            Event.current.character = '\0';
                        }
                        GUILayout.Label("Character Sequence (Decimal)", EditorStyles.boldLabel);
                        EditorGUI.BeginChangeCheck();
                        m_CharacterSequence = EditorGUILayout.TextArea(m_CharacterSequence, TMP_UIStyleManager.textAreaBoxWindow, GUILayout.Height(120), GUILayout.ExpandWidth(true));
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_IsFontAtlasInvalid = true;
                        }

                        EditorGUILayout.EndVertical();
                        break;

                    case 6: // Unicode HEX Range
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        GUILayout.Label("Enter a sequence of Unicode (hex) values to define the characters to be included in the font replacedet or retrieve one from another font replacedet.", TMP_UIStyleManager.label);
                        GUILayout.Space(10f);

                        EditorGUI.BeginChangeCheck();
                        m_ReferencedFontreplacedet = EditorGUILayout.ObjectField("Select Font replacedet", m_ReferencedFontreplacedet, typeof(TMP_Fontreplacedet), false) as TMP_Fontreplacedet;
                        if (EditorGUI.EndChangeCheck() || hreplacedelectionChanged)
                        {
                            if (m_ReferencedFontreplacedet != null)
                                m_CharacterSequence = TMP_EditorUtility.GetUnicodeCharacterSequence(TMP_Fontreplacedet.GetCharactersArray(m_ReferencedFontreplacedet));

                            m_IsFontAtlasInvalid = true;
                        }

                        // Filter out unwanted characters.
                        chr = Event.current.character;
                        if ((chr < '0' || chr > '9') && (chr < 'a' || chr > 'f') && (chr < 'A' || chr > 'F') && (chr < ',' || chr > '-'))
                        {
                            Event.current.character = '\0';
                        }
                        GUILayout.Label("Character Sequence (Hex)", EditorStyles.boldLabel);
                        EditorGUI.BeginChangeCheck();
                        m_CharacterSequence = EditorGUILayout.TextArea(m_CharacterSequence, TMP_UIStyleManager.textAreaBoxWindow, GUILayout.Height(120), GUILayout.ExpandWidth(true));
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_IsFontAtlasInvalid = true;
                        }

                        EditorGUILayout.EndVertical();
                        break;

                    case 7: // Characters from Font replacedet
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        GUILayout.Label("Type the characters to be included in the font replacedet or retrieve them from another font replacedet.", TMP_UIStyleManager.label);
                        GUILayout.Space(10f);

                        EditorGUI.BeginChangeCheck();
                        m_ReferencedFontreplacedet = EditorGUILayout.ObjectField("Select Font replacedet", m_ReferencedFontreplacedet, typeof(TMP_Fontreplacedet), false) as TMP_Fontreplacedet;
                        if (EditorGUI.EndChangeCheck() || hreplacedelectionChanged)
                        {
                            if (m_ReferencedFontreplacedet != null)
                                m_CharacterSequence = TMP_Fontreplacedet.GetCharacters(m_ReferencedFontreplacedet);

                            m_IsFontAtlasInvalid = true;
                        }

                        EditorGUI.indentLevel = 0;

                        GUILayout.Label("Custom Character List", EditorStyles.boldLabel);
                        EditorGUI.BeginChangeCheck();
                        m_CharacterSequence = EditorGUILayout.TextArea(m_CharacterSequence, TMP_UIStyleManager.textAreaBoxWindow, GUILayout.Height(120), GUILayout.ExpandWidth(true));
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_IsFontAtlasInvalid = true;
                        }
                        EditorGUILayout.EndVertical();
                        break;

                    case 8: // Character List from File
                        EditorGUI.BeginChangeCheck();
                        m_CharactersFromFile = EditorGUILayout.ObjectField("Character File", m_CharactersFromFile, typeof(Textreplacedet), false) as Textreplacedet;
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_IsFontAtlasInvalid = true;
                        }

                        if (m_CharactersFromFile != null)
                        {
                            Regex rx = new Regex(@"(?<!\\)(?:\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})");

                            m_CharacterSequence = rx.Replace(m_CharactersFromFile.text,
                                match =>
                                {
                                    if (match.Value.StartsWith("\\U"))
                                        return char.ConvertFromUtf32(int.Parse(match.Value.Replace("\\U", ""), NumberStyles.HexNumber));

                                    return char.ConvertFromUtf32(int.Parse(match.Value.Replace("\\u", ""), NumberStyles.HexNumber));
                                });
                        }
                        break;
                }

                // FONT STYLE SELECTION
                //GUILayout.BeginHorizontal();
                //EditorGUI.BeginChangeCheck();
                ////m_FontStyle = (FaceStyles)EditorGUILayout.EnumPopup("Font Style", m_FontStyle, GUILayout.Width(225));
                ////m_FontStyleValue = EditorGUILayout.IntField((int)m_FontStyleValue);
                //if (EditorGUI.EndChangeCheck())
                //{
                //    m_IsFontAtlasInvalid = true;
                //}
                //GUILayout.EndHorizontal();

                // Render Mode Selection
                CheckForLegacyGlyphRenderMode();

                EditorGUI.BeginChangeCheck();
                m_GlyphRenderMode = (GlyphRenderMode)EditorGUILayout.EnumPopup("Render Mode", m_GlyphRenderMode);
                if (EditorGUI.EndChangeCheck())
                {
                    m_IsFontAtlasInvalid = true;
                }

                m_IncludeFontFeatures = EditorGUILayout.Toggle("Get Kerning Pairs", m_IncludeFontFeatures);

                EditorGUILayout.Space();
            }

            EditorGUI.EndDisabledGroup();

            if (!string.IsNullOrEmpty(m_WarningMessage))
            {
                EditorGUILayout.HelpBox(m_WarningMessage, MessageType.Warning);
            }

            GUI.enabled = m_SourceFontFile != null && !m_IsProcessing && !m_IsGenerationDisabled; // Enable Preview if we are not already rendering a font.
            if (GUILayout.Button("Generate Font Atlas") && GUI.enabled)
            {
                if (!m_IsProcessing && m_SourceFontFile != null)
                {
                    DestroyImmediate(m_FontAtlasTexture);
                    m_FontAtlasTexture = null;
                    m_SavedFontAtlas = null;

                    // Initialize font engine
                    FontEngineError errorCode = FontEngine.InitializeFontEngine();
                    if (errorCode != FontEngineError.Success)
                    {
                        Debug.Log("Font replacedet Creator - Error [" + errorCode + "] has occurred while Initializing the FreeType Library.");
                    }

                    // Get file path of the source font file.
                    string fontPath = replacedetDatabase.GetreplacedetPath(m_SourceFontFile);

                    if (errorCode == FontEngineError.Success)
                    {
                        errorCode = FontEngine.LoadFontFace(fontPath);

                        if (errorCode != FontEngineError.Success)
                        {
                            Debug.Log("Font replacedet Creator - Error Code [" + errorCode + "] has occurred trying to load the [" + m_SourceFontFile.name + "] font file. This typically results from the use of an incompatible or corrupted font file.", m_SourceFontFile);
                        }
                    }


                    // Define an array containing the characters we will render.
                    if (errorCode == FontEngineError.Success)
                    {
                        uint[] characterSet = null;

                        // Get list of characters that need to be packed and rendered to the atlas texture.
                        if (m_CharacterSetSelectionMode == 7 || m_CharacterSetSelectionMode == 8)
                        {
                            List<uint> char_List = new List<uint>();

                            for (int i = 0; i < m_CharacterSequence.Length; i++)
                            {
                                uint unicode = m_CharacterSequence[i];

                                // Handle surrogate pairs
                                if (i < m_CharacterSequence.Length - 1 && char.IsHighSurrogate((char)unicode) && char.IsLowSurrogate(m_CharacterSequence[i + 1]))
                                {
                                    unicode = (uint)char.ConvertToUtf32(m_CharacterSequence[i], m_CharacterSequence[i + 1]);
                                    i += 1;
                                }

                                // Check to make sure we don't include duplicates
                                if (char_List.FindIndex(item => item == unicode) == -1)
                                    char_List.Add(unicode);
                            }

                            characterSet = char_List.ToArray();
                        }
                        else if (m_CharacterSetSelectionMode == 6)
                        {
                            characterSet = ParseHexNumberSequence(m_CharacterSequence);
                        }
                        else
                        {
                            characterSet = ParseNumberSequence(m_CharacterSequence);
                        }

                        m_CharacterCount = characterSet.Length;

                        m_AtlasGenerationProgress = 0;
                        m_IsProcessing = true;
                        m_IsGenerationCancelled = false;

                        GlyphLoadFlags glyphLoadFlags = ((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_HINTED) == GlyphRasterModes.RASTER_MODE_HINTED
                            ? GlyphLoadFlags.LOAD_RENDER
                            : GlyphLoadFlags.LOAD_RENDER | GlyphLoadFlags.LOAD_NO_HINTING;

                        glyphLoadFlags = ((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_MONO) == GlyphRasterModes.RASTER_MODE_MONO
                            ? glyphLoadFlags | GlyphLoadFlags.LOAD_MONOCHROME
                            : glyphLoadFlags;

                        //
                        AutoResetEvent autoEvent = new AutoResetEvent(false);

                        // Worker thread to pack glyphs in the given texture space.
                        ThreadPool.QueueUserWorkItem(PackGlyphs =>
                        {
                            // Start Stop Watch
                            m_StopWatch = System.Diagnostics.Stopwatch.StartNew();

                            // Clear the various lists used in the generation process.
                            m_AvailableGlyphsToAdd.Clear();
                            m_MissingCharacters.Clear();
                            m_ExcludedCharacters.Clear();
                            m_CharacterLookupMap.Clear();
                            m_GlyphLookupMap.Clear();
                            m_GlyphsToPack.Clear();
                            m_GlyphsPacked.Clear();

                            // Check if requested characters are available in the source font file.
                            for (int i = 0; i < characterSet.Length; i++)
                            {
                                uint unicode = characterSet[i];
                                uint glyphIndex;

                                if (FontEngine.TryGetGlyphIndex(unicode, out glyphIndex))
                                {
                                    // Skip over potential duplicate characters.
                                    if (m_CharacterLookupMap.ContainsKey(unicode))
                                        continue;

                                    // Add character to character lookup map.
                                    m_CharacterLookupMap.Add(unicode, glyphIndex);

                                    // Skip over potential duplicate glyph references.
                                    if (m_GlyphLookupMap.ContainsKey(glyphIndex))
                                    {
                                        // Add additional glyph reference for this character.
                                        m_GlyphLookupMap[glyphIndex].Add(unicode);
                                        continue;
                                    }

                                    // Add glyph reference to glyph lookup map.
                                    m_GlyphLookupMap.Add(glyphIndex, new List<uint>() { unicode });

                                    // Add glyph index to list of glyphs to add to texture.
                                    m_AvailableGlyphsToAdd.Add(glyphIndex);
                                }
                                else
                                {
                                    // Add Unicode to list of missing characters.
                                    m_MissingCharacters.Add(unicode);
                                }
                            }

                            // Pack available glyphs in the provided texture space.
                            if (m_AvailableGlyphsToAdd.Count > 0)
                            {
                                int packingModifier = ((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP ? 0 : 1;

                                if (m_PointSizeSamplingMode == 0) // Auto-Sizing Point Size Mode
                                {
                                    // Estimate min / max range for auto sizing of point size.
                                    int minPointSize = 0;
                                    int maxPointSize = (int)Mathf.Sqrt((m_AtlasWidth * m_AtlasHeight) / m_AvailableGlyphsToAdd.Count) * 3;

                                    m_PointSize = (maxPointSize + minPointSize) / 2;

                                    bool optimumPointSizeFound = false;
                                    for (int iteration = 0; iteration < 15 && optimumPointSizeFound == false; iteration++)
                                    {
                                        m_AtlasGenerationProgressLabel = "Packing glyphs - Preplaced (" + iteration + ")";

                                        FontEngine.SetFaceSize(m_PointSize);

                                        m_GlyphsToPack.Clear();
                                        m_GlyphsPacked.Clear();

                                        m_FreeGlyphRects.Clear();
                                        m_FreeGlyphRects.Add(new GlyphRect(0, 0, m_AtlasWidth - packingModifier, m_AtlasHeight - packingModifier));
                                        m_UsedGlyphRects.Clear();

                                        for (int i = 0; i < m_AvailableGlyphsToAdd.Count; i++)
                                        {
                                            uint glyphIndex = m_AvailableGlyphsToAdd[i];
                                            Glyph glyph;

                                            if (FontEngine.TryGetGlyphWithIndexValue(glyphIndex, glyphLoadFlags, out glyph))
                                            {
                                                if (glyph.glyphRect.width > 0 && glyph.glyphRect.height > 0)
                                                {
                                                    m_GlyphsToPack.Add(glyph);
                                                }
                                                else
                                                {
                                                    m_GlyphsPacked.Add(glyph);
                                                }
                                            }
                                        }

                                        FontEngine.TryPackGlyphsInAtlas(m_GlyphsToPack, m_GlyphsPacked, m_Padding, (GlyphPackingMode)m_PackingMode, m_GlyphRenderMode, m_AtlasWidth, m_AtlasHeight, m_FreeGlyphRects, m_UsedGlyphRects);

                                        if (m_IsGenerationCancelled)
                                        {
                                            DestroyImmediate(m_FontAtlasTexture);
                                            m_FontAtlasTexture = null;
                                            return;
                                        }

                                        //Debug.Log("Glyphs remaining to add [" + m_GlyphsToAdd.Count + "]. Glyphs added [" + m_GlyphsAdded.Count + "].");

                                        if (m_GlyphsToPack.Count > 0)
                                        {
                                            if (m_PointSize > minPointSize)
                                            {
                                                maxPointSize = m_PointSize;
                                                m_PointSize = (m_PointSize + minPointSize) / 2;

                                                //Debug.Log("Decreasing point size from [" + maxPointSize + "] to [" + m_PointSize + "].");
                                            }
                                        }
                                        else
                                        {
                                            if (maxPointSize - minPointSize > 1 && m_PointSize < maxPointSize)
                                            {
                                                minPointSize = m_PointSize;
                                                m_PointSize = (m_PointSize + maxPointSize) / 2;

                                                //Debug.Log("Increasing point size from [" + minPointSize + "] to [" + m_PointSize + "].");
                                            }
                                            else
                                            {
                                                //Debug.Log("[" + iteration + "] iterations to find the optimum point size of : [" + m_PointSize + "].");
                                                optimumPointSizeFound = true;
                                            }
                                        }
                                    }
                                }
                                else // Custom Point Size Mode
                                {
                                    m_AtlasGenerationProgressLabel = "Packing glyphs...";

                                    // Set point size
                                    FontEngine.SetFaceSize(m_PointSize);

                                    m_GlyphsToPack.Clear();
                                    m_GlyphsPacked.Clear();

                                    m_FreeGlyphRects.Clear();
                                    m_FreeGlyphRects.Add(new GlyphRect(0, 0, m_AtlasWidth - packingModifier, m_AtlasHeight - packingModifier));
                                    m_UsedGlyphRects.Clear();

                                    for (int i = 0; i < m_AvailableGlyphsToAdd.Count; i++)
                                    {
                                        uint glyphIndex = m_AvailableGlyphsToAdd[i];
                                        Glyph glyph;

                                        if (FontEngine.TryGetGlyphWithIndexValue(glyphIndex, glyphLoadFlags, out glyph))
                                        {
                                            if (glyph.glyphRect.width > 0 && glyph.glyphRect.height > 0)
                                            {
                                                m_GlyphsToPack.Add(glyph);
                                            }
                                            else
                                            {
                                                m_GlyphsPacked.Add(glyph);
                                            }
                                        }
                                    }

                                    FontEngine.TryPackGlyphsInAtlas(m_GlyphsToPack, m_GlyphsPacked, m_Padding, (GlyphPackingMode)m_PackingMode, m_GlyphRenderMode, m_AtlasWidth, m_AtlasHeight, m_FreeGlyphRects, m_UsedGlyphRects);

                                    if (m_IsGenerationCancelled)
                                    {
                                        DestroyImmediate(m_FontAtlasTexture);
                                        m_FontAtlasTexture = null;
                                        return;
                                    }
                                    //Debug.Log("Glyphs remaining to add [" + m_GlyphsToAdd.Count + "]. Glyphs added [" + m_GlyphsAdded.Count + "].");
                                }

                            }
                            else
                            {
                                int packingModifier = ((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP ? 0 : 1;

                                FontEngine.SetFaceSize(m_PointSize);

                                m_GlyphsToPack.Clear();
                                m_GlyphsPacked.Clear();

                                m_FreeGlyphRects.Clear();
                                m_FreeGlyphRects.Add(new GlyphRect(0, 0, m_AtlasWidth - packingModifier, m_AtlasHeight - packingModifier));
                                m_UsedGlyphRects.Clear();
                            }

                            //Stop StopWatch
                            m_StopWatch.Stop();
                            m_GlyphPackingGenerationTime = m_StopWatch.Elapsed.TotalMilliseconds;
                            m_IsGlyphPackingDone = true;
                            m_StopWatch.Reset();

                            m_FontCharacterTable.Clear();
                            m_FontGlyphTable.Clear();
                            m_GlyphsToRender.Clear();

                            // Add glyphs and characters successfully added to texture to their respective font tables.
                            foreach (Glyph glyph in m_GlyphsPacked)
                            {
                                uint glyphIndex = glyph.index;

                                m_FontGlyphTable.Add(glyph);

                                // Add glyphs to list of glyphs that need to be rendered.
                                if (glyph.glyphRect.width > 0 && glyph.glyphRect.height > 0)
                                    m_GlyphsToRender.Add(glyph);

                                foreach (uint unicode in m_GlyphLookupMap[glyphIndex])
                                {
                                    // Create new Character
                                    m_FontCharacterTable.Add(new TMP_Character(unicode, glyph));
                                }
                            }

                            //
                            foreach (Glyph glyph in m_GlyphsToPack)
                            {
                                foreach (uint unicode in m_GlyphLookupMap[glyph.index])
                                {
                                    m_ExcludedCharacters.Add(unicode);
                                }
                            }

                            // Get the face info for the current sampling point size.
                            m_FaceInfo = FontEngine.GetFaceInfo();

                            autoEvent.Set();
                        });

                        // Worker thread to render glyphs in texture buffer.
                        ThreadPool.QueueUserWorkItem(RenderGlyphs =>
                        {
                            autoEvent.WaitOne();

                            // Start Stop Watch
                            m_StopWatch = System.Diagnostics.Stopwatch.StartNew();

                            m_IsRenderingDone = false;

                            // Allocate texture data
                            m_AtlasTextureBuffer = new byte[m_AtlasWidth * m_AtlasHeight];

                            m_AtlasGenerationProgressLabel = "Rendering glyphs...";

                            // Render and add glyphs to the given atlas texture.
                            if (m_GlyphsToRender.Count > 0)
                            {
                                FontEngine.RenderGlyphsToTexture(m_GlyphsToRender, m_Padding, m_GlyphRenderMode, m_AtlasTextureBuffer, m_AtlasWidth, m_AtlasHeight);
                            }

                            m_IsRenderingDone = true;

                            // Stop StopWatch
                            m_StopWatch.Stop();
                            m_GlyphRenderingGenerationTime = m_StopWatch.Elapsed.TotalMilliseconds;
                            m_IsGlyphRenderingDone = true;
                            m_StopWatch.Reset();
                        });
                    }

                    SaveCreationSettingsToEditorPrefs(SaveFontCreationSettings());
                }
            }

            // FONT RENDERING PROGRESS BAR
            GUILayout.Space(1);
            Rect progressRect = EditorGUILayout.GetControlRect(false, 20);

            GUI.enabled = true;
            progressRect.width -= 22;
            EditorGUI.ProgressBar(progressRect, Mathf.Max(0.01f, m_AtlasGenerationProgress), m_AtlasGenerationProgressLabel);
            progressRect.x = progressRect.x + progressRect.width + 2;
            progressRect.y -= 1;
            progressRect.width = 20;
            progressRect.height = 20;

            GUI.enabled = m_IsProcessing;
            if (GUI.Button(progressRect, "X"))
            {
                FontEngine.SendCancellationRequest();
                m_AtlasGenerationProgress = 0;
                m_IsProcessing = false;
                m_IsGenerationCancelled = true;
            }
            GUILayout.Space(5);

            // FONT STATUS & INFORMATION
            GUI.enabled = true;

            GUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.Height(200));
            m_OutputScrollPosition = EditorGUILayout.BeginScrollView(m_OutputScrollPosition);
            EditorGUILayout.LabelField(m_OutputFeedback, TMP_UIStyleManager.label);
            EditorGUILayout.EndScrollView();
            GUILayout.EndVertical();

            // SAVE TEXTURE & CREATE and SAVE FONT XML FILE
            GUI.enabled = m_FontAtlasTexture != null && !m_IsProcessing;    // Enable Save Button if font_Atlas is not Null.

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Save") && GUI.enabled)
            {
                if (m_SelectedFontreplacedet == null)
                {
                    if (m_LegacyFontreplacedet != null)
                        SaveNewFontreplacedetWithSameName(m_LegacyFontreplacedet);
                    else
                        SaveNewFontreplacedet(m_SourceFontFile);
                }
                else
                {
                    // Save over exiting Font replacedet
                    string filePath = Path.GetFullPath(replacedetDatabase.GetreplacedetPath(m_SelectedFontreplacedet)).Replace('\\', '/');

                    if (((GlyphRasterModes)m_GlyphRenderMode & GlyphRasterModes.RASTER_MODE_BITMAP) == GlyphRasterModes.RASTER_MODE_BITMAP)
                            Save_Bitmap_Fontreplacedet(filePath);
                        else
                        Save_SDF_Fontreplacedet(filePath);
                }
            }
            if (GUILayout.Button("Save as...") && GUI.enabled)
            {
                if (m_SelectedFontreplacedet == null)
                {
                    SaveNewFontreplacedet(m_SourceFontFile);
                }
                else
                {
                    SaveNewFontreplacedetWithSameName(m_SelectedFontreplacedet);
                }
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.EndVertical();

            GUI.enabled = true; // Re-enable GUI

            if (position.height > position.width || position.width < k_TwoColumnControlsWidth)
            {
                DrawPreview();
                GUILayout.Space(5);
            }

            EditorGUILayout.EndScrollView();

            if (m_IsFontAtlasInvalid)
                ClearGeneratedData();
        }

19 View Source File : TMP_BaseShaderGUI.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

protected bool BeginPanel(string panel, ShaderFeature feature, bool expanded, bool readState = true)
        {
            EditorGUI.indentLevel = 0;

            if (readState)
            {
                feature.ReadState(m_Material);
            }

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.BeginHorizontal();

            Rect r = EditorGUI.IndentedRect(GUILayoutUtility.GetRect(20, 20, GUILayout.Width(20f)));
            bool active = EditorGUI.Toggle(r, feature.Active);

            if (EditorGUI.EndChangeCheck())
            {
                m_Editor.RegisterPropertyChangeUndo(feature.undoLabel);
                feature.SetActive(active, m_Material);
            }

            r = EditorGUI.IndentedRect(GUILayoutUtility.GetRect(20, 18));
            r.width += 6;

            bool enabled = GUI.enabled;
            GUI.enabled = true;
            expanded = TMP_EditorUtility.EditorToggle(r, expanded, new GUIContent(panel), TMP_UIStyleManager.panelreplacedle);
            r.width -= 10;
            EditorGUI.LabelField(r, new GUIContent(expanded ? s_PanelStateLabel[0] : s_PanelStateLabel[1]), TMP_UIStyleManager.rightLabel);
            GUI.enabled = enabled;

            GUILayout.EndHorizontal();

            EditorGUI.indentLevel += 1;
            EditorGUI.BeginDisabledGroup(!active);

            return expanded;
        }

19 View Source File : TMP_FontAssetEditor.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

public override void OnInspectorGUI()
        {
            //Debug.Log("OnInspectorGUI Called.");

            Event currentEvent = Event.current;

            serializedObject.Update();

            Rect rect = EditorGUILayout.GetControlRect(false, 24);
            float labelWidth = EditorGUIUtility.labelWidth;
            float fieldWidth = EditorGUIUtility.fieldWidth;

            // FACE INFO PANEL
            #region Face info
            GUI.Label(rect, new GUIContent("<b>Face Info</b> - v" + m_fontreplacedet.version), TMP_UIStyleManager.sectionHeader);

            rect.x += rect.width - 132f;
            rect.y += 2;
            rect.width = 130f;
            rect.height = 18f;
            if (GUI.Button(rect, new GUIContent("Update Atlas Texture")))
            {
                TMPro_FontreplacedetCreatorWindow.ShowFontAtlasCreatorWindow(target as TMP_Fontreplacedet);
            }

            EditorGUI.indentLevel = 1;
            GUI.enabled = false; // Lock UI

            // TODO : Consider creating a property drawer for these.
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_FamilyName"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_StyleName"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_PointSize"));

            GUI.enabled = true;

            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_Scale"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_LineHeight"));

            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_AscentLine"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_CapLine"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_MeanLine"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_Baseline"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_DescentLine"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_UnderlineOffset"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_UnderlineThickness"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_StrikethroughOffset"));
            //EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("strikethroughThickness"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_SuperscriptOffset"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_SuperscriptSize"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_SubscriptOffset"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_SubscriptSize"));
            EditorGUILayout.PropertyField(m_FaceInfo_prop.FindPropertyRelative("m_TabWidth"));
            // TODO : Add clamping for some of these values.
            //subSize_prop.floatValue = Mathf.Clamp(subSize_prop.floatValue, 0.25f, 1f);

            EditorGUILayout.Space();
            #endregion

            // GENERATION SETTINGS
            #region Generation Settings
            rect = EditorGUILayout.GetControlRect(false, 24);

            if (GUI.Button(rect, new GUIContent("<b>Generation Settings</b>"), TMP_UIStyleManager.sectionHeader))
                UI_PanelState.generationSettingsPanel = !UI_PanelState.generationSettingsPanel;

            GUI.Label(rect, (UI_PanelState.generationSettingsPanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);

            if (UI_PanelState.generationSettingsPanel)
            {
                EditorGUI.indentLevel = 1;

                EditorGUI.BeginChangeCheck();
                Font sourceFont = (Font)EditorGUILayout.ObjectField("Source Font File", m_fontreplacedet.m_SourceFontFile_EditorRef, typeof(Font), false);
                if (EditorGUI.EndChangeCheck())
                {
                    string guid = replacedetDatabase.replacedetPathToGUID(replacedetDatabase.GetreplacedetPath(sourceFont));
                    m_fontreplacedet.m_SourceFontFileGUID = guid;
                    m_fontreplacedet.m_SourceFontFile_EditorRef = sourceFont;
                }

                EditorGUI.BeginDisabledGroup(sourceFont == null);
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(m_AtlasPopulationMode_prop, new GUIContent("Atlas Population Mode"));
                    if (EditorGUI.EndChangeCheck())
                    {
                        serializedObject.ApplyModifiedProperties();

                        bool isDatabaseRefreshRequired = false;

                        if (m_AtlasPopulationMode_prop.intValue == 0)
                        {
                            m_fontreplacedet.sourceFontFile = null;

                            //Set atlas textures to non readable.
                            for (int i = 0; i < m_fontreplacedet.atlasTextures.Length; i++)
                            {
                                Texture2D tex = m_fontreplacedet.atlasTextures[i];

                                if (tex != null && tex.isReadable)
                                    FontEngineEditorUtilities.SetAtlasTextureIsReadable(tex, false);
                            }

                            Debug.Log("Atlas Population mode set to [Static].");
                        }
                        else if (m_AtlasPopulationMode_prop.intValue == 1)
                        {
                            if (m_fontreplacedet.m_SourceFontFile_EditorRef.dynamic == false)
                            {
                                Debug.LogWarning("Please set the [" + m_fontreplacedet.name + "] font to dynamic mode as this is required for Dynamic SDF support.", m_fontreplacedet.m_SourceFontFile_EditorRef);
                                m_AtlasPopulationMode_prop.intValue = 0;

                                serializedObject.ApplyModifiedProperties();
                            }
                            else
                            {
                                m_fontreplacedet.sourceFontFile = m_fontreplacedet.m_SourceFontFile_EditorRef;

                                // Set atlas textures to non readable.
                                for (int i = 0; i < m_fontreplacedet.atlasTextures.Length; i++)
                                {
                                    Texture2D tex = m_fontreplacedet.atlasTextures[i];

                                    if (tex != null && tex.isReadable == false)
                                        FontEngineEditorUtilities.SetAtlasTextureIsReadable(tex, true);
                                }

                                Debug.Log("Atlas Population mode set to [Dynamic].");
                            }
                        }

                        if (isDatabaseRefreshRequired)
                            replacedetDatabase.Refresh();

                        serializedObject.Update();
                        isreplacedetDirty = true;
                    }

                    // Save state of atlas settings
                    if (m_DisplayDestructiveChangeWarning == false)
                    {
                        SavedAtlasGenerationSettings();
                        //Undo.RegisterCompleteObjectUndo(m_fontreplacedet, "Font replacedet Changes");
                    }

                    EditorGUI.BeginDisabledGroup(m_AtlasPopulationMode_prop.intValue == (int)AtlasPopulationMode.Static);
                    {
                        EditorGUI.BeginChangeCheck();
                        // TODO: Switch shaders depending on GlyphRenderMode.
                        EditorGUILayout.PropertyField(m_AtlasRenderMode_prop);
                        EditorGUILayout.PropertyField(m_SamplingPointSize_prop, new GUIContent("Sampling Point Size"));
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_DisplayDestructiveChangeWarning = true;
                        }

                        // Changes to these properties require updating Material Presets for this font replacedet.
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PropertyField(m_AtlasPadding_prop, new GUIContent("Padding"));
                        EditorGUILayout.IntPopup(m_AtlasWidth_prop, m_AtlasResolutionLabels, m_AtlasResolutions, new GUIContent("Atlas Width"));
                        EditorGUILayout.IntPopup(m_AtlasHeight_prop, m_AtlasResolutionLabels, m_AtlasResolutions, new GUIContent("Atlas Height"));
                        EditorGUILayout.PropertyField(m_IsMultiAtlasTexturesEnabled_prop, new GUIContent("Multi Atlas Textures", "Determines if the font replacedet will store glyphs in multiple atlas textures."));
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_MaterialPresetsRequireUpdate = true;
                            m_DisplayDestructiveChangeWarning = true;
                        }

                        if (m_DisplayDestructiveChangeWarning)
                        {
                            // These changes are destructive on the font replacedet
                            rect = EditorGUILayout.GetControlRect(false, 60);
                            rect.x += 15;
                            rect.width -= 15;
                            EditorGUI.HelpBox(rect, "Changing these settings will clear the font replacedet's character, glyph and texture data.", MessageType.Warning);

                            if (GUI.Button(new Rect(rect.width - 140, rect.y + 36, 80, 18), new GUIContent("Apply")))
                            {
                                m_DisplayDestructiveChangeWarning = false;

                                // Update face info is sampling point size was changed.
                                if (m_Atlreplacedettings.pointSize != m_SamplingPointSize_prop.intValue)
                                {
                                    FontEngine.LoadFontFace(m_fontreplacedet.sourceFontFile, m_SamplingPointSize_prop.intValue);
                                    m_fontreplacedet.faceInfo = FontEngine.GetFaceInfo();
                                }

                                // Update material
                                m_fontreplacedet.material.SetFloat(ShaderUtilities.ID_TextureWidth, m_AtlasWidth_prop.intValue);
                                m_fontreplacedet.material.SetFloat(ShaderUtilities.ID_TextureHeight, m_AtlasHeight_prop.intValue);
                                m_fontreplacedet.material.SetFloat(ShaderUtilities.ID_GradientScale, m_AtlasPadding_prop.intValue + 1);

                                // Update material presets if any of the relevant properties have been changed.
                                if (m_MaterialPresetsRequireUpdate)
                                {
                                    m_MaterialPresetsRequireUpdate = false;

                                    Material[] materialPresets = TMP_EditorUtility.FindMaterialReferences(m_fontreplacedet);
                                    for (int i = 0; i < materialPresets.Length; i++)
                                    {
                                        Material mat = materialPresets[i];

                                        mat.SetFloat(ShaderUtilities.ID_TextureWidth, m_AtlasWidth_prop.intValue);
                                        mat.SetFloat(ShaderUtilities.ID_TextureHeight, m_AtlasHeight_prop.intValue);
                                        mat.SetFloat(ShaderUtilities.ID_GradientScale, m_AtlasPadding_prop.intValue + 1);
                                    }
                                }

                                m_fontreplacedet.UpdateFontreplacedetData();
                                GUIUtility.keyboardControl = 0;
                                isreplacedetDirty = true;

                                // Update Font replacedet Creation Settings to reflect new changes.
                                UpdateFontreplacedetCreationSettings();

                                // TODO: Clear undo buffers.
                                //Undo.ClearUndo(m_fontreplacedet);
                            }

                            if (GUI.Button(new Rect(rect.width - 56, rect.y + 36, 80, 18), new GUIContent("Revert")))
                            {
                                m_DisplayDestructiveChangeWarning = false;
                                RestoreAtlasGenerationSettings();
                                GUIUtility.keyboardControl = 0;

                                // TODO: Clear undo buffers.
                                //Undo.ClearUndo(m_fontreplacedet);
                            }
                        }
                    }
                    EditorGUI.EndDisabledGroup();
                }
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.Space();
            }
            #endregion

            // ATLAS & MATERIAL PANEL
            #region Atlas & Material
            rect = EditorGUILayout.GetControlRect(false, 24);

            if (GUI.Button(rect, new GUIContent("<b>Atlas & Material</b>"), TMP_UIStyleManager.sectionHeader))
                UI_PanelState.fontAtlasInfoPanel = !UI_PanelState.fontAtlasInfoPanel;

            GUI.Label(rect, (UI_PanelState.fontAtlasInfoPanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);

            if (UI_PanelState.fontAtlasInfoPanel)
            {
                EditorGUI.indentLevel = 1;

                GUI.enabled = false;
                EditorGUILayout.PropertyField(font_atlas_prop, new GUIContent("Font Atlas"));
                EditorGUILayout.PropertyField(font_material_prop, new GUIContent("Font Material"));
                GUI.enabled = true;
                EditorGUILayout.Space();
            }
            #endregion

            string evt_cmd = Event.current.commandName; // Get Current Event CommandName to check for Undo Events

            // FONT WEIGHT PANEL
            #region Font Weights
            rect = EditorGUILayout.GetControlRect(false, 24);

            if (GUI.Button(rect, new GUIContent("<b>Font Weights</b>", "The Font replacedets that will be used for different font weights and the settings used to simulate a typeface when no replacedet is available."), TMP_UIStyleManager.sectionHeader))
                UI_PanelState.fontWeightPanel = !UI_PanelState.fontWeightPanel;

            GUI.Label(rect, (UI_PanelState.fontWeightPanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);

            if (UI_PanelState.fontWeightPanel)
            {
                EditorGUIUtility.labelWidth *= 0.75f;
                EditorGUIUtility.fieldWidth *= 0.25f;

                EditorGUILayout.BeginVertical();
                EditorGUI.indentLevel = 1;
                rect = EditorGUILayout.GetControlRect(true);
                rect.x += EditorGUIUtility.labelWidth;
                rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2f;
                GUI.Label(rect, "Regular Typeface", EditorStyles.label);
                rect.x += rect.width;
                GUI.Label(rect, "Italic Typeface", EditorStyles.label);

                EditorGUI.indentLevel = 1;

                EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(1), new GUIContent("100 - Thin"));
                EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(2), new GUIContent("200 - Extra-Light"));
                EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(3), new GUIContent("300 - Light"));
                EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(4), new GUIContent("400 - Regular"));
                EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(5), new GUIContent("500 - Medium"));
                EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(6), new GUIContent("600 - Semi-Bold"));
                EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(7), new GUIContent("700 - Bold"));
                EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(8), new GUIContent("800 - Heavy"));
                EditorGUILayout.PropertyField(fontWeights_prop.GetArrayElementAtIndex(9), new GUIContent("900 - Black"));

                EditorGUILayout.EndVertical();

                EditorGUILayout.Space();

                EditorGUILayout.BeginVertical();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(font_normalStyle_prop, new GUIContent("Normal Weight"));
                font_normalStyle_prop.floatValue = Mathf.Clamp(font_normalStyle_prop.floatValue, -3.0f, 3.0f);
                if (GUI.changed || evt_cmd == k_UndoRedo)
                {
                    GUI.changed = false;

                    // Modify the material property on matching material presets.
                    for (int i = 0; i < m_materialPresets.Length; i++)
                        m_materialPresets[i].SetFloat("_WeightNormal", font_normalStyle_prop.floatValue);
                }

                EditorGUILayout.PropertyField(font_boldStyle_prop, new GUIContent("Bold Weight"));
                font_boldStyle_prop.floatValue = Mathf.Clamp(font_boldStyle_prop.floatValue, -3.0f, 3.0f);
                if (GUI.changed || evt_cmd == k_UndoRedo)
                {
                    GUI.changed = false;

                    // Modify the material property on matching material presets.
                    for (int i = 0; i < m_materialPresets.Length; i++)
                        m_materialPresets[i].SetFloat("_WeightBold", font_boldStyle_prop.floatValue);
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(font_normalSpacing_prop, new GUIContent("Spacing Offset"));
                font_normalSpacing_prop.floatValue = Mathf.Clamp(font_normalSpacing_prop.floatValue, -100, 100);
                if (GUI.changed || evt_cmd == k_UndoRedo)
                {
                    GUI.changed = false;
                }

                EditorGUILayout.PropertyField(font_boldSpacing_prop, new GUIContent("Bold Spacing"));
                font_boldSpacing_prop.floatValue = Mathf.Clamp(font_boldSpacing_prop.floatValue, 0, 100);
                if (GUI.changed || evt_cmd == k_UndoRedo)
                {
                    GUI.changed = false;
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(font_italicStyle_prop, new GUIContent("Italic Style"));
                font_italicStyle_prop.intValue = Mathf.Clamp(font_italicStyle_prop.intValue, 15, 60);

                EditorGUILayout.PropertyField(font_tabSize_prop, new GUIContent("Tab Multiple"));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
                EditorGUILayout.Space();
            }

            EditorGUIUtility.labelWidth = 0;
            EditorGUIUtility.fieldWidth = 0;
            #endregion

            // FALLBACK FONT replacedETS
            #region Fallback Font replacedet
            rect = EditorGUILayout.GetControlRect(false, 24);
            EditorGUI.indentLevel = 0;
            if (GUI.Button(rect, new GUIContent("<b>Fallback Font replacedets</b>", "Select the Font replacedets that will be searched and used as fallback when characters are missing from this font replacedet."), TMP_UIStyleManager.sectionHeader))
                UI_PanelState.fallbackFontreplacedetPanel = !UI_PanelState.fallbackFontreplacedetPanel;

            GUI.Label(rect, (UI_PanelState.fallbackFontreplacedetPanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);

            if (UI_PanelState.fallbackFontreplacedetPanel)
            {
                EditorGUIUtility.labelWidth = 120;
                EditorGUI.indentLevel = 0;

                m_list.DoLayoutList();
                EditorGUILayout.Space();
            }
            #endregion

            // CHARACTER TABLE TABLE
            #region Character Table
            EditorGUIUtility.labelWidth = labelWidth;
            EditorGUIUtility.fieldWidth = fieldWidth;
            EditorGUI.indentLevel = 0;
            rect = EditorGUILayout.GetControlRect(false, 24);

            int characterCount = m_fontreplacedet.characterTable.Count;

            if (GUI.Button(rect, new GUIContent("<b>Character Table</b>   [" + characterCount + "]" + (rect.width > 320 ? " Characters" : ""), "List of characters contained in this font replacedet."), TMP_UIStyleManager.sectionHeader))
                UI_PanelState.characterTablePanel = !UI_PanelState.characterTablePanel;

            GUI.Label(rect, (UI_PanelState.characterTablePanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);

            if (UI_PanelState.characterTablePanel)
            {
                int arraySize = m_CharacterTable_prop.arraySize;
                int itemsPerPage = 15;

                // Display Glyph Management Tools
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    // Search Bar implementation
                    #region DISPLAY SEARCH BAR
                    EditorGUILayout.BeginHorizontal();
                    {
                        EditorGUIUtility.labelWidth = 130f;
                        EditorGUI.BeginChangeCheck();
                        string searchPattern = EditorGUILayout.TextField("Character Search", m_CharacterSearchPattern, "SearchTextField");
                        if (EditorGUI.EndChangeCheck() || m_isSearchDirty)
                        {
                            if (string.IsNullOrEmpty(searchPattern) == false)
                            {
                                m_CharacterSearchPattern = searchPattern;

                                // Search Character Table for potential matches
                                SearchCharacterTable (m_CharacterSearchPattern, ref m_CharacterSearchList);
                            }
                            else
                                m_CharacterSearchPattern = null;

                            m_isSearchDirty = false;
                        }

                        string styleName = string.IsNullOrEmpty(m_CharacterSearchPattern) ? "SearchCancelButtonEmpty" : "SearchCancelButton";
                        if (GUILayout.Button(GUIContent.none, styleName))
                        {
                            GUIUtility.keyboardControl = 0;
                            m_CharacterSearchPattern = string.Empty;
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                    #endregion

                    // Display Page Navigation
                    if (!string.IsNullOrEmpty(m_CharacterSearchPattern))
                        arraySize = m_CharacterSearchList.Count;

                    DisplayPageNavigation(ref m_CurrentCharacterPage, arraySize, itemsPerPage);
                }
                EditorGUILayout.EndVertical();

                // Display Character Table Elements
                if (arraySize > 0)
                {
                    // Display each character entry using the CharacterPropertyDrawer.
                    for (int i = itemsPerPage * m_CurrentCharacterPage; i < arraySize && i < itemsPerPage * (m_CurrentCharacterPage + 1); i++)
                    {
                        // Define the start of the selection region of the element.
                        Rect elementStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));

                        int elementIndex = i;
                        if (!string.IsNullOrEmpty(m_CharacterSearchPattern))
                            elementIndex = m_CharacterSearchList[i];

                        SerializedProperty characterProperty = m_CharacterTable_prop.GetArrayElementAtIndex(elementIndex);

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                        EditorGUI.BeginDisabledGroup(i != m_SelectedCharacterRecord);
                        {
                            EditorGUILayout.PropertyField(characterProperty);
                        }
                        EditorGUI.EndDisabledGroup();

                        EditorGUILayout.EndVertical();

                        // Define the end of the selection region of the element.
                        Rect elementEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));

                        // Check for Item selection
                        Rect selectionArea = new Rect(elementStartRegion.x, elementStartRegion.y, elementEndRegion.width, elementEndRegion.y - elementStartRegion.y);
                        if (DoSelectionCheck(selectionArea))
                        {
                            if (m_SelectedCharacterRecord == i)
                                m_SelectedCharacterRecord = -1;
                            else
                            {
                                m_SelectedCharacterRecord = i;
                                m_AddCharacterWarning.isEnabled = false;
                                m_unicodeHexLabel = k_placeholderUnicodeHex;
                                GUIUtility.keyboardControl = 0;
                            }
                        }

                        // Draw Selection Highlight and Glyph Options
                        if (m_SelectedCharacterRecord == i)
                        {
                            TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));

                            // Draw Glyph management options
                            Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * 1f);
                            float optionAreaWidth = controlRect.width * 0.6f;
                            float btnWidth = optionAreaWidth / 3;

                            Rect position = new Rect(controlRect.x + controlRect.width * .4f, controlRect.y, btnWidth, controlRect.height);

                            // Copy Selected Glyph to Target Glyph ID
                            GUI.enabled = !string.IsNullOrEmpty(m_dstUnicode);
                            if (GUI.Button(position, new GUIContent("Copy to")))
                            {
                                GUIUtility.keyboardControl = 0;

                                // Convert Hex Value to Decimal
                                int dstGlyphID = TMP_TextUtilities.StringHexToInt(m_dstUnicode);

                                //Add new glyph at target Unicode hex id.
                                if (!AddNewCharacter(elementIndex, dstGlyphID))
                                {
                                    m_AddCharacterWarning.isEnabled = true;
                                    m_AddCharacterWarning.expirationTime = EditorApplication.timeSinceStartup + 1;
                                }

                                m_dstUnicode = string.Empty;
                                m_isSearchDirty = true;

                                TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, m_fontreplacedet);
                            }

                            // Target Glyph ID
                            GUI.enabled = true;
                            position.x += btnWidth;

                            GUI.SetNextControlName("CharacterID_Input");
                            m_dstUnicode = EditorGUI.TextField(position, m_dstUnicode);

                            // Placeholder text
                            EditorGUI.LabelField(position, new GUIContent(m_unicodeHexLabel, "The Unicode (Hex) ID of the duplicated Character"), TMP_UIStyleManager.label);

                            // Only filter the input when the destination glyph ID text field has focus.
                            if (GUI.GetNameOfFocusedControl() == "CharacterID_Input")
                            {
                                m_unicodeHexLabel = string.Empty;

                                //Filter out unwanted characters.
                                char chr = Event.current.character;
                                if ((chr < '0' || chr > '9') && (chr < 'a' || chr > 'f') && (chr < 'A' || chr > 'F'))
                                {
                                    Event.current.character = '\0';
                                }
                            }
                            else
                            {
                                m_unicodeHexLabel = k_placeholderUnicodeHex;
                                //m_dstUnicode = string.Empty;
                            }


                            // Remove Glyph
                            position.x += btnWidth;
                            if (GUI.Button(position, "Remove"))
                            {
                                GUIUtility.keyboardControl = 0;

                                RemoveCharacterFromList(elementIndex);

                                isreplacedetDirty = true;
                                m_SelectedCharacterRecord = -1;
                                m_isSearchDirty = true;
                                break;
                            }

                            if (m_AddCharacterWarning.isEnabled && EditorApplication.timeSinceStartup < m_AddCharacterWarning.expirationTime)
                            {
                                EditorGUILayout.HelpBox("The Destination Character ID already exists", MessageType.Warning);
                            }

                        }
                    }
                }

                DisplayPageNavigation(ref m_CurrentCharacterPage, arraySize, itemsPerPage);

                EditorGUILayout.Space();
            }
            #endregion

            // GLYPH TABLE
            #region Glyph Table
            EditorGUIUtility.labelWidth = labelWidth;
            EditorGUIUtility.fieldWidth = fieldWidth;
            EditorGUI.indentLevel = 0;
            rect = EditorGUILayout.GetControlRect(false, 24);

            GUIStyle glyphPanelStyle = new GUIStyle(EditorStyles.helpBox);

            int glyphCount = m_fontreplacedet.glyphTable.Count;

            if (GUI.Button(rect, new GUIContent("<b>Glyph Table</b>   [" + glyphCount + "]" + (rect.width > 275 ? " Glyphs" : ""), "List of glyphs contained in this font replacedet."), TMP_UIStyleManager.sectionHeader))
                UI_PanelState.glyphTablePanel = !UI_PanelState.glyphTablePanel;

            GUI.Label(rect, (UI_PanelState.glyphTablePanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);

            if (UI_PanelState.glyphTablePanel)
            {
                int arraySize = m_GlyphTable_prop.arraySize;
                int itemsPerPage = 15;

                // Display Glyph Management Tools
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    // Search Bar implementation
                    #region DISPLAY SEARCH BAR
                    EditorGUILayout.BeginHorizontal();
                    {
                        EditorGUIUtility.labelWidth = 130f;
                        EditorGUI.BeginChangeCheck();
                        string searchPattern = EditorGUILayout.TextField("Glyph Search", m_GlyphSearchPattern, "SearchTextField");
                        if (EditorGUI.EndChangeCheck() || m_isSearchDirty)
                        {
                            if (string.IsNullOrEmpty(searchPattern) == false)
                            {
                                m_GlyphSearchPattern = searchPattern;

                                // Search Glyph Table for potential matches
                                SearchGlyphTable(m_GlyphSearchPattern, ref m_GlyphSearchList);
                            }
                            else
                                m_GlyphSearchPattern = null;

                            m_isSearchDirty = false;
                        }

                        string styleName = string.IsNullOrEmpty(m_GlyphSearchPattern) ? "SearchCancelButtonEmpty" : "SearchCancelButton";
                        if (GUILayout.Button(GUIContent.none, styleName))
                        {
                            GUIUtility.keyboardControl = 0;
                            m_GlyphSearchPattern = string.Empty;
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                    #endregion

                    // Display Page Navigation
                    if (!string.IsNullOrEmpty(m_GlyphSearchPattern))
                        arraySize = m_GlyphSearchList.Count;

                    DisplayPageNavigation(ref m_CurrentGlyphPage, arraySize, itemsPerPage);
                }
                EditorGUILayout.EndVertical();

                // Display Glyph Table Elements

                if (arraySize > 0)
                {
                    // Display each GlyphInfo entry using the GlyphInfo property drawer.
                    for (int i = itemsPerPage * m_CurrentGlyphPage; i < arraySize && i < itemsPerPage * (m_CurrentGlyphPage + 1); i++)
                    {
                        // Define the start of the selection region of the element.
                        Rect elementStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));

                        int elementIndex = i;
                        if (!string.IsNullOrEmpty(m_GlyphSearchPattern))
                            elementIndex = m_GlyphSearchList[i];

                        SerializedProperty glyphProperty = m_GlyphTable_prop.GetArrayElementAtIndex(elementIndex);

                        EditorGUILayout.BeginVertical(glyphPanelStyle);

                        using (new EditorGUI.DisabledScope(i != m_SelectedGlyphRecord))
                        {
                            EditorGUILayout.PropertyField(glyphProperty);
                        }

                        EditorGUILayout.EndVertical();

                        // Define the end of the selection region of the element.
                        Rect elementEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));

                        // Check for Item selection
                        Rect selectionArea = new Rect(elementStartRegion.x, elementStartRegion.y, elementEndRegion.width, elementEndRegion.y - elementStartRegion.y);
                        if (DoSelectionCheck(selectionArea))
                        {
                            if (m_SelectedGlyphRecord == i)
                                m_SelectedGlyphRecord = -1;
                            else
                            {
                                m_SelectedGlyphRecord = i;
                                m_AddGlyphWarning.isEnabled = false;
                                m_unicodeHexLabel = k_placeholderUnicodeHex;
                                GUIUtility.keyboardControl = 0;
                            }
                        }

                        // Draw Selection Highlight and Glyph Options
                        if (m_SelectedGlyphRecord == i)
                        {
                            TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));

                            // Draw Glyph management options
                            Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * 1f);
                            float optionAreaWidth = controlRect.width * 0.6f;
                            float btnWidth = optionAreaWidth / 3;

                            Rect position = new Rect(controlRect.x + controlRect.width * .4f, controlRect.y, btnWidth, controlRect.height);

                            // Copy Selected Glyph to Target Glyph ID
                            GUI.enabled = !string.IsNullOrEmpty(m_dstGlyphID);
                            if (GUI.Button(position, new GUIContent("Copy to")))
                            {
                                GUIUtility.keyboardControl = 0;
                                int dstGlyphID;

                                // Convert Hex Value to Decimal
                                int.TryParse(m_dstGlyphID, out dstGlyphID);

                                //Add new glyph at target Unicode hex id.
                                if (!AddNewGlyph(elementIndex, dstGlyphID))
                                {
                                    m_AddGlyphWarning.isEnabled = true;
                                    m_AddGlyphWarning.expirationTime = EditorApplication.timeSinceStartup + 1;
                                }

                                m_dstGlyphID = string.Empty;
                                m_isSearchDirty = true;

                                TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, m_fontreplacedet);
                            }

                            // Target Glyph ID
                            GUI.enabled = true;
                            position.x += btnWidth;

                            GUI.SetNextControlName("GlyphID_Input");
                            m_dstGlyphID = EditorGUI.TextField(position, m_dstGlyphID);

                            // Placeholder text
                            EditorGUI.LabelField(position, new GUIContent(m_GlyphIDLabel, "The Glyph ID of the duplicated Glyph"), TMP_UIStyleManager.label);

                            // Only filter the input when the destination glyph ID text field has focus.
                            if (GUI.GetNameOfFocusedControl() == "GlyphID_Input")
                            {
                                m_GlyphIDLabel = string.Empty;

                                //Filter out unwanted characters.
                                char chr = Event.current.character;
                                if ((chr < '0' || chr > '9'))
                                {
                                    Event.current.character = '\0';
                                }
                            }
                            else
                            {
                                m_GlyphIDLabel = k_placeholderGlyphID;
                                //m_dstGlyphID = string.Empty;
                            }

                            // Remove Glyph
                            position.x += btnWidth;
                            if (GUI.Button(position, "Remove"))
                            {
                                GUIUtility.keyboardControl = 0;

                                RemoveGlyphFromList(elementIndex);

                                isreplacedetDirty = true;
                                m_SelectedGlyphRecord = -1;
                                m_isSearchDirty = true;
                                break;
                            }

                            if (m_AddGlyphWarning.isEnabled && EditorApplication.timeSinceStartup < m_AddGlyphWarning.expirationTime)
                            {
                                EditorGUILayout.HelpBox("The Destination Glyph ID already exists", MessageType.Warning);
                            }

                        }
                    }
                }

                DisplayPageNavigation(ref m_CurrentGlyphPage, arraySize, itemsPerPage);

                EditorGUILayout.Space();
            }
            #endregion

            // FONT FEATURE TABLE
            #region Font Feature Table
            EditorGUIUtility.labelWidth = labelWidth;
            EditorGUIUtility.fieldWidth = fieldWidth;
            EditorGUI.indentLevel = 0;
            rect = EditorGUILayout.GetControlRect(false, 24);

            int adjustmentPairCount = m_fontreplacedet.fontFeatureTable.glyphPairAdjustmentRecords.Count;

            if (GUI.Button(rect, new GUIContent("<b>Glyph Adjustment Table</b>   [" + adjustmentPairCount + "]" + (rect.width > 340 ? " Records" : ""), "List of glyph adjustment / advanced kerning pairs."), TMP_UIStyleManager.sectionHeader))
                UI_PanelState.fontFeatureTablePanel = !UI_PanelState.fontFeatureTablePanel;

            GUI.Label(rect, (UI_PanelState.fontFeatureTablePanel ? "" : s_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);

            if (UI_PanelState.fontFeatureTablePanel)
            {
                int arraySize = m_GlyphPairAdjustmentRecords_prop.arraySize;
                int itemsPerPage = 20;

                // Display Kerning Pair Management Tools
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    // Search Bar implementation
                    #region DISPLAY SEARCH BAR
                    EditorGUILayout.BeginHorizontal();
                    {
                        EditorGUIUtility.labelWidth = 150f;
                        EditorGUI.BeginChangeCheck();
                        string searchPattern = EditorGUILayout.TextField("Adjustment Pair Search", m_KerningTableSearchPattern, "SearchTextField");
                        if (EditorGUI.EndChangeCheck() || m_isSearchDirty)
                        {
                            if (string.IsNullOrEmpty(searchPattern) == false)
                            {
                                m_KerningTableSearchPattern = searchPattern;

                                // Search Glyph Table for potential matches
                                SearchKerningTable(m_KerningTableSearchPattern, ref m_KerningTableSearchList);
                            }
                            else
                                m_KerningTableSearchPattern = null;

                            m_isSearchDirty = false;
                        }

                        string styleName = string.IsNullOrEmpty(m_KerningTableSearchPattern) ? "SearchCancelButtonEmpty" : "SearchCancelButton";
                        if (GUILayout.Button(GUIContent.none, styleName))
                        {
                            GUIUtility.keyboardControl = 0;
                            m_KerningTableSearchPattern = string.Empty;
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                    #endregion

                    // Display Page Navigation
                    if (!string.IsNullOrEmpty(m_KerningTableSearchPattern))
                        arraySize = m_KerningTableSearchList.Count;

                    DisplayPageNavigation(ref m_CurrentKerningPage, arraySize, itemsPerPage);
                }
                EditorGUILayout.EndVertical();

                if (arraySize > 0)
                {
                    // Display each GlyphInfo entry using the GlyphInfo property drawer.
                    for (int i = itemsPerPage * m_CurrentKerningPage; i < arraySize && i < itemsPerPage * (m_CurrentKerningPage + 1); i++)
                    {
                        // Define the start of the selection region of the element.
                        Rect elementStartRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));

                        int elementIndex = i;
                        if (!string.IsNullOrEmpty(m_KerningTableSearchPattern))
                            elementIndex = m_KerningTableSearchList[i];

                        SerializedProperty pairAdjustmentRecordProperty = m_GlyphPairAdjustmentRecords_prop.GetArrayElementAtIndex(elementIndex);

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                        using (new EditorGUI.DisabledScope(i != m_SelectedAdjustmentRecord))
                        {
                            EditorGUILayout.PropertyField(pairAdjustmentRecordProperty, new GUIContent("Selectable"));
                        }

                        EditorGUILayout.EndVertical();

                        // Define the end of the selection region of the element.
                        Rect elementEndRegion = GUILayoutUtility.GetRect(0f, 0f, GUILayout.ExpandWidth(true));

                        // Check for Item selection
                        Rect selectionArea = new Rect(elementStartRegion.x, elementStartRegion.y, elementEndRegion.width, elementEndRegion.y - elementStartRegion.y);
                        if (DoSelectionCheck(selectionArea))
                        {
                            if (m_SelectedAdjustmentRecord == i)
                            {
                                m_SelectedAdjustmentRecord = -1;
                            }
                            else
                            {
                                m_SelectedAdjustmentRecord = i;
                                GUIUtility.keyboardControl = 0;
                            }
                        }

                        // Draw Selection Highlight and Kerning Pair Options
                        if (m_SelectedAdjustmentRecord == i)
                        {
                            TMP_EditorUtility.DrawBox(selectionArea, 2f, new Color32(40, 192, 255, 255));

                            // Draw Glyph management options
                            Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * 1f);
                            float optionAreaWidth = controlRect.width;
                            float btnWidth = optionAreaWidth / 4;

                            Rect position = new Rect(controlRect.x + controlRect.width - btnWidth, controlRect.y, btnWidth, controlRect.height);

                            // Remove Kerning pair
                            GUI.enabled = true;
                            if (GUI.Button(position, "Remove"))
                            {
                                GUIUtility.keyboardControl = 0;

                                RemoveAdjustmentPairFromList(i);

                                isreplacedetDirty = true;
                                m_SelectedAdjustmentRecord = -1;
                                m_isSearchDirty = true;
                                break;
                            }
                        }
                    }
                }

                DisplayPageNavigation(ref m_CurrentKerningPage, arraySize, itemsPerPage);

                GUILayout.Space(5);

                // Add new kerning pair
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(m_EmptyGlyphPairAdjustmentRecord_prop);
                }
                EditorGUILayout.EndVertical();

                if (GUILayout.Button("Add New Glyph Adjustment Record"))
                {
                    SerializedProperty firstAdjustmentRecordProperty = m_EmptyGlyphPairAdjustmentRecord_prop.FindPropertyRelative("m_FirstAdjustmentRecord");
                    SerializedProperty secondAdjustmentRecordProperty = m_EmptyGlyphPairAdjustmentRecord_prop.FindPropertyRelative("m_SecondAdjustmentRecord");

                    uint firstGlyphIndex = (uint)firstAdjustmentRecordProperty.FindPropertyRelative("m_GlyphIndex").intValue;
                    uint secondGlyphIndex = (uint)secondAdjustmentRecordProperty.FindPropertyRelative("m_GlyphIndex").intValue;

                    TMP_GlyphValueRecord firstValueRecord = GetValueRecord(firstAdjustmentRecordProperty.FindPropertyRelative("m_GlyphValueRecord"));
                    TMP_GlyphValueRecord secondValueRecord = GetValueRecord(secondAdjustmentRecordProperty.FindPropertyRelative("m_GlyphValueRecord"));

                    errorCode = -1;
                    uint pairKey = secondGlyphIndex << 16 | firstGlyphIndex;
                    if (m_FontFeatureTable.m_GlyphPairAdjustmentRecordLookupDictionary.ContainsKey(pairKey) == false)
                    {
                        TMP_GlyphPairAdjustmentRecord adjustmentRecord = new TMP_GlyphPairAdjustmentRecord(new TMP_GlyphAdjustmentRecord(firstGlyphIndex, firstValueRecord), new TMP_GlyphAdjustmentRecord(secondGlyphIndex, secondValueRecord));
                        m_FontFeatureTable.m_GlyphPairAdjustmentRecords.Add(adjustmentRecord);
                        m_FontFeatureTable.m_GlyphPairAdjustmentRecordLookupDictionary.Add(pairKey, adjustmentRecord);
                        errorCode = 0;
                    }

                    // Add glyphs and characters
                    TMP_Character character;

                    uint firstCharacter = m_SerializedPropertyHolder.firstCharacter;
                    if (!m_fontreplacedet.characterLookupTable.ContainsKey(firstCharacter))
                        m_fontreplacedet.TryAddCharacterInternal(firstCharacter, out character);

                    uint secondCharacter = m_SerializedPropertyHolder.secondCharacter;
                    if (!m_fontreplacedet.characterLookupTable.ContainsKey(secondCharacter))
                        m_fontreplacedet.TryAddCharacterInternal(secondCharacter, out character);

                    // Sort Kerning Pairs & Reload Font replacedet if new kerning pair was added.
                    if (errorCode != -1)
                    {
                        m_FontFeatureTable.SortGlyphPairAdjustmentRecords();
                        serializedObject.ApplyModifiedProperties();
                        isreplacedetDirty = true;
                        m_isSearchDirty = true;
                    }
                    else
                    {
                        timeStamp = System.DateTime.Now.AddSeconds(5);
                    }

                    // Clear Add Kerning Pair Panel
                    // TODO
                }

                if (errorCode == -1)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("Kerning Pair already <color=#ffff00>exists!</color>", TMP_UIStyleManager.label);
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    if (System.DateTime.Now > timeStamp)
                        errorCode = 0;
                }
            }
            #endregion

            if (serializedObject.ApplyModifiedProperties() || evt_cmd == k_UndoRedo || isreplacedetDirty)
            {
                // Delay callback until user has decided to Apply or Revert the changes.
                if (m_DisplayDestructiveChangeWarning == false)
                    TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, m_fontreplacedet);

                if (m_fontreplacedet.IsFontreplacedetLookupTablesDirty || evt_cmd == k_UndoRedo)
                    m_fontreplacedet.ReadFontreplacedetDefinition();

                isreplacedetDirty = false;
                EditorUtility.SetDirty(target);
            }


            // Clear selection if mouse event was not consumed.
            GUI.enabled = true;
            if (currentEvent.type == EventType.MouseDown && currentEvent.button == 0)
                m_SelectedAdjustmentRecord = -1;

        }

19 View Source File : TimelineWindow_TrackGui.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

void DrawNoSequenceGUI(WindowState windowState)
        {
            bool showCreateButton = false;
            var currentlySelectedGo = UnityEditor.Selection.activeObject != null ? UnityEditor.Selection.activeObject as GameObject : null;
            var textContent = DirectorStyles.noTimelinereplacedetSelected;
            var existingDirector = currentlySelectedGo != null ? currentlySelectedGo.GetComponent<PlayableDirector>() : null;
            var existingreplacedet = existingDirector != null ? existingDirector.playablereplacedet : null;

            if (currentlySelectedGo != null && !TimelineUtility.IsPrefabOrreplacedet(currentlySelectedGo) && existingreplacedet == null)
            {
                showCreateButton = true;
                textContent = new GUIContent(String.Format(DirectorStyles.createTimelineOnSelection.text, currentlySelectedGo.name, "a Director component and a Timeline replacedet"));
            }
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            GUILayout.Label(textContent);

            if (showCreateButton)
            {
                GUILayout.BeginHorizontal();
                var textSize = GUI.skin.label.CalcSize(textContent);
                GUILayout.Space((textSize.x / 2.0f) - (WindowConstants.createButtonWidth / 2.0f));
                if (GUILayout.Button("Create", GUILayout.Width(WindowConstants.createButtonWidth)))
                {
                    var message = DirectorStyles.createNewTimelineText.text + " '" + currentlySelectedGo.name + "'";
                    string newSequencePath = EditorUtility.SaveFilePanelInProject(DirectorStyles.createNewTimelineText.text, currentlySelectedGo.name + "Timeline", "playable", message, ProjectWindowUtil.GetActiveFolderPath());
                    if (!string.IsNullOrEmpty(newSequencePath))
                    {
                        var newreplacedet = TimelineUtility.CreateAndSaveTimelinereplacedet(newSequencePath);

                        Undo.IncrementCurrentGroup();

                        if (existingDirector == null)
                        {
                            existingDirector = Undo.AddComponent<PlayableDirector>(currentlySelectedGo);
                        }

                        existingDirector.playablereplacedet = newreplacedet;
                        SetCurrentTimeline(existingDirector);
                        windowState.previewMode = false;
                    }

                    // If we reach this point, the state of the pannel has changed; skip the rest of this GUI phase
                    // Fixes: case 955831 - [OSX] NullReferenceException when creating a timeline on a selected object
                    GUIUtility.ExitGUI();
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();
        }

19 View Source File : BreadcrumbDrawer.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

public static void Draw(float breadcrumbAreaWidth, List<BreadCrumbreplacedle> labels, Action<int> navigateToBreadcrumbIndex)
        {
            GUILayout.BeginHorizontal();
            {
                var labelWidth = (int)(breadcrumbAreaWidth / labels.Count);

                for (var i = 0; i < labels.Count; i++)
                {
                    var label = labels[i];

                    var style = i == 0 ? k_BreadCrumbLeft : k_BreadCrumbMid;
                    var backgroundStyle = i == 0 ? k_BreadCrumbLeftBg : k_BreadCrumbMidBg;

                    if (i == labels.Count - 1)
                    {
                        if (i > 0) // Only tint last breadcrumb if we are dug-in
                            DrawBreadcrumbreplacedelectedSubSequence(labelWidth, label, k_BreadCrumbMidSelected, k_BreadCrumbMidBgSelected);
                        else
                            DrawActiveBreadcrumb(labelWidth, label, style, backgroundStyle);
                    }
                    else
                    {
                        var previousContentColor = GUI.contentColor;
                        GUI.contentColor = new Color(previousContentColor.r,
                            previousContentColor.g,
                            previousContentColor.b,
                            previousContentColor.a * 0.6f);
                        var content = GetTextContent(labelWidth, label, style);
                        var rect = GetBreadcrumbLayoutRect(content, style);

                        if (Event.current.type == EventType.Repaint)
                            backgroundStyle.Draw(rect, GUIContent.none, 0);

                        if (GUI.Button(rect, content, style))
                            navigateToBreadcrumbIndex.Invoke(i);
                        GUI.contentColor = previousContentColor;
                    }
                }
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : TimelineWindow_TrackGui.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam

void TracksGUI(Rect clientRect, WindowState state, TimelineModeGUIState trackState)
        {
            if (Event.current.type == EventType.Repaint && treeView != null)
            {
                state.headerSpaceParreplacedioner.Clear();
                state.spaceParreplacedioner.Clear();
            }

            if (state.IsEditingASubTimeline() && !state.IsEditingAnEmptyTimeline())
            {
                var headerRect = clientRect;
                headerRect.width = state.sequencerHeaderWidth;
                Graphics.DrawBackgroundRect(state, headerRect);

                var clipRect = clientRect;
                clipRect.xMin = headerRect.xMax;
                Graphics.DrawBackgroundRect(state, clipRect, subSequenceMode: true);
            }
            else
            {
                Graphics.DrawBackgroundRect(state, clientRect);
            }

            if (!state.IsEditingAnEmptyTimeline())
                m_TimeArea.DrawMajorTicks(sequenceContentRect, state.referenceSequence.frameRate);

            GUILayout.BeginVertical();
            {
                GUILayout.Space(5.0f);
                GUILayout.BeginHorizontal();

                if (this.state.editSequence.replacedet == null)
                    DrawNoSequenceGUI(state);
                else
                    DrawTracksGUI(clientRect, trackState);

                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();

            Graphics.DrawShadow(clientRect);
        }

19 View Source File : BindingsPrinterWindow.cs
License : MIT License
Project Creator : Djohnnie

protected void OnGUI() {
            if (!editor) {
                editor = (BindingsPrinterWindow) EditorWindow.GetWindow<BindingsPrinterWindow>();
            }

            if (!Application.isPlaying) {
                GUILayout.FlexibleSpace();
                GUILayout.Label("Please execute the bindings printer on Play Mode", EditorStyles.message);
                GUILayout.FlexibleSpace();
                return;
            }

            if (ContextRoot.containersData == null || ContextRoot.containersData.Count == 0) {
                GUILayout.FlexibleSpace();
                GUILayout.Label("There are no containers in the current scene", EditorStyles.message);
                GUILayout.FlexibleSpace();
                return;
            }

            // Add window margin.
            GUILayout.BeginHorizontal();
            GUILayout.Space(WINDOW_MARGIN);
            GUILayout.BeginVertical();
			
            this.scrollPosition = GUILayout.BeginScrollView(scrollPosition);

            GUILayout.Space(WINDOW_MARGIN);
            GUILayout.Label("Adic Bindings Printer", EditorStyles.replacedle);
            GUILayout.Label("Displays all bindings of all available containers", EditorStyles.containerInfo);            

            // Display the containers and their bindings.
            for (int dataIndex = 0; dataIndex < ContextRoot.containersData.Count; dataIndex++) {
                var data = ContextRoot.containersData[dataIndex];
                var bindings = data.container.GetBindings();

                GUILayout.Space(20f);
                GUILayout.Label("CONTAINER", EditorStyles.containerInfo);
                GUILayout.Label(
                    string.Format("[{1}] {0} ({2} | {3})", data.container.GetType().FullName, dataIndex,
                        data.container.identifier, (data.destroyOnLoad ? "destroy on load" : "singleton")
                    ),
                    EditorStyles.replacedle
                );

                GUILayout.Space(10f);

                // Add indentation.
                GUILayout.BeginHorizontal();
                GUILayout.Space(10);
                GUILayout.BeginVertical();

                for (int bindingIndex = 0; bindingIndex < bindings.Count; bindingIndex++) {
                    var binding = bindings[bindingIndex];

                    GUILayout.Label(binding.ToString(), EditorStyles.bindinds);
                }
				
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }

            GUILayout.Space(WINDOW_MARGIN);
            GUILayout.EndScrollView();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }

19 View Source File : NavMeshLinkEditor.cs
License : MIT License
Project Creator : DKaravolos

public override void OnInspectorGUI()
        {
            serializedObject.Update();

            NavMeshComponentsGUIUtility.AgentTypePopup("Agent Type", m_AgentTypeID);
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(m_StartPoint);
            EditorGUILayout.PropertyField(m_EndPoint);

            GUILayout.BeginHorizontal();
            GUILayout.Space(EditorGUIUtility.labelWidth);
            if (GUILayout.Button("Swap"))
            {
                foreach (NavMeshLink navLink in targets)
                {
                    var tmp = navLink.startPoint;
                    navLink.startPoint = navLink.endPoint;
                    navLink.endPoint = tmp;
                }
                SceneView.RepaintAll();
            }
            if (GUILayout.Button("Align Transform"))
            {
                foreach (NavMeshLink navLink in targets)
                {
                    Undo.RecordObject(navLink.transform, "Align Transform to End Points");
                    Undo.RecordObject(navLink, "Align Transform to End Points");
                    AlignTransformToEndPoints(navLink);
                }
                SceneView.RepaintAll();
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(m_Width);
            EditorGUILayout.PropertyField(m_CostModifier);
            EditorGUILayout.PropertyField(m_AutoUpdatePosition);
            EditorGUILayout.PropertyField(m_Bidirectional);

            NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area);

            serializedObject.ApplyModifiedProperties();

            EditorGUILayout.Space();
        }

19 View Source File : NavMeshSurfaceEditor.cs
License : MIT License
Project Creator : DKaravolos

public override void OnInspectorGUI()
        {
            if (s_Styles == null)
                s_Styles = new Styles();

            serializedObject.Update();

            var bs = NavMesh.GetSettingsByID(m_AgentTypeID.intValue);

            if (bs.agentTypeID != -1)
            {
                // Draw image
                const float diagramHeight = 80.0f;
                Rect agentDiagramRect = EditorGUILayout.GetControlRect(false, diagramHeight);
                NavMeshEditorHelpers.DrawAgentDiagram(agentDiagramRect, bs.agentRadius, bs.agentHeight, bs.agentClimb, bs.agentSlope);
            }
            NavMeshComponentsGUIUtility.AgentTypePopup("Agent Type", m_AgentTypeID);

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(m_CollectObjects);
            if ((CollectObjects)m_CollectObjects.enumValueIndex == CollectObjects.Volume)
            {
                EditorGUI.indentLevel++;
                InspectorEditButtonGUI();
                EditorGUILayout.PropertyField(m_Size);
                EditorGUILayout.PropertyField(m_Center);
            }
            else
            {
                if (editingCollider)
                    EditMode.QuitEditMode();
            }

            EditorGUILayout.PropertyField(m_LayerMask, s_Styles.m_LayerMask);
            EditorGUILayout.PropertyField(m_UseGeometry);

            EditorGUILayout.Space();

            EditorGUILayout.Space();

            m_OverrideVoxelSize.isExpanded = EditorGUILayout.Foldout(m_OverrideVoxelSize.isExpanded, "Advanced");
            if (m_OverrideVoxelSize.isExpanded)
            {
                EditorGUI.indentLevel++;

                NavMeshComponentsGUIUtility.AreaPopup("Default Area", m_DefaultArea);

                // Override voxel size.
                EditorGUILayout.PropertyField(m_OverrideVoxelSize);

                using (new EditorGUI.DisabledScope(!m_OverrideVoxelSize.boolValue || m_OverrideVoxelSize.hasMultipleDifferentValues))
                {
                    EditorGUI.indentLevel++;

                    EditorGUILayout.PropertyField(m_VoxelSize);

                    if (!m_OverrideVoxelSize.hasMultipleDifferentValues)
                    {
                        if (!m_AgentTypeID.hasMultipleDifferentValues)
                        {
                            float voxelsPerRadius = m_VoxelSize.floatValue > 0.0f ? (bs.agentRadius / m_VoxelSize.floatValue) : 0.0f;
                            EditorGUILayout.LabelField(" ", voxelsPerRadius.ToString("0.00") + " voxels per agent radius", EditorStyles.miniLabel);
                        }
                        if (m_OverrideVoxelSize.boolValue)
                            EditorGUILayout.HelpBox("Voxel size controls how accurately the navigation mesh is generated from the level geometry. A good voxel size is 2-4 voxels per agent radius. Making voxel size smaller will increase build time.", MessageType.None);
                    }
                    EditorGUI.indentLevel--;
                }

                // Override tile size
                EditorGUILayout.PropertyField(m_OverrideTileSize);

                using (new EditorGUI.DisabledScope(!m_OverrideTileSize.boolValue || m_OverrideTileSize.hasMultipleDifferentValues))
                {
                    EditorGUI.indentLevel++;

                    EditorGUILayout.PropertyField(m_TileSize);

                    if (!m_TileSize.hasMultipleDifferentValues && !m_VoxelSize.hasMultipleDifferentValues)
                    {
                        float tileWorldSize = m_TileSize.intValue * m_VoxelSize.floatValue;
                        EditorGUILayout.LabelField(" ", tileWorldSize.ToString("0.00") + " world units", EditorStyles.miniLabel);
                    }

                    if (!m_OverrideTileSize.hasMultipleDifferentValues)
                    {
                        if (m_OverrideTileSize.boolValue)
                            EditorGUILayout.HelpBox("Tile size controls the how local the changes to the world are (rebuild or carve). Small tile size allows more local changes, while potentially generating more data in overal.", MessageType.None);
                    }
                    EditorGUI.indentLevel--;
                }


                // Height mesh
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.PropertyField(m_BuildHeightMesh);
                }

                EditorGUILayout.Space();
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();

            var hadError = false;
            var multipleTargets = targets.Length > 1;
            foreach (NavMeshSurface navSurface in targets)
            {
                var settings = navSurface.GetBuildSettings();
                // Calculating bounds is potentially expensive when unbounded - so here we just use the center/size.
                // It means the validation is not checking vertical voxel limit correctly when the surface is set to something else than "in volume".
                var bounds = new Bounds(Vector3.zero, Vector3.zero);
                if (navSurface.collectObjects == CollectObjects.Volume)
                {
                    bounds = new Bounds(navSurface.center, navSurface.size);
                }

                var errors = settings.ValidationReport(bounds);
                if (errors.Length > 0)
                {
                    if (multipleTargets)
                        EditorGUILayout.LabelField(navSurface.name);
                    foreach (var err in errors)
                    {
                        EditorGUILayout.HelpBox(err, MessageType.Warning);
                    }
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(EditorGUIUtility.labelWidth);
                    if (GUILayout.Button("Open Agent Settings...", EditorStyles.miniButton))
                        NavMeshEditorHelpers.OpenAgentSettings(navSurface.agentTypeID);
                    GUILayout.EndHorizontal();
                    hadError = true;
                }
            }

            if (hadError)
                EditorGUILayout.Space();

            using (new EditorGUI.DisabledScope(Application.isPlaying || m_AgentTypeID.intValue == -1))
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUIUtility.labelWidth);
                if (GUILayout.Button("Clear"))
                {
                    foreach (NavMeshSurface s in targets)
                        ClearSurface(s);
                    SceneView.RepaintAll();
                }

                if (GUILayout.Button("Bake"))
                {
                    // Remove first to avoid double registration of the callback
                    EditorApplication.update -= UpdateAsyncBuildOperations;
                    EditorApplication.update += UpdateAsyncBuildOperations;

                    foreach (NavMeshSurface surf in targets)
                    {
                        var oper = new AsyncBakeOperation();

                        oper.bakeData = InitializeBakeData(surf);
                        oper.bakeOperation = surf.UpdateNavMesh(oper.bakeData);
                        oper.surface = surf;

                        s_BakeOperations.Add(oper);
                    }
                }

                GUILayout.EndHorizontal();
            }

            // Show progress for the selected targets
            for (int i = s_BakeOperations.Count - 1; i >= 0; --i)
            {
                if (!targets.Contains(s_BakeOperations[i].surface))
                    continue;

                var oper = s_BakeOperations[i].bakeOperation;
                if (oper == null)
                    continue;

                var p = oper.progress;
                if (oper.isDone)
                {
                    SceneView.RepaintAll();
                    continue;
                }

                GUILayout.BeginHorizontal();

                if (GUILayout.Button("Cancel", EditorStyles.miniButton))
                {
                    var bakeData = s_BakeOperations[i].bakeData;
                    UnityEngine.AI.NavMeshBuilder.Cancel(bakeData);
                    s_BakeOperations.RemoveAt(i);
                }

                EditorGUI.ProgressBar(EditorGUILayout.GetControlRect(), p, "Baking: " + (int)(100 * p) + "%");
                if (p <= 1)
                    Repaint();

                GUILayout.EndHorizontal();
            }
        }

19 View Source File : IntegrateWindow.cs
License : MIT License
Project Creator : DonnYep

private void OnGUI()
        {
            GUILayout.BeginHorizontal();
            float toolbarWidth = position.width - 64;
            m_Mode = (Mode)GUILayout.Toolbar((int)m_Mode, labels, "LargeButton", GUILayout.Width(toolbarWidth));
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar))
            {
                GUILayout.Label("Bundle Data Source:");
                GUILayout.FlexibleSpace();
                var c = new GUIContent("cosmos");
                if (GUILayout.Button(c, EditorStyles.toolbarPopup))
                {
                    GenericMenu menu = new GenericMenu();
                    for (int index = 0; index < 16; index++)
                    {



                    }

                    menu.ShowAsContext();

                }
                searchStr = m_searchField.OnGUI(new Rect(), "Search");
                GUILayout.EndHorizontal();
            }
        }

19 View Source File : AssetBundleBuildTab.cs
License : MIT License
Project Creator : DonnYep

public void OnGUI(Rect rect)
        {
            replacedetBundleTabData.BuildTarget = (BuildTarget)EditorGUILayout.EnumPopup("BuildTarget", replacedetBundleTabData.BuildTarget);
            replacedetBundleTabData.OutputPath = EditorGUILayout.TextField("OutputPath", replacedetBundleTabData.OutputPath.Trim());

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Browse", GUILayout.MaxWidth(128f)))
            {
                BrowseFolder();
            }
            if (GUILayout.Button("Reset", GUILayout.MaxWidth(128f)))
            {
                ResetPath();
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(16);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("OpenOutputPath"))
            {
                EditorUtility.RevealInFinder(GetBuildFolder());
            }
            if (GUILayout.Button("OpenPersistentPath"))
            {
                EditorUtility.RevealInFinder(Application.persistentDataPath);
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(16);


            GUILayout.BeginVertical();
            replacedetBundleTabData.WithoutManifest = EditorGUILayout.ToggleLeft("WithoutManifest", replacedetBundleTabData.WithoutManifest);

            replacedetBundleTabData.ClearOutputFolders = EditorGUILayout.ToggleLeft("ClearOutputFolders", replacedetBundleTabData.ClearOutputFolders);
            replacedetBundleTabData.CopyToStreamingreplacedets = EditorGUILayout.ToggleLeft("CopyToStreamingreplacedets", replacedetBundleTabData.CopyToStreamingreplacedets);
            if (replacedetBundleTabData.CopyToStreamingreplacedets)
            {
                GUILayout.Space(16);
                GUILayout.Label("replacedets/Streamingreplacedets/ 下的相对路径地址,可选填 ");
                replacedetBundleTabData.StreamingRelativePath = EditorGUILayout.TextField("StreamingRelativePath", replacedetBundleTabData.StreamingRelativePath.Trim());
            }
            GUILayout.EndVertical();


            GUILayout.Space(16);
            GUILayout.Label("CompressedFormat  建议使用默认模式,并且请勿与NameHashType的其他类型混用,会导致AB包名混乱!");
            replacedetBundleTabData.BuildreplacedetBundleOptions = (BuildreplacedetBundleOptions)EditorGUILayout.EnumPopup("CompressedFormat:", replacedetBundleTabData.BuildreplacedetBundleOptions);
            replacedetBundleTabData.NameHashType = (replacedetBundleHashType)EditorGUILayout.EnumPopup("NameHashType", replacedetBundleTabData.NameHashType);

            GUILayout.Space(16);

            replacedetBundleTabData.UseAESEncryption = EditorGUILayout.ToggleLeft("UseAESEncryption", replacedetBundleTabData.UseAESEncryption);
            if (replacedetBundleTabData.UseAESEncryption)
            {
                GUILayout.Space(16);
                var aesKeyLength = Encoding.UTF8.GetBytes(replacedetBundleTabData.AESEncryptionKey).Length;
                EditorGUILayout.LabelField($"密钥长度须为16,24,32,当前密钥长度:{aesKeyLength}");
                replacedetBundleTabData.AESEncryptionKey = EditorGUILayout.TextField("AESEncryptionKey", replacedetBundleTabData.AESEncryptionKey);
            }
            GUILayout.Space(16);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Build"))
            {
                if (quarkreplacedetDataset != null)
                    EditorUtil.Coroutine.StartCoroutine(EnumBuildreplacedetBundle());
                else
                    EditorUtil.Debug.LogError("QuarkreplacedetDataset is invalid !");
            }
            if (GUILayout.Button("Reset"))
            {
                replacedetBundleTabData = new replacedetBundleBuildTabData();
                EditorUtil.SaveData(replacedetBundleTabDataFileName, replacedetBundleTabData);
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : AssetDatabaseTab.cs
License : MIT License
Project Creator : DonnYep

void DrawFastDevelopTab(Rect rect)
        {
            EditorUtil.DrawVerticalContext(() =>
            {
                WindowTabData.UnderreplacedetsDirectory = EditorGUILayout.ToggleLeft("UnderreplacedetsDirectory", WindowTabData.UnderreplacedetsDirectory);
                WindowTabData.GeneratereplacedetPathCode = EditorGUILayout.ToggleLeft("GeneratereplacedetPath", WindowTabData.GeneratereplacedetPathCode);
            });
            GUILayout.Space(16);
            EditorUtil.DrawHorizontalContext(() =>
            {
                if (GUILayout.Button("Build"))
                {
                    EditorUtil.Coroutine.StartCoroutine(EnumBuildADBMode());
                }
                if (GUILayout.Button("Clear"))
                {
                    ADBModeClear();
                }
            });

            GUILayout.Space(16);
            GUILayout.BeginHorizontal();

            //GUILayout.BeginVertical("box",GUILayout.MaxWidth(rect.width * 0.382f));
            GUILayout.BeginVertical("box");

            if (GUILayout.Button("Clearreplacedets"))
            {
                includeDirectoriesOperation.Clear();
            }
            if (!WindowTabData.UnderreplacedetsDirectory)
            {
                includeDirectoriesOperation.OnGUI(rect);
            }
            GUILayout.EndVertical();


            //GUILayout.BeginVertical();
            //GUILayout.Label("replacedetObject List:");
            //GUILayout.EndVertical();

            GUILayout.EndHorizontal();

        }

19 View Source File : QuarkAssetWindow.cs
License : MIT License
Project Creator : DonnYep

void OnGUI()
        {
            selectedBar = GUILayout.Toolbar(selectedBar, barArray);
            GUILayout.Space(16);
            quarkreplacedetDataset = (QuarkreplacedetDataset)EditorGUILayout.ObjectField("QuarkreplacedetDataset", quarkreplacedetDataset, typeof(QuarkreplacedetDataset), false);
            QuarkEditorDataProxy.QuarkreplacedetDataset = quarkreplacedetDataset;
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("CreateDataset", GUILayout.MaxWidth(128f)))
            {
                quarkreplacedetDataset = CreateQuarkreplacedetDataset();
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(16);
            var bar = (replacedetInfoBar)selectedBar;
            m_ScrollPos = EditorGUILayout.BeginScrollView(m_ScrollPos);
            switch (bar)
            {
                case replacedetInfoBar.replacedetDatabaseMode:
                    replacedetDatabaseTab.OnGUI(position);
                    break;
                case replacedetInfoBar.replacedetBundleMode:
                    replacedetBundleTab.OnGUI(position);
                    break;
            }
            EditorGUILayout.EndScrollView();
        }

19 View Source File : HotfixWindow.cs
License : MIT License
Project Creator : DonnYep

private void OnGUI()
        {
            m_ScrollPos = EditorGUILayout.BeginScrollView(m_ScrollPos);

            GUILayout.Space(16);
            EditorGUILayout.HelpBox("热更新工具,用于加载编译后的dll与pdb", MessageType.Info);
            GUILayout.Space(16);

            GUILayout.BeginVertical();
            hotfixWindowData.CompiledreplacedemblyPath = EditorGUILayout.TextField("CompiledreplacedemblyPath ", hotfixWindowData.CompiledreplacedemblyPath);
            replacedetRelativeFolderreplacedet = (Defaultreplacedet)EditorGUILayout.ObjectField("replacedginreplacedetsRelative", replacedetRelativeFolderreplacedet, typeof(Defaultreplacedet), false);
            string lableFieldStr = string.IsNullOrEmpty(hotfixWindowData.replacedetsRelativePath) == true ? "Null" : hotfixWindowData.replacedetsRelativePath;
            EditorGUILayout.LabelField("replacedetsRelativePath:", lableFieldStr);
            if (replacedetRelativeFolderreplacedet != null)
            {
                hotfixWindowData.replacedetsRelativePath = replacedetDatabase.GetreplacedetPath(replacedetRelativeFolderreplacedet);
            }

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Browsereplacedembly", GUILayout.MaxWidth(128f)))
            {
                hotfixWindowData.CompiledreplacedemblyPath = EditorUtility.OpenFilePanel("Browsereplacedembly", Directory.GetCurrentDirectory(), "dll");
            }
            if (GUILayout.Button("ResetRelativePath", GUILayout.MaxWidth(128f)))
            {
                replacedetRelativeFolderreplacedet = null;
                hotfixWindowData.replacedetsRelativePath = string.Empty;
            }
            GUILayout.EndHorizontal();

            hotfixWindowData.AppendExtension = EditorGUILayout.ToggleLeft("AppendExtension", hotfixWindowData.AppendExtension);
            if (hotfixWindowData.AppendExtension)
            {
                hotfixWindowData.Extension = EditorGUILayout.TextField("Extension", hotfixWindowData.Extension);
            }
            GUILayout.EndVertical();

            GUILayout.Space(16);
            hotfixWindowData.AutoLoadHotfixCode = EditorGUILayout.ToggleLeft("AutoLoadHotfixCode", hotfixWindowData.AutoLoadHotfixCode);
            GUILayout.Space(16);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Load"))
            {
                if (LoadHotfixreplacedembly())
                    EditorUtil.Debug.LogInfo("Hotfix code load done !");
            }
            if (GUILayout.Button("Reset"))
            {
                ResetHotfixreplacedembly();
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(16);

            EditorGUILayout.EndScrollView();
        }

19 View Source File : IncludeDirectoriesOperation.cs
License : MIT License
Project Creator : DonnYep

void DoToolbar()
		{
			GUILayout.BeginHorizontal(EditorStyles.toolbar);
			GUILayout.Space(128);
			GUILayout.FlexibleSpace();
			treeView.searchString = searchField.OnToolbarGUI(treeView.searchString);
			GUILayout.EndHorizontal();
		}

19 View Source File : SoftMaskableEditor.cs
License : GNU General Public License v3.0
Project Creator : FluffyFishGames

public override void OnInspectorGUI ()
		{
			base.OnInspectorGUI ();

			serializedObject.Update();
			DrawMaskInteractions();

//			maskInteraction = (MaskInteraction)EditorGUILayout.EnumPopup("Mask Interaction", maskInteraction);
			serializedObject.ApplyModifiedProperties();
			/*
			EditorGUI.indentLevel++;
			var l = EditorGUIUtility.labelWidth;
			EditorGUIUtility.labelWidth = 60;
			using (new EditorGUILayout.HorizontalScope())
			{
				EditorGUILayout.ObjectField("Mask 0", null, typeof(Mask), false);
				EditorGUILayout.EnumPopup (MaskIntr.None);
			}
			EditorGUIUtility.labelWidth = l;
			EditorGUI.indentLevel--;

			var spMaskInteraction = serializedObject.FindProperty ("m_MaskInteraction");
			MaskIntr intr0 = (MaskIntr)((spMaskInteraction.intValue >> 0) & 0x3);
			MaskIntr intr1 = (MaskIntr)((spMaskInteraction.intValue >> 2) & 0x3);
			MaskIntr intr2 = (MaskIntr)((spMaskInteraction.intValue >> 4) & 0x3);
			MaskIntr intr3 = (MaskIntr)((spMaskInteraction.intValue >> 6) & 0x3);

			using (var ccs = new EditorGUI.ChangeCheckScope ()) {

				intr0 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 0", intr0);
				intr1 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 1", intr1);
				intr2 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 2", intr2);
				intr3 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 3", intr3);

				if (ccs.changed) {
					current.SetMaskInteractions (intr0,intr1,intr2,intr3);
				}
			}
			*/

//			spMaskInteraction.intValue = (intr0 << 0) | (intr1 << 2) | (intr2 << 4) | (intr3 << 6);
//
//			serializedObject.ApplyModifiedProperties ();



			var current = target as SoftMaskable;

			current.GetComponentsInChildren<Graphic> (true, s_Graphics);
			var fixTargets = s_Graphics.Where (x => x.gameObject != current.gameObject && !x.GetComponent<SoftMaskable> () && (!x.GetComponent<Mask> () || x.GetComponent<Mask> ().showMaskGraphic)).ToList ();
			if (0 < fixTargets.Count)
			{
				GUILayout.BeginHorizontal ();
				EditorGUILayout.HelpBox ("There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning);
				GUILayout.BeginVertical ();
				if (GUILayout.Button ("Fix"))
				{
					foreach (var p in fixTargets)
					{
						p.gameObject.AddComponent<SoftMaskable> ();
					}
				}
				if (GUILayout.Button ("Ping"))
				{
					EditorGUIUtility.PingObject (fixTargets [0]);
				}
				GUILayout.EndVertical ();
				GUILayout.EndHorizontal ();
			}

			if(s_TypeTMPro != null)
			{
				ShowTMProWarning (_shader, _mobileShader, _spriteShader, m => { });
				var textMeshPro = current.GetComponent (s_TypeTMPro);
				if (textMeshPro != null)
				{
					Material [] fontSharedMaterials = s_PiFontSharedMaterials.GetValue (textMeshPro, new object [0]) as Material [];
					ShowMaterialEditors (fontSharedMaterials, 1, fontSharedMaterials.Length - 1);
				}
			}
			
			if (!DetectMask (current.transform.parent))
			{
				GUILayout.BeginHorizontal ();
				EditorGUILayout.HelpBox ("This is unnecessary SoftMaskable.\nCan't find any SoftMask components above.", MessageType.Warning);
				if (GUILayout.Button ("Remove", GUILayout.Height (40)))
				{
					DestroyImmediate (current);
					
					Utils.MarkPrefabDirty ();
				}
				GUILayout.EndHorizontal ();
			}
		}

19 View Source File : SoftMaskEditor.cs
License : GNU General Public License v3.0
Project Creator : FluffyFishGames

public override void OnInspectorGUI ()
		{
			base.OnInspectorGUI ();

			var current = target as SoftMask;
			current.GetComponentsInChildren<Graphic> (true, s_Graphics);
			var fixTargets = s_Graphics.Where (x => x.gameObject != current.gameObject && !x.GetComponent<SoftMaskable> () && (!x.GetComponent<Mask> () || x.GetComponent<Mask> ().showMaskGraphic)).ToList ();
			if (0 < fixTargets.Count)
			{
				GUILayout.BeginHorizontal ();
				EditorGUILayout.HelpBox ("There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning);
				GUILayout.BeginVertical ();
				if (GUILayout.Button ("Fix"))
				{
					foreach (var p in fixTargets)
					{
						p.gameObject.AddComponent<SoftMaskable> ();
					}
					
					Utils.MarkPrefabDirty ();
				}
				if (GUILayout.Button ("Ping"))
				{
					EditorGUIUtility.PingObject (fixTargets[0]);
				}
				GUILayout.EndVertical ();
				GUILayout.EndHorizontal ();
			}

			// Preview buffer.
			GUILayout.BeginHorizontal (EditorStyles.helpBox);
			if (s_Preview != (s_Preview = EditorGUILayout.ToggleLeft ("Preview Buffer", s_Preview, GUILayout.MaxWidth (EditorGUIUtility.labelWidth))))
			{
				EditorPrefs.SetBool (k_PrefsPreview, s_Preview);
			}
			if (s_Preview)
			{
				var tex = current.softMaskBuffer;
				var width = tex.width * 64 / tex.height;
				EditorGUI.DrawPreviewTexture (GUILayoutUtility.GetRect (width, 64), tex, null, ScaleMode.ScaleToFit);
				Repaint ();
			}
			GUILayout.FlexibleSpace ();
			GUILayout.EndHorizontal ();
		}

19 View Source File : EditorLayout.cs
License : MIT License
Project Creator : focus-creative-games

public static string SearchTextField(string searchString)
        {
            bool changed = GUI.changed;
            GUILayout.BeginHorizontal();
            searchString = GUILayout.TextField(searchString, GUI.skin.FindStyle("ToolbarSeachTextField"), new GUILayoutOption[0]);
            if (GUILayout.Button(string.Empty, GUI.skin.FindStyle("ToolbarSeachCancelButton"), new GUILayoutOption[0]))
                searchString = string.Empty;
            GUILayout.EndHorizontal();
            GUI.changed = changed;
            return searchString;
        }

19 View Source File : ReferenceCollectorEditor.cs
License : MIT License
Project Creator : focus-creative-games

public override void OnInspectorGUI()
	{
        //使ReferenceCollector支持撤销操作,还有Redo,不过没有在这里使用
        Undo.RecordObject(referenceCollector, "Changed Settings");
		var dataProperty = serializedObject.FindProperty("data");
        //开始水平布局,如果是比较新版本学习U3D的,可能不知道这东西,这个是老GUI系统的知识,除了用在编辑器里,还可以用在生成的游戏中
		GUILayout.BeginHorizontal();
        //下面几个if都是点击按钮就会返回true调用里面的东西
		if (GUILayout.Button("添加引用"))
		{
            //添加新的元素,具体的函数注释
            // Guid.NewGuid().GetHashCode().ToString() 就是新建后默认的key
            AddReference(dataProperty, Guid.NewGuid().GetHashCode().ToString(), null);
		}
		if (GUILayout.Button("全部删除"))
		{
			dataProperty.ClearArray();
		}
		if (GUILayout.Button("删除空引用"))
		{
			DelNullReference();
		}
		if (GUILayout.Button("排序"))
		{
			referenceCollector.Sort();
		}
		EditorGUILayout.EndHorizontal();
		EditorGUILayout.BeginHorizontal();
        //可以在编辑器中对searchKey进行赋值,只要输入对应的Key值,就可以点后面的删除按钮删除相对应的元素
        searchKey = EditorGUILayout.TextField(searchKey);
        //添加的可以用于选中Object的框,这里的object也是(UnityEngine.Object
        //第三个参数为是否只能引用scene中的Object
        EditorGUILayout.ObjectField(heroPrefab, typeof (Object), false);
		if (GUILayout.Button("删除"))
		{
			referenceCollector.Remove(searchKey);
			heroPrefab = null;
		}
		GUILayout.EndHorizontal();
		EditorGUILayout.Space();

		var delList = new List<int>();
        SerializedProperty property;
        //遍历ReferenceCollector中data list的所有元素,显示在编辑器中
        for (int i = referenceCollector.data.Count - 1; i >= 0; i--)
		{
			GUILayout.BeginHorizontal();
            //这里的知识点在ReferenceCollector中有说
            property = dataProperty.GetArrayElementAtIndex(i).FindPropertyRelative("key");
            EditorGUILayout.TextField(property.stringValue, GUILayout.Width(150));
            property = dataProperty.GetArrayElementAtIndex(i).FindPropertyRelative("gameObject");
            property.objectReferenceValue = EditorGUILayout.ObjectField(property.objectReferenceValue, typeof(Object), true);
			if (GUILayout.Button("X"))
			{
                //将元素添加进删除list
				delList.Add(i);
			}
			GUILayout.EndHorizontal();
		}
		var eventType = Event.current.type;
        //在Inspector 窗口上创建区域,向区域拖拽资源对象,获取到拖拽到区域的对象
        if (eventType == EventType.DragUpdated || eventType == EventType.DragPerform)
		{
			// Show a copy icon on the drag
			DragAndDrop.visualMode = DragAndDropVisualMode.Copy;

			if (eventType == EventType.DragPerform)
			{
				DragAndDrop.AcceptDrag();
				foreach (var o in DragAndDrop.objectReferences)
				{
					AddReference(dataProperty, o.name, o);
				}
			}

			Event.current.Use();
		}

        //遍历删除list,将其删除掉
		foreach (var i in delList)
		{
			dataProperty.DeleteArrayElementAtIndex(i);
		}
		serializedObject.ApplyModifiedProperties();
		serializedObject.UpdateIfRequiredOrScript();
	}

19 View Source File : RsyncEditor.cs
License : MIT License
Project Creator : focus-creative-games

private void OnGUI()
		{
			rsyncConfig.Host = EditorGUILayout.TextField("服务器地址", rsyncConfig.Host);
			rsyncConfig.Account = EditorGUILayout.TextField("账号(必须是Linux已有的账号)", rsyncConfig.Account);
			rsyncConfig.Preplacedword = EditorGUILayout.TextField("密码", rsyncConfig.Preplacedword);
			rsyncConfig.RelativePath = EditorGUILayout.TextField("相对路径", rsyncConfig.RelativePath);

			this.isFold = EditorGUILayout.Foldout(isFold, $"排除列表:");

			if (!this.isFold)
			{
				for (int i = 0; i < this.rsyncConfig.Exclude.Count; ++i)
				{
					GUILayout.BeginHorizontal();
					this.rsyncConfig.Exclude[i] = EditorGUILayout.TextField(this.rsyncConfig.Exclude[i]);
					if (GUILayout.Button("删除"))
					{
						this.rsyncConfig.Exclude.RemoveAt(i);
						break;
					}
					GUILayout.EndHorizontal();
				}
			}

			if (GUILayout.Button("添加排除项目"))
			{
				this.rsyncConfig.Exclude.Add("");
			}

			if (GUILayout.Button("保存"))
			{
				File.WriteAllText(ConfigFile, MongoHelper.ToJson(this.rsyncConfig));
				using (StreamWriter sw = new StreamWriter(new FileStream(@"..\Tools\cwRsync\Config\exclude.txt", FileMode.Create)))
				{
					foreach (string s in this.rsyncConfig.Exclude)
					{
						sw.Write(s + "\n");
					}
				}

				File.WriteAllText($@"..\Tools\cwRsync\Config\rsync.secrets", this.rsyncConfig.Preplacedword);
				File.WriteAllText($@"..\Tools\cwRsync\Config\rsyncd.secrets", $"{this.rsyncConfig.Account}:{this.rsyncConfig.Preplacedword}");

				string rsyncdConf = "uid = 0\n" + "gid = 0\n" + "use chroot = no\n" + "max connections = 100\n" + "read only = no\n" + "write only = no\n" +
				                    "log file =/var/log/rsyncd.log\n" + "fake super = yes\n" + "[Upload]\n" + $"path = /home/{this.rsyncConfig.Account}/\n" + 
									$"auth users = {this.rsyncConfig.Account}\n" + "secrets file = /etc/rsyncd.secrets\n" + "list = yes";
				File.WriteAllText($@"..\Tools\cwRsync\Config\rsyncd.conf", rsyncdConf);
			}

			if (GUILayout.Button("同步"))
			{
				string arguments =
						$"-vzrtopg --preplacedword-file=./Tools/cwRsync/Config/rsync.secrets --exclude-from=./Tools/cwRsync/Config/exclude.txt --delete ./ {this.rsyncConfig.Account}@{this.rsyncConfig.Host}::Upload/{this.rsyncConfig.RelativePath} --chmod=ugo=rwX";
				ProcessHelper.Run(@"./Tools/cwRsync/rsync.exe", arguments, @"..\");
				Log.Debug("同步完成!");
			}
		}

19 View Source File : ServerCommandLineEditor.cs
License : MIT License
Project Creator : focus-creative-games

public void OnGUI()
        {
            if (GUILayout.Button("启动"))
            {
                string arguments = $"";
                ProcessHelper.Run("App.exe", arguments, "../Bin/");
            }

            if (GUILayout.Button("启动数据库"))
            {
                ProcessHelper.Run("mongod", @"--dbpath=db", "../Database/bin/");
            }

            GUILayout.EndHorizontal();
        }

19 View Source File : ToluaInjectionBlackListPanel.cs
License : MIT License
Project Creator : focus-creative-games

void OnGUI()
    {
        InitPathsInfo();
        InitFilterListDrawer();

        bool execGenerate = false;
        GUILayout.BeginHorizontal(EditorStyles.toolbar);
        {
            if (GUILayout.Button("Add", EditorStyles.toolbarButton))
            {
                AddNewPath();
            }
            if (GUILayout.Button("Save", EditorStyles.toolbarButton))
            {
                SavePathsInfo();
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Generate", EditorStyles.toolbarButton))
            {
                execGenerate = true;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginVertical();
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            {
                pathUIList.DoLayoutList();
            }
            GUILayout.EndScrollView();
        }
        GUILayout.EndVertical();

        if (execGenerate)
        {
            Generate();
            Close();
        }
    }

19 View Source File : BranchesView.cs
License : MIT License
Project Creator : github-for-unity

private void Render()
        {
            listID = GUIUtility.GetControlID(FocusType.Keyboard);
            GUILayout.BeginHorizontal();
            {
                OnButtonBarGUI();
            }
            GUILayout.EndHorizontal();

            var rect = GUILayoutUtility.GetLastRect();
            scroll = GUILayout.BeginScrollView(scroll);
            {
                OnTreeGUI(new Rect(0f, 0f, Position.width, Position.height - rect.height + Styles.CommitAreaPadding)); 
            }
            GUILayout.EndScrollView();

            if (Event.current.type == EventType.Repaint)
            {
                // Effectuating mode switch
                if (mode != targetMode)
                {
                    mode = targetMode;
                    Redraw();
                }
            }
            DoProgressGUI();
        }

19 View Source File : GitHubEnterpriseAuthenticationView.cs
License : MIT License
Project Creator : github-for-unity

private void OnGUIHost()
        {
            EditorGUI.BeginDisabledGroup(isBusy);
            {
                ShowMessage();

                EditorGUILayout.Space();

                GUILayout.BeginHorizontal();
                {
                    serverAddress = EditorGUILayout.TextField(ServerAddressLabel, serverAddress, Styles.TextFieldStyle);
                }
                GUILayout.EndHorizontal();

                ShowErrorMessage();

                GUILayout.Space(Styles.BaseSpacing + 3);
                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(LoginButton) || (!isBusy && enterPressed))
                    {
                        GUI.FocusControl(null);
                        errorMessage = null;
                        isBusy = true;

                        GetAuthenticationService(serverAddress)
                            .GetServerMeta(DoServerMetaResult, DoServerMetaError);

                        Redraw();
                    }
                }
                GUILayout.EndHorizontal();
            }
            EditorGUI.EndDisabledGroup();
        }

19 View Source File : GitHubEnterpriseAuthenticationView.cs
License : MIT License
Project Creator : github-for-unity

private void OnGUIUserPreplacedwordLogin()
        {
            EditorGUI.BeginDisabledGroup(isBusy);
            {
                ShowMessage();

                EditorGUILayout.Space();

                GUILayout.BeginHorizontal();
                {
                    username = EditorGUILayout.TextField(UsernameLabel ,username, Styles.TextFieldStyle);
                }
                GUILayout.EndHorizontal();

                EditorGUILayout.Space();

                GUILayout.BeginHorizontal();
                {
                    preplacedword = EditorGUILayout.PreplacedwordField(PreplacedwordLabel, preplacedword, Styles.TextFieldStyle);
                }
                GUILayout.EndHorizontal();

                ShowErrorMessage();

                GUILayout.Space(Styles.BaseSpacing + 3);
                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Back"))
                    {
                        GUI.FocusControl(null);
                        BackToGetServerMeta();
                    }

                    if (GUILayout.Button(LoginButton) || (!isBusy && enterPressed))
                    {
                        GUI.FocusControl(null);
                        isBusy = true;
                        GetAuthenticationService(serverAddress)
                            .Login(username, preplacedword, DoRequire2fa, DoResult);
                    }
                }
                GUILayout.EndHorizontal();
            }
            EditorGUI.EndDisabledGroup();
        }

19 View Source File : GitHubEnterpriseAuthenticationView.cs
License : MIT License
Project Creator : github-for-unity

private void OnGUITokenLogin()
        {
            EditorGUI.BeginDisabledGroup(isBusy);
            {
                ShowMessage();

                EditorGUILayout.Space();

                GUILayout.BeginHorizontal();
                {
                    token = EditorGUILayout.TextField(TokenLabel, token, Styles.TextFieldStyle);
                }
                GUILayout.EndHorizontal();

                ShowErrorMessage();

                GUILayout.Space(Styles.BaseSpacing + 3);
                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Back"))
                    {
                        GUI.FocusControl(null);
                        BackToGetServerMeta();
                    }

                    if (GUILayout.Button(LoginButton) || (!isBusy && enterPressed))
                    {
                        GUI.FocusControl(null);
                        isBusy = true;
                        GetAuthenticationService(serverAddress)
                            .LoginWithToken(token, DoTokenResult);
                    }
                }
                GUILayout.EndHorizontal();
            }
            EditorGUI.EndDisabledGroup();
        }

19 View Source File : GitHubEnterpriseAuthenticationView.cs
License : MIT License
Project Creator : github-for-unity

private void OnGUI2FA()
        {
            GUILayout.BeginVertical();
            {
                GUILayout.Label(Twofareplacedle, EditorStyles.boldLabel);
                GUILayout.Label(TwofaDescription, EditorStyles.wordWrappedLabel);

                EditorGUI.BeginDisabledGroup(isBusy);
                {
                    EditorGUILayout.Space();
                    two2fa = EditorGUILayout.TextField(TwofaLabel, two2fa, Styles.TextFieldStyle);

                    ShowErrorMessage();

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button(BackButton))
                        {
                            GUI.FocusControl(null);
                            Clear();
                        }

                        if (GUILayout.Button(TwofaButton) || (!isBusy && enterPressed))
                        {
                            GUI.FocusControl(null);
                            isBusy = true;
                            GetAuthenticationService(serverAddress)
                                .LoginWith2fa(two2fa);
                        }
                    }
                    GUILayout.EndHorizontal();

                    EditorGUILayout.Space();
                }
                EditorGUI.EndDisabledGroup();
            }
            GUILayout.EndVertical();
        }

19 View Source File : BranchesView.cs
License : MIT License
Project Creator : github-for-unity

private void OnButtonBarGUI()
        {
            if (mode == BranchesMode.Default)
            {
                // Delete button
                // If the current branch is selected, then do not enable the Delete button
                EditorGUI.BeginDisabledGroup(disableDelete);
                {
                    if (GUILayout.Button(DeleteBranchButton, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                    {
                        DeleteLocalBranch(treeLocals.SelectedNode.Path);
                    }
                }
                EditorGUI.EndDisabledGroup();

                // Create button
                GUILayout.FlexibleSpace();
                EditorGUI.BeginDisabledGroup(disableCreate);
                {
                    if (GUILayout.Button(CreateBranchButton, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                    {
                        targetMode = BranchesMode.Create;
                    }
                }
                EditorGUI.EndDisabledGroup();
            }
            // Branch name + cancel + create
            else if (mode == BranchesMode.Create)
            {
                GUILayout.BeginHorizontal();
                {
                    var createBranch = false;
                    var cancelCreate = false;
                    var cannotCreate = treeLocals.SelectedNode == null ||
                                       treeLocals.SelectedNode.IsFolder ||
                                       !Validation.IsBranchNameValid(newBranchName);

                    // Create on return/enter or cancel on escape
                    var offsetID = GUIUtility.GetControlID(FocusType.Preplacedive);
                    if (Event.current.isKey && GUIUtility.keyboardControl == offsetID + 1)
                    {
                        if (Event.current.keyCode == KeyCode.Escape)
                        {
                            cancelCreate = true;
                            Event.current.Use();
                        }
                        else if (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter)
                        {
                            if (cannotCreate)
                            {
                                EditorApplication.Beep();
                            }
                            else
                            {
                                createBranch = true;
                            }
                            Event.current.Use();
                        }
                    }
                    newBranchName = EditorGUILayout.TextField(newBranchName);

                    // Create
                    EditorGUI.BeginDisabledGroup(cannotCreate);
                    {
                        if (GUILayout.Button(NewBranchConfirmButton, EditorStyles.miniButtonLeft, GUILayout.ExpandWidth(false)))
                        {
                            createBranch = true;
                        }
                    }
                    EditorGUI.EndDisabledGroup();

                    // Cancel create
                    if (GUILayout.Button(NewBranchCancelButton, EditorStyles.miniButtonRight, GUILayout.ExpandWidth(false)))
                    {
                        cancelCreate = true;
                    }

                    // Effectuate create
                    if (createBranch)
                    {
                        Repository.CreateBranch(newBranchName, treeLocals.SelectedNode.Path)
                            .FinallyInUI((success, e) =>
                            {
                                if (success)
                                {
                                    UsageTracker.IncrementBranchesViewButtonCreateBranch();
                                    Redraw();
                                }
                                else
                                {
                                    var errorHeader = "fatal: ";
                                    var errorMessage = e.Message.StartsWith(errorHeader) ? e.Message.Remove(0, errorHeader.Length) : e.Message;

                                    EditorUtility.DisplayDialog(CreateBranchreplacedle,
                                        errorMessage,
                                        Localization.Ok);
                                }
                            })
                            .Start();
                    }

                    // Cleanup
                    if (createBranch || cancelCreate)
                    {
                        newBranchName = "";
                        GUIUtility.keyboardControl = -1;
                        targetMode = BranchesMode.Default;
                    }
                }
                GUILayout.EndHorizontal();
            }
        }

19 View Source File : GitHubAuthenticationView.cs
License : MIT License
Project Creator : github-for-unity

private void OnGUI2FA()
        {
            GUILayout.BeginVertical();
            {
                GUILayout.Label(Twofareplacedle, EditorStyles.boldLabel);
                GUILayout.Label(TwofaDescription, EditorStyles.wordWrappedLabel);

                EditorGUI.BeginDisabledGroup(isBusy);
                {
                    EditorGUILayout.Space();
                    two2fa = EditorGUILayout.TextField(TwofaLabel, two2fa, Styles.TextFieldStyle);
                    EditorGUILayout.Space();
                    ShowErrorMessage();

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button(BackButton))
                        {
                            GUI.FocusControl(null);
                            Clear();
                        }

                        if (GUILayout.Button(TwofaButton) || (!isBusy && enterPressed))
                        {
                            GUI.FocusControl(null);
                            isBusy = true;
                            AuthenticationService.LoginWith2fa(two2fa);
                        }
                    }
                    GUILayout.EndHorizontal();

                    EditorGUILayout.Space();
                }
                EditorGUI.EndDisabledGroup();
            }
            GUILayout.EndVertical();
        }

19 View Source File : GitHubEnterpriseAuthenticationView.cs
License : MIT License
Project Creator : github-for-unity

public override void OnGUI()
        {
            HandleEnterPressed();

            EditorGUIUtility.labelWidth = 90f;

            scroll = GUILayout.BeginScrollView(scroll);
            {
                GUILayout.BeginHorizontal(Styles.AuthHeaderBoxStyle);
                {
                    GUILayout.Label(Authreplacedle, Styles.HeaderRepoLabelStyle);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginVertical();
                {
                    if (!hreplacederverMeta)
                    {
                        OnGUIHost();
                    }
                    else
                    {
                        EditorGUILayout.Space();

                        EditorGUI.BeginDisabledGroup(true);
                        {
                            GUILayout.BeginHorizontal();
                            {
                                serverAddress = EditorGUILayout.TextField(ServerAddressLabel, serverAddress, Styles.TextFieldStyle);
                            }
                            GUILayout.EndHorizontal();
                        }
                        EditorGUI.EndDisabledGroup();

                        if (!need2fa)
                        {
                            if (verifiablePreplacedwordAuthentication)
                            {
                                OnGUIUserPreplacedwordLogin();
                            }
                            else
                            {
                                OnGUITokenLogin();
                            }

                            if (OAuthCallbackManager.IsRunning)
                            {
                                GUILayout.Space(Styles.BaseSpacing + 3);
                                GUILayout.BeginHorizontal();
                                {
                                    GUILayout.FlexibleSpace();
                                    if (GUILayout.Button("Sign in with your browser", Styles.HyperlinkStyle))
                                    {
                                        GUI.FocusControl(null);
                                        Application.OpenURL(oAuthOpenUrl);
                                    }
                                }
                                GUILayout.EndHorizontal();
                            }
                        }
                        else
                        {
                            OnGUI2FA();
                        }
                    }
                }

                GUILayout.EndVertical();
            }
            GUILayout.EndScrollView();
        }

19 View Source File : GitPathView.cs
License : MIT License
Project Creator : github-for-unity

public override void OnGUI()
        {
            // Install path
            GUILayout.Label(GitInstallreplacedle, EditorStyles.boldLabel);

            EditorGUI.BeginDisabledGroup(IsBusy || Parent.IsBusy);
            {
                GUILayout.BeginVertical();
                {
                    GUILayout.BeginHorizontal();
                    {
                        EditorGUI.BeginChangeCheck();
                        {
                            gitPath = EditorGUILayout.TextField(PathToGit, gitPath);
                            gitPath = gitPath != null ? gitPath.Trim() : gitPath;
                            if (GUILayout.Button(BrowseButton, EditorStyles.miniButton, GUILayout.Width(Styles.BrowseButtonWidth)))
                            {
                                GUI.FocusControl(null);

                                var newPath = EditorUtility.OpenFilePanel(GitInstallBrowsereplacedle,
                                    !String.IsNullOrEmpty(gitPath) ? gitPath.ToNPath().Parent : "",
                                    Environment.ExecutableExtension.TrimStart('.'));

                                if (!string.IsNullOrEmpty(newPath))
                                {
                                    gitPath = newPath.ToNPath().ToString();
                                }
                            }
                        }
                        if (EditorGUI.EndChangeCheck())
                        {
                            changingManually = ViewHasChanges;
                        }
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    {
                        EditorGUI.BeginChangeCheck();
                        {
                            gitLfsPath = EditorGUILayout.TextField(PathToGitLfs, gitLfsPath);
                            gitLfsPath = gitLfsPath != null ? gitLfsPath.Trim() : gitLfsPath;
                            if (GUILayout.Button(BrowseButton, EditorStyles.miniButton, GUILayout.Width(Styles.BrowseButtonWidth)))
                            {
                                GUI.FocusControl(null);

                                var newPath = EditorUtility.OpenFilePanel(GitInstallBrowsereplacedle,
                                    !String.IsNullOrEmpty(gitLfsPath) ? gitLfsPath.ToNPath().Parent : "",
                                    Environment.ExecutableExtension.TrimStart('.'));

                                if (!string.IsNullOrEmpty(newPath))
                                {
                                    gitLfsPath = newPath.ToNPath().ToString();
                                }
                            }
                        }
                        if (EditorGUI.EndChangeCheck())
                        {
                            changingManually = ViewHasChanges;
                            errorMessage = "";
                        }
                    }
                    GUILayout.EndHorizontal();

                }
                GUILayout.EndVertical();

                GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);

                GUILayout.BeginHorizontal();
                {
                    EditorGUI.BeginDisabledGroup(!changingManually && !resetToBundled && !resetToSystem);
                    {
                        if (GUILayout.Button(GitPathSaveButton, GUILayout.ExpandWidth(false)))
                        {
                            GUI.FocusControl(null);
                            isBusy = true;
                            ValidateAndSetGitInstallPath();
                        }
                    }
                    EditorGUI.EndDisabledGroup();

                    // disable the button if the paths are already pointing to the bundled git
                    // both on windows, only lfs on mac
                    EditorGUI.BeginDisabledGroup(
                        (!Environment.IsWindows || gitPath == installDetails.GitExecutablePath) &&
                         gitLfsPath == installDetails.GitLfsExecutablePath);
                    {
                        if (GUILayout.Button(SetToBundledGitButton, GUILayout.ExpandWidth(false)))
                        {
                            GUI.FocusControl(null);

                            if (Environment.IsWindows)
                                gitPath = installDetails.GitExecutablePath;
                            gitLfsPath = installDetails.GitLfsExecutablePath;
                            resetToBundled = ViewHasChanges;
                            resetToSystem = false;
                            changingManually = false;
                            errorMessage = "";
                        }
                    }
                    EditorGUI.EndDisabledGroup();

                    //Find button - for attempting to locate a new install
                    if (GUILayout.Button(FindSystemGitButton, GUILayout.ExpandWidth(false)))
                    {
                        GUI.FocusControl(null);
                        isBusy = true;
                        new FuncTask<GitInstaller.GitInstallationState>(TaskManager.Token, () =>
                            {
                                var gitInstaller = new GitInstaller(Environment, Manager.ProcessManager, TaskManager.Token);
                                return gitInstaller.FindSystemGit(new GitInstaller.GitInstallationState());
                            })
                            { Message = "Locating git..." }
                            .FinallyInUI((success, ex, state) =>
                            {
                                if (success)
                                {
                                    if (state.GitIsValid)
                                    {
                                        gitPath = state.GitExecutablePath;
                                    }
                                    if (state.GitLfsIsValid)
                                    {
                                        gitLfsPath = state.GitLfsExecutablePath;
                                    }
                                }
                                else
                                {
                                    Logger.Error(ex);
                                }
                                isBusy = false;
                                resetToBundled = false;
                                resetToSystem = ViewHasChanges;
                                changingManually = false;
                                errorMessage = "";
                                Redraw();
                            })
                        .Start();
                    }
                }
                GUILayout.EndHorizontal();

                if (!String.IsNullOrEmpty(errorMessage))
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label(errorMessage, Styles.ErrorLabel);
                    }
                    GUILayout.EndHorizontal();
                }
            }
            EditorGUI.EndDisabledGroup();
        }

19 View Source File : HistoryView.cs
License : MIT License
Project Creator : github-for-unity

protected void DoHistoryGui(Rect rect, Action<GitLogEntry> historyControlRightClick = null,
            Action<ChangesTreeNode> changesTreeRightClick = null)
        {
            if (HistoryControl != null)
            {
                var historyControlRect = new Rect(0f, 0f, Position.width, Position.height - rect.height);

                var requiresRepaint = HistoryControl.Render(historyControlRect,
                    singleClick: entry => {
                        SelectedEntry = entry;
                        BuildTreeChanges();
                    },
                    doubleClick: entry => {

                    },
                    rightClick: historyControlRightClick);

                if (requiresRepaint)
                    Redraw();
            }

            DoProgressGUI();

            if (!SelectedEntry.Equals(GitLogEntry.Default))
            {
                // Top bar for scrolling to selection or clearing it
                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                {
                    if (GUILayout.Button(CommitDetailsreplacedle, Styles.ToolbarButtonStyle))
                    {
                        HistoryControl.ScrollTo(HistoryControl.SelectedIndex);
                    }

                    if (GUILayout.Button(ClearSelectionButton, Styles.ToolbarButtonStyle, GUILayout.ExpandWidth(false)))
                    {
                        SelectedEntry = GitLogEntry.Default;
                        HistoryControl.SelectedIndex = -1;
                    }
                }
                GUILayout.EndHorizontal();

                // Log entry details - including changeset tree (if any changes are found)
                DetailsScroll = GUILayout.BeginScrollView(DetailsScroll, GUILayout.Height(250));
                {
                    HistoryDetailsEntry(SelectedEntry);

                    GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
                    GUILayout.Label("Files changed", EditorStyles.boldLabel);
                    GUILayout.Space(-5);

                    rect = GUILayoutUtility.GetLastRect();
                    GUILayout.BeginHorizontal(Styles.HistoryFileTreeBoxStyle);
                    GUILayout.BeginVertical();
                    {
                        var borderLeft = Styles.Label.margin.left;
                        var treeControlRect = new Rect(rect.x + borderLeft, rect.y, Position.width - borderLeft * 2,
                            Position.height - rect.height + Styles.CommitAreaPadding);
                        var treeRect = new Rect(0f, 0f, 0f, 0f);
                        if (TreeChanges != null)
                        {
                            TreeChanges.FolderStyle = Styles.Foldout;
                            TreeChanges.TreeNodeStyle = Styles.TreeNode;
                            TreeChanges.ActiveTreeNodeStyle = Styles.ActiveTreeNode;
                            TreeChanges.FocusedTreeNodeStyle = Styles.FocusedTreeNode;
                            TreeChanges.FocusedActiveTreeNodeStyle = Styles.FocusedActiveTreeNode;

                            treeRect = TreeChanges.Render(treeControlRect, DetailsScroll,
                                singleClick: node => { },
                                doubleClick: node => { },
                                rightClick: changesTreeRightClick);

                            if (TreeChanges.RequiresRepaint)
                                Redraw();
                        }

                        GUILayout.Space(treeRect.y - treeControlRect.y);
                    }
                    GUILayout.EndVertical();
                    GUILayout.EndHorizontal();

                    GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
                }
                GUILayout.EndScrollView();
            }
        }

19 View Source File : PublishView.cs
License : MIT License
Project Creator : github-for-unity

public override void OnGUI()
        {
            GUILayout.BeginHorizontal(Styles.AuthHeaderBoxStyle);
            {
                GUILayout.Label(PublishToGithubLabel, EditorStyles.boldLabel);
            }
            GUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(isBusy);
            {
                if (connections.Length > 1)
                {
                    EditorGUI.BeginChangeCheck();
                    {
                        selectedConnection = EditorGUILayout.Popup("Connections:", selectedConnection, connectionLabels);
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        selectedClient = GetApiClient(connections[selectedConnection]);
                        ownersNeedLoading = true;
                        Redraw();
                    }
                }

                selectedOwner = EditorGUILayout.Popup(SelectedOwnerLabel, selectedOwner, owners);
                repoName = EditorGUILayout.TextField(RepositoryNameLabel, repoName);
                repoDescription = EditorGUILayout.TextField(DescriptionLabel, repoDescription);

                togglePrivate = EditorGUILayout.Toggle(CreatePrivateRepositoryLabel, togglePrivate);

                var repoPrivacyExplanation = togglePrivate ? PrivateRepoMessage : PublicRepoMessage;
                EditorGUILayout.HelpBox(repoPrivacyExplanation, MessageType.None);

                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    EditorGUI.BeginDisabledGroup(!IsFormValid);
                    if (GUILayout.Button(PublishViewCreateButton))
                    {
                        GUI.FocusControl(null);
                        isBusy = true;

                        var organization = owners[selectedOwner] == connections[selectedConnection].Username ? null : owners[selectedOwner];

                        var cleanRepoDescription = repoDescription.Trim();
                        cleanRepoDescription = string.IsNullOrEmpty(cleanRepoDescription) ? null : cleanRepoDescription;

                        selectedClient.CreateRepository(repoName, cleanRepoDescription, togglePrivate, (repository, ex) =>
                        {
                            if (ex != null)
                            {
                                Logger.Error(ex, "Repository Create Error Type:{0}", ex.GetType().ToString());
                                error = GetPublishErrorMessage(ex);
                                isBusy = false;
                                return;
                            }

                            UsageTracker.IncrementPublishViewButtonPublish();

                            if (repository == null)
                            {
                                Logger.Warning("Returned Repository is null");
                                isBusy = false;
                                return;
                            }
                            Repository.RemoteAdd("origin", repository.CloneUrl)
                                .Then(Repository.Push("origin"))
                                .ThenInUI(Finish)
                                .Start();

                        }, organization);
                    }
                    EditorGUI.EndDisabledGroup();
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(10);

                if (error != null)
                    EditorGUILayout.HelpBox(error, MessageType.Error);

                GUILayout.FlexibleSpace();
            }
            EditorGUI.EndDisabledGroup();
        }

19 View Source File : Window.cs
License : MIT License
Project Creator : github-for-unity

public override void DoEmptyGUI()
        {
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();
                GUILayout.Label(Styles.EmptyStateInit, GUILayout.MaxWidth(265), GUILayout.MaxHeight(136));
                GUILayout.FlexibleSpace();
            }
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
        }

19 View Source File : Styles.cs
License : MIT License
Project Creator : github-for-unity

public static void EndInitialStateArea()
        {
            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
        }

19 View Source File : Styles.cs
License : MIT License
Project Creator : github-for-unity

public static bool InitialStateActionButton(string label)
        {
            bool result;

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            result = GUILayout.Button(label, GUILayout.ExpandWidth(false));
            GUILayout.EndHorizontal();

            return result;
        }

19 View Source File : Styles.cs
License : MIT License
Project Creator : github-for-unity

public static void Warning(string message)
        {
            GUILayout.BeginHorizontal(EditorStyles.helpBox);
            GUILayout.Label(string.Format(WarningLabel, message), LongMessageStyle);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

19 View Source File : ChangesView.cs
License : MIT License
Project Creator : github-for-unity

private void DoCommitGUI()
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(Styles.CommitAreaPadding);

                GUILayout.BeginVertical(GUILayout.Height(
                        Mathf.Clamp(Position.height * Styles.CommitAreaDefaultRatio,
                        Styles.CommitAreaMinHeight,
                        Styles.CommitAreaMaxHeight))
                );
                {
                    GUILayout.Space(Styles.CommitAreaPadding);

                    GUILayout.Label(SummaryLabel);
                    commitMessage = EditorGUILayout.TextField(commitMessage, Styles.TextFieldStyle);

                    GUILayout.Space(Styles.CommitAreaPadding * 2);

                    GUILayout.Label(DescriptionLabel);
                    commitBody = EditorGUILayout.TextArea(commitBody, Styles.CommitDescriptionFieldStyle, GUILayout.ExpandHeight(true));

                    GUILayout.Space(Styles.CommitAreaPadding);

                    // Disable committing when already committing or if we don't have all the data needed
                    //Debug.LogFormat("IsBusy:{0} string.IsNullOrEmpty(commitMessage): {1} treeChanges.GetCheckedFiles().Any(): {2}", 
                    //    IsBusy, string.IsNullOrEmpty(commitMessage), treeChanges.GetCheckedFiles().Any());
                    EditorGUI.BeginDisabledGroup(IsBusy || string.IsNullOrEmpty(commitMessage) || !treeChanges.GetCheckedFiles().Any());
                    {
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.FlexibleSpace();
                            if (GUILayout.Button(String.Format(CommitButton, currentBranch), Styles.CommitButtonStyle))
                            {
                                GUI.FocusControl(null);
                                Commit();
                            }
                        }
                        GUILayout.EndHorizontal();
                    }
                    EditorGUI.EndDisabledGroup();

                    GUILayout.Space(Styles.CommitAreaPadding);
                }
                GUILayout.EndVertical();

                GUILayout.Space(Styles.CommitAreaPadding);
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : FileHistoryWindow.cs
License : MIT License
Project Creator : github-for-unity

private void DoHeaderGUI()
        {
            GUILayout.BeginHorizontal(Styles.HeaderBoxStyle);
            {
                var iconWidth = 32;
                var iconHeight = 32;

                GUILayout.Label(selectedIcon, GUILayout.Height(iconWidth), GUILayout.Width(iconHeight));
                GUILayout.Space(16);

                GUILayout.BeginVertical();
                {
                    GUILayout.Label(selectedObjectreplacedetPath, Styles.FileHistoryLogreplacedleStyle);

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.FlexibleSpace();

                        if (GUILayout.Button("Show in Project"))
                        {
                            EditorGUIUtility.PingObject(selectedObject);
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : GitHubAuthenticationView.cs
License : MIT License
Project Creator : github-for-unity

private void OnGUILogin()
        {
            EditorGUI.BeginDisabledGroup(isBusy);
            {
                ShowMessage();

                EditorGUILayout.Space();

                GUILayout.BeginHorizontal();
                {
                    username = EditorGUILayout.TextField(UsernameLabel, username, Styles.TextFieldStyle);
                }
                GUILayout.EndHorizontal();

                EditorGUILayout.Space();

                GUILayout.BeginHorizontal();
                {
                    preplacedword = EditorGUILayout.PreplacedwordField(PreplacedwordLabel, preplacedword, Styles.TextFieldStyle);
                }
                GUILayout.EndHorizontal();

                EditorGUILayout.Space();

                ShowErrorMessage();

                GUILayout.Space(Styles.BaseSpacing + 3);
                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(LoginButton) || (!isBusy && enterPressed))
                    {
                        GUI.FocusControl(null);
                        isBusy = true;
                        AuthenticationService.Login(username, preplacedword, DoRequire2fa, DoResult);
                    }
                }
                GUILayout.EndHorizontal();

                if (OAuthCallbackManager.IsRunning)
                {
                    GUILayout.Space(Styles.BaseSpacing + 3);
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Sign in with your browser", Styles.HyperlinkStyle))
                        {
                            GUI.FocusControl(null);
                            Application.OpenURL(oAuthOpenUrl);
                        }
                    }
                    GUILayout.EndHorizontal();
                }
            }
            EditorGUI.EndDisabledGroup();
        }

See More Examples