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 : CoreEditorUtils.cs
License : MIT License
Project Creator : TheSlippyPenguin

public static void DrawMultipleFields(GUIContent label, SerializedProperty[] ppts, GUIContent[] lbls)
        {
            GUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(label);
            GUILayout.BeginVertical();
            var labelWidth = EditorGUIUtility.labelWidth;
            EditorGUIUtility.labelWidth = 45;
            for (var i = 0; i < ppts.Length; ++i)
                EditorGUILayout.PropertyField(ppts[i], lbls[i]);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            EditorGUIUtility.labelWidth = labelWidth;
        }

19 View Source File : BlockEditor.cs
License : GNU General Public License v3.0
Project Creator : thiagosoara

public virtual void DrawButtonToolbar()
        {
            GUILayout.BeginHorizontal();


            // Previous Command
            if ((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.PageUp))
            {
                SelectPrevious();
                GUI.FocusControl("dummycontrol");
                Event.current.Use();
            }
            // Next Command
            if ((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.PageDown))
            {
                SelectNext();
                GUI.FocusControl("dummycontrol");
                Event.current.Use();
            }

            if (GUILayout.Button(upIcon))
            {
                SelectPrevious();
            }

            // Down Button
            if (GUILayout.Button(downIcon))
            {
                SelectNext();
            }

            GUILayout.FlexibleSpace();


            //using false to prevent forcing a longer row than will fit on smallest inspector
            var pos = EditorGUILayout.GetControlRect(false, 0, EditorStyles.objectField);
            if (pos.x != 0)
            {
                lastCMDpopupPos = pos;
                lastCMDpopupPos.x += EditorGUIUtility.labelWidth;
                lastCMDpopupPos.y += EditorGUIUtility.singleLineHeight * 2;
            }
            // Add Button
            if (GUILayout.Button(addIcon))
            {
                //this may be less reliable for HDPI scaling but previous method using editor window height is now returning 
                //  null in 2019.2 suspect ongoing ui changes, so default to screen.height and then attempt to get the better result
                int h = Screen.height;
                if (EditorWindow.focusedWindow != null) h = (int)EditorWindow.focusedWindow.position.height;
                else if (EditorWindow.mouseOverWindow != null) h = (int)EditorWindow.mouseOverWindow.position.height;

                CommandSelectorPopupWindowContent.ShowCommandMenu(lastCMDpopupPos, "", target as Block,
                    (int)(EditorGUIUtility.currentViewWidth),
                    (int)(h - lastCMDpopupPos.y));
            }

            // Duplicate Button
            if (GUILayout.Button(duplicateIcon))
            {
                Copy();
                Paste();
            }

            // Delete Button
            if (GUILayout.Button(deleteIcon))
            {
                Delete();
            }

            GUILayout.EndHorizontal();

        }

19 View Source File : CommandEditor.cs
License : GNU General Public License v3.0
Project Creator : thiagosoara

public virtual void DrawCommandInspectorGUI()
        {
            Command t = target as Command;
            if (t == null)
            {
                return;
            }

            var flowchart = (Flowchart)t.GetFlowchart();
            if (flowchart == null)
            {
                return;
            }

            CommandInfoAttribute commandInfoAttr = CommandEditor.GetCommandInfo(t.GetType());
            if (commandInfoAttr == null)
            {
                return;
            }

            GUILayout.BeginVertical(GUI.skin.box);

            if (t.enabled)
            {
                if (flowchart.ColorCommands)
                {
                    GUI.backgroundColor = t.GetButtonColor();
                }
                else
                {
                    GUI.backgroundColor = Color.white;
                }
            }
            else
            {
                GUI.backgroundColor = Color.grey;
            }
            GUILayout.BeginHorizontal(GUI.skin.button);

            string commandName = commandInfoAttr.CommandName;
            GUILayout.Label(commandName, GUILayout.MinWidth(80), GUILayout.ExpandWidth(true));

            GUILayout.FlexibleSpace();

            GUILayout.Label(new GUIContent("(" + t.ItemId + ")"));

            GUILayout.Space(10);

            GUI.backgroundColor = Color.white;
            bool enabled = t.enabled;
            enabled = GUILayout.Toggle(enabled, new GUIContent());

            if (t.enabled != enabled)
            {
                Undo.RecordObject(t, "Set Enabled");
                t.enabled = enabled;
            }

            GUILayout.EndHorizontal();
            GUI.backgroundColor = Color.white;

            EditorGUILayout.Separator();

            EditorGUI.BeginChangeCheck();
            DrawCommandGUI();
            if(EditorGUI.EndChangeCheck())
            {
                SelectedCommandDataStale = true;
            }

            EditorGUILayout.Separator();

            if (t.ErrorMessage.Length > 0)
            {
                GUIStyle style = new GUIStyle(GUI.skin.label);
                style.normal.textColor = new Color(1,0,0);
                EditorGUILayout.LabelField(new GUIContent("Error: " + t.ErrorMessage), style);
            }

            GUILayout.EndVertical();

            // Display help text
            CommandInfoAttribute infoAttr = CommandEditor.GetCommandInfo(t.GetType());
            if (infoAttr != null)
            {
                EditorGUILayout.HelpBox(infoAttr.HelpText, MessageType.Info, true);
            }
        }

19 View Source File : FlowchartEditor.cs
License : GNU General Public License v3.0
Project Creator : thiagosoara

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

            var flowchart = target as Flowchart;

            flowchart.UpdateHideFlags();

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.PropertyField(descriptionProp);
            EditorGUILayout.PropertyField(colorCommandsProp);
            EditorGUILayout.PropertyField(hideComponentsProp);
            EditorGUILayout.PropertyField(stepPauseProp);
            EditorGUILayout.PropertyField(saveSelectionProp);
            EditorGUILayout.PropertyField(localizationIdProp);
            EditorGUILayout.PropertyField(showLineNumbersProp);
            EditorGUILayout.PropertyField(luaEnvironmentProp);
            EditorGUILayout.PropertyField(luaBindingNameProp);

            // Show list of commands to hide in Add Command menu
            //ReorderableListGUI.replacedle(new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip));
            //ReorderableListGUI.ListField(hideCommandsProp);
            EditorGUILayout.PropertyField(hideCommandsProp, new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip), true);

            if(EditorGUI.EndChangeCheck())
            {
                FlowchartDataStale = true;
            }


            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(new GUIContent("Open Flowchart Window", "Opens the Flowchart Window")))
            {
                EditorWindow.GetWindow(typeof(FlowchartWindow), false, "Flowchart");
            }


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

            serializedObject.ApplyModifiedProperties();

            //Show the variables in the flowchart inspector
            GUILayout.Space(20);

            DrawVariablesGUI(false, Mathf.FloorToInt(EditorGUIUtility.currentViewWidth) - VariableListAdaptor.ReorderListSkirts);

        }

19 View Source File : InvokeMethodEditor.cs
License : GNU General Public License v3.0
Project Creator : thiagosoara

