protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dims = base.GetDimensions(); Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); if (this.ContainsPoint(MousePosition)) { Main.LocalPlayer.mouseInterface = true; } Stand stand = TBARPlayer.Get().PlayerStand; bool existsAndMatches = stand != null && stand.StandName == StandDisplayName; Texture2D texture = existsAndMatches ? Textures.StandCardCurrent : Textures.StandCard; spriteBatch.Draw(texture, dims.Position(), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); /*if (!Unlocked) * { * spriteBatch.Draw(Textures.Instance.SCUnknown, dims.Position() + new Vector2(70), null, Color.White, 0f, new Vector2(Textures.SCUnknown.Width / 2, Textures.SCUnknown.Height / 2), 1f, SpriteEffects.None, 1f); * Utils.DrawBorderString(spriteBatch, "???", dims.Position() + new Vector2(56, 160), Color.White); * } * * if (Unlocked) * {*/ Vector2 anchor = dims.Position() + new Vector2(16, 160); spriteBatch.Draw(Idle.SpriteSheet, dims.Position() + new Vector2(70), Idle.FrameRect, Color.White, 0f, Idle.FrameCenter, 1f, SpriteEffects.FlipHorizontally, 1f); Utils.DrawBorderString(spriteBatch, StandDisplayName, anchor, Color.White, 1); //} }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = base.GetDimensions(); //spriteBatch.Draw(this._texture, dimensions.Position(), Color.White * (base.IsMouseHovering ? this._visibilityActive : this._visibilityInactive)); spriteBatch.Draw(backgroundTexture, dimensions.Position(), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); //Texture2D texture2D = Main.itemTexture[this.item.type]; Rectangle rectangle2; if (Main.itemAnimations[id] != null) { rectangle2 = Main.itemAnimations[id].GetFrame(_texture); } else { rectangle2 = _texture.Frame(1, 1, 0, 0); } float num = 1f; float num2 = (float)backgroundTexture.Width * scale; if ((float)rectangle2.Width > num2 || (float)rectangle2.Height > num2) { if (rectangle2.Width > rectangle2.Height) { num = num2 / (float)rectangle2.Width; } else { num = num2 / (float)rectangle2.Height; } } Vector2 drawPosition = dimensions.Position(); drawPosition.X += (float)backgroundTexture.Width * scale / 2f - (float)rectangle2.Width * num / 2f; drawPosition.Y += (float)backgroundTexture.Height * scale / 2f - (float)rectangle2.Height * num / 2f; item.GetColor(Color.White); Color alphaColor = item.GetAlpha(Color.White); Color colorColor = item.GetColor(Color.White); //spriteBatch.Draw(_texture, drawPosition, new Rectangle?(rectangle2), this.item.GetAlpha(Color.White), 0f, Vector2.Zero, num, SpriteEffects.None, 0f); spriteBatch.Draw(_texture, drawPosition, new Rectangle?(rectangle2), alphaColor, 0f, Vector2.Zero, num, SpriteEffects.None, 0f); if (this.item.color != Color.Transparent) { spriteBatch.Draw(_texture, drawPosition, new Rectangle?(rectangle2), colorColor, 0f, Vector2.Zero, num, SpriteEffects.None, 0f); } //if (this.item.stack > 1) //{ // spriteBatch.DrawString(Main.fontItemStack, this.item.stack.ToString(), new Vector2(dimensions.Position().X + 10f * scale, dimensions.Position().Y + 26f * scale), Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); //} if (IsMouseHovering) { //Main.toolTip = item.Clone(); Main.hoverItemName = item.Name; //ItemChecklistUI.hoverText = item.name + (item.modItem != null ? " [" + item.modItem.mod.Name + "]" : ""); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dims = base.GetDimensions(); Vector2 MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY); if (this.ContainsPoint(MousePosition)) { Main.LocalPlayer.mouseInterface = true; } Texture2D texture = TBAPlayer.Get().Stand.StandName == StandDisplayName ? Textures.SCCurrent : Textures.StandCard; spriteBatch.Draw(texture, dims.Position(), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); if (!Unlocked) { spriteBatch.Draw(Textures.SCUnknown, dims.Position() + new Vector2(70), null, Color.White, 0f, new Vector2(Textures.SCUnknown.Width / 2, Textures.SCUnknown.Height / 2), 1f, SpriteEffects.None, 1f); Utils.DrawBorderString(spriteBatch, "???", dims.Position() + new Vector2(56, 160), Color.White); } if (Unlocked) { Vector2 anchor = dims.Position() + new Vector2(16, 160); spriteBatch.Draw(Idle.SpriteSheet, dims.Position() + new Vector2(70), Idle.FrameRect, Color.White, 0f, Idle.DrawOrigin, 1f, SpriteEffects.None, 1f); Utils.DrawBorderString(spriteBatch, StandDisplayName, anchor, Color.White, 1); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = GetDimensions(); spriteBatch.Draw(Main.magicPixel, dimensions.Position(), null, Color.Black, 0f, Vector2.Zero, new Vector2(dimensions.Width, dimensions.Height / 1000f), SpriteEffects.None, 0f); spriteBatch.Draw(gradTexture, dimensions.Position() + new Vector2(2, 2), null, Color.White, 0f, Vector2.Zero, new Vector2((dimensions.Width - 4f) / gradTexture.Width, (dimensions.Height - 4f) / gradTexture.Height), SpriteEffects.None, 0f); }
protected override void DrawSelf(SpriteBatch spriteBatch) { base.DrawSelf(spriteBatch); if (Ability != null) { CalculatedStyle dims = base.GetDimensions(); Effect effect = DoTariaMod.Instance.GetEffect("Effects/ProgressBar"); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, effect, Main.UIScaleMatrix); effect.Parameters["uSourceRect"].SetValue(new Vector4(0, 0, 34, 34)); effect.Parameters["uImageSize0"].SetValue(new Vector2(34, 34)); effect.Parameters["uRotation"].SetValue(3f); effect.Parameters["uDirection"].SetValue(-1f); effect.Parameters["uSaturation"].SetValue(Percent); effect.CurrentTechnique.Passes[0].Apply(); spriteBatch.Draw(_cooldownTexture, dims.Position(), new Rectangle(0, 0, 32, 32), Color.White * 0.85f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.UIScaleMatrix); if (Seconds > 0.0f) { Utils.DrawBorderString(spriteBatch, Seconds.ToString(), dims.Position() + new Vector2(12, 7) - new Vector2(2 * (Seconds.ToString().Length - 1), 0), Color.White, 1); } Texture2D unleveled = DoTariaMod.Instance.GetTexture("UserInterfaces/Abilities/AbilityUnlevel"), leveled = DoTariaMod.Instance.GetTexture("UserInterfaces/Abilities/AbilityLevel"); float spacing = 0; if (Ability.MaxLevel != 0) { spacing = 32 / Ability.MaxLevel; } if (Ability.MaxLevel > 0) { for (int i = 0; i < Ability.MaxLevel; i++) { spriteBatch.Draw(unleveled, dims.Position() + new Vector2(spacing * 0.5f + spacing * i, 34 + 4), null, Color.White, 0f, Vector2.Zero, 1.5f, SpriteEffects.None, 1f); } for (int i = 0; i < CurrentLevel; i++) { spriteBatch.Draw(leveled, dims.Position() + new Vector2(spacing * 0.5f + spacing * i, 34 + 4), null, Color.White, 0f, Vector2.Zero, 1.5f, SpriteEffects.None, 1f); } } if (IsMouseHovering) { DrawDescription(spriteBatch, Ability); } } }
protected override void DrawSelf(SpriteBatch spriteBatch) { if (texture == null) { return; } CalculatedStyle dimensions = base.GetInnerDimensions(); Rectangle rectangle = dimensions.ToRectangle(); spriteBatch.Draw(backgroundTexture, dimensions.Position(), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); if (selected) { spriteBatch.Draw(selectedTexture, dimensions.Position(), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); } int height = texture.Height; int width = texture.Width; float drawScale = 1f; // larger, uncomment below float availableWidth = (float)backgroundTexture.Width * scale; if (width /** drawScale*/ > availableWidth || height /** drawScale*/ > availableWidth) { if (width > height) { drawScale = availableWidth / width; } else { drawScale = availableWidth / height; } } drawScale *= scale; Vector2 vector = backgroundTexture.Size() * scale; Vector2 position2 = dimensions.Position() + vector / 2f - texture.Size() * drawScale / 2f; //Vector2 origin = texture.Size() * (1f / 2f - 0.5f); spriteBatch.Draw(texture, position2, null, Color.White, 0f, Vector2.Zero, drawScale, SpriteEffects.None, 0f); if (IsMouseHovering) { string tileName = Lang.GetMapObjectName(MapHelper.TileToLookup(tile, 0)); if (tileName == "") { if (tile < TileID.Count) { tileName = $"Tile {tile}"; } else { tileName = Terraria.ModLoader.TileLoader.GetTile(tile).Name + " (err no entry)"; } } Main.hoverItemName = tileName; } }
protected override void DrawSelf(SpriteBatch spriteBatch) { if (item != null) { CalculatedStyle dimensions = base.GetInnerDimensions(); Rectangle rectangle = dimensions.ToRectangle(); spriteBatch.Draw(backgroundTexture, dimensions.Position(), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); Texture2D itemTexture = Main.itemTexture[this.item.type]; Rectangle rectangle2; if (Main.itemAnimations[item.type] != null) { rectangle2 = Main.itemAnimations[item.type].GetFrame(itemTexture); } else { rectangle2 = itemTexture.Frame(1, 1, 0, 0); } int height = rectangle2.Height; int width = rectangle2.Width; float drawScale = 2f; float availableWidth = (float)backgroundTexture.Width * scale; if (width * drawScale > availableWidth || height * drawScale > availableWidth) { if (width > height) { drawScale = availableWidth / width; } else { drawScale = availableWidth / height; } } Vector2 drawPosition = dimensions.Position(); drawPosition.X += backgroundTexture.Width * scale / 2f - (float)width * drawScale / 2f; drawPosition.Y += backgroundTexture.Height * scale / 2f - (float)height * drawScale / 2f; this.item.GetColor(Color.White); spriteBatch.Draw(itemTexture, drawPosition, rectangle2, this.item.GetAlpha(Color.White), 0f, Vector2.Zero, drawScale, SpriteEffects.None, 0f); if (this.item.color != default(Color)) { spriteBatch.Draw(itemTexture, drawPosition, new Rectangle?(rectangle2), this.item.GetColor(Color.White), 0f, Vector2.Zero, drawScale, SpriteEffects.None, 0f); } if (this.item.stack > 1) { spriteBatch.DrawString(Main.fontItemStack, this.item.stack.ToString(), new Vector2(drawPosition.X + 10f * scale, drawPosition.Y + 26f * scale), Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); } if (IsMouseHovering) { Main.HoverItem = item.Clone(); Main.HoverItem.SetNameOverride(Main.HoverItem.Name + (Main.HoverItem.modItem != null ? " [" + Main.HoverItem.modItem.mod.Name + "]" : "")); } } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = base.GetDimensions(); spriteBatch.Draw(this._texture, dimensions.Position() + this._texture.Size() * (1f - this.ImageScale) / 2f, null, ImageColour, 0f, Vector2.Zero, this.ImageScale, SpriteEffects.None, 0f); if (_textureOverlay != null) { spriteBatch.Draw(this._textureOverlay, dimensions.Position() + (this._texture.Size() - this._textureOverlay.Size()) / 2 + this._textureOverlay.Size() * (1f - this.ImageScale) / 2f, null, ImageColour, 0f, Vector2.Zero, this.ImageScale, SpriteEffects.None, 0f); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = GetDimensions(); spriteBatch.Draw(_texture.get_Value(), dimensions.Position(), Color.White * (base.IsMouseHovering ? _visibilityActive : _visibilityInactive)); if (_borderTexture != null && base.IsMouseHovering) { spriteBatch.Draw(_borderTexture.get_Value(), dimensions.Position(), Color.White); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = GetInnerDimensions(); spriteBatch.Draw(backgroundTexture.Value, dimensions.Position(), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); if (definition != null) { int type = unloaded ? ProjectileID.Count : this.type; Main.instance.LoadProjectile(type); Texture2D projectileTexture = TextureAssets.Projectile[type].Value; int frameCounter = Interface.modConfig.updateCount / 4; int frames = Main.projFrames[type]; if (unloaded) { projectileTexture = TextureAssets.Item[ItemID.Count].Value; frames = 1; } int height = projectileTexture.Height / frames; int width = projectileTexture.Width; int frame = frameCounter % frames; int y = height * frame; var rectangle2 = new Rectangle(0, y, width, height); float drawScale = 1f; float availableWidth = (float)defaultBackgroundTexture.Width() * scale; if (width > availableWidth || height > availableWidth) { if (width > height) { drawScale = availableWidth / width; } else { drawScale = availableWidth / height; } } drawScale *= scale; Vector2 vector = backgroundTexture.Size() * scale; Vector2 position2 = dimensions.Position() + vector / 2f - rectangle2.Size() * drawScale / 2f; Vector2 origin = rectangle2.Size() * 0 /* * (pulseScale / 2f - 0.5f)*/; spriteBatch.Draw(projectileTexture, position2, rectangle2, Color.White, 0f, origin, drawScale, SpriteEffects.None, 0f); } if (IsMouseHovering) { UIModConfig.tooltip = tooltip; } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = this.GetDimensions(); spriteBatch.Draw(this._texture.Value, dimensions.Position(), Color.White * (this.IsMouseHovering ? this._visibilityActive : this._visibilityInactive)); if (this._borderTexture == null || !this.IsMouseHovering) { return; } spriteBatch.Draw(this._borderTexture.Value, dimensions.Position(), Color.White); }
private void UIDrawMethod(object instance, SpriteBatch sb) { string modName = (string)(typeUIModItem.GetProperty("ModName", SGAmod.UniversalBindingFlags).GetValue(instance)); CalculatedStyle style = (CalculatedStyle)(typeUIModItem.GetMethod("GetInnerDimensions", SGAmod.UniversalBindingFlags).Invoke(instance, new object[] { })); if (modName == "SGAmod") { //Button Texture2D credits = SGAmod.ExtraTextures[117]; Vector2 buttonOffset = new Vector2(style.Width - 112, style.Height - 38); Rectangle boxSize = new Rectangle(credits.Width / 2, 0, credits.Width / 2, credits.Height / 2); Vector2 pos = style.Position() + buttonOffset; Rectangle inBox = new Rectangle((int)pos.X, (int)pos.Y, boxSize.Width, boxSize.Height); sb.Draw(credits, style.Position() + buttonOffset, boxSize, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0f); if (inBox.Contains((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y)) { instance.GetType().GetField("_tooltip", SGAmod.UniversalBindingFlags).SetValue(instance, "SGAmod Credits"); Microsoft.Xna.Framework.Input.MouseState mouseState = Microsoft.Xna.Framework.Input.Mouse.GetState(); if (mouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed) { Credits.CreditsManager.queuedCredits = true; //Credits.CreditsManager.RollCredits(); } } //DynamicSpriteFontExtensionMethods.DrawString(sb, line.font, strrole, line.position, line.Colors.Item1, 0, new Vector2(strSize1.X, 0) / 2f, 1f, SpriteEffects.None, 0); //Dergon Texture2D Draken = ModContent.GetTexture("SGAmod/NPCs/TownNPCs/Dergon"); int frame = (int)(Main.GlobalTime * 8f) % 7; Vector2 offset = new Vector2(180, style.Height - 10); //offset.Y += -frame*0.5f;//sprite is slightly offset Vector2 frameSize = new Vector2(Draken.Width, Draken.Height); Rectangle rect = new Rectangle(0, (int)(frame * (frameSize.Y / 7)), (int)frameSize.X, (int)(frameSize.Y / 7)); SpriteEffects backAndForth = Main.GlobalTime % 38 < 19 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; offset += new Vector2((Main.GlobalTime % 38) + (Main.GlobalTime % 38 < 19 ? 0 : ((Main.GlobalTime - 19) % 19) * -2), 0) * 12; sb.Draw(Draken, style.Position() + offset, rect, Color.White, 0, new Vector2(frameSize.X, frameSize.Y / 7f) / 2f, 0.50f, backAndForth, 0f); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { Main.instance.LoadNPC(npcType); Texture2D npcTexture = Main.npcTexture[npcType]; if (++frameTimer > frameDelay) { frameCounter = frameCounter + 1; frameTimer = 0; if (frameCounter > Main.npcFrameCount[npcType] - 1) { frameCounter = 0; } } Rectangle npcDrawRectangle = new Rectangle(0, (Main.npcTexture[npcType].Height / Main.npcFrameCount[npcType]) * frameCounter, Main.npcTexture[npcType].Width, Main.npcTexture[npcType].Height / Main.npcFrameCount[npcType]); CalculatedStyle dimensions = base.GetInnerDimensions(); spriteBatch.Draw(backgroundTexture, dimensions.Position(), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); DrawAdditionalOverlays(spriteBatch, dimensions.Position(), scale); Rectangle rectangle = dimensions.ToRectangle(); int height = npcTexture.Height / Main.npcFrameCount[npcType]; int width = npcTexture.Width; float drawScale = 2f; float availableWidth = (float)backgroundTexture.Width * scale - 6; if (width * drawScale > availableWidth || height * drawScale > availableWidth) { if (width > height) { drawScale = availableWidth / width; } else { drawScale = availableWidth / height; } } Vector2 drawPosition = dimensions.Position(); drawPosition.X += backgroundTexture.Width * scale / 2f - (float)width * drawScale / 2f; drawPosition.Y += backgroundTexture.Height * scale / 2f - (float)height * drawScale / 2f; Color color = (npc.color != new Color(byte.MinValue, byte.MinValue, byte.MinValue, byte.MinValue)) ? new Color(npc.color.R, npc.color.G, npc.color.B, 255f) : new Color(1f, 1f, 1f); Main.spriteBatch.Draw(npcTexture, drawPosition, npcDrawRectangle, color, 0, Vector2.Zero, drawScale, SpriteEffects.None, 0); if (IsMouseHovering) { Main.hoverItemName = Lang.GetNPCNameValue(npc.type) + (npc.modNPC != null ? " [" + npc.modNPC.mod.Name + "]" : ""); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = GetDimensions(); spriteBatch.Draw(_texture, dimensions.Position(), Color.White); Vector2 value = dimensions.Position() + new Vector2(dimensions.Width * 0.5f - (float)(_player.width >> 1), dimensions.Height * 0.5f - (float)(_player.height >> 1)); Item ıtem = _player.inventory[_player.selectedItem]; _player.inventory[_player.selectedItem] = _blankItem; Main.instance.DrawPlayer(_player, value + Main.screenPosition, 0f, Vector2.Zero); _player.inventory[_player.selectedItem] = ıtem; }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = base.GetInnerDimensions(); spriteBatch.Draw(backgroundTexture.Value, dimensions.Position(), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); if (definition != null) { int type = unloaded ? 0 : this.type; Main.instance.LoadNPC(type); Texture2D npcTexture = TextureAssets.Npc[type].Value; int frameCounter = Interface.modConfig.updateCount / 8; int frames = Main.npcFrameCount[type]; if (unloaded) { npcTexture = TextureAssets.Item[ItemID.Count].Value; //Will this always return the 'missing item' texture? frames = 1; } int height = npcTexture.Height / frames; int width = npcTexture.Width; int frame = frameCounter % frames; int y = height * frame; Rectangle rectangle2 = new Rectangle(0, y, width, height); float drawScale = 1f; float availableWidth = defaultBackgroundTexture.Width() * scale; if (width > availableWidth || height > availableWidth) { if (width > height) { drawScale = availableWidth / width; } else { drawScale = availableWidth / height; } } drawScale *= scale; Vector2 vector = backgroundTexture.Size() * scale; Vector2 position2 = dimensions.Position() + vector / 2f - rectangle2.Size() * drawScale / 2f; Vector2 origin = rectangle2.Size() * 0; //Color color = (npc.color != new Color(byte.MinValue, byte.MinValue, byte.MinValue, byte.MinValue)) ? new Color(npc.color.R, npc.color.G, npc.color.B, 255f) : new Color(1f, 1f, 1f); spriteBatch.Draw(npcTexture, position2, rectangle2, Color.White, 0f, origin, drawScale, SpriteEffects.None, 0f); } if (IsMouseHovering) { UIModConfig.tooltip = tooltip; } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = this.GetDimensions(); spriteBatch.Draw(this._texture, dimensions.Position(), Color.White); Vector2 vector2 = dimensions.Position() + new Vector2(dimensions.Width * 0.5f - (float)(this._player.width >> 1), dimensions.Height * 0.5f - (float)(this._player.height >> 1)); Item obj = this._player.inventory[this._player.selectedItem]; this._player.inventory[this._player.selectedItem] = UICharacter._blankItem; Main.instance.DrawPlayer(this._player, vector2 + Main.screenPosition, 0.0f, Vector2.Zero, 0.0f); this._player.inventory[this._player.selectedItem] = obj; }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = base.GetOuterDimensions(); if (ContainsPoint(Main.MouseScreen)) { Main.LocalPlayer.mouseInterface = true; Main.LocalPlayer.showItemIcon = false; Main.ItemIconCacheUpdate(0); } if (dragging) { Left.Set(Main.MouseScreen.X - offset.X, 0f); Top.Set(Main.MouseScreen.Y - offset.Y, 0f); Recalculate(); } if (resizeing) { if (resizeableX) { Width.Pixels = Main.MouseScreen.X - dimensions.X - offset.X; } if (resizeableY) { Height.Pixels = Main.MouseScreen.Y - dimensions.Y - offset.Y; } Recalculate(); } base.DrawSelf(spriteBatch); if (resizeable) { DrawDragAnchor(spriteBatch, dragTexture, this.BorderColor); } //DrawCaption if (!string.IsNullOrEmpty(caption)) { dimensions = base.GetOuterDimensions(); float fontHeight = Main.fontMouseText.MeasureString(caption).Y; switch (drawCaptionPosition) { case 0: spriteBatch.DrawString(Main.fontMouseText, caption, dimensions.Position().Offset(7, dimensions.Height - fontHeight - 4), Color.Wheat); break; case 1: spriteBatch.DrawString(Main.fontMouseText, caption, dimensions.Position().Offset(7, 3), Color.Wheat); break; } } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = base.GetDimensions(); spriteBatch.Draw(this._texture, dimensions.Position(), Color.White * (base.IsMouseHovering ? this._visibilityActive : this._visibilityInactive)); if (!enabled) { // 32x32, overlay is 24x24. spriteBatch.Draw(this.overlay, dimensions.Position() + new Vector2(4), Color.White * (base.IsMouseHovering ? this._visibilityActive : this._visibilityInactive)); } if (IsMouseHovering) { ItemChecklistUI.hoverText = hoverText; } }
// TODO, choose Y direction, up negative or positive? // draw Axis, make circular option, make rotation option(ouside values only.) protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = base.GetInnerDimensions(); Rectangle rectangle = dimensions.ToRectangle(); spriteBatch.Draw(Main.magicPixel, rectangle, Color.Red); float x = dataX.GetProportion(); float y = dataY.GetProportion(); var position = dimensions.Position(); position.X += x * dimensions.Width; position.Y += y * dimensions.Height; var blipRectangle = new Rectangle((int)position.X - 2, (int)position.Y - 2, 4, 4); spriteBatch.Draw(Main.magicPixel, blipRectangle, Color.Black); if (IsMouseHovering && Main.mouseLeft) { float newPerc = (Main.mouseX - rectangle.X) / (float)rectangle.Width; newPerc = Utils.Clamp <float>(newPerc, 0f, 1f); dataX.SetProportion(newPerc); newPerc = (Main.mouseY - rectangle.Y) / (float)rectangle.Height; newPerc = Utils.Clamp <float>(newPerc, 0f, 1f); dataY.SetProportion(newPerc); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { if (this._drawPanel) { base.DrawSelf(spriteBatch); } CalculatedStyle innerDimensions = this.GetInnerDimensions(); Vector2 pos = innerDimensions.Position(); if (this._isLarge) { pos.Y -= 10f * this._textScale * this._textScale; } else { pos.Y -= 2f * this._textScale; } pos.X += (float)(((double)innerDimensions.Width - (double)this._textSize.X) * 0.5); if (this._isLarge) { Utils.DrawBorderStringBig(spriteBatch, this.Text, pos, this._color, this._textScale, 0.0f, 0.0f, -1); } else { Utils.DrawBorderString(spriteBatch, this.Text, pos, this._color, this._textScale, 0.0f, 0.0f, -1); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = GetDimensions(); spriteBatch.Draw(_texture, dimensions.Position(), null, color, 0f, Vector2.Zero, ImageScale, SpriteEffects.None, 0f); }
protected override void DrawSelf(SpriteBatch spriteBatch) { Player player = Main.LocalPlayer; CalculatedStyle dimensions = base.GetDimensions(); Rectangle rectangle = _texture.Frame(3, 1, 0, 0); rectangle.X = rectangle.Width * currentState; spriteBatch.Draw(_texture, dimensions.Position(), new Rectangle?(rectangle), Color.White * 1.0f, 0.0f, Vector2.Zero, Vector2.One, SpriteEffects.None, 0.0f); if (IsMouseHovering) { currentState = 2; } else { currentState = CurrentQuestUI.visible ? 0 : 1; } if (IsMouseHovering && !PlayerInput.IgnoreMouseInterface) { List <string> justPressed = Antiaris.hideTracker.GetAssignedKeys(InputMode.Keyboard); string button = justPressed.Count > 0 ? justPressed[0] : "?"; string TrackerButton = Language.GetTextValue("Mods.Antiaris.TrackerButton", button); Vector2 vector2 = new Vector2(Main.mouseX, Main.mouseY) + new Vector2(16.0f); if (!string.IsNullOrEmpty(TrackerButton)) { Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, TrackerButton, vector2.X, vector2.Y, new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor), Color.Black, new Vector2()); } Main.mouseText = true; } }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = GetDimensions(); if (_drawsBackPanel) { spriteBatch.Draw(_texture.Value, dimensions.Position(), Color.White); } UpdateAnim(); Vector2 value = dimensions.Position() + new Vector2(dimensions.Width * 0.5f - (float)(_player.width >> 1), dimensions.Height * 0.5f - (float)(_player.height >> 1)); Item item = _player.inventory[_player.selectedItem]; _player.inventory[_player.selectedItem] = _blankItem; Main.PlayerRenderer.DrawPlayer(Main.Camera, _player, value + Main.screenPosition, 0f, Vector2.Zero, 0f, _characterScale); _player.inventory[_player.selectedItem] = item; }
protected void DrawBar(SpriteBatch spriteBatch, Color color) { CalculatedStyle dimensions = GetDimensions(); spriteBatch.Draw(TheOneLibrary.corner, dimensions.Position(), color); spriteBatch.Draw(TheOneLibrary.corner, dimensions.Position() + new Vector2(dimensions.Width - 12, 12), null, color, MathHelper.Pi * 0.5f, new Vector2(12, 12), Vector2.One, SpriteEffects.None, 0f); spriteBatch.Draw(TheOneLibrary.corner, dimensions.Position() + new Vector2(12, dimensions.Height - 12), null, color, MathHelper.Pi * 1.5f, new Vector2(12, 12), Vector2.One, SpriteEffects.None, 0f); spriteBatch.Draw(TheOneLibrary.corner, dimensions.Position() + new Vector2(dimensions.Width - 12, dimensions.Height - 12), null, color, MathHelper.Pi * 1f, new Vector2(12, 12), Vector2.One, SpriteEffects.None, 0f); spriteBatch.Draw(TheOneLibrary.side, new Rectangle((int)(dimensions.X + 12), (int)dimensions.Y, (int)(dimensions.Width - 24), 12), color); spriteBatch.Draw(TheOneLibrary.side, new Rectangle((int)dimensions.X, (int)(dimensions.Y + dimensions.Height - 12), (int)(dimensions.Height - 24), 12), null, color, MathHelper.Pi * 1.5f, Vector2.Zero, SpriteEffects.None, 0f); spriteBatch.Draw(TheOneLibrary.side, new Rectangle((int)(dimensions.X + dimensions.Width), (int)(dimensions.Y + 12), (int)(dimensions.Height - 24), 12), null, color, MathHelper.Pi * 0.5f, Vector2.Zero, SpriteEffects.None, 0f); spriteBatch.Draw(TheOneLibrary.side, new Rectangle((int)(dimensions.X + dimensions.Width - 12), (int)(dimensions.Y + dimensions.Height), (int)(dimensions.Width - 24), 12), null, color, MathHelper.Pi, Vector2.Zero, SpriteEffects.None, 0f); spriteBatch.Draw(Main.magicPixel, new Rectangle((int)(dimensions.X + 12), (int)(dimensions.Y + 12), (int)(dimensions.Width - 24), (int)(dimensions.Height - 24)), color); }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = GetDimensions(); Vector2 vector = dimensions.Position() + new Vector2(dimensions.Width, dimensions.Height) / 2f; Rectangle frame = GetFrame(); Rectangle value = frame; value.X = _texture.Width() / 8; value.Y = 0; Vector2 origin = frame.Size() / 2f; Color white = Color.White; Color color = Color.Black; if (_hovered) { color = Main.OurFavoriteColor; } spriteBatch.Draw(_texture.Value, vector, value, white, 0f, origin, 1f, SpriteEffects.None, 0f); spriteBatch.Draw(_texture.Value, vector, frame, white, 0f, origin, 1f, SpriteEffects.None, 0f); spriteBatch.Draw(_textureBorder.Value, vector - Vector2.One * 2f, null, color, 0f, origin, 1f, SpriteEffects.None, 0f); if (_hovered) { string name = EmoteID.Search.GetName(_emoteIndex); string cursorText = "/" + Language.GetTextValue("EmojiName." + name); Main.instance.MouseText(cursorText, 0, 0); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { if (!FargoSoulsWorld.EternityMode) { return; } //base.DrawSelf(spriteBatch); CalculatedStyle style = GetDimensions(); // Logic if (IsMouseHovering && !dragging) { Vector2 textPosition = Main.MouseScreen + new Vector2(21, 21); Utils.DrawBorderString( spriteBatch, FargoSoulsWorld.MasochistModeReal ? TextMaso : TextEMode, textPosition, FargoSoulsWorld.MasochistModeReal ? new Color(51, 255, 191) : Color.White); } // Drawing Vector2 position = style.Position(); spriteBatch.Draw(Texture, position + new Vector2(2), Texture.Bounds, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); if (FargoSoulsWorld.MasochistModeReal) { spriteBatch.Draw(AuraTexture, position, AuraTexture.Bounds, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { if (this.HideSelf) { return; } this._cursor = this.Text.Length; base.DrawSelf(spriteBatch); ++this._frameCount; if ((this._frameCount %= 40) > 20 || !this.ShowInputTicker) { return; } CalculatedStyle innerDimensions = this.GetInnerDimensions(); Vector2 pos = innerDimensions.Position(); Vector2 vector2 = new Vector2((this.IsLarge ? FontAssets.DeathText.Value : FontAssets.MouseText.Value).MeasureString(this.Text.Substring(0, this._cursor)).X, this.IsLarge ? 32f : 16f) * this.TextScale; if (this.IsLarge) { pos.Y -= 8f * this.TextScale; } else { pos.Y -= 2f * this.TextScale; } pos.X += (float)(((double)innerDimensions.Width - (double)this.TextSize.X) * (double)this.TextHAlign + (double)vector2.X - (this.IsLarge ? 8.0 : 4.0) * (double)this.TextScale + 6.0); if (this.IsLarge) { Utils.DrawBorderStringBig(spriteBatch, "|", pos, this.TextColor, this.TextScale, 0.0f, 0.0f, -1); } else { Utils.DrawBorderString(spriteBatch, "|", pos, this.TextColor, this.TextScale, 0.0f, 0.0f, -1); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { base.DrawSelf(spriteBatch); this.VerifyTextState(); CalculatedStyle innerDimensions = this.GetInnerDimensions(); Vector2 pos = innerDimensions.Position(); if (this._isLarge) { pos.Y -= 10f * this._textScale; } else { pos.Y -= 2f * this._textScale; } pos.X += (innerDimensions.Width - this._textSize.X) * this.TextOriginX; float textScale = this._textScale; if (this.DynamicallyScaleDownToWidth && (double)this._textSize.X > (double)innerDimensions.Width) { textScale *= innerDimensions.Width / this._textSize.X; } if (this._isLarge) { Utils.DrawBorderStringBig(spriteBatch, this._visibleText, pos, this._color, textScale, 0.0f, 0.0f, -1); } else { Utils.DrawBorderString(spriteBatch, this._visibleText, pos, this._color, textScale, 0.0f, 0.0f, -1); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { base.DrawSelf(spriteBatch); CalculatedStyle dimensions = base.GetDimensions(); Vector2 pos = dimensions.Position(); // Draw bar spriteBatch.Draw(bar, pos + new Vector2(0f, 4f), bar.Bounds, barColour); int range = _maxValue - _minValue; // set to mouse if (_dragging) { _dragVal = (int)(Main.mouseX - pos.X - 10); } // limit slider to bar _dragVal = (int)Math.Max(Math.Min(_widthRange, _dragVal), 0f); //Set index to rounded position of dragVal in relation to range and distance across width _lastIndex = _index; if (_dragging) { _index = (int)((0.5f + _minValue) + range * _dragVal / _widthRange); } // Draw Slider spriteBatch.Draw(slider, pos + new Vector2(3f + _dragVal, 0f), slider.Bounds, Color.White); _dragVal = (int)(_widthRange / range * (_index - _minValue)); }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = this.GetDimensions(); if (this._drawsBackPanel) { spriteBatch.Draw(this._texture.get_Value(), dimensions.Position(), Color.White); } this.UpdateAnim(); Vector2 vector2 = dimensions.Position() + new Vector2(dimensions.Width * 0.5f - (float)(this._player.width >> 1), dimensions.Height * 0.5f - (float)(this._player.height >> 1)); Item obj = this._player.inventory[this._player.selectedItem]; this._player.inventory[this._player.selectedItem] = UICharacter._blankItem; Main.PlayerRenderer.DrawPlayer(Main.Camera, this._player, vector2 + Main.screenPosition, 0.0f, Vector2.Zero, 0.0f, this._characterScale); this._player.inventory[this._player.selectedItem] = obj; }