구글 시트 로직 수정 (클래스명 변경)

This commit is contained in:
NTG 2025-08-28 12:49:47 +09:00
parent bf1fe51957
commit ba5d3ffb59
117 changed files with 302 additions and 302 deletions

View File

@ -6,7 +6,7 @@
namespace DDD
{
public class DataSo<T> : ScriptableObject where T : IId
public class DataAsset<T> : ScriptableObject where T : IId
{
[FormerlySerializedAs("Datas")] [SerializeField] protected List<T> _datas = new();

View File

@ -18,6 +18,6 @@ public InventoryItemData(string id, int quantity)
Quantity = quantity;
}
public ItemData ItemData => InventoryManager.Instance.GetItemDataByIdOrNull(Id);
public ItemDataEntry ItemDataEntry => InventoryManager.Instance.GetItemDataByIdOrNull(Id);
}
}

View File

@ -19,7 +19,7 @@ public class InventoryManager : Singleton<InventoryManager>, IManager
{
[Title("아이템 전체 목록")]
[ShowInInspector, ReadOnly]
private Dictionary<string, ItemData> _allItemDataLookup;
private Dictionary<string, ItemDataEntry> _allItemDataLookup;
[Title("아이템 보유 목록")]
[ShowInInspector, ReadOnly]
@ -48,7 +48,7 @@ public void PostInit()
private void InitializeItemData()
{
var itemDataSo = DataManager.Instance.GetDataSo<ItemDataSo>();
var itemDataSo = DataManager.Instance.GetDataSo<ItemDataAsset>();
Debug.Assert(itemDataSo != null, "itemDataSo != null");
_allItemDataLookup = itemDataSo.GetDataList()
@ -129,12 +129,12 @@ public bool RemoveItem(string id, int quantity = 1)
return true;
}
public IReadOnlyDictionary<string, ItemData> AllItemDataLookup => _allItemDataLookup;
public IReadOnlyDictionary<string, ItemDataEntry> AllItemDataLookup => _allItemDataLookup;
public IReadOnlyDictionary<string, InventoryItemData> InventoryItems => _inventoryItemDatas;
public bool ContainInventoryItem(string id) => _inventoryItemDatas.ContainsKey(id);
public bool TryGetInventoryItemData(string id, out InventoryItemData inventoryItemData) => _inventoryItemDatas.TryGetValue(id, out inventoryItemData);
public int GetItemCount(string id) => _inventoryItemDatas.TryGetValue(id, out var itemData) ? itemData.Quantity : 0;
public ItemData GetItemDataByIdOrNull(string id)
public ItemDataEntry GetItemDataByIdOrNull(string id)
{
_allItemDataLookup.TryGetValue(id, out var itemData);
return itemData;

View File

@ -28,14 +28,14 @@ private IEnumerable<string> GetAllItemIds()
.Select(d => d.Id);
}
private ItemDataSo LoadItemDataSo()
private ItemDataAsset LoadItemDataSo()
{
// 경로는 프로젝트에 맞게 조정 필요
string[] guids = AssetDatabase.FindAssets("t:ItemDataSo");
string[] guids = AssetDatabase.FindAssets("t:ItemDataAsset");
if (guids.Length == 0) return null;
string path = AssetDatabase.GUIDToAssetPath(guids[0]);
return AssetDatabase.LoadAssetAtPath<ItemDataSo>(path);
return AssetDatabase.LoadAssetAtPath<ItemDataAsset>(path);
}
}

View File

@ -47,10 +47,10 @@ private void RemoveItem()
private IEnumerable<string> GetItemIds()
{
if (!Application.isPlaying || DataManager.Instance?.GetDataSo<ItemDataSo>() == null)
if (!Application.isPlaying || DataManager.Instance?.GetDataSo<ItemDataAsset>() == null)
return Enumerable.Empty<string>();
return DataManager.Instance.GetDataSo<ItemDataSo>().GetDataList()
return DataManager.Instance.GetDataSo<ItemDataAsset>().GetDataList()
.Select(data => data.Id)
.Where(id => !string.IsNullOrEmpty(id));
}

