Esempio n. 1
0
        public new static void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["Processor"] = Type.GetType(node.Attribute("Processor"));

            file["LinkResolver"] = parser.ParseDelegate("LinkResolver");

            file["ImageNotLoaded"] = parser.ParseResource <Texture2D>("ImageNotLoaded");

            file["EnableBaseLineCorrection"] = parser.ParseBoolean("EnableBaseLineCorrection");

            file["Text"]        = parser.ParseString("Text");
            file["Font"]        = parser.ValueOrNull("Font");
            file["FontSize"]    = parser.ParseInt("FontSize");
            file["FontSpacing"] = parser.ParseInt("FontSpacing");

            for (int idx = 0; idx < (int)FontType.Count; ++idx)
            {
                FontType type    = (FontType)idx;
                string   font    = string.Format("{0}.Font", type);
                string   spacing = string.Format("{0}.FontSpacing", type);
                string   resize  = string.Format("{0}.FontResize", type);

                file[font]    = parser.ValueOrNull(font);
                file[spacing] = parser.ParseInt(spacing);
                file[resize]  = parser.ParseInt(resize);
            }

            for (int idx = 0; idx < (int)SizeType.Count; ++idx)
            {
                SizeType type = (SizeType)idx;
                string   size = string.Format("{0}.FontSize", type);

                file[size] = parser.ParseInt(size);
            }

            file["LineHeight"]       = parser.ParseInt("LineHeight");
            file["Indent"]           = parser.ParseLength("Indent");
            file["ParagraphSpacing"] = parser.ParseLength("ParagraphSpacing");

            file["Justify"] = parser.ParseBoolean("Justify");

            file["TextColor"]            = parser.ParseColor("TextColor");
            file["LinkColor"]            = parser.ParseColor("LinkColor");
            file["ActiveLinkColor"]      = parser.ParseColor("ActiveLinkColor");
            file["HorizontalRulerColor"] = parser.ParseColor("HorizontalRulerColor");

            file["HorizontalContentAlignment"] = parser.ParseEnum <HorizontalContentAlignment>("HorizontalContentAlignment");
            file["VerticalContentAlignment"]   = parser.ParseEnum <VerticalContentAlignment>("VerticalContentAlignment");

            file["BulletText"]            = parser.ParseString("BulletText");
            file["HorizontalRulerHeight"] = parser.ParseLength("HorizontalRulerHeight");

            file["ClickMargin"] = parser.ParseLength("ClickMargin");
            file["UrlClick"]    = parser.ParseDelegate("UrlClick");
        }
Esempio n. 2
0
        public new static void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["TopColor"]    = parser.ParseColor("TopColor");
            file["BottomColor"] = parser.ParseColor("BottomColor");
        }
Esempio n. 3
0
        public new static void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["LeftColor"]  = parser.ParseColor("LeftColor");
            file["RightColor"] = parser.ParseColor("RightColor");
        }
Esempio n. 4
0
        public static void Parse(XNode node, DefinitionFile file)
        {
            var parser = new DefinitionParser(node);

            file["ChangeTime"] = parser.ParseDouble("ChangeTime");

            file["Opacity"] = parser.ParseDouble("Opacity");

            file["ColorPushed"]   = parser.ParseColor("ColorPushed");
            file["ColorReleased"] = parser.ParseColor("ColorReleased");
            file["ColorDisabled"] = parser.ParseColor("ColorDisabled");
            file["Margin"]        = parser.ParseMargin("Margin");

            file["Checked"] = parser.ParseBoolean("Checked");
            file["Special"] = parser.ParseBoolean("Special");
        }
Esempio n. 5
0
        public static void Parse(XNode node, DefinitionFile file)
        {
            var parser = new DefinitionParser(node);

            file["Color"] = parser.ParseColor("Color");
            file["Left"]  = parser.ParseLength("Left");
            file["Right"] = parser.ParseLength("Right");
        }
Esempio n. 6
0
        public new static void Parse(XNode node, DefinitionFile file)
        {
            UiLabel.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["Colors"] = parser.ParseColor("Colors");
        }