private void ShowParameters(SerializedObject objTarget, GameObject gameObject, MethodInfo method)
        {
            var methodParametersProp = objTarget.FindProperty("methodParameters");
            var objParams = method.GetParameters();

            if (objParams.Length > 0)
            {
                GUILayout.Space(20);
                EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                for (int i = 0; i < objParams.Length; i++)
                {
                    var objParam = objParams[i];

                    GUILayout.BeginHorizontal();
                    string labelFormat = string.Format("{0}: {1}", objParam.ParameterType.Name, objParam.Name);

                    var objItemProp = methodParametersProp.GetArrayElementAtIndex(i);
                    var serObjValueProp = objItemProp.FindPropertyRelative("objValue");
                    var serVariableKeyProp = objItemProp.FindPropertyRelative("variableKey");
                    var serValueTypereplacedemblynameProp = serObjValueProp.FindPropertyRelative("typereplacedemblyname");
                    var serValueTypeFullnameProp = serObjValueProp.FindPropertyRelative("typeFullname");

                    serValueTypereplacedemblynameProp.stringValue = objParam.ParameterType.replacedemblyQualifiedName;
                    serValueTypeFullnameProp.stringValue = objParam.ParameterType.FullName;

                    bool isDrawn = true;

                    if (string.IsNullOrEmpty(serVariableKeyProp.stringValue))
                    {
                        isDrawn = DrawTypedPropertyInput(labelFormat, serObjValueProp, objParam.ParameterType);
                    }

                    if (isDrawn)
                    {
                        var vars = GetFungusVariablesByType(targetMethod.GetFlowchart().Variables, objParam.ParameterType);
                        var values = new string[] { "<Value>" };
                        var displayValue = values.Concat(vars).ToList();

                        int index = displayValue.IndexOf(serVariableKeyProp.stringValue);

                        if (index == -1)
                        {
                            index = 0;
                        }

                        if (string.IsNullOrEmpty(serVariableKeyProp.stringValue))
                        {
                            index = EditorGUILayout.Popup(index, displayValue.ToArray(), GUILayout.MaxWidth(80));
                        }
                        else
                        {
                            index = EditorGUILayout.Popup(labelFormat, index, displayValue.ToArray());
                        }

                        if (index > 0)
                        {
                            serVariableKeyProp.stringValue = displayValue[index];
                        }
                        else
                        {
                            serVariableKeyProp.stringValue = null;
                        }
                    }
                    else
                    {
                        var style = EditorStyles.label;
                        var prevColor = style.normal.textColor;
                        style.normal.textColor = Color.red;
                        EditorGUILayout.LabelField(new GUIContent(objParam.ParameterType.Name + " cannot be drawn, don´t use this method in the flowchart."), style);
                        style.normal.textColor = prevColor;
                    }

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

                objTarget.ApplyModifiedProperties();
            }
        }

19 View Source File : SfxrGenerator.cs
License : GNU General Public License v3.0
Project Creator : thiagosoara

protected virtual void OnGUI() {
		// Initializations
		if (soundParameters == null) {
			soundParameters = new SfxrParams();
			soundParameters.Randomize();
		}
		
		if (synth == null) {
			synth = new SfxrSynth();
		}

		bool soundChanged = false;

		// Begin UI
		scrollPositionRoot = GUILayout.BeginScrollView(scrollPositionRoot);
		GUILayout.BeginHorizontal();

		// Left column (generator buttons, copy & paste)
		soundChanged = RenderLeftColumn(soundParameters) || soundChanged;

		// Main settings column
		soundChanged = RenderSettingsColumn(soundParameters) || soundChanged;

		// Ends the UI
		GUILayout.EndHorizontal();
		GUILayout.EndScrollView();
		
		// Play sound if necessary
		if (soundChanged) {
			synth.parameters.SetSettingsString(soundParameters.GetSettingsString());
			PlaySound();
			CreateWavePreview();
		}

	}

19 View Source File : PPBlendShapeGui.Gui.cs
License : GNU General Public License v3.0
Project Creator : thojmr

internal void GuiSliderControlls(int i)
		{
			string smrName = null;
			int kkBsIndex = -1;
			string sliderLabel = "<Empty Mesh>";

			var guiSmr = PregnancyPlusHelper.GetMeshRendererByName(_charaInstance.ChaControl, guiSkinnedMeshRenderers[i].name, guiSkinnedMeshRenderers[i].vertexCount);
			var smrIsEmpty = guiSmr == null || guiSmr.sharedMesh == null || guiSmr.sharedMesh.blendShapeCount == 0;

			//Get slider details
			if (!smrIsEmpty) 
			{
				smrName = guiSmr.name;			
				//Find the index of the Preg+ blendshape
				kkBsIndex = GetBlendShapeIndexFromName(guiSmr.sharedMesh);
				if (kkBsIndex >= 0)
				{
					sliderLabel = guiSmr.sharedMesh.GetBlendShapeName(kkBsIndex);
				}
			}

			//Check for empty blendshapes
			if ((kkBsIndex < 0 || sliderLabel == null) && smrName != null)
			{							
				smrIsEmpty = true;
				//When blendshape becomes invalid but mesh still exists, set the value to 0, so it will be reset in HSPE too if needed
				_sliderValues[smrName] = 0;
				_sliderValuesHistory[smrName] = -1;//To trigger clear val				
			}
			else if (kkBsIndex < 0 || sliderLabel == null)
			{
				//If the blendshape and smr dissapeared for some reason
				smrIsEmpty = true;
			}

			//Disable a single slider when the mesh is empty
			GUI.enabled = !smrIsEmpty;

			//Create a slider for the matching Preg+ blendshape
			GUILayout.BeginHorizontal(new GUILayoutOption[0]);			
			if (smrName != null)
			{
				GUILayout.Label(sliderLabel, lastTouched == i ? _labelreplacedleActiveStyle : _labelreplacedleStyle, new GUILayoutOption[0]);
				_sliderValues[smrName] = GUILayout.HorizontalSlider(_sliderValues[smrName], 0f, 100f, new GUILayoutOption[0]);
				GUILayout.Label(_sliderValues[smrName].ToString("#0"), _labelValueStyle, new GUILayoutOption[0]);
			}
			else
			{
				//Dummy disabled slider
				GUILayout.Label(sliderLabel, lastTouched == i ? _labelreplacedleActiveStyle : _labelreplacedleStyle, new GUILayoutOption[0]);
				GUILayout.HorizontalSlider(0, 0f, 100f, new GUILayoutOption[0]);
				GUILayout.Label(0.ToString("#0"), _labelValueStyle, new GUILayoutOption[0]);
			}
			GUILayout.EndHorizontal();

			GUI.enabled = true;

			//Don't need to check for slider changes when null (The Gui will close soon anyway)
			if (smrName == null) return;

			//When user changed slider value
			if (_sliderValues[smrName] != _sliderValuesHistory[smrName]) 
			{					
				lastTouched = i;
				// if (PregnancyPlusPlugin.DebugLog.Value)  PregnancyPlusPlugin.Logger.LogInfo($" BlendShapeSlider changed {smrName} > kkBsIndex {kkBsIndex}  val {_sliderValues[smrName]}");

				//If there are no blendshapes for this mesh anymore just reset it in HSPE
				if (kkBsIndex < 0) 
				{
					ResetHspeBlendShapes(new List<MeshIdentifier> { guiSkinnedMeshRenderers[i] });
					_sliderValuesHistory[smrName] = _sliderValues[smrName];
					return;
				}

				try 
				{					
					//We want to use HSPE when we can because changes to it will integrate with Timeline and VNGE
					HSPEExists = SetHspeBlendShapeWeight(guiSmr, kkBsIndex, _sliderValues[smrName]);
				}	
				catch (Exception e)
				{
					//If KKPE does not exists catch the error, and warn the user
					PregnancyPlusPlugin.errorCodeCtrl.LogErrorCode("-1", ErrorCode.PregPlus_HSPENotFound, 
                    	$"SetHspeBlendShapeWeight > HSPE not found {e.Message} ");
					HSPEExists = false;
				}

				if (!HSPEExists) 
				{
					//If HSPE not found adjust the weight the normal way, that won't integrate with VNGE, or Timeline, but is still visible to the user
					guiSmr.SetBlendShapeWeight(kkBsIndex, _sliderValues[smrName]);
				}				
			}
			//If the user changed the blendshape weight in KKPE (or elsewhere), update the GUI to match
			else if (_sliderValues[smrName] != guiSmr.GetBlendShapeWeight(kkBsIndex)) 
			{
				_sliderValues[smrName] = _sliderValuesHistory[smrName] = guiSmr.GetBlendShapeWeight(kkBsIndex);
			}
			
			_sliderValuesHistory[smrName] = _sliderValues[smrName];
		}

19 View Source File : AudioManagerInspector.cs
License : MIT License
Project Creator : Tobbse

static public bool DrawHeader( string text, string key, bool forceOn ) {
		bool state = EditorPrefs.GetBool(key, true);
		
		GUILayout.Space(3f);
		if (!forceOn && !state) GUI.backgroundColor = new Color(0.8f, 0.8f, 0.8f);
		GUILayout.BeginHorizontal();
		GUILayout.Space(3f);
		
		GUI.changed = false;
		text = "<b><size=11>" + text + "</size></b>";
		if (state) text = "\u25BC " + text;
		else text = "\u25B6 " + text;
		if (!GUILayout.Toggle(true, text, "dragtab", GUILayout.MinWidth(20f))) state = !state;
		if (GUI.changed) EditorPrefs.SetBool(key, state);
		
		GUILayout.Space(2f);
		GUILayout.EndHorizontal();
		GUI.backgroundColor = Color.white;
		if (!forceOn && !state) GUILayout.Space(3f);
		return state;
	}

19 View Source File : AudioManagerInspector.cs
License : MIT License
Project Creator : Tobbse

static public void EndContents() {
		GUILayout.Space(3f);
		GUILayout.EndVertical();
		EditorGUILayout.EndHorizontal();
		GUILayout.Space(3f);
		GUILayout.EndHorizontal();
		GUILayout.Space(3f);
	}

19 View Source File : GUIHelper.cs
License : MIT License
Project Creator : Tobbse

public static void HInset(int pixels, Worker worker) {
      InOut( 
        () => {
          GUILayout.BeginHorizontal();
          GUILayout.Space(pixels);
          GUILayout.BeginVertical();
        },
        worker,
        () => {
          GUILayout.EndVertical();
          GUILayout.EndHorizontal();
        }
      );
    }

19 View Source File : TeleportTransitionWarpInspector.cs
License : MIT License
Project Creator : Tobbse

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

		var warp = (TeleportTransitionWarp) target;

		warp.PositionLerp = EditorGUILayout.CurveField("Position Lerp", warp.PositionLerp, GUILayout.Height(50));

		GUILayout.BeginHorizontal();
		GUILayout.Label("Position Lerp Modes");
		if (GUILayout.Button("Default"))
		{
			warp.PositionLerp = AnimationCurve.Linear(0, 0, 1, 1);
		}
		if (GUILayout.Button("Ease"))
		{
			warp.PositionLerp = AnimationCurve.EaseInOut(0, 0, 1, 1);
		}
		if (GUILayout.Button("Step 5"))
		{
			CreateStep(warp, 5);
		}
		if (GUILayout.Button("Step 10"))
		{
			CreateStep(warp, 10);
		}
		GUILayout.EndHorizontal();
	}

19 View Source File : OVRSystemProfilerPanel.cs
License : MIT License
Project Creator : Tobbse

