Beispiel #1
0
        private static void RenderAdvancedView(MVCEditor editor)
        {
            EditorGUILayout.HelpBox(
                "Advanced view settings should NOT be touched in general cases.\nUnless you have full understanding" +
                "of this framework's process, it's highly recommended to just leave the settings as-is.",
                MessageType.Warning
                );

            RenderSpace();

            EditorGUILayout.LabelField(
                "Current workspace directory: " + NyanPath.EditorRelativePath(MvcWorkspace.WorkspacePath)
                );
            EditorGUILayout.HelpBox(
                "If you change the workspace directory, you must move/delete script files already created in " +
                "the previous directory.",
                MessageType.Warning
                );
            if (GUILayout.Button("Change workspace directory"))
            {
                MVCEditor.SelectWorkspaceDirectory();
            }

            RenderSpace();

            EditorGUILayout.LabelField("Default base class of MVC views.");
            Config.SetBaseClassName(EditorGUILayout.TextField(
                                        "BaseClassName",
                                        Config.BaseClassName
                                        ));
        }
Beispiel #2
0
 /// <summary>
 /// Returns whether RenkoLibrary is placed in the project window correctly.
 /// </summary>
 public static bool CheckRootPath()
 {
     if (!Directory.Exists(NyanPath.GetLibraryPath()))
     {
         Log("You should place RenkoLibrary in project root directory as 'Renko-L'!");
         return(false);
     }
     return(true);
 }
Beispiel #3
0
        /// <summary>
        /// Returns whether there is a valid workspace setup.
        /// </summary>
        public static bool HasValidWorkspace()
        {
            string workspace = WorkspacePath;

            if (string.IsNullOrEmpty(workspace) || !NyanPath.IsProjectPath(workspace))
            {
                return(false);
            }

            return(Directory.Exists(WorkspacePath));
        }
Beispiel #4
0
        /// <summary>
        /// Initializes all general modules.
        /// Modules that need manual initialization: IAPManager
        /// It's recommended to manually initialize the modules you only need.
        /// </summary>
        public static void Initialize(bool includePluginModules)
        {
            NyanPath.CreateRenkoDirectories();

            Netko.Initialize();
            RenQL.Initialize();
            UnityThread.Initialize();
            Easing.Initialize();

            if (includePluginModules)
            {
                GalleryPicker.Initialize();
                NativeCamera.Initialize();
                PluginTools.Initialize();
            }
        }
Beispiel #5
0
        /// <summary>
        /// Opens a folder selector window and returns the selected file's path.
        /// If cancelled, null is returned.
        /// </summary>
        public static string OpenDirectory(bool saveLastPath = false, bool getRelativePath = false)
        {
            string result = EditorUtility.OpenFolderPanel("Select a folder", LastFolderPath, null);

            if (string.IsNullOrEmpty(result))
            {
                return(null);
            }

            if (saveLastPath)
            {
                LastFolderPath = result;
            }

            if (getRelativePath)
            {
                return(NyanPath.EditorRelativePath(result));
            }
            return(result);
        }
Beispiel #6
0
        /// <summary>
        /// Opens a file selector window and returns the selected file's path.
        /// If cancelled, null is returned.
        /// </summary>
        public static string OpenFile(string extensions = "", bool saveLastPath = false, bool getRelativePath = false)
        {
            string result = EditorUtility.OpenFilePanel("Select a file", LastFilePath, extensions);

            if (string.IsNullOrEmpty(result))
            {
                return(null);
            }

            if (saveLastPath)
            {
                LastFilePath = result;
            }

            if (getRelativePath)
            {
                return(NyanPath.EditorRelativePath(result));
            }
            return(result);
        }
Beispiel #7
0
        /// <summary>
        /// Use this method to show a dialog for setting new workspace directory.
        /// </summary>
        public static void SelectWorkspaceDirectory()
        {
            // Get valid folder path
            string folderPath = EditorDialog.OpenDirectory();

            if (string.IsNullOrEmpty(folderPath))
            {
                return;
            }
            if (!NyanPath.IsStandardProjectPath(folderPath))
            {
                EditorDialog.OpenAlert(
                    "Error",
                    "Workspace must be placed inside the project, but outside of StreamingAssets, Resources, " +
                    "Plugins, and Editor folder."
                    );
                return;
            }

            // Setup workspace
            MvcWorkspace.SetWorkspace(folderPath);
        }
Beispiel #8
0
 /// <summary>
 /// Template file path for specified type.
 /// Types are as follows:
 /// Base,
 /// View,
 /// Model,
 /// Controller
 /// </summary>
 private static string TemplateFilePath(string type)
 {
     return(NyanPath.GetLibraryPath("Framework/MVC/Templates/" + type + "Autogen.txt"));
 }