コード例 #1
0
        public static LegoTextStyleMeta Create(YuLegoText text)
        {
            var meta = new LegoTextStyleMeta
            {
                FontName  = text.font == null ? null : text.font.name,
                FontStyle = text.font == null
                    ? LegoTextFontStyle.Normal
                    : text.fontStyle.ToString().AsEnum <LegoTextFontStyle>(),
                FontSize           = text.font == null ? 20 : text.fontSize,
                LineSpacing        = text.lineSpacing,
                SupportRichText    = text.supportRichText,
                Alignment          = text.alignment.ToString().AsEnum <LegoTextAlignment>(),
                AlignByGeometry    = text.alignByGeometry,
                HorizontalOverflow = text.horizontalOverflow.ToString()
                                     .AsEnum <LegoTextHorizontalOverflow>(),
                VerticalOverflow = text.verticalOverflow.ToString()
                                   .AsEnum <LegoTextVerticalOverflow>(),
                BestFit       = text.resizeTextForBestFit,
                TextLegoColor = LegoColorMeta.Create(text.color),
                Material      = text.material == null ? null : text.material.name,
                RaycastTarget = text.raycastTarget
            };

            return(meta);
        }
コード例 #2
0
        public static LegoRawImageMeta Create(YuLegoRawImage rawImage)
        {
            var meta = new LegoRawImageMeta
            {
                TextureId     = rawImage.texture == null ? null : rawImage.texture.name,
                Material      = rawImage.material == null ? null : rawImage.material.name,
                RaycastTarget = rawImage.raycastTarget,
                LegoColor     = LegoColorMeta.Create(rawImage.color)
            };

            return(meta);
        }
コード例 #3
0
        public static LegoColorMeta Create(Color color)
        {
            var meta = new LegoColorMeta
            {
                R = color.r,
                G = color.g,
                B = color.b,
                A = color.a
            };

            return(meta);
        }
コード例 #4
0
        public static LegoColorTintMeta Create(Selectable selectable)
        {
            var meta       = new LegoColorTintMeta();
            var colorBlock = selectable.colors;

            meta.NormalLegoColor      = LegoColorMeta.Create(colorBlock.normalColor);
            meta.HighlightedLegoColor = LegoColorMeta.Create(colorBlock.highlightedColor);
            meta.PressedLegoColor     = LegoColorMeta.Create(colorBlock.pressedColor);
            meta.DisabledLegoColor    = LegoColorMeta.Create(colorBlock.disabledColor);
            meta.ColorMultiplier      = colorBlock.colorMultiplier;
            meta.FadeDuration         = colorBlock.fadeDuration;

            return(meta);
        }