void OnGUI()
	{
		showAndroidOptions = EditorGUILayout.Foldout(showAndroidOptions, "Android Tools");

		if (showAndroidOptions)
		{
			GUILayout.BeginHorizontal();
			EditorGUILayout.LabelField("Android SDK root path: ", androidSdkRootPath);
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal();
			if (GUILayout.Button("Start Server"))
			{
				if (adbTool == null)
				{
					adbTool = new OVRADBTool(androidSdkRootPath);
				}
				if (adbTool.isReady)
				{
					int exitCode = adbTool.StartServer(null);
					EditorUtility.DisplayDialog("ADB StartServer", (exitCode == 0 ? "Success" : "Failure. ExitCode = " + exitCode.ToString()), "Ok");
				}
				else
				{
					EditorUtility.DisplayDialog("Can't locate ADBTool", adbTool.adbPath, "Ok");
				}
			}
			if (GUILayout.Button("Kill Server"))
			{
				if (adbTool == null)
				{
					adbTool = new OVRADBTool(androidSdkRootPath);
				}
				if (adbTool.isReady)
				{
					int exitCode = adbTool.KillServer(null);
					EditorUtility.DisplayDialog("ADB KillServer", (exitCode == 0 ? "Success" : "Failure. ExitCode = " + exitCode.ToString()), "Ok");
				}
				else
				{
					EditorUtility.DisplayDialog("Can't locate ADBTool", adbTool.adbPath, "Ok");
				}
			}
			if (GUILayout.Button("Forward Port"))
			{
				if (adbTool == null)
				{
					adbTool = new OVRADBTool(androidSdkRootPath);
				}
				if (adbTool.isReady)
				{
					int exitCode = adbTool.ForwardPort(remoteListeningPort, null);
					EditorUtility.DisplayDialog("ADB ForwardPort", (exitCode == 0 ? "Success" : "Failure. ExitCode = " + exitCode.ToString()), "Ok");
					OVRPlugin.SendEvent("device_metrics_profiler", (exitCode == 0 ? "adb_forward_success" : "adb_forward_failure"));
				}
				else
				{
					EditorUtility.DisplayDialog("Can't locate ADBTool", adbTool.adbPath, "Ok");
				}
			}
			if (GUILayout.Button("Release Port"))
			{
				if (adbTool == null)
				{
					adbTool = new OVRADBTool(androidSdkRootPath);
				}
				if (adbTool.isReady)
				{
					int exitCode = adbTool.ReleasePort(remoteListeningPort, null);
					EditorUtility.DisplayDialog("ADB ReleasePort", (exitCode == 0 ? "Success" : "Failure. ExitCode = " + exitCode.ToString()), "Ok");
				}
				else
				{
					EditorUtility.DisplayDialog("Can't locate ADBTool", adbTool.adbPath, "Ok");
				}
			}
			GUILayout.EndHorizontal();
		}

		EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);

		GUILayout.BeginHorizontal();
		remoteListeningPort = EditorGUILayout.DelayedIntField("Remote Port", remoteListeningPort);

		if (tcpClient.connectionState == OVRNetwork.OVRNetworkTcpClient.ConnectionState.Disconnected)
		{
			if (GUILayout.Button("Connect"))
			{
				ConnectPerfMetricsTcpServer();
				pauseReceiveMetrics = false;
				OVRPlugin.SendEvent("device_metrics_profiler", "connect");
			}
		}
		else
		{
			if (tcpClient.connectionState == OVRNetwork.OVRNetworkTcpClient.ConnectionState.Connecting)
			{
				if (GUILayout.Button("Connecting ... Click again to Cancel"))
				{
					DisconnectPerfMetricsTcpServer();
					OVRPlugin.SendEvent("device_metrics_profiler", "cancel");
				}
			}
			else
			{
				if (GUILayout.Button("Disconnect"))
				{
					DisconnectPerfMetricsTcpServer();
					OVRPlugin.SendEvent("device_metrics_profiler", "disconnect");
				}

				if (GUILayout.Button(pauseReceiveMetrics ? "Continue" : "Pause"))
				{
					pauseReceiveMetrics = !pauseReceiveMetrics;
				}
			}
		}
		GUILayout.EndHorizontal();

		EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);

		lock (receivedMetricsList)
		{
			PresentIntProperty("Frame Count", "frameCount");
			PresentIntProperty("Dropped Frame Count", "compositorDroppedFrameCount");

			float? avgFrameTime = GetAveragePerfValueFloat("deltaFrameTime");
			if (avgFrameTime.HasValue)
			{
				float fps = 1.0f / avgFrameTime.Value;
				EditorGUILayout.BeginHorizontal();
				EditorGUILayout.LabelField("FPS", GUILayout.Width(labelWidth));
				EditorGUILayout.LabelField(string.Format("{0:F1}", fps));
				EditorGUILayout.EndHorizontal();
			}

			int? deviceCpuClockLevel = GetLatestPerfValueInt("deviceCpuClockLevel");
			int? deviceGpuClockLevel = GetLatestPerfValueInt("deviceGpuClockLevel");
			float? deviceCpuClockFrequencyInMHz = GetLatestPerfValueFloat("deviceCpuClockFrequencyInMHz");
			float? deviceGpuClockFrequencyInMHz = GetLatestPerfValueFloat("deviceGpuClockFrequencyInMHz");

			if (deviceCpuClockLevel.HasValue || deviceCpuClockFrequencyInMHz.HasValue)
			{
				string cpuLabel;
				string cpuText;
				if (deviceCpuClockLevel.HasValue && deviceCpuClockFrequencyInMHz.HasValue)
				{
					cpuLabel = "CPU Level (Freq)";
					cpuText = string.Format("{0} ({1:F0} MHz)", deviceCpuClockLevel, deviceCpuClockFrequencyInMHz);
				}
				else if (deviceCpuClockLevel.HasValue)
				{
					cpuLabel = "CPU Level";
					cpuText = string.Format("{0}", deviceCpuClockLevel);
				}
				else
				{
					cpuLabel = "CPU Frequency";
					cpuText = string.Format("{0:F0} MHz", deviceCpuClockFrequencyInMHz);
				}
				PresentText(cpuLabel, cpuText);
			}

			if (deviceGpuClockLevel.HasValue || deviceGpuClockFrequencyInMHz.HasValue)
			{
				string cpuLabel;
				string cpuText;
				if (deviceGpuClockLevel.HasValue && deviceGpuClockFrequencyInMHz.HasValue)
				{
					cpuLabel = "GPU Level (Freq)";
					cpuText = string.Format("{0} ({1:F0} MHz)", deviceGpuClockLevel, deviceGpuClockFrequencyInMHz);
				}
				else if (deviceGpuClockLevel.HasValue)
				{
					cpuLabel = "GPU Level";
					cpuText = string.Format("{0}", deviceGpuClockLevel);
				}
				else
				{
					cpuLabel = "GPU Frequency";
					cpuText = string.Format("{0:F0} MHz", deviceGpuClockFrequencyInMHz);
				}
				PresentText(cpuLabel, cpuText);
			}

			PresentColumnreplacedles("Current", "Average", "Peak");

			PresentFloatTimeInMs("Frame Time", "deltaFrameTime", 0.020f, true, true);
			PresentFloatTimeInMs("App CPU Time", "appCpuTime", 0.020f, true, true);
			PresentFloatTimeInMs("App GPU Time", "appGpuTime", 0.020f, true, true);
			PresentFloatTimeInMs("Compositor CPU Time", "compositorCpuTime", 0.020f, true, true);
			PresentFloatTimeInMs("Compositor GPU Time", "compositorGpuTime", 0.020f, true, true);
			PresentFloatPercentage("CPU Util (Average)", "systemCpuUtilAveragePercentage", false, false);
			PresentFloatPercentage("CPU Util (Worst Core)", "systemCpuUtilWorstPercentage", false, false);
			PresentFloatPercentage("GPU Util", "systemGpuUtilPercentage", false, false);
		}
	}

19 View Source File : OVRPlatformTool.cs
License : MIT License
Project Creator : Tobbse

public static void HInset(int pixels, Worker worker)
			{
				InOut(
					() => {
						GUILayout.BeginHorizontal();
						GUILayout.Space(pixels);
						GUILayout.BeginVertical();
					},
					worker,
					() => {
						GUILayout.EndVertical();
						GUILayout.EndHorizontal();
					}
				);
			}

19 View Source File : UnityProjectSetup.cs
License : GNU General Public License v3.0
Project Creator : ToniMacaroni

private void AddFixButton(string text, Action callback)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(text);
            if (GUILayout.Button("Fix")) callback?.Invoke();
            GUILayout.EndHorizontal();
        }

19 View Source File : ITU_ImportTxmWindow.cs
License : MIT License
Project Creator : Tunied

private void DrawRunButtonGUI()
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Run", GUILayout.Width(100), GUILayout.Height(50)))
            {
                OnClickRunBtn();
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

19 View Source File : SwarmBrushEditor.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnPaintInspectorGUI()
    {
        if (BrushEditorUtility.SceneIsPrepared())
        {
            GUILayout.BeginHorizontal();
            brush.m_Difficulty = EditorGUILayout.Slider("Difficulty", brush.m_Difficulty, 0f, 1f);
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
            GUILayout.Label("Paint areas where you want minions spawning.");
            GUILayout.Label("Adjust difficulty slider for more and tougher minions.");
        }
        else
        {
            BrushEditorUtility.UnpreparedSceneInspector();
        }
    }

19 View Source File : MusicController.cs
License : MIT License
Project Creator : Unity-Technologies

void OnGUI()
    {
        if (GUILayout.Button("GUI"))
            showGUI = !showGUI;

        if (showGUI)
        {
            GUILayout.BeginHorizontal();
                GUILayout.Label (string.Format("Speed={0:00}%", playbackSpeed * 100));
                float newPlaybackSpeed = GUILayout.HorizontalSlider (playbackSpeed, 0.5f, 2.0f);
                if (newPlaybackSpeed != playbackSpeed)
                {
                    playbackSpeed = newPlaybackSpeed;
                    mixer.SetFloat ("MasterPlaybackSpeed", playbackSpeed);
                    mixer.SetFloat ("MasterPitchShift", 1.0f / playbackSpeed);
                    mixer.SetFloat ("EchoDelayTime", 237.0f / playbackSpeed);
                }
            GUILayout.EndHorizontal();

            int index = 0;
            foreach (var s in snapshots)
            {
                if (GUILayout.Button("Switch to snapshot " + s))
                {
                    segmentCounter = 0;
                    currSnapshot = index;
                    snapshots[currSnapshot].TransitionTo(transitionTimes[currSnapshot]);
                }
                index++;
            }
        }
    }

19 View Source File : NetworkManagerEditor.cs
License : MIT License
Project Creator : Unity-Technologies

private static void DrawInstallMultiplayerToolsTip()
        {
            const string getToolsText = "Access additional tools for multiplayer development by installing the Multiplayer Tools package in the Package Manager.";
            const string openDocsButtonText = "Open Docs";
            const string dismissButtonText = "Dismiss";
            const string targetUrl = "https://docs-multiplayer.unity3d.com/docs/tools/install-tools";
            const string infoIconName = "console.infoicon";

            if (PlayerPrefs.GetInt(InstallMultiplayerToolsTipDismissedPlayerPrefKey, 0) != 0)
            {
                return;
            }

            if (s_CenteredWordWrappedLabelStyle == null)
            {
                s_CenteredWordWrappedLabelStyle = new GUIStyle(GUI.skin.label);
                s_CenteredWordWrappedLabelStyle.wordWrap = true;
                s_CenteredWordWrappedLabelStyle.alignment = TextAnchor.MiddleLeft;
            }

            if (s_HelpBoxStyle == null)
            {
                s_HelpBoxStyle = new GUIStyle(EditorStyles.helpBox);
                s_HelpBoxStyle.padding = new RectOffset(10, 10, 10, 10);
            }

            var openDocsButtonStyle = GUI.skin.button;
            var dismissButtonStyle = EditorStyles.linkLabel;

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(s_HelpBoxStyle, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false), GUILayout.MaxWidth(800));
            {
                GUILayout.Label(new GUIContent(EditorGUIUtility.IconContent(infoIconName)), GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true));
                GUILayout.Space(4);
                GUILayout.Label(getToolsText, s_CenteredWordWrappedLabelStyle, GUILayout.ExpandHeight(true));

                GUILayout.Space(4);

                GUILayout.BeginVertical();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(openDocsButtonText, openDocsButtonStyle, GUILayout.Width(90), GUILayout.Height(30)))
                {
                    Application.OpenURL(targetUrl);
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndVertical();

                GUILayout.Space(4);

                GUILayout.BeginVertical();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(dismissButtonText, dismissButtonStyle, GUILayout.ExpandWidth(false)))
                {
                    PlayerPrefs.SetInt(InstallMultiplayerToolsTipDismissedPlayerPrefKey, 1);
                }
                EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
                GUILayout.FlexibleSpace();
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.Space(10);
        }