View File

@ -104,7 +104,7 @@ private object GetPropertyValue(string propertyPath)
{
if (_dataContext == null) return null;
// 중첩 속성 지원 (예: "ItemData.Name")
// 중첩 속성 지원 (예: "ItemDataEntry.Name")
var properties = propertyPath.Split('.');
object current = _dataContext;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,23 @@
// <auto-generated> File: CookwareDataAsset.cs
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "CookwareDataAsset", menuName = "GoogleSheet/CookwareDataAsset")]
public class CookwareDataAsset : DataAsset<CookwareDataEntry>
{
public bool TryGetValueByCookwareType(CookwareType cookwareType, out CookwareDataEntry cookwareDataEntry)
{
if (_datas == null)
{
cookwareDataEntry = null;
return false;
}
cookwareDataEntry = _datas.FirstOrDefault(data => data != null && data.CookwareType == cookwareType);
return cookwareDataEntry != null;
}
}
}

View File

@ -18,7 +18,7 @@ public enum CookwareType
}
[Serializable]
public class CookwareData : IId
public class CookwareDataEntry : IId
{
/// <summary>식별ID</summary>
[Tooltip("식별ID")]

View File

@ -1,23 +0,0 @@
// <auto-generated> File: CookwareDataSo.cs
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "CookwareDataSo", menuName = "GoogleSheet/CookwareDataSo")]
public class CookwareDataSo : DataSo<CookwareData>
{
public bool TryGetValueByCookwareType(CookwareType cookwareType, out CookwareData cookwareData)
{
if (_datas == null)
{
cookwareData = null;
return false;
}
cookwareData = _datas.FirstOrDefault(data => data != null && data.CookwareType == cookwareType);
return cookwareData != null;
}
}
}

View File

@ -3,8 +3,8 @@
namespace DDD
{
[CreateAssetMenu(fileName = "CustomerDataSo", menuName = "GoogleSheet/CustomerDataSo")]
public class CustomerDataSo : DataSo<CustomerData>
[CreateAssetMenu(fileName = "CustomerDataAsset", menuName = "GoogleSheet/CustomerDataAsset")]
public class CustomerDataAsset : DataAsset<CustomerDataEntry>
{
protected override void Initialize()
{

View File

@ -15,7 +15,7 @@ public enum CustomerType
}
[Serializable]
public class CustomerData : IId
public class CustomerDataEntry : IId
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]

View File

@ -3,8 +3,8 @@
namespace DDD
{
[CreateAssetMenu(fileName = "CustomerPoolDataSo", menuName = "GoogleSheet/CustomerPoolDataSo")]
public class CustomerPoolDataSo : DataSo<CustomerPoolData>
[CreateAssetMenu(fileName = "CustomerPoolDataAsset", menuName = "GoogleSheet/CustomerPoolDataAsset")]
public class CustomerPoolDataAsset : DataAsset<CustomerPoolDataEntry>
{
protected override void Initialize()
{

View File

@ -7,7 +7,7 @@
namespace DDD
{
[Serializable]
public class CustomerPoolData : IId
public class CustomerPoolDataEntry : IId
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]

View File

@ -0,0 +1,9 @@
// <auto-generated> File: DrinkDataAsset.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "DrinkDataAsset", menuName = "GoogleSheet/DrinkDataAsset")]
public class DrinkDataAsset : DataAsset<DrinkDataEntry> { }
}

View File

@ -5,7 +5,7 @@
namespace DDD
{
[Serializable]
public class FoodData : IId
public class DrinkDataEntry : IId
{
/// <summary>식별ID</summary>
[Tooltip("식별ID")]

View File

@ -1,9 +0,0 @@
// <auto-generated> File: DrinkDataSo.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "DrinkDataSo", menuName = "GoogleSheet/DrinkDataSo")]
public class DrinkDataSo : DataSo<DrinkData> { }
}

View File

@ -0,0 +1,9 @@
// <auto-generated> File: EnvironmentDataAsset.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "EnvironmentDataAsset", menuName = "GoogleSheet/EnvironmentDataAsset")]
public class EnvironmentDataAsset : DataAsset<EnvironmentDataEntry> { }
}

View File

@ -12,7 +12,7 @@ public enum RendererType
}
[Serializable]
public class EnvironmentData : IId
public class EnvironmentDataEntry : IId
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]

View File

@ -1,9 +0,0 @@
// <auto-generated> File: EnvironmentDataSo.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "EnvironmentDataSo", menuName = "GoogleSheet/EnvironmentDataSo")]
public class EnvironmentDataSo : DataSo<EnvironmentData> { }
}

