Ejemplo n.º 1
0
 public SerializedLayoutCategory(LayoutInfo info)
 {
     AABB              = new AABBLayout(info);
     AABBi             = new AABBiLayout(info);
     AnimationCurveTpl = new AnimationCurveTplLayout(info);
     ColorRGBA32       = new ColorRGBA32Layout(info);
     ColorRGBAf        = new ColorRGBAfLayout(info);
     Gradient          = new GradientLayout(info);
     GUIStyle          = new GUIStyleLayout(info);
     LayerMask         = new LayerMaskLayout(info);
     Matrix4x4f        = new Matrix4x4fLayout(info);
     Quaternionf       = new QuaternionfLayout(info);
     Rectf             = new RectfLayout(info);
     RectOffset        = new RectOffsetLayout(info);
     Vector2f          = new Vector2fLayout(info);
     Vector2i          = new Vector2iLayout(info);
     Vector3f          = new Vector3fLayout(info);
     Vector3i          = new Vector3iLayout(info);
     Vector4f          = new Vector4fLayout(info);
 }
Ejemplo n.º 2
0
        private static void GenerateEngineStruct(TypeTreeContext context, SerializableType origin, string name)
        {
            switch (origin.Name)
            {
            case SerializableType.Vector2Name:
                Vector2fLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.Vector2IntName:
                Vector2iLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.Vector3Name:
                Vector3fLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.Vector3IntName:
                Vector3iLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.Vector4Name:
                Vector4fLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.RectName:
                RectfLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.BoundsName:
                AABBLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.BoundsIntName:
                AABBiLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.QuaternionName:
                QuaternionfLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.Matrix4x4Name:
                Matrix4x4fLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.ColorName:
                ColorRGBAfLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.Color32Name:
                ColorRGBA32Layout.GenerateTypeTree(context, name);
                break;

            case SerializableType.LayerMaskName:
                LayerMaskLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.AnimationCurveName:
                AnimationCurveTplLayout.GenerateTypeTree(context, name, SingleLayout.GenerateTypeTree);
                break;

            case SerializableType.GradientName:
                GradientLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.RectOffsetName:
                RectOffsetLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.GUIStyleName:
                GUIStyleLayout.GenerateTypeTree(context, name);
                break;

            case SerializableType.PropertyNameName:
                PropertyNameLayout.GenerateTypeTree(context, name);
                break;

            default:
                throw new Exception($"Unknown engine struct {origin.Name}");
            }
        }
Ejemplo n.º 3
0
        public void Read(AssetReader reader)
        {
            GUIStyleLayout layout = reader.Layout.Serialized.GUIStyle;

            Name = reader.ReadString();
            Normal.Read(reader);
            Hover.Read(reader);
            Active.Read(reader);
            Focused.Read(reader);
            OnNormal.Read(reader);
            OnHover.Read(reader);
            OnActive.Read(reader);
            OnFocused.Read(reader);
            Border.Read(reader);
            if (layout.IsBuiltinFormat)
            {
                Margin.Read(reader);
                Padding.Read(reader);
            }
            else
            {
                Padding.Read(reader);
                Margin.Read(reader);
            }

            Overflow.Read(reader);
            Font.Read(reader);
            if (layout.IsBuiltinFormat)
            {
                FontSize  = reader.ReadInt32();
                FontStyle = (FontStyle)reader.ReadInt32();
                Alignment = (TextAnchor)reader.ReadInt32();
                WordWrap  = reader.ReadBoolean();
                RichText  = reader.ReadBoolean();
                reader.AlignStream();

                TextClipping  = (TextClipping)reader.ReadInt32();
                ImagePosition = (ImagePosition)reader.ReadInt32();
                ContentOffset.Read(reader);
                FixedWidth    = reader.ReadSingle();
                FixedHeight   = reader.ReadSingle();
                StretchWidth  = reader.ReadBoolean();
                StretchHeight = reader.ReadBoolean();
                reader.AlignStream();
            }
            else
            {
                ImagePosition = (ImagePosition)reader.ReadInt32();
                Alignment     = (TextAnchor)reader.ReadInt32();
                WordWrap      = reader.ReadBoolean();
                reader.AlignStream();

                TextClipping = (TextClipping)reader.ReadInt32();
                ContentOffset.Read(reader);
                ClipOffset.Read(reader);
                FixedWidth  = reader.ReadSingle();
                FixedHeight = reader.ReadSingle();
                if (layout.HasFontSize)
                {
                    FontSize  = reader.ReadInt32();
                    FontStyle = (FontStyle)reader.ReadInt32();
                }
                StretchWidth = reader.ReadBoolean();
                reader.AlignStream();
                StretchHeight = reader.ReadBoolean();
                reader.AlignStream();
            }
        }
