Ejemplo n.º 1
0
		public override void Draw(SpriteBatch spriteBatch) {
			base.Draw(spriteBatch);
			for (int i = 0; i < _categoryButtons.Count; i++) {
				if (_categoryButtons[i].IsMouseHovering) {
					string text;
					switch (i) {
						case 0:
							text = sortMode.ToFriendlyString();
							break;
						case 1:
							text = enabledFilterMode.ToFriendlyString();
							break;
						case 2:
							text = modSideFilterMode.ToFriendlyString();
							break;
						case 3:
							text = searchFilterMode.ToFriendlyString();
							break;
						default:
							text = "None";
							break;
					}
					UICommon.DrawHoverStringInBounds(spriteBatch, text);
					return;
				}
			}
			UILinkPointNavigator.Shortcuts.BackButtonCommand = 1;
		}
Ejemplo n.º 2
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);
            CalculatedStyle innerDimensions = GetInnerDimensions();
            var             drawPos         = new Vector2(innerDimensions.X + 5f + modIconAdjust, innerDimensions.Y + 30f);

            spriteBatch.Draw(dividerTexture, drawPos, null, Color.White, 0f, Vector2.Zero, new Vector2((innerDimensions.Width - 10f - modIconAdjust) / 8f, 1f), SpriteEffects.None, 0f);
            drawPos = new Vector2(innerDimensions.X + 10f + modIconAdjust, innerDimensions.Y + 45f);
            DrawPanel(spriteBatch, drawPos, 85f);
            DrawEnabledText(spriteBatch, drawPos + new Vector2(10f, 5f));
            if (mod.properties.side != ModSide.Server && (mod.Enabled != loaded || configChangesRequireReload))
            {
                drawPos += new Vector2(90f, 5f);
                Utils.DrawBorderString(spriteBatch, configChangesRequireReload ? Language.GetTextValue("tModLoader.ModReloadForced") : Language.GetTextValue("tModLoader.ModReloadRequired"), drawPos, Color.White, 1f, 0f, 0f, -1);
            }
            if (mod.properties.side == ModSide.Server)
            {
                drawPos += new Vector2(90f, -2f);
                spriteBatch.Draw(UICommon.modBrowserIconsTexture, drawPos, new Rectangle(5 * 34, 3 * 34, 32, 32), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
                if (new Rectangle((int)drawPos.X, (int)drawPos.Y, 32, 32).Contains(Main.MouseScreen.ToPoint()))
                {
                    UICommon.DrawHoverStringInBounds(spriteBatch, "This is a server side mod");
                }
            }
            //string text = this.enabled ? "Click to Disable" : "Click to Enable";
            //drawPos = new Vector2(innerDimensions.X + innerDimensions.Width - 150f, innerDimensions.Y + 50f);
            //Utils.DrawBorderString(spriteBatch, text, drawPos, Color.White, 1f, 0f, 0f, -1);
        }
Ejemplo n.º 3
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     base.Draw(spriteBatch);
     UILinkPointNavigator.Shortcuts.BackButtonCommand = 100;
     UILinkPointNavigator.Shortcuts.BackButtonGoto    = this.gotoMenu;
     if (modHomepageButton.IsMouseHovering)
     {
         UICommon.DrawHoverStringInBounds(spriteBatch, url);
     }
 }
Ejemplo n.º 4
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     _tooltip = null;
     base.Draw(spriteBatch);
     if (!string.IsNullOrEmpty(_tooltip))
     {
         var bounds = GetOuterDimensions().ToRectangle();
         bounds.Height += 16;
         UICommon.DrawHoverStringInBounds(spriteBatch, _tooltip, bounds);
     }
 }
Ejemplo n.º 5
0
 protected override void DrawSelf(SpriteBatch spriteBatch)
 {
     base.DrawSelf(spriteBatch);
     if (IsMouseHovering)
     {
         var bounds = Parent.GetDimensions().ToRectangle();
         bounds.Y      = 0;
         bounds.Height = Main.screenHeight;
         UICommon.DrawHoverStringInBounds(spriteBatch, hoverText, bounds);
     }
 }
Ejemplo n.º 6
0
        protected override void DrawChildren(SpriteBatch spriteBatch)
        {
            base.DrawChildren(spriteBatch);

            // show authors on mod title hover, after everything else
            // main.hoverItemName isn't drawn in UI
            if (this.modName.IsMouseHovering && mod.properties.author.Length > 0)
            {
                string text = Language.GetTextValue("tModLoader.ModsByline", mod.properties.author);
                UICommon.DrawHoverStringInBounds(spriteBatch, text);
            }
        }
