void switchAutoTile(int index) { AutotileData autotile = linker.autotiles[index]; currentAutotile = autotile; shower.setCurrentautoTile(autotile); }
void showSelectionButtons() { GUILayout.BeginHorizontal(); string[] autoTileChoices = new string[linker.autotiles.Count]; for (int index = 0; index < linker.autotiles.Count; index++) { autoTileChoices[index] = linker.autotiles[index].name; if (String.IsNullOrEmpty(autoTileChoices[index])) { autoTileChoices[index] = "* NO NAME * (" + index + ")"; } } GUI.changed = false; selectedAutoTileIndex = RickEditorGUI.Popup("Editing Tileset", selectedAutoTileIndex, autoTileChoices); if (GUI.changed) { switchAutoTile(selectedAutoTileIndex); } if (CustomEditorBase.Button(new GUIContent("Delete"))) { linker.autotiles.Remove(currentAutotile); selectedAutoTileIndex = selectedAutoTileIndex - 1; if (selectedAutoTileIndex >= 0) { switchAutoTile(selectedAutoTileIndex); } else { currentAutotile = null; } } if (CustomEditorBase.Button(new GUIContent("New Autotile"))) { currentAutotile = new AutotileData(); linker.autotiles.Add(currentAutotile); selectedAutoTileIndex = linker.autotiles.Count - 1; switchAutoTile(selectedAutoTileIndex); } GUILayout.EndHorizontal(); }
public void setCurrentautoTile(AutotileData currentAutotile) { this.currentAutotile = currentAutotile; loadTextures(); }
void switchAutoTile(int index) { AutotileData autotile = linker.autotiles[index]; currentAutotile = autotile; currentAutotileIndex = index; shower.setCurrentautoTile(autotile); }
void showSelectionButtons() { GUILayout.BeginHorizontal(); string[] autoTileChoices = new string[linker.autotiles.Count]; for (int index = 0; index < linker.autotiles.Count; index++) { autoTileChoices[index] = linker.autotiles[index].name; if( String.IsNullOrEmpty(autoTileChoices[index]) ) autoTileChoices[index] = "* NO NAME * (" + index +")"; } GUI.changed = false; selectedAutoTileIndex = RickEditorGUI.Popup("Editing Tileset", selectedAutoTileIndex,autoTileChoices); if(GUI.changed){ switchAutoTile(selectedAutoTileIndex); } if(CustomEditorBase.Button(new GUIContent("Delete"))){ linker.autotiles.Remove(currentAutotile); selectedAutoTileIndex = selectedAutoTileIndex - 1; if(selectedAutoTileIndex >= 0){ switchAutoTile(selectedAutoTileIndex); }else{ currentAutotile = null; } } if(CustomEditorBase.Button(new GUIContent("New Autotile"))){ currentAutotile = new AutotileData(); linker.autotiles.Add(currentAutotile); selectedAutoTileIndex = linker.autotiles.Count - 1; switchAutoTile(selectedAutoTileIndex); } GUILayout.EndHorizontal(); }