private void OnGUI_BrushSelection() { if (this.arrowStyle == null) { this.arrowStyle = new GUIStyle(GUI.skin.label); this.arrowStyle.stretchHeight = true; this.arrowStyle.alignment = TextAnchor.MiddleCenter; } GUILayout.BeginVertical(); ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Source Brush"), RotorzEditorStyles.Instance.BoldLabel); { this.sourceBrush = RotorzEditorGUI.BrushField(this.sourceBrush); EditorGUILayout.Space(); this.sourceBrush = this.DrawBrushPreviewField(this.sourceBrush); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.Label("=>", this.arrowStyle); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Replacement Brush"), RotorzEditorStyles.Instance.BoldLabel); { this.replacementBrush = RotorzEditorGUI.BrushField(this.replacementBrush); EditorGUILayout.Space(); this.replacementBrush = this.DrawBrushPreviewField(this.replacementBrush); } GUILayout.EndVertical(); }
private void DrawTilePreviewSection() { GUILayout.Space(10); GUILayout.BeginHorizontal(); RotorzEditorGUI.Title(TileLang.Text("Tile Previews")); GUILayout.FlexibleSpace(); if (GUILayout.Button(TileLang.ParticularText("Action", "Refresh Previews"), RotorzEditorStyles.Instance.ButtonWide)) { this.OnRefreshPreviews(); GUIUtility.ExitGUI(); } GUILayout.Space(5); GUILayout.EndHorizontal(); ExtraEditorGUI.SeparatorLight(); GUILayout.Space(-5); GUILayout.BeginVertical(RotorzEditorStyles.Instance.PaddedScrollView); this.DrawTilePreviews(); GUILayout.EndVertical(); GUILayout.Space(-10); }
private void DrawBrushCreatorTabs() { GUI.Box(new Rect(-1f, -1f, 109f, Screen.height + 6f), GUIContent.none); GUILayout.Space(30f); for (int i = 0; i < this.brushCreatorGroups.Length; ++i) { // Draw a separator between each group. if (i != 0) { ExtraEditorGUI.SeparatorLight(); } // Draw brush creator tabs in group. foreach (var brushCreator in this.brushCreatorGroups[i]) { if (TabButton(brushCreator == this.selectedBrushCreator, brushCreator.Name)) { this.SelectedBrushCreatorType = brushCreator.GetType(); this.hintShouldFocusPrimaryNameControl = true; } } } GUILayout.FlexibleSpace(); }
/// <inheritdoc/> protected override void DoGUI() { this.hasDrawnGUI = true; if (this.tileSystem == null) { return; } GUISkin skin = GUI.skin; GUILayout.Space(15f); ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Prefab Output Path:")); GUILayout.BeginHorizontal(); { this.PrefabOutputPath = RotorzEditorGUI.RelativeAssetPathTextField(GUIContent.none, this.PrefabOutputPath, ".prefab"); if (GUILayout.Button("...", GUILayout.Width(40))) { GUIUtility.keyboardControl = 0; this.PrefabOutputPath = this.DoSelectPrefabPath( TileLang.ParticularText("Action", "Save Prefab Output"), TileLang.Text("Specify path for prefab output"), this.PrefabOutputPath ); } } GUILayout.EndHorizontal(); EditorGUILayout.Space(); ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Data Output Path:")); GUILayout.BeginHorizontal(); { this.DataOutputPath = RotorzEditorGUI.RelativeAssetPathTextField(GUIContent.none, this.DataOutputPath, ".asset"); if (GUILayout.Button("...", GUILayout.Width(40))) { GUIUtility.keyboardControl = 0; this.DataOutputPath = this.DoSelectAssetPath( TileLang.ParticularText("Action", "Save Data Output"), TileLang.Text("Specify path for mesh output"), this.DataOutputPath ); } } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); ExtraEditorGUI.Separator(marginBottom: 10); GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); this.OnGUI_Buttons(); GUILayout.Space(5f); } GUILayout.EndHorizontal(); GUILayout.Space(8f); }
/// <summary> /// Occurs when header GUI is rendered and for GUI event handling. /// </summary> /// <remarks> /// <para>This means that your <see cref="OnFixedHeaderGUI"/> implementation might /// be called several times per frame (one call per event).</para> /// <para>The default implementation allows users to:</para> /// <list type="bullet"> /// <item>Rename brush</item> /// <item>Mark brush as "static"</item> /// <item>Mark brush as "smooth"</item> /// <item>Hide brush</item> /// <item>Set layer and tag for painted tiles</item> /// <item>Categorize brush</item> /// </list> /// </remarks> public override void OnFixedHeaderGUI() { GUILayout.Space(6); GUILayout.BeginHorizontal(); { GUILayout.Space(90); EditorGUIUtility.labelWidth = 80; this.DrawTilesetNameField(); GUILayout.Label( TileLang.PluralText( /* 0: quantity of brushes */ "Contains 1 brush", "Contains {0} brushes", this.tilesetRecord.BrushRecords.Count ), RotorzEditorStyles.Instance.LabelMiddleLeft ); Rect menuPosition = GUILayoutUtility.GetRect(GUIContent.none, RotorzEditorStyles.Instance.LabelMiddleLeft, GUILayout.Width(45)); this.DrawMenuButton(new Rect(menuPosition.x, 2, 44, 26), TileLang.Text("Tileset Menu")); this.DrawHelpButton(); } GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 125; ExtraEditorGUI.SeparatorLight(marginTop: 7, marginBottom: 0, thickness: 3); this.DrawTabs(); }
/// <inheritdoc/> public override void OnExtendedPropertiesGUI() { var emptyBrush = Brush as EmptyBrush; using (var content = ControlContent.WithTrailableTip( TileLang.ParticularText("Property", "Always Add Container"), TileLang.Text("Add tile container object even when not needed by brush.") )) { emptyBrush.alwaysAddContainer = EditorGUILayout.ToggleLeft(content, emptyBrush.alwaysAddContainer); ExtraEditorGUI.TrailingTip(content); } using (var content = ControlContent.WithTrailableTip( TileLang.ParticularText("Property", "Add Collider"), TileLang.Text("Automatically adds box collider to painted tile.") )) { emptyBrush.addCollider = EditorGUILayout.ToggleLeft(content, emptyBrush.addCollider); if (emptyBrush.addCollider) { ++EditorGUI.indentLevel; emptyBrush.colliderType = (ColliderType)EditorGUILayout.EnumPopup(emptyBrush.colliderType); --EditorGUI.indentLevel; } ExtraEditorGUI.TrailingTip(content); } }
private void DrawSelectedBrushCreator() { // Allow user to use return key to trigger asset creation. if (ExtraEditorGUI.AcceptKeyboardReturn()) { this.selectedBrushCreator.OnButtonCreate(); return; } // Draw creator title. Color initialBackgroundColor = GUI.backgroundColor; GUI.backgroundColor = new Color(0.8f, 0.8f, 0.8f); EditorGUILayout.BeginVertical(s_TitleHeaderStyle); { GUILayout.Box(this.selectedBrushCreator.Title, s_TitleStyle); } EditorGUILayout.EndVertical(); GUI.backgroundColor = initialBackgroundColor; // Draw creator GUI. EditorGUIUtility.wideMode = false; GUILayout.BeginVertical(s_PaddedView); { GUILayout.Space(5); this.selectedBrushCreator.OnGUI(); } GUILayout.EndVertical(); }
private void DrawServiceDependents(ServiceEntry service) { IServiceDescriptor[] sortedDependents; this.sortedServiceDependentsLookup.TryGetValue(service.Descriptor, out sortedDependents); bool hasProjectDependentUser = (service.Installer != null && service.Installer.IsProjectDependency); bool hasServiceDependents = (sortedDependents != null && sortedDependents.Length != 0); if (!hasProjectDependentUser && !hasServiceDependents) { return; } ExtraEditorGUI.SeparatorLight(marginTop: 0); GUILayout.Label(" Required For:", ExtraEditorStyles.Instance.MetaLabel); if (hasProjectDependentUser) { GUILayout.Label("(Project)", EditorStyles.miniLabel); } if (hasServiceDependents) { foreach (var dependent in sortedDependents) { GUILayout.Label(dependent.TitleWithNamespace, EditorStyles.miniLabel); } } GUILayout.Space(2); }
/// <inheritdoc/> protected override void DoGUI() { s_SelectedTab = Mathf.Clamp(RotorzEditorGUI.TabSelector(s_SelectedTab, this.tabContent), 0, this.tabs.Count - 1); GUILayout.Space(4); GUILayout.Label(this.tabs[s_SelectedTab].Description, EditorStyles.wordWrappedLabel); GUILayout.Space(5); EditorGUIUtility.labelWidth = 70; GUILayout.BeginHorizontal(); this.DrawFlagFields(0, 7); GUILayout.Space(5); this.DrawFlagFields(8, 15); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); ExtraEditorGUI.Separator(marginTop: 0); this.OnGUI_Buttons(); GUILayout.Space(5); }
private void DrawPaintingTab() { RtsPreferences.EraseEmptyChunksPreference.Value = (EraseEmptyChunksPreference)EditorGUILayout.EnumPopup(TileLang.Text("Erase empty chunks"), RtsPreferences.EraseEmptyChunksPreference); ExtraEditorGUI.SeparatorLight(); RtsPreferences.ToolPreferredNozzleIndicator.Value = (NozzleIndicator)EditorGUILayout.EnumPopup(TileLang.Text("Preferred nozzle indicator"), RtsPreferences.ToolPreferredNozzleIndicator); ++EditorGUI.indentLevel; { RtsPreferences.ToolWireframeColor.Value = EditorGUILayout.ColorField(TileLang.ParticularText("RenderMode", "Wireframe"), RtsPreferences.ToolWireframeColor); RtsPreferences.ToolShadedColor.Value = EditorGUILayout.ColorField(TileLang.ParticularText("RenderMode", "Shaded"), RtsPreferences.ToolShadedColor); } --EditorGUI.indentLevel; ExtraEditorGUI.SeparatorLight(); RtsPreferences.ToolImmediatePreviews.Value = EditorGUILayout.ToggleLeft(TileLang.Text("Display immediate previews"), RtsPreferences.ToolImmediatePreviews); EditorGUI.BeginDisabledGroup(!RtsPreferences.ToolImmediatePreviews); ++EditorGUI.indentLevel; { RtsPreferences.ToolImmediatePreviewsTintColor.Value = EditorGUILayout.ColorField(TileLang.Text("Preview Tint"), RtsPreferences.ToolImmediatePreviewsTintColor); RtsPreferences.ToolImmediatePreviewsSeeThrough.Value = EditorGUILayout.Toggle(TileLang.Text("See-through previews"), RtsPreferences.ToolImmediatePreviewsSeeThrough); ExtraEditorGUI.TrailingTip(TileLang.Text("Hold control when painting to temporarily see-through.")); } --EditorGUI.indentLevel; EditorGUI.EndDisabledGroup(); }
private void DrawProceduralField(TilesetBrush brush, Tileset tileset) { using (var content = ControlContent.WithTrailableTip( TileLang.ParticularText("Property", "Procedural"), TileLang.Text("Allows individual atlas brushes to override property of tileset.") )) { // Need to make width of "Procedural" popup shorter. GUILayout.BeginHorizontal(GUILayout.Width(200)); InheritYesNo newProcedural = (InheritYesNo)EditorGUILayout.EnumPopup(content, brush.procedural); if (newProcedural != brush.procedural) { brush.procedural = newProcedural; if (!brush.IsProcedural) { // Ensure that required procedural mesh exists! if (BrushUtility.EnsureTilesetMeshExists(tileset, brush.tileIndex)) { AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(tileset.tileMeshAsset)); } } } Rect position = GUILayoutUtility.GetLastRect(); GUI.Label(new Rect(position.x + position.width, position.y, 100, position.height), "= " + (brush.IsProcedural ? TileLang.Text("Procedural") : TileLang.Text("Non-Procedural")), EditorStyles.miniLabel); GUILayout.EndHorizontal(); ExtraEditorGUI.TrailingTip(content); } }
/// <inheritdoc/> public override void OnAdvancedToolOptionsGUI() { this.PlopLocation = (Location)EditorGUILayout.EnumPopup(TileLang.ParticularText("Property", "Location"), this.PlopLocation); ++EditorGUI.indentLevel; switch (this.PlopLocation) { case Location.GroupInsideTileSystem: this.PlopGroupName = EditorGUILayout.TextField(TileLang.ParticularText("Property", "Group Name"), this.PlopGroupName); break; } --EditorGUI.indentLevel; ExtraEditorGUI.SeparatorLight(); // Repaint scene views when options are changed so that handles updated. EditorGUI.BeginChangeCheck(); this.DisableCycleFunction = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Disable cycle function"), this.DisableCycleFunction); this.InteractWithActiveSystemOnly = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Interact with active system only"), this.InteractWithActiveSystemOnly); this.HideWireframeOutline = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Hide wireframe outline"), this.HideWireframeOutline); if (EditorGUI.EndChangeCheck()) { SceneView.RepaintAll(); } }
/// <inheritdoc/> protected override void DoGUI() { GUILayout.Space(10); GUILayout.BeginVertical(this.paddedArea1Style); RotorzEditorGUI.Title(TileLang.ParticularText("Action", "Refresh Tiles")); GUILayout.Space(5); GUILayout.Label(TileLang.Text("Tiles are replaced if obvious changes are detected. You can force refresh all tiles if necessary."), EditorStyles.wordWrappedLabel); ExtraEditorGUI.SeparatorLight(marginTop: 5, marginBottom: 5, thickness: 3); GUILayout.BeginVertical(this.paddedArea2Style); s_ForceRefreshTiles = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Force refresh all tiles"), s_ForceRefreshTiles); GUILayout.Space(2); EditorGUI.indentLevel += 2; if (!s_ForceRefreshTiles) { s_UpdateProcedural = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Update procedural tiles"), s_UpdateProcedural); } else { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Update procedural tiles"), true); EditorGUI.EndDisabledGroup(); } EditorGUI.indentLevel -= 2; GUILayout.Space(2); s_PreserveManualOffset = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Preserve manual offsets"), s_PreserveManualOffset); GUILayout.Space(2); s_PreserveFlags = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Preserve painted user flags"), s_PreserveFlags); GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); EditorGUILayout.HelpBox(TileLang.Text("Some manual changes may be lost when refreshing tiles."), MessageType.Warning, true); GUILayout.Space(8); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(TileLang.ParticularText("Action", "Refresh"), ExtraEditorStyles.Instance.BigButtonPadded)) { this.OnButtonRefresh(); GUIUtility.ExitGUI(); } GUILayout.Space(3); if (GUILayout.Button(TileLang.ParticularText("Action", "Cancel"), ExtraEditorStyles.Instance.BigButtonPadded)) { this.Close(); GUIUtility.ExitGUI(); } GUILayout.Space(5); GUILayout.EndHorizontal(); GUILayout.Space(8); }
/// <inheritdoc/> public override void OnGUI() { GUILayout.Label( TileLang.Text("Two-dimensional tile brushes can be created from a tileset."), EditorStyles.wordWrappedLabel ); GUILayout.Space(10f); this.DrawTilesetNameField(); GUILayout.Space(5f); EditorGUI.BeginChangeCheck(); { GUILayout.BeginHorizontal(); { this.DrawAtlasTextureField(); GUILayout.Space(7f); this.DrawAtlasParametersGUI(); GUILayout.Space(20f); this.DrawEdgeCorrectionGUI(); GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } if (EditorGUI.EndChangeCheck()) { this.RecalculateMetrics(); } // Display warning message if another similar tileset already exists. if (!string.IsNullOrEmpty(this.otherTilesetName)) { EditorGUILayout.HelpBox(string.Format( /* 0: name of the similar tileset */ TileLang.Text("Another similar tileset '{0}' exists that uses the same atlas texture."), this.otherTilesetName ), MessageType.Warning, true); } // Display warning message if texture is not power-of-two. if (this.tilesetTexture != null && (!Mathf.IsPowerOfTwo(this.tilesetTexture.width) || !Mathf.IsPowerOfTwo(this.tilesetTexture.height) || this.tilesetTexture.width != this.tilesetTexture.height)) { EditorGUILayout.HelpBox(TileLang.Text("Texture is not power of two and/or is not square."), MessageType.Warning, true); } ExtraEditorGUI.SeparatorLight(marginTop: 12, marginBottom: 5, thickness: 3); if (this.tilesetPreviewUtility == null) { this.tilesetPreviewUtility = new TilesetPreviewUtility(this.Context); } if (!this.tilesetPreviewUtility.DrawTilePreviews(this.tilesetTexture, this.tilesetMetrics)) { GUILayout.Label(TileLang.Text("No previews to display...")); } }
/// <summary> /// Draws the "Tileset Name" input field. /// </summary> /// <remarks> /// <para>User input is a shared property that is stored under the key /// <see cref="BrushCreatorSharedPropertyKeys.TilesetName"/>.</para> /// </remarks> protected void DrawTilesetNameField() { ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Tileset Name:")); GUI.SetNextControlName(this.Context.PrimaryAssetNameControlName); string tilesetName = this.Context.GetSharedProperty(BrushCreatorSharedPropertyKeys.TilesetName, ""); tilesetName = EditorGUILayout.TextField(tilesetName).Trim(); this.Context.SetSharedProperty(BrushCreatorSharedPropertyKeys.TilesetName, tilesetName); }
private void DrawMiscTab() { this.DrawPreferredLanguageField(); ExtraEditorGUI.Separator(marginBottom: 10); ControlContent.TrailingTipsVisible = EditorGUILayout.ToggleLeft(TileLang.Text("Show detailed tips when available."), ControlContent.TrailingTipsVisible); RtsPreferences.DisableCustomCursors.Value = EditorGUILayout.ToggleLeft(TileLang.Text("Disable custom cursors."), RtsPreferences.DisableCustomCursors); RtsPreferences.AlwaysCenterUtilityWindows.Value = EditorGUILayout.ToggleLeft(TileLang.Text("Always center utility windows."), RtsPreferences.AlwaysCenterUtilityWindows); }
/// <inheritdoc/> public override void OnToolOptionsGUI() { this.TemporarilyDisableVariationShifting = ToolUtility.RandomizeVariations; GUILayout.BeginHorizontal(); this.DrawStandardOptionsGUI(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); ExtraEditorGUI.SeparatorLight(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { Rect rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight + 1); var propActive = property.FindPropertyRelative("isActive"); ExtraEditorGUI.ToggleLeft(rect, propActive, label); rect.y = rect.yMax + 1; if (propActive.boolValue) { ++EditorGUI.indentLevel; using (var content = ControlContent.Basic( TileLang.ParticularText("Property", "Snap Threshold") )) { var propSnapThreshold = property.FindPropertyRelative("snapThreshold"); EditorGUI.PropertyField(rect, propSnapThreshold, content); rect.y = rect.yMax + 1; } using (var content = ControlContent.Basic( TileLang.ParticularText("Property", "Keep Separate") )) { var propKeepSeparate = property.FindPropertyRelative("keepSeparate"); DrawKeepSeparateField(rect, propKeepSeparate, content); rect.y = rect.yMax + 1; } using (var content = ControlContent.Basic( TileLang.ParticularText("Property", "Include tiles flagged as solid") )) { var propIncludeSolidTiles = property.FindPropertyRelative("includeSolidTiles"); ExtraEditorGUI.ToggleLeft(rect, propIncludeSolidTiles, content); rect.y = rect.yMax + 1; if (propIncludeSolidTiles.boolValue) { ++EditorGUI.indentLevel; using (var content2 = ControlContent.Basic( TileLang.ParticularText("Property", "Collider Type") )) { var propSolidTileColliderType = property.FindPropertyRelative("solidTileColliderType"); EditorGUI.PropertyField(rect, propSolidTileColliderType, content2); } --EditorGUI.indentLevel; } } --EditorGUI.indentLevel; } }
/// <inheritdoc/> protected override void DoGUI() { Event e = Event.current; Rect position; GUILayout.Space(10); // Draw header area. using (var titleContent = ControlContent.Basic(ProductInfo.Name)) { position = GUILayoutUtility.GetRect(1, 100); if (e.type == EventType.Repaint) { Rect headerBackgroundPosition = new Rect(position.x - 2, position.y - 12, position.width + 4, position.height); if (EditorGUIUtility.isProSkin) { GUI.DrawTexture(headerBackgroundPosition, EditorGUIUtility.whiteTexture); } else { RotorzEditorStyles.Instance.TransparentBox.Draw(headerBackgroundPosition, GUIContent.none, false, false, false, false); } Texture2D texAssetBadge = RotorzEditorStyles.Skin.Badge; GUI.DrawTexture(new Rect(position.x + position.width - texAssetBadge.width - 6, position.y - 3, texAssetBadge.width, texAssetBadge.height), texAssetBadge); } position.x += 10; position.width -= 10; GUI.Label(position, titleContent, this.labelTitleStyle); Rect versionLabelPosition = new Rect(position.x, position.y + this.labelTitleStyle.CalcHeight(titleContent, position.width), position.width, 42); GUI.Label(versionLabelPosition, this.versionString, this.labelVersionStyle); GUILayout.BeginHorizontal(); this.AddLink(TileLang.ParticularText("Online", "Repository"), "https://github.com/rotorz/unity3d-tile-system", "https://github.com/rotorz/unity3d-tile-system"); GUILayout.EndHorizontal(); } ExtraEditorGUI.SeparatorLight(marginTop: 17, marginBottom: 7); // Draw footer area. var vendorBadge = RotorzEditorStyles.Skin.VendorBadge; position = GUILayoutUtility.GetRect(1, vendorBadge.height + 5); if (e.type == EventType.Repaint) { GUI.DrawTexture(new Rect(position.x + 7, position.y - 2, vendorBadge.width, vendorBadge.height), vendorBadge); position.y -= 4; this.labelLowerRightStyle.Draw(position, "©2011-2017 Rotorz Limited. All rights reserved.", false, false, false, false); } }
private void DrawTileSystemNameField() { ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Tile System Name")); GUI.SetNextControlName("NameField"); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(this.propertySystemName, GUIContent.none); if (EditorGUI.EndChangeCheck()) { this.HasModifiedTileSystemName = true; } }
/// <summary> /// Draws the "Brush Name" input field. /// </summary> /// <remarks> /// <para>User input is a shared property that is stored under the key /// <see cref="BrushCreatorSharedPropertyKeys.BrushName"/>.</para> /// </remarks> protected void DrawBrushNameField() { ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Name:")); GUI.SetNextControlName(this.Context.PrimaryAssetNameControlName); string brushName = this.Context.GetSharedProperty(BrushCreatorSharedPropertyKeys.BrushName, ""); brushName = EditorGUILayout.TextField(brushName).Trim(); this.Context.SetSharedProperty(BrushCreatorSharedPropertyKeys.BrushName, brushName); RotorzEditorGUI.MiniFieldDescription(TileLang.Text("Must start with alphanumeric character (A-Z a-z 0-9) and can contain hyphens (-), underscores (_) and spaces.")); }
private void DrawEdgeCorrectionGUI() { EditorGUIUtility.labelWidth = 1; EditorGUIUtility.fieldWidth = 125; GUILayout.BeginVertical(); ExtraEditorGUI.AbovePrefixLabel(TileLang.Text("Edge Correction")); this.inputEdgeCorrectionPreset = (EdgeCorrectionPreset)EditorGUILayout.EnumPopup(this.inputEdgeCorrectionPreset); if (this.inputEdgeCorrectionPreset == EdgeCorrectionPreset.Custom) { ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Border Size (px)")); this.inputBorderSize = EditorGUILayout.IntField(this.inputBorderSize, GUILayout.Width(60)); ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Delta (% of 1px)")); GUILayout.BeginHorizontal(); { this.inputDelta = Mathf.Clamp(EditorGUILayout.FloatField(this.inputDelta, GUILayout.Width(60)), 0f, 1f); float newDelta = GUILayout.HorizontalSlider(this.inputDelta, 0f, +1f, GUILayout.Width(80)); if (newDelta != this.inputDelta) { this.inputDelta = (float)((int)(newDelta * 100f)) / 100f; } } GUILayout.EndHorizontal(); } else { this.inputBorderSize = 0; this.inputDelta = (this.inputEdgeCorrectionPreset == EdgeCorrectionPreset.InsetUVs) ? 0.5f : 0f; EditorGUI.BeginDisabledGroup(true); ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Border Size (px)")); EditorGUILayout.IntField(this.inputBorderSize, GUILayout.Width(60)); ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Delta (% of 1px)")); GUILayout.BeginHorizontal(); { EditorGUILayout.FloatField(this.inputDelta, GUILayout.Width(60)); GUILayout.HorizontalSlider(this.inputDelta, 0f, +1f, GUILayout.Width(80)); } GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); } GUILayout.EndVertical(); }
/// <summary> /// Draws button for adding new input. /// </summary> /// <param name="position">Absolute position of button in GUI.</param> protected virtual void DrawAddNewInputButton(Rect position) { EditorGUI.BeginDisabledGroup(!this.CanAddNewInput); var addButtonNormal = ReorderableListStyles.Skin.Icon_Add_Normal; var addButtonActive = ReorderableListStyles.Skin.Icon_Add_Active; if (ExtraEditorGUI.IconButton(position, addButtonNormal, addButtonActive, AddButtonStyle)) { this.OnAddNewInputButtonClick(); } EditorGUI.EndDisabledGroup(); }
private void DrawAtlasParametersGUI() { EditorGUIUtility.labelWidth = 1; EditorGUIUtility.fieldWidth = 105; GUILayout.BeginVertical(); EditorGUI.BeginChangeCheck(); { ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Tile Width (px)")); this.inputTileWidth = EditorGUILayout.IntField(this.inputTileWidth, GUILayout.Width(60)); ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Tile Height (px)")); this.inputTileHeight = EditorGUILayout.IntField(this.inputTileHeight, GUILayout.Width(60)); } if (EditorGUI.EndChangeCheck()) { this.ClearExpandedAutotileAtlas(); // Automatically load uncompressed version of autotile artwork if it has // not already been loaded. if (this.inputNewAutotileArtworkUncompressed == null) { this.LoadUncompressedAutotileArtwork(this.inputNewAutotileArtwork); } } GUILayout.Space(10); //this.alpha = GUILayout.Toggle(this.alpha, "Alpha Blending"); using (var content = ControlContent.Basic( TileLang.ParticularText("Property", "Procedural"), TileLang.Text("Autotile brushes are always procedural, however atlas brushes of an autotile atlas can be non-procedural if desired.") )) { this.inputProcedural = GUILayout.Toggle(this.inputProcedural, content); } using (var content = ControlContent.Basic( TileLang.ParticularText("Property", "Clamp Edges"), TileLang.Text("Indicates if outer edges should always be clamped. Often not appropriate when secondary tile acts as ground.") )) { if (this.autotileTileset.AutotileLayout == AutotileLayout.Extended && this.inputBorderSize > 0) { this.inputClampEdges = GUILayout.Toggle(this.inputClampEdges, content); } } GUILayout.EndVertical(); }
private void OnGUI_Title() { GUILayout.BeginVertical(); { RotorzEditorGUI.Title(TileLang.ParticularText("Action", "Delete Tileset")); GUILayout.Space(5); GUILayout.Label(this.headingText, RotorzEditorStyles.Instance.BoldLabel); GUILayout.Space(7); GUILayout.Label(TileLang.Text("Caution, proceeding will delete tileset which will cause damage to any scenes or assets that require it.\n\nAll contained brushes will also be deleted."), EditorStyles.wordWrappedLabel); GUILayout.Space(5); } GUILayout.EndVertical(); ExtraEditorGUI.SeparatorLight(thickness: 3); }
/// <inheritdoc/> public override void OnGUI() { GUILayout.Space(10f); this.DrawBrushNameField(); GUILayout.Space(10f); ExtraEditorGUI.AbovePrefixLabel(TileLang.Text("Select target brush to create duplicate from:")); var targetBrush = this.Context.GetSharedProperty <Brush>(BrushCreatorSharedPropertyKeys.TargetBrush); targetBrush = RotorzEditorGUI.BrushField(targetBrush); this.Context.SetSharedProperty(BrushCreatorSharedPropertyKeys.TargetBrush, targetBrush); }
private void OnGUI() { GUILayout.Space(10); switch (Event.current.type) { case EventType.KeyDown: this.OnKeyDownEvent(Event.current.keyCode); break; case EventType.Repaint: if (this.ShownAsDropDown) { RotorzEditorStyles.Instance.WindowGreyBorder.Draw(new Rect(0, 0, position.width, position.height), GUIContent.none, false, false, false, false); ExtraEditorGUI.SeparatorLight(new Rect(1, 21, position.width - 2, 1)); } break; } if (this.ShownAsDropDown) { GUILayout.Space(-7); GUILayout.Label(this.titleContent, EditorStyles.boldLabel); GUILayout.Space(5); } GUILayout.BeginHorizontal(); GUILayout.Space(5); this.DrawOrientationButtons(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); { GUILayout.Space(2); this.DrawDialogButtons(); GUILayout.Space(5); } GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.EndHorizontal(); RotorzEditorGUI.DrawHoverTip(this); }
/// <inheritdoc/> public override void OnGUI() { GUILayout.Space(-5f); this.DrawLayoutSelectionGUI(); GUILayout.Space(3f); this.DrawTilesetNameField(); this.DrawInnerJoinsField(); ExtraEditorGUI.SeparatorLight(marginBottom: 7); this.DrawAtlasDetailsGUI(); if (this.autotileTextureUncompressed == null) { ExtraEditorGUI.SeparatorLight(marginTop: 12, marginBottom: 5, thickness: 3); GUILayout.Label(TileLang.Text("No previews to display...")); return; } Rect r = EditorGUILayout.BeginHorizontal(); { GUILayout.Space(241f); if (GUILayout.Button(TileLang.ParticularText("Action", "Refresh Previews"), RotorzEditorStyles.ContractWidth)) { this.OnButtonRefreshAtlas(); GUIUtility.ExitGUI(); } } EditorGUILayout.EndHorizontal(); GUI.Label(new Rect(r.x, r.y + 4f, r.width, r.height), this.metricSummary, EditorStyles.miniLabel); ExtraEditorGUI.SeparatorLight(marginBottom: 5, thickness: 3); if (this.previews == null) { this.previews = new TilesetPreviewUtility(this.Context); } if (!this.previews.DrawTilePreviews(s_SelectedAutotileLayout, this.atlasTexture, s_InnerJoins, this.metrics)) { GUILayout.Label(TileLang.Text("No previews to display...")); } }
private void DrawAtlasTexture() { GUILayout.Space(10); RotorzEditorGUI.Title(TileLang.Text("Atlas Texture")); ExtraEditorGUI.SeparatorLight(marginBottom: 0); this.scrollingAtlasPreview = GUILayout.BeginScrollView(this.scrollingAtlasPreview); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Box(this.tileset.AtlasTexture); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndScrollView(); }
/// <inheritdoc/> public override void OnGUI() { GUILayout.Label(TileLang.Text("Create new brush that is based upon an existing brush to override properties and materials."), EditorStyles.wordWrappedLabel); GUILayout.Space(10f); this.DrawBrushNameField(); GUILayout.Space(10f); ExtraEditorGUI.AbovePrefixLabel(TileLang.Text("Select target brush to create an alias of:")); var targetBrush = this.Context.GetSharedProperty <Brush>(BrushCreatorSharedPropertyKeys.TargetBrush); targetBrush = RotorzEditorGUI.BrushField(targetBrush, false); this.Context.SetSharedProperty(BrushCreatorSharedPropertyKeys.TargetBrush, targetBrush); RotorzEditorGUI.MiniFieldDescription(TileLang.Text("Note: You cannot create an alias of another alias brush.")); }