Example #1
0
 public override void PropertyChanged(string propertyName, object oldValue)
 {
     if (propertyName == "ScriptName")
     {
         AudioClip itemBeingEdited = (AudioClip)_editor.SelectedItem;
         if (_agsEditor.CurrentGame.IsScriptNameAlreadyUsed(itemBeingEdited.ScriptName, itemBeingEdited))
         {
             _guiController.ShowMessage("This script name is already used by another item.", MessageBoxIconType.Warning);
             itemBeingEdited.ScriptName = (string)oldValue;
         }
         else
         {
             RePopulateTreeView(GetNodeIDForAudioClip(itemBeingEdited));
             AudioClipTypeConverter.RefreshAudioClipList();
         }
     }
     else if (propertyName == "Name")
     {
         RePopulateTreeView();
         if (_editor.SelectedItem is AudioClipFolder)
         {
             _guiController.ProjectTree.SelectNode(this, GetNodeIDForFolder((AudioClipFolder)_editor.SelectedItem));
         }
         else
         {
             _guiController.ProjectTree.SelectNode(this, AUDIO_TYPES_FOLDER_NODE_ID);
         }
     }
 }
Example #2
0
        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();
            }
        }