상속: TreeViewItem
 private void SetChildParentOfMixerItem(AudioMixerItem item, List<AudioMixerItem> items)
 {
   if ((UnityEngine.Object) item.mixer.outputAudioMixerGroup != (UnityEngine.Object) null)
   {
     AudioMixerItem itemInList = TreeViewUtility.FindItemInList<AudioMixerItem>(item.mixer.outputAudioMixerGroup.audioMixer.GetInstanceID(), items) as AudioMixerItem;
     if (itemInList == null)
       return;
     itemInList.AddChild((TreeViewItem) item);
   }
   else
     this.m_RootItem.AddChild((TreeViewItem) item);
 }
		private void SetChildParentOfMixerItem(AudioMixerItem item, List<AudioMixerItem> items)
		{
			if (item.mixer.outputAudioMixerGroup != null)
			{
				AudioMixer audioMixer = item.mixer.outputAudioMixerGroup.audioMixer;
				AudioMixerItem audioMixerItem = TreeViewUtility.FindItemInList<AudioMixerItem>(audioMixer.GetInstanceID(), items) as AudioMixerItem;
				if (audioMixerItem != null)
				{
					audioMixerItem.AddChild(item);
				}
			}
			else
			{
				this.m_RootItem.AddChild(item);
			}
		}
 void SetChildParentOfMixerItem(AudioMixerItem item, List <AudioMixerItem> items)
 {
     if (item.mixer.outputAudioMixerGroup != null)
     {
         var parentMixer = item.mixer.outputAudioMixerGroup.audioMixer;
         var parentItem  = TreeViewUtility.FindItemInList(parentMixer.GetInstanceID(), items) as AudioMixerItem;
         if (parentItem != null)
         {
             parentItem.AddChild(item);
         }
     }
     else
     {
         m_RootItem.AddChild(item);
     }
 }
 protected override void SyncFakeItem()
 {
     if (!this.m_TreeView.data.HasFakeItem() && this.GetCreateAssetUtility().IsCreatingNewAsset())
     {
         int            id           = this.m_TreeView.data.root.id;
         AudioMixerItem selectedItem = this.GetSelectedItem();
         if (selectedItem != null)
         {
             id = selectedItem.parent.id;
         }
         this.m_TreeView.data.InsertFakeItem(this.GetCreateAssetUtility().instanceID, id, this.GetCreateAssetUtility().originalName, this.GetCreateAssetUtility().icon);
     }
     if (this.m_TreeView.data.HasFakeItem() && !this.GetCreateAssetUtility().IsCreatingNewAsset())
     {
         this.m_TreeView.data.RemoveFakeItem();
     }
 }
