PJ/Assets/scripts/dotfs_scripts/ShopModels.cs

45 lines
No EOL
1.2 KiB
C#

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using UnityEngine;
[Serializable]
public class ShopConfig
{
// Используй простые поля для 100% совместимости
[JsonProperty("shops")]
public List<ShopItem> shops = new List<ShopItem>();
}
[Serializable]
public class ShopItem
{
public string id;
public string shop_type;
public string icon_id;
public string title;
public string description;
public int price;
public string currency_type;
public bool availableFromStart;
public bool isGift;
public float discount;
public bool preserve_aspect = true;
public string purchaseSfxId;
public string errorSfxId;
public List<ShopCondition> conditions;
[JsonIgnore] public bool isLocked;
[JsonIgnore]
public int FinalPrice => isGift ? 0 : (discount <= 0 ? price : Mathf.RoundToInt(price * (100f - discount) / 100f));
}
[Serializable]
public class ShopCondition
{
public string type;
public int value;
public string target_id;
}