public void OpenForgelightGameFolder()
        {
            string path = EditorUtility.OpenFolderPanel("Select Forgelight Game Folder", "", "");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            if (path.EndsWith("Resources"))
            {
                path += "/Assets";
            }
            else if (!path.EndsWith("/Resources/Assets"))
            {
                path += "/Resources/Assets";
            }

            if (!IsAssetDirectory(path))
            {
                bool dialog = DialogUtils.DisplayCancelableDialog("Invalid Asset Directory", "The directory provided is not a valid Forgelight game. Please make sure to select the root game directory (not the asset folder) and try again.");
                if (dialog)
                {
                    OpenForgelightGameFolder();
                }

                return;
            }

            LoadNewForgelightGame(path);
        }
 public static void DeleteZoneObjects()
 {
     if (DialogUtils.DisplayCancelableDialog("Destroy Zone", "This will destroy all objects and terrain in the current scene, and you will lose any unsaved changes. This cannot be undone. Are you sure you wish to continue?"))
     {
         ForgelightExtension.Instance.ZoneManager.DestroyActiveZone();
     }
 }
Пример #3
0
 private void OnZoneSelected(ForgelightGame forgelightGame, Zone zone)
 {
     if (DialogUtils.DisplayCancelableDialog("Changing Zone", "You have selected a new zone. Changing zones will DESTROY all objects and terrain in the current scene, and you will lose any unsaved changes. Are you sure you wish to continue?"))
     {
         ForgelightExtension.Instance.ZoneManager.ChangeZone(forgelightGame, zone);
     }
 }
 private void OnAreasSelected(Areas areas)
 {
     if (DialogUtils.DisplayCancelableDialog("Changing Area Definitions", "You have selected a new area definitions file. This will replace any areas currently loaded. Are you sure you wish to continue?"))
     {
         ForgelightExtension.Instance.ZoneManager.AreaObjectFactory.DestroyAreas();
         ForgelightExtension.Instance.ZoneManager.AreaObjectFactory.LoadAreaDefinitions(areas, 0.0f, 1.0f);
     }
 }
Пример #5
0
        private void OnGameSelected(string gameName)
        {
            if (!DialogUtils.DisplayCancelableDialog("Change Forgelight Game", "You have selected a new Forgelight game. Changing games will DESTROY all objects and terrain in the current scene, and you will lose any unsaved changes. Are you sure you wish to continue?"))
            {
                return;
            }

            ForgelightExtension.Instance.ZoneManager.DestroyActiveZone();
            ForgelightExtension.Instance.ForgelightGameFactory.ChangeActiveForgelightGame(gameName);
        }
        public static void CreatePackFromDirectory()
        {
            string sourceFolder = EditorUtility.OpenFolderPanel("Select folder that contains the assets you wish to pack", "", "");

            if (sourceFolder == null)
            {
                return;
            }

            if (DialogUtils.DirectoryIsEmpty(sourceFolder))
            {
                bool dialog = DialogUtils.DisplayCancelableDialog("Invalid Directory", "Please select a directory that contains files.");
                if (dialog)
                {
                    CreatePackFromDirectory();
                }

                return;
            }

            string[] files = Directory.GetFiles(sourceFolder);

            var destinationFile = EditorUtility.SaveFilePanel(
                "Select destination to save created pack file",
                sourceFolder,
                "Assets_256",
                "pack");

            if (destinationFile == null)
            {
                return;
            }

            CreatePackFromFiles(files, destinationFile);
            DialogUtils.DisplayDialog("Export Successful", "Successfully packed and saved " + files.Length + " assets to " + destinationFile);
        }