Exemplo n.º 1
0
        internal void InitWithUIResource(UIResource resource)
        {
            ClearComponents();

             for (int i = 0; i < resource.Labels.Count; i++)
             {
            WinWarCS.Data.Resources.UIResource.UIEntry me = resource.Labels[i];

            UILabel label = new UILabel(me.Text);
            label.X = (int)me.X;
            label.Y = (int)me.Y;
            label.TextAlign = (TextAlignHorizontal)me.Alignment;
            AddComponent(label);
             }

             for (int i = 0; i < resource.Elements.Count; i++)
             {
            WinWarCS.Data.Resources.UIResource.UIEntry me = resource.Elements[i];

            if (me.Type == UIResource.UIEntryType.ValueList)
            {
               UILabel lbl = new UILabel(me.Values[0]);
               lbl.X = (int)(me.X);
               lbl.Y = (int)(me.Y);
               lbl.TextAlign = (TextAlignHorizontal)me.Alignment;
               AddComponent(lbl);
            }
            else
            {
               UIButton btn = new UIButton(me.Text, me.ButtonReleasedResourceIndex, me.ButtonPressedResourceIndex);
               btn.X = (int)(me.X);
               btn.Y = (int)(me.Y);
               AddComponent(btn);
            }
             }
        }
Exemplo n.º 2
0
        internal static UIWindow FromUIResource(UIResource resource)
        {
            UIWindow wnd = new UIWindow();
             wnd.InitWithUIResource (resource);

             return wnd;
        }