예제 #5
0
        public override DragAndDropVisualMode DoDrag(TreeViewItem parentNode, TreeViewItem targetNode, bool perform, TreeViewDragging.DropPosition dragPos)
        {
            DragData genericData = DragAndDrop.GetGenericData("AudioMixerDragging") as DragData;

            if (genericData == null)
            {
                return(DragAndDropVisualMode.None);
            }
            List <AudioMixerItem> draggedItems = genericData.m_DraggedItems;
            AudioMixerItem        item         = parentNode as AudioMixerItem;

            if ((item == null) || (genericData == null))
            {
                return(DragAndDropVisualMode.None);
            }
            if (< > f__am$cache1 == null)
            {
        public void BeginCreateNewMixer()
        {
            this.ClearRenameAndNewNodeState();
            string         newAssetResourceFile = string.Empty;
            AudioMixerItem selectedItem         = this.GetSelectedItem();

            if (selectedItem != null && selectedItem.mixer.outputAudioMixerGroup != null)
            {
                newAssetResourceFile = selectedItem.mixer.outputAudioMixerGroup.GetInstanceID().ToString();
            }
            int num = 0;

            this.GetCreateAssetUtility().BeginNewAssetCreation(num, ScriptableObject.CreateInstance <DoCreateAudioMixer>(), "NewAudioMixer.mixer", null, newAssetResourceFile);
            this.SyncFakeItem();
            if (!base.GetRenameOverlay().BeginRename(this.GetCreateAssetUtility().originalName, num, 0f))
            {
                Debug.LogError("Rename not started (when creating new asset)");
            }
        }
        protected override void DrawIconAndLabel(Rect rect, TreeViewItem item, string label, bool selected, bool focused, bool useBoldFont, bool isPinging)
        {
            if (!isPinging)
            {
                float contentIndent = this.GetContentIndent(item);
                rect.x     += contentIndent;
                rect.width -= contentIndent;
            }
            AudioMixerItem audioMixerItem = item as AudioMixerItem;

            if (audioMixerItem == null)
            {
                return;
            }
            GUIStyle guiStyle = !useBoldFont ? TreeViewGUI.s_Styles.lineStyle : TreeViewGUI.s_Styles.lineBoldStyle;

            guiStyle.padding.left = (int)((double)this.k_IconWidth + (double)this.iconTotalPadding + (double)this.k_SpaceBetweenIconAndText);
            guiStyle.Draw(rect, label, false, false, selected, focused);
            audioMixerItem.UpdateSuspendedString(false);
            if ((double)audioMixerItem.labelWidth <= 0.0)
            {
                audioMixerItem.labelWidth = guiStyle.CalcSize(GUIContent.Temp(label)).x;
            }
            Rect position = rect;

            position.x += audioMixerItem.labelWidth + 8f;
            EditorGUI.BeginDisabledGroup(true);
            guiStyle.Draw(position, audioMixerItem.infoText, false, false, false, false);
            EditorGUI.EndDisabledGroup();
            if (this.iconOverlayGUI == null)
            {
                return;
            }
            Rect rect1 = rect;

            rect1.width = this.k_IconWidth + this.iconTotalPadding;
            this.iconOverlayGUI(item, rect1);
        }
        public void BeginCreateNewMixer()
        {
            this.ClearRenameAndNewNodeState();
            string         empty        = string.Empty;
            AudioMixerItem selectedItem = this.GetSelectedItem();

            if (selectedItem != null && (Object)selectedItem.mixer.outputAudioMixerGroup != (Object)null)
            {
                empty = selectedItem.mixer.outputAudioMixerGroup.GetInstanceID().ToString();
            }
            int num = 0;

            if (!this.GetCreateAssetUtility().BeginNewAssetCreation(num, (EndNameEditAction)ScriptableObject.CreateInstance <DoCreateAudioMixer>(), "NewAudioMixer.mixer", (Texture2D)null, empty))
            {
                return;
            }
            this.SyncFakeItem();
            if (this.GetRenameOverlay().BeginRename(this.GetCreateAssetUtility().originalName, num, 0.0f))
            {
                return;
            }
            Debug.LogError((object)"Rename not started (when creating new asset)");
        }
        protected override void DrawIconAndLabel(Rect rect, TreeViewItem item, string label, bool selected, bool focused, bool useBoldFont, bool isPinging)
        {
            if (!isPinging)
            {
                float contentIndent = this.GetContentIndent(item);
                rect.x     += contentIndent;
                rect.width -= contentIndent;
            }
            AudioMixerItem audioMixerItem = item as AudioMixerItem;

            if (audioMixerItem == null)
            {
                return;
            }
            GUIStyle gUIStyle = (!useBoldFont) ? TreeViewGUI.s_Styles.lineStyle : TreeViewGUI.s_Styles.lineBoldStyle;

            gUIStyle.padding.left = (int)(this.k_IconWidth + base.iconTotalPadding + this.k_SpaceBetweenIconAndText);
            gUIStyle.Draw(rect, label, false, false, selected, focused);
            audioMixerItem.UpdateSuspendedString(false);
            if (audioMixerItem.labelWidth <= 0f)
            {
                audioMixerItem.labelWidth = gUIStyle.CalcSize(GUIContent.Temp(label)).x;
            }
            Rect position = rect;

            position.x += audioMixerItem.labelWidth + 8f;
            using (new EditorGUI.DisabledScope(true))
            {
                gUIStyle.Draw(position, audioMixerItem.infoText, false, false, false, false);
            }
            if (base.iconOverlayGUI != null)
            {
                Rect arg = rect;
                arg.width = this.k_IconWidth + base.iconTotalPadding;
                base.iconOverlayGUI(item, arg);
            }
        }
 protected override void OnContentGUI(Rect rect, int row, TreeViewItem item, string label, bool selected, bool focused, bool useBoldFont, bool isPinging)
 {
     if (Event.current.type == EventType.Repaint)
     {
         if (!isPinging)
         {
             float contentIndent = this.GetContentIndent(item);
             rect.x     += contentIndent;
             rect.width -= contentIndent;
         }
         AudioMixerItem item2 = item as AudioMixerItem;
         if (item2 != null)
         {
             GUIStyle style = !useBoldFont ? TreeViewGUI.s_Styles.lineStyle : TreeViewGUI.s_Styles.lineBoldStyle;
             style.padding.left = (int)((base.k_IconWidth + base.iconTotalPadding) + base.k_SpaceBetweenIconAndText);
             style.Draw(rect, label, false, false, selected, focused);
             item2.UpdateSuspendedString(false);
             if (item2.labelWidth <= 0f)
             {
                 item2.labelWidth = style.CalcSize(GUIContent.Temp(label)).x;
             }
             Rect position = rect;
             position.x += item2.labelWidth + 8f;
             using (new EditorGUI.DisabledScope(true))
             {
                 style.Draw(position, item2.infoText, false, false, false, false);
             }
             if (base.iconOverlayGUI != null)
             {
                 Rect rect3 = rect;
                 rect3.width = base.k_IconWidth + base.iconTotalPadding;
                 base.iconOverlayGUI(item, rect3);
             }
         }
     }
 }
        public override DragAndDropVisualMode DoDrag(TreeViewItem parentNode, TreeViewItem targetNode, bool perform, TreeViewDragging.DropPosition dragPos)
        {
            AudioMixerTreeViewDragging.DragData dragData = DragAndDrop.GetGenericData("AudioMixerDragging") as AudioMixerTreeViewDragging.DragData;
            DragAndDropVisualMode result;

            if (dragData == null)
            {
                result = DragAndDropVisualMode.None;
            }
            else
            {
                List <AudioMixerItem> draggedItems   = dragData.m_DraggedItems;
                AudioMixerItem        audioMixerItem = parentNode as AudioMixerItem;
                if (audioMixerItem != null && dragData != null)
                {
                    List <AudioMixerGroupController> groupsToBeMoved = (from i in draggedItems
                                                                        select i.mixer.masterGroup).ToList <AudioMixerGroupController>();
                    List <AudioMixerGroupController> allAudioGroupsSlow = audioMixerItem.mixer.GetAllAudioGroupsSlow();
                    bool flag  = AudioMixerController.WillModificationOfTopologyCauseFeedback(allAudioGroupsSlow, groupsToBeMoved, audioMixerItem.mixer.masterGroup, null);
                    bool flag2 = this.ValidDrag(parentNode, draggedItems) && !flag;
                    if (perform && flag2)
                    {
                        if (this.m_MixersDroppedOnMixerCallback != null)
                        {
                            this.m_MixersDroppedOnMixerCallback(this.GetAudioMixersFromItems(draggedItems), audioMixerItem.mixer);
                        }
                    }
                    result = ((!flag2) ? DragAndDropVisualMode.Rejected : DragAndDropVisualMode.Move);
                }
                else
                {
                    result = DragAndDropVisualMode.None;
                }
            }
            return(result);
        }
        public override DragAndDropVisualMode DoDrag(TreeViewItem parentNode, TreeViewItem targetNode, bool perform, TreeViewDragging.DropPosition dragPos)
        {
            AudioMixerTreeViewDragging.DragData genericData = DragAndDrop.GetGenericData("AudioMixerDragging") as AudioMixerTreeViewDragging.DragData;
            if (genericData == null)
            {
                return(DragAndDropVisualMode.None);
            }
            List <AudioMixerItem> draggedItems   = genericData.m_DraggedItems;
            AudioMixerItem        audioMixerItem = parentNode as AudioMixerItem;

            if (audioMixerItem == null || genericData == null)
            {
                return(DragAndDropVisualMode.None);
            }
            List <AudioMixerGroupController> list = draggedItems.Select <AudioMixerItem, AudioMixerGroupController>((Func <AudioMixerItem, AudioMixerGroupController>)(i => i.mixer.masterGroup)).ToList <AudioMixerGroupController>();
            bool flag1 = AudioMixerController.WillModificationOfTopologyCauseFeedback(audioMixerItem.mixer.GetAllAudioGroupsSlow(), list, audioMixerItem.mixer.masterGroup, (List <AudioMixerController.ConnectionNode>)null);
            bool flag2 = this.ValidDrag(parentNode, draggedItems) && !flag1;

            if (perform && flag2 && this.m_MixersDroppedOnMixerCallback != null)
            {
                this.m_MixersDroppedOnMixerCallback(this.GetAudioMixersFromItems(draggedItems), audioMixerItem.mixer);
            }
            return(flag2 ? DragAndDropVisualMode.Move : DragAndDropVisualMode.Rejected);
        }