19 View Source File : NetworkTransformEditor.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnInspectorGUI()
        {
            EditorGUILayout.LabelField("Syncing", EditorStyles.boldLabel);
            {
                GUILayout.BeginHorizontal();

                var rect = GUILayoutUtility.GetRect(EditorGUIUtility.fieldWidth, s_MaxRowWidth, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight, EditorStyles.numberField);
                var ctid = GUIUtility.GetControlID(7231, FocusType.Keyboard, rect);

                rect = EditorGUI.PrefixLabel(rect, ctid, s_PositionLabel);
                rect.width = s_ToggleOffset;

                m_SyncPositionXProperty.boolValue = EditorGUI.ToggleLeft(rect, "X", m_SyncPositionXProperty.boolValue);
                rect.x += s_ToggleOffset;
                m_SyncPositionYProperty.boolValue = EditorGUI.ToggleLeft(rect, "Y", m_SyncPositionYProperty.boolValue);
                rect.x += s_ToggleOffset;
                m_SyncPositionZProperty.boolValue = EditorGUI.ToggleLeft(rect, "Z", m_SyncPositionZProperty.boolValue);

                GUILayout.EndHorizontal();
            }
            {
                GUILayout.BeginHorizontal();

                var rect = GUILayoutUtility.GetRect(EditorGUIUtility.fieldWidth, s_MaxRowWidth, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight, EditorStyles.numberField);
                var ctid = GUIUtility.GetControlID(7231, FocusType.Keyboard, rect);

                rect = EditorGUI.PrefixLabel(rect, ctid, s_RotationLabel);
                rect.width = s_ToggleOffset;

                m_SyncRotationXProperty.boolValue = EditorGUI.ToggleLeft(rect, "X", m_SyncRotationXProperty.boolValue);
                rect.x += s_ToggleOffset;
                m_SyncRotationYProperty.boolValue = EditorGUI.ToggleLeft(rect, "Y", m_SyncRotationYProperty.boolValue);
                rect.x += s_ToggleOffset;
                m_SyncRotationZProperty.boolValue = EditorGUI.ToggleLeft(rect, "Z", m_SyncRotationZProperty.boolValue);

                GUILayout.EndHorizontal();
            }
            {
                GUILayout.BeginHorizontal();

                var rect = GUILayoutUtility.GetRect(EditorGUIUtility.fieldWidth, s_MaxRowWidth, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight, EditorStyles.numberField);
                var ctid = GUIUtility.GetControlID(7231, FocusType.Keyboard, rect);

                rect = EditorGUI.PrefixLabel(rect, ctid, s_ScaleLabel);
                rect.width = s_ToggleOffset;

                m_SyncScaleXProperty.boolValue = EditorGUI.ToggleLeft(rect, "X", m_SyncScaleXProperty.boolValue);
                rect.x += s_ToggleOffset;
                m_SyncScaleYProperty.boolValue = EditorGUI.ToggleLeft(rect, "Y", m_SyncScaleYProperty.boolValue);
                rect.x += s_ToggleOffset;
                m_SyncScaleZProperty.boolValue = EditorGUI.ToggleLeft(rect, "Z", m_SyncScaleZProperty.boolValue);

                GUILayout.EndHorizontal();
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Thresholds", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_PositionThresholdProperty);
            EditorGUILayout.PropertyField(m_RotAngleThresholdProperty);
            EditorGUILayout.PropertyField(m_ScaleThresholdProperty);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Configurations", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_InLocalSpaceProperty);
            EditorGUILayout.PropertyField(m_InterpolateProperty);

            // if rigidbody is present but network rigidbody is not present
            var go = ((NetworkTransform)target).gameObject;
            if (go.TryGetComponent<Rigidbody>(out _) && go.TryGetComponent<NetworkRigidbody>(out _) == false)
            {
                EditorGUILayout.HelpBox("This GameObject contains a Rigidbody but no NetworkRigidbody.\n" +
                    "Add a NetworkRigidbody component to improve Rigidbody synchronization.", MessageType.Warning);
            }

            if (go.TryGetComponent<Rigidbody2D>(out _) && go.TryGetComponent<NetworkRigidbody2D>(out _) == false)
            {
                EditorGUILayout.HelpBox("This GameObject contains a Rigidbody2D but no NetworkRigidbody2D.\n" +
                    "Add a NetworkRigidbody2D component to improve Rigidbody2D synchronization.", MessageType.Warning);
            }

            serializedObject.ApplyModifiedProperties();
        }

19 View Source File : IMGUIVisualContainer.cs
License : MIT License
Project Creator : Unity-Technologies

protected void EndAlignment()
        {
            switch (style.alignment)
            {
                case StyleSheet.Alignment.HorizontalCenter:
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                    break;
                case StyleSheet.Alignment.VerticalCenter:
                    GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    break;
                case StyleSheet.Alignment.BothCenter:
                    GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                    break;
            }
        }

19 View Source File : DelightingToolVisualContainer.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnGUI()
        {
            var resizeHandleId = EditorGUIUtility.GetControlID(kResizeHandle, FocusType.Preplacedive);

            GUILayout.BeginHorizontal();
            GUILayout.BeginHorizontal(GUILayout.Width(m_SpliterPosition));
            m_InspectorToolbar.OnGUI();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            m_CanvasToolbar.OnGUI();
            GUILayout.EndHorizontal();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical(GUILayout.Width(m_SpliterPosition));
            m_Inspector.OnGUI();
            GUILayout.EndVertical();

            m_SpliterPosition = EditorGUIXLayout.HorizontalHandle(resizeHandleId, m_SpliterPosition, kMinSplitterPosition, kMaxSplitterPosition);

            m_Canvas.OnGUI();
            GUILayout.EndHorizontal();

            var progressRect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandWidth(true), GUILayout.Height(EditorGUIUtility.singleLineHeight));
            if (GetValue(kLoadingShow))
                EditorGUI.ProgressBar(progressRect, GetValue(kLoadingProgress), GetValue(kLoadingContent));
            else
                EditorGUI.ProgressBar(progressRect, 0, string.Empty);
        }

19 View Source File : DelightingToolCanvasToolbarContainer.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnGUI()
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar);

            var hasPreviewTexture = GetValue(kPreviewTexture) != null;
            GUI.enabled = hasPreviewTexture;
            SetValue(kOverrideReferenceZone, GUILayout.Toggle(GetValue(kOverrideReferenceZone), Content.exposureGizmoLabel, EditorStyles.toolbarButton));

            if (GUILayout.Button(Content.resetExposureLabel, EditorStyles.toolbarButton))
                ExecuteCommand(kCmdResetExposureZone);

            if (GUILayout.Button(Content.fitToWindowLabel, EditorStyles.toolbarButton))
                SetValue(kFitCanvasToWindow, true);

            GUILayout.FlexibleSpace();

            var shouldRenderPreview = false;
            var showViewModes = (GetValue(kDisplayedUI) & DelightingUI.Display.FieldViewMode) != 0;
            if (showViewModes)
                shouldRenderPreview |= SetValue(kLeftViewMode, (DelightingViewMode)EditorGUILayout.EnumPopup(GetValue(kLeftViewMode), EditorStyles.toolbarPopup, GUILayout.Width(130f)));
            shouldRenderPreview |= SetValue(kCompareViewLerp, GUILayout.HorizontalSlider(GetValue(kCompareViewLerp), 0f, 1f, DelightingStyles.preSlider, DelightingStyles.preSliderThumb, GUILayout.Width(140f)));
            if (showViewModes)
                shouldRenderPreview |= SetValue(kRightViewMode, (DelightingViewMode)EditorGUILayout.EnumPopup(GetValue(kRightViewMode), EditorStyles.toolbarPopup, GUILayout.Width(130f)));

            if (shouldRenderPreview)
                ExecuteCommand(kCmdRenderPreview);
            GUI.enabled = true;

            GUILayout.FlexibleSpace();

            SetValue(kDisplayedUIMode, (DelightingUI.Mode)EditorGUILayout.EnumPopup(GetValue(kDisplayedUIMode), EditorStyles.toolbarDropDown));

            GUILayout.EndHorizontal();
        }

19 View Source File : DelightingToolDebugTextureContainer.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnGUI()
        {
            SetValue(kLatLongExposure, EditorGUILayout.Slider(Content.kLatLongExposureLabel, GetValue(kLatLongExposure), 0, 1));

            var latLongA = GetValue(kLatLongA);
            if (latLongA != null)
            {
                var mat = DelightingService.GetLatLongMaterial(
                    latLongA,
                    GetValue(kNormalsTexture),
                    GetValue(kLatLongAverage),
                    GetValue(kOverrideReferenceZone),
                    GetValue(kLatLongExposure),
                    GetValue(kSafetyZoneParams),
                    false);

                var oldRt = RenderTexture.active;
                m_latLongExposed = DelightingHelpers.InstantiateRTIfRequired(m_latLongExposed, latLongA.width, latLongA.height, false, TextureWrapMode.Clamp);
                DelightingHelpers.PushSRGBWrite(false);
                Graphics.Blit(null, m_latLongExposed, mat);
                DelightingHelpers.PopSRGBWrite();
                RenderTexture.active = oldRt;

                GUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(Content.kLatLongALabel, EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(Content.kExportLabel))
                    ExecuteCommand(kCmdExportMainEnvMap);
                GUILayout.EndHorizontal();

                EditorGUILayout.Space();

                var rect = GUILayoutUtility.GetAspectRect(latLongA.width / (float)latLongA.height);
                GUI.DrawTexture(rect, m_latLongExposed);
                EditorGUILayout.Space();
            }




            var bakedLut = GetValue(kBakedLUT);
            if (bakedLut != null)
            {

                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Content.kBakedLUTLabel, EditorStyles.boldLabel);

                EditorGUILayout.Space();

                var rect = GUILayoutUtility.GetAspectRect(bakedLut.width / (float)bakedLut.height);
                GUI.DrawTexture(rect, bakedLut);
                EditorGUILayout.Space();
            }
        }

