Universal Properties Panel
Properties panel is now shared between tabs
This commit is contained in:
parent
4f29bf24d0
commit
87acc75b96
25 changed files with 11397 additions and 41840 deletions
|
|
@ -11,14 +11,8 @@ using static NoiseFbm;
|
|||
[Inspectable, Serializable, RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class GlobalData : DatabaseEntry
|
||||
{
|
||||
[InspectableField, JsonProperty("targetPersistenceDuration"), Key(1)]
|
||||
public float TargetPersistenceDuration = 3;
|
||||
|
||||
[InspectableField, JsonProperty("heatRadiationPower"), Key(2)]
|
||||
public float HeatRadiationPower = 1;
|
||||
|
||||
[InspectableField, JsonProperty("heatRadiationMultiplier"), Key(3)]
|
||||
public float HeatRadiationMultiplier = 1;
|
||||
[InspectableField, JsonProperty("galaxyName"), Key(1)]
|
||||
public string GalaxyName;
|
||||
|
||||
[InspectableField, JsonProperty("galaxyArms"), Key(4)]
|
||||
public int Arms = 4;
|
||||
|
|
@ -116,6 +110,15 @@ public class GlobalData : DatabaseEntry
|
|||
[InspectableField, JsonProperty("orbitSpeedMultiplier"), Key(34)]
|
||||
public float OrbitSpeedMultiplier = .25f;
|
||||
|
||||
[InspectableField, JsonProperty("targetPersistenceDuration"), Key(35)]
|
||||
public float TargetPersistenceDuration = 3;
|
||||
|
||||
[InspectableField, JsonProperty("heatRadiationPower"), Key(36)]
|
||||
public float HeatRadiationPower = 1;
|
||||
|
||||
[InspectableField, JsonProperty("heatRadiationMultiplier"), Key(37)]
|
||||
public float HeatRadiationMultiplier = 1;
|
||||
|
||||
public float PlanetRadius(float mass)
|
||||
{
|
||||
return pow(mass, 1 / RadiusPower);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public class StrategyGameManager : MonoBehaviour
|
|||
public MeshRenderer ZoneBackground;
|
||||
public MeshRenderer ZoneBoundary;
|
||||
public ClickRaycaster ClickRaycaster;
|
||||
public ReadOnlyPropertiesPanel PropertiesPanel;
|
||||
|
||||
[Section("Tab Links")]
|
||||
public TabGroup PrimaryTabGroup;
|
||||
|
|
@ -56,15 +57,6 @@ public class StrategyGameManager : MonoBehaviour
|
|||
public int AsteroidSpritesheetWidth = 4;
|
||||
public int AsteroidSpritesheetHeight = 4;
|
||||
|
||||
[Section("Zone Properties Panel")]
|
||||
public RectTransform ZonePropertiesPanel;
|
||||
public TextMeshProUGUI ZoneTitle;
|
||||
public RectTransform[] ZonePlanetProperties;
|
||||
public TextMeshProUGUI ZonePropertiesName;
|
||||
public TextMeshProUGUI ZonePropertiesMass;
|
||||
public Transform ZonePropertiesResourcesParent;
|
||||
public ZonePropertiesResource ZonePropertiesResourcePrefab;
|
||||
|
||||
private DatabaseCache _cache;
|
||||
private GameContext _context;
|
||||
// private GalaxyResponseMessage _galaxyResponse;
|
||||
|
|
@ -79,7 +71,6 @@ public class StrategyGameManager : MonoBehaviour
|
|||
private Dictionary<Guid, AsteroidBelt> _zoneBelts = new Dictionary<Guid, AsteroidBelt>();
|
||||
private Dictionary<Ship, ZoneShip> _zoneShips = new Dictionary<Ship, ZoneShip>();
|
||||
private List<ZoneObject> _wormholes = new List<ZoneObject>();
|
||||
private List<ZonePropertiesResource> _zonePropertiesResources = new List<ZonePropertiesResource>();
|
||||
private Vector3 _galaxyCameraPos = -Vector3.forward;
|
||||
private float _galaxyOrthoSize = 50;
|
||||
private Material _boundaryMaterial;
|
||||
|
|
@ -135,6 +126,9 @@ public class StrategyGameManager : MonoBehaviour
|
|||
_cache.Add(zone.Zone);
|
||||
foreach (var entry in zone.Contents) _cache.Add(entry);
|
||||
|
||||
if(_currentTab==GalaxyTabButton && _selectedZone == zone.Zone.ID)
|
||||
PopulateZoneProperties(_selectedZone);
|
||||
|
||||
if (_currentTab == ZoneTabButton && _populatedZone != zone.Zone.ID) PopulateZone();
|
||||
});
|
||||
}
|
||||
|
|
@ -144,23 +138,29 @@ public class StrategyGameManager : MonoBehaviour
|
|||
_currentTab = button;
|
||||
if (_currentTab == GalaxyTabButton)
|
||||
{
|
||||
PropertiesPanel.gameObject.SetActive(true);
|
||||
PopulateGalaxyProperties();
|
||||
if (!_galaxyPopulated) PopulateGalaxy();
|
||||
Camera.transform.position = _galaxyCameraPos;
|
||||
Camera.orthographicSize = _galaxyOrthoSize;
|
||||
}
|
||||
|
||||
if (_currentTab == ZoneTabButton)
|
||||
else if (_currentTab == ZoneTabButton)
|
||||
{
|
||||
PropertiesPanel.gameObject.SetActive(true);
|
||||
var zone = _cache.Get<ZoneData>(_selectedZone);
|
||||
if (_populatedZone != _selectedZone && zone != null)
|
||||
PopulateZone();
|
||||
PopulateZoneProperties(_populatedZone);
|
||||
Camera.transform.position = -Vector3.forward;
|
||||
if (zone != null)
|
||||
Camera.orthographicSize = zone.Radius * ZoneSizeScale;
|
||||
}
|
||||
|
||||
if (_currentTab == TechTabButton)
|
||||
else if (_currentTab == TechTabButton)
|
||||
{
|
||||
PropertiesPanel.gameObject.SetActive(true);
|
||||
PopulateTechProperties();
|
||||
if (!_techLayoutGenerated)
|
||||
{
|
||||
TechTree.Initialize();
|
||||
|
|
@ -168,12 +168,46 @@ public class StrategyGameManager : MonoBehaviour
|
|||
TechTree.GenerateTechs();
|
||||
}
|
||||
}
|
||||
|
||||
else PropertiesPanel.gameObject.SetActive(false);
|
||||
};
|
||||
|
||||
_boundaryMaterial = ZoneBoundary.material;
|
||||
_backgroundMaterial = ZoneBackground.material;
|
||||
|
||||
ClickRaycaster.OnClickMiss += () => ZonePropertiesPanel.gameObject.SetActive(false);
|
||||
|
||||
ClickRaycaster.OnClickMiss += () =>
|
||||
{
|
||||
if (_currentTab == GalaxyTabButton) PopulateGalaxyProperties();
|
||||
else if (_currentTab == ZoneTabButton) PopulateZoneProperties(_populatedZone);
|
||||
else if (_currentTab == TechTabButton) PopulateTechProperties();
|
||||
};
|
||||
}
|
||||
|
||||
private void PopulateGalaxyProperties()
|
||||
{
|
||||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.Title.text = _context.GlobalData.GalaxyName;
|
||||
PropertiesPanel.AddSection("Galaxy");
|
||||
PropertiesPanel.AddProperty("Sectors", $"{_galaxyResponseZones.Count}");
|
||||
}
|
||||
|
||||
private void PopulateZoneProperties(Guid zone)
|
||||
{
|
||||
PropertiesPanel.Clear();
|
||||
var zoneData = _cache.Get<ZoneData>(zone);
|
||||
PropertiesPanel.Title.text = zoneData.Name;
|
||||
PropertiesPanel.AddSection("Sector");
|
||||
PropertiesPanel.AddProperty("Planets", $"{zoneData.Planets.Length}");
|
||||
}
|
||||
|
||||
private void PopulateTechProperties()
|
||||
{
|
||||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.Title.text = "Technologies";
|
||||
var count = _context.Cache.GetAll<BlueprintData>().Count();
|
||||
PropertiesPanel.AddProperty("Discovered Techs", $"{count}");
|
||||
PropertiesPanel.AddProperty("Available Techs", $"{count}");
|
||||
PropertiesPanel.AddProperty("Researched Techs", $"{count}");
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
|
@ -259,6 +293,14 @@ public class StrategyGameManager : MonoBehaviour
|
|||
_selectedGalaxyZone.Background.material.SetColor("_TintColor", UnselectedColor);
|
||||
if(_selectedZone != zone.ZoneID)
|
||||
CultClient.Send(new ZoneRequestMessage{ZoneID = zone.ZoneID});
|
||||
if (TestMode)
|
||||
{
|
||||
if(!_context.Cache.Get<ZoneData>(zone.ZoneID).Visited)
|
||||
{
|
||||
GenerateZone(zone.ZoneID);
|
||||
}
|
||||
PopulateZoneProperties(zone.ZoneID);
|
||||
}
|
||||
_selectedZone = zone.ZoneID;
|
||||
_selectedGalaxyZone = instanceZone;
|
||||
_selectedGalaxyZone.Background.material.SetColor("_TintColor", SelectedColor);
|
||||
|
|
@ -278,6 +320,29 @@ public class StrategyGameManager : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
void GenerateZone(Guid zone)
|
||||
{
|
||||
var zoneData = _cache.Get<ZoneData>(zone);
|
||||
float2 position;
|
||||
do
|
||||
{
|
||||
position = float2(Random.value, Random.value);
|
||||
} while (_context.MapLayers["StarDensity"].Evaluate(position, _context.GlobalData) < .1f);
|
||||
|
||||
OrbitData[] orbits;
|
||||
PlanetData[] planets;
|
||||
ZoneGenerator.GenerateZone(
|
||||
context: _context,
|
||||
zone: zoneData,
|
||||
mapLayers: _context.MapLayers.Values,
|
||||
resources: _cache.GetAll<SimpleCommodityData>().Where(i=>i.ResourceDensity.Any()),
|
||||
orbitData: out orbits,
|
||||
planetsData: out planets);
|
||||
_cache.AddAll(orbits);
|
||||
_cache.AddAll(planets);
|
||||
zoneData.Visited = true;
|
||||
}
|
||||
|
||||
void PopulateZone()
|
||||
{
|
||||
// Delete all the existing zone contents
|
||||
|
|
@ -295,30 +360,11 @@ public class StrategyGameManager : MonoBehaviour
|
|||
|
||||
_populatedZone = _selectedZone;
|
||||
|
||||
ZoneData zoneData = _cache.Get<ZoneData>(_populatedZone);
|
||||
|
||||
ZoneTitle.text = zoneData.Name;
|
||||
var zoneData = _cache.Get<ZoneData>(_populatedZone);
|
||||
|
||||
if (TestMode && !zoneData.Visited)
|
||||
{
|
||||
float2 position;
|
||||
do
|
||||
{
|
||||
position = float2(Random.value, Random.value);
|
||||
} while (_context.MapLayers["StarDensity"].Evaluate(position, _context.GlobalData) < .1f);
|
||||
|
||||
OrbitData[] orbits;
|
||||
PlanetData[] planets;
|
||||
ZoneGenerator.GenerateZone(
|
||||
context: _context,
|
||||
zone: zoneData,
|
||||
mapLayers: _context.MapLayers.Values,
|
||||
resources: _cache.GetAll<SimpleCommodityData>().Where(i=>i.ResourceDensity.Any()),
|
||||
orbitData: out orbits,
|
||||
planetsData: out planets);
|
||||
_cache.AddAll(orbits);
|
||||
_cache.AddAll(planets);
|
||||
zoneData.Visited = true;
|
||||
GenerateZone(_populatedZone);
|
||||
}
|
||||
|
||||
_context.InitializeZone(_populatedZone);
|
||||
|
|
@ -348,24 +394,18 @@ public class StrategyGameManager : MonoBehaviour
|
|||
PlanetoidSprite);
|
||||
planetObject.Icon.GetComponent<ClickableCollider>().OnClick += (collider, data) =>
|
||||
{
|
||||
ZonePropertiesPanel.gameObject.SetActive(true);
|
||||
foreach (var zonePlanetProperty in ZonePlanetProperties)
|
||||
zonePlanetProperty.gameObject.SetActive(true);
|
||||
|
||||
foreach (var zonePropertiesResource in _zonePropertiesResources)
|
||||
Destroy(zonePropertiesResource.gameObject);
|
||||
_zonePropertiesResources.Clear();
|
||||
|
||||
ZonePropertiesName.text = planetData.Name;
|
||||
ZonePropertiesMass.text = $"{planetData.Mass}";
|
||||
foreach (var resource in planetData.Resources)
|
||||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.Title.text = planetData.Name;
|
||||
PropertiesPanel.AddSection(planetData.Mass > _context.GlobalData.SunMass ? "Star" :
|
||||
planetData.Mass > _context.GlobalData.GasGiantMass ? "Gas Giant" :
|
||||
planetData.Mass > _context.GlobalData.PlanetMass ? "Planet" :
|
||||
"Planetoid");
|
||||
PropertiesPanel.AddProperty("Mass", $"{planetData.Mass}");
|
||||
PropertiesPanel.AddList("Resources", planetData.Resources.Select(resource =>
|
||||
{
|
||||
var itemData = _context.Cache.Get<SimpleCommodityData>(resource.Key);
|
||||
var resourceInstance = Instantiate(ZonePropertiesResourcePrefab, ZonePropertiesResourcesParent);
|
||||
resourceInstance.NameLabel.text = itemData.Name;
|
||||
resourceInstance.QuantityLabel.text = $"{resource.Value:0}";
|
||||
_zonePropertiesResources.Add(resourceInstance);
|
||||
}
|
||||
return new Tuple<string, string>(itemData.Name, $"{resource.Value:0}");
|
||||
}));
|
||||
};
|
||||
}
|
||||
else
|
||||
|
|
@ -376,24 +416,15 @@ public class StrategyGameManager : MonoBehaviour
|
|||
_zoneBelts[_cache.Get<OrbitData>(planetData.Orbit).Parent] = belt;
|
||||
beltObject.GetComponent<ClickableCollider>().OnClick += (_, data) =>
|
||||
{
|
||||
ZonePropertiesPanel.gameObject.SetActive(true);
|
||||
foreach (var zonePlanetProperty in ZonePlanetProperties)
|
||||
zonePlanetProperty.gameObject.SetActive(true);
|
||||
|
||||
foreach (var zonePropertiesResource in _zonePropertiesResources)
|
||||
Destroy(zonePropertiesResource.gameObject);
|
||||
_zonePropertiesResources.Clear();
|
||||
|
||||
ZonePropertiesName.text = planetData.Name;
|
||||
ZonePropertiesMass.text = $"{planetData.Mass}";
|
||||
foreach (var resource in planetData.Resources)
|
||||
PropertiesPanel.Clear();
|
||||
PropertiesPanel.Title.text = planetData.Name;
|
||||
PropertiesPanel.AddSection("Asteroid Belt");
|
||||
PropertiesPanel.AddProperty("Mass", $"{planetData.Mass}");
|
||||
PropertiesPanel.AddList("Resources", planetData.Resources.Select(resource =>
|
||||
{
|
||||
var itemData = _context.Cache.Get<SimpleCommodityData>(resource.Key);
|
||||
var resourceInstance = Instantiate(ZonePropertiesResourcePrefab, ZonePropertiesResourcesParent);
|
||||
resourceInstance.NameLabel.text = itemData.Name;
|
||||
resourceInstance.QuantityLabel.text = $"{resource.Value:0}";
|
||||
_zonePropertiesResources.Add(resourceInstance);
|
||||
}
|
||||
return new Tuple<string, string>(itemData.Name, $"{resource.Value:0}");
|
||||
}));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,7 @@ public class TechTreeMsagl : MonoBehaviour
|
|||
public Prototype Arrow;
|
||||
|
||||
[Section("UI Links")]
|
||||
public RectTransform PropertiesPanel;
|
||||
public TextMeshProUGUI TechName;
|
||||
public TextMeshProUGUI Quality;
|
||||
public TextMeshProUGUI ProductionTime;
|
||||
public TextMeshProUGUI Produces;
|
||||
public TextMeshProUGUI ResearchTime;
|
||||
public RectTransform RequirementParent;
|
||||
public RectTransform DependencyParent;
|
||||
public RectTransform DescendantParent;
|
||||
public RectTransform RequirementPrefab;
|
||||
public RectTransform DependencyPrefab;
|
||||
public RectTransform DescendantPrefab;
|
||||
public ClickRaycaster ClickRaycaster;
|
||||
public ReadOnlyPropertiesPanel PropertiesPanel;
|
||||
|
||||
[Section("Graph Generation")]
|
||||
public bool TestMode;
|
||||
|
|
@ -86,7 +74,6 @@ public class TechTreeMsagl : MonoBehaviour
|
|||
private List<Prototype> _linkInstances = new List<Prototype>();
|
||||
private List<Prototype> _arrowInstances = new List<Prototype>();
|
||||
private Texture2D[] _icons;
|
||||
private List<RectTransform> _propertyInstances = new List<RectTransform>();
|
||||
|
||||
public BlueprintData[] Blueprints { get; set; }
|
||||
|
||||
|
|
@ -94,7 +81,6 @@ public class TechTreeMsagl : MonoBehaviour
|
|||
{
|
||||
if(TestMode)
|
||||
Initialize();
|
||||
ClickRaycaster.OnClickMiss += () => PropertiesPanel.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
|
|
@ -344,36 +330,25 @@ public class TechTreeMsagl : MonoBehaviour
|
|||
if (!TestMode)
|
||||
tech.Fill.GetComponent<ClickableCollider>().OnClick += (collider, data) =>
|
||||
{
|
||||
foreach (var instance in _propertyInstances) Destroy(instance.gameObject);
|
||||
_propertyInstances.Clear();
|
||||
PropertiesPanel.Clear();
|
||||
var blueprint = (BlueprintData) vertex.UserData;
|
||||
PropertiesPanel.gameObject.SetActive(true);
|
||||
TechName.text = blueprint.Name;
|
||||
Quality.text = $"{Mathf.RoundToInt(blueprint.Quality * 100)}%";
|
||||
ProductionTime.text = $"{blueprint.ProductionTime:0.##} MH";
|
||||
Produces.text = $"{blueprint.Quantity} {Context.Cache.Get<ItemData>(blueprint.Item).Name}";
|
||||
ResearchTime.text = $"{blueprint.ResearchTime:0.##} MH";
|
||||
foreach (var ingredient in blueprint.Ingredients)
|
||||
PropertiesPanel.Title.text = blueprint.Name;
|
||||
PropertiesPanel.AddProperty("Research Time", $"{blueprint.ResearchTime:0.##} MH");
|
||||
PropertiesPanel.AddProperty("Produces", $"{blueprint.Quantity} {Context.Cache.Get<ItemData>(blueprint.Item).Name}");
|
||||
PropertiesPanel.AddProperty("Production Quality", $"{Mathf.RoundToInt(blueprint.Quality * 100)}%");
|
||||
PropertiesPanel.AddProperty("Production Time", $"{blueprint.ProductionTime:0.##} MH");
|
||||
PropertiesPanel.AddList("Ingredients", blueprint.Ingredients.Select(ingredient =>
|
||||
{
|
||||
var ingredientData = Context.Cache.Get<ItemData>(ingredient.Key);
|
||||
var ingredientInstance = Instantiate(RequirementPrefab, RequirementParent);
|
||||
ingredientInstance.GetComponentInChildren<TextMeshProUGUI>().text = $"{ingredient.Value} {ingredientData.Name}";
|
||||
_propertyInstances.Add(ingredientInstance);
|
||||
}
|
||||
foreach (var dependency in blueprint.Dependencies)
|
||||
return $"{ingredient.Value} {ingredientData.Name}";
|
||||
}));
|
||||
PropertiesPanel.AddList("Dependencies", blueprint.Dependencies.Select(dependency =>
|
||||
{
|
||||
var dependencyBlueprint = Context.Cache.Get<BlueprintData>(dependency);
|
||||
var dependencyInstance = Instantiate(DependencyPrefab, DependencyParent);
|
||||
dependencyInstance.GetComponentInChildren<TextMeshProUGUI>().text = dependencyBlueprint.Name;
|
||||
_propertyInstances.Add(dependencyInstance);
|
||||
}
|
||||
foreach (var descendant in Blueprints.Where(bp =>
|
||||
bp.Dependencies.Any(dep => blueprint.ID == dep)))
|
||||
{
|
||||
var descendantInstance = Instantiate(DescendantPrefab, DescendantParent);
|
||||
descendantInstance.GetComponentInChildren<TextMeshProUGUI>().text = descendant.Name;
|
||||
_propertyInstances.Add(descendantInstance);
|
||||
}
|
||||
return $"{dependencyBlueprint.Name}";
|
||||
}));
|
||||
PropertiesPanel.AddList("Descendants", Blueprints.Where(bp =>
|
||||
bp.Dependencies.Any(dep => blueprint.ID == dep)).Select(descendant => $"{descendant.Name}"));
|
||||
};
|
||||
_techInstances.Add(tech.GetComponent<Prototype>());
|
||||
}
|
||||
|
|
|
|||
10
Assets/Scripts/UI/PropertyLabel.cs
Normal file
10
Assets/Scripts/UI/PropertyLabel.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class PropertyLabel : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI Name;
|
||||
public TextMeshProUGUI Value;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e422bcc206d214044ab697caaac9fd12
|
||||
guid: b403db1d8980f544099fedf5735cf364
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
65
Assets/Scripts/UI/ReadOnlyPropertiesPanel.cs
Normal file
65
Assets/Scripts/UI/ReadOnlyPropertiesPanel.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class ReadOnlyPropertiesPanel : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI Title;
|
||||
public RectTransform SectionPrefab;
|
||||
public RectTransform ListPrefab;
|
||||
public RectTransform ListItemPrefab;
|
||||
public PropertyLabel ListPropertyPrefab;
|
||||
public PropertyLabel PropertyPrefab;
|
||||
|
||||
private List<GameObject> _properties = new List<GameObject>();
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
foreach(var property in _properties)
|
||||
Destroy(property);
|
||||
}
|
||||
|
||||
public void AddProperty(string name, string value)
|
||||
{
|
||||
var property = Instantiate(PropertyPrefab, transform);
|
||||
property.Name.text = name;
|
||||
property.Value.text = value;
|
||||
_properties.Add(property.gameObject);
|
||||
}
|
||||
|
||||
public void AddSection(string name)
|
||||
{
|
||||
var section = Instantiate(SectionPrefab, transform);
|
||||
section.GetComponentInChildren<TextMeshProUGUI>().text = name;
|
||||
_properties.Add(section.gameObject);
|
||||
}
|
||||
|
||||
public void AddList(string name, IEnumerable<string> elements)
|
||||
{
|
||||
var list = Instantiate(ListPrefab, transform);
|
||||
list.GetComponentInChildren<TextMeshProUGUI>().text = name;
|
||||
foreach (var element in elements)
|
||||
{
|
||||
var item = Instantiate(ListItemPrefab, list);
|
||||
item.GetComponentInChildren<TextMeshProUGUI>().text = element;
|
||||
_properties.Add(item.gameObject);
|
||||
}
|
||||
_properties.Add(list.gameObject);
|
||||
}
|
||||
|
||||
public void AddList(string name, IEnumerable<Tuple<string, string>> elements)
|
||||
{
|
||||
var list = Instantiate(ListPrefab, transform);
|
||||
list.GetComponentInChildren<TextMeshProUGUI>().text = name;
|
||||
foreach (var element in elements)
|
||||
{
|
||||
var item = Instantiate(ListPropertyPrefab, list);
|
||||
item.Name.text = element.Item1;
|
||||
item.Value.text = element.Item2;
|
||||
_properties.Add(item.gameObject);
|
||||
}
|
||||
_properties.Add(list.gameObject);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/ReadOnlyPropertiesPanel.cs.meta
Normal file
11
Assets/Scripts/UI/ReadOnlyPropertiesPanel.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8c2bf4a7080061d42a87046c37bf0c60
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class ZonePropertiesResource : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI NameLabel;
|
||||
public TextMeshProUGUI QuantityLabel;
|
||||
}
|
||||
Loading…
Reference in a new issue