summaryrefslogtreecommitdiff
path: root/Assembly_CSharp/UI
diff options
context:
space:
mode:
Diffstat (limited to 'Assembly_CSharp/UI')
-rw-r--r--Assembly_CSharp/UI/AchievementManager.cs424
-rw-r--r--Assembly_CSharp/UI/AudioPoolSource.cs40
-rw-r--r--Assembly_CSharp/UI/BuildButtonUI.cs107
-rw-r--r--Assembly_CSharp/UI/BuildingGhost.cs13
-rw-r--r--Assembly_CSharp/UI/BuildingManager.cs163
-rw-r--r--Assembly_CSharp/UI/DamageNumber.cs138
-rw-r--r--Assembly_CSharp/UI/DamageTracker.cs101
-rw-r--r--Assembly_CSharp/UI/HealthBar.cs157
-rw-r--r--Assembly_CSharp/UI/IBuildable.cs8
-rw-r--r--Assembly_CSharp/UI/KeyDisappear.cs61
-rw-r--r--Assembly_CSharp/UI/MainMenu.cs16
-rw-r--r--Assembly_CSharp/UI/MonsterManualEntry.cs63
-rw-r--r--Assembly_CSharp/UI/OptionsMenu.cs187
-rw-r--r--Assembly_CSharp/UI/PauseMenu.cs140
-rw-r--r--Assembly_CSharp/UI/PlayMenu.cs27
-rw-r--r--Assembly_CSharp/UI/SimpleUI.cs51
-rw-r--r--Assembly_CSharp/UI/SocialMediaManager.cs9
-rw-r--r--Assembly_CSharp/UI/TowerUI.cs289
-rw-r--r--Assembly_CSharp/UI/TreasureUI.cs30
-rw-r--r--Assembly_CSharp/UI/UICameraController.cs67
-rw-r--r--Assembly_CSharp/UI/UIManager.cs47
-rw-r--r--Assembly_CSharp/UI/UniBonusUI.cs46
-rw-r--r--Assembly_CSharp/UI/UniversityUI.cs135
-rw-r--r--Assembly_CSharp/UI/UpgradeButton.cs167
24 files changed, 2486 insertions, 0 deletions
diff --git a/Assembly_CSharp/UI/AchievementManager.cs b/Assembly_CSharp/UI/AchievementManager.cs
new file mode 100644
index 0000000..a189341
--- /dev/null
+++ b/Assembly_CSharp/UI/AchievementManager.cs
@@ -0,0 +1,424 @@
+using Steamworks;
+using UnityEngine;
+
+public class AchievementManager : MonoBehaviour
+{
+ public static AchievementManager instance;
+
+ private int goldSpentOnResearch;
+
+ private int discoveriesMade;
+
+ private int enemiesKilled;
+
+ [SerializeField]
+ private string[] towerUnlockStrings;
+
+ public bool shrineSpawned;
+
+ private void Awake()
+ {
+ instance = this;
+ }
+
+ private void Start()
+ {
+ if (SteamManager.Initialized)
+ {
+ SteamUserStats.GetStat("EnemiesKilled", out enemiesKilled);
+ SteamUserStats.GetStat("DiscoveriesMade", out discoveriesMade);
+ SteamUserStats.GetStat("GoldOnResearch", out goldSpentOnResearch);
+ }
+ }
+
+ public void OnSceneClose()
+ {
+ if (SteamManager.Initialized)
+ {
+ SteamUserStats.SetStat("EnemiesKilled", enemiesKilled);
+ SteamUserStats.SetStat("DiscoveriesMade", discoveriesMade);
+ SteamUserStats.SetStat("GoldOnResearch", goldSpentOnResearch);
+ SteamUserStats.StoreStats();
+ }
+ }
+
+ public void ResetSteamStats()
+ {
+ SteamUserStats.ResetAllStats(bAchievementsToo: true);
+ }
+
+ public void FundResearchAchievement(int amt)
+ {
+ if (goldSpentOnResearch < 100000 && goldSpentOnResearch + amt >= 100000)
+ {
+ UnlockAchievement("Funding100000");
+ }
+ else if (goldSpentOnResearch < 10000 && goldSpentOnResearch + amt >= 10000)
+ {
+ UnlockAchievement("Funding10000");
+ }
+ else if (goldSpentOnResearch < 1000 && goldSpentOnResearch + amt >= 1000)
+ {
+ UnlockAchievement("Funding1000");
+ }
+ goldSpentOnResearch += amt;
+ }
+
+ public void NewDiscoveriesAchievement()
+ {
+ discoveriesMade++;
+ if (discoveriesMade == 100)
+ {
+ UnlockAchievement("Discover100");
+ }
+ else if (discoveriesMade == 10)
+ {
+ UnlockAchievement("Discover10");
+ }
+ else if (discoveriesMade == 1)
+ {
+ UnlockAchievement("Discover1");
+ }
+ }
+
+ public void EnemyKilled()
+ {
+ enemiesKilled++;
+ if (enemiesKilled == 1000000)
+ {
+ UnlockAchievement("Kill1000000Enemies");
+ }
+ else if (enemiesKilled == 100000)
+ {
+ UnlockAchievement("Kill100000Enemies");
+ }
+ else if (enemiesKilled == 10000)
+ {
+ UnlockAchievement("Kill10000Enemies");
+ }
+ else if (enemiesKilled == 1000)
+ {
+ UnlockAchievement("Kill1000Enemies");
+ }
+ else if (enemiesKilled == 100)
+ {
+ UnlockAchievement("Kill100Enemies");
+ }
+ }
+
+ public void UnlockAchievement(string s)
+ {
+ if (SteamManager.Initialized)
+ {
+ Debug.Log("Unlocked Achievement: " + s);
+ SteamUserStats.SetAchievement(s);
+ SteamUserStats.StoreStats();
+ }
+ }
+
+ public void CheckTowerUnlocks()
+ {
+ int num = 0;
+ string[] array = towerUnlockStrings;
+ foreach (string key in array)
+ {
+ num += PlayerPrefs.GetInt(key, 0);
+ }
+ if (num == towerUnlockStrings.Length)
+ {
+ UnlockAchievement("UnlockAllTowers");
+ }
+ }
+
+ public void BeatLevel(int level)
+ {
+ int gameMode = GameManager.instance.gameMode;
+ if (level == 15)
+ {
+ switch (gameMode)
+ {
+ case 1:
+ UnlockAchievement("BeatLevel15Mode1");
+ break;
+ case 2:
+ UnlockAchievement("BeatLevel15Mode2");
+ break;
+ case 3:
+ UnlockAchievement("BeatLevel15Mode3");
+ break;
+ }
+ }
+ if (level == 25)
+ {
+ switch (gameMode)
+ {
+ case 1:
+ UnlockAchievement("BeatLevel25Mode1");
+ break;
+ case 2:
+ UnlockAchievement("BeatLevel25Mode2");
+ break;
+ case 3:
+ UnlockAchievement("BeatLevel25Mode3");
+ break;
+ }
+ }
+ if (level == 35)
+ {
+ switch (gameMode)
+ {
+ case 1:
+ UnlockAchievement("BeatLevel35Mode1");
+ break;
+ case 2:
+ UnlockAchievement("BeatLevel35Mode2");
+ break;
+ case 3:
+ UnlockAchievement("BeatLevel35Mode3");
+ break;
+ }
+ if (!shrineSpawned)
+ {
+ UnlockAchievement("NoShrines");
+ }
+ }
+ if (level == 45)
+ {
+ switch (gameMode)
+ {
+ case 1:
+ UnlockAchievement("BeatLevel45Mode1");
+ break;
+ case 2:
+ UnlockAchievement("BeatLevel45Mode2");
+ break;
+ case 3:
+ UnlockAchievement("BeatLevel45Mode3");
+ break;
+ }
+ }
+ }
+
+ public void TowerLevel(int level)
+ {
+ switch (level)
+ {
+ case 10:
+ UnlockAchievement("TowerLevel10");
+ break;
+ case 20:
+ UnlockAchievement("TowerLevel20");
+ break;
+ case 50:
+ UnlockAchievement("TowerLevel50");
+ break;
+ }
+ }
+
+ public void CheckTowerTypesVictory()
+ {
+ int gameMode = GameManager.instance.gameMode;
+ if (TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Count <= 1)
+ {
+ UnlockAchievement("OnlyBallista");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallista2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallista3");
+ }
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.Crossbow))
+ {
+ UnlockAchievement("NoBallista");
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.Morter) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.Morter) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaMortar");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaMortar2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaMortar3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.TeslaCoil) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.TeslaCoil) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaTesla");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaTesla2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaTesla3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.Frost) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.Frost) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaFrost");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaFrost2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaFrost3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.FlameThrower) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.FlameThrower) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaFlameThrower");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaFlameThrower2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaFlameThrower3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.PoisonSprayer) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.PoisonSprayer) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaPoisonSprayer");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaPoisonSprayer2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaPoisonSprayer3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.Shredder) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.Shredder) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaShredder");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaShredder2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaShredder3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.Encampment) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.Encampment) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaEncampment");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaEncampment2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaEncampment3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.Lookout) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.Lookout) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaLookout");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaLookout2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaLookout3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.Radar) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.Radar) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaRadar");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaRadar2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaRadar3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.Obelisk) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.Obelisk) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaObelisk");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaObelisk2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaObelisk3");
+ }
+ }
+ if ((TowerManager.instance.towersUsed.Contains(TowerType.Crossbow) && TowerManager.instance.towersUsed.Contains(TowerType.ParticleCannon) && TowerManager.instance.towersUsed.Count <= 2) || (TowerManager.instance.towersUsed.Contains(TowerType.ParticleCannon) && TowerManager.instance.towersUsed.Count <= 1))
+ {
+ UnlockAchievement("OnlyBallistaParticleCannon");
+ if (gameMode >= 2)
+ {
+ UnlockAchievement("OnlyBallistaParticleCannon2");
+ }
+ if (gameMode >= 3)
+ {
+ UnlockAchievement("OnlyBallistaParticleCannon3");
+ }
+ }
+ }
+
+ public bool CheckAllTowers()
+ {
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.Crossbow))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.Morter))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.TeslaCoil))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.Frost))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.FlameThrower))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.PoisonSprayer))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.Shredder))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.Encampment))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.Lookout))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.Radar))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.Obelisk))
+ {
+ return false;
+ }
+ if (!TowerManager.instance.towersUsed.Contains(TowerType.ParticleCannon))
+ {
+ return false;
+ }
+ UnlockAchievement("UsedAllTowers");
+ return true;
+ }
+}
diff --git a/Assembly_CSharp/UI/AudioPoolSource.cs b/Assembly_CSharp/UI/AudioPoolSource.cs
new file mode 100644
index 0000000..883151d
--- /dev/null
+++ b/Assembly_CSharp/UI/AudioPoolSource.cs
@@ -0,0 +1,40 @@
+using UnityEngine;
+
+public class AudioPoolSource : MonoBehaviour
+{
+ [SerializeField]
+ private AudioSource audioS;
+
+ private float timer = -1f;
+
+ private bool active;
+
+ public void PlayClip(AudioClip clip, float volume, float pitchVariance)
+ {
+ audioS.Stop();
+ audioS.clip = clip;
+ audioS.pitch = 1f + Random.Range(0f - pitchVariance, pitchVariance);
+ audioS.volume = volume;
+ timer = clip.length + 0.1f;
+ active = true;
+ audioS.Play();
+ }
+
+ private void Update()
+ {
+ if (!active)
+ {
+ return;
+ }
+ timer -= Time.deltaTime;
+ if (timer <= 0f)
+ {
+ active = false;
+ if (base.transform.parent != null)
+ {
+ base.transform.parent = null;
+ }
+ SFXManager.instance.sources.Add(this);
+ }
+ }
+}
diff --git a/Assembly_CSharp/UI/BuildButtonUI.cs b/Assembly_CSharp/UI/BuildButtonUI.cs
new file mode 100644
index 0000000..86c7732
--- /dev/null
+++ b/Assembly_CSharp/UI/BuildButtonUI.cs
@@ -0,0 +1,107 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class BuildButtonUI : MonoBehaviour
+{
+ [SerializeField]
+ private GameObject tower;
+
+ [SerializeField]
+ private TowerFlyweight towerFlyweight;
+
+ [SerializeField]
+ private Text priceTag;
+
+ [SerializeField]
+ private Text modifiersText;
+
+ [SerializeField]
+ private TowerType myTowerType;
+
+ private void Start()
+ {
+ priceTag.text = towerFlyweight.currentPrice + "g";
+ UpdateModifiersText();
+ }
+
+ public void Build()
+ {
+ BuildingManager.instance.EnterBuildMode(tower, towerFlyweight.currentPrice, towerFlyweight.priceIncrease, myTowerType);
+ }
+
+ public void UpdatePriceText()
+ {
+ priceTag.text = towerFlyweight.currentPrice + "g";
+ }
+
+ public void UpdateModifiersText()
+ {
+ if (!(modifiersText != null))
+ {
+ return;
+ }
+ string text = "";
+ if (TowerManager.instance.GetBonusBaseDamage(myTowerType) > 0)
+ {
+ text = text + "\n+" + TowerManager.instance.GetBonusBaseDamage(myTowerType) + " Base Damage";
+ }
+ if (TowerManager.instance.GetBonusBaseDamage(myTowerType) < 0)
+ {
+ text = text + "\n" + TowerManager.instance.GetBonusBaseDamage(myTowerType) + " Base Damage";
+ }
+ if (TowerManager.instance.GetBonusHealthDamage(myTowerType) > 0)
+ {
+ text = text + "\n+" + TowerManager.instance.GetBonusHealthDamage(myTowerType) + " Health Damage";
+ }
+ if (TowerManager.instance.GetBonusArmorDamage(myTowerType) > 0)
+ {
+ text = text + "\n+" + TowerManager.instance.GetBonusArmorDamage(myTowerType) + " Armor Damage";
+ }
+ if (TowerManager.instance.GetBonusShieldDamage(myTowerType) > 0)
+ {
+ text = text + "\n+" + TowerManager.instance.GetBonusShieldDamage(myTowerType) + " Shield Damage";
+ }
+ if (TowerManager.instance.GetCritChance(myTowerType) + TowerManager.instance.GetCritChanceLevelMultiplier(myTowerType) > 0f)
+ {
+ text = text + "\n+(" + (int)(TowerManager.instance.GetCritChance(myTowerType) * 100f);
+ if (TowerManager.instance.GetCritChanceLevelMultiplier(myTowerType) > 1f)
+ {
+ text = text + " + " + (int)TowerManager.instance.GetCritChanceLevelMultiplier(myTowerType) + "xLvl";
+ }
+ else if (TowerManager.instance.GetCritChanceLevelMultiplier(myTowerType) > 0f)
+ {
+ text += " + level";
+ }
+ text += ")% Crit";
+ }
+ if (TowerManager.instance.GetStunChance(myTowerType) > 0f)
+ {
+ text = text + "\n+" + Mathf.FloorToInt(TowerManager.instance.GetStunChance(myTowerType) * 101f) + "% Freeze Chance";
+ }
+ if (TowerManager.instance.GetBonusRange(myTowerType) > 0f)
+ {
+ text = text + "\n+" + TowerManager.instance.GetBonusRange(myTowerType) + " Range";
+ }
+ if (TowerManager.instance.GetBonusBlast(myTowerType) > 0f)
+ {
+ text = text + "\n+" + (int)(TowerManager.instance.GetBonusBlast(myTowerType) * 100f) + "% Blast Radius";
+ }
+ if (TowerManager.instance.GetBonusSlow(myTowerType) > 0f)
+ {
+ text = text + "\n+" + (int)(TowerManager.instance.GetBonusSlow(myTowerType) * 100f) + "% Slow";
+ }
+ if (TowerManager.instance.GetBonusBleed(myTowerType) > 0f)
+ {
+ text = text + "\n+" + (int)(TowerManager.instance.GetBonusBleed(myTowerType) * 100f) + "% Bleed";
+ }
+ if (TowerManager.instance.GetBonusBurn(myTowerType) > 0f)
+ {
+ text = text + "\n+" + (int)(TowerManager.instance.GetBonusBurn(myTowerType) * 100f) + "% Burn";
+ }
+ if (TowerManager.instance.GetBonusPoison(myTowerType) > 0f)
+ {
+ text = text + "\n+" + (int)(TowerManager.instance.GetBonusPoison(myTowerType) * 100f) + "% Poison";
+ }
+ modifiersText.text = text;
+ }
+}
diff --git a/Assembly_CSharp/UI/BuildingGhost.cs b/Assembly_CSharp/UI/BuildingGhost.cs
new file mode 100644
index 0000000..ea1db9f
--- /dev/null
+++ b/Assembly_CSharp/UI/BuildingGhost.cs
@@ -0,0 +1,13 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class BuildingGhost : MonoBehaviour
+{
+ [SerializeField]
+ private Text text;
+
+ public void SetText(string newText)
+ {
+ text.text = newText;
+ }
+}
diff --git a/Assembly_CSharp/UI/BuildingManager.cs b/Assembly_CSharp/UI/BuildingManager.cs
new file mode 100644
index 0000000..4ace1ac
--- /dev/null
+++ b/Assembly_CSharp/UI/BuildingManager.cs
@@ -0,0 +1,163 @@
+using UnityEngine;
+
+public class BuildingManager : MonoBehaviour
+{
+ public static BuildingManager instance;
+
+ [SerializeField]
+ private GameObject buildingGhost;
+
+ private GameObject currentGhost;
+
+ [SerializeField]
+ private GameObject placementFXObject;
+
+ [SerializeField]
+ public GameObject levelUpFX;
+
+ [SerializeField]
+ private LayerMask buildableMask;
+
+ private bool buildSpotAvailable;
+
+ private GameObject thingToBuild;
+
+ private int buildingCost;
+
+ private int priceIncrease;
+
+ private TowerType tType;
+
+ public bool buildMode { get; private set; }
+
+ private void Awake()
+ {
+ instance = this;
+ }
+
+ private void Start()
+ {
+ buildMode = false;
+ }
+
+ private void FixedUpdate()
+ {
+ if (buildMode)
+ {
+ buildSpotAvailable = SamplePoint();
+ }
+ }
+
+ private void Update()
+ {
+ if (!buildMode)
+ {
+ return;
+ }
+ if (Input.GetMouseButtonDown(0) && BuildingCheck())
+ {
+ ResourceManager.instance.Spend(buildingCost);
+ DamageTracker.instance.AddCost(tType, buildingCost);
+ Build();
+ if (!Input.GetKey(KeyCode.LeftShift))
+ {
+ ExitBuildMode();
+ }
+ else
+ {
+ buildingCost += priceIncrease;
+ }
+ }
+ if (Input.GetMouseButtonDown(1) || Input.GetKeyDown(KeyCode.Escape))
+ {
+ ExitBuildMode();
+ }
+ }
+
+ public void EnterBuildMode(GameObject objectToBuild, int cost, int _priceIncrease, TowerType type)
+ {
+ buildMode = true;
+ thingToBuild = objectToBuild;
+ buildingCost = cost;
+ priceIncrease = _priceIncrease;
+ tType = type;
+ }
+
+ private void ExitBuildMode()
+ {
+ HideGhost();
+ buildMode = false;
+ }
+
+ private void Build()
+ {
+ GameObject gameObject = Object.Instantiate(thingToBuild, currentGhost.transform.position, Quaternion.identity);
+ gameObject.GetComponent<IBuildable>()?.SetStats();
+ Object.Instantiate(placementFXObject, gameObject.transform.position + Vector3.up * 0.333f, Quaternion.identity);
+ buildSpotAvailable = SamplePoint();
+ }
+
+ private bool BuildingCheck()
+ {
+ if (!PauseMenu.instance.paused && buildSpotAvailable && ResourceManager.instance.CheckMoney(buildingCost))
+ {
+ return true;
+ }
+ if (!ResourceManager.instance.CheckMoney(buildingCost) && !PauseMenu.instance.paused && buildSpotAvailable)
+ {
+ DamageNumber component = ObjectPool.instance.SpawnObject(ObjectPool.ObjectType.DamageNumber, currentGhost.transform.position + Vector3.up, Quaternion.identity).GetComponent<DamageNumber>();
+ component.SetText("Not enough gold", "Grey", 1f);
+ component.SetHoldTime(0.25f);
+ }
+ return false;
+ }
+
+ private bool SamplePoint()
+ {
+ if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out var hitInfo, 2000f, buildableMask, QueryTriggerInteraction.Ignore))
+ {
+ if (hitInfo.collider.gameObject.layer != LayerMask.NameToLayer("Grass"))
+ {
+ HideGhost();
+ return false;
+ }
+ Vector3 vector = new Vector3(Mathf.Round(hitInfo.point.x), Mathf.Round(3f * hitInfo.point.y) / 3f, Mathf.Round(hitInfo.point.z));
+ if (Vector3.SqrMagnitude(hitInfo.point - vector) < 0.25f)
+ {
+ string text = "";
+ if (vector.y > 0.34f)
+ {
+ text = "+" + (Mathf.RoundToInt(vector.y * 3f) - 1);
+ }
+ DisplayGhost(vector, text);
+ return true;
+ }
+ HideGhost();
+ return false;
+ }
+ HideGhost();
+ return false;
+ }
+
+ private void DisplayGhost(Vector3 pos, string text)
+ {
+ if (currentGhost == null)
+ {
+ currentGhost = Object.Instantiate(buildingGhost, pos, Quaternion.identity);
+ }
+ else
+ {
+ currentGhost.SetActive(value: true);
+ currentGhost.transform.position = pos;
+ }
+ currentGhost.GetComponent<BuildingGhost>().SetText(text);
+ }
+
+ private void HideGhost()
+ {
+ if (currentGhost != null)
+ {
+ currentGhost.SetActive(value: false);
+ }
+ }
+}
diff --git a/Assembly_CSharp/UI/DamageNumber.cs b/Assembly_CSharp/UI/DamageNumber.cs
new file mode 100644
index 0000000..4355328
--- /dev/null
+++ b/Assembly_CSharp/UI/DamageNumber.cs
@@ -0,0 +1,138 @@
+using System.Collections;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class DamageNumber : MonoBehaviour
+{
+ [SerializeField]
+ private Transform holder;
+
+ [SerializeField]
+ private Text text;
+
+ [SerializeField]
+ private int baseTextSize;
+
+ [SerializeField]
+ private float zoom = 0.25f;
+
+ private float hold = 0.5f;
+
+ [SerializeField]
+ private float spin = 0.5f;
+
+ [SerializeField]
+ private Color healthColor;
+
+ [SerializeField]
+ private Color armorColor;
+
+ [SerializeField]
+ private Color shieldColor;
+
+ [SerializeField]
+ private Color greyColor;
+
+ [SerializeField]
+ private Color greenColor;
+
+ public void Start()
+ {
+ StartCoroutine(Bloop());
+ }
+
+ public void SetNumber(int num, string color, float fontScale)
+ {
+ text.fontSize = (int)((float)baseTextSize * fontScale);
+ text.text = num.ToString();
+ switch (color)
+ {
+ case "Blue":
+ text.color = shieldColor;
+ break;
+ case "Yellow":
+ text.color = armorColor;
+ break;
+ case "Red":
+ text.color = healthColor;
+ break;
+ case "Grey":
+ text.color = greyColor;
+ break;
+ case "Green":
+ text.color = greenColor;
+ break;
+ }
+ }
+
+ public void SetText(string _text, string color, float fontScale)
+ {
+ text.fontSize = (int)((float)baseTextSize * fontScale);
+ text.text = _text;
+ switch (color)
+ {
+ case "Blue":
+ text.color = shieldColor;
+ break;
+ case "Yellow":
+ text.color = armorColor;
+ break;
+ case "Red":
+ text.color = healthColor;
+ break;
+ case "Grey":
+ text.color = greyColor;
+ break;
+ case "Green":
+ text.color = greenColor;
+ break;
+ }
+ }
+
+ public void SetHoldTime(float time)
+ {
+ hold = time;
+ }
+
+ private IEnumerator Bloop()
+ {
+ Vector3 scale = Vector3.zero;
+ holder.localScale = scale;
+ holder.localPosition = new Vector3(-1.5f, 2.12132f, 1.5f);
+ text.rectTransform.localRotation = Quaternion.identity;
+ float t2 = zoom;
+ while (t2 > 0f)
+ {
+ scale += Vector3.one * (1f / zoom) * Time.deltaTime;
+ holder.localScale = scale;
+ t2 -= Time.deltaTime;
+ yield return null;
+ }
+ scale = Vector3.one;
+ holder.localScale = scale;
+ t2 = hold;
+ Vector3 direction = new Vector3(Random.Range(-1f, 1f), Random.Range(0f, 1f), 0f);
+ while (t2 > 0f)
+ {
+ holder.localPosition += direction * Time.deltaTime;
+ t2 -= Time.deltaTime;
+ yield return null;
+ }
+ t2 = spin;
+ int r = 1;
+ if (Random.Range(1f, 100f) <= 50f)
+ {
+ r = -1;
+ }
+ while (t2 > 0f)
+ {
+ holder.localPosition += direction * Time.deltaTime;
+ scale -= Vector3.one * (1f / spin) * Time.deltaTime;
+ holder.localScale = scale;
+ text.rectTransform.eulerAngles += r * 180 * Vector3.forward * Time.deltaTime / spin;
+ t2 -= Time.deltaTime;
+ yield return null;
+ }
+ ObjectPool.instance.PoolDamageNumber(base.gameObject);
+ }
+}
diff --git a/Assembly_CSharp/UI/DamageTracker.cs b/Assembly_CSharp/UI/DamageTracker.cs
new file mode 100644
index 0000000..2d80e8f
--- /dev/null
+++ b/Assembly_CSharp/UI/DamageTracker.cs
@@ -0,0 +1,101 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class DamageTracker : MonoBehaviour
+{
+ public enum IncomeType
+ {
+ Monster,
+ House,
+ Haunted,
+ Bonus
+ }
+
+ public static DamageTracker instance;
+
+ public GameObject uiObject;
+
+ [SerializeField]
+ private Text healthDmg;
+
+ [SerializeField]
+ private Text armorDmg;
+
+ [SerializeField]
+ private Text shieldDmg;
+
+ [SerializeField]
+ private Text totalDmg;
+
+ [SerializeField]
+ private Text cost;
+
+ [SerializeField]
+ private Text ratio;
+
+ [SerializeField]
+ private Text incomeTotals;
+
+ [SerializeField]
+ private Text incomePercent;
+
+ private Vector3[] towerDamage = new Vector3[15];
+
+ private int[] towerCost = new int[15];
+
+ private int[] income = new int[4];
+
+ private void Awake()
+ {
+ instance = this;
+ }
+
+ public void AddDamage(TowerType type, int healthDmg, int armorDmg, int shieldDmg)
+ {
+ towerDamage[(int)type].x += (float)healthDmg / 1000f;
+ towerDamage[(int)type].y += (float)armorDmg / 1000f;
+ towerDamage[(int)type].z += (float)shieldDmg / 1000f;
+ }
+
+ public void AddCost(TowerType type, int gold)
+ {
+ towerCost[(int)type] += gold;
+ }
+
+ public void AddIncome(IncomeType type, int gold)
+ {
+ income[(int)type] += gold;
+ }
+
+ public void DisplayIncomeTotals()
+ {
+ float num = 0f;
+ for (int i = 0; i < income.Length; i++)
+ {
+ num += (float)income[i];
+ }
+ num = Mathf.Max(num, 1f);
+ string text = "Gold Generated\n" + income[0] + "g\n" + income[1] + "g\n" + income[2] + "g\n" + income[3] + "g\n";
+ incomeTotals.text = text;
+ string text2 = "Income Share\n" + Mathf.FloorToInt((float)(100 * income[0]) / num) + "%\n" + Mathf.FloorToInt((float)(100 * income[1]) / num) + "%\n" + Mathf.FloorToInt((float)(100 * income[2]) / num) + "%\n" + Mathf.FloorToInt((float)(100 * income[3]) / num) + "%\n";
+ incomePercent.text = text2;
+ }
+
+ public void DisplayDamageTotals()
+ {
+ uiObject.SetActive(value: true);
+ DisplayIncomeTotals();
+ string text = "Health\n" + (int)towerDamage[0].x + "K\n" + (int)towerDamage[1].x + "K\n" + (int)towerDamage[2].x + "K\n" + (int)towerDamage[3].x + "K\n" + (int)towerDamage[5].x + "K\n" + (int)towerDamage[6].x + "K\n" + (int)towerDamage[12].x + "K\n" + (int)towerDamage[13].x + "K\n" + (int)towerDamage[14].x + "K\n" + (int)towerDamage[8].x + "K\n" + (int)towerDamage[4].x + "K\n" + (int)towerDamage[9].x + "K\n" + (int)towerDamage[10].x + "K\n";
+ healthDmg.text = text;
+ string text2 = "Armor\n" + (int)towerDamage[0].y + "K\n" + (int)towerDamage[1].y + "K\n" + (int)towerDamage[2].y + "K\n" + (int)towerDamage[3].y + "K\n" + (int)towerDamage[5].y + "K\n" + (int)towerDamage[6].y + "K\n" + (int)towerDamage[12].y + "K\n" + (int)towerDamage[13].y + "K\n" + (int)towerDamage[14].y + "K\n" + (int)towerDamage[8].y + "K\n" + (int)towerDamage[4].y + "K\n" + (int)towerDamage[9].y + "K\n" + (int)towerDamage[10].y + "K\n";
+ armorDmg.text = text2;
+ string text3 = "Shield\n" + (int)towerDamage[0].z + "K\n" + (int)towerDamage[1].z + "K\n" + (int)towerDamage[2].z + "K\n" + (int)towerDamage[3].z + "K\n" + (int)towerDamage[5].z + "K\n" + (int)towerDamage[6].z + "K\n" + (int)towerDamage[12].z + "K\n" + (int)towerDamage[13].z + "K\n" + (int)towerDamage[14].z + "K\n" + (int)towerDamage[8].z + "K\n" + (int)towerDamage[4].z + "K\n" + (int)towerDamage[9].z + "K\n" + (int)towerDamage[10].z + "K\n";
+ shieldDmg.text = text3;
+ string text4 = "Total\n" + (int)(towerDamage[0].x + towerDamage[0].y + towerDamage[0].z) + "K\n" + (int)(towerDamage[1].x + towerDamage[1].y + towerDamage[1].z) + "K\n" + (int)(towerDamage[2].x + towerDamage[2].y + towerDamage[2].z) + "K\n" + (int)(towerDamage[3].x + towerDamage[3].y + towerDamage[3].z) + "K\n" + (int)(towerDamage[5].x + towerDamage[5].y + towerDamage[5].z) + "K\n" + (int)(towerDamage[6].x + towerDamage[6].y + towerDamage[6].z) + "K\n" + (int)(towerDamage[12].x + towerDamage[12].y + towerDamage[12].z) + "K\n" + (int)(towerDamage[13].x + towerDamage[13].y + towerDamage[13].z) + "K\n" + (int)(towerDamage[14].x + towerDamage[14].y + towerDamage[14].z) + "K\n" + (int)(towerDamage[8].x + towerDamage[8].y + towerDamage[8].z) + "K\n" + (int)(towerDamage[4].x + towerDamage[4].y + towerDamage[4].z) + "K\n" + (int)(towerDamage[9].x + towerDamage[9].y + towerDamage[9].z) + "K\n" + (int)(towerDamage[10].x + towerDamage[10].y + towerDamage[10].z) + "K\n";
+ totalDmg.text = text4;
+ string text5 = "Cost\n" + towerCost[0] + "g\n" + towerCost[1] + "g\n" + towerCost[2] + "g\n" + towerCost[3] + "g\n" + towerCost[5] + "g\n" + towerCost[6] + "g\n" + towerCost[12] + "g\n" + towerCost[13] + "g\n" + towerCost[14] + "g\n" + towerCost[8] + "g\n" + towerCost[4] + "g\n" + towerCost[9] + "g\n";
+ cost.text = text5;
+ string text6 = "Dmg/g\n" + (1000f * ((towerDamage[0].x + towerDamage[0].y + towerDamage[0].z) / (float)Mathf.Max(towerCost[0], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[1].x + towerDamage[1].y + towerDamage[1].z) / (float)Mathf.Max(towerCost[1], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[2].x + towerDamage[2].y + towerDamage[2].z) / (float)Mathf.Max(towerCost[2], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[3].x + towerDamage[3].y + towerDamage[3].z) / (float)Mathf.Max(towerCost[3], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[5].x + towerDamage[5].y + towerDamage[5].z) / (float)Mathf.Max(towerCost[5], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[6].x + towerDamage[6].y + towerDamage[6].z) / (float)Mathf.Max(towerCost[6], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[12].x + towerDamage[12].y + towerDamage[12].z) / (float)Mathf.Max(towerCost[12], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[13].x + towerDamage[13].y + towerDamage[13].z) / (float)Mathf.Max(towerCost[13], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[14].x + towerDamage[14].y + towerDamage[14].z) / (float)Mathf.Max(towerCost[14], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[8].x + towerDamage[8].y + towerDamage[8].z) / (float)Mathf.Max(towerCost[8], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[4].x + towerDamage[4].y + towerDamage[4].z) / (float)Mathf.Max(towerCost[4], 1))).ToString("F2") + "\n" + (1000f * ((towerDamage[9].x + towerDamage[9].y + towerDamage[9].z) / (float)Mathf.Max(towerCost[9], 1))).ToString("F2") + "\n";
+ ratio.text = text6;
+ }
+}
diff --git a/Assembly_CSharp/UI/HealthBar.cs b/Assembly_CSharp/UI/HealthBar.cs
new file mode 100644
index 0000000..558df63
--- /dev/null
+++ b/Assembly_CSharp/UI/HealthBar.cs
@@ -0,0 +1,157 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class HealthBar : MonoBehaviour
+{
+ [SerializeField]
+ private Image maskBar;
+
+ [SerializeField]
+ private Image healthBar;
+
+ [SerializeField]
+ private Image armorBar;
+
+ [SerializeField]
+ private Image shieldBar;
+
+ [SerializeField]
+ private Image dmgBar;
+
+ [SerializeField]
+ private Image slowImageLeft;
+
+ [SerializeField]
+ private Image slowImageRight;
+
+ [SerializeField]
+ private GameObject BleedImage;
+
+ [SerializeField]
+ private GameObject BurnImage;
+
+ [SerializeField]
+ private GameObject PoisonImage;
+
+ [SerializeField]
+ private Text bleedText;
+
+ [SerializeField]
+ private Text burnText;
+
+ [SerializeField]
+ private Text poisonText;
+
+ [SerializeField]
+ private Image fortImageLeft;
+
+ [SerializeField]
+ private Image fortImageRight;
+
+ [SerializeField]
+ private Image hasteImageLeft;
+
+ [SerializeField]
+ private Image hasteImageRight;
+
+ private float maxHp;
+
+ private float health;
+
+ private float armor;
+
+ private float shield;
+
+ private float dmg;
+
+ private float barScaler = 100f;
+
+ private void Update()
+ {
+ if (dmg > health + armor + shield)
+ {
+ dmg = Mathf.Clamp(dmg - 4f * Time.deltaTime, health + armor + shield, dmg);
+ dmgBar.rectTransform.sizeDelta = new Vector2(dmg, 0.25f);
+ }
+ }
+
+ public void SetHealth(int max, int heal, int armr, int shld, int scaleDegree)
+ {
+ barScaler = 10f * Mathf.Pow(10f, scaleDegree);
+ maxHp = (float)max / barScaler;
+ dmg = maxHp;
+ health = (float)heal / barScaler;
+ armor = (float)armr / barScaler;
+ shield = (float)shld / barScaler;
+ maskBar.rectTransform.localScale = new Vector3(3f / (maxHp + 3f), 1f, 1f);
+ maskBar.rectTransform.sizeDelta = new Vector2(maxHp, 0.25f);
+ dmgBar.rectTransform.sizeDelta = new Vector2(dmg, 0.25f);
+ UpdateHealth(heal, armr, shld, 0f, isBleeding: false, isBurning: false, isPoisoned: false, 0, 0, 0);
+ }
+
+ public void UpdateHealth(int heal, int armr, int shld, float currentSlow, bool isBleeding, bool isBurning, bool isPoisoned, int currentBleed, int currentBurn, int currentPoison)
+ {
+ health = (float)heal / barScaler;
+ armor = (float)armr / barScaler;
+ shield = (float)shld / barScaler;
+ healthBar.rectTransform.sizeDelta = new Vector2(health, 0.25f);
+ armorBar.rectTransform.sizeDelta = new Vector2(armor, 0.25f);
+ shieldBar.rectTransform.sizeDelta = new Vector2(shield, 0.25f);
+ armorBar.rectTransform.localPosition = new Vector3(health - maskBar.rectTransform.sizeDelta.x / 2f, 0f, 0f);
+ shieldBar.rectTransform.localPosition = new Vector3(health + armor - maskBar.rectTransform.sizeDelta.x / 2f, 0f, 0f);
+ Image image = slowImageLeft;
+ float fillAmount = (slowImageRight.fillAmount = currentSlow);
+ image.fillAmount = fillAmount;
+ BleedImage.SetActive(isBleeding);
+ bleedText.gameObject.SetActive(isBleeding);
+ bleedText.text = currentBleed.ToString();
+ BurnImage.SetActive(isBurning);
+ burnText.gameObject.SetActive(isBurning);
+ burnText.text = currentBurn.ToString();
+ PoisonImage.SetActive(isPoisoned);
+ poisonText.gameObject.SetActive(isPoisoned);
+ poisonText.text = currentPoison.ToString();
+ }
+
+ public void UpdateSlow(float currentSlow)
+ {
+ Image image = slowImageLeft;
+ float fillAmount = (slowImageRight.fillAmount = currentSlow);
+ image.fillAmount = fillAmount;
+ }
+
+ public void UpdateBleed(bool status, int amt)
+ {
+ BleedImage.SetActive(status);
+ bleedText.gameObject.SetActive(status);
+ bleedText.text = amt.ToString();
+ }
+
+ public void UpdateBurn(bool status, int amt)
+ {
+ BurnImage.SetActive(status);
+ burnText.gameObject.SetActive(status);
+ burnText.text = amt.ToString();
+ }
+
+ public void UpdatePoison(bool status, int amt)
+ {
+ PoisonImage.SetActive(status);
+ poisonText.gameObject.SetActive(status);
+ poisonText.text = amt.ToString();
+ }
+
+ public void UpdateFortified(float fortTime)
+ {
+ Image image = fortImageLeft;
+ float fillAmount = (fortImageRight.fillAmount = fortTime * 0.083333f);
+ image.fillAmount = fillAmount;
+ }
+
+ public void UpdateHaste(float hastePercentage)
+ {
+ Image image = hasteImageLeft;
+ float fillAmount = (hasteImageRight.fillAmount = hastePercentage);
+ image.fillAmount = fillAmount;
+ }
+}
diff --git a/Assembly_CSharp/UI/IBuildable.cs b/Assembly_CSharp/UI/IBuildable.cs
new file mode 100644
index 0000000..5fcdc7e
--- /dev/null
+++ b/Assembly_CSharp/UI/IBuildable.cs
@@ -0,0 +1,8 @@
+public interface IBuildable
+{
+ void SetStats();
+
+ void Demolish();
+
+ void SpawnUI();
+}
diff --git a/Assembly_CSharp/UI/KeyDisappear.cs b/Assembly_CSharp/UI/KeyDisappear.cs
new file mode 100644
index 0000000..d997703
--- /dev/null
+++ b/Assembly_CSharp/UI/KeyDisappear.cs
@@ -0,0 +1,61 @@
+using UnityEngine;
+
+public class KeyDisappear : MonoBehaviour
+{
+ [SerializeField]
+ private GameObject wKey;
+
+ [SerializeField]
+ private GameObject aKey;
+
+ [SerializeField]
+ private GameObject sKey;
+
+ [SerializeField]
+ private GameObject dKey;
+
+ private bool w;
+
+ private bool a;
+
+ private bool s;
+
+ private bool d;
+
+ [SerializeField]
+ private bool destroyOnCompletion = true;
+
+ private float time;
+
+ private void Update()
+ {
+ time += Time.deltaTime;
+ if (time > 3f)
+ {
+ if (Input.GetKeyUp(KeyCode.W))
+ {
+ wKey.SetActive(value: false);
+ w = true;
+ }
+ if (Input.GetKeyUp(KeyCode.A))
+ {
+ aKey.SetActive(value: false);
+ a = true;
+ }
+ if (Input.GetKeyUp(KeyCode.S))
+ {
+ sKey.SetActive(value: false);
+ s = true;
+ }
+ if (Input.GetKeyUp(KeyCode.D))
+ {
+ dKey.SetActive(value: false);
+ d = true;
+ }
+ if (destroyOnCompletion && w && a && s && d)
+ {
+ Object.Destroy(base.gameObject);
+ }
+ }
+ }
+}
diff --git a/Assembly_CSharp/UI/MainMenu.cs b/Assembly_CSharp/UI/MainMenu.cs
new file mode 100644
index 0000000..1028d13
--- /dev/null
+++ b/Assembly_CSharp/UI/MainMenu.cs
@@ -0,0 +1,16 @@
+using UnityEngine;
+
+public class MainMenu : MonoBehaviour
+{
+
+ void Awake()
+ {
+ Screen.fullScreen = false;
+ Screen.SetResolution(1920, 1080, false);
+ }
+
+ public void QuitGame()
+ {
+ Application.Quit();
+ }
+}
diff --git a/Assembly_CSharp/UI/MonsterManualEntry.cs b/Assembly_CSharp/UI/MonsterManualEntry.cs
new file mode 100644
index 0000000..6c5156c
--- /dev/null
+++ b/Assembly_CSharp/UI/MonsterManualEntry.cs
@@ -0,0 +1,63 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class MonsterManualEntry : MonoBehaviour
+{
+ [SerializeField]
+ private int level;
+
+ [SerializeField]
+ private Enemy prefab;
+
+ [SerializeField]
+ private Text titleText;
+
+ [SerializeField]
+ private Text descriptionText;
+
+ [SerializeField]
+ private Image img;
+
+ [SerializeField]
+ private Sprite unknownSprite;
+
+ private void Start()
+ {
+ int b = 0;
+ b = Mathf.Max(PlayerPrefs.GetInt("Record1", 0), b);
+ b = Mathf.Max(PlayerPrefs.GetInt("Record2", 0), b);
+ b = Mathf.Max(PlayerPrefs.GetInt("Record3", 0), b);
+ if (b + 1 < prefab.level)
+ {
+ titleText.text = "???";
+ descriptionText.text = "???";
+ img.sprite = unknownSprite;
+ return;
+ }
+ string text = descriptionText.text;
+ string text2 = "";
+ text2 = text2 + "Speed: " + prefab.baseSpeed;
+ text2 = text2 + "| Health: " + prefab.baseHealth;
+ if (prefab.baseArmor > 0)
+ {
+ text2 = text2 + "| Armor: " + prefab.baseArmor;
+ }
+ if (prefab.baseShield > 0)
+ {
+ text2 = text2 + "| Shield: " + prefab.baseShield;
+ }
+ if (prefab.healthRegen > 0)
+ {
+ text2 = text2 + "| Heal: " + prefab.healthRegen + "/sec";
+ }
+ if (prefab.armorRegen > 0)
+ {
+ text2 = text2 + "| Armor repair: " + prefab.armorRegen + "/sec";
+ }
+ if (prefab.shieldRegen > 0)
+ {
+ text2 = text2 + "| Shield regen: " + prefab.shieldRegen + "/sec";
+ }
+ descriptionText.text = text2 + "\n" + text;
+ }
+}
diff --git a/Assembly_CSharp/UI/OptionsMenu.cs b/Assembly_CSharp/UI/OptionsMenu.cs
new file mode 100644
index 0000000..7377cfd
--- /dev/null
+++ b/Assembly_CSharp/UI/OptionsMenu.cs
@@ -0,0 +1,187 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class OptionsMenu : MonoBehaviour
+{
+ public static OptionsMenu instance;
+
+ public bool showConditionText;
+
+ public bool showDamageNumbers = true;
+
+ public bool extraProjectileEffects = true;
+
+ public float masterVolume;
+
+ public float musicVolume;
+
+ public float sfxVolume;
+
+ [SerializeField]
+ private Transform[] scalableUIs;
+
+ public float uiScale;
+
+ [SerializeField]
+ private Toggle showDamageToggle;
+
+ [SerializeField]
+ private Toggle showConditionToggle;
+
+ [SerializeField]
+ private Toggle projectileFXToggle;
+
+ [SerializeField]
+ private Slider masterVolumeSlider;
+
+ [SerializeField]
+ private Slider musicVolumeSlider;
+
+ [SerializeField]
+ private Slider sfxVolumeSlider;
+
+ [SerializeField]
+ private Slider uiScaleSlider;
+
+ private float timer = 1f;
+
+ private void Awake()
+ {
+ instance = this;
+ }
+
+ private void Update()
+ {
+ if (timer >= 0f)
+ {
+ timer -= Time.deltaTime;
+ }
+ }
+
+ private void Start()
+ {
+ if (PlayerPrefs.GetInt("ShowConditionText", 0) == 1)
+ {
+ showConditionText = true;
+ }
+ else
+ {
+ showConditionText = false;
+ }
+ if (showConditionToggle != null)
+ {
+ showConditionToggle.isOn = showConditionText;
+ }
+ if (PlayerPrefs.GetInt("ShowDamageNumbers", 1) == 1)
+ {
+ showDamageNumbers = true;
+ }
+ else
+ {
+ showDamageNumbers = false;
+ }
+ if (showDamageToggle != null)
+ {
+ showDamageToggle.isOn = showDamageNumbers;
+ }
+ if (PlayerPrefs.GetInt("ExtraProjectileFX", 1) == 1)
+ {
+ extraProjectileEffects = true;
+ }
+ else
+ {
+ extraProjectileEffects = false;
+ }
+ if (projectileFXToggle != null)
+ {
+ projectileFXToggle.isOn = extraProjectileEffects;
+ }
+ masterVolume = PlayerPrefs.GetFloat("MasterVolume", 1f);
+ musicVolume = PlayerPrefs.GetFloat("MusicVolume", 0.5f);
+ sfxVolume = PlayerPrefs.GetFloat("SFXVolume", 0.5f);
+ masterVolumeSlider.value = masterVolume;
+ musicVolumeSlider.value = musicVolume;
+ sfxVolumeSlider.value = sfxVolume;
+ if (uiScaleSlider != null)
+ {
+ uiScale = PlayerPrefs.GetFloat("UIScale", 0.5f);
+ uiScaleSlider.value = uiScale;
+ }
+ }
+
+ public void ToggleDamageNumbers()
+ {
+ showDamageNumbers = showDamageToggle.isOn;
+ PlayerPrefs.SetInt("ShowDamageNumbers", showDamageNumbers ? 1 : 0);
+ if (timer < 0f)
+ {
+ SFXManager.instance.ButtonClick();
+ }
+ }
+
+ public void ToggleConditionTexts()
+ {
+ showConditionText = showConditionToggle.isOn;
+ PlayerPrefs.SetInt("ShowConditionText", showConditionText ? 1 : 0);
+ if (timer < 0f)
+ {
+ SFXManager.instance.ButtonClick();
+ }
+ }
+
+ public void ToggleProjectileFX()
+ {
+ extraProjectileEffects = projectileFXToggle.isOn;
+ PlayerPrefs.SetInt("ExtraProjectileFX", extraProjectileEffects ? 1 : 0);
+ if (timer < 0f)
+ {
+ SFXManager.instance.ButtonClick();
+ }
+ }
+
+ public void ChangeMasterVolume()
+ {
+ masterVolume = masterVolumeSlider.value;
+ PlayerPrefs.SetFloat("MasterVolume", masterVolume);
+ if (MusicManager.instance != null)
+ {
+ MusicManager.instance.UpdateVolume(masterVolume * musicVolume);
+ }
+ if (SFXManager.instance != null)
+ {
+ SFXManager.instance.volume = masterVolume * sfxVolume;
+ }
+ }
+
+ public void ChangeMusicVolume()
+ {
+ musicVolume = musicVolumeSlider.value;
+ PlayerPrefs.SetFloat("MusicVolume", musicVolume);
+ if (MusicManager.instance != null)
+ {
+ MusicManager.instance.UpdateVolume(masterVolume * musicVolume);
+ }
+ }
+
+ public void ChangeSFXVolume()
+ {
+ sfxVolume = sfxVolumeSlider.value;
+ PlayerPrefs.SetFloat("SFXVolume", sfxVolume);
+ if (SFXManager.instance != null)
+ {
+ SFXManager.instance.volume = masterVolume * sfxVolume;
+ }
+ }
+
+ public void ChangeUIScale()
+ {
+ uiScale = uiScaleSlider.value;
+ PlayerPrefs.SetFloat("UIScale", uiScale);
+ float num = Mathf.Max(uiScale + 0.5f, (uiScale + 0.5f) * 2f - 1f);
+ Transform[] array = scalableUIs;
+ for (int i = 0; i < array.Length; i++)
+ {
+ array[i].localScale = num * Vector3.one;
+ }
+ }
+}
diff --git a/Assembly_CSharp/UI/PauseMenu.cs b/Assembly_CSharp/UI/PauseMenu.cs
new file mode 100644
index 0000000..0ccfc28
--- /dev/null
+++ b/Assembly_CSharp/UI/PauseMenu.cs
@@ -0,0 +1,140 @@
+using UnityEngine;
+
+public class PauseMenu : MonoBehaviour
+{
+ [SerializeField]
+ private KeyCode pauseKey1;
+
+ [SerializeField]
+ private KeyCode pauseKey2;
+
+ [SerializeField]
+ private KeyCode hideUIKey;
+
+ [SerializeField]
+ private KeyCode damageTrackerKey;
+
+ [SerializeField]
+ private GameObject pauseMenu;
+
+ [SerializeField]
+ private GameObject areYouSureMenu;
+
+ [SerializeField]
+ private GameObject optionsMenu;
+
+ [SerializeField]
+ private GameObject[] hideableUI;
+
+ [SerializeField]
+ private GameObject[] hideableWithTracker;
+
+ private bool uiHidden;
+
+ private bool trackerHidden = true;
+
+ public bool paused;
+
+ public static PauseMenu instance;
+
+ private void Awake()
+ {
+ instance = this;
+ }
+
+ private void Update()
+ {
+ if (Input.GetKeyDown(pauseKey1) || Input.GetKeyDown(pauseKey2))
+ {
+ if (!paused)
+ {
+ UnHideUI();
+ Pause();
+ }
+ else
+ {
+ UnPause();
+ }
+ }
+ if (Input.GetKeyDown(hideUIKey))
+ {
+ if (uiHidden)
+ {
+ UnHideUI();
+ }
+ else
+ {
+ hideUI();
+ }
+ }
+ if (Input.GetKeyDown(damageTrackerKey))
+ {
+ if (trackerHidden)
+ {
+ UnHideTracker();
+ }
+ else
+ {
+ HideTracker();
+ }
+ }
+ }
+
+ public void Pause()
+ {
+ paused = true;
+ Time.timeScale = 0f;
+ pauseMenu.SetActive(value: true);
+ }
+
+ public void UnPause()
+ {
+ pauseMenu.SetActive(value: false);
+ areYouSureMenu.SetActive(value: false);
+ optionsMenu.SetActive(value: false);
+ Time.timeScale = 1f;
+ paused = false;
+ }
+
+ public void hideUI()
+ {
+ uiHidden = true;
+ GameObject[] array = hideableUI;
+ for (int i = 0; i < array.Length; i++)
+ {
+ array[i].SetActive(value: false);
+ }
+ }
+
+ public void UnHideUI()
+ {
+ uiHidden = false;
+ GameObject[] array = hideableUI;
+ for (int i = 0; i < array.Length; i++)
+ {
+ array[i].SetActive(value: true);
+ }
+ }
+
+ public void HideTracker()
+ {
+ trackerHidden = true;
+ DamageTracker.instance.uiObject.SetActive(value: false);
+ GameObject[] array = hideableWithTracker;
+ for (int i = 0; i < array.Length; i++)
+ {
+ array[i].SetActive(value: false);
+ }
+ }
+
+ public void UnHideTracker()
+ {
+ trackerHidden = false;
+ DamageTracker.instance.DisplayDamageTotals();
+ GameObject[] array = hideableWithTracker;
+ for (int i = 0; i < array.Length; i++)
+ {
+ array[i].SetActive(value: true);
+ }
+ }
+}
diff --git a/Assembly_CSharp/UI/PlayMenu.cs b/Assembly_CSharp/UI/PlayMenu.cs
new file mode 100644
index 0000000..19514b3
--- /dev/null
+++ b/Assembly_CSharp/UI/PlayMenu.cs
@@ -0,0 +1,27 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class PlayMenu : MonoBehaviour
+{
+ [SerializeField]
+ private Text record1Text;
+
+ [SerializeField]
+ private Text record2Text;
+
+ [SerializeField]
+ private Text record3Text;
+
+ private void Start()
+ {
+ record1Text.text = "Current Record\nLevel " + PlayerPrefs.GetInt("Record1", 0);
+ record2Text.text = "Current Record\nLevel " + PlayerPrefs.GetInt("Record2", 0);
+ record3Text.text = "Current Record\nLevel " + PlayerPrefs.GetInt("Record3", 0);
+ }
+
+ public void StartGame(int mode)
+ {
+ PlayerPrefs.SetInt("GameMode", Mathf.Clamp(mode, 1, 3));
+ LevelLoader.instance.LoadLevel("GameScene");
+ }
+}
diff --git a/Assembly_CSharp/UI/SimpleUI.cs b/Assembly_CSharp/UI/SimpleUI.cs
new file mode 100644
index 0000000..ec51413
--- /dev/null
+++ b/Assembly_CSharp/UI/SimpleUI.cs
@@ -0,0 +1,51 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class SimpleUI : MonoBehaviour
+{
+ private GameObject demolishableObject;
+
+ private int goldBackOnDemolish;
+
+ [SerializeField]
+ private Text demolishText;
+
+ [SerializeField]
+ private Text discriptionText;
+
+ [SerializeField]
+ private GameObject demolishButton;
+
+ private void Start()
+ {
+ UIManager.instance.SetNewUI(base.gameObject);
+ }
+
+ public void SetDemolishable(GameObject obj, int goldReturned)
+ {
+ demolishableObject = obj;
+ goldBackOnDemolish = goldReturned;
+ demolishButton.SetActive(value: true);
+ if (demolishText != null)
+ {
+ demolishText.text = "Demolish (" + goldBackOnDemolish + "g)";
+ }
+ }
+
+ public void Demolish()
+ {
+ demolishableObject.GetComponent<IBuildable>()?.Demolish();
+ Object.Destroy(demolishableObject);
+ ResourceManager.instance.AddMoney(goldBackOnDemolish);
+ SFXManager.instance.ButtonClick();
+ UIManager.instance.CloseUI(base.gameObject);
+ }
+
+ public void SetDiscriptionText(string txt)
+ {
+ if (discriptionText != null)
+ {
+ discriptionText.text = txt;
+ }
+ }
+}
diff --git a/Assembly_CSharp/UI/SocialMediaManager.cs b/Assembly_CSharp/UI/SocialMediaManager.cs
new file mode 100644
index 0000000..25f761f
--- /dev/null
+++ b/Assembly_CSharp/UI/SocialMediaManager.cs
@@ -0,0 +1,9 @@
+using UnityEngine;
+
+public class SocialMediaManager : MonoBehaviour
+{
+ public void OpenLink(string s)
+ {
+ Application.OpenURL(s);
+ }
+}
diff --git a/Assembly_CSharp/UI/TowerUI.cs b/Assembly_CSharp/UI/TowerUI.cs
new file mode 100644
index 0000000..7b49139
--- /dev/null
+++ b/Assembly_CSharp/UI/TowerUI.cs
@@ -0,0 +1,289 @@
+using System;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class TowerUI : MonoBehaviour
+{
+ private Tower myTower;
+
+ private int level;
+
+ private int baseDamage;
+
+ private int healthDamage;
+
+ private int armorDamage;
+
+ private int shieldDamage;
+
+ private float healthXP;
+
+ private float armorXP;
+
+ private float shieldXP;
+
+ private bool usesMana;
+
+ private float range;
+
+ private float manaUseMultiplier;
+
+ private int rpm;
+
+ [SerializeField]
+ private Image healthXPImg;
+
+ [SerializeField]
+ private Image armorXPImg;
+
+ [SerializeField]
+ private Image shieldXPImg;
+
+ [SerializeField]
+ private Text levelText;
+
+ [SerializeField]
+ private Text baseDamageText;
+
+ [SerializeField]
+ private Text healthDamageText;
+
+ [SerializeField]
+ private Text armorDamageText;
+
+ [SerializeField]
+ private Text shieldDamageText;
+
+ [SerializeField]
+ private Text healthXPText;
+
+ [SerializeField]
+ private Text armorXPText;
+
+ [SerializeField]
+ private Text shieldXPText;
+
+ [SerializeField]
+ private Text[] priorityTexts;
+
+ [SerializeField]
+ private Text slowText;
+
+ [SerializeField]
+ private Text bleedText;
+
+ [SerializeField]
+ private Text burnText;
+
+ [SerializeField]
+ private Text poisonText;
+
+ [SerializeField]
+ private Text critText;
+
+ [SerializeField]
+ private Text rangeText;
+
+ [SerializeField]
+ private Text rpmText;
+
+ [SerializeField]
+ private Text manaUseText;
+
+ [SerializeField]
+ private Text demolishText;
+
+ private float timer = 0.5f;
+
+ [SerializeField]
+ private LineRenderer line;
+
+ private void Start()
+ {
+ UIManager.instance.SetNewUI(base.gameObject);
+ }
+
+ private void Update()
+ {
+ if (timer < 0f)
+ {
+ SetStats(myTower);
+ timer = 0.5f;
+ }
+ timer -= Time.deltaTime;
+ if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1))
+ {
+ BuyHealthLevel();
+ }
+ if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2))
+ {
+ BuyArmorLevel();
+ }
+ if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3))
+ {
+ BuyShieldLevel();
+ }
+ }
+
+ public void SetStats(Tower _myTower)
+ {
+ myTower = _myTower;
+ level = myTower.level;
+ baseDamage = myTower.damage;
+ healthDamage = myTower.healthDamage;
+ armorDamage = myTower.armorDamage;
+ shieldDamage = myTower.shieldDamage;
+ healthXP = myTower.healthXP;
+ armorXP = myTower.armorXP;
+ shieldXP = myTower.shieldXP;
+ slowText.text = (int)(myTower.slowPercent * 100f) + "%";
+ bleedText.text = (int)(myTower.bleedPercent * 100f) + "%";
+ burnText.text = (int)(myTower.burnPercent * 100f) + "%";
+ poisonText.text = (int)(myTower.poisonPercent * 100f) + "%";
+ critText.text = CritText();
+ if (myTower.range != range)
+ {
+ DrawCircle();
+ }
+ range = myTower.range;
+ rpm = (int)myTower.rpm;
+ usesMana = myTower.consumesMana;
+ manaUseMultiplier = myTower.finalManaConsumption;
+ UpdateText();
+ for (int i = 0; i < priorityTexts.Length; i++)
+ {
+ priorityTexts[i].text = myTower.priorities[i].ToString();
+ }
+ }
+
+ private void DrawCircle()
+ {
+ float num = myTower.range;
+ if (myTower.squareUI)
+ {
+ num += 0.5f;
+ line.SetVertexCount(5);
+ line.useWorldSpace = true;
+ Vector3 position = base.transform.position;
+ position.y = 0.4f;
+ line.SetPosition(0, new Vector3(num, 0f, num) + position);
+ line.SetPosition(1, new Vector3(num, 0f, 0f - num) + position);
+ line.SetPosition(2, new Vector3(0f - num, 0f, 0f - num) + position);
+ line.SetPosition(3, new Vector3(0f - num, 0f, num) + position);
+ line.SetPosition(4, new Vector3(num, 0f, num) + position);
+ return;
+ }
+ line.SetVertexCount(61);
+ line.useWorldSpace = true;
+ Vector3 vector = new Vector3(0f, 0f, 0f);
+ Vector3 position2 = base.transform.position;
+ position2.y = 0.4f;
+ float num2 = 0f;
+ for (int i = 0; i < 61; i++)
+ {
+ vector.x = Mathf.Cos((float)Math.PI / 180f * num2) * num;
+ vector.z = Mathf.Sin((float)Math.PI / 180f * num2) * num;
+ line.SetPosition(i, vector + position2);
+ num2 += 6f;
+ }
+ }
+
+ private string CritText()
+ {
+ string text = "x2! ";
+ text = text + (int)Mathf.Clamp(myTower.critChance * 100f, 0f, 50f) + "%";
+ if (myTower.critChance > 0.5f)
+ {
+ text = text + "\nx3!! " + (int)Mathf.Clamp(myTower.critChance * 100f - 50f, 0f, 50f) + "%";
+ }
+ if (myTower.critChance > 1f)
+ {
+ text = text + "\nx4!! " + (int)Mathf.Clamp(myTower.critChance * 100f - 100f, 0f, 50f) + "%";
+ }
+ return text;
+ }
+
+ private void UpdateText()
+ {
+ levelText.text = "Level: " + level;
+ baseDamageText.text = "Base Damage: " + baseDamage;
+ healthDamageText.text = "Health Multiplier: " + healthDamage + " (" + baseDamage * healthDamage + ")";
+ armorDamageText.text = "Armor Multiplier: " + armorDamage + " (" + baseDamage * armorDamage + ")";
+ shieldDamageText.text = "Shield Multiplier: " + shieldDamage + " (" + baseDamage * shieldDamage + ")";
+ healthXPText.text = ((10 * level - (int)healthXP) * myTower.upgradeCostMultiplier).ToString();
+ armorXPText.text = ((10 * level - (int)armorXP) * myTower.upgradeCostMultiplier).ToString();
+ shieldXPText.text = ((10 * level - (int)shieldXP) * myTower.upgradeCostMultiplier).ToString();
+ healthXPImg.rectTransform.sizeDelta = new Vector2(healthXP / (float)level, 0.25f);
+ armorXPImg.rectTransform.sizeDelta = new Vector2(armorXP / (float)level, 0.25f);
+ shieldXPImg.rectTransform.sizeDelta = new Vector2(shieldXP / (float)level, 0.25f);
+ rangeText.text = "Range: " + range;
+ if (myTower.GetComponent<Dropper>() != null)
+ {
+ rpmText.text = "Fire Rate: " + (int)myTower.GetComponent<Dropper>().dropperRPMdisplay + " RPM";
+ }
+ else
+ {
+ rpmText.text = "Fire Rate: " + rpm + " RPM";
+ }
+ if (usesMana)
+ {
+ manaUseText.text = "Mana Use: " + (int)((float)baseDamage * manaUseMultiplier) + "/shot";
+ }
+ else if (!usesMana && manaUseMultiplier > 0f)
+ {
+ manaUseText.text = "Mana Use: " + manaUseMultiplier + "/sec";
+ }
+ else
+ {
+ manaUseText.text = "";
+ }
+ demolishText.text = "Demolish (" + TowerManager.instance.GetSellPrice(myTower.towerType) + "g)";
+ }
+
+ public void BuyHealthLevel()
+ {
+ SFXManager.instance.ButtonClick();
+ myTower.BuyHealthLevel();
+ SetStats(myTower);
+ }
+
+ public void BuyArmorLevel()
+ {
+ SFXManager.instance.ButtonClick();
+ myTower.BuyArmorLevel();
+ SetStats(myTower);
+ }
+
+ public void BuyShieldLevel()
+ {
+ SFXManager.instance.ButtonClick();
+ myTower.BuyShieldLevel();
+ SetStats(myTower);
+ }
+
+ public void TogglePriorityUp(int index)
+ {
+ SFXManager.instance.ButtonClick();
+ myTower.TogglePriority(index, 1);
+ priorityTexts[index].text = myTower.priorities[index].ToString();
+ }
+
+ public void TogglePriorityDown(int index)
+ {
+ SFXManager.instance.ButtonClick();
+ myTower.TogglePriority(index, -1);
+ priorityTexts[index].text = myTower.priorities[index].ToString();
+ }
+
+ public void DemolishTower()
+ {
+ SFXManager.instance.ButtonClick();
+ myTower.Demolish();
+ CloseUI();
+ }
+
+ public void CloseUI()
+ {
+ UIManager.instance.CloseUI(base.gameObject);
+ }
+}
diff --git a/Assembly_CSharp/UI/TreasureUI.cs b/Assembly_CSharp/UI/TreasureUI.cs
new file mode 100644
index 0000000..c0e297f
--- /dev/null
+++ b/Assembly_CSharp/UI/TreasureUI.cs
@@ -0,0 +1,30 @@
+using UnityEngine;
+
+public class TreasureUI : MonoBehaviour
+{
+ public GameObject myChest;
+
+ private int cardDraw = 2;
+
+ private void Start()
+ {
+ UIManager.instance.SetNewUI(base.gameObject);
+ cardDraw = 2 + PlayerPrefs.GetInt("TreasureDraw1", 0);
+ }
+
+ public void Open()
+ {
+ SFXManager.instance.PlaySound(Sound.CritBig, myChest.transform.position);
+ for (int i = 0; i < myChest.GetComponent<TreasureChest>().numberOfDrops; i++)
+ {
+ CardManager.instance.DrawCards(cardDraw);
+ }
+ Die();
+ }
+
+ public void Die()
+ {
+ Object.Destroy(myChest);
+ UIManager.instance.CloseUI(base.gameObject);
+ }
+}
diff --git a/Assembly_CSharp/UI/UICameraController.cs b/Assembly_CSharp/UI/UICameraController.cs
new file mode 100644
index 0000000..c309492
--- /dev/null
+++ b/Assembly_CSharp/UI/UICameraController.cs
@@ -0,0 +1,67 @@
+using UnityEngine;
+
+public class UICameraController : MonoBehaviour
+{
+ [SerializeField]
+ private float cameraSpeed = 10f;
+
+ [SerializeField]
+ private float cameraZoom = 1f;
+
+ private Vector3 oldPos;
+
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ UpdateMovement();
+ UpdateZoom();
+ }
+
+ public void ResetPosition()
+ {
+ base.transform.localPosition = Vector3.zero;
+ cameraZoom = 1f;
+ base.transform.localScale = Vector3.one * cameraZoom;
+ }
+
+ private Vector3 ViewPointToPixels(Vector3 view)
+ {
+ return new Vector3(view.x * (float)Camera.main.scaledPixelWidth, view.y * (float)Camera.main.scaledPixelHeight, 0f);
+ }
+
+ private void UpdateMovement()
+ {
+ if (Input.GetMouseButtonDown(1))
+ {
+ oldPos = ViewPointToPixels(Camera.main.ScreenToViewportPoint(Input.mousePosition));
+ }
+ if (Input.GetMouseButton(1))
+ {
+ Vector3 vector = ViewPointToPixels(Camera.main.ScreenToViewportPoint(Input.mousePosition));
+ Vector3 translation = vector - oldPos;
+ translation.z = 0f;
+ base.transform.Translate(translation);
+ oldPos = vector;
+ }
+ else
+ {
+ Vector3 vector2 = new Vector3(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"), 0f);
+ if (vector2.sqrMagnitude > 0.1f)
+ {
+ base.transform.Translate(-vector2.normalized * Time.deltaTime * cameraSpeed * (6f / (5f + cameraZoom)));
+ }
+ }
+ }
+
+ private void UpdateZoom()
+ {
+ float num = cameraZoom;
+ cameraZoom = Mathf.Clamp(cameraZoom + Input.mouseScrollDelta.y / 10f, 0.5f, 2f);
+ base.transform.localScale = Vector3.one * cameraZoom;
+ base.transform.localPosition *= cameraZoom / num;
+ base.transform.localPosition += new Vector3(0f, 0.5f * (float)Camera.main.scaledPixelHeight * (cameraZoom - num), 0f);
+ }
+}
diff --git a/Assembly_CSharp/UI/UIManager.cs b/Assembly_CSharp/UI/UIManager.cs
new file mode 100644
index 0000000..2a7081f
--- /dev/null
+++ b/Assembly_CSharp/UI/UIManager.cs
@@ -0,0 +1,47 @@
+using UnityEngine;
+
+public class UIManager : MonoBehaviour
+{
+ public static UIManager instance;
+
+ [SerializeField]
+ private LayerMask clickableMask;
+
+ private GameObject currentUI;
+
+ private void Awake()
+ {
+ instance = this;
+ }
+
+ public void SetNewUI(GameObject newUI)
+ {
+ if (currentUI != null)
+ {
+ Object.Destroy(currentUI);
+ }
+ currentUI = newUI;
+ }
+
+ public void CloseUI(GameObject oldUI)
+ {
+ currentUI = null;
+ Object.Destroy(oldUI);
+ }
+
+ private void Update()
+ {
+ if (Input.GetKeyDown(KeyCode.Escape) && currentUI != null)
+ {
+ CloseUI(currentUI);
+ }
+ if (!BuildingManager.instance.buildMode && Input.GetMouseButtonDown(0) && Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out var hitInfo, 2000f, clickableMask, QueryTriggerInteraction.Collide))
+ {
+ hitInfo.collider.GetComponent<IBuildable>()?.SpawnUI();
+ }
+ if (Input.GetMouseButtonDown(1))
+ {
+ CloseUI(currentUI);
+ }
+ }
+}
diff --git a/Assembly_CSharp/UI/UniBonusUI.cs b/Assembly_CSharp/UI/UniBonusUI.cs
new file mode 100644
index 0000000..8d29a9b
--- /dev/null
+++ b/Assembly_CSharp/UI/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;
+ }
+}
diff --git a/Assembly_CSharp/UI/UniversityUI.cs b/Assembly_CSharp/UI/UniversityUI.cs
new file mode 100644
index 0000000..bf7b8bd
--- /dev/null
+++ b/Assembly_CSharp/UI/UniversityUI.cs
@@ -0,0 +1,135 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class UniversityUI : MonoBehaviour
+{
+ private University myUniversity;
+
+ [SerializeField]
+ private Text healthCostText;
+
+ [SerializeField]
+ private Text armorCostText;
+
+ [SerializeField]
+ private Text shieldCostText;
+
+ [SerializeField]
+ private Text healthDiscoveresText;
+
+ [SerializeField]
+ private Text armorDiscoveriesText;
+
+ [SerializeField]
+ private Text shieldDiscoveriesText;
+
+ [SerializeField]
+ private Text healthBonusText;
+
+ [SerializeField]
+ private Text armorBonusText;
+
+ [SerializeField]
+ private Text shieldBonusText;
+
+ [SerializeField]
+ private Text healthPercentageText;
+
+ [SerializeField]
+ private Text armorPercentageText;
+
+ [SerializeField]
+ private Text shieldPercentageText;
+
+ [SerializeField]
+ private Image healthPercentageImg;
+
+ [SerializeField]
+ private Image armorPercentageImg;
+
+ [SerializeField]
+ private Image shieldPercentageImg;
+
+ [SerializeField]
+ private Text demolishText;
+
+ private void Start()
+ {
+ UIManager.instance.SetNewUI(base.gameObject);
+ if (demolishText != null)
+ {
+ demolishText.text = "Demolish (" + myUniversity.goldBackOnDemolish + "g)";
+ }
+ }
+
+ public void SetStats(University myUni)
+ {
+ myUniversity = myUni;
+ int num = (myUniversity.healthPercent + myUniversity.armorPercent + myUniversity.shieldPercent + 1) * 20;
+ healthCostText.text = num.ToString();
+ armorCostText.text = num.ToString();
+ shieldCostText.text = num.ToString();
+ healthDiscoveresText.text = "Health Studies: " + myUniversity.healthGained;
+ armorDiscoveriesText.text = "Armor Studies: " + myUniversity.armorGained;
+ shieldDiscoveriesText.text = "Magic Studies: " + myUniversity.shieldGained;
+ healthBonusText.text = "Global Health Damage: +" + myUniversity.healthGained;
+ armorBonusText.text = "Global Armor Damage: +" + myUniversity.armorGained;
+ shieldBonusText.text = "Global Shield Damage: +" + myUniversity.shieldGained;
+ healthPercentageText.text = "Health Studies: " + (myUniversity.healthPercent + GameManager.instance.universityBonus) + "%";
+ armorPercentageText.text = "Armor Studies: " + (myUniversity.armorPercent + GameManager.instance.universityBonus) + "%";
+ shieldPercentageText.text = "Magic Studies: " + (myUniversity.shieldPercent + GameManager.instance.universityBonus) + "%";
+ healthPercentageImg.rectTransform.sizeDelta = new Vector2((float)(myUniversity.healthPercent + GameManager.instance.universityBonus) / 10f, 0.25f);
+ armorPercentageImg.rectTransform.sizeDelta = new Vector2((float)(myUniversity.armorPercent + GameManager.instance.universityBonus) / 10f, 0.25f);
+ shieldPercentageImg.rectTransform.sizeDelta = new Vector2((float)(myUniversity.shieldPercent + GameManager.instance.universityBonus) / 10f, 0.25f);
+ if (demolishText != null)
+ {
+ demolishText.text = "Demolish (" + myUniversity.goldBackOnDemolish + "g)";
+ }
+ }
+
+ private void Update()
+ {
+ if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1))
+ {
+ FundHealthResearch();
+ }
+ if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2))
+ {
+ FundArmorResearch();
+ }
+ if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3))
+ {
+ FundShieldResearch();
+ }
+ }
+
+ public void FundHealthResearch()
+ {
+ SFXManager.instance.ButtonClick();
+ myUniversity.FundHealthStudies();
+ SetStats(myUniversity);
+ }
+
+ public void FundArmorResearch()
+ {
+ SFXManager.instance.ButtonClick();
+ myUniversity.FundArmorStudies();
+ SetStats(myUniversity);
+ }
+
+ public void FundShieldResearch()
+ {
+ SFXManager.instance.ButtonClick();
+ myUniversity.FundShieldStudies();
+ SetStats(myUniversity);
+ }
+
+ public void Demolish()
+ {
+ SFXManager.instance.ButtonClick();
+ myUniversity.Demolish();
+ Object.Destroy(myUniversity.gameObject);
+ ResourceManager.instance.AddMoney(myUniversity.goldBackOnDemolish);
+ UIManager.instance.CloseUI(base.gameObject);
+ }
+}
diff --git a/Assembly_CSharp/UI/UpgradeButton.cs b/Assembly_CSharp/UI/UpgradeButton.cs
new file mode 100644
index 0000000..271976b
--- /dev/null
+++ b/Assembly_CSharp/UI/UpgradeButton.cs
@@ -0,0 +1,167 @@
+using System.Collections;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class UpgradeButton : MonoBehaviour
+{
+ [SerializeField]
+ private string unlockString;
+
+ [SerializeField]
+ public int xpCost;
+
+ public int cardCountRequirement;
+
+ [SerializeField]
+ private bool countsAsCardUnlock = true;
+
+ [SerializeField]
+ private bool countAsDevelopment;
+
+ [SerializeField]
+ private Sprite unlockedSprite;
+
+ [SerializeField]
+ private bool checkAchievements;
+
+ [SerializeField]
+ private GameObject priceTag;
+
+ private GameObject currentPriceTag;
+
+ private Image img;
+
+ private Button btn;
+
+ [SerializeField]
+ private UpgradeButton previous;
+
+ [SerializeField]
+ private UpgradeButton[] next;
+
+ public bool unlocked;
+
+ private void Start()
+ {
+ img = GetComponent<Image>();
+ btn = GetComponent<Button>();
+ CheckUnlock();
+ StartCoroutine(LateStart());
+ }
+
+ public void Unlock()
+ {
+ if (UpgradeManager.instance.xp >= xpCost)
+ {
+ SFXManager.instance.ButtonClick();
+ UpgradeManager.instance.AddXP(-xpCost);
+ PlayerPrefs.SetInt(unlockString, 1);
+ if (checkAchievements)
+ {
+ AchievementManager.instance.CheckTowerUnlocks();
+ }
+ UpgradeManager.instance.CountCard(countsAsCardUnlock);
+ UpgradeManager.instance.CountDevelopment(countAsDevelopment);
+ btn.enabled = false;
+ img.sprite = unlockedSprite;
+ unlocked = true;
+ UpdateTitleText();
+ UpgradeButton[] array = next;
+ for (int i = 0; i < array.Length; i++)
+ {
+ array[i].CheckEnabled();
+ }
+ }
+ }
+
+ public void ResetUnlock()
+ {
+ PlayerPrefs.SetInt(unlockString, 0);
+ unlocked = false;
+ }
+
+ private void CheckUnlock()
+ {
+ if (PlayerPrefs.GetInt(unlockString, 0) == 1)
+ {
+ btn.enabled = false;
+ img.sprite = unlockedSprite;
+ unlocked = true;
+ }
+ }
+
+ public void CheckEnabled()
+ {
+ if (previous == null)
+ {
+ if (cardCountRequirement <= UpgradeManager.instance.unlockedCardCount)
+ {
+ btn.interactable = true;
+ }
+ else
+ {
+ btn.interactable = false;
+ }
+ UpdateTitleText();
+ }
+ else
+ {
+ if (previous.unlocked && cardCountRequirement <= UpgradeManager.instance.unlockedCardCount)
+ {
+ btn.interactable = true;
+ }
+ else
+ {
+ btn.interactable = false;
+ }
+ UpdateTitleText();
+ }
+ }
+
+ private void UpdateTitleText()
+ {
+ if (!unlocked)
+ {
+ if (currentPriceTag == null)
+ {
+ currentPriceTag = Object.Instantiate(priceTag, base.transform);
+ currentPriceTag.transform.localPosition = new Vector3(-63.7f, 0f, 0f);
+ int num = cardCountRequirement - UpgradeManager.instance.unlockedCardCount;
+ if (num > 0)
+ {
+ currentPriceTag.GetComponent<RectTransform>().sizeDelta = new Vector2(75f, 50f);
+ currentPriceTag.GetComponentInChildren<Text>().text = " Unlock " + num + "\n more cards";
+ }
+ else
+ {
+ currentPriceTag.GetComponent<RectTransform>().sizeDelta = new Vector2(50f, 25f);
+ currentPriceTag.GetComponentInChildren<Text>().text = xpCost + " xp";
+ }
+ }
+ else
+ {
+ int num2 = cardCountRequirement - UpgradeManager.instance.unlockedCardCount;
+ if (num2 > 0)
+ {
+ currentPriceTag.GetComponent<RectTransform>().sizeDelta = new Vector2(75f, 50f);
+ currentPriceTag.GetComponentInChildren<Text>().text = " Unlock " + num2 + "\n more cards";
+ }
+ else
+ {
+ currentPriceTag.GetComponent<RectTransform>().sizeDelta = new Vector2(50f, 25f);
+ currentPriceTag.GetComponentInChildren<Text>().text = xpCost + " xp";
+ }
+ }
+ }
+ else if (currentPriceTag != null)
+ {
+ currentPriceTag.SetActive(value: false);
+ }
+ }
+
+ private IEnumerator LateStart()
+ {
+ yield return new WaitForSeconds(0.1f);
+ CheckEnabled();
+ }
+}