Пример #1
0
        private static StyleProperty DrawStyleProperty(StyleProperty property, bool isEditable)
        {
            switch (property.propertyId)
            {
            case StylePropertyId.LayoutFitHorizontal:
            case StylePropertyId.LayoutFitVertical:
                return(DrawEnumWithValue <LayoutFit>(property, isEditable));

            case StylePropertyId.OverflowX:
            case StylePropertyId.OverflowY:
                return(DrawEnumWithValue <Overflow>(property, isEditable));

            case StylePropertyId.BackgroundColor:
            case StylePropertyId.BackgroundTint:
            case StylePropertyId.BorderColorTop:
            case StylePropertyId.BorderColorLeft:
            case StylePropertyId.BorderColorRight:
            case StylePropertyId.BorderColorBottom:
                return(DrawColor(property, isEditable));

            case StylePropertyId.BackgroundFit:
                return(DrawEnumWithValue <BackgroundFit>(property, isEditable));

            case StylePropertyId.Visibility:
                return(DrawEnumWithValue <Visibility>(property, isEditable));

            case StylePropertyId.Painter:
                return(DrawString(property, isEditable));

            case StylePropertyId.TextOutlineWidth:
            case StylePropertyId.TextGlowOffset:
            case StylePropertyId.TextGlowOuter:
            case StylePropertyId.TextGlowInner:
            case StylePropertyId.TextGlowPower:
            case StylePropertyId.TextUnderlayX:
            case StylePropertyId.TextUnderlayY:
            case StylePropertyId.TextUnderlayDilate:
            case StylePropertyId.TextUnderlaySoftness:
            case StylePropertyId.TextFaceDilate:
            case StylePropertyId.TextOutlineSoftness:
                return(DrawFloat(property, isEditable));

            case StylePropertyId.MeshType:
            case StylePropertyId.MeshFillDirection:
            case StylePropertyId.MeshFillOrigin:
                return(DrawEnumWithValue <MeshType>(property, isEditable));

            case StylePropertyId.MeshFillAmount:
                return(DrawFloat(property, isEditable));

            case StylePropertyId.Layer:
                return(DrawInt(property, isEditable));

            case StylePropertyId.Material:
                return(DrawMaterial(property));

            case StylePropertyId.TextOutlineColor:
            case StylePropertyId.TextGlowColor:
            case StylePropertyId.TextUnderlayColor:
            case StylePropertyId.CaretColor:
            case StylePropertyId.SelectionBackgroundColor:
            case StylePropertyId.SelectionTextColor:
                return(DrawColor(property, isEditable));

            case StylePropertyId.TextUnderlayType:
                return(DrawEnumWithValue <UnderlayType>(property, isEditable));

            case StylePropertyId.RadialLayoutStartAngle:
            case StylePropertyId.RadialLayoutEndAngle:
                return(DrawFloat(property, isEditable));

            case StylePropertyId.RadialLayoutRadius:
            case StylePropertyId.CornerBevelTopLeft:
            case StylePropertyId.CornerBevelTopRight:
            case StylePropertyId.CornerBevelBottomLeft:
            case StylePropertyId.CornerBevelBottomRight:
                return(DrawFixedLength(property, isEditable));

            case StylePropertyId.AlignItemsHorizontal:
            case StylePropertyId.AlignItemsVertical:
                return(DrawFloat(property, isEditable));

            case StylePropertyId.DistributeExtraSpaceHorizontal:
            case StylePropertyId.DistributeExtraSpaceVertical:
                return(DrawEnumWithValue <SpaceDistribution>(property, isEditable));

            case StylePropertyId.FitItemsHorizontal:
            case StylePropertyId.FitItemsVertical:
                return(DrawEnumWithValue <LayoutFit>(property, isEditable));

            case StylePropertyId.BackgroundImageOffsetX:
            case StylePropertyId.BackgroundImageOffsetY:
            case StylePropertyId.BackgroundImageScaleX:
            case StylePropertyId.BackgroundImageScaleY:
            case StylePropertyId.ShadowIntensity:
            case StylePropertyId.ShadowOpacity:
            case StylePropertyId.ShadowSizeX:
            case StylePropertyId.ShadowSizeY:
            case StylePropertyId.BackgroundImageRotation:
            case StylePropertyId.BackgroundImageTileX:
            case StylePropertyId.BackgroundImageTileY:
                return(DrawFloat(property, isEditable));

            case StylePropertyId.BackgroundImage:
                return(DrawTextureAsset(property, isEditable));

            case StylePropertyId.Cursor:
                return(DrawCursor(property, isEditable));

            case StylePropertyId.Opacity:
                return(DrawFloat(property, isEditable));

            case StylePropertyId.GridItemY:
            case StylePropertyId.GridItemHeight:
            case StylePropertyId.GridItemX:
            case StylePropertyId.GridItemWidth:
                return(DrawInt(property, isEditable));

            case StylePropertyId.GridLayoutDirection:
                return(DrawEnumWithValue <LayoutDirection>(property, isEditable));

            case StylePropertyId.GridLayoutDensity:
                return(DrawEnumWithValue <GridLayoutDensity>(property, isEditable));

            case StylePropertyId.GridLayoutColTemplate:
            case StylePropertyId.GridLayoutRowTemplate:
                return(DrawGridTemplate(property, isEditable));

            case StylePropertyId.GridLayoutColAutoSize:
            case StylePropertyId.GridLayoutRowAutoSize:
                return(DrawGridTemplate(property, isEditable));

            case StylePropertyId.GridLayoutColGap:
            case StylePropertyId.GridLayoutRowGap:
                return(DrawFloat(property, isEditable));

            case StylePropertyId.GridLayoutColAlignment:
            case StylePropertyId.GridLayoutRowAlignment:
                return(DrawEnumWithValue <GridAxisAlignment>(property, isEditable));

            case StylePropertyId.FlexLayoutWrap:
                return(DrawEnumWithValue <LayoutWrap>(property, isEditable));

            case StylePropertyId.FlexLayoutDirection:
                return(DrawEnumWithValue <LayoutDirection>(property, isEditable));

            case StylePropertyId.FlexItemGrow:
            case StylePropertyId.FlexItemShrink:
                return(DrawInt(property, isEditable));

            case StylePropertyId.MarginTop:
            case StylePropertyId.MarginRight:
            case StylePropertyId.MarginBottom:
            case StylePropertyId.MarginLeft:
                return(DrawMeasurement(property, isEditable));

            case StylePropertyId.BorderTop:
            case StylePropertyId.BorderRight:
            case StylePropertyId.BorderBottom:
            case StylePropertyId.BorderLeft:
            case StylePropertyId.PaddingTop:
            case StylePropertyId.PaddingRight:
            case StylePropertyId.PaddingBottom:
            case StylePropertyId.PaddingLeft:
                return(DrawFixedLength(property, isEditable));

            case StylePropertyId.BorderRadiusTopLeft:
            case StylePropertyId.BorderRadiusTopRight:
            case StylePropertyId.BorderRadiusBottomLeft:
            case StylePropertyId.BorderRadiusBottomRight:
                return(DrawFixedLength(property, isEditable));

            case StylePropertyId.TransformPositionX:
            case StylePropertyId.TransformPositionY:
            case StylePropertyId.ShadowOffsetX:
            case StylePropertyId.ShadowOffsetY:
                return(DrawOffsetMeasurement(property, isEditable));

            case StylePropertyId.TransformScaleX:
            case StylePropertyId.TransformScaleY:
                return(DrawFloat(property, isEditable));

            case StylePropertyId.TransformPivotX:
            case StylePropertyId.TransformPivotY:
                return(DrawFixedLength(property, isEditable));

            case StylePropertyId.TransformRotation:
                return(DrawFloat(property, isEditable));

            case StylePropertyId.TextColor:
            case StylePropertyId.ShadowColor:
            case StylePropertyId.ShadowTint:
                return(DrawColor(property, isEditable));

            case StylePropertyId.TextFontAsset:
                return(DrawFontAsset(property, isEditable));

            case StylePropertyId.TextFontSize:
                return(DrawFixedLength(property, isEditable));

            case StylePropertyId.TextFontStyle:
                // todo -- this needs to be an EnumFlags popup
                return(DrawEnumWithValue <FontStyle>(property, isEditable));

            //                    return DrawEnum<Text.FontStyle>(property, isEditable);

            case StylePropertyId.TextAlignment:
                return(DrawEnumWithValue <TextAlignment>(property, isEditable));

            case StylePropertyId.TextWhitespaceMode:
                return(DrawEnumWithValue <WhitespaceMode>(property, isEditable));

            //
            case StylePropertyId.TextTransform:
                return(DrawEnumWithValue <TextTransform>(property, isEditable));

            case StylePropertyId.AlignmentTargetX:
            case StylePropertyId.AlignmentTargetY:
                return(DrawEnumWithValue <AlignmentTarget>(property, isEditable));

            case StylePropertyId.AlignmentDirectionX:
            case StylePropertyId.AlignmentDirectionY:
                return(DrawEnumWithValue <AlignmentDirection>(property, isEditable));

            case StylePropertyId.AlignmentOffsetX:
            case StylePropertyId.AlignmentOffsetY:
            case StylePropertyId.AlignmentOriginX:
            case StylePropertyId.AlignmentOriginY:
                return(DrawOffsetMeasurement(property, isEditable));

            case StylePropertyId.MinWidth:
            case StylePropertyId.MaxWidth:
            case StylePropertyId.PreferredWidth:
            case StylePropertyId.MinHeight:
            case StylePropertyId.MaxHeight:
            case StylePropertyId.PreferredHeight:
                return(DrawMeasurement(property, isEditable));

            case StylePropertyId.LayoutType:
                return(DrawEnumWithValue <LayoutType>(property, isEditable));

            case StylePropertyId.LayoutBehavior:
                return(DrawEnumWithValue <LayoutBehavior>(property, isEditable));

            case StylePropertyId.ZIndex:
            case StylePropertyId.RenderLayerOffset:
                return(DrawInt(property, isEditable));

            case StylePropertyId.RenderLayer:
                return(DrawEnumWithValue <RenderLayer>(property, isEditable));

            case StylePropertyId.ClipBehavior:
                return(DrawEnumWithValue <ClipBehavior>(property, isEditable));

            case StylePropertyId.ClipBounds:
                return(DrawEnumWithValue <ClipBounds>(property, isEditable));

            case StylePropertyId.AlignmentBoundaryX:
                return(DrawEnumWithValue <AlignmentBoundary>(property, isEditable));

            case StylePropertyId.AlignmentBoundaryY:
                return(DrawEnumWithValue <AlignmentBoundary>(property, isEditable));

            case StylePropertyId.PointerEvents:
                return(DrawEnumWithValue <PointerEvents>(property, isEditable));

            default:
                Debug.Log(property.propertyId.ToString() + " has no inspector");
                return(StyleProperty.Unset(property.propertyId));
            }
        }
 public void OnButton2Clicked()
 {
     Debug.Log("Child enabled");
     child.style.SetProperty(StyleProperty.Unset(StylePropertyId.PointerEvents), StyleState.Normal);
 }