CapersProject/Assets/02.Scripts/Item/ItemData.cs

102 lines
3.0 KiB
C#
Raw Normal View History

2024-06-03 18:26:03 +00:00
using System;
using BlueWater.Interfaces;
using Newtonsoft.Json;
using Sirenix.OdinInspector;
2024-06-03 18:26:03 +00:00
using UnityEngine;
namespace BlueWater.Items
{
public enum ItemType
2024-06-03 18:26:03 +00:00
{
None = 0,
FoodIngredient,
Currency,
Dish,
Drink,
2024-06-03 18:26:03 +00:00
Quest = 9
}
public enum IngredientType
2024-06-03 18:26:03 +00:00
{
None = 0,
Meat,
Fish,
Egg,
Fruit,
Shellfish,
Seasoning
}
public enum ItemQuality
{
None = 0,
Normal,
High
}
2024-06-03 18:26:03 +00:00
[Serializable]
2024-09-10 10:25:05 +00:00
public class ItemData : IPickup
2024-06-03 18:26:03 +00:00
{
[BoxGroup("Json 데이터 영역")]
[field: SerializeField, Tooltip("고유 식별 ID"), BoxGroup("Json 데이터 영역")]
2024-08-22 10:39:15 +00:00
public string Idx { get; set; }
2024-06-03 18:26:03 +00:00
[field: SerializeField, Tooltip("이름"), BoxGroup("Json 데이터 영역")]
2024-06-03 18:26:03 +00:00
public string Name { get; set; }
[field: SerializeField, Tooltip("아이템 종류"), BoxGroup("Json 데이터 영역")]
public ItemType Type { get; set; }
2024-06-03 18:26:03 +00:00
[field: SerializeField, Tooltip("재료 종류"), BoxGroup("Json 데이터 영역")]
public IngredientType IngredientType { get; set; }
[field: SerializeField, Tooltip("아이템 품질"), BoxGroup("Json 데이터 영역")]
public ItemQuality Quality { get; set; }
2024-06-03 18:26:03 +00:00
[field: SerializeField, Tooltip("가격"), BoxGroup("Json 데이터 영역")]
2024-06-03 18:26:03 +00:00
public int Price { get; set; }
[field: SerializeField, Tooltip("무게"), BoxGroup("Json 데이터 영역")]
2024-06-03 18:26:03 +00:00
public int Weight { get; set; }
[field: SerializeField, Tooltip("설명"), TextArea(3, 10), BoxGroup("Json 데이터 영역")]
public string Description { get; set; }
[BoxGroup("직접 추가하는 영역")]
[field: SerializeField, BoxGroup("직접 추가하는 영역")]
2024-06-03 18:26:03 +00:00
public Sprite Sprite { get; set; }
[field: SerializeField, BoxGroup("직접 추가하는 영역")]
public Item ItemPrefab { get; set; }
[JsonConstructor]
2024-08-22 10:39:15 +00:00
public ItemData(string idx, string name, ItemType type, IngredientType ingredientType, ItemQuality quality, int price,
int weight, string description, Sprite sprite, Item itemPrefab)
{
Idx = idx;
Name = name;
Type = type;
IngredientType = ingredientType;
Quality = quality;
Price = price;
Weight = weight;
Description = description;
Sprite = sprite;
ItemPrefab = itemPrefab;
}
public ItemData(ItemData itemData)
{
Idx = itemData.Idx;
Name = itemData.Name;
Type = itemData.Type;
IngredientType = itemData.IngredientType;
Quality = itemData.Quality;
Price = itemData.Price;
Weight = itemData.Weight;
Description = itemData.Description;
Sprite = itemData.Sprite;
ItemPrefab = itemData.ItemPrefab;
}
2024-06-03 18:26:03 +00:00
}
}