private void DrawTrack(Rect rect) { using (new GUI.ClipScope(new Rect(rect.x, rect.y, rect.width, rect.height))) { int startY = Mathf.FloorToInt(DrawerConfig.ScrollPosY / DrawerConfig.TrackLineHeight); int endY = Mathf.CeilToInt((DrawerConfig.ScrollPosY + rect.height) / DrawerConfig.TrackLineHeight); float maxWidth = m_GroupData.Length * DrawerConfig.WidthForSecond; for (int i = startY; i < endY; ++i) { float y = DrawerConfig.TrackLineHeight * i - DrawerConfig.ScrollPosY; if (i >= m_TrackDrawers.Count) { break; } Rect trackRect = new Rect(0, y, rect.width, DrawerConfig.TrackLineHeight); trackRect.width = Mathf.Min(rect.width, maxWidth - DrawerConfig.ScrollPosX); if (SelectTrackIndex == i) { EditorGUIUtil.DrawAreaLine(trackRect, Color.green); } m_TrackDrawers[i].OnGUI(trackRect); } } }
private void OnGUI() { Rect toolbarRect = new Rect(0, 0, position.width, TOOLBAR_HEIGHT); DrawToolbar(toolbarRect); Rect configListRect = new Rect(1, TOOLBAR_HEIGHT, CONFIG_LIST_WIDTH, position.height - TOOLBAR_HEIGHT - 1); EditorGUIUtil.DrawAreaLine(configListRect, Color.gray); configListRect.x += 2; configListRect.y += 2; configListRect.width -= 4; configListRect.height -= 4; DrawConfigList(configListRect); Rect tabPageRect = new Rect(CONFIG_LIST_WIDTH, TOOLBAR_HEIGHT, position.width - CONFIG_LIST_WIDTH, TAB_PAGE_HEIGHT); DrawTabPages(tabPageRect); Rect tabContentRect = new Rect(CONFIG_LIST_WIDTH, TOOLBAR_HEIGHT + TAB_PAGE_HEIGHT, position.width - CONFIG_LIST_WIDTH - 1, position.height - TAB_PAGE_HEIGHT - TOOLBAR_HEIGHT - 1); EditorGUIUtil.DrawAreaLine(tabContentRect, Color.yellow); tabContentRect.x += 1; tabContentRect.y += 1; tabContentRect.width -= 2; tabContentRect.height -= 2; DrawTabContent(tabContentRect); }
public void OnGUI(Rect rect) { if (m_EndStageData == null) { EditorGUI.HelpBox(rect, "Data is Null", MessageType.Error); return; } float deltaHeight = 0.0f; Rect isScaleTimeRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, EditorGUIUtility.singleLineHeight); m_EndStageData.IsScaleByTime = EditorGUI.Toggle(isScaleTimeRect, "Is Scale By Time", m_EndStageData.IsScaleByTime); deltaHeight += isScaleTimeRect.height; Rect groupRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, (rect.height - deltaHeight) * .6f); EditorGUIUtil.DrawAreaLine(groupRect, Color.gray); groupDrawer.OnGUI(groupRect); deltaHeight += groupRect.height; Rect breakGroupRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, rect.height - deltaHeight); EditorGUIUtil.DrawAreaLine(breakGroupRect, Color.gray); breakGroupDrawer.OnGUI(breakGroupRect); }
public void OnGUI(Rect rect) { if (m_FlyingStageData == null) { EditorGUI.HelpBox(rect, "Data is Null", MessageType.Error); return; } EditorGUIUtil.DrawAreaLine(rect, Color.gray); groupDrawer.OnGUI(rect); }
public void OnGUI(Rect rect) { if (m_TitleSytle == null) { m_TitleSytle = new GUIStyle(EditorStyles.boldLabel); m_TitleSytle.alignment = TextAnchor.MiddleCenter; m_TitleSytle.fontSize = 20; } if (m_PropertyStyle == null) { m_PropertyStyle = new GUIStyle(EditorStyles.boldLabel); m_PropertyStyle.alignment = TextAnchor.MiddleCenter; } float deltaHeight = 0.0f; Rect titileRect = new Rect(rect.x, rect.y, rect.width, TITLE_HEIGHT); EditorGUI.LabelField(titileRect, m_TitleName, m_TitleSytle); deltaHeight += TITLE_HEIGHT; Rect propertyRect = new Rect(rect.x + rect.width - PROPERTY_WIDTH, rect.y + deltaHeight, PROPERTY_WIDTH, rect.height - deltaHeight); EditorGUIUtil.DrawAreaLine(propertyRect, Color.grey); OnPropertyGUI(propertyRect); Rect operationRect = new Rect(rect.x, rect.y + deltaHeight, OPERATION_WIDTH, RULER_HEIGHT); EditorGUIUtil.DrawAreaLine(operationRect, Color.grey); DrawTrackOperation(operationRect); Rect rulerRect = new Rect(rect.x + OPERATION_WIDTH + 1, rect.y + deltaHeight, rect.width - PROPERTY_WIDTH - OPERATION_WIDTH, RULER_HEIGHT); EditorGUIUtil.DrawAreaLine(rulerRect, Color.grey); DrawRuler(rulerRect); deltaHeight += RULER_HEIGHT; Rect trackIndexRect = new Rect(rect.x, rect.y + deltaHeight, OPERATION_WIDTH, rect.height - deltaHeight); EditorGUIUtil.DrawAreaLine(trackIndexRect, Color.grey); DrawTrackIndex(trackIndexRect); Rect trackRect = new Rect(rect.x + OPERATION_WIDTH, rect.y + deltaHeight, rect.width - PROPERTY_WIDTH - OPERATION_WIDTH, rect.height - deltaHeight); EditorGUIUtil.DrawAreaLine(trackRect, Color.blue); DrawTimeGrid(trackRect); DrawTrack(trackRect); DrawScroll(trackRect); }
private void DrawGroup(Rect rect) { if (m_ReleaseStageData.Childs.Count == 0) { EditorGUI.LabelField(rect, "Child Data is Empty.Add a new child by btn(new)"); return; } SkillReleaseChildData childData = m_ReleaseStageData.Childs[SelectedChildIndex]; float deltaHeight = 0.0f; Rect fieldRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, EditorGUIUtility.singleLineHeight); childData.ConditionType = (SkillReleaseStageCondtionType)EditorGUI.EnumPopup(fieldRect, "ConditionType", childData.ConditionType); SkillReleaseTimeLengthCondition condition = childData.TimeLengthCondition; fieldRect.y += fieldRect.height; EditorGUI.LabelField(fieldRect, "TimeLengthCondition"); fieldRect.y += fieldRect.height; Rect conditionRect = fieldRect; conditionRect.x += 12; condition.MinTime = EditorGUI.FloatField(conditionRect, "MinTime", condition.MinTime); conditionRect.y += conditionRect.height; condition.MaxTime = EditorGUI.FloatField(conditionRect, "MaxTime", condition.MaxTime); deltaHeight += EditorGUIUtility.singleLineHeight * 4; Rect groupRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, (rect.height - deltaHeight) * .6f); EditorGUIUtil.DrawAreaLine(groupRect, Color.gray); groupDrawer.OnGUI(groupRect); deltaHeight += groupRect.height; Rect breakGroupRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, rect.height - deltaHeight); EditorGUIUtil.DrawAreaLine(breakGroupRect, Color.gray); breakGroupDrawer.OnGUI(breakGroupRect); }
public void OnGUI(Rect rect) { if (m_BeginStageData == null) { EditorGUI.HelpBox(rect, "Data is Null", MessageType.Error); return; } float deltaHeight = 0.0f; Rect isScaleTimeRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, EditorGUIUtility.singleLineHeight); m_BeginStageData.IsScaleByTime = EditorGUI.Toggle(isScaleTimeRect, "Is Scale By Time", m_BeginStageData.IsScaleByTime); deltaHeight += isScaleTimeRect.height; //进度条 Rect ProgressBarRect = new Rect(isScaleTimeRect.x, isScaleTimeRect.y + isScaleTimeRect.height, isScaleTimeRect.width, EditorGUIUtility.singleLineHeight * 3); GUI.BeginGroup(ProgressBarRect); Rect PbRect = new Rect(0, 0, ProgressBarRect.width, EditorGUIUtility.singleLineHeight); EditorGUI.LabelField(PbRect, "进度条信息:"); PbRect.x += 20; PbRect.y += EditorGUIUtility.singleLineHeight; m_BeginStageData.ProgressBarData.IsShow = EditorGUI.Toggle(PbRect, "是否显示", m_BeginStageData.ProgressBarData.IsShow); PbRect.y += EditorGUIUtility.singleLineHeight; m_BeginStageData.ProgressBarData.StyleIndex = EditorGUI.IntField(PbRect, "样式索引", m_BeginStageData.ProgressBarData.StyleIndex); GUI.EndGroup(); deltaHeight += ProgressBarRect.height; Rect groupRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, (rect.height - deltaHeight) * .6f); EditorGUIUtil.DrawAreaLine(groupRect, Color.gray); groupDrawer.OnGUI(groupRect); deltaHeight += groupRect.height; Rect breakGroupRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, rect.height - deltaHeight); EditorGUIUtil.DrawAreaLine(breakGroupRect, Color.gray); breakGroupDrawer.OnGUI(breakGroupRect); }
private void OnGUI() { if (m_TitleStyle == null) { m_TitleStyle = new GUIStyle(EditorStyles.label); m_TitleStyle.alignment = TextAnchor.MiddleCenter; m_TitleStyle.fontSize = 24; m_TitleStyle.fontStyle = FontStyle.Bold; } DrawToolbar(); EditorGUILayout.LabelField(new GUIContent("Asset Dependencies"), m_TitleStyle, GUILayout.Height(24)); EditorGUILayout.LabelField(GUIContent.none, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); Rect areaRect = GUILayoutUtility.GetLastRect(); areaRect.x += 1; areaRect.width -= 2; areaRect.y += 1; areaRect.height -= 2; EditorGUIUtil.DrawAreaLine(areaRect, Color.blue); Rect dependTreeViewRect = areaRect; dependTreeViewRect.x += 1; dependTreeViewRect.width -= 2; dependTreeViewRect.y += 1; dependTreeViewRect.height -= 2; if (m_DependTreeView == null) { InitDependTreeView(); RefreshDependTreeView(); } m_DependTreeView?.OnGUI(dependTreeViewRect); }
public void OnGUI(Rect rect) { if (m_ReleaseStageData == null) { EditorGUI.HelpBox(rect, "Data is Null", MessageType.Error); return; } float deltaHeight = 0.0f; Rect fieldRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, EditorGUIUtility.singleLineHeight); m_ReleaseStageData.IsScaleByTime = EditorGUI.Toggle(fieldRect, "IsScaleByTime", m_ReleaseStageData.IsScaleByTime); fieldRect.y += fieldRect.height; m_ReleaseStageData.LoopCount = EditorGUI.IntField(fieldRect, "LoopCount", m_ReleaseStageData.LoopCount); fieldRect.y += fieldRect.height; m_ReleaseStageData.IsDynamicLoopCount = EditorGUI.Toggle(fieldRect, "IsDynamicLoopCount", m_ReleaseStageData.IsDynamicLoopCount); fieldRect.y += fieldRect.height + 10; EditorGUI.LabelField(fieldRect, "Child Datas:"); deltaHeight += EditorGUIUtility.singleLineHeight * 5 + 10; Rect childRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, rect.height - deltaHeight); EditorGUIUtil.DrawAreaLine(childRect, Color.gray); Rect childOperationRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, 25); using (new GUILayout.AreaScope(childOperationRect)) { using (new GUILayout.HorizontalScope(GUILayout.Height(25))) { if (GUILayout.Button("New", GUILayout.Width(CHILD_OPERATION_WIDTH))) { SkillReleaseChildData childData = new SkillReleaseChildData(); m_ReleaseStageData.Childs.Add(childData); SelectedChildIndex = m_ReleaseStageData.Childs.Count - 1; } if (GUILayout.Button("Delete", GUILayout.Width(CHILD_OPERATION_WIDTH))) { if (m_ReleaseStageData.Childs.Count > 1) { m_ReleaseStageData.Childs.RemoveAt(SelectedChildIndex); int prevChildIndex = SelectedChildIndex - 1; if (prevChildIndex < 0) { prevChildIndex = 0; } SelectedChildIndex = prevChildIndex; } } GUILayout.FlexibleSpace(); if (GUILayout.Button("Prev", GUILayout.Width(CHILD_OPERATION_WIDTH))) { int prevChildIndex = SelectedChildIndex - 1; if (prevChildIndex >= 0) { SelectedChildIndex = prevChildIndex; } } GUILayout.Label("" + (SelectedChildIndex + 1) + "/" + m_ReleaseStageData.Childs.Count); if (GUILayout.Button("Next", GUILayout.Width(CHILD_OPERATION_WIDTH))) { int nextChildIndex = SelectedChildIndex + 1; if (nextChildIndex < m_ReleaseStageData.Childs.Count) { SelectedChildIndex = nextChildIndex; } } } } deltaHeight += childOperationRect.height; Rect groupRect = new Rect(rect.x, rect.y + deltaHeight, rect.width, rect.height - deltaHeight); DrawGroup(groupRect); }