예제 #1
0
        public int DrawItem(UIItem i, int y, int lc = 0)
        {
            int dx = lc * 25 + 15;

            if ((WidY + y) > WidY)
            {
                if (sy < 0)
                {
                    sy = y;
                }
            }
            if ((WidY + y) < WidY + WidH)
            {
                ey = y;
            }
            UISys.Skin().DrawBoxText((int)WidX + dx, (int)WidY + y, i.Name);
            UIPatch p = new UIPatch
            {
                X      = (int)WidX + dx - 8,
                Y      = (int)WidY + y + 4,
                W      = (int)WidW,
                H      = (int)25,
                Action = () =>
                {
                    Select(i);
                }
            };

            AddPatch(p);


            return(y + 25);
        }
예제 #2
0
        public UIMenuItem AddItem(string text)
        {
            int xs = 0;

            foreach (var i in Sub)
            {
                xs += (int)i.WidW + 5;
                // i.WidW = UISys.Skin().SmallFont.Width(i.Name) + 5;
                //i.WidH = 25;
            }

            UIMenuItem ni = new UIMenuItem(text, null, true)
            {
                WidX = (int)0,

                WidW = UISys.Skin().SmallFont.Width(text) + 10,
                WidH = 22
            };
            UIPanel np = new UIPanel(10 + xs, 2, (int)ni.WidW, 22, "", this);

            np.Flat = true;
            np.AddWidget(ni);


            return(ni);
        }
예제 #3
0
        private void Del()
        {
            if (Name.Length == 0)
            {
                UISys.Skin().EOESound();
                return;
            }

            if (Name.Length == 1)
            {
                UISys.Skin().TypeSound();
                Name      = "";
                CarrotPos = 0;
                return;
            }
            if (CarrotPos < Name.Length)
            {
                Name = Name.Substring(0, CarrotPos - 1) + Name.Substring(CarrotPos);
                CarrotPos--;
                UISys.Skin().TypeSound();
            }
            else
            {
                Name = Name.Substring(0, Name.Length - 1);
                CarrotPos--;
                UISys.Skin().TypeSound();
            }
            if (CarrotPos < 0)
            {
                CarrotPos = 0;
            }
        }
예제 #4
0
        public override void Draw()
        {
            UISys.Skin().DrawBox((int)WidX, (int)WidY, (int)WidW, (int)WidH);
            string nt = Name;

            if (CarrotOn && CarrotDraw)
            {
                if (Name.Length == 0)
                {
                    nt = "|";
                }
                else
                {
                    if (Name.Length == 1)
                    {
                        if (CarrotPos == 0)
                        {
                            nt = "|" + nt;
                        }
                        else
                        {
                            nt = nt + "|";
                        }
                    }
                    else
                    {
                        nt = nt.Substring(0, CarrotPos) + "|" + nt.Substring(CarrotPos);
                    }
                }
            }
            UISys.Skin().DrawBoxText((int)WidX + 3, (int)WidY + 3, nt);
        }
예제 #5
0
        public override void AppResize(int w, int h)
        {
            int ys = 10;
            int mw = -5;

            if (Sub.Count > 0)
            {
                if (Sub[0].Sub.Count > 0)
                {
                    foreach (var i in Sub[0].Sub)
                    {
                        var sw = UISys.Skin().SmallFont.Width(i.Name) + 5;
                        if (sw > mw)
                        {
                            mw = sw;
                        }
                        i.WidY = ys;
                        ys    += 25;
                    }
                }
            }
            if (subp != null)
            {
                subp.WidH = ys;
                subp.WidW = mw;
            }
            base.Resized();
        }
예제 #6
0
        public UIMenuItem AddItem(string text)
        {
            int ys = 15;

            if (subp != null)
            {
                foreach (var i in Sub[0].Sub)
                {
                    ys += 25;
                }
            }

            UIMenuItem ni = new UIMenuItem(text, subp, false)
            {
                WidY = ys,
                WidW = UISys.Skin().SmallFont.Width(text) + 5,
                WidH = 25
            };

            if (ni.WidY < 25)
            {
                ni.WidY = 25;
            }

            AppResize(App.AppInfo.W, App.AppInfo.H);
            return(ni);
        }
예제 #7
0
 public override void OnMouseDown(UIMouseButton b)
 {
     lx    = VInput.MX;
     ly    = VInput.MY;
     State = ButState.Press;
     UISys.Skin().ClickSound();
 }
