using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ShowDamageNumber")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("微软中国")]
[assembly: AssemblyProduct("ShowDamageNumber")]
[assembly: AssemblyCopyright("Copyright © 微软中国 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a1ca53ac-8cac-4162-9005-cf1538cab9b9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShowDamageNumber;
public static class API
{
public static Color defaultColor = new Color(0.75f, 0.45f, 0.3f, 1f);
public const float LocalDistanceThreshold = 0.7f;
public static DamageNumber ShowDamage(float damage, ref SkillTarget target, EDmgType dmgType = EDmgType.Normal, ESizeMode sizeMode = ESizeMode.Auto, EColorMode colorMode = EColorMode.Auto)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Invalid comparison between Unknown and I4
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Invalid comparison between Unknown and I4
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Invalid comparison between Unknown and I4
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Invalid comparison between Unknown and I4
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
if (!ShowDamageNumberPlugin.ShowDamage.Value)
{
return null;
}
SkillSystem skillSystem = GameMain.spaceSector.skillSystem;
SpaceSector spaceSector = GameMain.spaceSector;
bool flag = false;
VectorLF3 val = VectorLF3.zero;
Quaternion val2 = Quaternion.identity;
int astroId = target.astroId;
if ((int)target.type == 15)
{
val = GameMain.mainPlayer.uPosition;
val2 = GameMain.mainPlayer.uRotation;
flag = true;
}
if (astroId > 1000000)
{
if ((int)target.type == 4 && ShowDamageNumberPlugin.SpaceEnemyOnHitDamage.Value)
{
EnemyDFHiveSystem val3 = GameMain.spaceSector.dfHivesByAstro[astroId - 1000000];
if (val3 == null || GameMain.localStar == null)
{
return null;
}
if (val3.starData.id != GameMain.localStar.id)
{
return null;
}
ref EnemyData reference = ref spaceSector.enemyPool[target.id];
val = reference.pos;
val2 = reference.rot;
flag = true;
}
else if ((int)target.type == 6 && ShowDamageNumberPlugin.AllyOnHitDamage.Value)
{
ref CraftData reference2 = ref spaceSector.craftPool[target.id];
val = reference2.pos;
val2 = reference2.rot;
flag = true;
}
}
else if ((astroId <= 100 || astroId > 204899 || astroId % 100 <= 0) && astroId % 100 == 0 && (int)target.type == 6 && ShowDamageNumberPlugin.AllyOnHitDamage.Value)
{
ref CraftData reference3 = ref spaceSector.craftPool[target.id];
val = reference3.pos;
val2 = reference3.rot;
flag = true;
}
if (flag)
{
val = VectorLF3.op_Implicit(skillSystem.sector.GetRelativePose(target.astroId, val, val2).position);
return TryAddNewDamageNumber(damage, VectorLF3.op_Implicit(val), isGroundTarget: false, dmgType, sizeMode, colorMode);
}
return null;
}
public static DamageNumber ShowDamageGround(float damage, ref SkillTargetLocal target, PlanetFactory factory, EDmgType dmgType = EDmgType.Normal, ESizeMode sizeMode = ESizeMode.Auto, EColorMode colorMode = EColorMode.Auto)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between Unknown and I4
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Invalid comparison between Unknown and I4
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Invalid comparison between Unknown and I4
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Invalid comparison between Unknown and I4
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Invalid comparison between Unknown and I4
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Invalid comparison between Unknown and I4
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
if (!ShowDamageNumberPlugin.ShowDamage.Value)
{
return null;
}
bool flag = false;
VectorLF3 val = VectorLF3.zero;
Quaternion val2 = Quaternion.identity;
if ((int)target.type == 4 && ShowDamageNumberPlugin.GoundEnemyOnHitDamage.Value)
{
ref EnemyData reference = ref factory.enemyPool[target.id];
val = reference.pos;
val2 = reference.rot;
flag = true;
}
else if ((int)target.type == 6 && ShowDamageNumberPlugin.AllyOnHitDamage.Value)
{
ref CraftData reference2 = ref factory.craftPool[target.id];
val = reference2.pos;
val2 = reference2.rot;
flag = true;
}
else if ((int)target.type == 0 && ShowDamageNumberPlugin.AllyOnHitDamage.Value)
{
ref EntityData reference3 = ref factory.entityPool[target.id];
val = VectorLF3.op_Implicit(reference3.pos);
val2 = reference3.rot;
flag = true;
}
else if ((int)target.type == 1 && ShowDamageNumberPlugin.VegetableOnHitDamage.Value)
{
ref VegeData reference4 = ref factory.vegePool[target.id];
val = VectorLF3.op_Implicit(reference4.pos);
val2 = reference4.rot;
flag = true;
}
else if ((int)target.type == 2 && ShowDamageNumberPlugin.VegetableOnHitDamage.Value)
{
val = VectorLF3.op_Implicit(factory.veinPool[target.id].pos);
val2 = Quaternion.identity;
flag = true;
}
else if ((int)target.type == 15 && target.id == 1)
{
val = VectorLF3.op_Implicit(GameMain.mainPlayer.position);
val2 = Quaternion.identity;
flag = true;
}
if (ShowDamageNumberPlugin.LocalHideFar.Value && (int)UIGame.viewMode != 3)
{
flag = false;
PlanetData localPlanet = GameMain.localPlanet;
if (localPlanet != null)
{
float num = localPlanet.radius * 0.7f;
num *= num;
Vector3 val3 = VectorLF3.op_Implicit(val) - GameMain.mainPlayer.position;
float num2 = val3.x * val3.x;
if (num2 < num)
{
num2 += val3.y * val3.y;
if (num2 < num)
{
num2 += val3.z * val3.z;
if (num2 < num)
{
flag = true;
}
}
}
}
}
if (flag)
{
val = VectorLF3.op_Implicit(GameMain.spaceSector.skillSystem.sector.GetRelativePose(factory.planet.astroId, val, val2).position);
return TryAddNewDamageNumber(damage, VectorLF3.op_Implicit(val), isGroundTarget: true, dmgType, sizeMode, colorMode, target.id);
}
return null;
}
public static DamageNumber TryAddNewDamageNumber(float damage, Vector3 pos, bool isGroundTarget, EDmgType dmgType, ESizeMode sizeMode, EColorMode colorMode, int targetId = -1)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
if (!ShowDamageNumberPlugin.ShowDamage.Value)
{
return null;
}
lock (DamageNumberController.main)
{
if (dmgType != EDmgType.Dot)
{
int num = ArrangeNewNormalIndex();
if (num < 0)
{
return null;
}
if (DamageNumberController.main.activeArray[num] != null)
{
DamageNumberController.main.activeArray[num].SetForNewDamage(num, damage, pos, isGroundTarget, dmgType, sizeMode, colorMode);
}
else
{
DamageNumber damageNumber = new DamageNumber(num, damage, pos, isGroundTarget, dmgType, sizeMode, colorMode);
DamageNumberController.main.activeArray[num] = damageNumber;
}
return DamageNumberController.main.activeArray[num];
}
if (dmgType == EDmgType.Dot && targetId > 0)
{
if (DamageNumberController.main.dotArray.ContainsKey(targetId) && DamageNumberController.main.dotArray[targetId] != null)
{
DamageNumberController.main.dotArray[targetId].AddDotDamage(damage);
}
else if (DamageNumberController.main.dotArray.Count < 150)
{
int num2 = ArrangeNewNormalIndex();
if (num2 < 0)
{
return null;
}
if (DamageNumberController.main.activeArray[num2] != null)
{
DamageNumberController.main.activeArray[num2].SetForNewDamage(num2, damage, pos, isGroundTarget, dmgType, sizeMode, colorMode);
}
else
{
DamageNumber damageNumber2 = new DamageNumber(num2, damage, pos, isGroundTarget, dmgType, sizeMode, colorMode);
DamageNumberController.main.activeArray[num2] = damageNumber2;
}
DamageNumberController.main.dotArray[targetId] = DamageNumberController.main.activeArray[num2];
return DamageNumberController.main.activeArray[num2];
}
}
}
return null;
}
public static DamageNumber TryAddPlayerShieldResistNumber(float damage)
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
if (!ShowDamageNumberPlugin.ShowDamage.Value)
{
return null;
}
if (!ShowDamageNumberPlugin.IcarusShieldOnHitDamage.Value)
{
return null;
}
int num = ArrangeNewNormalIndex();
if (num < 0)
{
return null;
}
if (DamageNumberController.main.activeArray[num] != null)
{
DamageNumberController.main.activeArray[num].SetForNewDamage(num, damage, Vector3.zero, isGroundTarget: false, EDmgType.ShieldRisist);
}
else
{
DamageNumber damageNumber = new DamageNumber(num, damage, Vector3.zero, isGroundTarget: false, EDmgType.ShieldRisist);
DamageNumberController.main.activeArray[num] = damageNumber;
}
return DamageNumberController.main.activeArray[num];
}
public static bool WorldPointIntoScreen(Vector3 worldPoint, RectTransform rect, out Vector2 rectPoint)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = Vector2.op_Implicit(Camera.main.WorldToScreenPoint(worldPoint));
RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, val, UIRoot.instance.overlayCanvas.worldCamera, ref rectPoint);
return true;
}
public static int ArrangeNewNormalIndex()
{
int num = -1;
if (DamageNumberController.main.recycleCursor > 0)
{
num = DamageNumberController.main.recycleArray[DamageNumberController.main.recycleCursor - 1];
Interlocked.Add(ref DamageNumberController.main.recycleCursor, -1);
}
else
{
if (DamageNumberController.main.cursor >= DamageNumberController.main.activeArray.Length && DamageNumberController.main.activeArray.Length >= ShowDamageNumberPlugin.MaxNumberCount.Value)
{
return -1;
}
while (DamageNumberController.main.cursor >= DamageNumberController.main.activeArray.Length)
{
DamageNumber[] activeArray = DamageNumberController.main.activeArray;
DamageNumberController.main.activeArray = new DamageNumber[activeArray.Length * 2];
Array.Copy(activeArray, DamageNumberController.main.activeArray, activeArray.Length);
}
num = DamageNumberController.main.cursor;
Interlocked.Add(ref DamageNumberController.main.cursor, 1);
}
return num;
}
}
public class DamageNumber
{
public static GameObject glowingObj;
public static GameObject glowingObjWithIcon;
public static Transform parentTrans;
public static Color[] presetColors;
public static int fadeBeginFrame = 20;
public static float fadePerFrame = 0.025f;
public static int destroyFrame = 60;
public static float xSpeedPerFrame = 0.4f;
public static float yA = -0.03f;
public static float y0Frame = 40f;
public static float ShdResistNumDropSpeed = 1.2f;
public static int onhitFrame = 15;
public static int basicMidFontSize2160p = 60;
public static int basicBigFontSize2160p = 90;
public static int basicSmallFontSize2160p = 44;
public static int basicSmallFontLocalDmgThreshold = 10;
public static int basicBigFontLocalDmgThreshold = 200;
public static int basicSmallFontSpaceDmgThreshold = 100;
public static int basicBigFontSpaceDmgThreshold = 2000;
public static Color criticIconColor = new Color(0.75f, 0.2f, 0.1f, 1f);
public static Color thornmailIconColor = new Color(0.402f, 0.2f, 0.802f, 1f);
public static Sprite criticIconSprite;
public static int curMidFontSize;
public static int curBigFontSize;
public static int curSmallFontSize;
public static float dotSizeIncPerDamage;
public static int curSmallFontLocalDmgThreshold;
public static int curBigFontLocalDmgThreshold;
public static int curSmallFontSpaceDmgThreshold;
public static int curBigFontSpaceDmgThreshold;
public int index;
public float damage;
public EDmgType type;
public ESizeMode sizeMode;
public EColorMode colorMode;
public string prefix;
public string suffix;
public bool isGroundTarget;
public int localEnemyId;
public int time;
public GameObject obj;
public Text text;
public float x;
public float y;
public int autoSize;
public int xDirection;
public static void Init()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Expected O, but got Unknown
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0363: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0404: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Unknown result type (might be due to invalid IL or missing references)
//IL_0466: Unknown result type (might be due to invalid IL or missing references)
//IL_0486: Unknown result type (might be due to invalid IL or missing references)
//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
//IL_04bd: Expected O, but got Unknown
//IL_050d: Unknown result type (might be due to invalid IL or missing references)
//IL_051f: Unknown result type (might be due to invalid IL or missing references)
//IL_053d: Unknown result type (might be due to invalid IL or missing references)
//IL_0559: Unknown result type (might be due to invalid IL or missing references)
//IL_0575: Unknown result type (might be due to invalid IL or missing references)
//IL_0591: Unknown result type (might be due to invalid IL or missing references)
//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0606: Unknown result type (might be due to invalid IL or missing references)
//IL_0640: Unknown result type (might be due to invalid IL or missing references)
//IL_0645: Unknown result type (might be due to invalid IL or missing references)
//IL_0664: Unknown result type (might be due to invalid IL or missing references)
//IL_0669: Unknown result type (might be due to invalid IL or missing references)
//IL_0688: Unknown result type (might be due to invalid IL or missing references)
//IL_068d: Unknown result type (might be due to invalid IL or missing references)
//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
//IL_06f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0718: Unknown result type (might be due to invalid IL or missing references)
//IL_071d: Unknown result type (might be due to invalid IL or missing references)
//IL_073c: Unknown result type (might be due to invalid IL or missing references)
//IL_0741: Unknown result type (might be due to invalid IL or missing references)
//IL_0760: Unknown result type (might be due to invalid IL or missing references)
//IL_0765: Unknown result type (might be due to invalid IL or missing references)
criticIconSprite = Resources.Load<Sprite>("icons/signal/signal-503");
Transform transform = GameObject.Find("UI Root/Overlay Canvas/In Game").transform;
GameObject val = new GameObject("DamageTexts");
val.transform.parent = transform;
val.transform.SetAsFirstSibling();
val.transform.localScale = Vector3.one;
val.transform.localPosition = Vector3.zero;
val.AddComponent<RectTransform>();
parentTrans = val.transform;
Text component = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Replicator Window/queue-group/label").GetComponent<Text>();
glowingObj = new GameObject("dmg");
glowingObj.AddComponent<Text>();
glowingObj.GetComponent<Text>().text = "0";
((Graphic)glowingObj.GetComponent<Text>()).raycastTarget = false;
((Graphic)glowingObj.GetComponent<Text>()).color = new Color(0.732f, 0.45f, 0f, 1f);
glowingObj.GetComponent<Text>().font = Resources.Load<Font>("ui/fonts/sairasb");
((Graphic)glowingObj.GetComponent<Text>()).material = ((Graphic)component).material;
glowingObj.GetComponent<Text>().alignment = (TextAnchor)4;
glowingObj.GetComponent<Text>().verticalOverflow = (VerticalWrapMode)1;
glowingObj.GetComponent<Text>().horizontalOverflow = (HorizontalWrapMode)1;
glowingObj.AddComponent<Outline>();
((Shadow)glowingObj.GetComponent<Outline>()).effectColor = Color.black;
glowingObj.AddComponent<Shadow>();
glowingObj.GetComponent<Shadow>().effectColor = Color.black;
float num = DSPGame.globalOption.uiLayoutHeight;
if (DSPGame.globalOption.uiLayoutHeight <= 0)
{
num = UICanvasScalerHandler.GetSuggestUILayoutHeight(((Resolution)(ref DSPGame.globalOption.resolution)).height);
}
curMidFontSize = (int)Math.Round(num / 2160f * (float)basicMidFontSize2160p);
curBigFontSize = (int)Math.Round(num / 2160f * (float)basicBigFontSize2160p);
curSmallFontSize = (int)Math.Round(num / 2160f * (float)basicSmallFontSize2160p);
glowingObj.GetComponent<Text>().fontSize = curMidFontSize;
glowingObj.transform.localScale = Vector3.one;
glowingObj.transform.SetParent(parentTrans, false);
glowingObj.GetComponent<RectTransform>().anchorMax = Vector2.op_Implicit(Vector3.zero);
glowingObj.GetComponent<RectTransform>().anchorMin = Vector2.op_Implicit(Vector3.zero);
glowingObj.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);
glowingObj.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
glowingObj.SetActive(false);
glowingObjWithIcon = new GameObject("dmg");
glowingObjWithIcon.transform.SetParent(parentTrans, false);
glowingObjWithIcon.SetActive(false);
glowingObjWithIcon.transform.localScale = Vector3.one;
glowingObjWithIcon.AddComponent<Text>();
glowingObjWithIcon.GetComponent<Text>().text = "0";
((Graphic)glowingObjWithIcon.GetComponent<Text>()).raycastTarget = false;
((Graphic)glowingObjWithIcon.GetComponent<Text>()).color = new Color(0.732f, 0.45f, 0f, 1f);
glowingObjWithIcon.GetComponent<Text>().font = Resources.Load<Font>("ui/fonts/sairasb");
((Graphic)glowingObjWithIcon.GetComponent<Text>()).material = ((Graphic)component).material;
glowingObjWithIcon.GetComponent<Text>().alignment = (TextAnchor)3;
glowingObjWithIcon.GetComponent<Text>().verticalOverflow = (VerticalWrapMode)1;
glowingObjWithIcon.GetComponent<Text>().horizontalOverflow = (HorizontalWrapMode)1;
glowingObjWithIcon.GetComponent<RectTransform>().sizeDelta = new Vector2(300f, 300f);
glowingObjWithIcon.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 0f);
glowingObjWithIcon.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 0f);
glowingObjWithIcon.GetComponent<RectTransform>().pivot = new Vector2(0f, 0.5f);
glowingObjWithIcon.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0f, 0f, 0f);
glowingObjWithIcon.AddComponent<Outline>();
((Shadow)glowingObjWithIcon.GetComponent<Outline>()).effectColor = Color.black;
glowingObjWithIcon.AddComponent<Shadow>();
glowingObjWithIcon.GetComponent<Shadow>().effectColor = Color.black;
GameObject val2 = new GameObject("icon");
val2.transform.SetParent(glowingObjWithIcon.transform);
val2.AddComponent<Image>();
val2.GetComponent<Image>().sprite = Resources.Load<Sprite>("icons/signal/signal-503");
((Graphic)val2.GetComponent<Image>()).material = ((Graphic)component).material;
((Graphic)val2.GetComponent<Image>()).color = criticIconColor;
val2.transform.localScale = Vector3.one;
val2.GetComponent<RectTransform>().sizeDelta = new Vector2((float)curBigFontSize, (float)curBigFontSize);
val2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 0.5f);
val2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 0.5f);
val2.GetComponent<RectTransform>().pivot = new Vector2(1f, 0.5f);
val2.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0.0046296297f * num, -0.0018518518f * num, 0f);
val2.AddComponent<Outline>();
((Shadow)val2.GetComponent<Outline>()).effectColor = Color.black;
((Shadow)val2.GetComponent<Outline>()).effectDistance = new Vector2(2f, -2f);
val2.AddComponent<Shadow>();
val2.GetComponent<Shadow>().effectColor = Color.black;
val2.SetActive(false);
presetColors = (Color[])(object)new Color[10];
presetColors[0] = new Color(0.732f, 0.45f, 0f, 1f);
presetColors[1] = new Color(0.732f, 0.45f, 0f, 1f);
presetColors[2] = new Color(0.65f, 0.65f, 0.65f, 1f);
presetColors[3] = new Color(0.75f, 0.2f, 0.1f, 1f);
presetColors[4] = new Color(0.732f, 0.45f, 0f, 1f);
presetColors[5] = new Color(0.402f, 0.2f, 0.802f, 1f);
presetColors[6] = new Color(0.45f, 0.45f, 0.45f, 1f);
presetColors[7] = new Color(0.2f, 0.8f, 0.2f, 0.917f);
presetColors[8] = new Color(0.2f, 0.55f, 0.72f, 1f);
}
public static void UpdateGameHistoryData()
{
if (GameMain.history != null)
{
float val = Math.Max(GameMain.history.energyDamageScale, GameMain.history.blastDamageScale);
val = Math.Max(val, GameMain.history.kineticDamageScale);
val = 1f + (val - 1f) * 0.9f;
curSmallFontLocalDmgThreshold = (int)Math.Round((float)basicSmallFontLocalDmgThreshold * val);
curBigFontLocalDmgThreshold = (int)Math.Round((float)basicBigFontLocalDmgThreshold * val);
curSmallFontSpaceDmgThreshold = (int)Math.Round((float)basicSmallFontSpaceDmgThreshold * val);
curBigFontSpaceDmgThreshold = (int)Math.Round((float)basicBigFontSpaceDmgThreshold * val);
dotSizeIncPerDamage = (float)(curBigFontSize - curSmallFontSize) * 1f / (float)curBigFontLocalDmgThreshold;
}
}
public DamageNumber(int index, float damage, Vector3 pos, bool isGroundTarget, EDmgType dmgType = EDmgType.Normal, ESizeMode sizeMode = ESizeMode.Auto, EColorMode colorMode = EColorMode.Auto)
{
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
this.index = index;
this.damage = damage;
type = dmgType;
this.sizeMode = sizeMode;
this.colorMode = colorMode;
time = 0;
this.obj = Object.Instantiate<GameObject>(glowingObjWithIcon);
if (dmgType == EDmgType.Crit)
{
((Component)this.obj.transform.Find("icon")).gameObject.SetActive(true);
((Component)this.obj.transform.Find("icon")).GetComponent<Image>().sprite = criticIconSprite;
((Graphic)((Component)this.obj.transform.Find("icon")).GetComponent<Image>()).color = criticIconColor;
}
else
{
((Component)this.obj.transform.Find("icon")).gameObject.SetActive(false);
}
this.obj.transform.SetParent(parentTrans, false);
this.obj.transform.localScale = (Vector3)((type == EDmgType.Dot || type == EDmgType.DotEnding) ? new Vector3(0.5f, 0.5f, 0.5f) : Vector3.one);
Transform obj = parentTrans;
API.WorldPointIntoScreen(pos, (RectTransform)(object)((obj is RectTransform) ? obj : null), out var rectPoint);
if (dmgType == EDmgType.ShieldRisist)
{
x = 0f;
y = 0f;
}
else
{
x = rectPoint.x + (float)(Utils.randSeed.Value.NextDouble() - 0.5) * (float)curBigFontSize / 2f + (float)curBigFontSize;
y = rectPoint.y + (float)(Utils.randSeed.Value.NextDouble() - 0.5) * (float)curBigFontSize / 2f + 1.5f * (float)curBigFontSize;
}
this.obj.GetComponent<RectTransform>().anchoredPosition = new Vector2(x, y);
xDirection = ((Utils.randSeed.Value.NextDouble() > 0.5) ? 1 : (-1));
prefix = "";
suffix = "";
if (type == EDmgType.ShieldRisist)
{
prefix = "- ";
}
else if (type == EDmgType.Crit)
{
suffix = "!";
}
text = this.obj.GetComponent<Text>();
text.text = prefix + (int)damage + suffix;
this.obj.SetActive(true);
this.isGroundTarget = isGroundTarget;
AutoSize();
AutoColor();
}
public void SetForNewDamage(int index, float damage, Vector3 pos, bool isGroundTarget, EDmgType dmgType = EDmgType.Normal, ESizeMode sizeMode = ESizeMode.Auto, EColorMode colorMode = EColorMode.Auto)
{
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
this.index = index;
this.damage = damage;
type = dmgType;
this.sizeMode = sizeMode;
this.colorMode = colorMode;
time = 0;
if ((Object)(object)this.obj == (Object)null)
{
Remove();
return;
}
if (dmgType == EDmgType.Crit)
{
((Component)this.obj.transform.Find("icon")).gameObject.SetActive(true);
((Component)this.obj.transform.Find("icon")).GetComponent<Image>().sprite = criticIconSprite;
((Graphic)((Component)this.obj.transform.Find("icon")).GetComponent<Image>()).color = criticIconColor;
}
else
{
((Component)this.obj.transform.Find("icon")).gameObject.SetActive(false);
}
this.obj.transform.localScale = (Vector3)((type == EDmgType.Dot || type == EDmgType.DotEnding) ? new Vector3(0.5f, 0.5f, 0.5f) : Vector3.one);
Transform obj = parentTrans;
API.WorldPointIntoScreen(pos, (RectTransform)(object)((obj is RectTransform) ? obj : null), out var rectPoint);
if (dmgType == EDmgType.ShieldRisist)
{
x = 0f;
y = 0f;
}
else
{
x = rectPoint.x + (float)(Utils.randSeed.Value.NextDouble() - 0.5) * (float)curBigFontSize / 2f + (float)curBigFontSize;
y = rectPoint.y + (float)(Utils.randSeed.Value.NextDouble() - 0.5) * (float)curBigFontSize / 2f + 1.5f * (float)curBigFontSize;
}
this.obj.GetComponent<RectTransform>().anchoredPosition = new Vector2(x, y);
xDirection = ((Utils.randSeed.Value.NextDouble() > 0.5) ? 1 : (-1));
prefix = "";
suffix = "";
if (type == EDmgType.ShieldRisist)
{
prefix = "- ";
}
else if (type == EDmgType.Crit)
{
suffix = "!";
}
else if (type == EDmgType.Thornmail)
{
prefix = "❃ ";
}
text = this.obj.GetComponent<Text>();
text.text = prefix + (int)damage + suffix;
this.isGroundTarget = isGroundTarget;
AutoSize();
AutoColor();
this.obj.SetActive(true);
}
public void SetTargetData(ref SkillTargetLocal target)
{
localEnemyId = target.id;
}
public void AddDotDamage(float damage)
{
this.damage += damage;
text.text = ((int)this.damage).ToString();
time = 0;
AutoSize();
AutoColor();
}
public void Update()
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
//IL_036f: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)this.obj == (Object)null)
{
OnNullObj();
}
if (time > destroyFrame)
{
Remove();
return;
}
if (type == EDmgType.ShieldRisist)
{
this.obj.GetComponent<RectTransform>().anchoredPosition = new Vector2(x, y - (float)time * ShdResistNumDropSpeed);
if (time > onhitFrame)
{
((Graphic)text).color = new Color(((Graphic)text).color.r, ((Graphic)text).color.g, ((Graphic)text).color.b, ((Graphic)text).color.a - fadePerFrame);
}
AutoScale();
time++;
return;
}
if (type != EDmgType.Dot && type != EDmgType.DotEnding && type != EDmgType.Crit)
{
this.obj.GetComponent<RectTransform>().anchoredPosition = new Vector2(x + (float)time * xSpeedPerFrame * (float)xDirection, y + yA * (float)time * ((float)time - y0Frame));
}
else if (type == EDmgType.Dot)
{
if (GameMain.localPlanet == null || DamageNumberController.main.lastPlanetId != GameMain.localPlanet.id)
{
Remove();
return;
}
PlanetFactory val = GameMain.galaxy.PlanetById(DamageNumberController.main.lastPlanetId)?.factory;
if (val != null && localEnemyId > 0 && localEnemyId < val.enemyCursor)
{
ref EnemyData reference = ref val.enemyPool[localEnemyId];
if (reference.id > 0)
{
VectorLF3 pos = reference.pos;
Quaternion rot = reference.rot;
pos = VectorLF3.op_Implicit(GameMain.spaceSector.skillSystem.sector.GetRelativePose(val.planet.astroId, pos, rot).position);
Vector3 worldPoint = VectorLF3.op_Implicit(pos);
Transform obj = parentTrans;
API.WorldPointIntoScreen(worldPoint, (RectTransform)(object)((obj is RectTransform) ? obj : null), out var rectPoint);
this.obj.GetComponent<RectTransform>().anchoredPosition = new Vector2(rectPoint.x + (float)curBigFontSize, rectPoint.y + (float)curBigFontSize);
}
else
{
type = EDmgType.DotEnding;
time = (int)((float)fadeBeginFrame * 0.6f);
if (DamageNumberController.main.dotArray.ContainsKey(localEnemyId))
{
DamageNumberController.main.dotArray.Remove(localEnemyId);
}
}
}
}
if (time > fadeBeginFrame)
{
((Graphic)text).color = new Color(((Graphic)text).color.r, ((Graphic)text).color.g, ((Graphic)text).color.b, ((Graphic)text).color.a - fadePerFrame);
if (type == EDmgType.Crit)
{
Transform obj2 = this.obj.transform.Find("icon");
Image val2 = ((obj2 != null) ? ((Component)obj2).GetComponent<Image>() : null);
if ((Object)(object)val2 != (Object)null)
{
((Graphic)val2).color = new Color(((Graphic)val2).color.r, ((Graphic)val2).color.g, ((Graphic)val2).color.b, ((Graphic)text).color.a);
}
}
}
if (type == EDmgType.Dot)
{
AutoSize();
AutoColor();
}
AutoScale();
time++;
}
public void Remove()
{
if (type == EDmgType.Dot && DamageNumberController.main.dotArray.ContainsKey(localEnemyId))
{
DamageNumberController.main.dotArray.Remove(localEnemyId);
}
if ((Object)(object)obj != (Object)null)
{
obj.SetActive(false);
}
if (index >= 0 && index < DamageNumberController.main.cursor)
{
while (DamageNumberController.main.recycleCursor >= DamageNumberController.main.recycleArray.Length)
{
int[] recycleArray = DamageNumberController.main.recycleArray;
DamageNumberController.main.recycleArray = new int[recycleArray.Length * 2];
Array.Copy(recycleArray, DamageNumberController.main.recycleArray, recycleArray.Length);
}
DamageNumberController.main.recycleArray[DamageNumberController.main.recycleCursor] = index;
DamageNumberController.main.recycleCursor++;
}
index = -1;
localEnemyId = -1;
}
public void OnNullObj()
{
Remove();
}
public void AutoSize()
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
if (type == EDmgType.Dot)
{
int num = (int)((float)curSmallFontSize + damage * dotSizeIncPerDamage);
text.fontSize = (((float)num > 1.3f * (float)curBigFontSize) ? ((int)(1.3f * (float)curBigFontSize)) : num);
}
else if (type == EDmgType.Crit)
{
text.fontSize = curBigFontSize;
((Component)obj.transform.Find("icon")).GetComponent<RectTransform>().sizeDelta = new Vector2((float)text.fontSize, (float)text.fontSize);
}
else
{
if (sizeMode != 0)
{
return;
}
if (isGroundTarget)
{
if (damage < (float)curSmallFontLocalDmgThreshold)
{
text.fontSize = curSmallFontSize;
}
else if (damage < (float)curBigFontLocalDmgThreshold)
{
text.fontSize = curMidFontSize;
}
else
{
text.fontSize = curBigFontSize;
}
}
else if (damage < (float)curSmallFontSpaceDmgThreshold)
{
text.fontSize = curSmallFontSize;
}
else if (damage < (float)curBigFontSpaceDmgThreshold)
{
text.fontSize = curMidFontSize;
}
else
{
text.fontSize = curBigFontSize;
}
}
}
public void AutoScale()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
if (type != EDmgType.Dot && time <= onhitFrame)
{
float num = 1f - (float)time * 0.5f / (float)onhitFrame;
obj.transform.localScale = new Vector3(num, num, num);
if (xDirection > 0 && type != EDmgType.DotEnding && type != EDmgType.Crit)
{
x += xSpeedPerFrame * (float)text.fontSize / (float)curSmallFontSize;
}
}
}
public void AutoColor()
{
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
if (type == EDmgType.Dot)
{
if (damage < (float)curSmallFontLocalDmgThreshold)
{
float num = damage / (float)curSmallFontLocalDmgThreshold;
Color val = presetColors[2];
Color val2 = presetColors[0];
((Graphic)text).color = new Color(val.r * (1f - num) + val2.r * num, val.g * (1f - num) + val2.g * num, val.b * (1f - num) + val2.b * num, val.a * (1f - num) + val2.a * num);
}
else if (damage < (float)curBigFontLocalDmgThreshold)
{
float num2 = (damage - (float)curSmallFontLocalDmgThreshold) / (float)(curBigFontLocalDmgThreshold - curSmallFontLocalDmgThreshold);
Color val3 = presetColors[0];
Color val4 = presetColors[3];
((Graphic)text).color = new Color(val3.r * (1f - num2) + val4.r * num2, val3.g * (1f - num2) + val4.g * num2, val3.b * (1f - num2) + val4.b * num2, val3.a * (1f - num2) + val4.a * num2);
}
else
{
((Graphic)text).color = presetColors[3];
}
}
else if (type == EDmgType.Crit)
{
((Graphic)text).color = presetColors[3];
}
else if (type == EDmgType.ShieldRisist)
{
((Graphic)text).color = presetColors[8];
}
else if (colorMode == EColorMode.Auto)
{
if (isGroundTarget)
{
if (damage < (float)curSmallFontLocalDmgThreshold)
{
((Graphic)text).color = presetColors[2];
}
else if (damage < (float)curBigFontLocalDmgThreshold)
{
((Graphic)text).color = presetColors[0];
}
else
{
((Graphic)text).color = presetColors[3];
}
}
else if (damage < (float)curSmallFontSpaceDmgThreshold)
{
((Graphic)text).color = presetColors[2];
}
else if (damage < (float)curBigFontSpaceDmgThreshold)
{
((Graphic)text).color = presetColors[0];
}
else
{
((Graphic)text).color = presetColors[3];
}
}
else
{
((Graphic)text).color = presetColors[(int)colorMode];
}
}
}
public enum EDmgType
{
Normal = 0,
Dot = 1,
DotEnding = 2,
Crit = 3,
Heal = 4,
ShieldRisist = 5,
Thornmail = 6,
Custom = 99
}
public enum ESizeMode
{
Auto,
CustomFixed,
Small,
Middle,
Big
}
public enum EColorMode
{
Auto,
CustomFixed,
PresetWhite,
PresetRed,
PresetGold,
PresetPurple,
PresetGray,
PresetGreen,
PresetBlue
}
public static class DamageNumberController
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__7_0;
internal void <Init>b__7_0()
{
ShowHideDamageNumberOnChange();
}
}
public static DamageNumberDatas main;
public static List<int> listForClearNull;
public static Image ImgShowDamage;
public static Sprite checkBoxCheckedIcon;
public static Sprite checkBoxUncheckedIcon;
public static long lastNFrameShdDmgTotal;
public const int showShdDmgOncePerNFrame = 6;
public static void Init()
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Expected O, but got Unknown
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_034c: Unknown result type (might be due to invalid IL or missing references)
//IL_0368: Unknown result type (might be due to invalid IL or missing references)
//IL_0389: Unknown result type (might be due to invalid IL or missing references)
//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Expected O, but got Unknown
main = new DamageNumberDatas();
listForClearNull = new List<int>();
lastNFrameShdDmgTotal = 0L;
checkBoxCheckedIcon = Resources.Load<Sprite>("ui/textures/sprites/icons/checkbox-on");
checkBoxUncheckedIcon = Resources.Load<Sprite>("ui/textures/sprites/icons/checkbox-off");
GameObject val = GameObject.Find("UI Root/Overlay Canvas/In Game/Z Screen/fleet-group/fleet-panel");
GameObject val2 = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Dyson Sphere Editor/Dyson Editor Control Panel/hierarchy/layers/display-group/display-toggle-3/checkbox-back-structures");
if (!((Object)(object)val2 != (Object)null) || !((Object)(object)val != (Object)null))
{
return;
}
GameObject val3 = Object.Instantiate<GameObject>(val2);
val3.transform.SetParent(val.transform, false);
val3.transform.localScale = Vector3.one;
((Object)val3).name = "show-damage";
Object.DestroyImmediate((Object)(object)val3.GetComponent<Image>());
val3.AddComponent<Image>();
val3.GetComponent<Image>().sprite = Resources.Load<Sprite>("ui/textures/sprites/sci-fi/sci-fi-button-32-4k");
((UnityEventBase)val3.GetComponent<Button>().onClick).RemoveAllListeners();
ButtonClickedEvent onClick = val3.GetComponent<Button>().onClick;
object obj = <>c.<>9__7_0;
if (obj == null)
{
UnityAction val4 = delegate
{
ShowHideDamageNumberOnChange();
};
<>c.<>9__7_0 = val4;
obj = (object)val4;
}
((UnityEvent)onClick).AddListener((UnityAction)obj);
((Graphic)((Component)val3.transform.Find("text")).GetComponent<Text>()).color = Color.white;
val3.GetComponent<RectTransform>().sizeDelta = Vector2.op_Implicit(new Vector3(140f, 22f, 0f));
val3.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
val3.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
val3.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
val3.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(-230f, 45f, 0f);
val3.GetComponent<UIButton>().tips.tipTitle = "";
val3.GetComponent<UIButton>().tips.corner = 1;
val3.GetComponent<UIButton>().tips.delay = 0.1f;
val3.GetComponent<UIButton>().tips.width = 300;
val3.GetComponent<UIButton>().transitions[0].target = (Graphic)(object)val3.GetComponent<Image>();
val3.GetComponent<UIButton>().transitions[0].normalColor = new Color(1f, 1f, 1f, 0f);
val3.GetComponent<UIButton>().transitions[0].mouseoverColor = new Color(1f, 1f, 1f, 0.0392f);
val3.GetComponent<UIButton>().transitions[0].pressedColor = new Color(1f, 1f, 1f, 0.0314f);
((Component)val3.transform.Find("text")).GetComponent<Localizer>().stringKey = "Show Damage Number";
val3.AddComponent<UIBlockZone>();
GameObject val5 = new GameObject();
((Object)val5).name = "icon";
val5.transform.SetParent(val3.transform, false);
val5.AddComponent<Image>();
val5.GetComponent<Image>().sprite = checkBoxCheckedIcon;
ImgShowDamage = val5.GetComponent<Image>();
val5.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 0.5f);
val5.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 0.5f);
val5.GetComponent<RectTransform>().pivot = new Vector2(0f, 0.5f);
val5.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0f, 0f, 0f);
val5.GetComponent<RectTransform>().sizeDelta = new Vector2(20f, 20f);
RefreshUI();
}
public static void RefreshDataWhenLoad()
{
ClearAllNumbers();
main.lastPlanetId = -1;
}
public static void Update()
{
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameData), "GameTick")]
public static void GameTickUpdate(long time)
{
if (!ShowDamageNumberPlugin.ShowDamage.Value)
{
return;
}
CheckPlayerViewStatus();
if (time % 60 == 50)
{
DamageNumber.UpdateGameHistoryData();
}
if (lastNFrameShdDmgTotal > 0 && Utils.randSeed.Value.NextDouble() * 6.0 <= 1.0)
{
API.TryAddPlayerShieldResistNumber(lastNFrameShdDmgTotal);
lastNFrameShdDmgTotal = 0L;
}
for (int i = 0; i < main.cursor; i++)
{
if (main.activeArray[i] != null && main.activeArray[i].index >= 0)
{
main.activeArray[i].Update();
}
}
}
public static void CheckPlayerViewStatus()
{
int num = ((GameMain.localPlanet != null) ? GameMain.localPlanet.id : (-1));
if (num != main.lastPlanetId)
{
ClearAllNumbers();
main.lastPlanetId = num;
}
}
public static void ClearAllNumbers()
{
ForceRemoveAllNumbers();
}
public static void ForceRemoveAllNumbers()
{
int num = 0;
while (num < DamageNumber.parentTrans.childCount)
{
if (((Object)((Component)DamageNumber.parentTrans.GetChild(num)).gameObject).name != "dmg")
{
Object.DestroyImmediate((Object)(object)((Component)DamageNumber.parentTrans.GetChild(num)).gameObject);
}
else
{
num++;
}
}
int num2 = main.activeArray.Length;
for (int i = 0; i < num2; i++)
{
main.activeArray[i] = null;
}
main.dotArray.Clear();
main.cursor = 0;
main.recycleCursor = 0;
lastNFrameShdDmgTotal = 0L;
}
public static void ShowHideDamageNumberOnChange()
{
if (ShowDamageNumberPlugin.ShowDamage.Value)
{
ForceRemoveAllNumbers();
}
ShowDamageNumberPlugin.ShowDamage.Value = !ShowDamageNumberPlugin.ShowDamage.Value;
((ConfigEntryBase)ShowDamageNumberPlugin.ShowDamage).ConfigFile.Save();
RefreshUI();
}
public static void RefreshUI()
{
if (ShowDamageNumberPlugin.ShowDamage.Value)
{
ImgShowDamage.sprite = checkBoxCheckedIcon;
}
else
{
ImgShowDamage.sprite = checkBoxUncheckedIcon;
}
}
}
public class DamageNumberDatas
{
public DamageNumber[] activeArray;
public int cursor;
public int[] recycleArray;
public int recycleCursor;
public Dictionary<int, DamageNumber> dotArray;
public int lastPlanetId;
public DamageNumberDatas()
{
activeArray = new DamageNumber[10];
cursor = 0;
recycleArray = new int[10];
recycleCursor = 0;
dotArray = new Dictionary<int, DamageNumber>();
lastPlanetId = -1;
}
}
public class OnDamagePatcher
{
public const int dotInterval = 20;
[HarmonyPostfix]
[HarmonyPatch(typeof(SkillSystem), "DamageObject")]
public static void OnDamageObject(ref SkillSystem __instance, int damage, int slice, ref SkillTarget target, ref SkillTarget caster)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Invalid comparison between Unknown and I4
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Invalid comparison between Unknown and I4
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Invalid comparison between Unknown and I4
if (!ShowDamageNumberPlugin.ShowDamage.Value || (GameMain.localPlanet != null && (int)target.type != 15) || slice == 4)
{
return;
}
int astroId = target.astroId;
if (astroId <= 1000000 && astroId > 100 && astroId <= 204899 && astroId % 100 > 0)
{
return;
}
float num = (float)Math.Round((float)damage / 100f);
if (caster.id == 1 && (int)caster.type == 6 && slice != 7 && damage <= 200)
{
return;
}
if (slice == 7 && (int)target.type == 4)
{
if (GameMain.instance.timei % 60 == target.id * 7 % 60)
{
API.ShowDamage(num * 60f, ref target);
}
return;
}
switch (slice)
{
case 2:
API.ShowDamage(num, ref target, EDmgType.Crit);
break;
case 3:
API.ShowDamage(num, ref target, EDmgType.Thornmail, ESizeMode.Auto, EColorMode.PresetPurple);
break;
default:
API.ShowDamage(num, ref target);
break;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SkillSystem), "DamageGroundObjectByLocalCaster")]
public static void OnDamageGroundObjectByLocalCaster(ref SkillSystem __instance, PlanetFactory factory, int damage, int slice, ref SkillTargetLocal target)
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Invalid comparison between Unknown and I4
if (!ShowDamageNumberPlugin.ShowDamage.Value || target.id <= 0 || GameMain.localPlanet == null || GameMain.localPlanet.id != factory.planetId)
{
return;
}
float damage2 = (float)Math.Round((float)damage / 100f);
if (slice == 10 && (int)target.type == 4)
{
API.ShowDamageGround(damage2, ref target, factory, EDmgType.Dot)?.SetTargetData(ref target);
return;
}
switch (slice)
{
case 2:
API.ShowDamageGround(damage2, ref target, factory, EDmgType.Crit);
break;
case 3:
API.ShowDamageGround(damage2, ref target, factory, EDmgType.Thornmail, ESizeMode.Auto, EColorMode.PresetPurple);
break;
default:
API.ShowDamageGround(damage2, ref target, factory);
break;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SkillSystem), "DamageGroundObjectByRemoteCaster")]
public static void OnDamageGroundObjectByRemoteCaster(ref SkillSystem __instance, PlanetFactory factory, int damage, int slice, ref SkillTargetLocal target)
{
if (ShowDamageNumberPlugin.ShowDamage.Value && target.id > 0 && GameMain.localPlanet != null && GameMain.localPlanet.id == factory.planetId)
{
float damage2 = (float)Math.Round((float)damage / 100f);
switch (slice)
{
case 2:
API.ShowDamageGround(damage2, ref target, factory, EDmgType.Crit);
break;
case 3:
API.ShowDamageGround(damage2, ref target, factory, EDmgType.Thornmail, ESizeMode.Auto, EColorMode.PresetPurple);
break;
default:
API.ShowDamageGround(damage2, ref target, factory);
break;
}
}
}
[HarmonyPrefix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static bool OnSpaceDamageMechaShield(int damage)
{
int num = (int)Math.Round((float)damage / 100f);
Interlocked.Add(ref DamageNumberController.lastNFrameShdDmgTotal, num);
return true;
}
[HarmonyPrefix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static bool OnLocalDamageMechaShield(int damage)
{
int num = (int)Math.Round((float)damage / 100f);
Interlocked.Add(ref DamageNumberController.lastNFrameShdDmgTotal, num);
return true;
}
}
[BepInPlugin("com.GniMaerd.ShowDamageNumber", "ShowDamageNumber", "1.0.2")]
public class ShowDamageNumberPlugin : BaseUnityPlugin
{
public const string NAME = "ShowDamageNumber";
public const string GUID = "com.GniMaerd.ShowDamageNumber";
public const string VERSION = "1.0.2";
public static ConfigEntry<bool> ShowDamage;
public static ConfigEntry<bool> LocalHideFar;
public static ConfigEntry<int> MaxNumberCount;
public static ConfigEntry<bool> GoundEnemyOnHitDamage;
public static ConfigEntry<bool> SpaceEnemyOnHitDamage;
public static ConfigEntry<bool> IcarusShieldOnHitDamage;
public static ConfigEntry<bool> AllyOnHitDamage;
public static ConfigEntry<bool> VegetableOnHitDamage;
public static ConfigEntry<int> SmallTextSize;
public static ConfigEntry<int> MiddleTextSize;
public static ConfigEntry<int> BigTextSize;
public void Awake()
{
ShowDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "ShowDamage", true, "Whether show the damage number. 是否显示伤害数字。");
LocalHideFar = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "Local_HideFarDamageNumber", true, "Hide the Damage Number far from player when on a planet. 在行星上时,隐藏距离玩家较远的伤害数字。");
MaxNumberCount = ((BaseUnityPlugin)this).Config.Bind<int>("config", "MaxNumberCount", 150, "Limit the maximum number of damage numbers that can be displayed simultaneously. Excessive values may significantly reduce performance in high-frequency damage scenarios. 限制可同时显示的伤害数字的最大数量。过高的同屏限制可能会在高频伤害场景严重降低性能。");
GoundEnemyOnHitDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "GoundEnemyOnHitDamage", true, "Whether show the damage number when the ground dark fog is hit. 是否显示地面黑雾的受击伤害数字。");
SpaceEnemyOnHitDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "SpaceEnemyOnHitDamage", true, "Whether show the damage number when the space dark fog is hit. 是否显示太空黑雾的受击伤害数字。");
IcarusShieldOnHitDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "IcarusShieldOnHitDamage", false, "Whether show the damage number when the Icarus' shield is hit. 是否显示伊卡洛斯护盾的受击伤害数字。");
AllyOnHitDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "AllyOnHitDamage", false, "Whether show the damage number when the ally buildings or fleets are hit. 是否显示友方建筑或舰队的受击伤害数字。");
VegetableOnHitDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "VegetableOnHitDamage", true, "Whether show the damage number when the ground sundries are hit. 是否显示地面杂物的受击伤害数字。");
SmallTextSize = ((BaseUnityPlugin)this).Config.Bind<int>("config", "SmallTextSize", 44, "Text size for minor damage. 较小伤害的文本大小。");
MiddleTextSize = ((BaseUnityPlugin)this).Config.Bind<int>("config", "MiddleTextSize", 60, "Text size for normal damage. 普通伤害的文本大小。");
BigTextSize = ((BaseUnityPlugin)this).Config.Bind<int>("config", "BigTextSize", 90, "Text size for major damage and critical strike damage. 较大伤害和暴击伤害的文本大小。");
DamageNumber.basicSmallFontSize2160p = SmallTextSize.Value;
DamageNumber.basicMidFontSize2160p = MiddleTextSize.Value;
DamageNumber.basicBigFontSize2160p = BigTextSize.Value;
Harmony.CreateAndPatchAll(typeof(ShowDamageNumberPlugin), (string)null);
Harmony.CreateAndPatchAll(typeof(OnDamagePatcher), (string)null);
Harmony.CreateAndPatchAll(typeof(DamageNumberController), (string)null);
}
public void Start()
{
DamageNumberController.Init();
DamageNumber.Init();
}
public void Update()
{
DamageNumberController.Update();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameSave), "LoadCurrentGame")]
public void OnLoadGame()
{
DamageNumberController.RefreshDataWhenLoad();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameData), "NewGame")]
public void OnNewGame()
{
DamageNumberController.RefreshDataWhenLoad();
}
}
public static class Utils
{
private static int seed = Environment.TickCount;
public static readonly ThreadLocal<Random> randSeed = new ThreadLocal<Random>(() => new Random(Interlocked.Increment(ref seed)));
}