Esempio n. 1
0
        public virtual void Update(GameTime gameTime)
        {
            Widgets.Update(gameTime);

            var mousePos = MouseManager.GetMousePosition();

            for (var i = 0; i < Widgets.Widgets.Count; i++)
            {
                var widget = Widgets.Widgets[i];

                if (widget.PointInsideWidget(mousePos - Position) && widget.Tooltip.Length > 0)
                {
                    PUITooltipManager.SetActiveTooltip(widget.Tooltip);
                }
            }
        }
Esempio n. 2
0
        } // pointInsideWidget

        public void SetTooltip(string name, string text, bool enableImages = false)
        {
            Tooltip = name;
            PUITooltipManager.AddTextTooltip(name, text, enableImages: enableImages);
        }
Esempio n. 3
0
        public void LoadStandardXML()
        {
            Name = GetXMLAttribute("Name").Value;

            var valueX = GetXMLElement("Position", "X").Value;

            if (valueX.ToUpper() == "CENTER")
            {
                _positionFlags.CenterX = true;
            }
            else if (valueX.ToUpper() == "LEFT")
            {
                _positionFlags.AnchorLeft = true;
            }
            else if (valueX.ToUpper() == "RIGHT")
            {
                _positionFlags.AnchorRight = true;
            }
            else
            {
                _positionFlags.SetX = int.Parse(valueX);
            }

            var valueY = GetXMLElement("Position", "Y").Value;

            if (valueY.ToUpper() == "CENTER")
            {
                _positionFlags.CenterY = true;
            }
            else if (valueY.ToUpper() == "TOP")
            {
                _positionFlags.AnchorTop = true;
            }
            else if (valueY.ToUpper() == "BOTTOM")
            {
                _positionFlags.AnchorBottom = true;
            }
            else
            {
                _positionFlags.SetY = int.Parse(valueY);
            }

            UpdatePositionFromFlags();

            var offsetElement = GetXMLElement("Offset");

            if (offsetElement != null)
            {
                _offset.X = int.Parse(GetXMLElement("Offset", "X").Value);
                _offset.Y = int.Parse(GetXMLElement("Offset", "Y").Value);
            }

            var sizeElement = GetXMLElement("Size");

            if (sizeElement != null)
            {
                Width  = int.Parse(GetXMLElement("Size", "Width").Value);
                Height = int.Parse(GetXMLElement("Size", "Height").Value);
            }

            DrawOrder = GetXMLAttribute("DrawOrder") == null ? 0 : int.Parse(GetXMLAttribute("DrawOrder").Value);
            Visible   = (GetXMLAttribute("Visible") != null ? Convert.ToBoolean(GetXMLAttribute("Visible").Value) : true);
            Active    = (GetXMLAttribute("Active") != null ? Convert.ToBoolean(GetXMLAttribute("Active").Value) : true);
            Tooltip   = GetXMLAttribute("Tooltip") == null ? "" : GetXMLAttribute("Tooltip").Value;

            var enableTooltipImages = (GetXMLAttribute("EnableTooltipImages") != null ? Convert.ToBoolean(GetXMLAttribute("EnableTooltipImages").Value) : false);

            if (Tooltip.Length > 0 && (GetXMLAttribute("TextTooltip") == null || Convert.ToBoolean(GetXMLAttribute("TextTooltip").Value) == true))
            {
                PUITooltipManager.AddTextTooltip(Tooltip, Tooltip, enableImages: enableTooltipImages);
            }

            if (PandaMonogameConfig.Logging)
            {
                Console.WriteLine("New widget " + Name + " [type:" + this.GetType().Name + "] [active:" + Active + "] [visible:" + Visible + "]");
            }
        } // loadStandardXML