예제 #8
0
        private void Add(string k)
        {
            UISys.Skin().TypeSound();
            if (Name.Length == 0)
            {
                Name      = k;
                CarrotPos = 1;

                return;
            }
            if (CarrotPos == Name.Length)
            {
                Name += k;
                CarrotPos++;

                return;
            }
            if (Name.Length == 1 && CarrotPos == 1)
            {
                Name += k;
                CarrotPos++;
                return;
            }
            if (CarrotPos == 0)
            {
                Name = k + Name;
                CarrotPos++;
                return;
            }
            Name = Name.Substring(0, CarrotPos) + k + Name.Substring(CarrotPos);
            CarrotPos++;
        }
예제 #9
0
 public override void Draw()
 {
     if (Img == null)
     {
         return;
     }
     UISys.Skin().DrawImg((int)WidX, (int)WidY, (int)WidW, (int)WidH, Img);
 }
예제 #10
0
 public override void Draw()
 {
     UISys.Skin().DrawWindow(this);
     // UISys.Skin().DrawRect((int)WidX + (int)WidW - 15, (int)WidY + (int)WidH - 15, 15, 15,DragCol);
     //  UISys.Skin().DrawRect((int)WidX, (int)WidY+UISys.Skin().TitleHeight + 1, 10, (int)WidH - UISys.Skin().TitleHeight - 2,DragCol);
     //   UISys.Skin().DrawRect((int)WidX, (int)WidY+(int)WidH - 10, (int)WidW - 15, 10,DragCol);
     //     UISys.Skin().DrawRect((int)WidX + (int)WidW - 10, (int)WidY + UISys.Skin().TitleHeight + 1, 10, (int)WidH - UISys.Skin().TitleHeight - 16,DragCol);
 }
예제 #11
0
        public UIWindow(int x, int y, int w, int h, string title, UIWidget top = null) : base(x, y, w, h, title, top)
        {
            titleDrag = new UIDragZone(0, 0, (int)WidW, UISys.Skin().TitleHeight, this);
            sizeDrag  = new UIDragZone((int)WidW - 15, (int)WidH - 15, 15, 15, this);
            botDrag   = new UIDragZone(0, (int)WidH - 10, (int)WidW - 15, 10, this);
            rightDrag = new UIDragZone((int)WidW - 10, UISys.Skin().TitleHeight + 1, 10, (int)WidH - 15 - UISys.Skin().TitleHeight, this);
            leftDrag  = new UIDragZone(0, UISys.Skin().TitleHeight + 1, 10, (int)WidH - UISys.Skin().TitleHeight - 2, this);

            EnableScissorTest = true;
        }
예제 #12
0
 public override void Draw()
 {
     if (over == false)
     {
         UISys.Skin().DrawText((int)WidX, (int)WidY, Name, new OpenTK.Vector4(0.2f, 0.2f, 0.2f, 1.0f));
     }
     else
     {
         UISys.Skin().DrawText((int)WidX, (int)WidY, Name, new OpenTK.Vector4(0.95f, 0.95f, 0.95f, 1.0f));
     }
 }
예제 #13
0
        public override void AppResize(int w, int h)
        {
            int xs = 0;

            foreach (var i in Sub)
            {
                i.WidW = UISys.Skin().SmallFont.Width(i.Sub[0].Name) + 5;
                i.WidH = 25;
                i.WidX = 10 + xs;
                xs    += UISys.Skin().SmallFont.Width(i.Sub[0].Name) + 5;
            }
        }
예제 #14
0
 public override void Resized()
 {
     titleDrag.WidW = WidW;
     sizeDrag.LocX  = WidW - 15;
     sizeDrag.LocY  = WidH - 15;
     botDrag.WidW   = WidW - 15;
     botDrag.LocY   = WidH - 10;
     rightDrag.LocX = WidW - 10;
     rightDrag.WidH = WidH - 15 - UISys.Skin().TitleHeight;
     leftDrag.WidH  = WidH - UISys.Skin().TitleHeight - 2;
     //Console.WriteLine("Resized!");
 }
예제 #15
0
 public override void KeyBackSpace()
 {
     if (Name.Length > 1)
     {
         //Name = Name.Substring(0, Name.Length - 1);
         Del();
     }
     else
     {
         UISys.Skin().EOESound();
         Name = "";
     }
 }
예제 #16
0
 public override void Draw()
 {
     if (State == ButState.Press)
     {
         if (Dragged != null)
         {
             Dragged(VInput.MX - lx, VInput.MY - ly);
             lx = VInput.MX;
             ly = VInput.MY;
         }
     }
     UISys.Skin().DrawButton(this);
 }