19 View Source File : DelightingToolInspectorContainer.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnGUI()
        {
            var displays = GetValue(kDisplayedUI);
            var errorCode = GetValue(kInputErrorCode);

            m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
            if ((displays & DelightingUI.Display.SectionInput) != 0)
            {
                EditorGUILayout.Space();
                SetValue(kFoldInputParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldInputParameters), Content.inputParametersreplacedle, DelightingHelpers.GetIcon(errorCode, kInputError)));
                if (GetValue(kFoldInputParameters))
                {
                    ++EditorGUI.indentLevel;
                    if ((displays & DelightingUI.Display.FieldBaseTexture) != 0)
                        SetValue(kBaseTexture, EditorGUIXLayout.InlineObjectField(Content.baseTextureLabel, GetValue(kBaseTexture), DelightingHelpers.GetIcon(errorCode, kBaseValueError)));
                    if ((displays & DelightingUI.Display.FieldNormalsTexture) != 0)
                        SetValue(kNormalsTexture, EditorGUIXLayout.InlineObjectField(Content.normalsTextureLabel, GetValue(kNormalsTexture), DelightingHelpers.GetIcon(errorCode, kNormalsValueError)));
                    if ((displays & DelightingUI.Display.FieldBentNormalsTexture) != 0)
                        SetValue(kBentNormalsTexture, EditorGUIXLayout.InlineObjectField(Content.bentNormalsTextureLabel, GetValue(kBentNormalsTexture), DelightingHelpers.GetIcon(errorCode, kBentNormalsValueError)));
                    if ((displays & DelightingUI.Display.FieldAmbientOcclusionTexture) != 0)
                        SetValue(kAmbientOcclusionTexture, EditorGUIXLayout.InlineObjectField(Content.ambientOcclusionTextureLabel, GetValue(kAmbientOcclusionTexture), DelightingHelpers.GetIcon(errorCode, kAmbientOcclusionValueError)));
                    --EditorGUI.indentLevel;
                }

                EditorGUILayout.Space();
                SetValue(kFoldOptionalParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldOptionalParameters), Content.optionalParametersreplacedle, DelightingHelpers.GetIcon(errorCode, kOptionalError)));
                if (GetValue(kFoldOptionalParameters))
                {
                    ++EditorGUI.indentLevel;
                    if ((displays & DelightingUI.Display.FieldPositionTexture) != 0)
                        SetValue(kPositionTexture, EditorGUIXLayout.InlineObjectField(Content.positionTextureLabel, GetValue(kPositionTexture), DelightingHelpers.GetIcon(errorCode, kPositionValueError)));
                    if ((displays & DelightingUI.Display.FieldMaskTexture) != 0)
                        SetValue(kMaskTexture, EditorGUIXLayout.InlineObjectField(Content.maskLabel, GetValue(kMaskTexture), DelightingHelpers.GetIcon(errorCode, kMaskValueError)));
                    if ((displays & DelightingUI.Display.FieldSwitchYZAxes) != 0)
                        SetValue(kSwitchYZaxes, EditorGUILayout.Toggle(Content.switchYZLabel, GetValue(kSwitchYZaxes)));
                    --EditorGUI.indentLevel;
                }
            }

            if ((displays & DelightingUI.Display.SectionDelighting) != 0)
            {
                EditorGUILayout.Space();
                SetValue(kFoldDelightingParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldDelightingParameters), Content.delightingParametersreplacedle));
                if (GetValue(kFoldDelightingParameters))
                {
                    ++EditorGUI.indentLevel;
                    GUI.enabled = GetValue(kPreviewTexture) != null;

                    //if ((displays & DelightingUI.Display.FieldNoiseReduction) != 0)
                       // SetValue(kSmoothNormals, EditorGUILayout.Slider(Content.smoothNormalsLabel, GetValue(kSmoothNormals), 0, 2));
                    if ((displays & DelightingUI.Display.FieldRemoveHighlights) != 0)
                        SetValue(kRemoveHighlights, EditorGUILayout.Slider(Content.removeHighlightsLabel, GetValue(kRemoveHighlights), 0, 1));
                    if ((displays & DelightingUI.Display.FieldRemoveDarkNoise) != 0)
                        SetValue(kRemoveDarkNoise, EditorGUILayout.Slider(Content.removeDarkNoiseLabel, GetValue(kRemoveDarkNoise), 0, 1));
                    if ((displays & DelightingUI.Display.FieldSeparateDarkAreas) != 0)
                        SetValue(kSeparateDarkAreas, EditorGUILayout.Slider(Content.separateDarkAreasLabel, GetValue(kSeparateDarkAreas), 0, 1));
                    if ((displays & DelightingUI.Display.FieldForceLocalDelighting) != 0)
                        SetValue(kForceLocalDelighting, EditorGUILayout.Slider(Content.forceLocalDelightingLabel, GetValue(kForceLocalDelighting), 0, 1));

                    GUI.enabled = true;
                    --EditorGUI.indentLevel;
                }
            }

            if ((displays & DelightingUI.Display.SectionImport) != 0)
            {
                EditorGUILayout.Space();
                SetValue(kFoldImportParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldImportParameters), Content.importPanelreplacedle));
                if (GetValue(kFoldImportParameters))
                {
                    ++EditorGUI.indentLevel;
                    SetValue(kBaseTextureSuffix, EditorGUILayout.TextField(Content.baseTextureLabel, GetValue(kBaseTextureSuffix)));
                    SetValue(kNormalsTextureSuffix, EditorGUILayout.TextField(Content.normalsTextureLabel, GetValue(kNormalsTextureSuffix)));
                    SetValue(kBentNormalsTextureSuffix, EditorGUILayout.TextField(Content.bentNormalsTextureLabel, GetValue(kBentNormalsTextureSuffix)));
                    SetValue(kAmbientOcclusionTextureSuffix, EditorGUILayout.TextField(Content.ambientOcclusionTextureLabel, GetValue(kAmbientOcclusionTextureSuffix)));
                    SetValue(kPositionsTextureSuffix, EditorGUILayout.TextField(Content.positionTextureLabel, GetValue(kPositionsTextureSuffix)));
                    SetValue(kMaskTextureSuffix, EditorGUILayout.TextField(Content.maskLabel, GetValue(kMaskTextureSuffix)));
                    --EditorGUI.indentLevel;
                }
            }

            var messages = GetValue(kInspectorErrorMessages);
            if (messages != null)
            {
                EditorGUILayout.Space();
                for (int i = 0; i < messages.Count; i++)
                    EditorGUILayout.HelpBox(messages[i], MessageType.Error, true);
            }

            if ((displays & (DelightingUI.Display.ButtonCompute | DelightingUI.Display.ButtonExport)) != 0)
            {
                var computeStyle = Styles.largeButton;
                var exportStyle = Styles.largeButton;

                if ((displays & (DelightingUI.Display.ButtonCompute | DelightingUI.Display.ButtonExport)) == 
                    (DelightingUI.Display.ButtonCompute | DelightingUI.Display.ButtonExport))
                {
                    computeStyle = Styles.largeButtonLeft;
                    exportStyle = Styles.largeButtonRight;
                }

                GUILayout.Box(GUIContent.none, Styles.separator);
                GUI.enabled = GetValue(kHasValidInput);
                GUILayout.BeginHorizontal();
                if ((displays & DelightingUI.Display.ButtonCompute) != 0
                    && GUILayout.Button(Content.computeLabel, computeStyle))
                    ExecuteCommand(kCmdProcessFromGather);
                if ((displays & DelightingUI.Display.ButtonExport) != 0
                    && GUILayout.Button(Content.exportLabel, exportStyle))
                    ExecuteCommand(kCmdExport);
                GUILayout.EndHorizontal();
            }
            GUI.enabled = true;

            if ((displays & DelightingUI.Display.SectionDebug) != 0)
            {
                EditorGUILayout.Space();
                SetValue(kFoldDebugParameters, EditorGUIXLayout.InspectorFoldout(GetValue(kFoldDebugParameters), Content.debugPanelreplacedle));
                if (GetValue(kFoldDebugParameters))
                {
                    ++EditorGUI.indentLevel;
                    m_DebugTexture.OnGUI();
                    --EditorGUI.indentLevel;
                }
            }
            EditorGUILayout.EndScrollView();
        }

19 View Source File : DelightingToolInspectorToolbarContainer.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnGUI()
        {
            var displays = GetValue(kDisplayedUI);
            GUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
            if ((displays & DelightingUI.Display.ButtonAutoCompute) != 0)
                SetValue(kAutoCompute, GUILayout.Toggle(GetValue(kAutoCompute), Content.autoComputeLabel, EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)));
            GUILayout.EndHorizontal();
        }

19 View Source File : IMGUIVisualContainer.cs
License : MIT License
Project Creator : Unity-Technologies

protected void EndGUILayout()
        {
            switch (style.layout)
            {
                case StyleSheet.GUILayoutType.Horizontal:
                    GUILayout.EndHorizontal();
                    break;
                default:
                    GUILayout.EndVertical();
                    break;
            }
        }

19 View Source File : ReadmeEditor.cs
License : MIT License
Project Creator : Unity-Technologies

protected override void OnHeaderGUI()
	{
		var readme = (Readme)target;
		Init();
		
		var iconWidth = Mathf.Min(EditorGUIUtility.currentViewWidth/3f - 20f, 128f);
		
		GUILayout.BeginHorizontal("In Bigreplacedle");
		{
			GUILayout.Label(readme.icon, GUILayout.Width(iconWidth), GUILayout.Height(iconWidth));
			GUILayout.Label(readme.replacedle, replacedleStyle);
		}
		GUILayout.EndHorizontal();
	}

