protected override void OnExpandedGUI(WorldStampCreator parent) { EditorGUI.BeginChangeCheck(); Mask = LayerMaskFieldUtility.LayerMaskField("Layer Mask", Mask, false); RelativeMode = (WorldStamp.EObjectRelativeMode)EditorGUILayout.EnumPopup("Relative Mode", RelativeMode); if (EditorGUI.EndChangeCheck()) { NeedsRecapture = true; } }
protected override LayerMask DrawGUIInternal(LayerMask target, string label = "", Type targetType = null, FieldInfo fieldInfo = null, object context = null) { return(LayerMaskFieldUtility.LayerMaskField(label, target, true)); }
private void DoConnectionsUI() { EditorGUILayout.HelpBox( string.Format("Press [{0}] to select a node and [Shift] to select multiple.\n\nHold [CTRL] and press [Middle Mouse Button] to place a new node, or connect two existing nodes." , _placementKey.Value), MessageType.Info); // Connection Configuration history for easy selection FocusedRoadNetwork.RoadConfigHistory = FocusedRoadNetwork.RoadConfigHistory.Where(configuration => configuration).ToList(); // Remove null entries if (FocusedRoadNetwork.RoadConfigHistory.Count > 0) { _roadConfigScroll = EditorGUILayout.BeginScrollView(_roadConfigScroll, GUILayout.Height(95)); EditorGUILayout.BeginHorizontal("Box", GUILayout.ExpandWidth(true)); for (int i = FocusedRoadNetwork.RoadConfigHistory.Count - 1; i >= 0; i--) { var config = FocusedRoadNetwork.RoadConfigHistory[i]; if (config == null) { FocusedRoadNetwork.RoadConfigHistory.RemoveAt(i); continue; } var textStyle = new GUIStyle { richText = true, wordWrap = true, alignment = TextAnchor.MiddleCenter, fontStyle = FontStyle.Bold, font = GUIResources.OpenSans_ExtraBold, fontSize = 12, }; GUI.color = Color.black.WithAlpha(.3f); if (config == _currentConfiguration) { GUILayout.Label(GUIResources.RoadConfigurationIcon, EditorStyles.helpBox, GUILayout.Width(64), GUILayout.Height(64)); } else { GUILayout.Label(GUIResources.RoadConfigurationIcon, GUILayout.Width(64), GUILayout.Height(64)); } GUI.color = Color.white; var buttonRect = GUILayoutUtility.GetLastRect(); var configName = string.Format("<color={1}>{0}</color>", config.name.SplitCamelCase(), Color.black.ToHexString()); const float outlineSize = 1; var buttonRect1 = buttonRect; buttonRect1.x += outlineSize; GUI.Label(buttonRect1, configName, textStyle); buttonRect1.x -= outlineSize * 2; GUI.Label(buttonRect1, configName, textStyle); buttonRect1.x += outlineSize; buttonRect1.y += outlineSize; GUI.Label(buttonRect1, configName, textStyle); buttonRect1.y -= outlineSize * 2; GUI.Label(buttonRect1, configName, textStyle); configName = string.Format("<color={1}>{0}</color>", config.name.SplitCamelCase(), config.PreviewColor.ToHexString()); var deleteRect = new Rect(buttonRect.max.x - 20, buttonRect.y + 2, 24, 24); var content = GenericEditor.DeleteContent; content.tooltip = "Remove From List"; if (GUI.Button(deleteRect, content, EditorStyles.label)) { FocusedRoadNetwork.RoadConfigHistory.RemoveAt(i); _currentConfiguration = null; } if (GUI.Button(buttonRect, configName, textStyle)) { _currentConfiguration = config; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); } if (!FocusedRoadNetwork.RoadConfigHistory.Contains(_currentConfiguration)) { FocusedRoadNetwork.RoadConfigHistory.Add(_currentConfiguration); } _currentConfiguration = (ConnectionConfiguration)EditorGUILayout.ObjectField("Configuration", _currentConfiguration, typeof(ConnectionConfiguration), false); GUI.enabled = _currentConfiguration != null; if (GUILayout.Button("Apply Configuration to Selected")) { var selected = GetCurrentlySelectedNodes(); foreach (var node in selected) { foreach (var nodeConnection in node.AllConnections()) { nodeConnection.Configuration = _currentConfiguration; EditorUtility.SetDirty(nodeConnection); } } } GUI.enabled = true; EditorExtensions.Seperator(); // Config FocusedRoadNetwork.CurrentNodeConfiguration.SnappingMode = (NodeConfiguration.ESnappingMode)EditorGUILayout.EnumPopup("Snapping Mode", FocusedRoadNetwork.CurrentNodeConfiguration.SnappingMode); if (FocusedRoadNetwork.CurrentNodeConfiguration.SnappingMode == NodeConfiguration.ESnappingMode.Raycast) { FocusedRoadNetwork.CurrentNodeConfiguration.SnapMask = LayerMaskFieldUtility.LayerMaskField("Snapping Mask", FocusedRoadNetwork.CurrentNodeConfiguration.SnapMask, false); } FocusedRoadNetwork.CurrentNodeConfiguration.SnapOffset = EditorGUILayout.FloatField("Snapping Offset", FocusedRoadNetwork.CurrentNodeConfiguration.SnapOffset); }