protected override void OnHeaderGUI() { using (var h = new EditorGUILayout.HorizontalScope()) { string temp = target.name; target.name = EditorGUILayout.TextField("Name", target.name); if (temp != target.name) { var element = target as UIElement; for (int i = 0; i < element.components.Count; i++) { element.components[i].Rename(); } EditorUtility.SetDirty(target); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } } EditorGUILayout.Space(); }
protected void GeometryGUI() { GUILayout.Label(Styles.Geometry, EditorStyles.boldLabel); EditorGUILayout.PropertyField(m_KeepQuads, Styles.KeepQuads); EditorGUILayout.PropertyField(m_WeldVertices, Styles.WeldVertices); using (var horizontal = new EditorGUILayout.HorizontalScope()) { using (var prop = new EditorGUI.PropertyScope(horizontal.rect, Styles.IndexFormatLabel, m_IndexFormat)) { EditorGUI.BeginChangeCheck(); var newValue = (int)(ModelImporterIndexFormat)EditorGUILayout.EnumPopup(prop.content, (ModelImporterIndexFormat)m_IndexFormat.intValue); if (EditorGUI.EndChangeCheck()) { m_IndexFormat.intValue = newValue; } } } NormalsTangentsGUI(); UvsGUI(); }
void DrawItemAxis(DataItem item) { item = item ?? new DataItem(); using (var hScope = new EditorGUILayout.HorizontalScope()) { GUI.Box(hScope.rect, ""); EditorGUILayout.LabelField("graphName", LayoutOption.mediaWidth); EditorGUILayout.LabelField("graph", LayoutOption.mediaWidth); EditorGUILayout.LabelField("axisMin", LayoutOption.mediaWidth); EditorGUILayout.LabelField("axisMax", LayoutOption.mediaWidth); EditorGUILayout.LabelField("axisSize", LayoutOption.mediaWidth); } using (var hScope = new EditorGUILayout.HorizontalScope()) { GUI.Box(hScope.rect, ""); item.graphName = EditorGUILayout.TextField(item.graphName ?? "", LayoutOption.mediaWidth); item.graph = EditorGUILayout.Toggle(item.graph, LayoutOption.mediaWidth); item.axisMin = EditorGUILayout.FloatField(item.axisMin, LayoutOption.mediaWidth); item.axisMax = EditorGUILayout.FloatField(item.axisMax, LayoutOption.mediaWidth); item.axisSize = EditorGUILayout.FloatField(item.axisSize, LayoutOption.mediaWidth); } }
private void OnGUI() { using (var horizonal = new EditorGUILayout.HorizontalScope("box")) { EditorGUILayout.LabelField("delete unreference assets from buildsettings and resources"); } using (var scrollScope = new EditorGUILayout.ScrollViewScope(scroll)) { scroll = scrollScope.scrollPosition; foreach (var asset in deleteAssets) { if (string.IsNullOrEmpty(asset.path)) { continue; } using (var horizonal = new EditorGUILayout.HorizontalScope()) { asset.isDelete = EditorGUILayout.Toggle(asset.isDelete, GUILayout.Width(20)); var icon = AssetDatabase.GetCachedIcon(asset.path); GUILayout.Label(icon, GUILayout.Width(20), GUILayout.Height(20)); if (GUILayout.Button(asset.path, EditorStyles.largeLabel)) { Selection.activeObject = AssetDatabase.LoadAssetAtPath <Object>(asset.path); } } } } using (var horizonal = new EditorGUILayout.HorizontalScope("box")) { EditorGUILayout.Space(); if (GUILayout.Button("Exclude from Project", GUILayout.Width(160)) && deleteAssets.Count != 0) { EditorApplication.delayCall += Exclude; } } }
private void DrawPanelComponent() { if (!panelCompnent) { return; } using (var hor = new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button(new GUIContent("→", "快速绑定"), EditorStyles.toolbarButton, GUILayout.Width(20))) { BridgeUI.CodeGen.GenCodeUtil.BindingUI(panelCompnent, components); } } GUILayout.Space(5); if (panelDrawer != null) { panelDrawer.OnInspectorGUI(); } }
bool DrawListHeader(DataList list) { using (var scope = new EditorGUILayout.HorizontalScope()) { if (!viewDic.ContainsKey(list)) { viewDic.Add(list, true); } //using(var fScope = new EditorGUILayout.FadeGroupScope()) if (viewDic[list] = GUILayout.Toggle(viewDic[list], list.name, LayoutOption.mediaHigh)) { GUI.backgroundColor = Color.green; GUI.Box(scope.rect, ""); GUI.backgroundColor = Color.white; EditorGUILayout.LabelField("ListName", LayoutOption.longWidth); list.name = EditorGUILayout.TextField(list.name, LayoutOption.longWidth); list.values = list.values ?? new List <DataItem>(); GUI.backgroundColor = Color.blue; if (GUILayout.Button("+", LayoutOption.minWidth)) { list.values.Add(new DataItem()); } GUI.backgroundColor = Color.white; return(true); } else { GUI.backgroundColor = Color.red; if (GUILayout.Button("-", LayoutOption.minWidth)) { waitDeleteList = list; } GUI.backgroundColor = Color.white; return(false); } } }
private void DrawFileSelect() { using (var hor = new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField("PSD文件路径:", GUILayout.Width(30)); EditorGUI.BeginChangeCheck(); psdPath = EditorGUILayout.TextField(psdPath); if (GUILayout.Button("选择", EditorStyles.miniButtonRight, GUILayout.Width(40))) { string dir = Application.dataPath; if (!string.IsNullOrEmpty(psdPath)) { dir = System.IO.Path.GetDirectoryName(psdPath); } psdPath = EditorUtility.OpenFilePanel("选择一个pdf文件", dir, "psd"); if (psdPath.Contains(Application.dataPath)) { psdPath = psdPath.Replace("\\", "/").Replace(Application.dataPath, "Assets"); } if (!string.IsNullOrEmpty(psdPath)) { OpenPsdDocument(); } } var change = EditorGUI.EndChangeCheck(); if (change) { EditorPrefs.SetString(Prefs_pdfPath, psdPath); } } if (!string.IsNullOrEmpty(psdPath) && psd == null) { OpenPsdDocument(); } }
void OnGUI() { using (EditorGUILayout.HorizontalScope horizontalScope = new EditorGUILayout.HorizontalScope()) { showBorders = EditorGUILayout.Toggle("Show Gizmos", showBorders, GUILayout.Width(200.0f)); borderColor = EditorGUILayout.ColorField(borderColor); } hideUnchecked = EditorGUILayout.Toggle("隐藏未勾选对象", hideUnchecked); //------------分割线-----------// GUILayout.Space(12.0f); Rect rect = GUILayoutUtility.GetLastRect(); GUI.color = new Color(0.0f, 0.0f, 0.0f, 0.25f); GUI.DrawTexture(new Rect(0.0f, rect.yMin + 6.0f, Screen.width, 4.0f), EditorGUIUtility.whiteTexture); GUI.DrawTexture(new Rect(0.0f, rect.yMin + 6.0f, Screen.width, 1.0f), EditorGUIUtility.whiteTexture); GUI.DrawTexture(new Rect(0.0f, rect.yMin + 9.0f, Screen.width, 1.0f), EditorGUIUtility.whiteTexture); GUI.color = Color.white; //获取所有拥有MaskableGraphic的对象 graphics = GameObject.FindObjectsOfType <MaskableGraphic>(); using (GUILayout.ScrollViewScope scrollViewScope = new GUILayout.ScrollViewScope(scrollPosition)) { scrollPosition = scrollViewScope.scrollPosition; for (int i = 0; i < graphics.Length; i++) { MaskableGraphic graphic = graphics[i]; if (hideUnchecked == false || graphic.raycastTarget == true) { DrawElement(graphic); } } } //foreach ( var item in graphics ) //{ // EditorUtility.SetDirty( item ); //} Repaint(); }
private void DrawToggleFromNodeType(NodeType model) { var on = (nodeType & model) == model; using (var hor = new EditorGUILayout.HorizontalScope()) { var thison = GUILayout.Toggle(on, model.ToString(), EditorStyles.radioButton, GUILayout.Width(60)); if (thison != on) { on = thison; if (on) { nodeType |= model; } else { nodeType &= ~model; } } } }
void OnGUI() { objectsParent = (Transform)EditorGUILayout.ObjectField(objectsParent, typeof(Transform), true, GUILayout.Width(100)); using (var group = new EditorGUILayout.HorizontalScope()) { experimentData = (ExperimentDataObject)EditorGUILayout.ObjectField(experimentData, typeof(ExperimentDataObject), false, GUILayout.Width(200)); if (GUILayout.Button("保存初始位置")) { SaveStartUpGroup(); } } using (var group = new EditorGUILayout.HorizontalScope()) { configData = (ConfigGroupObject)EditorGUILayout.ObjectField(configData, typeof(ConfigGroupObject), false, GUILayout.Width(200)); _title = EditorGUILayout.TextField(_title); if (GUILayout.Button("新建一配制组合")) { CreateNewGroup(); } } }
protected void MeshesGUI() { GUILayout.Label(Styles.Meshes, EditorStyles.boldLabel); using (var horizontal = new EditorGUILayout.HorizontalScope()) { using (var prop = new EditorGUI.PropertyScope(horizontal.rect, Styles.MeshCompressionLabel, m_MeshCompression)) { EditorGUI.BeginChangeCheck(); var newValue = (int)(ModelImporterMeshCompression)EditorGUILayout.EnumPopup(prop.content, (ModelImporterMeshCompression)m_MeshCompression.intValue); if (EditorGUI.EndChangeCheck()) { m_MeshCompression.intValue = newValue; } } } EditorGUILayout.PropertyField(m_IsReadable, Styles.IsReadable); m_MeshOptimizationFlags.intValue = (int)(MeshOptimizationFlags)EditorGUILayout.EnumFlagsField(Styles.OptimizationFlags, (MeshOptimizationFlags)m_MeshOptimizationFlags.intValue); EditorGUILayout.PropertyField(m_AddColliders, Styles.GenerateColliders); }
public static void HandleCoinOutput(SerializedObject so) { var count = so.FindProperty("Count"); using (var vertical = new EditorGUILayout.VerticalScope()) { using (var horizontal = new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField("Coin", EditorStyles.miniLabel); EditorGUILayout.PropertyField(so.FindProperty("Coin"), new GUIContent("")); } EditorGUILayout.LabelField("Count"); if (count.objectReferenceValue == null) { EditorGUILayout.PropertyField(count, new GUIContent()); } else { GoExpressionEditor.HandleGoExpression(new SerializedObject(count.objectReferenceValue)); } } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_Convex, Styles.convexText); if (EditorGUI.EndChangeCheck() && m_Convex.boolValue == false) { m_IsTrigger.boolValue = false; } EditorGUI.indentLevel++; using (new EditorGUI.DisabledScope(!m_Convex.boolValue)) { EditorGUILayout.PropertyField(m_IsTrigger, Styles.isTriggerText); } EditorGUI.indentLevel--; using (var horizontal = new EditorGUILayout.HorizontalScope()) { using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, GUIContent.none, m_CookingOptions)) { EditorGUI.BeginChangeCheck(); var newOptions = (MeshColliderCookingOptions)EditorGUILayout.EnumFlagsField(Styles.cookingOptionsText, GetCookingOptions()); if (EditorGUI.EndChangeCheck()) { SetCookingOptions(newOptions); } } } EditorGUILayout.PropertyField(m_Material, BaseStyles.materialContent); EditorGUILayout.PropertyField(m_Mesh, Styles.meshText); serializedObject.ApplyModifiedProperties(); }
void OnGUI() { GUIStyle style = new GUIStyle(); style.fontSize = 18; var color = GUI.backgroundColor; using (var v = new EditorGUILayout.VerticalScope(GUI.skin.box)) { GUILayout.Space(5); using (var vv = new EditorGUILayout.VerticalScope(GUI.skin.box)) { EditorGUILayout.LabelField("打包", style); GUILayout.Space(5); using (var h = new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField("选择目标平台:", style); GUILayout.Space(15); this.platform = (BuildPlatform)EditorGUILayout.EnumPopup(this.platform); } GUILayout.Space(20); GUI.backgroundColor = Color.green; if (GUILayout.Button("开始打包", GUILayout.Height(30))) { if (EditorUtility.DisplayDialog("提示", "确认开始打包?", "确认")) { } } GUI.backgroundColor = color; } GUILayout.Space(10); using (var vv = new EditorGUILayout.VerticalScope(GUI.skin.box)) { EditorGUILayout.LabelField("打热更包", style); GUILayout.Space(5); } } }
void OnGUI() { GUILayout.Label("Base Settings", EditorStyles.boldLabel); myString = EditorGUILayout.TextField("Text Field", myString); groupEnabled = EditorGUILayout.BeginToggleGroup("Optional Settings", groupEnabled); myBool = EditorGUILayout.Toggle("Toggle", myBool); myFloat = EditorGUILayout.Slider("Slider", myFloat, -3, 3); EditorGUILayout.EndToggleGroup(); using (var h = new EditorGUILayout.HorizontalScope("Button")) { if (GUI.Button(h.rect, GUIContent.none)) { Debug.Log("Go here"); } GUILayout.Label("I'm inside the button"); GUILayout.Label("So am I"); } using (var h = new EditorGUILayout.HorizontalScope()) { using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPos, GUILayout.Width(100), GUILayout.Height(100))) { scrollPos = scrollView.scrollPosition; GUILayout.Label(t); } if (GUILayout.Button("Add More Text", GUILayout.Width(100), GUILayout.Height(100))) { t += " \nAnd this is more text!"; } } if (GUILayout.Button("Clear")) { t = ""; } }
void OnGUI() { using (var scope = new EditorGUILayout.VerticalScope()) { using (var scope1 = new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("Compare", GUILayout.Width(70))) { if (this._diffWindow.unpackedCrawlPrev == null || this._diffWindow.unpackedCrawl == null) { return; } CompareSnapshot(this._diffWindow.unpackedCrawlPrev, this._diffWindow.unpackedCrawl); } if (GUILayout.Button("Clear", GUILayout.Width(50))) { if (this._extraObjs != null) { this._extraObjs = null; } } EditorGUIUtility.labelWidth = 160; this._needCompareInstanceID = EditorGUILayout.Toggle("Need compare InstanceID: ", this._needCompareInstanceID); } if (this._extraObjs != null) { EditorGUILayout.LabelField(string.Format("Result: {0}, TotalMemory: {1}", this._extraObjs.Length, ToMemorySize(this._memorySize))); this._scrollPosition = EditorGUILayout.BeginScrollView(this._scrollPosition); for (int i = 0; i < this._extraObjs.Length; i++) { DrawNativeObject(this._extraObjs[i]); } EditorGUILayout.EndScrollView(); } } }
void DisplayButtons() { using (var ButtonsScope = new EditorGUILayout.VerticalScope()) { using (var buttonsScope = new EditorGUILayout.HorizontalScope("Box")) { GUILayout.Label("Selection"); if (GUILayout.Button("Remove From", buttonLayout)) { RemoveFrom(); } if (GUILayout.Button("Add To", buttonLayout)) { AddTo(); } if (GUILayout.Button("Select", buttonLayout)) { Select(); } } using (var buttonsScope = new EditorGUILayout.HorizontalScope("Box")) { GUILayout.Label("Check"); if (GUILayout.Button("All", buttonLayout)) { SetChecks(true); } if (GUILayout.Button("None", buttonLayout)) { SetChecks(false); } if (GUILayout.Button("Invert", buttonLayout)) { Invert(); } } } }
public void OnGUI() { using (var header = new EditorGUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); isSelectedObject = GUILayout.Toggle(isSelectedObject, "selected", EditorStyles.toolbarButton, GUILayout.Width(70)); searchText = EditorGUILayout.TextField(searchText); if (EditorGUI.EndChangeCheck()) { UpdateMonoscript(); } } if (monoscripts == null) { return; } foreach (var monoscript in monoscripts) { EditorGUILayout.ObjectField(monoscript, typeof(MonoScript), false); } }
void NodeWindow(int windowID) { using (var horizontalScope = new EditorGUILayout.HorizontalScope()) { //Input Points using (var verticalScope = new EditorGUILayout.VerticalScope()) { nodes[windowID].DrawInputPoints(); } //Window using (var verticalScope = new EditorGUILayout.VerticalScope("window")) { nodes[windowID].DrawWindow(); } //Output Points using (var verticalScope = new EditorGUILayout.VerticalScope()) { nodes[windowID].DrawOutputPoints(); } } }
private void DrawViewFormat() { var xCount = 4; var width = (EditorGUIUtility.currentViewWidth - 20) / xCount; using (var vertical = new EditorGUILayout.VerticalScope()) { for (int i = 0; i < styleOptions.Length; i += xCount) { using (var hor = new EditorGUILayout.HorizontalScope()) { for (int j = i; j < i + xCount && j < styleOptions.Length; j++) { var isOn = GUILayout.Toggle(j == panelNode.style - 1, new GUIContent(styleOptions[j]), EditorStyles.radioButton, GUILayout.Width(width)); if (isOn) { panelNode.style = j + 1; } } } } } }
private void DrawCacheTable() { try { EditorGUILayout.LabelField("Cache Table", EditorStyles.boldLabel); using (var group = new EditorGUILayout.HorizontalScope()) { using (var idColumn = new EditorGUILayout.VerticalScope()) { EditorGUILayout.LabelField("Id", EditorStyles.boldLabel); foreach (var entry in cacheTable) { EditorGUILayout.LabelField(entry.Key.ToString()); } } using (var objectColumn = new EditorGUILayout.VerticalScope()) { EditorGUILayout.LabelField("Object Instance", EditorStyles.boldLabel); foreach (var entry in cacheTable) { EditorGUILayout.LabelField(entry.Value.ToString()); } } } } catch (System.NullReferenceException) {} }
public override void Draw() { if (value == null) { return; } using (var v = new EditorGUILayout.VerticalScope()) { EditorGUILayout.LabelField(string.Format("List[{0}] {1}", typeName, name)); using (var t = new EditorGUILayout.HorizontalScope()) { GUILayout.Space(23); using (var vv = new EditorGUILayout.VerticalScope()) { for (int i = 0; i < value.Count; ++i) { var item = value[i]; item.Draw(); } using (var tt = new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("Add Item")) { AddItem(); } if (GUILayout.Button("Delete Item")) { DeleteItem(); } } } } } }
private void OnGUI() { if (mExcelReader == null || mExcelReader.ExcelFormatConfig == null) { return; } using (var space = new EditorGUILayout.VerticalScope()) { mScrollPos = EditorGUILayout.BeginScrollView(mScrollPos); var rFormatConfig = mExcelReader.ExcelFormatConfig; for (int i = 0; i < rFormatConfig.Count; i++) { using (var space1 = new EditorGUILayout.HorizontalScope("TextField")) { EditorGUILayout.LabelField(rFormatConfig[i].ExcelName, GUILayout.MaxWidth(150)); EditorGUILayout.LabelField("|", GUILayout.Width(15)); EditorGUILayout.LabelField(rFormatConfig[i].SheetName, GUILayout.MaxWidth(100)); EditorGUILayout.LabelField("|", GUILayout.Width(15)); EditorGUILayout.LabelField(rFormatConfig[i].PrimaryKey, GUILayout.MaxWidth(60)); if (GUILayout.Button("导出", GUILayout.Width(60))) { mExcelReader.Export(rFormatConfig[i]); } } } EditorGUILayout.EndScrollView(); EditorGUILayout.Space(); if (GUILayout.Button("全部导出")) { mExcelReader.ExportAll(); EditorUtility.DisplayDialog("Tips", "导出Excel完成!", "OK"); } EditorGUILayout.Space(); } }
public void GutterGUI(int currentPageIndex, int pageCount, Rect windowRect) { using (new GUILayout.HorizontalScope(AllTutorialStyles.gutter)) { using (var gutterLeft = new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { var paginationText = string.Format("{0} of {1}", m_CurrentTutorial.currentPageIndex + 1, m_CurrentTutorial.pageCount); GUI.Label(gutterLeft.rect, paginationText, AllTutorialStyles.paginationLabel); } using (var gutterRight = new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) { using (new EditorGUI.DisabledScope(!canMoveToNextPage)) { var nextButtonStyle = GUI.enabled ? AllTutorialStyles.nextButton : AllTutorialStyles.nextButtonDisabled; var nextButtonRect = gutterRight.rect; nextButtonRect.xMin += nextButtonStyle.margin.left; nextButtonRect.yMin += nextButtonStyle.margin.top; nextButtonRect.xMax -= nextButtonStyle.margin.right; nextButtonRect.yMax -= nextButtonStyle.margin.bottom; if (GUI.Button(nextButtonRect, m_NextButtonText, nextButtonStyle)) { m_CurrentTutorial.TryGoToNextPage(); // exit GUI to prevent InvalidOperationException when disposing DisabledScope // some other GUIView might clear the disabled stack when repainting immediately to be unmasked GUIUtility.ExitGUI(); Repaint(); } } } } float sizeOfEachBox = (windowRect.width / pageCount) * (currentPageIndex + 1); var style = AllTutorialStyles.progressBar; GUI.DrawTexture(new Rect(0, windowRect.yMax - style.fixedHeight, sizeOfEachBox, style.fixedHeight), style.normal.background); }
public override void Render() { if (rootProperty == null) { return; } SerializedPropertyX isExpirable = rootProperty.FindProperty("IsExpirable"); SerializedPropertyX isDispellable = rootProperty.FindProperty("IsDispellable"); SerializedPropertyX isRefreshable = rootProperty.FindProperty("IsRefreshable"); SerializedPropertyX isUnique = rootProperty.FindProperty("IsUnique"); SerializedPropertyX duration = rootProperty.FindProperty("duration").FindProperty("baseValue"); SerializedPropertyX tickRate = rootProperty.FindProperty("tickRate").FindProperty("baseValue"); SerializedPropertyX ticks = rootProperty.FindProperty("ticks").FindProperty("baseValue"); GUILayout.BeginHorizontal(); isExpirable.Value = EditorGUILayout.ToggleLeft(new GUIContent("Is Expirable"), (bool)isExpirable.Value); isDispellable.Value = EditorGUILayout.ToggleLeft(new GUIContent("Is Dispellable"), (bool)isDispellable.Value); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); isRefreshable.Value = EditorGUILayout.ToggleLeft(new GUIContent("Is Refreshable"), (bool)isRefreshable.Value); isUnique.Value = EditorGUILayout.ToggleLeft(new GUIContent("Is Unique"), (bool)isUnique.Value); GUILayout.EndHorizontal(); GUILayout.Space(10f); using (var h = new EditorGUILayout.HorizontalScope()) { duration.Value = EditorGUILayout.FloatField("Duration", duration.GetValue <float>()); } using (var h = new EditorGUILayout.HorizontalScope()) { ticks.Value = EditorGUILayout.FloatField("Ticks", ticks.GetValue <float>()); } using (var h = new EditorGUILayout.HorizontalScope()) { tickRate.Value = EditorGUILayout.FloatField("Tick Rate", tickRate.GetValue <float>()); } }
static void Drawer_PhysicalCamera_ApertureShape(SerializedHDCamera p, Editor owner) { var cam = p.baseCameraSettings; using (new EditorGUI.IndentLevelScope()) { EditorGUILayout.PropertyField(p.bladeCount, Styles.bladeCount); using (var horizontal = new EditorGUILayout.HorizontalScope()) using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, Styles.curvature, p.curvature)) { var v = p.curvature.vector2Value; // The layout system breaks alignment when mixing inspector fields with custom layout'd // fields as soon as a scrollbar is needed in the inspector, so we'll do the layout // manually instead const int kFloatFieldWidth = 50; const int kSeparatorWidth = 5; float indentOffset = EditorGUI.indentLevel * 15f; var lineRect = EditorGUILayout.GetControlRect(); var labelRect = new Rect(lineRect.x, lineRect.y, EditorGUIUtility.labelWidth - indentOffset, lineRect.height); var floatFieldLeft = new Rect(labelRect.xMax, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height); var sliderRect = new Rect(floatFieldLeft.xMax + kSeparatorWidth - indentOffset, lineRect.y, lineRect.width - labelRect.width - kFloatFieldWidth * 2 - kSeparatorWidth * 2, lineRect.height); var floatFieldRight = new Rect(sliderRect.xMax + kSeparatorWidth - indentOffset, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height); EditorGUI.PrefixLabel(labelRect, propertyScope.content); v.x = EditorGUI.FloatField(floatFieldLeft, v.x); EditorGUI.MinMaxSlider(sliderRect, ref v.x, ref v.y, HDPhysicalCamera.kMinAperture, HDPhysicalCamera.kMaxAperture); v.y = EditorGUI.FloatField(floatFieldRight, v.y); p.curvature.vector2Value = v; } EditorGUILayout.PropertyField(p.barrelClipping, Styles.barrelClipping); EditorGUILayout.PropertyField(p.anamorphism, Styles.anamorphism); } }
public override void OnInspectorGUI() { EditorGUILayout.Space(); using (var rHorizontalScope = new EditorGUILayout.HorizontalScope("box")) { if (GUILayout.Button("Play")) { this.mTweeningAnimator.Play(); } if (GUILayout.Button("Pause")) { this.mTweeningAnimator.Pause(); } if (GUILayout.Button("Stop")) { this.mTweeningAnimator.Stop(); } } using (var rHorizontalScope = new EditorGUILayout.HorizontalScope("box")) { EditorGUIUtility.labelWidth = 65; EditorGUILayout.PropertyField(this.serializedObject.FindProperty("IsIgnoreTimeScale"), new GUIContent("TimeScale: "), GUILayout.Width(75)); EditorGUIUtility.labelWidth = 35; EditorGUILayout.PropertyField(this.serializedObject.FindProperty("IsUseFixedUpdate"), new GUIContent("Fixed: "), GUILayout.Width(45)); EditorGUIUtility.labelWidth = 30; EditorGUILayout.PropertyField(this.serializedObject.FindProperty("IsAutoExecute"), new GUIContent("Auto: "), GUILayout.Width(45)); EditorGUIUtility.labelWidth = 30; EditorGUILayout.PropertyField(this.serializedObject.FindProperty("IsLoopAnimator"), new GUIContent("Loop: "), GUILayout.Width(45)); } this.mReorderableActionList.DoLayoutList(); this.serializedObject.ApplyModifiedProperties(); }
private void DrawEventWidget() { using (EditorGUILayout.HorizontalScope hScope = new EditorGUILayout.HorizontalScope()) { //筛选当前UI的事件控件 foreach (var elem in Enum.GetValues(typeof(CodeConfig.EventWidgetType))) { for (int i = 0; i < uiWidgets.Count; i++) { if (uiWidgets[i] == null) { continue; } Type type = uiWidgets[i].GetType(); if (type == null) { Debug.LogError("BuildUICode type error !"); continue; } if (type.Name == elem.ToString() && !selectedEventWidgets.ContainsKey(type.Name)) { selectedEventWidgets.Add(type.Name, true); } } } //绘制toggle,注意不能遍历dic的同时赋值 List <string> list = new List <string>(selectedEventWidgets.Keys); foreach (string wedagetName in list) { selectedEventWidgets[wedagetName] = EditorGUILayout.ToggleLeft(wedagetName, selectedEventWidgets[wedagetName], GUILayout.Width(halfViewWidth / 8f)); } } }
private void DrawHead() { using (var hor = new EditorGUILayout.HorizontalScope()) { EditorGUILayout.ObjectField(script, typeof(MonoScript), false); if (!isSetting && GUILayout.Button("setting", EditorStyles.miniButtonRight, GUILayout.Width(60))) { isSetting = true; } else if (isSetting && GUILayout.Button("confer", EditorStyles.miniButtonRight, GUILayout.Width(60)) && !string.IsNullOrEmpty(authorName)) { isSetting = false; } } if (!isSetting && GUILayout.Button("Clear", EditorStyles.toolbarButton)) { if (currentTemplates != null) { currentTemplates.headerInfo = new TempScriptHeader(); } templates.Clear(); } }
private static void OnGUI() { EditorGUILayout.LabelField(COMPILER_OPTIONS_HEADER, EditorStyles.boldLabel); bool autoGeneratePreference; bool newAutoGeneratePreference; using (var scope = new EditorGUILayout.HorizontalScope()) { autoGeneratePreference = CompilerOverrideTools.IsCompilerOverrideFileAutoGenerationEnabled(); EditorGUILayout.LabelField(AUTO_GENERATE_PREFERENCE_LABEL, GUILayout.MinWidth(220f)); newAutoGeneratePreference = EditorGUILayout.Toggle(autoGeneratePreference); } if (autoGeneratePreference != newAutoGeneratePreference) { CompilerOverrideTools.SetAutoGenerateCompilerOverrideFilePreference(newAutoGeneratePreference); } if (GUILayout.Button(REGENERATE_COMPILER_FILE_BUTTON)) { CompilerOverrideTools.RegenerateCompilerOverrideFile(); } }