コード例 #1
0
        public void DrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute)
        {
            GetDrawerForMember(mightyMember, m_elementCallback, out var drawerMethod, baseAttribute);

            InvokeDrawer(drawerMethod,
                         $"void {((CustomDrawerAttribute) baseAttribute).DrawerCallback}(Rect rect, SerializedProperty property, SerializedProperty element, int index)",
                         rect, mightyMember.Property, mightyMember.GetElement(index), index);
        }
コード例 #2
0
        public override float GetElementHeight(BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute)
        {
            var element = mightyMember.GetElement(index);

            if (element.propertyType != SerializedPropertyType.ObjectReference || element.objectReferenceValue == null)
            {
                return(50);
            }

            var previewTexture = AssetPreview.GetAssetPreview(element.objectReferenceValue);

            if (previewTexture == null)
            {
                return(50);
            }

            var showAssetAttribute = (ShowAssetPreviewAttribute)attribute;

            var textureRatio = (float)previewTexture.width / previewTexture.height;

            return((int)Mathf.Clamp(showAssetAttribute.Size / textureRatio, 0, previewTexture.height) + 15);
        }
コード例 #3
0
        public float GetElementHeight(BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute)
        {
            var element = mightyMember.GetElement(index);

            return(element.propertyType != SerializedPropertyType.String ? 64 : Height(element) + 24);
        }
コード例 #4
0
 public void DrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute) =>
 DrawTextArea(rect, mightyMember.GetElement(index), (ResizableTextAreaAttribute)baseAttribute);
コード例 #5
0
 public void DrawElement(GUIContent label, BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute) =>
 DrawTextArea(mightyMember.GetElement(index), (ResizableTextAreaAttribute)baseAttribute, label);
コード例 #6
0
 public void DrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute) =>
 DrawRotation2D(rect, mightyMember.GetElement(index), baseAttribute);
コード例 #7
0
 public void DrawElement(GUIContent label, BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute) =>
 DrawRotation2D(mightyMember.GetElement(index), baseAttribute, label);
コード例 #8
0
 public void DrawElement(BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute) =>
 DrawMargins(mightyMember.GetElement(index), baseAttribute);
コード例 #9
0
 public float GetElementHeight(BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute) =>
 mightyMember.GetElement(index).propertyType != SerializedPropertyType.Integer ? 64 : 20;
コード例 #10
0
 public void DrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute) =>
 DrawSlider(rect, mightyMember.GetElement(index), (MinMaxSliderAttribute)baseAttribute);
コード例 #11
0
 public void DrawElement(GUIContent label, BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute) =>
 DrawSlider(mightyMember.GetElement(index), (MinMaxSliderAttribute)baseAttribute, label);
コード例 #12
0
        public float GetElementHeight(BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute)
        {
            var propertyType = mightyMember.GetElement(index).propertyType;

            return(propertyType != SerializedPropertyType.Integer && propertyType != SerializedPropertyType.Float ? 64 : 20);
        }
コード例 #13
0
 public void DrawElement(BaseMightyMember mightyMember, int index, BaseDrawerAttribute baseAttribute) =>
 DrawSlider(mightyMember.GetElement(index), (PercentSliderAttribute)baseAttribute);
コード例 #14
0
 public override Rect EndDrawElement(Rect rect, BaseMightyMember mightyMember, int index, BaseElementDecoratorAttribute attribute) =>
 DrawPreview(rect, mightyMember.GetElement(index), (ShowAssetPreviewAttribute)attribute);