43 lines
1019 B
C#
43 lines
1019 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITKit;
|
|
using BITKit.UX;
|
|
using Steamworks.Data;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace BITFALL.UX
|
|
{
|
|
public static class UXUtils
|
|
{
|
|
public static UXContainer CreateItemContainer(VisualElement visualElement, IBasicItem item)
|
|
{
|
|
var asset = item.GetAssetable();
|
|
var uxContainer = new UXContainer(visualElement);
|
|
uxContainer.icon.style.backgroundImage =asset.SquareIcon;
|
|
uxContainer.contextLabel.text = asset.Name;
|
|
visualElement.userData = item.AddressablePath;
|
|
|
|
if (uxContainer.numberLabel is not null)
|
|
{
|
|
if (item.TryGetProperty<ICount>(out var count))
|
|
{
|
|
uxContainer.numberLabel.text = count.Count.ToString();
|
|
uxContainer.numberLabel.SetActive(true);
|
|
|
|
}
|
|
else
|
|
{
|
|
uxContainer.numberLabel.SetActive(false);
|
|
}
|
|
}
|
|
if (uxContainer.descriptionLabel is not null)
|
|
{
|
|
uxContainer.descriptionLabel.text = asset.Description;
|
|
}
|
|
return uxContainer;
|
|
}
|
|
}
|
|
|
|
}
|