diff --git a/Assets/Scripts/Data Store/Databases/ResourceDatabase.cs b/Assets/Scripts/Data Store/Databases/ResourceDatabase.cs
index d33adfbe..ba7067ad 100644
--- a/Assets/Scripts/Data Store/Databases/ResourceDatabase.cs
+++ b/Assets/Scripts/Data Store/Databases/ResourceDatabase.cs
@@ -34,9 +34,12 @@ public static int GetResourceId(string name)
throw new System.Exception($"Resource '{name}' does not exits");
}
- public static string GetResourceName(int id, string locale = "en")
+ public static string GetResourceName(int id, bool color = false, string locale = "en")
{
- return INST.resourceList.resourceDefinations[id].name;
+ var res = INST.resourceList.resourceDefinations[id];
+ if (color)
+ return GameRegistry.RarityColors.ColorizeAsString(res.name, res.tier);
+ return res.name;
}
public static int GetSpriteId(int id)
diff --git a/Assets/Scripts/Data Store/RarityColors.cs b/Assets/Scripts/Data Store/RarityColors.cs
index 1379aa14..dddea173 100644
--- a/Assets/Scripts/Data Store/RarityColors.cs
+++ b/Assets/Scripts/Data Store/RarityColors.cs
@@ -1,9 +1,27 @@
using System.Collections;
using System.Collections.Generic;
+using System.Text;
+
using UnityEngine;
[CreateAssetMenu(menuName = "Game Data/Rarity Colors")]
public class RarityColors : ScriptableObject
{
public Color[] Colors;
+
+ public string ColorizeAsString(string name, int rarity)
+ {
+ return Colorize(name, rarity).ToString();
+ }
+
+ public StringBuilder Colorize(string name, int rarity)
+ {
+ var sb = new StringBuilder();
+ sb.Append("');
+ sb.Append(name);
+ sb.Append("");
+ return sb;
+ }
}
diff --git a/Assets/Scripts/Data Store/ResourceDefination.cs b/Assets/Scripts/Data Store/ResourceDefination.cs
index 8725cab6..0b8f829b 100644
--- a/Assets/Scripts/Data Store/ResourceDefination.cs
+++ b/Assets/Scripts/Data Store/ResourceDefination.cs
@@ -1,4 +1,6 @@
-using UnityEngine;
+using JetBrains.Annotations;
+
+using UnityEngine;
[System.Serializable]
public class ResourceDefination
@@ -6,4 +8,5 @@ public class ResourceDefination
public string name;
public Sprite sprite;
public int spriteID;
+ public int tier;
}
\ No newline at end of file
diff --git a/Assets/Scripts/Game Logic/UI/GameUI/UIBuildPanel.cs b/Assets/Scripts/Game Logic/UI/GameUI/UIBuildPanel.cs
index be697250..aa1b9948 100644
--- a/Assets/Scripts/Game Logic/UI/GameUI/UIBuildPanel.cs
+++ b/Assets/Scripts/Game Logic/UI/GameUI/UIBuildPanel.cs
@@ -143,7 +143,7 @@ public void Show(FactoryBuildingTile factoryTile)
{
if (state == BuildState.HQPlacement) //This should never happen, but just in case
return;
- state = BuildState.UnitConstruction;
+ state = BuildState.Idle;
_selectedFactory = factoryTile;
var units = _selectedFactory.factoryInfo.unitsToBuild;
bool hasIcons = false;
@@ -243,7 +243,7 @@ public void UpdateState()
switch(state)
{
case BuildState.Disabled:
- UnitFactoryLogic();
+ InfoPanelLogic();
break;
case BuildState.Idle:
ReadBackInput();
@@ -265,12 +265,14 @@ public void UpdateState()
}
}
- void UnitFactoryLogic()
+ void InfoPanelLogic()
{
infoPanel.Hide();
var tile = GetTileUnderCursor();
if (tile is BuildingTile b)
infoPanel.ShowInfo(b.buildingInfo);
+ else if(tile is ResourceTile r)
+ infoPanel.ShowInfo(r.resInfo);
if (Input.GetKeyUp(KeyCode.Mouse0) && tile is FactoryBuildingTile f)
Show(f);
diff --git a/Assets/Scripts/Game Logic/UI/GameUI/UIInfoPanel.cs b/Assets/Scripts/Game Logic/UI/GameUI/UIInfoPanel.cs
index 01837fbd..13f391ed 100644
--- a/Assets/Scripts/Game Logic/UI/GameUI/UIInfoPanel.cs
+++ b/Assets/Scripts/Game Logic/UI/GameUI/UIInfoPanel.cs
@@ -2,6 +2,8 @@
using System.Collections;
using System.Collections.Generic;
+using System.Text;
+
using TMPro;
using UnityEngine;
@@ -19,6 +21,19 @@ public void ShowInfo(BuildingTileEntity building)
SetActive(true);
}
+ public void ShowInfo(ResourceTileInfo tile)
+ {
+ titleText.SetText(tile.GetNameString());
+ descriptionText.SetText(tile.description);
+ var sb = new StringBuilder();
+ for (int i = 0; i < tile.resourceYields.Length; i++)
+ {
+ sb.Append($"{ResourceDatabase.GetResourceName(tile.resourceYields[i].id)}");
+ }
+ productionText.SetText(sb);
+ SetActive(true);
+ }
+
public void ShowInfo(MobileUnitEntity unitEntity)
{
titleText.SetText(unitEntity.GetNameString());
diff --git a/Assets/Scripts/Map/Tiles/MappedTiles/Buildings/FactoryBuildingTile.cs b/Assets/Scripts/Map/Tiles/MappedTiles/Buildings/FactoryBuildingTile.cs
index dc378de9..e9b595ae 100644
--- a/Assets/Scripts/Map/Tiles/MappedTiles/Buildings/FactoryBuildingTile.cs
+++ b/Assets/Scripts/Map/Tiles/MappedTiles/Buildings/FactoryBuildingTile.cs
@@ -12,6 +12,5 @@ public FactoryBuildingTile(HexCoords coords, float height, Map map, FactoryTileE
factoryInfo = tInfo;
}
-
}
}
\ No newline at end of file
diff --git a/Assets/Scripts/Map/Tiles/MappedTiles/Buildings/MetaTile.cs b/Assets/Scripts/Map/Tiles/MappedTiles/Buildings/MetaTile.cs
index 30524948..44e327cb 100644
--- a/Assets/Scripts/Map/Tiles/MappedTiles/Buildings/MetaTile.cs
+++ b/Assets/Scripts/Map/Tiles/MappedTiles/Buildings/MetaTile.cs
@@ -4,6 +4,8 @@
using System.Collections;
using System.Collections.Generic;
+using System.Text;
+
using UnityEngine;
@@ -56,7 +58,7 @@ public override string GetDescription()
return _parent.GetDescription();
}
- public override string GetName()
+ public override StringBuilder GetName()
{
return _parent.GetName();
}
diff --git a/Assets/Scripts/Map/Tiles/MappedTiles/Tile.cs b/Assets/Scripts/Map/Tiles/MappedTiles/Tile.cs
index 4953728b..b4de903a 100644
--- a/Assets/Scripts/Map/Tiles/MappedTiles/Tile.cs
+++ b/Assets/Scripts/Map/Tiles/MappedTiles/Tile.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
+using System.Text;
using Unity.Collections;
using Unity.Entities;
@@ -59,7 +60,7 @@ public Tile SetBiome(int biome, float moisture, float temperature)
return this;
}
- public virtual string GetName()
+ public virtual StringBuilder GetName()
{
return info.GetNameString();
}
diff --git a/Assets/Scripts/Map/Tiles/TileInfo/Buildings/BuildingTileEntity.cs b/Assets/Scripts/Map/Tiles/TileInfo/Buildings/BuildingTileEntity.cs
index 4e52b848..fa45fda4 100644
--- a/Assets/Scripts/Map/Tiles/TileInfo/Buildings/BuildingTileEntity.cs
+++ b/Assets/Scripts/Map/Tiles/TileInfo/Buildings/BuildingTileEntity.cs
@@ -145,9 +145,9 @@ public virtual StringBuilder GetUpkeepString()
return upkeepString;
}
- public override string GetNameString()
+ public override StringBuilder GetNameString()
{
- return $"{name}";
+ return GameRegistry.RarityColors.Colorize(name, tier);
}
}
}
\ No newline at end of file
diff --git a/Assets/Scripts/Map/Tiles/TileInfo/Buildings/FactoryTileEntity.cs b/Assets/Scripts/Map/Tiles/TileInfo/Buildings/FactoryTileEntity.cs
index de131f8e..78716ca0 100644
--- a/Assets/Scripts/Map/Tiles/TileInfo/Buildings/FactoryTileEntity.cs
+++ b/Assets/Scripts/Map/Tiles/TileInfo/Buildings/FactoryTileEntity.cs
@@ -8,6 +8,7 @@ namespace Amatsugu.Phos.TileEntities
{
public class FactoryTileEntity : BuildingTileEntity
{
+ [Header("Factory")]
public UnitIdentifier[] unitsToBuild;
public override Tile CreateTile(Map map, HexCoords pos, float height)
diff --git a/Assets/Scripts/Map/Tiles/TileInfo/Buildings/TechBuildingTileEntity.cs b/Assets/Scripts/Map/Tiles/TileInfo/Buildings/TechBuildingTileEntity.cs
index 7353d0a7..01edf220 100644
--- a/Assets/Scripts/Map/Tiles/TileInfo/Buildings/TechBuildingTileEntity.cs
+++ b/Assets/Scripts/Map/Tiles/TileInfo/Buildings/TechBuildingTileEntity.cs
@@ -30,7 +30,7 @@ public override StringBuilder GetProductionString()
for (int i = 0; i < buildingsToUnlock.Length; i++)
{
prod.Append("\t");
- prod.AppendLine(GameRegistry.BuildingDatabase[buildingsToUnlock[i]].info.GetNameString());
+ prod.AppendLine(GameRegistry.BuildingDatabase[buildingsToUnlock[i]].info.GetNameString().ToString());
}
return prod;
}
diff --git a/Assets/Scripts/Map/Tiles/TileInfo/TileEntity.cs b/Assets/Scripts/Map/Tiles/TileInfo/TileEntity.cs
index 39c7af97..44a1f89b 100644
--- a/Assets/Scripts/Map/Tiles/TileInfo/TileEntity.cs
+++ b/Assets/Scripts/Map/Tiles/TileInfo/TileEntity.cs
@@ -3,6 +3,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Text;
+
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
@@ -99,9 +101,9 @@ public void OnBeforeSerialize()
#endif
}
- public virtual string GetNameString()
+ public virtual StringBuilder GetNameString()
{
- return name;
+ return new StringBuilder(name);
}
public void OnAfterDeserialize()
diff --git a/Assets/Scripts/Map/Units/MobileUnitEntity.cs b/Assets/Scripts/Map/Units/MobileUnitEntity.cs
index 7a56464b..94dc2673 100644
--- a/Assets/Scripts/Map/Units/MobileUnitEntity.cs
+++ b/Assets/Scripts/Map/Units/MobileUnitEntity.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Text;
using Unity.Entities;
using Unity.Mathematics;
@@ -129,9 +130,9 @@ public Entity Instantiate(float3 pos, Quaternion rotation, int id, Faction facti
return e;
}
- internal string GetNameString()
+ internal StringBuilder GetNameString()
{
- return name;
+ return GameRegistry.RarityColors.Colorize(name, tier);
}
internal string GetCostString()