Initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace LiveOpsExamples
|
||||
{
|
||||
public class BackpackItemRowView
|
||||
{
|
||||
private readonly VisualElement _icon;
|
||||
private readonly Label _nameLabel;
|
||||
private readonly Label _metaLabel;
|
||||
private readonly Label _amountLabel;
|
||||
|
||||
public BackpackItemRowView(VisualElement root)
|
||||
{
|
||||
_icon = root.Q<VisualElement>("item-icon");
|
||||
_nameLabel = root.Q<Label>("item-name");
|
||||
_metaLabel = root.Q<Label>("item-meta");
|
||||
_amountLabel = root.Q<Label>("item-amount");
|
||||
}
|
||||
|
||||
public void Set(Sprite icon, string itemName, string slug, int amount)
|
||||
{
|
||||
_icon.style.backgroundImage = new StyleBackground(icon);
|
||||
_nameLabel.text = itemName;
|
||||
_metaLabel.text = slug;
|
||||
_amountLabel.text = $"×{amount}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7a25568da97f48f3b07abf321ad2f82
|
||||
@@ -0,0 +1,25 @@
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace LiveOpsExamples
|
||||
{
|
||||
public class LeaderboardRowView
|
||||
{
|
||||
private readonly Label rankLabel;
|
||||
private readonly Label playerLabel;
|
||||
private readonly Label scoreLabel;
|
||||
|
||||
public LeaderboardRowView(VisualElement root)
|
||||
{
|
||||
rankLabel = root.Q<Label>("lb-rank");
|
||||
playerLabel = root.Q<Label>("lb-player");
|
||||
scoreLabel = root.Q<Label>("lb-score");
|
||||
}
|
||||
|
||||
public void Set(int rank, string playerName, int score)
|
||||
{
|
||||
rankLabel.text = rank > 0 ? $"#{rank}" : "—";
|
||||
playerLabel.text = playerName;
|
||||
scoreLabel.text = score.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29788c49080d642ff919c1d25b5dd979
|
||||
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace LiveOpsExamples
|
||||
{
|
||||
public class LogRowView
|
||||
{
|
||||
private readonly Label _timeLabel;
|
||||
private readonly Label _tagLabel;
|
||||
private readonly Label _messageLabel;
|
||||
private readonly Label _detailLabel;
|
||||
|
||||
public LogRowView(VisualElement root)
|
||||
{
|
||||
_timeLabel = root.Q<Label>("log-time");
|
||||
_tagLabel = root.Q<Label>("log-tag");
|
||||
_messageLabel = root.Q<Label>("log-message");
|
||||
_detailLabel = root.Q<Label>("log-detail");
|
||||
}
|
||||
|
||||
public void Set(string time, string tag, Color tagColor, string message, string detail)
|
||||
{
|
||||
_timeLabel.text = time;
|
||||
_tagLabel.text = tag;
|
||||
_tagLabel.style.color = tagColor;
|
||||
_tagLabel.style.backgroundColor = new Color(tagColor.r, tagColor.g, tagColor.b, 0.18f);
|
||||
_messageLabel.text = message;
|
||||
_detailLabel.text = detail;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffa213acafee84d818a3cf631f0bb01b
|
||||
@@ -0,0 +1,26 @@
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace LiveOpsExamples
|
||||
{
|
||||
public class ShopOfferRowView
|
||||
{
|
||||
private readonly Label _nameLabel;
|
||||
private readonly Label _priceLabel;
|
||||
private readonly Button _buyButton;
|
||||
|
||||
public Button BuyButton => _buyButton;
|
||||
|
||||
public ShopOfferRowView(VisualElement root)
|
||||
{
|
||||
_nameLabel = root.Q<Label>("offer-name");
|
||||
_priceLabel = root.Q<Label>("offer-price");
|
||||
_buyButton = root.Q<Button>("offer-buy-button");
|
||||
}
|
||||
|
||||
public void Set(string offerName, string price)
|
||||
{
|
||||
_nameLabel.text = offerName;
|
||||
_priceLabel.text = price;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94bf1e4d6fb50418487ed96aa4d65d4b
|
||||
@@ -0,0 +1,32 @@
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace LiveOpsExamples
|
||||
{
|
||||
public class ToastView
|
||||
{
|
||||
private const string ToneInfoClass = "tone-info";
|
||||
private const string ToneSuccessClass = "tone-success";
|
||||
private const string ToneErrorClass = "tone-error";
|
||||
|
||||
private readonly Label _titleLabel;
|
||||
private readonly Label _messageLabel;
|
||||
|
||||
public ToastView(VisualElement root)
|
||||
{
|
||||
Root = root;
|
||||
_titleLabel = root.Q<Label>("toast-title");
|
||||
_messageLabel = root.Q<Label>("toast-message");
|
||||
}
|
||||
|
||||
public VisualElement Root { get; }
|
||||
|
||||
public void Set(string title, string message, CozyToastTone tone)
|
||||
{
|
||||
_titleLabel.text = title;
|
||||
_messageLabel.text = message;
|
||||
Root.EnableInClassList(ToneInfoClass, tone == CozyToastTone.Info);
|
||||
Root.EnableInClassList(ToneSuccessClass, tone == CozyToastTone.Success);
|
||||
Root.EnableInClassList(ToneErrorClass, tone == CozyToastTone.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d468efab7b7645f78186c03b82f5d32
|
||||
Reference in New Issue
Block a user