90 lines
2.6 KiB
C#
90 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
public class DataManager : Singleton<DataManager>
|
|
{
|
|
[field: Title("Inventory")]
|
|
[field: SerializeField] public PlayerInventory PlayerInventory { get; private set; }
|
|
public int Gold { get; set; } = 0;
|
|
|
|
[Title("DataBase", "GameObject")]
|
|
public GameObject mouseSpot;
|
|
public GameObject boat;
|
|
public GameObject assaultCard;
|
|
public GameObject radarTargetUi;
|
|
public GameObject vomit;
|
|
|
|
[Title("DataBase", "Particle")]
|
|
public GameObject nukeFire;
|
|
public GameObject grenadeFire;
|
|
public GameObject emojiHeart;
|
|
public GameObject emojiPuke;
|
|
public GameObject emojiAnger;
|
|
|
|
[Title("DataBase", "Sprites")]
|
|
public Sprite[] cardType;
|
|
public Texture2D cursorTexture;
|
|
public Sprite enemyMarker;
|
|
public Sprite scallion;
|
|
public Sprite tomato;
|
|
public Sprite onion;
|
|
public Sprite kingCrabMeat;
|
|
public Sprite beer;
|
|
|
|
[field: SerializeField] public NpcDataSO NpcDataSo { get; private set; }
|
|
|
|
private void Init()
|
|
{
|
|
PlayerInventory = new PlayerInventory();
|
|
}
|
|
|
|
protected override void OnAwake()
|
|
{
|
|
Init();
|
|
if (gameObject.GetComponent<Upd>() == null)
|
|
{
|
|
gameObject.AddComponent<Upd>();
|
|
}
|
|
}
|
|
|
|
public NpcData GetNpcData(int idx)
|
|
{
|
|
var data = NpcDataSo.npcDataList.FirstOrDefault(d => d.idx == idx);
|
|
if(data == null)
|
|
{
|
|
Debug.LogWarning($"NPC Data for index {idx} not found.");
|
|
}
|
|
return data;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Dictionary 초기화 함수
|
|
/// </summary>
|
|
private Dictionary<string, T> CreateDictionaryFromList<T>(List<T> list, int capacity) where T : IIdx
|
|
{
|
|
var newDictionary = new Dictionary<string, T>(capacity);
|
|
|
|
foreach (var item in list)
|
|
{
|
|
newDictionary.Add(item.Idx, item);
|
|
}
|
|
|
|
return newDictionary;
|
|
}
|
|
|
|
[ContextMenu("Json To So")]
|
|
public void MakeDataSoFromJson()
|
|
{
|
|
// WeaponDataSo.weaponDataList = GetJsonData<List<WeaponData>>("JSON/WEAPON_TABLE.json");
|
|
// #if UNITY_EDITOR_OSX || UNITY_EDITOR_WIN
|
|
// EditorUtility.SetDirty(WeaponDataSo);
|
|
// #endif
|
|
}
|
|
}
|
|
} |