2024-07-15 16:20:39 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using BlueWater.Items;
|
2024-07-08 20:06:22 +00:00
|
|
|
using BlueWater.Tycoons;
|
2024-06-03 18:26:03 +00:00
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace BlueWater
|
|
|
|
{
|
|
|
|
public enum SaveStage
|
|
|
|
{
|
2024-06-13 16:46:37 +00:00
|
|
|
None = 0,
|
2024-06-21 22:11:53 +00:00
|
|
|
TitanSlime = 3,
|
|
|
|
Rhinoceros = 4,
|
2024-06-28 08:44:52 +00:00
|
|
|
SandMole = 5,
|
|
|
|
GhostBarrel = 6
|
2024-06-03 18:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public class DataManager : Singleton<DataManager>
|
|
|
|
{
|
|
|
|
public SaveStage CurrentSaveStage { get; set; }
|
|
|
|
|
2024-07-20 11:32:54 +00:00
|
|
|
[field: Title("스프라이트 데이터")]
|
|
|
|
[field: SerializeField]
|
|
|
|
public SpriteDataSo SpriteDataSo { get; private set; }
|
|
|
|
|
2024-07-15 16:20:39 +00:00
|
|
|
[field: Title("아이템 데이터")]
|
2024-07-20 11:32:54 +00:00
|
|
|
[field: SerializeField]
|
|
|
|
public Inventory Inventory { get; private set; }
|
2024-07-15 16:20:39 +00:00
|
|
|
|
|
|
|
[field: Title("아이템 데이터")]
|
2024-07-20 11:32:54 +00:00
|
|
|
[field: SerializeField]
|
2024-08-22 10:39:15 +00:00
|
|
|
public List<string> FoodRecipes { get; private set; } = new();
|
2024-07-08 20:06:22 +00:00
|
|
|
|
|
|
|
[field: Title("타이쿤 데이터")]
|
|
|
|
[field: SerializeField]
|
|
|
|
public TycoonData TycoonData { get; private set; }
|
2024-07-15 16:20:39 +00:00
|
|
|
|
2024-07-20 11:32:54 +00:00
|
|
|
[field: Title("실시간 데이터")]
|
|
|
|
public int Gold { get; set; }
|
|
|
|
|
2024-07-15 16:20:39 +00:00
|
|
|
public event Action<FoodData> OnChangeFoodRecipe;
|
2024-07-20 11:32:54 +00:00
|
|
|
public event Action<int> OnChangeGold;
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
GetMoney(5000);
|
|
|
|
}
|
2024-06-03 18:26:03 +00:00
|
|
|
|
2024-07-15 16:20:39 +00:00
|
|
|
public void TestData()
|
|
|
|
{
|
2024-08-22 10:39:15 +00:00
|
|
|
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));
|
2024-07-15 16:20:39 +00:00
|
|
|
|
2024-08-22 10:39:15 +00:00
|
|
|
AddFoodRecipe("30001");
|
|
|
|
AddFoodRecipe("30002");
|
|
|
|
AddFoodRecipe("30004");
|
|
|
|
AddFoodRecipe("30005");
|
|
|
|
AddFoodRecipe("30006");
|
2024-07-15 16:20:39 +00:00
|
|
|
}
|
2024-06-03 18:26:03 +00:00
|
|
|
|
2024-08-22 10:39:15 +00:00
|
|
|
public void AddFoodRecipe(string idx)
|
2024-07-15 16:20:39 +00:00
|
|
|
{
|
|
|
|
if (FoodRecipes.Contains(idx)) return;
|
|
|
|
|
|
|
|
var foodData = ItemManager.Instance.GetFoodDataByIdx(idx);
|
|
|
|
if (foodData == null) return;
|
|
|
|
|
|
|
|
FoodRecipes.Add(idx);
|
|
|
|
OnChangeFoodRecipe?.Invoke(foodData);
|
|
|
|
}
|
2024-07-20 11:32:54 +00:00
|
|
|
|
|
|
|
public void GetMoney(int money)
|
|
|
|
{
|
|
|
|
Gold += money;
|
|
|
|
OnChangeGold?.Invoke(Gold);
|
|
|
|
}
|
2024-06-03 18:26:03 +00:00
|
|
|
}
|
|
|
|
}
|