Ejemplo n.º 4
0
        public void Write(AssetWriter writer)
        {
            GUIStyleLayout layout = writer.Layout.Serialized.GUIStyle;

            writer.Write(Name);
            Normal.Write(writer);
            Hover.Write(writer);
            Active.Write(writer);
            Focused.Write(writer);
            OnNormal.Write(writer);
            OnHover.Write(writer);
            OnActive.Write(writer);
            OnFocused.Write(writer);
            Border.Write(writer);
            if (layout.IsBuiltinFormat)
            {
                Margin.Write(writer);
                Padding.Write(writer);
            }
            else
            {
                Padding.Write(writer);
                Margin.Write(writer);
            }

            Overflow.Write(writer);
            Font.Write(writer);
            if (layout.IsBuiltinFormat)
            {
                writer.Write(FontSize);
                writer.Write((int)FontStyle);
                writer.Write((int)Alignment);
                writer.Write(WordWrap);
                writer.Write(RichText);
                writer.AlignStream();

                writer.Write((int)TextClipping);
                writer.Write((int)ImagePosition);
                ContentOffset.Write(writer);
                writer.Write(FixedWidth);
                writer.Write(FixedHeight);
                writer.Write(StretchWidth);
                writer.Write(StretchHeight);
                writer.AlignStream();
            }
            else
            {
                writer.Write((int)ImagePosition);
                writer.Write((int)Alignment);
                writer.Write(WordWrap);
                writer.AlignStream();

                writer.Write((int)TextClipping);
                ContentOffset.Write(writer);
                ClipOffset.Write(writer);
                writer.Write(FixedWidth);
                writer.Write(FixedHeight);
                if (layout.HasFontSize)
                {
                    writer.Write(FontSize);
                    writer.Write((int)FontStyle);
                }
                writer.Write(StretchWidth);
                writer.AlignStream();
                writer.Write(StretchHeight);
                writer.AlignStream();
            }
        }
Ejemplo n.º 5
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node   = new YAMLMappingNode();
            GUIStyleLayout  layout = container.ExportLayout.Serialized.GUIStyle;

            node.Add(layout.NameName, Name);
            node.Add(layout.NormalName, Normal.ExportYAML(container));
            node.Add(layout.HoverName, Hover.ExportYAML(container));
            node.Add(layout.ActiveName, Active.ExportYAML(container));
            node.Add(layout.FocusedName, Focused.ExportYAML(container));
            node.Add(layout.OnNormalName, OnNormal.ExportYAML(container));
            node.Add(layout.OnHoverName, OnHover.ExportYAML(container));
            node.Add(layout.OnActiveName, OnActive.ExportYAML(container));
            node.Add(layout.OnFocusedName, OnFocused.ExportYAML(container));
            node.Add(layout.BorderName, Border.ExportYAML(container));
            if (layout.IsBuiltinFormat)
            {
                node.Add(layout.MarginName, Margin.ExportYAML(container));
                node.Add(layout.PaddingName, Padding.ExportYAML(container));
            }
            else
            {
                node.Add(layout.PaddingName, Padding.ExportYAML(container));
                node.Add(layout.MarginName, Margin.ExportYAML(container));
            }

            node.Add(layout.OverflowName, Overflow.ExportYAML(container));
            node.Add(layout.FontName, Font.ExportYAML(container));
            if (layout.IsBuiltinFormat)
            {
                node.Add(layout.FontSizeName, FontSize);
                node.Add(layout.FontStyleName, (int)FontStyle);
                node.Add(layout.AlignmentName, (int)Alignment);
                node.Add(layout.WordWrapName, WordWrap);
                node.Add(layout.RichTextName, RichText);
                node.Add(layout.TextClippingName, (int)TextClipping);
                node.Add(layout.ImagePositionName, (int)ImagePosition);
                node.Add(layout.ContentOffsetName, ContentOffset.ExportYAML(container));
                node.Add(layout.FixedWidthName, FixedWidth);
                node.Add(layout.FixedHeightName, FixedHeight);
                node.Add(layout.StretchWidthName, StretchWidth);
                node.Add(layout.StretchHeightName, StretchHeight);
            }
            else
            {
                node.Add(layout.ImagePositionName, (int)ImagePosition);
                node.Add(layout.AlignmentName, (int)Alignment);
                node.Add(layout.WordWrapName, WordWrap);
                node.Add(layout.TextClippingName, (int)TextClipping);
                node.Add(layout.ContentOffsetName, ContentOffset.ExportYAML(container));
                node.Add(layout.ClipOffsetName, ClipOffset.ExportYAML(container));
                node.Add(layout.FixedWidthName, FixedWidth);
                node.Add(layout.FixedHeightName, FixedHeight);
                if (layout.HasFontSize)
                {
                    node.Add(layout.FontSizeName, FontSize);
                    node.Add(layout.FontStyleName, (int)FontStyle);
                }
                node.Add(layout.StretchWidthName, StretchWidth);
                node.Add(layout.StretchHeightName, StretchHeight);
            }
            return(node);
        }