예제 #17
0
 public override void Draw()
 {
     VFontRenderer.Draw(UISys.Skin().SmallFont, Name, WidX + 5, WidY + 5, new OpenTK.Vector4(1, 1, 1, 1));
     if (WinOver == false)
     {
         VPen.Rect(WidX, WidY, WidW, 50, new OpenTK.Vector4(0, 0, 0.5f, 0.1f));
     }
     else
     {
         VPen.Rect(WidX, WidY, WidW, 50, new OpenTK.Vector4(0, 0, 0.5f, 0.35f));
         if (StarEngine.Input.VInput.MB[0] == false && UISys.ActiveWindow.Docked == false)
         {
             DockWin();
         }
     }
 }
예제 #18
0
        public override void Draw()
        {
            Patches.Clear();
            UISys.Skin().DrawBox((int)WidX, (int)WidY, (int)WidW, (int)WidH);
            UISys.Skin().DrawBoxText((int)(WidX + WidW / 2 - UISys.Skin().SmallFont.Width(Name) / 2), (int)WidY + 8, Name);
            int oy = Scroll.Current;
            int dy = 25 - oy;

            sy = -1;
            ey = -1;
            foreach (var i in ItemRoot.Sub)
            {
                dy = DrawItem(i, dy);
            }
            Scroll.Max   = (dy + oy);
            Scroll.ViewH = (ey - sy);
            Scroll.Rebuild();
        }
예제 #19
0
        public override void KeyDel()
        {
            if (Name.Length == 0)
            {
                CarrotPos = 0;
                UISys.Skin().EOESound();
                return;
            }
            if (CarrotPos == 0)
            {
                if (Name.Length > 0)
                {
                    Name = Name.Substring(1);
                    UISys.Skin().TypeSound();

                    return;
                }
                return;
            }
            if (CarrotPos < Name.Length)
            {
                if (CarrotPos + 1 <= Name.Length)
                {
                    Name = Name.Substring(0, CarrotPos) + Name.Substring(CarrotPos + 1);
                    UISys.Skin().TypeSound();
                }
                else
                {
                    UISys.Skin().EOESound();
                }
            }
            else
            {
                UISys.Skin().EOESound();
            }
        }
예제 #20
0
 public override void Draw()
 {
     UISys.Skin().DrawPanel(this);
 }
예제 #21
0
 public override void Draw()
 {
     WidH = 25;
     UISys.Skin().DrawRect(0, 0, (int)WidW, (int)WidH, new OpenTK.Vector4(0.6f, 0.6f, 0.6f, 0.8f));
 }
예제 #22
0
        public int DrawItem(UIItem i, int y, int lc = 0)
        {
            if (y > 0 || y < WidH)
            {
                int dx = lc * 25 + 15;

                if (i.Open)
                {
                    UISys.Skin().DrawLine((int)WidX + dx - 10, (int)WidY + y + 12, (int)WidX + dx - 4, (int)WidY + y + 12, new OpenTK.Vector4(1, 0.3f, 0.3f, 1.0f));
                }
                else
                {
                    UISys.Skin().DrawLine((int)WidX + dx - 7, (int)WidY + y + 6, (int)WidX + dx - 7, (int)WidY + y + 18, new OpenTK.Vector4(1, 0.3f, 0.3f, 1.0f));
                    UISys.Skin().DrawLine((int)WidX + dx - 10, (int)WidY + y + 12, (int)WidX + dx - 4, (int)WidY + y + 12, new OpenTK.Vector4(1, 0.3f, 0.3f, 1.0f));
                }
                if ((WidY + y) > WidY)
                {
                    if (sy < 0)
                    {
                        sy = y;
                    }
                }
                if ((WidY + y) < WidY + WidH)
                {
                    ey = y;
                }
                UISys.Skin().DrawBoxText((int)WidX + dx, (int)WidY + y, i.Name);
                UIPatch p = new UIPatch
                {
                    X = (int)WidX + dx - 8,
                    Y = (int)WidY + y + 4,
                    W = (int)WidW,
                    H = (int)25
                };
                if ((p.X + p.W) > WidX + WidW)
                {
                    p.W = (int)WidW - (p.X - (int)WidX);
                }
                p.Action = () =>
                {
                    if (i.Open)
                    {
                        i.Open = false;
                    }
                    else
                    {
                        i.Open = true;
                        Open(i);
                    }
                };
                AddPatch(p);
            }
            if (i.Open)
            {
                y += 25;

                int ny = y;
                foreach (var si in i.Sub)
                {
                    y  = DrawItem(si, y, lc + 1);
                    y += 25;
                }
            }
            return(y);
        }
예제 #23
0
 public override void Draw()
 {
     UISys.Skin().DrawText((int)WidX, (int)WidY, Name);
 }