19 View Source File : BaseAreaGroupEditor.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnInspectorGUI()
        {
            Color oldColor = GUI.color;

            GUILayout.Space(15);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Texture Resolution", GUILayout.Width(EditorGUIUtility.labelWidth));
            EditorGUILayout.PropertyField(m_TextureWidth, GUIContent.none, GUILayout.MaxWidth(75.0f));
            EditorGUILayout.LabelField(" x ", GUILayout.Width(20.0f));
            EditorGUILayout.PropertyField(m_TextureHeight, GUIContent.none, GUILayout.MaxWidth(75.0f));
            EditorGUILayout.EndHorizontal();

            GUI.color = Color.green;
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            if (GUILayout.Button(string.Format("Add New {0}", Name), GUILayout.Height(50)))
            {
                MonoBehaviour behavior = target as MonoBehaviour;
                CreateArea(behavior.gameObject);
            }

            GUILayout.Space(15);
            GUILayout.EndHorizontal();
            GUILayout.Space(15);

            serializedObject.ApplyModifiedProperties();
        }

19 View Source File : ClickableItemGroupEditor.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnInspectorGUI()
        {
            Color oldColor = GUI.color;

            GUI.color = Color.green;
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            if (GUILayout.Button("Add New Clickable Item", GUILayout.Height(50)))
            {

            }

            GUILayout.Space(15);
            GUILayout.EndHorizontal();
            GUILayout.Space(15);

            serializedObject.ApplyModifiedProperties();
        }

19 View Source File : SceneManagerEditor.cs
License : MIT License
Project Creator : Unity-Technologies

public override void OnInspectorGUI()
        {
            Color oldColor = GUI.color;

            GUILayout.Space(15);
            
            EditorGUILayout.PropertyField(m_Character, new GUIContent("Character"));
            EditorGUILayout.PropertyField(m_OutputPath, new GUIContent("Output Path"));

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Default Resolution", GUILayout.Width(EditorGUIUtility.labelWidth));
            EditorGUILayout.PropertyField(m_DefaultWidth, GUIContent.none, GUILayout.MaxWidth(75.0f));
            EditorGUILayout.LabelField(" x ", GUILayout.Width(20.0f));
            EditorGUILayout.PropertyField(m_DefaultHeight, GUIContent.none, GUILayout.MaxWidth(75.0f));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.PropertyField(m_TransitionObject);
            EditorGUILayout.PropertyField(m_TransitionTime, new GUIContent("Transition Time"));

            GUILayout.Space(15);

            GUI.color = Color.green;
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            if (GUILayout.Button("Add New Scene", GUILayout.Height(50)))
            {
                AddNewScene();
            }
            GUILayout.Space(15);
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            GUI.color = Color.cyan;
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            if (GUILayout.Button("Save Scene Prefabs", GUILayout.Height(50)))
            {
                SaveAllScenePrefabs(m_SceneManager);
            }
            GUILayout.Space(15);
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            GUI.color = Color.red;
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            if (GUILayout.Button("Reload Scene Prefabs", GUILayout.Height(50)))
            {
                m_SceneManager.ReloadScenePrefabs();
            }
            GUILayout.Space(15);
            GUILayout.EndHorizontal();

            GUI.color = oldColor;

            GUILayout.Space(15);

            serializedObject.ApplyModifiedProperties();
        }

19 View Source File : StoryEventsEditorWindow.cs
License : MIT License
Project Creator : Unity-Technologies

void OnGUI()
		{
			GUILayout.Space(20);

			if (storyEvents != null && storyEvents.events != null)
			{
				GUILayout.BeginHorizontal();

				if (GUILayout.Button("Add Item", GUILayout.ExpandWidth(false)))
				{
					AddEvent();
				}

				GUILayout.EndHorizontal();
				if (storyEvents.events.Count > 0)
				{
					for (int i = 0; i < storyEvents.events.Count; i++)
					{
						GUILayout.BeginHorizontal();

						if (currentlyChangingNameIndex == i)
						{
							var changedTextInField = EditorGUILayout.TextField(storyEvents.events[i], GUILayout.ExpandWidth(false));
							var storyEventExists = storyEvents.events.Exists((x) => string.Equals(x, changedTextInField));
							var indexOfExistingElement = storyEvents.events.FindIndex((x) => string.Equals(x, changedTextInField));

							if (string.Equals(string.Empty, changedTextInField))
							{
								EditorGUILayout.LabelField(" - you can't leave empty event name", GUILayout.ExpandWidth(true));
							}
							if (!storyEventExists || indexOfExistingElement == i)
							{
								ChangeEvent(i, changedTextInField);
								if (GUILayout.Button("Save Changes", GUILayout.ExpandWidth(false)))
								{
									currentlyChangingNameIndex = -1;
									replacedetDatabase.Savereplacedets();
								}
							}
							else
							{
								EditorGUILayout.LabelField(" - you can't add same event", GUILayout.ExpandWidth(true));
							}
						}
						else
						{
							EditorGUILayout.LabelField("- " + storyEvents.events[i], "", GUILayout.ExpandWidth(false));

							if (GUILayout.Button("Change Event", GUILayout.ExpandWidth(false)))
							{
								currentlyChangingNameIndex = i;
							}

							if (GUILayout.Button("Delete Event", GUILayout.ExpandWidth(false)))
							{
								DeleteEvent(i);
							}
						}

						GUILayout.EndHorizontal();
					}
				}
				else
				{
					GUILayout.Label("This events list is empty.");
				}

				if (GUI.changed)
				{
					EditorUtility.SetDirty(storyEvents);
				}
			}
		}

19 View Source File : NoiseBall.cs
License : MIT License
Project Creator : Unity-Technologies

public void OnGUI()
    {
        if (m_UIOptions == null)
        {
            m_UIOptions = new[]
            {
                new GUIContent("C# 1 thread"),
                new GUIContent("Burst 1 thread"),
                new GUIContent("Burst threaded"),
#if UNITY_2021_2_OR_NEWER // Mesh GPU buffer access is since 2021.2            
                new GUIContent("GPU compute"),
#endif
            };
        }
        GUI.matrix = Matrix4x4.Scale(Vector3.one * 2);
        GUILayout.BeginArea(new Rect(5,25,420,80), "Options", GUI.skin.window);
        m_Mode = (Mode)GUILayout.Toolbar((int)m_Mode, m_UIOptions);
        GUILayout.BeginHorizontal();
        GUILayout.Label($"Triangles: {m_TriangleCount/1000}K", GUILayout.Width(120));

        int triIndex = TrisToIndex(m_TriangleCount);
        int newTriIndex = Mathf.RoundToInt(GUILayout.HorizontalSlider(triIndex, 1, 10));
        if (triIndex != newTriIndex)
            m_TriangleCount = IndexToTris(newTriIndex);
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }

19 View Source File : NetworkManagerHud.cs
License : MIT License
Project Creator : Unity-Technologies

void DrawConnectGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Space(10);
        GUILayout.Label("Address", m_LabelTextStyle);
        GUILayout.Label("Port", m_LabelTextStyle);

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        m_ConnectAddress = GUILayout.TextField(m_ConnectAddress);
        m_PortString = GUILayout.TextField(m_PortString);
        if (ushort.TryParse(m_PortString, out ushort port))
        {
            m_Transport.SetConnectionData(m_ConnectAddress, port);
        }
        else
        {
            m_Transport.SetConnectionData(m_ConnectAddress, 7777);
        }

        GUILayout.EndHorizontal();

        if (GUILayout.Button("Host (Server + Client)"))
        {
            m_NetworkManager.StartHost();
        }

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Server"))
        {
            m_NetworkManager.StartServer();
        }

        if (GUILayout.Button("Client"))
        {
            m_NetworkManager.StartClient();
        }

        GUILayout.EndHorizontal();
    }

19 View Source File : HUDPanel.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

void OnGUI()
        {
            if (!isEnabled)
                return;

            // Initialize main HUD
            GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(300));

            foreach (Action element in s_HeaderContents.Values)
            {
                element();
            }

            GUILayout.BeginHorizontal();

            foreach (IHudTab tab in s_HUDTabs.Values)
            {
                var wreplacedelected = tab == m_SelectedTab;
                var selected = GUILayout.Toggle(wreplacedelected, tab.Label, GUI.skin.button);
                if (selected != wreplacedelected)
                {
                    if (m_SelectedTab != null)
                        m_SelectedTab.OnDeselected();

                    m_SelectedTab = selected ? tab : null;

                    if (m_SelectedTab != null)
                        m_SelectedTab.OnSelected();
                }
            }

            GUILayout.EndHorizontal();

            if (m_SelectedTab != null)
                m_SelectedTab.OnGUI(this);

            GUILayout.EndVertical();

            // Draggable windows
            var current = Event.current;
            if (current.type == EventType.MouseDown)
            {
                for (var Idx = s_ActiveWindows.Count - 1; Idx >= 0; --Idx)
                {
                    var window = s_ActiveWindows[Idx];
                    if (s_ActiveWindows[Idx].TryDragWindow(current))
                    {
                        m_DraggingWindow = s_ActiveWindows[Idx];
                        break;
                    }
                }
            }
            else if (current.type == EventType.MouseDrag && m_DraggingWindow != null)
            {
                m_DraggingWindow.UpdateDragWindow(current);
            }
            else if (current.type == EventType.MouseUp && m_DraggingWindow != null)
            {
                m_DraggingWindow.EndDragWindow();
                m_DraggingWindow = null;
            }

            foreach (var window in s_ActiveWindows)
                window.DrawWindow(this);
        }

19 View Source File : ROSConnection.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

