Esempio n. 1
0
        public XmlUIButton(XmlUIScene scene, XInt.Button button, XInt.Style style) : base(style, scene)
        {
            Button      = button;
            Positioning = button;
            if (Style.HoverStyle != null)
            {
                hoverChunk = LuaStyleEnvironment.L.CompileChunk(
                    style.HoverStyle, "buttonHover", new Neo.IronLua.LuaCompileOptions()
                    );
            }

            ID = button.ID;
        }
Esempio n. 2
0
 public XmlUIButton(XmlUIScene scene, XInt.Button button, XInt.Style style) : base(style, scene)
 {
     Button      = button;
     Positioning = button;
     if (Style.HoverStyle != null)
     {
         hoverChunk = LuaStyleEnvironment.L.CompileChunk(
             style.HoverStyle, "buttonHover", new Neo.IronLua.LuaCompileOptions()
             );
     }
     if (Texts.Count > 0)
     {
         Texts[0].Text          = scene.Manager.GetString(button.Strid, button.InfocardId, button.Text);
         Texts[0].ColorOverride = hoverStyle.TextColor;
     }
     ID = button.ID;
 }
Esempio n. 3
0
            public XmlUIButton.LuaAPI addbutton(dynamic dn)
            {
                var btn   = new XInt.Button();
                var style = new XInt.Style();

                style.Size = new XInt.StyleSize();
                if (dn["x"] != null)
                {
                    btn.XText = dn.x;
                }
                if (dn["y"] != null)
                {
                    btn.YText = dn.y;
                }
                if (dn["anchor"] != null)
                {
                    btn.Anchor = Enum.Parse(typeof(XInt.Anchor), dn.anchor);
                }
                if (dn["height"] != null)
                {
                    style.Size.HeightText = dn.height;
                }
                if (dn["ratio"] != null)
                {
                    style.Size.Ratio = (float)dn.ratio;
                }
                if (dn["scissor"] != null)
                {
                    style.Scissor = (bool)dn.scissor;
                }
                if (dn["onclick"] != null)
                {
                    btn.OnClick = dn.onclick;
                }
                if (dn["background"] != null)
                {
                    style.Background = new XInt.StyleBackground()
                    {
                        ColorText = dn.background
                    }
                }
                ;
                style.HoverStyle = dn.hoverstyle;
                if (dn["models"] != null)
                {
                    var mdlxml = new List <XInt.Model>();
                    foreach (var kv in dn.models)
                    {
                        var mdl = kv.Value;
                        mdlxml.Add(new XInt.Model()
                        {
                            Path            = mdl.path,
                            TransformString = mdl.transform,
                            ColorText       = mdl.color
                        });
                    }
                    style.Models = mdlxml.ToArray();
                }
                var result = new XmlUIButton(scn, btn, style);

                scn.toadd.Add(result);
                return(result.Lua);
            }
        }