Add player currency
This commit is contained in:
@@ -48,6 +48,14 @@ namespace PerfectWorld.Scripts.Managers
|
||||
[SerializeField] private bool autoRefresh = true;
|
||||
[SerializeField] private float refreshInterval = 1.0f;
|
||||
[SerializeField] private bool showEquipmentDetails = true;
|
||||
|
||||
[Header("Money UI (assign any text fields to mirror money amount)")]
|
||||
[SerializeField] private List<UnityEngine.UI.Text> moneyTextsLegacy = new List<UnityEngine.UI.Text>();
|
||||
[SerializeField] private List<TMPro.TextMeshProUGUI> moneyTextsTMP = new List<TMPro.TextMeshProUGUI>();
|
||||
|
||||
[Header("Cash UI (assign any text fields to mirror cash amount)")]
|
||||
[SerializeField] private List<UnityEngine.UI.Text> cashTextsLegacy = new List<UnityEngine.UI.Text>();
|
||||
[SerializeField] private List<TMPro.TextMeshProUGUI> cashTextsTMP = new List<TMPro.TextMeshProUGUI>();
|
||||
|
||||
private float lastRefreshTime;
|
||||
|
||||
@@ -200,6 +208,56 @@ namespace PerfectWorld.Scripts.Managers
|
||||
view.RenderPackage(fashionPackButtons, fshItems, PKG_FASHION, OnInventoryButtonClicked, GetDisplayTextForItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update all configured money text components with the current amount.
|
||||
/// Call this when GET_OWN_MONEY arrives.
|
||||
/// </summary>
|
||||
public void UpdateMoney(ulong amount, ulong maxAmount)
|
||||
{
|
||||
string text = amount.ToString();
|
||||
if (moneyTextsLegacy != null)
|
||||
{
|
||||
for (int i = 0; i < moneyTextsLegacy.Count; i++)
|
||||
{
|
||||
var t = moneyTextsLegacy[i];
|
||||
if (t != null) t.text = text;
|
||||
}
|
||||
}
|
||||
if (moneyTextsTMP != null)
|
||||
{
|
||||
for (int i = 0; i < moneyTextsTMP.Count; i++)
|
||||
{
|
||||
var t = moneyTextsTMP[i];
|
||||
if (t != null) t.text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update all configured cash text components with the current boutique cash amount.
|
||||
/// Call this when PLAYER_CASH arrives.
|
||||
/// </summary>
|
||||
public void UpdateCash(int amount)
|
||||
{
|
||||
string text = amount.ToString();
|
||||
if (cashTextsLegacy != null)
|
||||
{
|
||||
for (int i = 0; i < cashTextsLegacy.Count; i++)
|
||||
{
|
||||
var t = cashTextsLegacy[i];
|
||||
if (t != null) t.text = text;
|
||||
}
|
||||
}
|
||||
if (cashTextsTMP != null)
|
||||
{
|
||||
for (int i = 0; i < cashTextsTMP.Count; i++)
|
||||
{
|
||||
var t = cashTextsTMP[i];
|
||||
if (t != null) t.text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnInventoryButtonClicked(byte package, int slot)
|
||||
{
|
||||
UnityGameSession.RequestCheckSecurityPassWd("");
|
||||
|
||||
Reference in New Issue
Block a user