private static void PrintNetDiagnosticsLineForMessage( SpriteBatch spriteBatch, int msgId, int x, int y) { float num = 0.7f; string str1 = msgId.ToString() + ": "; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), str1, new Vector2((float)x, (float)y), Color.White, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); x += 30; string str2 = "rx:" + string.Format("{0:0,0}", (object)LegacyNetDiagnosticsUI.rxMsgType[msgId]); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), str2, new Vector2((float)x, (float)y), Color.White, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); x += 70; string str3 = string.Format("{0:0,0}", (object)LegacyNetDiagnosticsUI.rxDataType[msgId]); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), str3, new Vector2((float)x, (float)y), Color.White, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); x += 70; string str4 = msgId.ToString() + ": "; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), str4, new Vector2((float)x, (float)y), Color.White, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); x += 30; string str5 = "tx:" + string.Format("{0:0,0}", (object)LegacyNetDiagnosticsUI.txMsgType[msgId]); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), str5, new Vector2((float)x, (float)y), Color.White, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); x += 70; string str6 = string.Format("{0:0,0}", (object)LegacyNetDiagnosticsUI.txDataType[msgId]); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), str6, new Vector2((float)x, (float)y), Color.White, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); }
private static void DrawTitles(SpriteBatch spriteBatch) { for (int index = 0; index < 4; ++index) { string str = ""; int num1 = 20; int num2 = 220; if (index == 0) { str = "RX Msgs: " + string.Format("{0:0,0}", (object)LegacyNetDiagnosticsUI.rxMsg); num2 += index * 20; } else if (index == 1) { str = "RX Bytes: " + string.Format("{0:0,0}", (object)LegacyNetDiagnosticsUI.rxData); num2 += index * 20; } else if (index == 2) { str = "TX Msgs: " + string.Format("{0:0,0}", (object)LegacyNetDiagnosticsUI.txMsg); num2 += index * 20; } else if (index == 3) { str = "TX Bytes: " + string.Format("{0:0,0}", (object)LegacyNetDiagnosticsUI.txData); num2 += index * 20; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), str, new Vector2((float)num1, (float)num2), Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } }
private static void DrawTitles(SpriteBatch spriteBatch) { for (int i = 0; i < 4; i++) { string text = ""; int num = 20; int num2 = 220; switch (i) { case 0: text = "RX Msgs: " + $"{rxMsg:0,0}"; num2 += i * 20; break; case 1: text = "RX Bytes: " + $"{rxData:0,0}"; num2 += i * 20; break; case 2: text = "TX Msgs: " + $"{txMsg:0,0}"; num2 += i * 20; break; case 3: text = "TX Bytes: " + $"{txData:0,0}"; num2 += i * 20; break; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, text, new Vector2(num, num2), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { var dimensions = this.GetDimensions(); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, Main.fontDeathText, this.Text, new Vector2(dimensions.X, dimensions.Y), Color.White); }
public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { //Miner UI int inventory = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Inventory")); if (inventory != -1) { layers.Insert(inventory, new LegacyGameInterfaceLayer( "Miner: Miner Light UI", delegate { // If the current UIState of the UserInterface is null, nothing will draw. We don't need to track a separate .visible value. MinerUserInterface.Draw(Main.spriteBatch, new GameTime()); return(true); }, InterfaceScaleType.UI) ); } //Revive Countdown int deathText = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Death Text")); if (deathText != -1) { layers.Insert(deathText, new LegacyGameInterfaceLayer("Desiccation: Respawn Timer", delegate { if (Main.player[Main.myPlayer].dead) { Player player = Main.player[Main.myPlayer]; float num = player.respawnTimer / 60f; string value = string.Format("{0:f1}", num); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, value, new Vector2((Main.screenWidth / 2) - Main.fontDeathText.MeasureString(value).X / 2f, (Main.screenHeight / 2 - 70)), Main.player[Main.myPlayer].GetDeathAlpha(Color.Transparent), 0f, default, 1f, SpriteEffects.None, 0f);
private void DrawMana() { Player localPlayer = Main.LocalPlayer; SpriteBatch spriteBatch = Main.spriteBatch; Color color = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); this.UIDisplay_ManaPerStar = 20; if (localPlayer.ghost || localPlayer.statManaMax2 <= 0) { return; } int num1 = localPlayer.statManaMax2 / 20; Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(Lang.inter[2].Value); int num2 = 50; if ((double)vector2.X >= 45.0) { num2 = (int)vector2.X + 5; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, Lang.inter[2].Value, new Vector2((float)(800 - num2 + this.UI_ScreenAnchorX), 6f), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); for (int index = 1; index < localPlayer.statManaMax2 / this.UIDisplay_ManaPerStar + 1; ++index) { bool flag = false; float scale = 1f; int num3; if (localPlayer.statMana >= index * this.UIDisplay_ManaPerStar) { num3 = (int)byte.MaxValue; if (localPlayer.statMana == index * this.UIDisplay_ManaPerStar) { flag = true; } } else { float num4 = (float)(localPlayer.statMana - (index - 1) * this.UIDisplay_ManaPerStar) / (float)this.UIDisplay_ManaPerStar; num3 = (int)(30.0 + 225.0 * (double)num4); if (num3 < 30) { num3 = 30; } scale = (float)((double)num4 / 4.0 + 0.75); if ((double)scale < 0.75) { scale = 0.75f; } if ((double)num4 > 0.0) { flag = true; } } if (flag) { scale += Main.cursorScale - 1f; } int a = (int)((double)num3 * 0.9); spriteBatch.Draw(TextureAssets.Mana.Value, new Vector2((float)(775 + this.UI_ScreenAnchorX), (float)(30 + TextureAssets.Mana.Height() / 2) + (float)(((double)TextureAssets.Mana.Height() - (double)TextureAssets.Mana.Height() * (double)scale) / 2.0) + (float)(28 * (index - 1))), new Rectangle?(new Rectangle(0, 0, TextureAssets.Mana.Width(), TextureAssets.Mana.Height())), new Color(num3, num3, num3, a), 0.0f, new Vector2((float)(TextureAssets.Mana.Width() / 2), (float)(TextureAssets.Mana.Height() / 2)), scale, SpriteEffects.None, 0.0f); } }
private void DrawMana() { Player localPlayer = Main.LocalPlayer; SpriteBatch spriteBatch = Main.spriteBatch; Color color = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor); UIDisplay_ManaPerStar = 20; if (localPlayer.ghost || localPlayer.statManaMax2 <= 0) { return; } _ = localPlayer.statManaMax2 / 20; Vector2 vector = FontAssets.MouseText.Value.MeasureString(Lang.inter[2].Value); int num = 50; if (vector.X >= 45f) { num = (int)vector.X + 5; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, Lang.inter[2].Value, new Vector2(800 - num + UI_ScreenAnchorX, 6f), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); for (int i = 1; i < localPlayer.statManaMax2 / UIDisplay_ManaPerStar + 1; i++) { int num2 = 255; bool flag = false; float num3 = 1f; if (localPlayer.statMana >= i * UIDisplay_ManaPerStar) { num2 = 255; if (localPlayer.statMana == i * UIDisplay_ManaPerStar) { flag = true; } } else { float num4 = (float)(localPlayer.statMana - (i - 1) * UIDisplay_ManaPerStar) / (float)UIDisplay_ManaPerStar; num2 = (int)(30f + 225f * num4); if (num2 < 30) { num2 = 30; } num3 = num4 / 4f + 0.75f; if ((double)num3 < 0.75) { num3 = 0.75f; } if (num4 > 0f) { flag = true; } } if (flag) { num3 += Main.cursorScale - 1f; } int a = (int)((double)num2 * 0.9); spriteBatch.Draw(TextureAssets.Mana.Value, new Vector2(775 + UI_ScreenAnchorX, (float)(30 + TextureAssets.Mana.Height() / 2) + ((float)TextureAssets.Mana.Height() - (float)TextureAssets.Mana.Height() * num3) / 2f + (float)(28 * (i - 1))), new Rectangle(0, 0, TextureAssets.Mana.Width(), TextureAssets.Mana.Height()), new Color(num2, num2, num2, a), 0f, new Vector2(TextureAssets.Mana.Width() / 2, TextureAssets.Mana.Height() / 2), num3, SpriteEffects.None, 0f); } }
private static void DrawPlayerName(SpriteBatch spriteBatch, string namePlate, ref Vector2 namePlatePos, ref Color namePlateColor) { DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), namePlate, new Vector2(namePlatePos.X - 2f, namePlatePos.Y), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), namePlate, new Vector2(namePlatePos.X + 2f, namePlatePos.Y), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), namePlate, new Vector2(namePlatePos.X, namePlatePos.Y - 2f), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), namePlate, new Vector2(namePlatePos.X, namePlatePos.Y + 2f), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), namePlate, namePlatePos, namePlateColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); }
protected override void DrawSelf(SpriteBatch spriteBatch) { base.DrawSelf(spriteBatch); DynamicSpriteFont font = _isLarge ? Main.fontDeathText : Main.fontMouseText; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, font, Text, base.GetDimensions().Center() - TextSize * 0.5f, new Color(43, 28, 17), 0f, Vector2.Zero, TextScale, SpriteEffects.None, 0f); }
public void DrawPlayerName_WhenPlayerIsOnScreen(SpriteBatch spriteBatch) { _pos = _pos; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, _name, new Vector2(_pos.X - 2f, _pos.Y), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, _name, new Vector2(_pos.X + 2f, _pos.Y), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, _name, new Vector2(_pos.X, _pos.Y - 2f), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, _name, new Vector2(_pos.X, _pos.Y + 2f), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, _name, _pos, _color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); }
public void DrawPlayerName_WhenPlayerIsOnScreen(SpriteBatch spriteBatch) { this._pos = this._pos.Floor(); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this._name, new Vector2(this._pos.X - 2f, this._pos.Y), Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this._name, new Vector2(this._pos.X + 2f, this._pos.Y), Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this._name, new Vector2(this._pos.X, this._pos.Y - 2f), Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this._name, new Vector2(this._pos.X, this._pos.Y + 2f), Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this._name, this._pos, this._color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); }
private static void DrawPlayerName2(SpriteBatch spriteBatch, ref Color namePlateColor, string npDist, ref Vector2 npDistPos) { float num = 0.85f; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), npDist, new Vector2(npDistPos.X - 2f, npDistPos.Y), Color.Black, 0f, default(Vector2), num, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), npDist, new Vector2(npDistPos.X + 2f, npDistPos.Y), Color.Black, 0f, default(Vector2), num, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), npDist, new Vector2(npDistPos.X, npDistPos.Y - 2f), Color.Black, 0f, default(Vector2), num, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), npDist, new Vector2(npDistPos.X, npDistPos.Y + 2f), Color.Black, 0f, default(Vector2), num, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), npDist, npDistPos, namePlateColor, 0f, default(Vector2), num, SpriteEffects.None, 0f); }
public void DrawPlayerDistance(SpriteBatch spriteBatch) { float num = 0.85f; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this.distanceString, new Vector2(this.distanceDrawPosition.X - 2f, this.distanceDrawPosition.Y), Color.Black, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this.distanceString, new Vector2(this.distanceDrawPosition.X + 2f, this.distanceDrawPosition.Y), Color.Black, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this.distanceString, new Vector2(this.distanceDrawPosition.X, this.distanceDrawPosition.Y - 2f), Color.Black, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this.distanceString, new Vector2(this.distanceDrawPosition.X, this.distanceDrawPosition.Y + 2f), Color.Black, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), this.distanceString, this.distanceDrawPosition, this.namePlateColor, 0.0f, new Vector2(), num, SpriteEffects.None, 0.0f); }
public void DrawPlayerDistance(SpriteBatch spriteBatch) { float num = 0.85f; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, distanceString, new Vector2(distanceDrawPosition.X - 2f, distanceDrawPosition.Y), Color.Black, 0f, default(Vector2), num, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, distanceString, new Vector2(distanceDrawPosition.X + 2f, distanceDrawPosition.Y), Color.Black, 0f, default(Vector2), num, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, distanceString, new Vector2(distanceDrawPosition.X, distanceDrawPosition.Y - 2f), Color.Black, 0f, default(Vector2), num, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, distanceString, new Vector2(distanceDrawPosition.X, distanceDrawPosition.Y + 2f), Color.Black, 0f, default(Vector2), num, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, distanceString, distanceDrawPosition, namePlateColor, 0f, default(Vector2), num, SpriteEffects.None, 0f); }
private static void DrawLifeBarText(SpriteBatch spriteBatch, Vector2 topLeftAnchor) { Vector2 value = topLeftAnchor + new Vector2(130f, -20f); Player localPlayer = Main.LocalPlayer; Color color = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor); string text = Lang.inter[0].Value + " " + localPlayer.statLifeMax2 + "/" + localPlayer.statLifeMax2; Vector2 vector = FontAssets.MouseText.get_Value().MeasureString(text); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), Lang.inter[0].Value, value + new Vector2((0f - vector.X) * 0.5f, 0f), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), localPlayer.statLife + "/" + localPlayer.statLifeMax2, value + new Vector2(vector.X * 0.5f, 0f), color, 0f, new Vector2(FontAssets.MouseText.get_Value().MeasureString(localPlayer.statLife + "/" + localPlayer.statLifeMax2).X, 0f), 1f, SpriteEffects.None, 0f); }
private static void DrawLifeBarText(SpriteBatch spriteBatch, Vector2 topLeftAnchor) { Vector2 vector2_1 = topLeftAnchor + new Vector2(130f, -20f); Player localPlayer = Main.LocalPlayer; Color color = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); string str = Lang.inter[0].Value + " " + (object)localPlayer.statLifeMax2 + "/" + (object)localPlayer.statLifeMax2; Vector2 vector2_2 = FontAssets.MouseText.Value.MeasureString(str); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, Lang.inter[0].Value, vector2_1 + new Vector2((float)(-(double)vector2_2.X * 0.5), 0.0f), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, localPlayer.statLife.ToString() + "/" + (object)localPlayer.statLifeMax2, vector2_1 + new Vector2(vector2_2.X * 0.5f, 0.0f), color, 0.0f, new Vector2(FontAssets.MouseText.Value.MeasureString(localPlayer.statLife.ToString() + "/" + (object)localPlayer.statLifeMax2).X, 0.0f), 1f, SpriteEffects.None, 0.0f); }
protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = this.GetDimensions(); float num = 1.2f; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.DeathText.get_Value(), this.Text, new Vector2(dimensions.X - num, dimensions.Y - num), Color.Black); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.DeathText.get_Value(), this.Text, new Vector2(dimensions.X + num, dimensions.Y - num), Color.Black); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.DeathText.get_Value(), this.Text, new Vector2(dimensions.X - num, dimensions.Y + num), Color.Black); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.DeathText.get_Value(), this.Text, new Vector2(dimensions.X + num, dimensions.Y + num), Color.Black); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.DeathText.get_Value(), this.Text, new Vector2(dimensions.X, dimensions.Y), Color.White); }
private static void DrawManaText(SpriteBatch spriteBatch) { Vector2 vector = FontAssets.MouseText.Value.MeasureString(Lang.inter[2].Value); Color color = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor); int num = 50; if (vector.X >= 45f) { num = (int)vector.X + 5; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, Lang.inter[2].Value, new Vector2(Main.screenWidth - num, 6f), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); }
private static void DrawManaText(SpriteBatch spriteBatch) { Vector2 vector2 = FontAssets.MouseText.get_Value().MeasureString(Lang.inter[2].Value); Color color = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); int num = 50; if ((double)vector2.X >= 45.0) { num = (int)vector2.X + 5; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), Lang.inter[2].Value, new Vector2((float)(Main.screenWidth - num), 6f), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); }
private static void DrawManaText(SpriteBatch spriteBatch) { Color color = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor); int num = 180; Player localPlayer = Main.LocalPlayer; string text = Lang.inter[2].Value + ":"; string text2 = localPlayer.statMana + "/" + localPlayer.statManaMax2; Vector2 value = new Vector2(Main.screenWidth - num, 65f); string text3 = text + " " + text2; Vector2 vector = FontAssets.MouseText.get_Value().MeasureString(text3); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), text, value + new Vector2((0f - vector.X) * 0.5f, 0f), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.get_Value(), text2, value + new Vector2(vector.X * 0.5f, 0f), color, 0f, new Vector2(FontAssets.MouseText.get_Value().MeasureString(text2).X, 0f), 1f, SpriteEffects.None, 0f); }
private static void DrawManaText(SpriteBatch spriteBatch) { Color color = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); int num = 180; Player localPlayer = Main.LocalPlayer; string str1 = Lang.inter[2].Value + ":"; string str2 = localPlayer.statMana.ToString() + "/" + (object)localPlayer.statManaMax2; Vector2 vector2_1 = new Vector2((float)(Main.screenWidth - num), 65f); string str3 = str1 + " " + str2; Vector2 vector2_2 = FontAssets.MouseText.Value.MeasureString(str3); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, str1, vector2_1 + new Vector2((float)(-(double)vector2_2.X * 0.5), 0.0f), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, str2, vector2_1 + new Vector2(vector2_2.X * 0.5f, 0.0f), color, 0.0f, new Vector2(FontAssets.MouseText.Value.MeasureString(str2).X, 0.0f), 1f, SpriteEffects.None, 0.0f); }
private void YouDiedL(On.Terraria.Main.orig_DrawInterface_35_YouDied orig) // method swapping for professional mode just because { if (Terraria.Main.player[Terraria.Main.myPlayer].dead) { string value = Terraria.Lang.inter[38].Value; DynamicSpriteFontExtensionMethods.DrawString(Terraria.Main.spriteBatch, Terraria.Main.fontDeathText, value, new Vector2((float)(Terraria.Main.screenWidth / 2) - Terraria.Main.fontDeathText.MeasureString(value).X / 2f, Terraria.Main.screenHeight / 2 - 20), Terraria.Main.player[Terraria.Main.myPlayer].GetDeathAlpha(Microsoft.Xna.Framework.Color.Transparent), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); if (Terraria.Main.player[Terraria.Main.myPlayer].lostCoins > 0) { string textValue = SpectraWorld.professionalMode ? "dropped all (" + Terraria.Main.player[Terraria.Main.myPlayer].lostCoinString + ") coins" : Language.GetTextValue("Game.DroppedCoins", Terraria.Main.player[Terraria.Main.myPlayer].lostCoinString); string coinText = SpectraWorld.professionalMode ? "(" + Terraria.Main.player[Terraria.Main.myPlayer].lostCoinString + ")" : ""; DynamicSpriteFontExtensionMethods.DrawString(Terraria.Main.spriteBatch, Terraria.Main.fontMouseText, textValue, new Vector2((float)(Terraria.Main.screenWidth / 2) - Terraria.Main.fontMouseText.MeasureString(textValue).X / 2f, Terraria.Main.screenHeight / 2 + 30), Terraria.Main.player[Terraria.Main.myPlayer].GetDeathAlpha(Microsoft.Xna.Framework.Color.Transparent), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } }
public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndex != -1) { layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer("BossAssist: Boss Log", delegate { BossLogInterface.Draw(Main.spriteBatch, new GameTime()); return(true); }, InterfaceScaleType.UI) ); layers.Insert(++MouseTextIndex, new LegacyGameInterfaceLayer("BossAssist: Boss Radar", delegate { BossRadarUIInterface.Draw(Main.spriteBatch, new GameTime()); return(true); }, InterfaceScaleType.UI) ); } int InventoryIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Death Text")); if (InventoryIndex != -1) { layers.Insert(InventoryIndex, new LegacyGameInterfaceLayer("BossAssist: Respawn Timer", delegate { if (Main.LocalPlayer.dead && Main.LocalPlayer.difficulty != 2) { if (Main.LocalPlayer.respawnTimer % 60 == 0 && Main.LocalPlayer.respawnTimer / 60 <= 3) { Main.PlaySound(25); } string timer = (Main.LocalPlayer.respawnTimer / 60 + 1).ToString(); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, timer, new Vector2(Main.screenWidth / 2, Main.screenHeight / 2 - 75), new Color(1f, 0.388f, 0.278f), 0f, default(Vector2), 1, SpriteEffects.None, 0f); } return(true); }, InterfaceScaleType.UI) ); } }
/// <summary> /// Draw the health bar. Don't forget to override the methods if you want to change settings. /// </summary> /// <param name="spriteBatch">Pass the spritebatch pls</param> /// <param name="XLeft">The left of the bar, NOT the bar side frame.</param> /// <param name="yTop">Top of the bar frame (including sides).</param> /// <param name="BarLength">Length of the middle section of the bar.</param> /// <param name="Alpha">Alpha between 1f and 0f</param> /// <param name="life">npc.life</param> /// <param name="lifeMax">npc.lifeMax</param> /// <param name="npc">npc itself for handling certain internal methods</param> public static void DrawHealthBar(SpriteBatch spriteBatch, int XLeft, int yTop, int BarLength, float Alpha, int life, int lifeMax, NPC npc) { string displayName = "blushiemagic (M/J)";; // Get variables Color frameColour = Color.White; Color barColour = GetHealthColor(BlushieBoss.Phase3Attack); Color backColour = GetHealthColor(BlushieBoss.Phase3Attack + 1); frameColour *= Alpha; barColour *= Alpha; backColour *= Alpha; Texture2D fill, barL, barM, barR; fill = Bluemagic.HealthBars.GetTexture("UI/HealthBarFill"); barL = Bluemagic.HealthBars.GetTexture("UI/HealthBarStart" + (Main.expertMode ? "_Exp" : "")); barM = Bluemagic.HealthBars.GetTexture("UI/HealthBarMiddle" + (Main.expertMode ? "_Exp" : "")); barR = Bluemagic.HealthBars.GetTexture("UI/HealthBarEnd" + (Main.expertMode ? "_Exp" : "")); int midXOffset = -30; int midYOffset = 10; // The very far left where the side frames start Vector2 FrameTopLeft = new Vector2(XLeft - barL.Width, yTop); // Draw Back drawHealthBarFill(spriteBatch, lifeMax, lifeMax, backColour, fill, BarLength, XLeft, midXOffset, midYOffset, yTop); // Draw Fill int realLength = drawHealthBarFill(spriteBatch, life, lifeMax, barColour, fill, BarLength, XLeft, midXOffset, midYOffset, yTop); // Draw Frame drawHealthBarFrame(spriteBatch, frameColour, barL, barM, barR, BarLength, XLeft, midYOffset, yTop, FrameTopLeft); string text = string.Concat(displayName, ": ", life, "/", lifeMax); DynamicSpriteFontExtensionMethods.DrawString( spriteBatch, Main.fontMouseText, text, new Vector2(XLeft + BarLength / 2, yTop + midYOffset + barM.Height / 2), frameColour, 0f, ChatManager.GetStringSize(Main.fontMouseText, text, Vector2.One, BarLength) / 2, 1.1f, SpriteEffects.None, 0f); }
public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { int deathText = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Death Text")); if (deathText != -1) { layers.Insert(deathText, new LegacyGameInterfaceLayer("Desiccation: Respawn Timer", delegate { if (MyPlayer.dead && ModContent.GetInstance <DesiccationClientsideConfig>().RespawnTimer) { DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, string.Format("{0:f" + ModContent.GetInstance <DesiccationClientsideConfig>().RespawnTimerDecimal + "}", MyPlayer.respawnTimer / 60f), new Vector2((Main.screenWidth / 2) - Main.fontDeathText.MeasureString(string.Format("{0:f" + ModContent.GetInstance <DesiccationClientsideConfig>().RespawnTimerDecimal + "}", MyPlayer.respawnTimer / 60f)).X / 2f, Main.screenHeight / 2 - 70), MyPlayer.GetDeathAlpha(Color.Transparent)); } return(true); }, InterfaceScaleType.UI) ); } int mouseText = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (mouseText != -1) { layers.Insert(mouseText, new LegacyGameInterfaceLayer("Desiccation: Player Name", delegate { if (!Main.gameMenu && ModContent.GetInstance <DesiccationClientsideConfig>().NameInfo&& !DUtils.IsInventoryOpen) { string text = $"{MyName} in {Main.worldName}"; Vector2 size = Utils.DrawBorderString(Main.spriteBatch, text, new Vector2(DrawData.CenterStringXOnScreen(text, Main.fontMouseText), 2f), Color.WhiteSmoke); Rectangle rectangle = new Rectangle((int)DrawData.CenterStringXOnScreen(text, Main.fontMouseText), 2, (int)size.X + 2, (int)size.Y - 10); if (rectangle.ContainsCursor()) { Main.hoverItemName = "Type in chat to change names. '/playername NEW NAME' to change player name, '/worldname NEW NAME' to change world name."; } } return(true); }, InterfaceScaleType.UI) ); } }
private static void PrintNetDiagnosticsLineForMessage(SpriteBatch spriteBatch, int msgId, int x, int y) { float num = 0.7f; string text = ""; text = msgId + ": "; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, text, new Vector2(x, y), Color.White, 0f, default(Vector2), num, SpriteEffects.None, 0f); x += 30; text = "rx:" + $"{rxMsgType[msgId]:0,0}"; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, text, new Vector2(x, y), Color.White, 0f, default(Vector2), num, SpriteEffects.None, 0f); x += 70; text = $"{rxDataType[msgId]:0,0}"; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, text, new Vector2(x, y), Color.White, 0f, default(Vector2), num, SpriteEffects.None, 0f); x += 70; text = msgId + ": "; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, text, new Vector2(x, y), Color.White, 0f, default(Vector2), num, SpriteEffects.None, 0f); x += 30; text = "tx:" + $"{txMsgType[msgId]:0,0}"; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, text, new Vector2(x, y), Color.White, 0f, default(Vector2), num, SpriteEffects.None, 0f); x += 70; text = $"{txDataType[msgId]:0,0}"; DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, text, new Vector2(x, y), Color.White, 0f, default(Vector2), num, SpriteEffects.None, 0f); }
public static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth, bool ignoreColors = false) { var num1 = -1; var vec = new Vector2((float)Main.mouseX, (float)Main.mouseY); var vector2_1 = position; var vector2_2 = vector2_1; var x = font.MeasureString(" ").X; var color = baseColor; var num2 = 0.0f; for (var index1 = 0; index1 < snippets.Length; ++index1) { var snippet = snippets[index1]; snippet.Update(); if (!ignoreColors) { color = snippet.GetVisibleColor(); } var scale = snippet.Scale; Vector2 size; if (snippet.UniqueDraw(false, out size, spriteBatch, vector2_1, color, scale)) { if (vec.Between(vector2_1, vector2_1 + size)) { num1 = index1; } vector2_1.X += size.X * baseScale.X * scale; vector2_2.X = Math.Max(vector2_2.X, vector2_1.X); } else { var strArray1 = snippet.Text.Split('\n'); foreach (var str in strArray1) { var chArray = new char[1] { ' ' }; var strArray2 = str.Split(chArray); for (var index2 = 0; index2 < strArray2.Length; ++index2) { if (index2 != 0) { vector2_1.X += x * baseScale.X * scale; } if ((double)maxWidth > 0.0) { var num3 = font.MeasureString(strArray2[index2]).X *baseScale.X *scale; if ((double)vector2_1.X - (double)position.X + (double)num3 > (double)maxWidth) { vector2_1.X = position.X; vector2_1.Y += (float)font.LineSpacing * num2 * baseScale.Y; vector2_2.Y = Math.Max(vector2_2.Y, vector2_1.Y); num2 = 0.0f; } } if ((double)num2 < (double)scale) { num2 = scale; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, font, strArray2[index2], vector2_1, color, rotation, origin, baseScale * snippet.Scale * scale, SpriteEffects.None, 0.0f); var vector2_3 = font.MeasureString(strArray2[index2]); if (vec.Between(vector2_1, vector2_1 + vector2_3)) { num1 = index1; } vector2_1.X += vector2_3.X * baseScale.X * scale; vector2_2.X = Math.Max(vector2_2.X, vector2_1.X); } if (strArray1.Length > 1) { vector2_1.Y += (float)font.LineSpacing * num2 * baseScale.Y; vector2_1.X = position.X; vector2_2.Y = Math.Max(vector2_2.Y, vector2_1.Y); num2 = 0.0f; } } } } hoveredSnippet = num1; return(vector2_2); }
private void DrawInterfaceInfoAccs() { bool flaghitlife = false; int num = -1; int num2 = -10; int num3 = 0; string text = ""; float num4 = 215f; int num5 = 0; Player player = Main.player[Main.myPlayer]; for (int i = 0; i < 14; i++) { string text2 = ""; string text3 = ""; if ((Main.npcChatText == null || Main.npcChatText == "") && Main.player[Main.myPlayer].sign < 0 && ZZLocalizationMod.modConfiguration.uitext) { if (i == (Main.playerInventory? 0:-1) && !ZZPlayerInfo.visible) { text2 = "每秒" + player.lifeRegen + "生命再生"; text3 = "生命再生速度"; } if (i == (Main.playerInventory? 1:-1) && !ZZPlayerInfo.visible) { text2 = "每秒" + player.manaRegen + "魔力再生"; text3 = "魔力再生速度"; } if (i == (Main.playerInventory? 2:-1) && !ZZPlayerInfo.visible) { text2 = player.wingTimeMax + "最大飞行时间"; text3 = "飞行时间"; } if (i == (Main.playerInventory? 3:-1) && !ZZPlayerInfo.visible) { text2 = "获得" + player.endurance * 100 + "%伤害减免"; text3 = "伤害减免"; } if (i == (Main.playerInventory? 4:-1) && !ZZPlayerInfo.visible) { text2 = "召唤物栏已用/上限:" + player.slotsMinions + " / " + player.maxMinions; text3 = "召唤栏"; } if (i == (Main.playerInventory? 5:-1) && !ZZPlayerInfo.visible) { text2 = "哨兵炮塔上限:" + player.maxTurrets; text3 = "炮塔栏"; } if (i == (Main.playerInventory? 6:-1) && !ZZPlayerInfo.visible && ModLoader.GetMod("ThoriumMod") != null) { ModPlayer playerthorium = Main.player[Main.myPlayer].GetModPlayer(ModLoader.GetMod("ThoriumMod"), "ThoriumPlayer"); text2 = "瑟银乐师灵感: " + ModLoader.GetMod("ThoriumMod").GetPlayer("ThoriumPlayer").GetType().GetField("bardResource").GetValue(playerthorium) + "灵感"; text3 = "瑟银乐师灵感"; } if (i == (Main.playerInventory? 8:0) && !flaghitlife) { int num15 = 2500; int num16 = 300; NPC npcaround = null; NPC npcaround2 = null; NPC npcaround3 = null; text3 = "敌人生命显示"; for (int l = 0; l < 200; l++) { if (Main.npc[l].active && !Main.npc[l].townNPC && Main.npc[l].life < Main.npc[l].lifeMax) { NPC type = Main.npc[l]; float distance = (Main.npc[l].Center - Main.player[Main.myPlayer].Center).Length(); if (distance < (float)num15) { Player player3 = Main.player[Main.myPlayer]; Player player4 = player3; if (npcaround != null) { if (((npcaround.Center - Main.player[Main.myPlayer].Center).Length() - distance > (float)num16) && ((npcaround.Center - Main.player[Main.myPlayer].Center).Length() < 800)) { npcaround = type; } } else { npcaround = type; } if (npcaround2 == null) { npcaround2 = type; npcaround3 = null; } else { npcaround3 = type; } if (npcaround == type) { npcaround2 = null; } } } } if (npcaround == null) { text2 = ""; } else { text2 = npcaround.GivenOrTypeName + ": " + npcaround.life + " / " + npcaround.lifeMax; } if (npcaround2 != null) { text2 += "\n" + npcaround2.GivenOrTypeName + ": " + npcaround2.life + " / " + npcaround2.lifeMax; } if (npcaround3 != null) { text2 += "\n" + npcaround3.GivenOrTypeName + ": " + npcaround3.life + " / " + npcaround3.lifeMax; } flaghitlife = true; } if (i == (Main.playerInventory? 13:6) && ZZLocalizationMod.modConfiguration.zonetext && !ZZPlayerInfo.visible) { text2 = zoneString(player); text3 = "所处环境"; } } if (text2 != "") { int num26; int num27; if (!Main.playerInventory) { num26 = Main.screenWidth - 520; num27 = -80; } else { bool shouldDrawInfoIconsHorizontally = Main.ShouldDrawInfoIconsHorizontally; if (shouldDrawInfoIconsHorizontally) { num26 = Main.screenWidth - 520 + 20 * num3 - 10; num27 = -80; } else { int num28 = (int)(74f * Main.inventoryScale); num26 = Main.screenWidth - 520; /* num26 = 697 - num28 * 4 + Main.screenWidth - 800 + 20 * (num3 % 2);*/ num27 = 114 + num28 * 7 + num28 / 2 + 20 * (num3 / 2) + 8 * (num3 / 4) - 340; if (Main.EquipPage == 2) { /*num26 += num28 + num28 / 2;*/ num27 -= num28; } } } num26 += num5; if (num >= 0) { num3++; int num29 = 22; if (Main.screenHeight < 650) { num29 = 20; } Vector2 vector = new Vector2((float)num26, (float)(num27 + 74 + num29 * i + 52) + 300); int num30 = num; if (num30 == 8) { num30 = 7; } Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; bool flag14 = false; if (!Main.playerInventory) { vector = new Vector2((float)num26, (float)num27); if ((float)Main.mouseX >= vector.X && (float)Main.mouseY >= vector.Y && (float)Main.mouseX <= vector.X + (float)this.infoIconTexture[num].Width && (float)Main.mouseY <= vector.Y + (float)this.infoIconTexture[num].Height) { flag14 = true; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.PlaySound(12, -1, -1, 1, 1f, 0f); Main.mouseLeftRelease = false; Main.player[Main.myPlayer].hideInfo[num30] = !Main.player[Main.myPlayer].hideInfo[num30]; } if (!Main.mouseText) { text = text3; Main.mouseText = true; } } if (Main.player[Main.myPlayer].hideInfo[num30]) { white = new Microsoft.Xna.Framework.Color(80, 80, 80, 70); } } else if ((float)Main.mouseX >= vector.X && (float)Main.mouseY >= vector.Y && (float)Main.mouseX <= vector.X + (float)this.infoIconTexture[num].Width && (float)Main.mouseY <= vector.Y + (float)this.infoIconTexture[num].Height && !Main.mouseText) { num2 = i; text = text3; Main.mouseText = true; } UILinkPointNavigator.SetPosition(1558 + num3 - 1, vector); Main.spriteBatch.Draw(this.infoIconTexture[num], vector, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, this.infoIconTexture[num].Width, this.infoIconTexture[num].Height)), white, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); if (flag14) { Main.spriteBatch.Draw(this.infoIconTexture[13], vector - Vector2.One * 2f, null, Main.OurFavoriteColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } num26 += 20; } UILinkPointNavigator.Shortcuts.INFOACCCOUNT = num3; if (Main.playerInventory) { Vector2 vector2 = new Vector2(1f); Vector2 vector3 = Main.fontMouseText.MeasureString(text2); if (vector3.X > num4) { vector2.X = num4 / vector3.X; } if (vector2.X < 0.58f) { vector2.Y = 1f - vector2.X / 3f; } for (int num31 = 0; num31 < 5; num31++) { int num32 = 0; int num33 = 0; Microsoft.Xna.Framework.Color black = Microsoft.Xna.Framework.Color.Black; if (num31 == 0) { num32 = -2; } if (num31 == 1) { num32 = 2; } if (num31 == 2) { num33 = -2; } if (num31 == 3) { num33 = 2; } if (num31 == 4) { black = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); } if (i > num2 && i < num2 + 2) { black = new Microsoft.Xna.Framework.Color((int)(black.R / 3), (int)(black.G / 3), (int)(black.B / 3), (int)(black.A / 3)); } int num34 = 22; if (Main.screenHeight < 650) { num34 = 20; } DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, text2, new Vector2((float)(num26 + num32), (float)(num27 + 74 + num34 * i + num33) + 100), black, 0f, default(Vector2), vector2, SpriteEffects.None, 0f); } } if (!Main.playerInventory) { Vector2 vector2 = new Vector2(1f); Vector2 vector3 = Main.fontMouseText.MeasureString(text2); if (vector3.X > num4) { vector2.X = num4 / vector3.X; } if (vector2.X < 0.58f) { vector2.Y = 1f - vector2.X / 3f; } for (int num31 = 0; num31 < 5; num31++) { int num32 = 0; int num33 = 0; Microsoft.Xna.Framework.Color black = Microsoft.Xna.Framework.Color.Black; if (num31 == 0) { num32 = -2; } if (num31 == 1) { num32 = 2; } if (num31 == 2) { num33 = -2; } if (num31 == 3) { num33 = 2; } if (num31 == 4) { black = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); } if (i > num2 && i < num2 + 2) { black = new Microsoft.Xna.Framework.Color((int)(black.R / 3), (int)(black.G / 3), (int)(black.B / 3), (int)(black.A / 3)); } int num34 = 22; if (Main.screenHeight < 650) { num34 = 20; } DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, text2, new Vector2((float)(num26 + num32), (float)(num27 + 74 + num34 * i + num33) + 100), black, 0f, default(Vector2), vector2, SpriteEffects.None, 0f); } } } } }
public static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, DynamicSpriteFont font, string text, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, float maxWidth = -1f, bool ignoreColors = false) { var vector2_1 = position; var vector2_2 = vector2_1; var strArray1 = text.Split('\n'); var x = font.MeasureString(" ").X; var color = baseColor; var num1 = 1f; var num2 = 0.0f; foreach (var str1 in strArray1) { var chArray = new char[1] { ':' }; foreach (var str2 in str1.Split(chArray)) { if (str2.StartsWith("sss")) { if (str2.StartsWith("sss1")) { if (!ignoreColors) { color = Color.Red; } } else if (str2.StartsWith("sss2")) { if (!ignoreColors) { color = Color.Blue; } } else if (str2.StartsWith("sssr") && !ignoreColors) { color = Color.White; } } else { var strArray2 = str2.Split(' '); for (var index = 0; index < strArray2.Length; ++index) { if (index != 0) { vector2_1.X += x * baseScale.X * num1; } if ((double)maxWidth > 0.0) { var num3 = font.MeasureString(strArray2[index]).X *baseScale.X *num1; if ((double)vector2_1.X - (double)position.X + (double)num3 > (double)maxWidth) { vector2_1.X = position.X; vector2_1.Y += (float)font.LineSpacing * num2 * baseScale.Y; vector2_2.Y = Math.Max(vector2_2.Y, vector2_1.Y); num2 = 0.0f; } } if ((double)num2 < (double)num1) { num2 = num1; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, font, strArray2[index], vector2_1, color, rotation, origin, baseScale * num1, SpriteEffects.None, 0.0f); vector2_1.X += font.MeasureString(strArray2[index]).X *baseScale.X *num1; vector2_2.X = Math.Max(vector2_2.X, vector2_1.X); } } } vector2_1.X = position.X; vector2_1.Y += (float)font.LineSpacing * num2 * baseScale.Y; vector2_2.Y = Math.Max(vector2_2.Y, vector2_1.Y); num2 = 0.0f; } return(vector2_2); }
private void DrawLife() { Player localPlayer = Main.LocalPlayer; SpriteBatch spriteBatch = Main.spriteBatch; Color color = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); this.UIDisplay_LifePerHeart = 20f; if (localPlayer.ghost) { return; } int num1 = localPlayer.statLifeMax / 20; int num2 = (localPlayer.statLifeMax - 400) / 5; if (num2 < 0) { num2 = 0; } if (num2 > 0) { num1 = localPlayer.statLifeMax / (20 + num2 / 4); this.UIDisplay_LifePerHeart = (float)localPlayer.statLifeMax / 20f; } this.UIDisplay_LifePerHeart += (float)((localPlayer.statLifeMax2 - localPlayer.statLifeMax) / num1); int num3 = (int)((double)localPlayer.statLifeMax2 / (double)this.UIDisplay_LifePerHeart); if (num3 >= 10) { num3 = 10; } string str = Lang.inter[0].Value + " " + (object)localPlayer.statLifeMax2 + "/" + (object)localPlayer.statLifeMax2; Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(str); if (!localPlayer.ghost) { DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, Lang.inter[0].Value, new Vector2((float)(500 + 13 * num3) - vector2.X * 0.5f + (float)this.UI_ScreenAnchorX, 6f), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, localPlayer.statLife.ToString() + "/" + (object)localPlayer.statLifeMax2, new Vector2((float)(500 + 13 * num3) + vector2.X * 0.5f + (float)this.UI_ScreenAnchorX, 6f), color, 0.0f, new Vector2(FontAssets.MouseText.Value.MeasureString(localPlayer.statLife.ToString() + "/" + (object)localPlayer.statLifeMax2).X, 0.0f), 1f, SpriteEffects.None, 0.0f); } for (int index = 1; index < (int)((double)localPlayer.statLifeMax2 / (double)this.UIDisplay_LifePerHeart) + 1; ++index) { float scale = 1f; bool flag = false; int num4; if ((double)localPlayer.statLife >= (double)index * (double)this.UIDisplay_LifePerHeart) { num4 = (int)byte.MaxValue; if ((double)localPlayer.statLife == (double)index * (double)this.UIDisplay_LifePerHeart) { flag = true; } } else { float num5 = ((float)localPlayer.statLife - (float)(index - 1) * this.UIDisplay_LifePerHeart) / this.UIDisplay_LifePerHeart; num4 = (int)(30.0 + 225.0 * (double)num5); if (num4 < 30) { num4 = 30; } scale = (float)((double)num5 / 4.0 + 0.75); if ((double)scale < 0.75) { scale = 0.75f; } if ((double)num5 > 0.0) { flag = true; } } if (flag) { scale += Main.cursorScale - 1f; } int num6 = 0; int num7 = 0; if (index > 10) { num6 -= 260; num7 += 26; } int a = (int)((double)num4 * 0.9); if (!localPlayer.ghost) { if (num2 > 0) { --num2; spriteBatch.Draw(TextureAssets.Heart2.Value, new Vector2((float)(500 + 26 * (index - 1) + num6 + this.UI_ScreenAnchorX + TextureAssets.Heart.Width() / 2), (float)(32.0 + ((double)TextureAssets.Heart.Height() - (double)TextureAssets.Heart.Height() * (double)scale) / 2.0) + (float)num7 + (float)(TextureAssets.Heart.Height() / 2)), new Rectangle?(new Rectangle(0, 0, TextureAssets.Heart.Width(), TextureAssets.Heart.Height())), new Color(num4, num4, num4, a), 0.0f, new Vector2((float)(TextureAssets.Heart.Width() / 2), (float)(TextureAssets.Heart.Height() / 2)), scale, SpriteEffects.None, 0.0f); } else { spriteBatch.Draw(TextureAssets.Heart.Value, new Vector2((float)(500 + 26 * (index - 1) + num6 + this.UI_ScreenAnchorX + TextureAssets.Heart.Width() / 2), (float)(32.0 + ((double)TextureAssets.Heart.Height() - (double)TextureAssets.Heart.Height() * (double)scale) / 2.0) + (float)num7 + (float)(TextureAssets.Heart.Height() / 2)), new Rectangle?(new Rectangle(0, 0, TextureAssets.Heart.Width(), TextureAssets.Heart.Height())), new Color(num4, num4, num4, a), 0.0f, new Vector2((float)(TextureAssets.Heart.Width() / 2), (float)(TextureAssets.Heart.Height() / 2)), scale, SpriteEffects.None, 0.0f); } } } }