public XmlUIServerList(XInt.ServerList sl, XInt.Style style, XmlUIScene scene) : base(style, scene, false)
 {
     Positioning = sl;
     ID          = sl.ID;
     Lua         = new ServerListAPI(this);
     grid        = new GridControl(scene, dividerPositions, columnTitles, GetGridRect, new ServerListContent(this), NUM_ROWS);
 }
示例#2
0
 public XmlUIPanel(XInt.Style style, XmlUIScene scene, bool setLua = true) : base(scene)
 {
     if (setLua)
     {
         Lua = new PanelAPI(this);
     }
     Style = style;
     if (style.Models != null)
     {
         foreach (var model in style.Models)
         {
             var res = new ModelInfo();
             res.Drawable = Scene.Manager.Game.ResourceManager.GetDrawable(
                 Scene.Manager.Game.GameData.ResolveDataPath(model.Path.Substring(2))
                 );
             res.Transform = Matrix4.CreateScale(model.Transform[2], model.Transform[3], 1) *
                             Matrix4.CreateTranslation(model.Transform[0], model.Transform[1], 0);
             if (model.Color != null)
             { //Dc is modified
                 var l0  = ((Utf.Cmp.ModelFile)res.Drawable).Levels[0];
                 var vms = l0.Mesh;
                 //Save Mesh material state
                 for (int i = l0.StartMesh; i < l0.StartMesh + l0.MeshCount; i++)
                 {
                     var mat = (BasicMaterial)vms.Meshes[i].Material?.Render;
                     if (mat == null)
                     {
                         continue;
                     }
                     bool found = false;
                     foreach (var m in res.Materials)
                     {
                         if (m.Mat == mat)
                         {
                             found = true;
                             break;
                         }
                     }
                     if (found)
                     {
                         continue;
                     }
                     res.Materials.Add(new ModifiedMaterial()
                     {
                         Mat = mat, Dc = mat.Dc
                     });
                 }
             }
             models.Add(res);
         }
     }
     if (Style.Texts != null)
     {
         foreach (var t in Style.Texts)
         {
             Texts.Add(new TextElement(t));
         }
     }
 }
示例#3
0
 public XmlUITextBox(XInt.TextBox text, XInt.Style style, XmlUIScene scn) : base(style, scn)
 {
     Positioning = text;
     ID          = text.ID;
     TextBox     = text;
     Lua         = new LuaTextBox(this);
     font        = scn.Manager.Game.Fonts.GetSystemFont("Arial Unicode MS");
     elem        = Texts.Where((x) => x.ID == text.DisplayArea).First();
 }
示例#4
0
 public XmlChatBox(XInt.ChatBox chat, XInt.Style style, XmlUIScene scn) : base(style, scn)
 {
     Positioning = chat;
     ID          = chat.ID;
     ChatBox     = chat;
     Lua         = new LuaChatBox(this);
     renderText  = false;
     font        = scn.Manager.Game.Fonts.GetSystemFont("Arial Unicode MS");
     boldFont    = scn.Manager.Game.Fonts.GetSystemFont("Arial Unicode MS", FontStyles.Bold);
     elem        = Texts.Where((x) => x.ID == chat.DisplayArea).First();
     Visible     = false;
 }
示例#5
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;
        }
示例#6
0
 public XmlUIPanel(XInt.Panel pnl, XInt.Style style, XmlUIScene scene) : this(style, scene)
 {
     Positioning = pnl;
     ID          = pnl.ID;
     if (pnl.Text != null)
     {
         foreach (var t in pnl.Text)
         {
             var f = Texts.FirstOrDefault(x => x.ID == t.Item);
             if (f != null)
             {
                 f.Text = t.Value;
             }
         }
     }
 }
示例#7
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;
 }
示例#8
0
 public XmlUIPanel(XInt.Panel pnl, XInt.Style style, XmlUIScene scene) : this(style, scene)
 {
     Positioning = pnl;
     ID          = pnl.ID;
     if (pnl.Text != null)
     {
         foreach (var t in pnl.Text)
         {
             var f = Texts.FirstOrDefault(x => x.ID == t.Item);
             if (f != null)
             {
                 var txt = scene.Manager.GetString(t.Strid, t.InfocardId, t.Value);
                 if (txt != null)
                 {
                     f.Text = txt;
                 }
             }
         }
     }
 }
示例#9
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);
            }
        }
示例#10
0
 public XmlUIPanel(XInt.Panel pnl, XInt.Style style, XmlUIManager manager) : this(style, manager)
 {
     Positioning = pnl;
     ID          = pnl.ID;
 }