아이템 테이블 정보 추가

This commit is contained in:
yonggyun 2025-06-25 16:16:48 +09:00
parent 1c4c7906d7
commit 47e479c0fa
19 changed files with 292 additions and 66 deletions

View File

@ -21,6 +21,12 @@ MonoBehaviour:
m_SerializedLabels:
- GoogleSheetSo
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 5479f075b6cda4949a55b4f1e2cb6dd1
m_Address: ItemSo
m_ReadOnly: 0
m_SerializedLabels:
- GoogleSheetSo
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 6e22365847202cd42978093a2b420135
m_Address: MonsterSo
m_ReadOnly: 0

View File

@ -422,10 +422,10 @@ MonoBehaviour:
_namespace: DDD
_availSheets: Food/Monster/Item
_generateFolderPath: /_Datas/02.Scripts/GenerateGoogleSheet/AutoCreated
_currentVersion: "0 - 2025-06-25 14:48:53 by \uC774\uC6A9\uADE0"
_currentVersion: "0 - 2025-06-25 16:14:34 by \uC774\uC6A9\uADE0"
_restoreIndex: 0
_editorName:
_refreshTrigger: 1
_refreshTrigger: 0
--- !u!114 &141274235
MonoBehaviour:
m_ObjectHideFlags: 0
@ -6483,6 +6483,37 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 04cb72fe661fd534b950283199ac4a83, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1785845838
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1785845839}
m_Layer: 0
m_Name: Unused
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1785845839
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785845838}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.08174, y: 0.40321, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1787885308
MonoBehaviour:
m_ObjectHideFlags: 0
@ -7611,3 +7642,4 @@ SceneRoots:
- {fileID: 968554881}
- {fileID: 1221676613}
- {fileID: 121938434}
- {fileID: 1785845839}

View File

@ -82,5 +82,35 @@
"Name": "D",
"T1": 4
}
],
"Item": [
{
"Id": "식별번호",
"Name": "이름",
"ItemType_Enum": "아이템타입",
"CellSizeX:int": "셀크기X",
"CellSizeY:int": "셀크기Y"
},
{
"Id": "Item001",
"Name": "나무장판",
"ItemType_Enum": "Floor",
"CellSizeX:int": 1,
"CellSizeY:int": 1
},
{
"Id": "Item002",
"Name": "테이블",
"ItemType_Enum": "Furniture",
"CellSizeX:int": 2,
"CellSizeY:int": 2
},
{
"Id": "Item003",
"Name": "전등",
"ItemType_Enum": "WallMount",
"CellSizeX:int": "",
"CellSizeY:int": ""
}
]
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1e7e04ed247b61846b3f6e4289590e2a
guid: 1f9b8f585350fe54bb7e558ae0b00e98
TextScriptImporter:
externalObjects: {}
userData:

View File

@ -1,39 +1,42 @@
// <auto-generated>
using System;
using UnityEngine;
[Serializable]
public class Food
namespace DDD
{
/// <summary>식별ID</summary>
[Tooltip("식별ID")]
public string Id;
[Serializable]
public class Food
{
/// <summary>식별ID</summary>
[Tooltip("식별ID")]
public string Id;
/// <summary>이름</summary>
[Tooltip("이름")]
public string Name;
/// <summary>이름</summary>
[Tooltip("이름")]
public string Name;
/// <summary>요리도구</summary>
[Tooltip("요리도구")]
public Cookware Cookware;
/// <summary>요리도구</summary>
[Tooltip("요리도구")]
public Cookware Cookware;
/// <summary>재료1</summary>
[Tooltip("재료1")]
public string Ingredient1;
/// <summary>재료1</summary>
[Tooltip("재료1")]
public string Ingredient1;
/// <summary>재료2</summary>
[Tooltip("재료2")]
public string Ingredient2;
/// <summary>재료2</summary>
[Tooltip("재료2")]
public string Ingredient2;
/// <summary>맛1</summary>
[Tooltip("맛1")]
public Taste Taste1;
/// <summary>맛1</summary>
[Tooltip("맛1")]
public Taste Taste1;
/// <summary>맛2</summary>
[Tooltip("맛2")]
public Taste Taste2;
/// <summary>맛2</summary>
[Tooltip("맛2")]
public Taste Taste2;
/// <summary>Addressable 이미지 이름</summary>
[Tooltip("Addressable 이미지 이름")]
public Sprite Sprite;
/// <summary>Addressable 이미지 이름</summary>
[Tooltip("Addressable 이미지 이름")]
public Sprite Sprite;
}
}

