/// <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...")); } }
/// <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...")); } }