72 lines
2.3 KiB
C#
72 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BlueWater.Items;
|
|
using BlueWater.Tycoons;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
namespace BlueWater
|
|
{
|
|
public enum SaveStage
|
|
{
|
|
None = 0,
|
|
TitanSlime = 3,
|
|
Rhinoceros = 4,
|
|
SandMole = 5,
|
|
GhostBarrel = 6
|
|
}
|
|
|
|
public class DataManager : Singleton<DataManager>
|
|
{
|
|
public SaveStage CurrentSaveStage { get; set; }
|
|
|
|
[field: Title("아이템 데이터")]
|
|
[field: SerializeField] public Inventory Inventory { get; private set; } = new();
|
|
|
|
[field: Title("아이템 데이터")]
|
|
[field: SerializeField] public List<int> FoodRecipes { get; private set; } = new();
|
|
|
|
public int Gold { get; set; } = 0;
|
|
|
|
[field: Title("타이쿤 데이터")]
|
|
[field: SerializeField]
|
|
public TycoonData TycoonData { get; private set; }
|
|
|
|
public event Action<FoodData> OnChangeFoodRecipe;
|
|
|
|
public void TestData()
|
|
{
|
|
Inventory.AddItem(new ItemSlot(10107, 2));
|
|
Inventory.AddItem(new ItemSlot(10108, 1));
|
|
Inventory.AddItem(new ItemSlot(10109, 2));
|
|
Inventory.AddItem(new ItemSlot(10201, 1));
|
|
Inventory.AddItem(new ItemSlot(10404, 9));
|
|
Inventory.AddItem(new ItemSlot(10503, 4));
|
|
Inventory.AddItem(new ItemSlot(10507, 15));
|
|
Inventory.AddItem(new ItemSlot(10508, 100));
|
|
Inventory.AddItem(new ItemSlot(10603, 3));
|
|
Inventory.AddItem(new ItemSlot(10701, 999));
|
|
Inventory.AddItem(new ItemSlot(10704, 5396));
|
|
Inventory.AddItem(new ItemSlot(10705, 66));
|
|
Inventory.AddItem(new ItemSlot(10706, 35));
|
|
Inventory.AddItem(new ItemSlot(60001, 2));
|
|
|
|
AddFoodRecipe(30001);
|
|
AddFoodRecipe(30002);
|
|
AddFoodRecipe(30004);
|
|
AddFoodRecipe(30005);
|
|
AddFoodRecipe(30006);
|
|
}
|
|
|
|
public void AddFoodRecipe(int idx)
|
|
{
|
|
if (FoodRecipes.Contains(idx)) return;
|
|
|
|
var foodData = ItemManager.Instance.GetFoodDataByIdx(idx);
|
|
if (foodData == null) return;
|
|
|
|
FoodRecipes.Add(idx);
|
|
OnChangeFoodRecipe?.Invoke(foodData);
|
|
}
|
|
}
|
|
} |