Esempio n. 7
0
        public new static void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            DefinitionParser parser = new DefinitionParser(node);

            file["SelectionColor"] = parser.ParseColor("SelectionColor");
        }
Esempio n. 8
0
        public new static void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["Image"]       = parser.ParseResource <NinePatchImage>("Image");
            file["ScaleByUnit"] = parser.ParseBoolean("ScaleByUnit");
            file["Scale"]       = parser.ParseDouble("Scale");
            file["Color"]       = parser.ParseColor("Color");
        }
Esempio n. 9
0
        public new static void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["Image"]         = parser.ParseResource <Texture2D>("Image");
            file["Stretch"]       = parser.ParseEnum <Stretch>("Stretch");
            file["Color"]         = parser.ParseColor("Color");
            file["RotationSpeed"] = parser.ParseDouble("RotationSpeed");
            file["ScaleByUnit"]   = parser.ParseBoolean("ScaleByUnit");
            file["Scale"]         = parser.ParseDouble("Scale");
        }
        public static new void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["AutomataGrid"] = parser.ParseDelegate("AutomataGrid");
            file["EditEnabled"] = parser.ParseBoolean("EditEnabled");

            file["Zoom"] = parser.ParseDouble("Zoom");
            file["StateToPaint"] = parser.ParseInt("StateToPaint");

            file["Colors"] = parser.ParseDelegate("Colors");

            file["GridColor"] = parser.ParseColor("GridColor");
        }
Esempio n. 11
0
        public new static void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["Text"]        = parser.ParseString("Text");
            file["Font"]        = parser.ValueOrNull("Font");
            file["FontSize"]    = parser.ParseInt("FontSize");
            file["FontSpacing"] = parser.ParseInt("FontSpacing");
            file["LineHeight"]  = parser.ParseInt("LineHeight");

            file["TextColor"] = parser.ParseColor("TextColor");
            file["HorizontalContentAlignment"] = parser.ParseEnum <HorizontalContentAlignment>("HorizontalContentAlignment");
            file["VerticalContentAlignment"]   = parser.ParseEnum <VerticalContentAlignment>("VerticalContentAlignment");

            file["AutoSizeUpdate"] = parser.ParseBoolean("AutoSizeUpdate");
            file["TextRotation"]   = parser.ParseEnum <TextRotation>("TextRotation");

            file["TextMargin"] = parser.ParseMargin("TextMargin");
        }
Esempio n. 12
0
        public new static void Parse(XNode node, DefinitionFile file)
        {
            UiView.Parse(node, file);

            var parser = new DefinitionParser(node);

            file["Text"]        = parser.ParseString("Text");
            file["Font"]        = parser.ValueOrNull("Font");
            file["FontSize"]    = parser.ParseInt("FontSize");
            file["FontSpacing"] = parser.ParseInt("FontSpacing");
            file["LineHeight"]  = parser.ParseInt("LineHeight");
            file["Indent"]      = parser.ParseLength("Indent");

            file["LineWidth"] = parser.ParseLength("LineWidth");

            file["Justify"] = parser.ParseBoolean("Justify");

            file["TextColor"] = parser.ParseColor("TextColor");
            file["HorizontalContentAlignment"] = parser.ParseEnum <HorizontalContentAlignment>("HorizontalContentAlignment");
            file["VerticalContentAlignment"]   = parser.ParseEnum <VerticalContentAlignment>("VerticalContentAlignment");
        }