View File

@ -2,8 +2,11 @@
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "FoodSo", menuName = "GoogleSheet/FoodSo")]
public class FoodSo : ScriptableObject
namespace DDD
{
public List<Food> FoodList;
[CreateAssetMenu(fileName = "FoodSo", menuName = "GoogleSheet/FoodSo")]
public class FoodSo : ScriptableObject
{
public List<Food> FoodList;
}
}

View File

@ -0,0 +1,30 @@
// <auto-generated>
using System;
using UnityEngine;
namespace DDD
{
[Serializable]
public class Item
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]
public string Id;
/// <summary>이름</summary>
[Tooltip("이름")]
public string Name;
/// <summary>아이템타입</summary>
[Tooltip("아이템타입")]
public ItemType ItemType;
/// <summary>셀크기X</summary>
[Tooltip("셀크기X")]
public int CellSizeX;
/// <summary>셀크기Y</summary>
[Tooltip("셀크기Y")]
public int CellSizeY;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5cab0c6954bc2c5408c61f1eb944b9bc

View File

@ -0,0 +1,12 @@
// <auto-generated> File: ItemSo.cs
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "ItemSo", menuName = "GoogleSheet/ItemSo")]
public class ItemSo : ScriptableObject
{
public List<Item> ItemList;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 786eeb81014098446b41cf48e8e8210f

View File

@ -1,19 +1,22 @@
// <auto-generated>
using System;
using UnityEngine;
[Serializable]
public class Monster
namespace DDD
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]
public string Id;
[Serializable]
public class Monster
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]
public string Id;
/// <summary>이름</summary>
[Tooltip("이름")]
public string Name;
/// <summary>이름</summary>
[Tooltip("이름")]
public string Name;
/// <summary>테스트1</summary>
[Tooltip("테스트1")]
public int T1;
/// <summary>테스트1</summary>
[Tooltip("테스트1")]
public int T1;
}
}

View File

@ -2,8 +2,11 @@
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "MonsterSo", menuName = "GoogleSheet/MonsterSo")]
public class MonsterSo : ScriptableObject
namespace DDD
{
public List<Monster> MonsterList;
[CreateAssetMenu(fileName = "MonsterSo", menuName = "GoogleSheet/MonsterSo")]
public class MonsterSo : ScriptableObject
{
public List<Monster> MonsterList;
}
}

View File

@ -20,3 +20,11 @@ public enum Taste
Salty = 6,
}
public enum ItemType
{
None = 0,
Floor = 1,
Furniture = 2,
WallMount = 3,
}

View File

@ -82,5 +82,35 @@
"Name": "D",
"T1": 4
}
],
"Item": [
{
"Id": "식별번호",
"Name": "이름",
"ItemType_Enum": "아이템타입",
"CellSizeX:int": "셀크기X",
"CellSizeY:int": "셀크기Y"
},
{
"Id": "Item001",
"Name": "나무장판",
"ItemType_Enum": "Floor",
"CellSizeX:int": 1,
"CellSizeY:int": 1
},
{
"Id": "Item002",
"Name": "테이블",
"ItemType_Enum": "Furniture",
"CellSizeX:int": 2,
"CellSizeY:int": 2
},
{
"Id": "Item003",
"Name": "전등",
"ItemType_Enum": "WallMount",
"CellSizeX:int": "",
"CellSizeY:int": ""
}
]
}

View File

