Exemple #1
0
 public void Open(UIBox2?box = null)
 {
     if (GameController.OnGodot)
     {
         SceneControl.Call("popup", box?.Convert());
     }
 }
Exemple #2
0
        public void DrawStyleBox(StyleBox styleBox, UIBox2 box)
        {
            if (!GameController.OnGodot)
            {
                return;
            }

            CheckDisposed();
            styleBox.GodotStyleBox.Draw(Item, box.Convert());
        }
 public void Draw(DrawingHandleScreen handle, UIBox2 box)
 {
     if (GameController.OnGodot)
     {
         GodotStyleBox.Draw(handle.Item, box.Convert());
     }
     else
     {
         DoDraw(handle, box);
     }
 }
Exemple #4
0
 public void DrawTextureRect(Texture texture, UIBox2 rect, bool tile, Color?modulate = null,
                             bool transpose = false, Texture normalMap = null)
 {
     CheckDisposed();
     if (_renderHandle != null)
     {
         _renderHandle.DrawTextureRect(texture, rect.TopLeft, rect.BottomRight, modulate, _handleId);
     }
     else if (Item != null)
     {
         texture.GodotTexture.DrawRect(Item, rect.Convert(), tile, modulate?.Convert(), transpose, normalMap);
     }
 }
        public void DrawTextureRectRegion(Texture texture, UIBox2 rect, UIBox2 subRegion, Color?modulate = null)
        {
            CheckDisposed();
            var actualModulate = (modulate ?? Color.White) * Modulate;

            if (_renderHandle != null)
            {
                _renderHandle.DrawTextureRect(texture, rect.TopLeft, rect.BottomRight, actualModulate, subRegion, _handleId);
            }
            else if (Item != null)
            {
                texture.GodotTexture.DrawRect(Item, rect.Convert(), false, actualModulate.Convert());
            }
        }
Exemple #6
0
 public void DrawRect(UIBox2 rect, Color color, bool filled = true)
 {
     CheckDisposed();
     if (filled)
     {
         VS.CanvasItemAddRect(Item, rect.Convert(), color.Convert());
     }
     else
     {
         DrawLine(rect.TopLeft, rect.TopRight, color);
         DrawLine(rect.TopRight, rect.BottomRight, color);
         DrawLine(rect.BottomRight, rect.BottomLeft, color);
         DrawLine(rect.BottomLeft, rect.TopLeft, color);
     }
 }
        public void DrawStyleBox(StyleBox styleBox, UIBox2 box)
        {
            if (styleBox == null)
            {
                throw new ArgumentNullException(nameof(styleBox));
            }

            CheckDisposed();
            if (GameController.OnGodot)
            {
                styleBox.GodotStyleBox.Draw(Item, box.Convert());
            }
            else
            {
                styleBox.Draw(this, box);
            }
        }
Exemple #8
0
        public void Open(UIBox2?box = null)
        {
            if (GameController.OnGodot)
            {
                SceneControl.Call("popup", box?.Convert());
            }
            else
            {
                if (box != null)
                {
                    Position = box.Value.TopLeft;
                    Size     = box.Value.Size;
                }

                Visible = true;
            }
        }
Exemple #9
0
        public void Open(UIBox2?box = null)
        {
            if (GameController.OnGodot)
            {
                SceneControl.Call("popup", box?.Convert());
            }
            else
            {
                if (box != null)
                {
                    Position = box.Value.TopLeft;
                    Size     = box.Value.Size;
                }

                Visible = true;
                UserInterfaceManagerInternal.PushModal(this);
            }
        }
Exemple #10
0
        public AtlasTexture(Texture texture, UIBox2 subRegion)
        {
            DebugTools.Assert(SubRegion.Right < texture.Width);
            DebugTools.Assert(SubRegion.Bottom < texture.Height);
            DebugTools.Assert(SubRegion.Left >= 0);
            DebugTools.Assert(SubRegion.Top >= 0);

            if (GameController.OnGodot)
            {
                GodotTexture = new Godot.AtlasTexture
                {
                    Atlas  = texture,
                    Region = subRegion.Convert()
                };
            }

            SubRegion     = subRegion;
            SourceTexture = texture;
        }
 public void DrawRect(UIBox2 rect, Color color, bool filled = true)
 {
     CheckDisposed();
     color *= Modulate;
     if (filled)
     {
         if (_renderHandle != null)
         {
             _renderHandle.DrawTextureRect(Texture.White, rect.TopLeft, rect.BottomRight, color, null, _handleId);
         }
         else if (Item != null)
         {
             VS.CanvasItemAddRect(Item, rect.Convert(), color.Convert());
         }
     }
     else
     {
         DrawLine(rect.TopLeft, rect.TopRight, color);
         DrawLine(rect.TopRight, rect.BottomRight, color);
         DrawLine(rect.BottomRight, rect.BottomLeft, color);
         DrawLine(rect.BottomLeft, rect.TopLeft, color);
     }
 }
Exemple #12
0
 public void Open(UIBox2?box = null)
 {
     SceneControl.Popup_(box?.Convert());
 }
Exemple #13
0
 public void SetItemIconRegion(int idx, UIBox2 region)
 {
     SceneControl.SetItemIconRegion(idx, region.Convert());
 }
Exemple #14
0
 public void DrawTextureRect(Texture texture, UIBox2 rect, bool tile, Color?modulate = null,
                             bool transpose = false, Texture normalMap = null)
 {
     CheckDisposed();
     texture.GodotTexture.DrawRect(Item, rect.Convert(), tile, modulate?.Convert(), transpose, normalMap);
 }
Exemple #15
0
 public void DrawStyleBox(StyleBox styleBox, UIBox2 box)
 {
     CheckDisposed();
     styleBox.GodotStyleBox.Draw(Item, box.Convert());
 }