void DrawHeaderGUI()
        {
            GUIStyle labelStyle = new GUIStyle
            {
                alignment = TextAnchor.MiddleLeft,
                normal = { textColor = Color.white },
                fontStyle = FontStyle.Bold,
                fixedWidth = 250
            };

            GUIStyle contentStyle = new GUIStyle
            {
                alignment = TextAnchor.MiddleLeft,
                padding = new RectOffset(10, 0, 0, 5),
                normal = { textColor = Color.white },
                fixedWidth = 300
            };


            // ROS IP Setup
            GUILayout.BeginHorizontal();
            DrawConnectionArrows(
                true,
                0,
                0,
                Time.realtimeSinceStartup - LastMessageReceivedRealtime,
                Time.realtimeSinceStartup - LastMessageSentRealtime,
                HasConnectionThread,
                HasConnectionThread,
                HasConnectionError
            );

#if ROS2
            string protocolName = "ROS2";
#else
            string protocolName = "ROS";
#endif

            GUILayout.Space(30);
            GUILayout.Label($"{protocolName} IP: ", labelStyle, GUILayout.Width(100));

            if (!HasConnectionThread)
            {
                // if you've never run a build on this machine before, initialize the playerpref settings to the ones from the RosConnection
                if (!PlayerPrefs.HasKey(PlayerPrefsKey_ROS_IP))
                    SetIPPref(RosIPAddress);
                if (!PlayerPrefs.HasKey(PlayerPrefsKey_ROS_TCP_PORT))
                    SetPortPref(RosPort);

                // NB, here the user is editing the PlayerPrefs values, not the ones in the RosConnection.
                // (So that the hud remembers what IP you used last time you ran this build.)
                // The RosConnection receives the edited values when you click Connect.
                SetIPPref(GUILayout.TextField(RosIPAddressPref));
                SetPortPref(Convert.ToInt32(GUILayout.TextField(RosPortPref.ToString())));

                GUILayout.EndHorizontal();
                GUILayout.Label("(Not connected)");
                if (GUILayout.Button("Connect"))
                    Connect(RosIPAddressPref, RosPortPref);
            }
            else
            {
                GUILayout.Label($"{RosIPAddress}:{RosPort}", contentStyle);
                GUILayout.EndHorizontal();
            }
        }

19 View Source File : VisualizationEditorWindow.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

private void OnGUI()
        {
            if (!EditorApplication.isPlaying)
            {
                GUILayout.Label("Waiting for play mode...");
                return;
            }

            if (m_Visual == null && EditorApplication.isPlaying)
            {
                if (m_FactoryID == null)
                {
                    GUIContent buttonContent = new GUIContent("Select Visualizer");
                    Rect selectBtnRect = GUILayoutUtility.GetRect(buttonContent, EditorStyles.toolbarDropDown, GUILayout.ExpandWidth(false));
                    if (EditorGUI.DropdownButton(selectBtnRect, buttonContent, FocusType.Keyboard))
                    {
                        GenericMenu menu = new GenericMenu();
                        foreach (IVisualFactory factory in VisualFactoryRegistry.GetAllVisualFactories(m_Topic, m_RosMessageName))
                        {
                            menu.AddItem(new GUIContent(factory.Name), false, () => SetFactory(factory));
                        }
                        menu.DropDown(selectBtnRect);
                    }
                }
                else if (m_VisualFactory == null)
                {
                    foreach (IVisualFactory factory in VisualFactoryRegistry.GetAllVisualFactories(m_Topic, m_RosMessageName))
                    {
                        if (factory.ID == m_FactoryID)
                        {
                            m_VisualFactory = factory;
                        }
                    }
                    if (m_VisualFactory == null)
                        m_FactoryID = null;
                }

                if (m_VisualFactory != null)
                    m_Visual = m_VisualFactory.GetOrCreateVisual(m_Topic);
            }

            if (m_Visual != null)
            {
                GUILayout.BeginHorizontal(GUI.skin.box);
                EditorGUI.BeginDisabledGroup(m_VisualFactory == null || !m_VisualFactory.CanShowDrawing);
                bool drawingEnable = EditorGUILayout.ToggleLeft("Show 3d drawings", m_Visual.IsDrawingEnabled);
                EditorGUI.EndDisabledGroup();
                EditorGUI.BeginDisabledGroup(!(m_VisualFactory is Object));
                if (GUILayout.Button("Select in Editor"))
                {
                    Object factoryObject = (Object)m_VisualFactory;
                    Selection.activeObject = factoryObject;
                }
                EditorGUI.EndDisabledGroup();
                GUILayout.EndHorizontal();
                if (m_Visual.IsDrawingEnabled != drawingEnable)
                    m_Visual.SetDrawingEnabled(drawingEnable);

                m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos);
                m_Visual.OnGUI();
                GUILayout.EndScrollView();
            }
        }

19 View Source File : ImageDefaultVisualizer.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

public void OnGUI()
        {
            if (message == null)
            {
                GUILayout.Label("Waiting for message...");
                return;
            }

            message.header.GUI();
            GUILayout.Label($"{m_Height}x{m_Width}, encoding: {m_Encoding}");
            if (message.data.Length > 0)
            {
                GUILayout.BeginHorizontal();
                if (m_Encoding.StartsWith("bayer"))
                    m_Debayer = GUILayout.Toggle(m_Debayer, "Debayer");
                GUILayout.EndHorizontal();

                if (m_Texture2D != null || m_Debayer)
                {
                    // if we already generated the "real" texture, just use that
                    GetTexture().GUITexture();
                }
                else
                {
                    if (m_CheapTexture2D == null)
                    {
                        m_CheapTexture2D = message.ToTexture2D(m_Debayer, convertBGR: false, flipY: false);
                    }
                    m_CheapTexture2D.GUITexture(m_CheapTextureMaterial);
                }
            }
        }

19 View Source File : TFSystemVisualizer.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

void IHudTab.OnGUI(HudPanel hud)
        {
            m_TransformMenuScrollPosition = GUILayout.BeginScrollView(m_TransformMenuScrollPosition);

            GUI.changed = false;
            GUILayout.BeginHorizontal(GUILayout.Height(20));
            GUILayout.Label("", GUILayout.Width(k_TFNameWidth));
            ShowTFAxesDefault = DrawTFHeaderCheckbox(ShowTFAxesDefault, "Axes", (stream, check) => m_ShowAxes[stream] = check);
            ShowTFLinksDefault = DrawTFHeaderCheckbox(ShowTFLinksDefault, "Link", (stream, check) => m_ShowLinks[stream] = check);
            ShowTFNamesDefault = DrawTFHeaderCheckbox(ShowTFNamesDefault, "Lbl", (stream, check) => m_ShowNames[stream] = check);
            GUILayout.EndHorizontal();
            bool globalChange = GUI.changed;

            // draw the root objects
            int numDrawn = 0;
            foreach (TFStream stream in TFSystem.instance.GetTransforms())
            {
                if (stream.Parent == null)
                {
                    numDrawn++;
                    DrawTFStreamHierarchy(stream, 0, globalChange);
                }
            }

            if (numDrawn == 0)
            {
                GUILayout.Label("(No transform data received yet)");
            }

            GUILayout.EndScrollView();
        }

19 View Source File : TFSystemVisualizer.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

void DrawTFStreamHierarchy(TFStream stream, int indent, bool globalChange)
        {
            GUI.changed = false;
            EnsureSettings(stream);

            GUILayout.BeginHorizontal();
            GUILayout.Space(indent * k_IndentWidth);

            /*#if UNITY_EDITOR
                        GUIStyle style = new GUIStyle(UnityEditor.EditorStyles.foldout);
                        style.fixedWidth = k_TFNameWidth;// - indent * k_IndentWidth;
                        style.stretchWidth = false;
                        m_ShowExpanded[stream] = UnityEditor.EditorGUILayout.Foldout(m_ShowExpanded[stream], stream.Name, true, style);// GUILayout.Width(k_TFNameWidth - indent * k_IndentWidth));
            #else*/
            if (GUILayout.Button(stream.Name, GUI.skin.label, GUILayout.Width(k_TFNameWidth - indent * k_IndentWidth)))
                m_ShowExpanded[stream] = !m_ShowExpanded[stream];
            //#endif

            m_ShowAxes[stream] = GUILayout.Toggle(m_ShowAxes[stream], "", GUILayout.Width(k_CheckboxWidth));
            m_ShowLinks[stream] = GUILayout.Toggle(m_ShowLinks[stream], "", GUILayout.Width(k_CheckboxWidth));
            m_ShowNames[stream] = GUILayout.Toggle(m_ShowNames[stream], "", GUILayout.Width(k_CheckboxWidth));
            GUILayout.EndHorizontal();

            if (GUI.changed || globalChange)
            {
                TFSystem.instance.NotifyAllChanged(stream);
            }

            if (m_ShowExpanded[stream])
                foreach (TFStream child in stream.Children)
                    DrawTFStreamHierarchy(child, indent + 1, globalChange);
        }

void CreateMinMaxSlider(ref float[] range, float min, float max)
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label(range[0].ToString());
        EditorGUILayout.MinMaxSlider(ref range[0], ref range[1], min, max);
        GUILayout.Label(range[1].ToString());
        GUILayout.EndHorizontal();
    }

19 View Source File : SettingsBasedVisualizerEditor.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

public void CreateNewDropdown(string[] channels, string label, string channel, System.Action<string> action)
    {
        if (channels == null)
            return;

        GUILayout.BeginHorizontal();
        GUILayout.Label(label);
        if (EditorGUILayout.DropdownButton(new GUIContent(channel), FocusType.Keyboard))
        {
            var menu = new GenericMenu();
            foreach (var c in channels)
                menu.AddItem(new GUIContent(c), c == channel, () =>
                {
                    action(c);
                    VisualizerRedraw();
                });
            menu.DropDown(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0f, 0f));
        }

        GUILayout.EndHorizontal();
    }

19 View Source File : SettingsBasedVisualizerEditor.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

public void CreateMinMaxEditor(string label1, string label2, float[] range)
    {
        GUILayout.BeginHorizontal();
        range[0] = EditorGUILayout.FloatField(label1, range[0]);
        //GUILayout.Space(30);
        GUILayout.Label(label2);
        range[1] = EditorGUILayout.FloatField(range[1], GUILayout.Width(70));
        GUILayout.EndHorizontal();
    }

19 View Source File : VisualizationLayoutTab.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

