소스 검색

Added description to stockpile data

jamesperet 3 년 전
부모
커밋
e3ab0eb658
4개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  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.

+ 2 - 0
Runtime/StockpilePreset.cs

@@ -16,6 +16,8 @@ namespace KairoEngine.Stockpiles
         public int maxValue = 100;
         public int initialValue = 0;
         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 TMPro;
 using KairoEngine.Stockpiles;
+using KairoEngine.UI.Tooltips;
 
 namespace KairoEngine.Stockpiles.UI 
 {
@@ -12,6 +13,8 @@ namespace KairoEngine.Stockpiles.UI
         public Image iconImage;
         public TextMeshProUGUI ammoutText;
         public TextMeshProUGUI capacityText;
+        public TooltipTrigger tooltipTrigger;
+        public string tooltipType = "";
 
         public StockpileGroupView viewManager;
         public StockpilePreset stockpilePreset;
@@ -29,6 +32,12 @@ namespace KairoEngine.Stockpiles.UI
             this.stockpilePreset = stockpilePreset;
             iconImage.sprite = this.stockpilePreset.icon;
             UpdateValues();
+            if(tooltipTrigger != null)
+            {
+                tooltipTrigger.header = stockpilePreset.title;
+                tooltipTrigger.content = stockpilePreset.description;
+                tooltipTrigger.tooltipType = tooltipType;
+            }
         }
 
         private void UpdateValues()

+ 1 - 1
package.json

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