Esempio n. 13
0
        public static void Parse(XNode node, DefinitionFile file)
        {
            var parser = new DefinitionParser(node);

            file["Id"] = parser.ParseString("Id");

            string controller     = node.Attribute("Controller");
            Type   controllerType = null;

            if (!string.IsNullOrEmpty(controller))
            {
                controllerType = Type.GetType(controller);
                if (controllerType == null)
                {
                    throw new Exception(string.Format("Cannot find controller type: {0}.", controller));
                }
            }

            file["Controller"] = controllerType;

            file["Binding"] = parser.ParseDelegate("Binding");

            file["Modal"] = parser.ParseBoolean("Modal");

            file["Visible"] = parser.ParseBoolean("Visible");
            file["Hidden"]  = parser.ParseBoolean("Hidden");

            file["BackgroundColor"] = parser.ParseColor("BackgroundColor");

            file["Opacity"] = parser.ParseDouble("Opacity");

            file["ViewRemoved"] = parser.ParseDelegate("ViewRemoved");
            file["ViewAdded"]   = parser.ParseDelegate("ViewAdded");

            file["ViewActivated"]   = parser.ParseDelegate("ViewActivated");
            file["ViewDeactivated"] = parser.ParseDelegate("ViewDeactivated");

            file["ViewResized"] = parser.ParseDelegate("ViewResized");

            file["MinWidth"]  = parser.ParseLength("MinWidth", false);
            file["MinHeight"] = parser.ParseLength("MinHeight", false);

            file["ShowHideTime"] = parser.ParseDouble("ShowHideTime");

            file["HideTime"] = parser.ParseDouble("HideTime");
            file["ShowTime"] = parser.ParseDouble("ShowTime");

            file["Tag"] = parser.ParseString("Tag");

            PositionParameters.Parse(node, file);

            foreach (var cn in node.Nodes)
            {
                if (cn.Tag == "UiView.BackgroundDrawable")
                {
                    if (cn.Nodes.Count != 1)
                    {
                        string error = node.NodeError("UiView.BackgroundDrawable must have exactly 1 child.");
                        if (DefinitionParser.EnableCheckMode)
                        {
                            ConsoleEx.WriteLine(error);
                        }
                        else
                        {
                            throw new Exception(error);
                        }
                    }

                    file["BackgroundDrawable"] = DefinitionFile.LoadFile(cn.Nodes[0]);
                }

                if (cn.Tag == "UiView.ShowTransitionEffect")
                {
                    if (cn.Nodes.Count != 1)
                    {
                        string error = node.NodeError("UiView.ShowTransitionEffect must have exactly 1 child.");
                        if (DefinitionParser.EnableCheckMode)
                        {
                            ConsoleEx.WriteLine(error);
                        }
                        else
                        {
                            throw new Exception(error);
                        }
                    }

                    file["ShowTransitionEffect"] = DefinitionFile.LoadFile(cn.Nodes[0]);
                }

                if (cn.Tag == "UiView.HideTransitionEffect")
                {
                    if (cn.Nodes.Count != 1)
                    {
                        string error = node.NodeError("UiView.HideTransitionEffect must have exactly 1 child.");
                        if (DefinitionParser.EnableCheckMode)
                        {
                            ConsoleEx.WriteLine(error);
                        }
                        else
                        {
                            throw new Exception(error);
                        }
                    }

                    file["HideTransitionEffect"] = DefinitionFile.LoadFile(cn.Nodes[0]);
                }

                if (cn.Tag == "UiView.ParentShowTransitionEffect")
                {
                    if (cn.Nodes.Count != 1)
                    {
                        string error = node.NodeError("UiView.NavigateToTransitionEffect must have exactly 1 child.");
                        if (DefinitionParser.EnableCheckMode)
                        {
                            ConsoleEx.WriteLine(error);
                        }
                        else
                        {
                            throw new Exception(error);
                        }
                    }

                    file["ParentShowTransitionEffect"] = DefinitionFile.LoadFile(cn.Nodes[0]);
                }

                if (cn.Tag == "UiView.ParentHideTransitionEffect")
                {
                    if (cn.Nodes.Count != 1)
                    {
                        string error = node.NodeError("UiView.NavigateFromTransitionEffect must have exactly 1 child.");
                        if (DefinitionParser.EnableCheckMode)
                        {
                            ConsoleEx.WriteLine(error);
                        }
                        else
                        {
                            throw new Exception(error);
                        }
                    }

                    file["ParentHideTransitionEffect"] = DefinitionFile.LoadFile(cn.Nodes[0]);
                }
            }
        }