Exemple #1
0
        public override void RefreshDataFromGame()
        {
            if (_agsEditor.CurrentGame.AudioClipTypes.Count == 0)
            {
                CreateDefaultAudioClipTypes();
            }

            IList <AudioClip> allAudio = null;

            if ((!_agsEditor.CurrentGame.SavedXmlVersionIndex.HasValue) ||
                (_agsEditor.CurrentGame.SavedXmlVersionIndex < 5))
            {
                ImportSoundAndMusicFromOldVersion();
                allAudio = _agsEditor.CurrentGame.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders();

                UpdateScoreSound(allAudio);
                UpdateViewFrameSounds(allAudio, _agsEditor.CurrentGame.RootViewFolder);
            }

            if (allAudio == null)
            {
                allAudio = _agsEditor.CurrentGame.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders();
            }
            AudioClipTypeTypeConverter.SetAudioClipTypeList(_agsEditor.CurrentGame.AudioClipTypes);
            AudioClipTypeConverter.SetAudioClipList(allAudio);

            RePopulateTreeView();
        }
Exemple #2
0
        private void ImportAudioFiles(string[] selectedFiles)
        {
            string lastAddedId = null;

            foreach (string fileName in selectedFiles)
            {
                AudioClip newClip = CreateAudioClipForFile(fileName);
                if (newClip != null)
                {
                    AudioClipFolder parentFolder = _folders[_rightClickedID];
                    newClip.BundlingType = parentFolder.DefaultBundlingType;
                    newClip.Type         = parentFolder.DefaultType;
                    parentFolder.Items.Add(newClip);
                    lastAddedId = newClip.ScriptName;
                }
                else
                {
                    _guiController.ShowMessage("The file '" + fileName + "' could not be imported. The file type was not recognised.", MessageBoxIconType.Warning);
                }
            }

            if (lastAddedId != null)
            {
                RePopulateTreeView(ITEM_COMMAND_PREFIX + lastAddedId);
                AudioClipTypeConverter.SetAudioClipList(_agsEditor.CurrentGame.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders());
            }
        }
Exemple #3
0
        private void DeleteAudioClip(AudioClip clip)
        {
            int removingID = clip.ID;

            foreach (AudioClip item in _agsEditor.CurrentGame.RootAudioClipFolder.AllItemsFlat)
            {
                if (item.ID > removingID)
                {
                    item.ID--;
                }
            }

            DeleteResourcesForAudioClip(clip);
            AudioClipTypeConverter.SetAudioClipList(_agsEditor.CurrentGame.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders());
        }
Exemple #4
0
 protected override void DeleteResourcesUsedByItem(AudioClip item)
 {
     DeleteResourcesForAudioClip(item);
     AudioClipTypeConverter.SetAudioClipList(_agsEditor.CurrentGame.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders());
 }
Exemple #5
0
        protected override void ItemCommandClick(string controlID)
        {
            if (controlID == COMMAND_ADD_AUDIO)
            {
                string[] selectedFiles = _guiController.ShowOpenFileDialogMultipleFiles("Select audio to add", AUDIO_FILES_FILTER);
                if (selectedFiles.Length > 0)
                {
                    ImportAudioFiles(selectedFiles);
                }
            }
            else if (controlID == COMMAND_RENAME)
            {
                _guiController.ProjectTree.BeginLabelEdit(this, _rightClickedID);
            }
            else if (controlID == COMMAND_DELETE)
            {
                AudioClip clipToDelete = _items[_rightClickedID];
                if (_guiController.ShowQuestion("Are you sure you want to delete audio '" + clipToDelete.ScriptName + "'?") == System.Windows.Forms.DialogResult.Yes)
                {
                    AudioClipFolder parentFolder = this.FindFolderThatContainsItem(this.GetRootFolder(), clipToDelete);
                    parentFolder.Items.Remove(clipToDelete);
                    DeleteResourcesForAudioClip(clipToDelete);

                    AudioClipTypeConverter.SetAudioClipList(_agsEditor.CurrentGame.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders());
                    RePopulateTreeView(GetNodeIDForFolder(parentFolder));
                    _guiController.ProjectTree.ExpandNode(this, GetNodeIDForFolder(parentFolder));
                }
            }
            else if (controlID == SPEECH_NODE_ID)
            {
                _guiController.ShowMessage("You create voice speech files by placing them in the Speech sub-folder in explorer, and they must have special names corresponding to the line of text that they represent.\n\nPlease look up 'Voice Speech' in the help file for details.", MessageBoxIconType.Information);
            }
            else if (controlID == COMMAND_PROPERTIES)
            {
                ShowPaneForItem(_rightClickedID);
            }
            else if (controlID == COMMAND_NEW_CLIP_TYPE)
            {
                CreateNewAudioClipType();
            }
            else if (controlID == COMMAND_RENAME_CLIP_TYPE)
            {
                _guiController.ProjectTree.BeginLabelEdit(this, _rightClickedID);
            }
            else if (controlID == COMMAND_DELETE_CLIP_TYPE)
            {
                AudioClipType typeToDelete = FindAudioClipTypeByNodeID(_rightClickedID, true);
                DeleteAudioClipType(typeToDelete);
            }
            else if (controlID.StartsWith(NODE_ID_PREFIX_CLIP_TYPE))
            {
                ShowPaneForItem(controlID);
            }
            else if (controlID == COMMAND_PROPERTIES_CLIP_TYPE)
            {
                ShowPaneForItem(_rightClickedID);
            }
            else if (controlID != AUDIO_TYPES_FOLDER_NODE_ID)
            {
                ShowPaneForItem(controlID);
            }
        }