示例#1
0
        void CalculateDrawingParts(IEnumerable <ComponentType> types)
        {
            var typeList = types.ToList();

            typeList.Sort((Comparison <ComponentType>)ComponentGroupGUI.CompareTypes);
            styles = new List <GUIStyle>(typeList.Count);
            names  = new List <GUIContent>(typeList.Count);
            rects  = new List <Rect>(typeList.Count);
            foreach (var type in typeList)
            {
                var style   = ComponentGroupGUI.StyleForAccessMode(type.AccessModeType, archetypeQueryMode);
                var content = new GUIContent((string)ComponentGroupGUI.SpecifiedTypeName(type.GetManagedType()));

                styles.Add(style);
                names.Add(content);
            }
        }
        void CalculateDrawingParts(IEnumerable <ComponentType> types, IEnumerable <ComponentType> readWriteTypes, bool archetypeQueryMode)
        {
            var typeList = types.ToList();

            typeList.Sort((Comparison <ComponentType>)ComponentGroupGUI.CompareTypes);
            styles = new List <GUIStyle>(typeList.Count);
            names  = new List <GUIContent>(typeList.Count);
            rects  = new List <Rect>(typeList.Count);
            foreach (var type in typeList)
            {
                GUIStyle style = null;
                if (readWriteTypes != null)
                {
                    foreach (var readWriteType in readWriteTypes)
                    {
                        if (readWriteType.TypeIndex == type.TypeIndex)
                        {
                            style = ComponentGroupGUI.StyleForAccessMode(readWriteType.AccessModeType, archetypeQueryMode);
                            break;
                        }
                    }

                    if (style == null)
                    {
                        if (type.AccessModeType == ComponentType.AccessMode.Subtractive)
                        {
                            style = EntityDebuggerStyles.ComponentSubtractive;
                        }
                        else
                        {
                            style = EntityDebuggerStyles.ComponentRequired;
                        }
                    }
                }
                else
                {
                    style = ComponentGroupGUI.StyleForAccessMode(type.AccessModeType, archetypeQueryMode);
                }
                var content = new GUIContent((string)ComponentGroupGUI.SpecifiedTypeName(type.GetManagedType()));

                styles.Add(style);
                names.Add(content);
            }
        }