Ejemplo n.º 7
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);
            CalculatedStyle innerDimensions = GetInnerDimensions();
            var             drawPos         = new Vector2(innerDimensions.X + 5f + _modIconAdjust, innerDimensions.Y + 30f);

            spriteBatch.Draw(UICommon.DividerTexture.Value, drawPos, null, Color.White, 0f, Vector2.Zero, new Vector2((innerDimensions.Width - 10f - _modIconAdjust) / 8f, 1f), SpriteEffects.None, 0f);
            drawPos = new Vector2(innerDimensions.X + 10f + _modIconAdjust, innerDimensions.Y + 45f);

            // TODO: These should just be UITexts
            if (_mod.properties.side != ModSide.Server && (_mod.Enabled != _loaded || _configChangesRequireReload))
            {
                if (_modReferenceIcon != null)
                {
                    drawPos += new Vector2(_uiModStateText.Width.Pixels + _modReferenceIcon.Width.Pixels + PADDING, 0f);
                }
                else
                {
                    drawPos += new Vector2(_uiModStateText.Width.Pixels, 0f);
                }
                Utils.DrawBorderString(spriteBatch, _configChangesRequireReload ? Language.GetTextValue("tModLoader.ModReloadForced") : Language.GetTextValue("tModLoader.ModReloadRequired"), drawPos, Color.White, 1f, 0f, 0f, -1);
            }
            if (_mod.properties.side == ModSide.Server)
            {
                drawPos += new Vector2(90f, -2f);
                spriteBatch.Draw(UICommon.ModBrowserIconsTexture.Value, drawPos, new Rectangle(5 * 34, 3 * 34, 32, 32), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
                if (new Rectangle((int)drawPos.X, (int)drawPos.Y, 32, 32).Contains(Main.MouseScreen.ToPoint()))
                {
                    UICommon.DrawHoverStringInBounds(spriteBatch, Language.GetTextValue("tModLoader.ModIsServerSide"));
                }
            }

            if (_moreInfoButton?.IsMouseHovering == true)
            {
                _tooltip = Language.GetTextValue("tModLoader.ModsMoreInfo");
            }
            else if (_deleteModButton?.IsMouseHovering == true)
            {
                _tooltip = Language.GetTextValue("UI.Delete");
            }
            else if (_modName?.IsMouseHovering == true && _mod?.properties.author.Length > 0)
            {
                _tooltip = Language.GetTextValue("tModLoader.ModsByline", _mod.properties.author);
            }
            else if (_uiModStateText?.IsMouseHovering == true)
            {
                _tooltip = ToggleModStateText;
            }
            else if (_configButton?.IsMouseHovering == true)
            {
                _tooltip = Language.GetTextValue("tModLoader.ModsOpenConfig");
            }
        }
Ejemplo n.º 8
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            tooltip = null;
            base.Draw(spriteBatch);
            for (int i = 0; i < _categoryButtons.Count; i++)
            {
                if (_categoryButtons[i].IsMouseHovering)
                {
                    string text;
                    switch (i)
                    {
                    case 0:
                        text = sortMode.ToFriendlyString();
                        break;

                    case 1:
                        text = enabledFilterMode.ToFriendlyString();
                        break;

                    case 2:
                        text = modSideFilterMode.ToFriendlyString();
                        break;

                    case 3:
                        text = searchFilterMode.ToFriendlyString();
                        break;

                    default:
                        text = "None";
                        break;
                    }
                    UICommon.DrawHoverStringInBounds(spriteBatch, text);
                    return;
                }
            }
            if (!string.IsNullOrEmpty(tooltip))
            {
                Rectangle bounds           = GetDimensions().ToRectangle();
                Vector2   stringDimensions = Main.fontMouseText.MeasureString(tooltip);
                Vector2   vector           = Main.MouseScreen + new Vector2(16f);
                vector.X = System.Math.Min(vector.X, bounds.Right - stringDimensions.X - 16);
                vector.Y = System.Math.Min(vector.Y, bounds.Bottom - 30);

                Rectangle drawDestination           = new Rectangle((int)vector.X, (int)vector.Y, (int)stringDimensions.X, (int)stringDimensions.Y);
                Rectangle backgroundDrawDestination = drawDestination;
                backgroundDrawDestination.Inflate(12, 12);
                Utils.DrawInvBG(spriteBatch, backgroundDrawDestination);

                Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, tooltip, vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f);
            }
            UILinkPointNavigator.Shortcuts.BackButtonCommand = 1;
        }
Ejemplo n.º 9
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            UILinkPointNavigator.Shortcuts.BackButtonCommand = 100;
            UILinkPointNavigator.Shortcuts.BackButtonGoto    = _gotoMenu;

            if (_modHomepageButton.IsMouseHovering)
            {
                UICommon.DrawHoverStringInBounds(spriteBatch, _url);
            }
            if (_fakeDeleteButton.IsMouseHovering)
            {
                UICommon.DrawHoverStringInBounds(spriteBatch, Language.GetTextValue("tModLoader.ModInfoDisableModToDelete"));
            }
        }
Ejemplo n.º 10
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);

            if (IsMouseHovering)
            {
                if (delayedDrawStorage != null)
                {
                    delayedDrawStorage.Invoke(HoverText);
                }
                else
                {
                    var bounds = Parent.GetDimensions().ToRectangle();
                    bounds.Y      = 0;
                    bounds.Height = Main.screenHeight;
                    UICommon.DrawHoverStringInBounds(spriteBatch, HoverText, bounds);
                }
            }
        }