예제 #1
0
 void showTilesetSelector()
 {
     string[] tilsetChoicesText = new string[linker.tilesets.Count];
     for (int index = 0; index < linker.tilesets.Count; index++)
     {
         tilsetChoicesText[index] = linker.tilesets[index].name;
     }
     GUI.changed          = false;
     selectedTilesetIndex = RickEditorGUI.Popup("Editing Tileset", selectedTilesetIndex, tilsetChoicesText);
     if (GUI.changed)
     {
         switchShownTile(selectedTilesetIndex);
     }
 }
예제 #2
0
        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();
        }