Exemplo n.º 1
0
        private void OnExtractFileArchivePath(string path)
        {
            // Get the appropriate archive type
            string      extension = Path.GetExtension(path);
            ArchiveFile archive;

            switch (extension.ToLower())
            {
            case ".vol":    archive = new VolFile(path);    break;

            case ".clm":    archive = new ClmFile(path);    break;

            default:
                interactable = true;
                Debug.Log("Invalid archive selected.");
                return;
            }

            // Get list of files from the archive
            List <string> fileNames = new List <string>();

            for (int i = 0; i < archive.GetCount(); ++i)
            {
                fileNames.Add(archive.GetName(i));
            }

            // Open list of file names for selection
            ListSelectDialog.Create(fileNames, "Extract File", "Select", (string fileName) => OnExtractFileSelected(archive, fileName), () => OnExtractFileCanceled(archive));
        }
Exemplo n.º 2
0
        private void OnImportMapPath(string path)
        {
            string extension = Path.GetExtension(path);

            switch (extension.ToLower())
            {
            case ".vol":
                List <string> fileNames = new List <string>();

                // Get list of map names from the archive
                VolFile vol = new VolFile(path);
                for (int i = 0; i < vol.GetCount(); ++i)
                {
                    string name = vol.GetName(i);
                    if (Path.GetExtension(name).ToLower() == ".map")
                    {
                        fileNames.Add(name);
                    }
                }

                // Open list of map names for selection
                ListSelectDialog.Create(fileNames, "Select Map", "Import", (string mapName) => OnImportMapSelected(vol, mapName), () =>
                {
                    interactable = true;
                    vol.Dispose();
                });

                break;

            default:
                CreateNew_NoRefresh();

                interactable = true;

                if (UserData.current.ImportMap(path))
                {
                    interactable = false;

                    m_MapRenderer.Refresh(() =>
                    {
                        interactable = true;
                        Debug.Log("Import Complete.");
                    });
                }
                else
                {
                    // Import failed
                    interactable = false;

                    m_MapRenderer.Refresh(() =>
                    {
                        interactable = true;
                        Debug.LogError("Failed to read map: " + path);
                    });
                }
                break;
            }
        }
Exemplo n.º 3
0
 public void OnClick_DeleteFile()
 {
     ListSelectDialog.Create(missionData.fileNames, "Delete File", "Delete", OnSelected_DeleteFileName);
 }