예제 #1
0
 public void AddGroup(ChildGroup group)
 {
     if (!_groups.Contains(group))
     {
         _groups.Add(group);
     }
 }
 public void AddItem(DraggableItem item, ChildGroup group)
 {
     group.Add(item);
 }
 public void RemoveGroup(ChildGroup group)
 {
     //Debug.Log("RemoveGroup!");
     _groups.Remove(group);
 }
 public void AddGroup(ChildGroup group)
 {
     if (!_groups.Contains(group))
         _groups.Add(group);
 }
예제 #5
0
 public void AddItem(DraggableItem item, ChildGroup group)
 {
     group.Add(item);
 }
예제 #6
0
 public void RemoveGroup(ChildGroup group)
 {
     //Debug.Log("RemoveGroup!");
     _groups.Remove(group);
 }
예제 #7
0
        public static ChildGroupRenderingList BuildContentGroups(GroupAdapter groupAdapter)
        {
            //Debug.Log("BuildContentGroups");
            ChildGroupRenderingList childGroupList = new ChildGroupRenderingList();

            var groupDescriptors = DesignerReflection.GetChildGroupsReferences(groupAdapter);
            bool skipFirst = false;
            if (groupDescriptors.Count > 0)
            {
                skipFirst = groupDescriptors[0].Attribute.ShowHeader;
            }

            foreach (ChildGroupDescriptor descriptor in groupDescriptors)
            {
                var attr = descriptor.Attribute;

                ChildGroup group;

                if (attr.ShowHeader)
                {
                    Texture iconTexture = null;

                    if (!string.IsNullOrEmpty(attr.Icon))
                        iconTexture = (Texture)Resources.Load(attr.Icon);

                    group = new ChildGroup(new GUIContent(attr.Label, iconTexture, attr.Tooltip));
                }
                else
                {
                    group = new ChildGroup();
                }

                List<ComponentAdapter> adapters = Core.Reflection.CoreReflector.GetMemberValue(descriptor.CollectionMemberInfo, groupAdapter) as List<ComponentAdapter>;

                // temp hack
                // ReSharper disable ConvertIfStatementToNullCoalescingExpression
                if (null == adapters)
                // ReSharper restore ConvertIfStatementToNullCoalescingExpression
                {
                    // ReSharper disable AssignNullToNotNullAttribute
                    adapters = new List<ComponentAdapter>(Core.Reflection.CoreReflector.GetMemberValue(descriptor.CollectionMemberInfo, groupAdapter) as ComponentAdapter[]);
                    // ReSharper restore AssignNullToNotNullAttribute
                }

                //Debug.Log("adapters.Count: " + adapters.Count);
                foreach (ComponentAdapter adapter in adapters)
                {
                    //Debug.Log("  -> adapter: " + adapter);
                    if (null != adapter)
                    {
                        var dataObject = new OrderDisplayRow(adapter.ToString(), adapter, new Rect(0, 0, 0, 0))
                        {
                            Color = (adapter is GroupAdapter) ? Dark : Light,
                            IsContainer = adapter is GroupAdapter
                        };

                        if (skipFirst)
                            dataObject.YMin = OrderDisplay.ElementHeight;

                        //Debug.Log("Adding " + dataObject);
                        group.Add(dataObject);
                    }
                }

//                Debug.Log(string.Format(@"***** Group created: 
//{0}
//
//", group));
                childGroupList.AddGroup(group);
            }

            //Debug.Log(childGroupList);

            return childGroupList;
        }