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(); }
private void CreateNewAudioClipType() { _guiController.ProjectTree.StartFromNode(this, AUDIO_TYPES_FOLDER_NODE_ID); AudioClipType newClipType = new AudioClipType(_agsEditor.CurrentGame.AudioClipTypes.Count + 1, "New audio type", 0, 0, false, CrossfadeSpeed.No); _agsEditor.CurrentGame.AudioClipTypes.Add(newClipType); string newNodeID = AddTreeNodeForAudioClipType(newClipType); _guiController.ProjectTree.BeginLabelEdit(this, newNodeID); AudioClipTypeTypeConverter.RefreshAudioClipTypeList(); }
private void DeleteAudioClipType(AudioClipType typeToDelete) { if (_agsEditor.CurrentGame.AudioClipTypes.Count <= 1) { _guiController.ShowMessage("You cannot delete this audio type, as the game must contain at least one.", MessageBoxIconType.Warning); return; } if (typeToDelete.BackwardsCompatibilityType) { if (_guiController.ShowQuestion("This audio type is required for backwards compatibility with old-style audio scripting. If you delete it, commands like PlayMusic and PlayAmbientSound will no longer work correctly. Are you sure you want to continue?", System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No) { return; } } int typeUsedByClipCount = 0; foreach (AudioClip clip in _agsEditor.CurrentGame.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders()) { if (clip.Type == typeToDelete.TypeID) { typeUsedByClipCount++; } } if (typeUsedByClipCount > 0) { _guiController.ShowMessage("This audio type is in use by " + typeUsedByClipCount + " audio clips and cannot be deleted", MessageBoxIconType.Warning); return; } if (_guiController.ShowQuestion("Are you sure you want to delete audio type '" + typeToDelete.Name + "'?") == System.Windows.Forms.DialogResult.Yes) { _agsEditor.CurrentGame.AudioClipTypes.Remove(typeToDelete); AdjustAudioTypeIDsAfterDeletingOne(typeToDelete); RePopulateTreeView(AUDIO_TYPES_FOLDER_NODE_ID); AudioClipTypeTypeConverter.RefreshAudioClipTypeList(); } }
private void ProjectTree_OnAfterLabelEdit(string commandID, ProjectTreeItem treeItem) { if (commandID.StartsWith(NODE_ID_PREFIX_CLIP_TYPE)) { // this must be first because the AudioClipType prefix // is also the AudioClip prefix if we don't check this! AudioClipTypeTypeConverter.RefreshAudioClipTypeList(); } else if ((commandID.StartsWith(ITEM_COMMAND_PREFIX)) && (!commandID.StartsWith(NODE_ID_PREFIX_FOLDER))) { AudioClip itemBeingEdited = (AudioClip)treeItem.LabelTextDataSource; if (_agsEditor.CurrentGame.IsScriptNameAlreadyUsed(itemBeingEdited.ScriptName, itemBeingEdited)) { _guiController.ShowMessage("This script name is already used by another item.", MessageBoxIconType.Warning); itemBeingEdited.ScriptName = treeItem.LabelTextBeforeLabelEdit; treeItem.TreeNode.Text = itemBeingEdited.ScriptName; } AudioClipTypeConverter.RefreshAudioClipList(); } }