Explorar o código

Added description to stockpile data

jamesperet %!s(int64=3) %!d(string=hai) anos
pai
achega
e3ab0eb658
Modificáronse 4 ficheiros con 13 adicións e 2 borrados
  1. 1 1
      Readme.md
  2. 2 0
      Runtime/StockpilePreset.cs
  3. 9 0
      Runtime/UI/StockpileView.cs
  4. 1 1
      package.json

+ 1 - 1
Readme.md

@@ -1,3 +1,3 @@
-# 📦 KairoEngine.Stockpiles v0.1.1
+# 📦 KairoEngine.Stockpiles v0.1.3
 
 
 Stockpiles represent resources in strategy games. They can represent currency in other games. The Stockpiles library adds tools to manage multiple stockpiles during gameplay, a stockpile preset to create different types of resources and an API to comunicate with this system.
 Stockpiles represent resources in strategy games. They can represent currency in other games. The Stockpiles library adds tools to manage multiple stockpiles during gameplay, a stockpile preset to create different types of resources and an API to comunicate with this system.

+ 2 - 0
Runtime/StockpilePreset.cs

@@ -16,6 +16,8 @@ namespace KairoEngine.Stockpiles
         public int maxValue = 100;
         public int maxValue = 100;
         public int initialValue = 0;
         public int initialValue = 0;
         public string spriteText = "<sprite name=\"minerals\">";
         public string spriteText = "<sprite name=\"minerals\">";
+
+        public string description = "New stockpile description.";
     }
     }
 }
 }
 
 

+ 9 - 0
Runtime/UI/StockpileView.cs

@@ -4,6 +4,7 @@ using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.UI;
 using TMPro;
 using TMPro;
 using KairoEngine.Stockpiles;
 using KairoEngine.Stockpiles;
+using KairoEngine.UI.Tooltips;
 
 
 namespace KairoEngine.Stockpiles.UI 
 namespace KairoEngine.Stockpiles.UI 
 {
 {
@@ -12,6 +13,8 @@ namespace KairoEngine.Stockpiles.UI
         public Image iconImage;
         public Image iconImage;
         public TextMeshProUGUI ammoutText;
         public TextMeshProUGUI ammoutText;
         public TextMeshProUGUI capacityText;
         public TextMeshProUGUI capacityText;
+        public TooltipTrigger tooltipTrigger;
+        public string tooltipType = "";
 
 
         public StockpileGroupView viewManager;
         public StockpileGroupView viewManager;
         public StockpilePreset stockpilePreset;
         public StockpilePreset stockpilePreset;
@@ -29,6 +32,12 @@ namespace KairoEngine.Stockpiles.UI
             this.stockpilePreset = stockpilePreset;
             this.stockpilePreset = stockpilePreset;
             iconImage.sprite = this.stockpilePreset.icon;
             iconImage.sprite = this.stockpilePreset.icon;
             UpdateValues();
             UpdateValues();
+            if(tooltipTrigger != null)
+            {
+                tooltipTrigger.header = stockpilePreset.title;
+                tooltipTrigger.content = stockpilePreset.description;
+                tooltipTrigger.tooltipType = tooltipType;
+            }
         }
         }
 
 
         private void UpdateValues()
         private void UpdateValues()

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
 {
     "name": "at.kairoscope.kairoengine.stockpiles",
     "name": "at.kairoscope.kairoengine.stockpiles",
     "displayName": "KairoEngine Stockpiles",
     "displayName": "KairoEngine Stockpiles",
-    "version": "0.1.2",
+    "version": "0.1.3",
     "unity": "2020.3",
     "unity": "2020.3",
     "description": "Kairoengine stockpiles library.",
     "description": "Kairoengine stockpiles library.",
     "dependencies": {
     "dependencies": {