Пример #1
0
        public void RenderWidget(double delta)
        {
            DeltaTime = delta;
            if (baseWidget == null)
            {
                textFocusWidget = null;
                return;
            }
            if (game != null && game.Mouse.Wheel != 0)
            {
                OnMouseWheel(game.Mouse.Wheel);
            }
            textFocusWidget            = null;
            RenderContext.DepthEnabled = false;
            var aspect      = ViewportWidth / ViewportHeight;
            var desktopRect = new RectangleF(0, 0, 480 * aspect, 480);

            if (Visible)
            {
                baseWidget.Render(this, desktopRect);
            }
            foreach (var widget in modals)
            {
                widget.Widget.Render(this, desktopRect);
            }
            RenderContext.DepthEnabled = true;
        }
Пример #2
0
 public void AddChild(UiWidget child)
 {
     addRemoves.Enqueue((ctx) =>
     {
         child.ApplyStylesheet(ctx.Data.Stylesheet);
         Children.Add(child);
     });
 }
Пример #3
0
 public void SetWidget(UiWidget widget)
 {
     foreach (var m in modals)
     {
         m.Widget.Dispose();
     }
     modals     = new Stack <ModalState>();
     baseWidget = widget;
 }
Пример #4
0
        public void Update(UiWidget widget, TimeSpan globalTime, int mouseX, int mouseY, bool leftDown)
        {
            GlobalTime = globalTime;
            var inputRatio = 480 / ViewportHeight;

            MouseX        = mouseX * inputRatio;
            MouseY        = mouseY * inputRatio;
            MouseLeftDown = leftDown;
        }
Пример #5
0
 public void SetWidget(UiWidget widget)
 {
     widget.ApplyStylesheet(Data.Stylesheet);
     foreach (var m in modals)
     {
         m.Widget.Dispose();
     }
     modals     = new List <ModalState>();
     baseWidget = widget;
 }
Пример #6
0
        public int OpenModal(UiWidget widget)
        {
            var handle = _h++;

            widget.ApplyStylesheet(Data.Stylesheet);
            modals.Add(new ModalState()
            {
                Widget = widget, Handle = handle
            });
            return(handle);
        }
Пример #7
0
        public void Update(UiWidget widget, double globalTime, int mouseX, int mouseY, bool leftDown)
        {
            GlobalTime = globalTime;
            var inputRatio = 480 / ViewportHeight;

            MouseX        = mouseX * inputRatio;
            MouseY        = mouseY * inputRatio;
            MouseLeftDown = leftDown;
            lua?.DoTimers(globalTime);
            lua?.CallEvent("Update", globalTime);
        }
Пример #8
0
 public void SwapModal(UiWidget widget, int handle)
 {
     widget.ApplyStylesheet(Data.Stylesheet);
     for (int i = 0; i < modals.Count; i++)
     {
         if (modals[i].Handle == handle)
         {
             modals[i].Widget = widget;
             break;
         }
     }
 }
 public UiFullState SetWidget(UiWidget widget)
 {
     foreach (var m in modals)
     {
         m.Widget.Dispose();
     }
     modals     = new Stack <ModalState>();
     baseWidget = widget;
     fullState  = new UiFullState()
     {
         Widget = baseWidget,
         Modals = modals
     };
     return(fullState);
 }
        public void RenderWidget()
        {
            if (baseWidget == null)
            {
                return;
            }
            textFocusWidget          = null;
            RenderState.DepthEnabled = false;
            mode2d = false;
            var aspect      = ViewportWidth / ViewportHeight;
            var desktopRect = new RectangleF(0, 0, 480 * aspect, 480);

            baseWidget.Render(this, desktopRect);
            foreach (var widget in modals.Reverse())
            {
                widget.Widget.Render(this, desktopRect);
            }
            if (mode2d)
            {
                Renderer2D.Finish();
            }
            RenderState.DepthEnabled = true;
        }
Пример #11
0
 public void AddChild(UiWidget child)
 {
     Children.Add(child);
 }
Пример #12
0
 public void RemoveChild(UiWidget child)
 {
     addRemoves.Enqueue((x) => { Children.Remove(child); });
 }
Пример #13
0
 public void SwapModal(UiWidget widget, int handle) => c.uiContext.SwapModal(widget, handle);
Пример #14
0
 public int OpenModal(UiWidget widget) => c.uiContext.OpenModal(widget);
Пример #15
0
 public void SetWidget(UiWidget widget) => c.uiContext.SetWidget(widget);
Пример #16
0
 internal void SetTextFocus(UiWidget widget) => textFocusWidget = widget;
 public void SetFullState(UiFullState ctx)
 {
     modals     = ctx.Modals;
     baseWidget = ctx.Widget;
     fullState  = ctx;
 }