View File

@ -0,0 +1,9 @@
// <auto-generated> File: FoodDataAsset.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "FoodDataAsset", menuName = "GoogleSheet/FoodDataAsset")]
public class FoodDataAsset : DataAsset<FoodDataEntry> { }
}

View File

@ -5,7 +5,7 @@
namespace DDD
{
[Serializable]
public class DrinkData : IId
public class FoodDataEntry : IId
{
/// <summary>식별ID</summary>
[Tooltip("식별ID")]

View File

@ -1,9 +0,0 @@
// <auto-generated> File: FoodDataSo.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "FoodDataSo", menuName = "GoogleSheet/FoodDataSo")]
public class FoodDataSo : DataSo<FoodData> { }
}

View File

@ -0,0 +1,8 @@
// <auto-generated>
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "IngredientDataAsset", menuName = "GoogleSheet/IngredientDataAsset")]
public class IngredientDataAsset : DataAsset<IngredientDataEntry> { }
}

View File

@ -5,7 +5,7 @@
namespace DDD
{
[Serializable]
public class IngredientData : IId
public class IngredientDataEntry : IId
{
/// <summary>식별ID</summary>
[Tooltip("식별ID")]

View File

@ -1,8 +0,0 @@
// <auto-generated>
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "IngredientDataSo", menuName = "GoogleSheet/IngredientDataSo")]
public class IngredientDataSo : DataSo<IngredientData> { }
}

View File

@ -0,0 +1,9 @@
// <auto-generated> File: ItemDataAsset.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "ItemDataAsset", menuName = "GoogleSheet/ItemDataAsset")]
public class ItemDataAsset : DataAsset<ItemDataEntry> { }
}

View File

@ -15,7 +15,7 @@ public enum ItemType
}
[Serializable]
public class ItemData : IId
public class ItemDataEntry : IId
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]

View File

@ -1,9 +0,0 @@
// <auto-generated> File: ItemDataSo.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "ItemDataSo", menuName = "GoogleSheet/ItemDataSo")]
public class ItemDataSo : DataSo<ItemData> { }
}

View File

@ -0,0 +1,8 @@
// <auto-generated>
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "LevelDataAsset", menuName = "GoogleSheet/LevelDataAsset")]
public class LevelDataAsset : DataAsset<LevelDataEntry> { }
}

View File

@ -12,7 +12,7 @@ public enum SpawnType
}
[Serializable]
public class LevelData : IId
public class LevelDataEntry : IId
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]

View File

@ -1,8 +0,0 @@
// <auto-generated>
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "LevelDataSo", menuName = "GoogleSheet/LevelDataSo")]
public class LevelDataSo : DataSo<LevelData> { }
}

View File

@ -0,0 +1,9 @@
// <auto-generated> File: RecipeDataAsset.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "RecipeDataAsset", menuName = "GoogleSheet/RecipeDataAsset")]
public class RecipeDataAsset : DataAsset<RecipeDataEntry> { }
}

View File

