Exemple #1
0
            public static GuiImage GetNewGuiImage(Plugin plugin, string name, Rectangle rectangle, string imgNameOrData, bool raw = false, GuiElement parent = null, Layer layer = Layer.hud, GuiColor panelColor = null, float fadeIn = 0, float fadeOut = 0)
            {
                Layer higherLayer = layer;

                if (parent != null)
                {
                    higherLayer = (Layer)Math.Min((int)layer, (int)parent.Layer);
                }

                return(new GuiImage
                {
                    Name = name,
                    Rectangle = rectangle.WithParent(parent?.Rectangle),
                    Layer = higherLayer,
                    Parent = layers[(int)higherLayer],
                    Color = panelColor,
                    FadeOut = fadeOut,
                    Components =
                    {
                        new CuiRawImageComponent {
                            Color = panelColor?.getColorString() ?? "1 1 1 1",
                            FadeIn = fadeIn,
                            Png = raw?imgNameOrData:PluginInstance.getImageData(plugin, imgNameOrData)
                        },
                        rectangle.WithParent(parent?.Rectangle)
                    }
                });
            }
Exemple #2
0
            public void addImage(string name, CuiRectTransformComponent rectangle, string imgName, string parent = "Hud", GuiColor panelColor = null, float FadeIn = 0, float FadeOut = 0)
            {
                if (string.IsNullOrEmpty(name))
                {
                    name = "image";
                }
                else
                {
                    name = PluginInstance.encodeName(this, name);
                };
                purgeDuplicates(name);

                this.Add(new CuiElement
                {
                    Parent     = PluginInstance.encodeName(this, parent),
                    Name       = name,
                    Components =
                    {
                        new CuiRawImageComponent {
                            Color = (panelColor != null)?panelColor.getColorString():"1 1 1 1", FadeIn = FadeIn, Png = PluginInstance.getImageData(plugin, imgName)
                        },
                        rectangle
                    },
                    FadeOut = FadeOut
                });
            }