コード例 #1
0
        void OnGUI()
        {
            prefabFilePath = RickEditorGUI.FilePath("Prefab to rotate", prefabFilePath, RickEditorGUI.resourcesFolder, "prefab");
            if (CustomEditorBase.Button(new GUIContent("Make rotated prefab")))
            {
                string     filePath       = "Assets/Resources" + prefabFilePath;
                GameObject prefabToRotate = (GameObject)AssetDatabase.LoadAssetAtPath(filePath + ".prefab", typeof(GameObject));

                int    dotIndex   = filePath.LastIndexOf('/');
                string fileFolder = filePath.Substring(0, dotIndex);

                nameRotation(prefabToRotate, fileFolder, "90", new Vector3(0, 0, 90));
                nameRotation(prefabToRotate, fileFolder, "180", new Vector3(0, 0, 180));
                nameRotation(prefabToRotate, fileFolder, "-90", new Vector3(0, 0, -90));
            }
        }
コード例 #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();
        }