void IHudTab.OnGUI(HudPanel hud)
        {
            // Save/Load layout files
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Export layout"))
            {
#if UNITY_EDITOR
                m_LayoutPath = EditorUtility.SaveFilePanel("Save Visualizations Settings", "", "RosHudLayout", "json");
#endif
                m_Topics.SaveLayout(m_LayoutPath);
            }
            if (GUILayout.Button("Import layout"))
            {
#if UNITY_EDITOR
                m_LayoutPath = EditorUtility.OpenFilePanel("Select Visualizations Settings", "", "json");
#endif
                m_Topics.LoadLayout(m_LayoutPath);
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : VisualizationTopicsTab.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

void IHudTab.OnGUI(HudPanel hud)
        {
            m_Connection.RefreshTopicsList();

            GUILayout.BeginHorizontal();
            bool showPrompt = (GUI.GetNameOfFocusedControl() != "topic_filter" && m_TopicFilter == "");
            GUI.SetNextControlName("topic_filter");
            if (showPrompt)
            {
                Color oldCol = GUI.color;
                GUI.color = new Color(oldCol.r, oldCol.g, oldCol.b, 0.5f);
                GUILayout.TextField("(Type here to filter topics)");
                GUI.color = oldCol;
            }
            else
            {
                m_TopicFilter = GUILayout.TextField(m_TopicFilter).ToLower();
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (m_SortMode != SortMode.v2D)
                GUILayout.Space(5);
            string label2D = m_SortMode == SortMode.v2D ? "\u25BC2D" : "2D";
            if (GUILayout.Button(label2D, HudPanel.s_BoldStyle, GUILayout.Width(20)))
            {
                SetSortMode(m_SortMode == SortMode.v2D ? SortMode.Normal : SortMode.v2D);
            }
            if (m_SortMode == SortMode.v2D)
                GUILayout.Space(5);
            if (m_SortMode != SortMode.v3D)
                GUILayout.Space(5);
            string label3D = m_SortMode == SortMode.v3D ? "\u25BC3D" : "3D";
            if (GUILayout.Button(label3D, HudPanel.s_BoldStyle, GUILayout.Width(25)))
            {
                SetSortMode(m_SortMode == SortMode.v3D ? SortMode.Normal : SortMode.v3D);
            }
            if (m_SortMode == SortMode.v3D)
                GUILayout.Space(5);
            string labelTopic = m_SortMode == SortMode.Topic ? "\u25BCTopic" : m_SortMode == SortMode.TopicDescending ? "\u25B2Topic" : "Topic";
            if (GUILayout.Button(labelTopic, HudPanel.s_BoldStyle))
            {
                if (m_SortMode == SortMode.TopicDescending)
                    SetSortMode(SortMode.Normal);
                else if (m_SortMode == SortMode.Topic)
                    SetSortMode(SortMode.TopicDescending);
                else
                    SetSortMode(SortMode.Topic);
            }
            GUILayout.EndHorizontal();

            m_TopicMenuScrollPosition = GUILayout.BeginScrollView(m_TopicMenuScrollPosition);
            var numTopicsShown = 0;

            if (m_TopicsSorted == null)
                SortTopics();

            foreach (VisualizationTopicsTabEntry topicState in m_TopicsSorted)
            {
                if (m_TopicFilter != "" && !topicState.Topic.ToLower().Contains(m_TopicFilter) && !topicState.RosMessageName.ToLower().Contains(m_TopicFilter))
                    continue;

                numTopicsShown++;
                topicState.DrawGUI();
            }

            GUILayout.EndScrollView();

            if (numTopicsShown == 0)
            {
                if (!m_Connection.AllTopics.Any())
                    GUILayout.Label("No topics registered");
                else
                    GUILayout.Label($"No topics named \"{m_TopicFilter}\"!");
            }
        }

19 View Source File : VisualizationTopicsTabEntry.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

public void DrawGUILine()
        {
            bool showWindow = IsVisualizingUI;
            bool showDrawing = IsVisualizingDrawing;

            bool canShowWindow = CanShowWindow;
            bool canShowDrawing = CanShowDrawing;

            var hasWindow = showWindow;
            var hasDrawing = showDrawing;

            if (m_LineStyle == null)
                InitLineStyle();

            GUILayout.BeginHorizontal(m_IsHovering ? m_HoverStyle : m_LineStyle);
            if (hasWindow || canShowWindow)
                showWindow = GUILayout.Toggle(showWindow, "", GUILayout.Width(15));
            else
                GUILayout.Label("", GUILayout.Width(15));

            if (hasDrawing || canShowDrawing)
                showDrawing = GUILayout.Toggle(showDrawing, "", GUILayout.Width(15));
            else
                GUILayout.Label("", GUILayout.Width(15));

            var baseColor = GUI.color;
            GUI.color = canShowWindow ? baseColor : Color.grey;

            GUILayout.Space(40);
            Rect space = GUILayoutUtility.GetLastRect();
            ROSConnection.DrawConnectionArrows(false,
                space.x + 5, space.y,
                Time.realtimeSinceStartup - TopicState.LastMessageReceivedRealtime,
                Time.realtimeSinceStartup - TopicState.LastMessageSentRealtime,
                TopicState.IsPublisher,
                TopicState.SentSubscriberRegistration,
                m_TopicState.Connection.HasConnectionError);

            if (GUILayout.Button(replacedle, m_LineStyle, GUILayout.Width(240)))
            {
                if (!canShowWindow)
                {
                    Debug.LogError($"No message clreplaced registered for type {RosMessageName}");
                }
                else if (!canShowDrawing)
                {
                    showWindow = !showWindow;
                }
                else
                {
                    var toggleOn = !showWindow || !showDrawing;
                    showWindow = toggleOn;
                    showDrawing = toggleOn;
                }
            }

            GUI.color = baseColor;
            GUILayout.EndHorizontal();

            Rect horizontalRect = GUILayoutUtility.GetLastRect();

#if UNITY_EDITOR
            Rect buttonRect = new Rect(horizontalRect.xMax - 20, horizontalRect.center.y - 10, 20, 20);
            if (GUI.Button(buttonRect, "\u2630"))
                ShowOptionsMenu(buttonRect);
#endif

            if (m_IsHovering)
            {
                string labelText = RosMessageName;
                Vector2 labelSize = GUI.skin.box.CalcSize(new GUIContent(labelText));

                GUI.Box(new Rect(horizontalRect.xMax - labelSize.x, horizontalRect.yMax - 10, labelSize.x, horizontalRect.height), labelText);
            }

            if (Event.current.type == EventType.Repaint)
                m_IsHovering = horizontalRect.Contains(Event.current.mousePosition);

            if (showDrawing != m_IsVisualizingDrawing || showWindow != m_IsVisualizingUI)
            {
                SetVisualizing(showWindow, showDrawing);
            }
        }

19 View Source File : VisualizationUtils.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

public static void GUI(this ColorRGBAMsg message, bool withText = true)
        {
            Color oldBackgroundColor = UnityEngine.GUI.color;

            GUILayout.BeginHorizontal();
            UnityEngine.GUI.backgroundColor = message.ToUnityColor();
            GUILayout.Box("", s_ColorSwatchStyle);
            UnityEngine.GUI.backgroundColor = oldBackgroundColor;
            if (withText)
                GUILayout.Label($"R{message.r} G{message.g} B{message.b} A{message.a}");
            GUILayout.EndHorizontal();
        }

19 View Source File : VisualizationUtils.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

public static void GUI(this InertiaMsg message)
        {
            GUILayout.Label($"Mreplaced: {message.m}kg");
            message.com.GUI();
            GUILayout.BeginHorizontal();
            GUILayout.Label(message.ixx.ToString());
            GUILayout.Label(message.ixy.ToString());
            GUILayout.Label(message.ixz.ToString());
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(message.ixy.ToString());
            GUILayout.Label(message.iyy.ToString());
            GUILayout.Label(message.iyz.ToString());
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(message.ixz.ToString());
            GUILayout.Label(message.iyz.ToString());
            GUILayout.Label(message.izz.ToString());
            GUILayout.EndHorizontal();
        }

19 View Source File : VisualizationUtils.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

public static void GUIGrid<T>(T[] data, int width, ref bool view)
        {
            view = GUILayout.Toggle(view, "View matrix");
            if (!view) return;

            int dataIndex = 0;
            while (dataIndex < data.Length)
            {
                GUILayout.BeginHorizontal();
                for (int Idx = 0; Idx < width && dataIndex < data.Length; ++Idx)
                {
                    GUILayout.Label(data[dataIndex].ToString());
                    dataIndex++;
                }
                GUILayout.EndHorizontal();
            }
        }

19 View Source File : VisualizationUtils.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

public static void GUIGrid<T>(T[] data, int width, string name, ref bool view)
        {
            view = GUILayout.Toggle(view, $"View {name} matrix");
            if (!view) return;

            int dataIndex = 0;
            GUILayout.Label(name);
            while (dataIndex < data.Length)
            {
                GUILayout.BeginHorizontal();
                for (int Idx = 0; Idx < width && dataIndex < data.Length; ++Idx)
                {
                    GUILayout.Label(data[dataIndex].ToString());
                    dataIndex++;
                }
                GUILayout.EndHorizontal();
            }
        }

19 View Source File : VisualizationUtils.cs
License : Apache License 2.0
Project Creator : Unity-Technologies

static void GUIMultiArrayLevel<T>(T[] data, MultiArrayLayoutMsg layout, uint dataIndex, int depth, bool tabulate)
        {
            uint size = layout.dim[depth].size;
            if (layout.dim.Length > depth + 1)
            {
                uint stride = layout.dim[depth + 1].stride;
                if (depth > 0)
                    GUILayout.BeginVertical(s_ArrayContainerStyle);
                for (int step = 0; step < size; ++step)
                {
                    GUIMultiArrayLevel(data, layout, dataIndex, depth + 1, tabulate);
                    dataIndex += stride;
                }
                if (depth > 0)
                    GUILayout.EndVertical();
            }
            else if (tabulate)
            {
                GUILayout.BeginHorizontal();
                for (int step = 0; step < size; ++step)
                {
                    GUILayout.Label(data[dataIndex].ToString());
                    dataIndex++;
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginVertical(s_ArrayContainerStyle);
                for (int step = 0; step < size; ++step)
                {
                    GUILayout.Label(data[dataIndex].ToString());
                    dataIndex++;
                }
                GUILayout.EndVertical();
            }
        }

See More Examples