@ -12,7 +12,7 @@ public enum RecipeType
}
[Serializable]
public class RecipeData : IId
public class RecipeDataEntry : IId
{
/// <summary>식별ID</summary>
[Tooltip("식별ID")]

View File

@ -1,9 +0,0 @@
// <auto-generated> File: RecipeDataSo.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "RecipeDataSo", menuName = "GoogleSheet/RecipeDataSo")]
public class RecipeDataSo : DataSo<RecipeData> { }
}

View File

@ -0,0 +1,9 @@
// <auto-generated> File: TasteDataAsset.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "TasteDataAsset", menuName = "GoogleSheet/TasteDataAsset")]
public class TasteDataAsset : DataAsset<TasteDataEntry> { }
}

View File

@ -28,7 +28,7 @@ public enum TasteType
}
[Serializable]
public class TasteData : IId
public class TasteDataEntry : IId
{
/// <summary>식별ID</summary>
[Tooltip("식별ID")]

View File

@ -1,9 +0,0 @@
// <auto-generated> File: TasteDataSo.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "TasteDataSo", menuName = "GoogleSheet/TasteDataSo")]
public class TasteDataSo : DataSo<TasteData> { }
}

View File

@ -83,8 +83,8 @@ public CodeGenerationResult Generate(string fullJson, IReadOnlyCollection<string
if (!autoCreateSheets.Contains(className)) continue;
if (pair.Value is not JArray items || items.Count < 2) continue;
string dataAssetPath = $"{classesFolderAssetPath}/{className}.cs";
string soAssetPath = $"{classesFolderAssetPath}/{className}So.cs";
string dataAssetPath = $"{classesFolderAssetPath}/{className}Entry.cs";
string soAssetPath = $"{classesFolderAssetPath}/{className}Asset.cs";
if (!File.Exists(GoogleSheetSettingsSo.AssetToFull(dataAssetPath)))
{
@ -173,8 +173,8 @@ private string GenerateSoClass(string rootNamespace, string className)
namespace {rootNamespace}
{{
[CreateAssetMenu(fileName = ""{safe}So"", menuName = ""GoogleSheet/{safe}So"")]
public class {safe}So : DataSo<{safe}> {{ }}
[CreateAssetMenu(fileName = ""{safe}Asset"", menuName = ""GoogleSheet/{safe}Asset"")]
public class {safe}Asset : DataAsset<{safe}> {{ }}
}}";
}
@ -193,7 +193,7 @@ private string GenerateDataClass(string rootNamespace, string className, JArray
sb.AppendLine($"namespace {rootNamespace}");
sb.AppendLine("{");
sb.AppendLine(" [Serializable]");
sb.AppendLine($" public class {safeClass} : IId");
sb.AppendLine($" public class {safeClass}Entry : IId");
sb.AppendLine(" {");
foreach (var prop in sampleRow.Properties())

View File

@ -21,7 +21,7 @@ public class GoogleSheetSettingsSo : ScriptableObject
[Header("출력 경로(모두 AssetPath, 한 곳만 바꾸면 연동)")]
[SerializeField] private string _generateAssetBasePath = "Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated";
[SerializeField] private string _classesFolderName = "Classes";
[SerializeField] private string _soFolderName = "So";
[SerializeField] private string _assetFolderName = "Assets";
[SerializeField] private string _logsFolderName = "Logs";
[SerializeField] private string _backupsFolderName = "BackUps";
[SerializeField] private string _enumTypesFileName = "EnumTypes.cs";
@ -30,7 +30,7 @@ public class GoogleSheetSettingsSo : ScriptableObject
public string GenerateAssetBasePath => _generateAssetBasePath;
public string ClassesFolderAssetPath => CombineAsset(_generateAssetBasePath, _classesFolderName);
public string SoFolderAssetPath => CombineAsset(_generateAssetBasePath, _soFolderName);
public string SoFolderAssetPath => CombineAsset(_generateAssetBasePath, _assetFolderName);
public string LogsFolderAssetPath => CombineAsset(_generateAssetBasePath, _logsFolderName);
public string BackupsFolderAssetPath => CombineAsset(_generateAssetBasePath, _backupsFolderName);
public string EnumTypesAssetPath => CombineAsset(_generateAssetBasePath, _enumTypesFileName);
@ -74,7 +74,7 @@ private void OnValidate()
{
_generateAssetBasePath = NormalizeAssetPath(_generateAssetBasePath);
_classesFolderName = (_classesFolderName ?? "Classes").Replace("/", "").Replace("\\", "");
_soFolderName = (_soFolderName ?? "So").Replace("/", "").Replace("\\", "");
_assetFolderName = (_assetFolderName ?? "So").Replace("/", "").Replace("\\", "");
_logsFolderName = (_logsFolderName ?? "Logs").Replace("/", "").Replace("\\", "");
_backupsFolderName = (_backupsFolderName ?? "BackUps").Replace("/", "").Replace("\\", "");
_enumTypesFileName = string.IsNullOrWhiteSpace(_enumTypesFileName) ? "EnumTypes.cs" : _enumTypesFileName;

View File

@ -20,11 +20,11 @@ private void Awake()
_blackboardComponent = GetComponent<CustomerBlackboardComponent>();
}
public async Task InitializeAi(CustomerData inCustomerData)
public async Task InitializeAi(CustomerDataEntry inCustomerDataEntry)
{
try
{
await InitializeAiInternal(inCustomerData);
await InitializeAiInternal(inCustomerDataEntry);
}
catch (Exception e)
{
@ -34,21 +34,21 @@ public async Task InitializeAi(CustomerData inCustomerData)
}
}
private async Task InitializeAiInternal(CustomerData inCustomerData)
private async Task InitializeAiInternal(CustomerDataEntry inCustomerDataEntry)
{
var customerState = RestaurantState.Instance.CustomerState;
var subtree = customerState.GetLoadedSubtree(inCustomerData.CustomerType);
var subtree = customerState.GetLoadedSubtree(inCustomerDataEntry.CustomerType);
if (subtree == null)
{
Debug.LogError(
$"[CustomerCharacter] No preloaded subtree found for CustomerType: {inCustomerData.CustomerType}. Make sure CustomerBehaviorData is loaded.");
subtree = await customerState.GetOrLoadSubtree(inCustomerData.CustomerType);
$"[CustomerCharacter] No preloaded subtree found for CustomerType: {inCustomerDataEntry.CustomerType}. Make sure CustomerBehaviorData is loaded.");
subtree = await customerState.GetOrLoadSubtree(inCustomerDataEntry.CustomerType);
}
_behaviorTree.Subgraph = subtree;
_blackboardComponent.InitializeWithBehaviorTree(subtree);
_blackboardComponent.SetCustomerData(inCustomerData);
_blackboardComponent.SetCustomerData(inCustomerDataEntry);
// TODO : 1. Subtree - Action, Condition
// TODO : 2. Blackboard
_behaviorTree.StartBehavior();

View File

@ -17,10 +17,10 @@ public void InitializeWithBehaviorTree(Subtree subtree)
}
}
public void SetCustomerData(CustomerData inCustomerData)
public void SetCustomerData(CustomerDataEntry inCustomerDataEntry)
{
if (_subtree == null) return;
_subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerData), inCustomerData);
_subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerData), inCustomerDataEntry);
}
public void SetCurrentInteractionTarget(GameObject targetGameObject)

View File

@ -4,6 +4,6 @@ namespace DDD
{
public interface ICustomerAi
{
Task InitializeAi(CustomerData inCustomerData);
Task InitializeAi(CustomerDataEntry inCustomerDataEntry);
}
}

View File

@ -11,7 +11,7 @@ public enum RestaurantCustomerBlackboardKey
public interface ICustomerBlackboard
{
void SetCustomerData(CustomerData inCustomerData);
void SetCustomerData(CustomerDataEntry inCustomerDataEntry);
void SetCurrentInteractionTarget(GameObject targetGameObject);
GameObject GetCurrentInteractionTarget();
}

Some files were not shown because too many files have changed in this diff Show More