@ -13,8 +13,8 @@ MonoBehaviour:
m_Name: GoogleSheetChangeLog
m_EditorClassIdentifier:
_logs:
- Editor: "\uB0A8\uD0DC\uAC74"
Timestamp: 2025-06-11 14:50:56
- Editor: "\uC774\uC6A9\uADE0"
Timestamp: 2025-06-25 16:14:34
JsonSnapshot: "{\n \"$\uAC1C\uC694\": [\n {\n \"\": \"\uC2DC\uD2B8 \uC0DD\uC131\"\n
}\n ],\n \"Food\": [\n {\n \"Id:string\": \"\uC2DD\uBCC4ID\",\n
\"Name:string\": \"\uC774\uB984\",\n \"Cookware_Enum\": \"\uC694\uB9AC\uB3C4\uAD6C\",\n
@ -42,5 +42,14 @@ MonoBehaviour:
},\n {\n \"Id\": \"Test002\",\n \"Name\": \"B\",\n \"T1\":
2\n },\n {\n \"Id\": \"Test003\",\n \"Name\": \"C\",\n
\"T1\": 3\n },\n {\n \"Id\": \"Test004\",\n \"Name\": \"D\",\n
\"T1\": 4\n }\n ]\n}"
\"T1\": 4\n }\n ],\n \"Item\": [\n {\n \"Id\": \"\uC2DD\uBCC4\uBC88\uD638\",\n
\"Name\": \"\uC774\uB984\",\n \"ItemType_Enum\": \"\uC544\uC774\uD15C\uD0C0\uC785\",\n
\"CellSizeX:int\": \"\uC140\uD06C\uAE30X\",\n \"CellSizeY:int\": \"\uC140\uD06C\uAE30Y\"\n
},\n {\n \"Id\": \"Item001\",\n \"Name\": \"\uB098\uBB34\uC7A5\uD310\",\n
\"ItemType_Enum\": \"Floor\",\n \"CellSizeX:int\": 1,\n \"CellSizeY:int\":
1\n },\n {\n \"Id\": \"Item002\",\n \"Name\": \"\uD14C\uC774\uBE14\",\n
\"ItemType_Enum\": \"Furniture\",\n \"CellSizeX:int\": 2,\n \"CellSizeY:int\":
2\n },\n {\n \"Id\": \"Item003\",\n \"Name\": \"\uC804\uB4F1\",\n
\"ItemType_Enum\": \"WallMount\",\n \"CellSizeX:int\": \"\",\n \"CellSizeY:int\":
\"\"\n }\n ]\n}"
MaxLogs: 100

View File

@ -20,7 +20,7 @@ MonoBehaviour:
Ingredient2: "\uD587\uBE5B\uB2F9\uADFC"
Taste1: 1
Taste2: 2
Sprite: {fileID: -3766852031887921369, guid: 00000000000000000000000000000000, type: 0}
Sprite: {fileID: 21300000, guid: e15933f76da90e742866563b5cd9e45f, type: 3}
- Id: Food002
Name: B
Cookware: 2
@ -44,4 +44,4 @@ MonoBehaviour:
Ingredient2: 3
Taste1: 5
Taste2: 6
Sprite: {fileID: -3766852031887921369, guid: 00000000000000000000000000000000, type: 0}
Sprite: {fileID: 21300000, guid: e15933f76da90e742866563b5cd9e45f, type: 3}

View File

@ -0,0 +1,30 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 786eeb81014098446b41cf48e8e8210f, type: 3}
m_Name: ItemSo
m_EditorClassIdentifier:
ItemList:
- Id: Item001
Name: "\uB098\uBB34\uC7A5\uD310"
ItemType: 1
CellSizeX: 1
CellSizeY: 1
- Id: Item002
Name: "\uD14C\uC774\uBE14"
ItemType: 2
CellSizeX: 2
CellSizeY: 2
- Id: Item003
Name: "\uC804\uB4F1"
ItemType: 3
CellSizeX: 0
CellSizeY: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5479f075b6cda4949a55b4f1e2cb6dd1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -11,9 +11,11 @@
using System.Linq;
using JetBrains.Annotations;
using Sirenix.OdinInspector;
using Unity.VisualScripting;
using UnityEditor;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using ColorUtility = UnityEngine.ColorUtility;
public class GoogleSheetManager : Singleton<GoogleSheetManager>
{
@ -25,6 +27,10 @@ public class GoogleSheetManager : Singleton<GoogleSheetManager>
[SerializeField, Tooltip("구글 시트 -> 확장 프로그램 -> Apps Script -> 새 배포(웹 앱) or 배포 관리 -> 웹 앱 URL(~~~/exec)")]
private string _googleSheetUrl;
[BoxGroup("기본 설정")]
[SerializeField, Tooltip("기본 네임 스페이스")]
private string _namespace = "DDD";
[BoxGroup("기본 설정")]
[SerializeField, Tooltip("적용시킬 시트의 이름을 적고, 여러 개의 시트를 적는 경우 '/'로 구분지어 시트 나열\nex) \"Sheet1/Sheet2\"")]
private string _availSheets = "Sheet1/Sheet2";
@ -363,7 +369,9 @@ private void GenerateClassFilesPerSheet(string jsonInput)
string enumType = null;
if (rawName.EndsWith("_Enum"))
{
enumType = rawName.Contains(":") ? rawName.Split(':')[1].Replace("_Enum", "") : rawName.Replace("_Enum", "");
enumType = rawName.Contains(":")
? rawName.Split(':')[1].Replace("_Enum", "")
: rawName.Replace("_Enum", "");
}
if (!string.IsNullOrEmpty(enumType))
@ -400,7 +408,7 @@ private void GenerateClassFilesPerSheet(string jsonInput)
File.WriteAllText($"{BaseAssetPath}/EnumTypes.cs", enumCode.ToString());
AssetDatabase.ImportAsset($"{BaseAssetPath}/EnumTypes.cs");
if (!Directory.Exists(ClassedFullPath))
{
Directory.CreateDirectory(ClassedFullPath);
@ -436,9 +444,11 @@ private string GenerateSoClassCode(string className)
$"// <auto-generated> File: {className}So.cs\n" +
"using System.Collections.Generic;\n" +
"using UnityEngine;\n\n" +
$"[CreateAssetMenu(fileName = \"{className}So\", menuName = \"GoogleSheet/{className}So\")]\n" +
$"public class {className}So : ScriptableObject \n" +
$"{{\n public List<{className}> {className}List;\n}}\n";
$"namespace {_namespace}\n" +
"{\n" +
$" [CreateAssetMenu(fileName = \"{className}So\", menuName = \"GoogleSheet/{className}So\")]\n" +
$" public class {className}So : ScriptableObject \n" +
$" {{\n public List<{className}> {className}List;\n }}\n}}\n";
}
private string GenerateDataClassCode(string className, JArray items)
@ -450,9 +460,11 @@ private string GenerateDataClassCode(string className, JArray items)
sb.AppendLine("// <auto-generated>");
sb.AppendLine("using System;");
sb.AppendLine("using UnityEngine;");
sb.AppendLine("[Serializable]");
sb.AppendLine($"public class {className} \n{{");
sb.AppendLine($"namespace {_namespace}");
sb.AppendLine("{");
sb.AppendLine(" [Serializable]");
sb.AppendLine($" public class {className}");
sb.AppendLine(" {");
int count = sampleRow.Properties().Count();
string[] types = new string[count];
@ -492,13 +504,14 @@ private string GenerateDataClassCode(string className, JArray items)
{
if (!string.IsNullOrWhiteSpace(tooltips[i]))
{
sb.AppendLine($" /// <summary>{tooltips[i]}</summary>");
sb.AppendLine($" [Tooltip(\"{tooltips[i]}\")]");
sb.AppendLine($" /// <summary>{tooltips[i]}</summary>");
sb.AppendLine($" [Tooltip(\"{tooltips[i]}\")]");
}
sb.AppendLine($" public {types[i]} {names[i]};\n");
sb.AppendLine($" public {types[i]} {names[i]};\n");
}
sb.AppendLine(" }");
sb.AppendLine("}");
return sb.ToString();
}
@ -546,7 +559,7 @@ private async Task<bool> CreateGoogleSheetSoAsync()
{
_isCreatingSo = false;
}
#if UNITY_EDITOR
if (result) // 성공적으로 SO 생성된 경우에만 빌드 수행
{
@ -557,7 +570,7 @@ private async Task<bool> CreateGoogleSheetSoAsync()
return result;
}
private async Task<bool> InternalCreateGoogleSheetSoAsync()
{
JObject jsonObject = JObject.Parse(_json);
@ -691,7 +704,9 @@ private async Task<bool> InternalCreateGoogleSheetSoAsync()
// ✅ Color 처리
else if (field.FieldType == typeof(Color))
{
value = ColorUtility.TryParseHtmlString(prop.Value.ToString(), out var color) ? color : Color.white;
value = ColorUtility.TryParseHtmlString(prop.Value.ToString(), out var color)
? color
: Color.white;
}
// ✅ 기본 타입 처리
else
@ -754,7 +769,7 @@ private Type FindTypeByName(string sheetName)
{
return AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(a => a.GetTypes())
.FirstOrDefault(t => t.Name == sheetName);
.FirstOrDefault(t => t.Namespace == "DDD" && t.Name == sheetName);
}
private string NormalizeEnumKey(string input)