From 0e63c4a2c6dec8dfa260501fb7d73750261ea7b7 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Sat, 25 Nov 2023 18:39:02 +0800 Subject: + init --- Assembly_CSharp/UniBonusUI.cs | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Assembly_CSharp/UniBonusUI.cs (limited to 'Assembly_CSharp/UniBonusUI.cs') diff --git a/Assembly_CSharp/UniBonusUI.cs b/Assembly_CSharp/UniBonusUI.cs new file mode 100644 index 0000000..8d29a9b --- /dev/null +++ b/Assembly_CSharp/UniBonusUI.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using UnityEngine.UI; + +public class UniBonusUI : MonoBehaviour +{ + public static UniBonusUI instance; + + [SerializeField] + private GameObject uniUI; + + [SerializeField] + private Text uniUIText; + + private int healthTotal; + + private int armorTotal; + + private int shieldTotal; + + private void Awake() + { + instance = this; + } + + public void UniBonus(int health, int armor, int shield) + { + healthTotal += health; + armorTotal += armor; + shieldTotal += shield; + uniUI.SetActive(value: true); + string text = ""; + if (healthTotal > 0) + { + text = text + "+" + healthTotal + "HD"; + } + if (armorTotal > 0) + { + text = text + "\n+" + armorTotal + "AD"; + } + if (shieldTotal > 0) + { + text = text + "\n+" + shieldTotal + "SD"; + } + uniUIText.text = text; + } +} -- cgit v1.1-26-g67d0