구글 시트 연동 기능 확장4
This commit is contained in:
parent
ec664526c6
commit
24e2244178
@ -13,4 +13,5 @@ MonoBehaviour:
|
||||
m_Name: AddressableAssetGroupSortSettings
|
||||
m_EditorClassIdentifier:
|
||||
sortOrder:
|
||||
- 30e7f67fe9aaa7849a34c9b6e2bc53ae
|
||||
- 7fe0c33d351391a45a0ea3c93ecef42e
|
||||
|
@ -12,7 +12,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 468a46d0ae32c3544b7d98094e6448a9, type: 3}
|
||||
m_Name: AddressableAssetSettings
|
||||
m_EditorClassIdentifier:
|
||||
m_DefaultGroup: 929eb052721483043b12b85e5d4bdc84
|
||||
m_DefaultGroup: 30e7f67fe9aaa7849a34c9b6e2bc53ae
|
||||
m_currentHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
@ -59,6 +59,7 @@ MonoBehaviour:
|
||||
m_BuildAddressablesWithPlayerBuild: 0
|
||||
m_overridePlayerVersion: '[UnityEditor.PlayerSettings.bundleVersion]'
|
||||
m_GroupAssets:
|
||||
- {fileID: 11400000, guid: 5329bd0c1faf253408343429c6a99b39, type: 2}
|
||||
- {fileID: 11400000, guid: 5b7b9bd594e863849bf5e512f59ba0fc, type: 2}
|
||||
m_BuildSettings:
|
||||
m_LogResourceManagerExceptions: 1
|
||||
@ -100,6 +101,7 @@ MonoBehaviour:
|
||||
m_LabelNames:
|
||||
- default
|
||||
- GoogleSheetSo
|
||||
- GoogleSheetSprite
|
||||
m_SchemaTemplates: []
|
||||
m_GroupTemplateObjects:
|
||||
- {fileID: 11400000, guid: f804fe78e7005554f9ba60273aade35b, type: 2}
|
||||
|
@ -0,0 +1,29 @@
|
||||
%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: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
|
||||
m_Name: GoogleSheetSprite_Group
|
||||
m_EditorClassIdentifier:
|
||||
m_GroupName: GoogleSheetSprite_Group
|
||||
m_GUID: 30e7f67fe9aaa7849a34c9b6e2bc53ae
|
||||
m_SerializeEntries:
|
||||
- m_GUID: e15933f76da90e742866563b5cd9e45f
|
||||
m_Address: Gold
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels:
|
||||
- GoogleSheetSprite
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
m_ReadOnly: 0
|
||||
m_Settings: {fileID: 11400000, guid: d12ffbb6f886d48418efb0b6d15ccb88, type: 2}
|
||||
m_SchemaSet:
|
||||
m_Schemas:
|
||||
- {fileID: 11400000, guid: 7e7c84ad73aefe14a8fe3acef1a1ef70, type: 2}
|
||||
- {fileID: 11400000, guid: 446e71e39fbb9cc41bd76f6e78ea5347, type: 2}
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5329bd0c1faf253408343429c6a99b39
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,47 @@
|
||||
%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: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||
m_Name: GoogleSheetSprite_Group_BundledAssetGroupSchema
|
||||
m_EditorClassIdentifier:
|
||||
m_Group: {fileID: 11400000, guid: 5329bd0c1faf253408343429c6a99b39, type: 2}
|
||||
m_InternalBundleIdMode: 1
|
||||
m_Compression: 1
|
||||
m_IncludeAddressInCatalog: 1
|
||||
m_IncludeGUIDInCatalog: 1
|
||||
m_IncludeLabelsInCatalog: 1
|
||||
m_InternalIdNamingMode: 0
|
||||
m_CacheClearBehavior: 0
|
||||
m_IncludeInBuild: 1
|
||||
m_BundledAssetProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
|
||||
m_ForceUniqueProvider: 0
|
||||
m_UseAssetBundleCache: 1
|
||||
m_UseAssetBundleCrc: 1
|
||||
m_UseAssetBundleCrcForCachedBundles: 1
|
||||
m_UseUWRForLocalBundles: 0
|
||||
m_Timeout: 0
|
||||
m_ChunkedTransfer: 0
|
||||
m_RedirectLimit: -1
|
||||
m_RetryCount: 0
|
||||
m_BuildPath:
|
||||
m_Id: 30b8e03fd76b09f46850a05b2650884d
|
||||
m_LoadPath:
|
||||
m_Id: 7852182deca226a488adf0342a6f6c9a
|
||||
m_BundleMode: 0
|
||||
m_AssetBundleProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
|
||||
m_UseDefaultSchemaSettings: 0
|
||||
m_SelectedPathPairIndex: 0
|
||||
m_BundleNaming: 0
|
||||
m_AssetLoadMode: 0
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e7c84ad73aefe14a8fe3acef1a1ef70
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,16 @@
|
||||
%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: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
|
||||
m_Name: GoogleSheetSprite_Group_ContentUpdateGroupSchema
|
||||
m_EditorClassIdentifier:
|
||||
m_Group: {fileID: 11400000, guid: 5329bd0c1faf253408343429c6a99b39, type: 2}
|
||||
m_StaticContent: 0
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 446e71e39fbb9cc41bd76f6e78ea5347
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -285,12 +285,12 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 2631101f894592945a1c50aed7048e66, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_persistent: 1
|
||||
_persistent: 0
|
||||
_isAccessGoogleSheet: 1
|
||||
_googleSheetUrl: https://script.google.com/macros/s/AKfycbw8TRSl_OuY2S-RX0yvOJi1SqNqoflG0R3pWxk9GC9u_wvGQeuABZc0VH7YJ5lMrAl4/exec
|
||||
_availSheets: Food/Monster
|
||||
_generateFolderPath: /_Datas/02.Scripts/GenerateGoogleSheet/AutoCreated
|
||||
_lastUpdated: "1 - 2025-05-13 03:29:57 by \uACE0\uC131\uC9C4"
|
||||
_currentVersion: "0 - 2025-05-13 15:02:17 by \uB0A8\uD0DC\uAC74"
|
||||
_restoreIndex: 0
|
||||
_editorName:
|
||||
_refreshTrigger: 1
|
||||
@ -302,7 +302,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 383092896}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
|
26
Assets/_Datas/02.Scripts/AddressableManager.cs
Normal file
26
Assets/_Datas/02.Scripts/AddressableManager.cs
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
using System.Linq;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor.AddressableAssets;
|
||||
#endif
|
||||
|
||||
public class AddressableManager : Singleton<AddressableManager>
|
||||
{
|
||||
public static bool HasLabel(string addressKey, string label)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
||||
if (settings == null) return false;
|
||||
|
||||
var entry = settings.groups
|
||||
.SelectMany(g => g.entries)
|
||||
.FirstOrDefault(e => e.address == addressKey);
|
||||
|
||||
if (entry == null) return false;
|
||||
|
||||
return entry.labels.Contains(label);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
2
Assets/_Datas/02.Scripts/AddressableManager.cs.meta
Normal file
2
Assets/_Datas/02.Scripts/AddressableManager.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85a4615ed6971ef4aa78a1b01d8a8be3
|
@ -1,76 +0,0 @@
|
||||
{
|
||||
"$개요": [
|
||||
{
|
||||
"": "시트 생성"
|
||||
}
|
||||
],
|
||||
"Food": [
|
||||
{
|
||||
"Id": "식별ID",
|
||||
"Name": "이름",
|
||||
"Ingredient1": "재료1",
|
||||
"Ingredient2": "재료2",
|
||||
"Taste1:Taste_Enum": "맛1",
|
||||
"Taste2:Taste_Enum": "맛2"
|
||||
},
|
||||
{
|
||||
"Id": "Food001",
|
||||
"Name": "햇빛수프",
|
||||
"Ingredient1": "극락쌀",
|
||||
"Ingredient2": "햇빛당근",
|
||||
"Taste1:Taste_Enum": "Bitter",
|
||||
"Taste2:Taste_Enum": "Sweet"
|
||||
},
|
||||
{
|
||||
"Id": "Food002",
|
||||
"Name": "B",
|
||||
"Ingredient1": 1,
|
||||
"Ingredient2": 11,
|
||||
"Taste1:Taste_Enum": "Spicy",
|
||||
"Taste2:Taste_Enum": "Bitter"
|
||||
},
|
||||
{
|
||||
"Id": "Food003",
|
||||
"Name": "C",
|
||||
"Ingredient1": 2,
|
||||
"Ingredient2": 22,
|
||||
"Taste1:Taste_Enum": "Fresh",
|
||||
"Taste2:Taste_Enum": "None"
|
||||
},
|
||||
{
|
||||
"Id": "Food004",
|
||||
"Name": "D",
|
||||
"Ingredient1": 3,
|
||||
"Ingredient2": 33,
|
||||
"Taste1:Taste_Enum": "Sour",
|
||||
"Taste2:Taste_Enum": "Salty"
|
||||
}
|
||||
],
|
||||
"Monster": [
|
||||
{
|
||||
"Id": "식별번호",
|
||||
"Name": "이름",
|
||||
"T1": "테스트1"
|
||||
},
|
||||
{
|
||||
"Id": "Test001",
|
||||
"Name": "A",
|
||||
"T1": 1
|
||||
},
|
||||
{
|
||||
"Id": "Test002",
|
||||
"Name": "B",
|
||||
"T1": 2
|
||||
},
|
||||
{
|
||||
"Id": "Test003",
|
||||
"Name": "C",
|
||||
"T1": 3
|
||||
},
|
||||
{
|
||||
"Id": "Test004",
|
||||
"Name": "D",
|
||||
"T1": 4
|
||||
}
|
||||
]
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
{
|
||||
"$개요": [
|
||||
{
|
||||
"": "시트 생성"
|
||||
}
|
||||
],
|
||||
"Food": [
|
||||
{
|
||||
"Id": "식별ID",
|
||||
"Name": "이름",
|
||||
"Ingredient1": "재료1",
|
||||
"Ingredient2": "재료2",
|
||||
"Taste1:Taste_Enum": "맛1",
|
||||
"Taste2:Taste_Enum": "맛2"
|
||||
},
|
||||
{
|
||||
"Id": "Food001",
|
||||
"Name": "햇빛수프",
|
||||
"Ingredient1": "극락쌀",
|
||||
"Ingredient2": "햇빛당근",
|
||||
"Taste1:Taste_Enum": "Bitter",
|
||||
"Taste2:Taste_Enum": "Sweet"
|
||||
},
|
||||
{
|
||||
"Id": "Food002",
|
||||
"Name": "B",
|
||||
"Ingredient1": 1,
|
||||
"Ingredient2": 4,
|
||||
"Taste1:Taste_Enum": "Spicy",
|
||||
"Taste2:Taste_Enum": "Bitter"
|
||||
},
|
||||
{
|
||||
"Id": "Food003",
|
||||
"Name": "C",
|
||||
"Ingredient1": 2,
|
||||
"Ingredient2": 5,
|
||||
"Taste1:Taste_Enum": "Fresh",
|
||||
"Taste2:Taste_Enum": "None"
|
||||
},
|
||||
{
|
||||
"Id": "Food004",
|
||||
"Name": "D",
|
||||
"Ingredient1": 3,
|
||||
"Ingredient2": 6,
|
||||
"Taste1:Taste_Enum": "Sour",
|
||||
"Taste2:Taste_Enum": "Salty"
|
||||
}
|
||||
],
|
||||
"Monster": [
|
||||
{
|
||||
"Id": "식별번호",
|
||||
"Name": "이름",
|
||||
"T1": "테스트1"
|
||||
},
|
||||
{
|
||||
"Id": "Test001",
|
||||
"Name": "A",
|
||||
"T1": 1
|
||||
},
|
||||
{
|
||||
"Id": "Test002",
|
||||
"Name": "B",
|
||||
"T1": 2
|
||||
},
|
||||
{
|
||||
"Id": "Test003",
|
||||
"Name": "C",
|
||||
"T1": 3
|
||||
},
|
||||
{
|
||||
"Id": "Test004",
|
||||
"Name": "D",
|
||||
"T1": 4
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
{
|
||||
"$개요": [
|
||||
{
|
||||
"": "시트 생성"
|
||||
}
|
||||
],
|
||||
"Food": [
|
||||
{
|
||||
"Id:string": "식별ID",
|
||||
"Name:string": "이름",
|
||||
"Ingredient1:string": "재료1",
|
||||
"Ingredient2:string": "재료2",
|
||||
"Taste1:Taste_Enum": "맛1",
|
||||
"Taste2:Taste_Enum": "맛2",
|
||||
"Sprite:Sprite": "Addressable 이미지 이름"
|
||||
},
|
||||
{
|
||||
"Id:string": "Food001",
|
||||
"Name:string": "햇빛수프",
|
||||
"Ingredient1:string": "극락쌀",
|
||||
"Ingredient2:string": "햇빛당근",
|
||||
"Taste1:Taste_Enum": "Bitter",
|
||||
"Taste2:Taste_Enum": "Sweet",
|
||||
"Sprite:Sprite": "Gold"
|
||||
},
|
||||
{
|
||||
"Id:string": "Food002",
|
||||
"Name:string": "B",
|
||||
"Ingredient1:string": 1,
|
||||
"Ingredient2:string": 4,
|
||||
"Taste1:Taste_Enum": "Spicy",
|
||||
"Taste2:Taste_Enum": "Bitter",
|
||||
"Sprite:Sprite": ""
|
||||
},
|
||||
{
|
||||
"Id:string": "Food003",
|
||||
"Name:string": "C",
|
||||
"Ingredient1:string": 2,
|
||||
"Ingredient2:string": 5,
|
||||
"Taste1:Taste_Enum": "Fresh",
|
||||
"Taste2:Taste_Enum": "None",
|
||||
"Sprite:Sprite": ""
|
||||
},
|
||||
{
|
||||
"Id:string": "Food004",
|
||||
"Name:string": "D",
|
||||
"Ingredient1:string": 3,
|
||||
"Ingredient2:string": 6,
|
||||
"Taste1:Taste_Enum": "Sour",
|
||||
"Taste2:Taste_Enum": "Salty",
|
||||
"Sprite:Sprite": ""
|
||||
}
|
||||
],
|
||||
"Monster": [
|
||||
{
|
||||
"Id": "식별번호",
|
||||
"Name": "이름",
|
||||
"T1": "테스트1"
|
||||
},
|
||||
{
|
||||
"Id": "Test001",
|
||||
"Name": "A",
|
||||
"T1": 1
|
||||
},
|
||||
{
|
||||
"Id": "Test002",
|
||||
"Name": "B",
|
||||
"T1": 2
|
||||
},
|
||||
{
|
||||
"Id": "Test003",
|
||||
"Name": "C",
|
||||
"T1": 3
|
||||
},
|
||||
{
|
||||
"Id": "Test004",
|
||||
"Name": "D",
|
||||
"T1": 4
|
||||
}
|
||||
]
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59c0671301dbb8f4b8929bc354d0d52c
|
||||
guid: 1cf6b1e28051e1f418882d448a258c13
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
@ -28,4 +28,8 @@ public class Food
|
||||
[Tooltip("맛2")]
|
||||
public Taste Taste2;
|
||||
|
||||
/// <summary>Addressable 이미지 이름</summary>
|
||||
[Tooltip("Addressable 이미지 이름")]
|
||||
public Sprite Sprite;
|
||||
|
||||
}
|
||||
|
@ -6,44 +6,49 @@
|
||||
],
|
||||
"Food": [
|
||||
{
|
||||
"Id": "식별ID",
|
||||
"Name": "이름",
|
||||
"Ingredient1": "재료1",
|
||||
"Ingredient2": "재료2",
|
||||
"Id:string": "식별ID",
|
||||
"Name:string": "이름",
|
||||
"Ingredient1:string": "재료1",
|
||||
"Ingredient2:string": "재료2",
|
||||
"Taste1:Taste_Enum": "맛1",
|
||||
"Taste2:Taste_Enum": "맛2"
|
||||
"Taste2:Taste_Enum": "맛2",
|
||||
"Sprite:Sprite": "Addressable 이미지 이름"
|
||||
},
|
||||
{
|
||||
"Id": "Food001",
|
||||
"Name": "햇빛수프",
|
||||
"Ingredient1": "극락쌀",
|
||||
"Ingredient2": "햇빛당근",
|
||||
"Id:string": "Food001",
|
||||
"Name:string": "햇빛수프",
|
||||
"Ingredient1:string": "극락쌀",
|
||||
"Ingredient2:string": "햇빛당근",
|
||||
"Taste1:Taste_Enum": "Bitter",
|
||||
"Taste2:Taste_Enum": "Sweet"
|
||||
"Taste2:Taste_Enum": "Sweet",
|
||||
"Sprite:Sprite": "Gold"
|
||||
},
|
||||
{
|
||||
"Id": "Food002",
|
||||
"Name": "B",
|
||||
"Ingredient1": 1,
|
||||
"Ingredient2": 4,
|
||||
"Id:string": "Food002",
|
||||
"Name:string": "B",
|
||||
"Ingredient1:string": 1,
|
||||
"Ingredient2:string": 4,
|
||||
"Taste1:Taste_Enum": "Spicy",
|
||||
"Taste2:Taste_Enum": "Bitter"
|
||||
"Taste2:Taste_Enum": "Bitter",
|
||||
"Sprite:Sprite": ""
|
||||
},
|
||||
{
|
||||
"Id": "Food003",
|
||||
"Name": "C",
|
||||
"Ingredient1": 2,
|
||||
"Ingredient2": 5,
|
||||
"Id:string": "Food003",
|
||||
"Name:string": "C",
|
||||
"Ingredient1:string": 2,
|
||||
"Ingredient2:string": 5,
|
||||
"Taste1:Taste_Enum": "Fresh",
|
||||
"Taste2:Taste_Enum": "None"
|
||||
"Taste2:Taste_Enum": "None",
|
||||
"Sprite:Sprite": ""
|
||||
},
|
||||
{
|
||||
"Id": "Food004",
|
||||
"Name": "D",
|
||||
"Ingredient1": 3,
|
||||
"Ingredient2": 6,
|
||||
"Id:string": "Food004",
|
||||
"Name:string": "D",
|
||||
"Ingredient1:string": 3,
|
||||
"Ingredient2:string": 6,
|
||||
"Taste1:Taste_Enum": "Sour",
|
||||
"Taste2:Taste_Enum": "Salty"
|
||||
"Taste2:Taste_Enum": "Salty",
|
||||
"Sprite:Sprite": ""
|
||||
}
|
||||
],
|
||||
"Monster": [
|
||||
|
@ -14,49 +14,30 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
_logs:
|
||||
- Editor: "\uB0A8\uD0DC\uAC74"
|
||||
Timestamp: 2025-05-13 03:29:27
|
||||
Timestamp: 2025-05-13 15:02:17
|
||||
JsonSnapshot: "{\n \"$\uAC1C\uC694\": [\n {\n \"\": \"\uC2DC\uD2B8 \uC0DD\uC131\"\n
|
||||
}\n ],\n \"Food\": [\n {\n \"Id\": \"\uC2DD\uBCC4ID\",\n \"Name\":
|
||||
\"\uC774\uB984\",\n \"Ingredient1\": \"\uC7AC\uB8CC1\",\n \"Ingredient2\":
|
||||
\"\uC7AC\uB8CC2\",\n \"Taste1:Taste_Enum\": \"\uB9DB1\",\n \"Taste2:Taste_Enum\":
|
||||
\"\uB9DB2\"\n },\n {\n \"Id\": \"Food001\",\n \"Name\": \"\uD587\uBE5B\uC218\uD504\",\n
|
||||
\"Ingredient1\": \"\uADF9\uB77D\uC300\",\n \"Ingredient2\": \"\uD587\uBE5B\uB2F9\uADFC\",\n
|
||||
\"Taste1:Taste_Enum\": \"Bitter\",\n \"Taste2:Taste_Enum\": \"Sweet\"\n
|
||||
},\n {\n \"Id\": \"Food002\",\n \"Name\": \"B\",\n \"Ingredient1\":
|
||||
1,\n \"Ingredient2\": 11,\n \"Taste1:Taste_Enum\": \"Spicy\",\n
|
||||
\"Taste2:Taste_Enum\": \"Bitter\"\n },\n {\n \"Id\": \"Food003\",\n
|
||||
\"Name\": \"C\",\n \"Ingredient1\": 2,\n \"Ingredient2\": 22,\n
|
||||
\"Taste1:Taste_Enum\": \"Fresh\",\n \"Taste2:Taste_Enum\": \"None\"\n
|
||||
},\n {\n \"Id\": \"Food004\",\n \"Name\": \"D\",\n \"Ingredient1\":
|
||||
3,\n \"Ingredient2\": 33,\n \"Taste1:Taste_Enum\": \"Sour\",\n
|
||||
\"Taste2:Taste_Enum\": \"Salty\"\n }\n ],\n \"Monster\": [\n {\n
|
||||
\"Id\": \"\uC2DD\uBCC4\uBC88\uD638\",\n \"Name\": \"\uC774\uB984\",\n
|
||||
\"T1\": \"\uD14C\uC2A4\uD2B81\"\n },\n {\n \"Id\": \"Test001\",\n
|
||||
\"Name\": \"A\",\n \"T1\": 1\n },\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}"
|
||||
- Editor: "\uACE0\uC131\uC9C4"
|
||||
Timestamp: 2025-05-13 03:29:57
|
||||
JsonSnapshot: "{\n \"$\uAC1C\uC694\": [\n {\n \"\": \"\uC2DC\uD2B8 \uC0DD\uC131\"\n
|
||||
}\n ],\n \"Food\": [\n {\n \"Id\": \"\uC2DD\uBCC4ID\",\n \"Name\":
|
||||
\"\uC774\uB984\",\n \"Ingredient1\": \"\uC7AC\uB8CC1\",\n \"Ingredient2\":
|
||||
\"\uC7AC\uB8CC2\",\n \"Taste1:Taste_Enum\": \"\uB9DB1\",\n \"Taste2:Taste_Enum\":
|
||||
\"\uB9DB2\"\n },\n {\n \"Id\": \"Food001\",\n \"Name\": \"\uD587\uBE5B\uC218\uD504\",\n
|
||||
\"Ingredient1\": \"\uADF9\uB77D\uC300\",\n \"Ingredient2\": \"\uD587\uBE5B\uB2F9\uADFC\",\n
|
||||
\"Taste1:Taste_Enum\": \"Bitter\",\n \"Taste2:Taste_Enum\": \"Sweet\"\n
|
||||
},\n {\n \"Id\": \"Food002\",\n \"Name\": \"B\",\n \"Ingredient1\":
|
||||
1,\n \"Ingredient2\": 4,\n \"Taste1:Taste_Enum\": \"Spicy\",\n
|
||||
\"Taste2:Taste_Enum\": \"Bitter\"\n },\n {\n \"Id\": \"Food003\",\n
|
||||
\"Name\": \"C\",\n \"Ingredient1\": 2,\n \"Ingredient2\": 5,\n
|
||||
\"Taste1:Taste_Enum\": \"Fresh\",\n \"Taste2:Taste_Enum\": \"None\"\n
|
||||
},\n {\n \"Id\": \"Food004\",\n \"Name\": \"D\",\n \"Ingredient1\":
|
||||
3,\n \"Ingredient2\": 6,\n \"Taste1:Taste_Enum\": \"Sour\",\n
|
||||
\"Taste2:Taste_Enum\": \"Salty\"\n }\n ],\n \"Monster\": [\n {\n
|
||||
\"Id\": \"\uC2DD\uBCC4\uBC88\uD638\",\n \"Name\": \"\uC774\uB984\",\n
|
||||
\"T1\": \"\uD14C\uC2A4\uD2B81\"\n },\n {\n \"Id\": \"Test001\",\n
|
||||
\"Name\": \"A\",\n \"T1\": 1\n },\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}"
|
||||
}\n ],\n \"Food\": [\n {\n \"Id:string\": \"\uC2DD\uBCC4ID\",\n
|
||||
\"Name:string\": \"\uC774\uB984\",\n \"Ingredient1:string\": \"\uC7AC\uB8CC1\",\n
|
||||
\"Ingredient2:string\": \"\uC7AC\uB8CC2\",\n \"Taste1:Taste_Enum\": \"\uB9DB1\",\n
|
||||
\"Taste2:Taste_Enum\": \"\uB9DB2\",\n \"Sprite:Sprite\": \"Addressable
|
||||
\uC774\uBBF8\uC9C0 \uC774\uB984\"\n },\n {\n \"Id:string\": \"Food001\",\n
|
||||
\"Name:string\": \"\uD587\uBE5B\uC218\uD504\",\n \"Ingredient1:string\":
|
||||
\"\uADF9\uB77D\uC300\",\n \"Ingredient2:string\": \"\uD587\uBE5B\uB2F9\uADFC\",\n
|
||||
\"Taste1:Taste_Enum\": \"Bitter\",\n \"Taste2:Taste_Enum\": \"Sweet\",\n
|
||||
\"Sprite:Sprite\": \"Gold\"\n },\n {\n \"Id:string\": \"Food002\",\n
|
||||
\"Name:string\": \"B\",\n \"Ingredient1:string\": 1,\n \"Ingredient2:string\":
|
||||
4,\n \"Taste1:Taste_Enum\": \"Spicy\",\n \"Taste2:Taste_Enum\": \"Bitter\",\n
|
||||
\"Sprite:Sprite\": \"\"\n },\n {\n \"Id:string\": \"Food003\",\n
|
||||
\"Name:string\": \"C\",\n \"Ingredient1:string\": 2,\n \"Ingredient2:string\":
|
||||
5,\n \"Taste1:Taste_Enum\": \"Fresh\",\n \"Taste2:Taste_Enum\": \"None\",\n
|
||||
\"Sprite:Sprite\": \"\"\n },\n {\n \"Id:string\": \"Food004\",\n
|
||||
\"Name:string\": \"D\",\n \"Ingredient1:string\": 3,\n \"Ingredient2:string\":
|
||||
6,\n \"Taste1:Taste_Enum\": \"Sour\",\n \"Taste2:Taste_Enum\": \"Salty\",\n
|
||||
\"Sprite:Sprite\": \"\"\n }\n ],\n \"Monster\": [\n {\n \"Id\":
|
||||
\"\uC2DD\uBCC4\uBC88\uD638\",\n \"Name\": \"\uC774\uB984\",\n \"T1\":
|
||||
\"\uD14C\uC2A4\uD2B81\"\n },\n {\n \"Id\": \"Test001\",\n \"Name\":
|
||||
\"A\",\n \"T1\": 1\n },\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}"
|
||||
MaxLogs: 100
|
||||
|
@ -19,21 +19,25 @@ MonoBehaviour:
|
||||
Ingredient2: "\uD587\uBE5B\uB2F9\uADFC"
|
||||
Taste1: 1
|
||||
Taste2: 2
|
||||
Sprite: {fileID: 21300000, guid: e15933f76da90e742866563b5cd9e45f, type: 3}
|
||||
- Id: Food002
|
||||
Name: B
|
||||
Ingredient1: 1
|
||||
Ingredient2: 4
|
||||
Taste1: 3
|
||||
Taste2: 1
|
||||
Sprite: {fileID: 0}
|
||||
- Id: Food003
|
||||
Name: C
|
||||
Ingredient1: 2
|
||||
Ingredient2: 5
|
||||
Taste1: 4
|
||||
Taste2: 0
|
||||
Sprite: {fileID: 0}
|
||||
- Id: Food004
|
||||
Name: D
|
||||
Ingredient1: 3
|
||||
Ingredient2: 6
|
||||
Taste1: 5
|
||||
Taste2: 6
|
||||
Sprite: {fileID: 0}
|
||||
|
@ -33,8 +33,8 @@ public class GoogleSheetManager : Singleton<GoogleSheetManager>
|
||||
private string _generateFolderPath = "/_Datas/02.Scripts/GenerateGoogleSheet/AutoCreated";
|
||||
|
||||
[Title("버전 복구"), BoxGroup("버전 복구")]
|
||||
[SerializeField, Tooltip("마지막 업데이트 시간"), ReadOnly]
|
||||
private string _lastUpdated;
|
||||
[SerializeField, Tooltip("현재 사용중인 버전"), ReadOnly]
|
||||
private string _currentVersion;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[BoxGroup("버전 복구")]
|
||||
@ -46,18 +46,19 @@ public class GoogleSheetManager : Singleton<GoogleSheetManager>
|
||||
[SerializeField, Required("반드시 수정자 이름을 입력해야 합니다\n이력을 남길 때 표시될 사용자 이름입니다.")]
|
||||
private string _editorName;
|
||||
|
||||
private string _baseFullPath => $"{Application.dataPath}{_generateFolderPath}";
|
||||
private string _baseAssetPath => $"Assets{_generateFolderPath}";
|
||||
private string BaseFullPath => $"{Application.dataPath}{_generateFolderPath}";
|
||||
private string BaseAssetPath => $"Assets{_generateFolderPath}";
|
||||
|
||||
private string _jsonFullPath => $"{_baseFullPath}/GoogleSheetJson.json";
|
||||
private string _changeLogAssetPath => $"{_baseAssetPath}/Logs/GoogleSheetChangeLog.asset";
|
||||
private string _backupFullPath => $"{_baseFullPath}/BackUps";
|
||||
private string JsonFullPath => $"{BaseFullPath}/GoogleSheetJson.json";
|
||||
private string ChangeLogAssetPath => $"{BaseAssetPath}/Logs/GoogleSheetChangeLog.asset";
|
||||
private string BackupFullPath => $"{BaseFullPath}/BackUps";
|
||||
|
||||
private string[] _availSheetArray;
|
||||
private string _json;
|
||||
|
||||
[SerializeField, ReadOnly]
|
||||
private bool _refreshTrigger;
|
||||
|
||||
private bool _alreadyCreatedSo;
|
||||
|
||||
public static async Task<T> LoadSo<T>() where T : ScriptableObject
|
||||
@ -82,7 +83,7 @@ private async void FetchGoogleSheet()
|
||||
{
|
||||
_availSheetArray = _availSheets.Split('/');
|
||||
|
||||
var prevLog = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(_changeLogAssetPath);
|
||||
var prevLog = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(ChangeLogAssetPath);
|
||||
string previousJson = prevLog?.Logs.LastOrDefault()?.JsonSnapshot ?? "";
|
||||
|
||||
if (_isAccessGoogleSheet)
|
||||
@ -112,11 +113,9 @@ private async void FetchGoogleSheet()
|
||||
if (diffs.Count > 0)
|
||||
GoogleSheetDiffViewer.ShowWindow(diffs);
|
||||
|
||||
bool isJsonSaved = SaveFileOrSkip(_jsonFullPath, _json);
|
||||
bool isJsonSaved = SaveFileOrSkip(JsonFullPath, _json);
|
||||
GenerateClassFilesPerSheet(_json);
|
||||
|
||||
_lastUpdated = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
if (isJsonSaved)
|
||||
{
|
||||
_refreshTrigger = true;
|
||||
@ -136,18 +135,18 @@ private bool CanFetchData()
|
||||
/// </summary>
|
||||
private void SaveChangeLog(string json)
|
||||
{
|
||||
string logsDirectory = Path.GetDirectoryName(_changeLogAssetPath);
|
||||
string logsDirectory = Path.GetDirectoryName(ChangeLogAssetPath);
|
||||
if (!Directory.Exists(logsDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(logsDirectory);
|
||||
AssetDatabase.ImportAsset(logsDirectory);
|
||||
}
|
||||
|
||||
var log = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(_changeLogAssetPath);
|
||||
var log = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(ChangeLogAssetPath);
|
||||
if (log == null)
|
||||
{
|
||||
log = ScriptableObject.CreateInstance<GoogleSheetChangeLog>();
|
||||
AssetDatabase.CreateAsset(log, _changeLogAssetPath);
|
||||
AssetDatabase.CreateAsset(log, ChangeLogAssetPath);
|
||||
}
|
||||
|
||||
string previousJson = log.Logs.Count > 0 ? log.Logs[^1].JsonSnapshot : null;
|
||||
@ -162,7 +161,7 @@ private void SaveChangeLog(string json)
|
||||
string saveTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
string versionLabel = $"{log.Logs.Count} - {saveTime} by {_editorName}";
|
||||
|
||||
_lastUpdated = versionLabel;
|
||||
_currentVersion = versionLabel;
|
||||
log.Logs.Add(new GoogleSheetChangeLog.LogEntry
|
||||
{
|
||||
Editor = _editorName,
|
||||
@ -183,11 +182,11 @@ private void SaveJsonBackup(string json, string saveTime)
|
||||
{
|
||||
string safeSaveTime = saveTime.Replace(":", "-"); // 윈도우 파일 이름 안전 처리
|
||||
|
||||
if (!Directory.Exists(_backupFullPath))
|
||||
Directory.CreateDirectory(_backupFullPath);
|
||||
if (!Directory.Exists(BackupFullPath))
|
||||
Directory.CreateDirectory(BackupFullPath);
|
||||
|
||||
string fileName = $"{safeSaveTime} by {_editorName}.json";
|
||||
string filePath = Path.Combine(_backupFullPath, fileName);
|
||||
string filePath = Path.Combine(BackupFullPath, fileName);
|
||||
|
||||
File.WriteAllText(filePath, json);
|
||||
}
|
||||
@ -196,7 +195,7 @@ private void SaveJsonBackup(string json, string saveTime)
|
||||
[Button("선택한 버전과 현재 비교")]
|
||||
private void CompareWithSelectedVersion()
|
||||
{
|
||||
var log = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(_changeLogAssetPath);
|
||||
var log = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(ChangeLogAssetPath);
|
||||
if (log == null || _restoreIndex < 0 || _restoreIndex >= log.Logs.Count)
|
||||
{
|
||||
Debug.LogWarning("비교할 수 있는 로그가 없습니다.");
|
||||
@ -204,7 +203,7 @@ private void CompareWithSelectedVersion()
|
||||
}
|
||||
|
||||
string restoreJson = log.Logs[_restoreIndex].JsonSnapshot;
|
||||
string currentJson = File.Exists(_jsonFullPath) ? File.ReadAllText(_jsonFullPath) : "";
|
||||
string currentJson = File.Exists(JsonFullPath) ? File.ReadAllText(JsonFullPath) : "";
|
||||
|
||||
List<GoogleSheetDiff> diffs = GoogleSheetFetchHelper.CompareJsonDiff(currentJson, restoreJson);
|
||||
|
||||
@ -223,7 +222,7 @@ private void CompareWithSelectedVersion()
|
||||
[Button("선택한 버전으로 복구")]
|
||||
private void RestoreSelectedVersion()
|
||||
{
|
||||
var log = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(_changeLogAssetPath);
|
||||
var log = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(ChangeLogAssetPath);
|
||||
if (log == null || _restoreIndex < 0 || _restoreIndex >= log.Logs.Count)
|
||||
{
|
||||
Debug.LogWarning("복원할 수 있는 로그가 없습니다.");
|
||||
@ -231,7 +230,7 @@ private void RestoreSelectedVersion()
|
||||
}
|
||||
|
||||
string restoreJson = log.Logs[_restoreIndex].JsonSnapshot;
|
||||
string currentJson = File.Exists(_jsonFullPath) ? File.ReadAllText(_jsonFullPath) : "";
|
||||
string currentJson = File.Exists(JsonFullPath) ? File.ReadAllText(JsonFullPath) : "";
|
||||
|
||||
List<GoogleSheetDiff> diffs = GoogleSheetFetchHelper.CompareJsonDiff(currentJson, restoreJson);
|
||||
|
||||
@ -241,9 +240,9 @@ private void RestoreSelectedVersion()
|
||||
// 복원 처리
|
||||
_json = restoreJson;
|
||||
|
||||
SaveFileOrSkip(_jsonFullPath, _json);
|
||||
SaveFileOrSkip(JsonFullPath, _json);
|
||||
CreateGoogleSheetSo();
|
||||
_lastUpdated = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
_currentVersion = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Debug.Log($"[{log.Logs[_restoreIndex].Editor}]의 버전으로 복원 완료");
|
||||
}
|
||||
@ -253,7 +252,7 @@ private void RestoreSelectedVersion()
|
||||
/// </summary>
|
||||
private IEnumerable<ValueDropdownItem<int>> GetVersionOptions()
|
||||
{
|
||||
var log = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(_changeLogAssetPath);
|
||||
var log = AssetDatabase.LoadAssetAtPath<GoogleSheetChangeLog>(ChangeLogAssetPath);
|
||||
if (log == null)
|
||||
yield break;
|
||||
|
||||
@ -288,12 +287,12 @@ private async Task<string> LoadDataGoogleSheet(string url)
|
||||
/// </summary>
|
||||
private string LoadDataLocalJson()
|
||||
{
|
||||
if (File.Exists(_jsonFullPath))
|
||||
if (File.Exists(JsonFullPath))
|
||||
{
|
||||
return File.ReadAllText(_jsonFullPath);
|
||||
return File.ReadAllText(JsonFullPath);
|
||||
}
|
||||
|
||||
Debug.Log($"Json 파일이 존재하지 않습니다\n{_jsonFullPath}");
|
||||
Debug.Log($"Json 파일이 존재하지 않습니다\n{JsonFullPath}");
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -335,12 +334,13 @@ private void GenerateClassFilesPerSheet(string jsonInput)
|
||||
JObject jsonObject = JObject.Parse(jsonInput);
|
||||
string basePath = $"Assets{_generateFolderPath}";
|
||||
|
||||
// enum 후보 수집
|
||||
Dictionary<string, HashSet<string>> enumCandidates = new();
|
||||
|
||||
foreach (var jObject in jsonObject)
|
||||
{
|
||||
string className = jObject.Key;
|
||||
if (!IsExistAvailSheets(className)) continue;
|
||||
|
||||
var items = (JArray)jObject.Value;
|
||||
if (items.Count < 2) continue;
|
||||
|
||||
@ -349,17 +349,30 @@ private void GenerateClassFilesPerSheet(string jsonInput)
|
||||
foreach (var property in ((JObject)items[i]).Properties())
|
||||
{
|
||||
string rawName = property.Name;
|
||||
if (!rawName.Contains("_Enum")) continue;
|
||||
|
||||
string[] parts = rawName.Split(':');
|
||||
string enumTypeName =
|
||||
parts.Length > 1 ? parts[1].Replace("_Enum", "") : rawName.Replace("_Enum", "");
|
||||
// ✅ Enum 타입 여부 판단
|
||||
string enumType = null;
|
||||
if (rawName.EndsWith("_Enum"))
|
||||
{
|
||||
if (rawName.Contains(":"))
|
||||
{
|
||||
enumType = rawName.Split(':')[1].Replace("_Enum", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
enumType = rawName.Replace("_Enum", "");
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(enumType))
|
||||
{
|
||||
string enumValue = NormalizeEnumKey(property.Value.ToString());
|
||||
|
||||
if (!enumCandidates.ContainsKey(enumTypeName))
|
||||
enumCandidates[enumTypeName] = new();
|
||||
if (!enumCandidates.ContainsKey(enumType))
|
||||
enumCandidates[enumType] = new();
|
||||
|
||||
enumCandidates[enumTypeName].Add(enumValue);
|
||||
enumCandidates[enumType].Add(enumValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -386,11 +399,12 @@ private void GenerateClassFilesPerSheet(string jsonInput)
|
||||
File.WriteAllText($"{basePath}/EnumTypes.cs", enumCode.ToString());
|
||||
AssetDatabase.ImportAsset($"{basePath}/EnumTypes.cs");
|
||||
|
||||
// 시트별 클래스 파일 생성
|
||||
// 시트별 클래스 생성
|
||||
foreach (var jObject in jsonObject)
|
||||
{
|
||||
string className = jObject.Key;
|
||||
if (!IsExistAvailSheets(className)) continue;
|
||||
|
||||
var items = (JArray)jObject.Value;
|
||||
if (items.Count < 2) continue;
|
||||
|
||||
@ -443,31 +457,25 @@ private string GenerateDataClassCode(string className, JArray items)
|
||||
foreach (var prop in ((JObject)item).Properties())
|
||||
{
|
||||
string rawName = prop.Name;
|
||||
string propType = GetCSharpType(prop.Value.Type);
|
||||
string fieldName, enumName;
|
||||
string fieldName = rawName;
|
||||
string explicitType = null;
|
||||
|
||||
if (rawName.Contains(":") && rawName.EndsWith("_Enum"))
|
||||
if (rawName.Contains(":"))
|
||||
{
|
||||
string[] parts = rawName.Split(':');
|
||||
var parts = rawName.Split(':');
|
||||
fieldName = parts[0];
|
||||
enumName = parts[1].Replace("_Enum", "");
|
||||
types[i] = enumName;
|
||||
names[i] = fieldName;
|
||||
explicitType = parts[1].Replace("_Enum", "");
|
||||
}
|
||||
else if (rawName.EndsWith("_Enum"))
|
||||
{
|
||||
fieldName = rawName.Replace("_Enum", "");
|
||||
enumName = fieldName;
|
||||
types[i] = enumName;
|
||||
names[i] = fieldName;
|
||||
}
|
||||
else
|
||||
{
|
||||
types[i] ??= propType;
|
||||
names[i] ??= rawName;
|
||||
explicitType = fieldName;
|
||||
}
|
||||
|
||||
types[i] = explicitType ?? GetCSharpType(prop.Value.Type);
|
||||
names[i] = fieldName;
|
||||
tooltips[i] ??= commentRow.TryGetValue(rawName, out var tip) ? tip.ToString() : "";
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@ -513,7 +521,6 @@ private bool CreateGoogleSheetSo()
|
||||
if (!IsExistAvailSheets(sheetName))
|
||||
continue;
|
||||
|
||||
// 1. 데이터 클래스 및 SO 클래스 타입 찾기
|
||||
Type dataType = FindTypeByName(sheetName);
|
||||
Type soType = FindTypeByName($"{sheetName}So");
|
||||
|
||||
@ -524,7 +531,6 @@ private bool CreateGoogleSheetSo()
|
||||
continue;
|
||||
}
|
||||
|
||||
// 2. SO 경로 설정 및 불러오기 / 생성
|
||||
string soDirectory = $"Assets{_generateFolderPath}/So";
|
||||
if (!Directory.Exists(soDirectory))
|
||||
{
|
||||
@ -533,20 +539,19 @@ private bool CreateGoogleSheetSo()
|
||||
}
|
||||
|
||||
string soPath = $"{soDirectory}/{sheetName}So.asset";
|
||||
|
||||
ScriptableObject soInstance = AssetDatabase.LoadAssetAtPath<ScriptableObject>(soPath);
|
||||
if (soInstance == null)
|
||||
{
|
||||
soInstance = ScriptableObject.CreateInstance(soType);
|
||||
AssetDatabase.CreateAsset(soInstance, soPath);
|
||||
}
|
||||
|
||||
GoogleSheetAddressableAutoSetup.AutoRegisterSo(soPath);
|
||||
|
||||
// 3. 데이터 파싱
|
||||
IList list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(dataType));
|
||||
var dataArray = (JArray)sheetPair.Value;
|
||||
|
||||
for (int i = 1; i < dataArray.Count; i++) // 0번은 주석이므로 제외
|
||||
for (int i = 1; i < dataArray.Count; i++)
|
||||
{
|
||||
JObject item = (JObject)dataArray[i];
|
||||
object dataInstance = Activator.CreateInstance(dataType);
|
||||
@ -554,7 +559,20 @@ private bool CreateGoogleSheetSo()
|
||||
foreach (var prop in item.Properties())
|
||||
{
|
||||
string rawName = prop.Name;
|
||||
string fieldName = rawName.Contains(":") ? rawName.Split(':')[0] : rawName;
|
||||
string fieldName = rawName;
|
||||
string explicitType = null;
|
||||
|
||||
if (rawName.Contains(":"))
|
||||
{
|
||||
var split = rawName.Split(':');
|
||||
fieldName = split[0];
|
||||
explicitType = split[1].Replace("_Enum", "");
|
||||
}
|
||||
else if (rawName.EndsWith("_Enum"))
|
||||
{
|
||||
fieldName = rawName.Replace("_Enum", "");
|
||||
explicitType = fieldName;
|
||||
}
|
||||
|
||||
FieldInfo field = dataType.GetField(fieldName,
|
||||
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
@ -568,14 +586,59 @@ private bool CreateGoogleSheetSo()
|
||||
try
|
||||
{
|
||||
object value;
|
||||
|
||||
// ✅ Sprite 처리
|
||||
if (explicitType == "Sprite" && field.FieldType == typeof(Sprite))
|
||||
{
|
||||
string key = prop.Value.ToString().Trim();
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
Debug.Log($"[GoogleSheetManager] Sprite 키가 비어 있어 {fieldName} 건너뜀");
|
||||
continue;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (!AddressableManager.HasLabel(key, "GoogleSheetSprite"))
|
||||
{
|
||||
Debug.LogWarning($"[GoogleSheetManager] '{key}'는 GoogleSheetSprite 라벨 없음");
|
||||
continue;
|
||||
}
|
||||
|
||||
var handle = Addressables.LoadAssetAsync<Sprite>(key);
|
||||
var sprite = handle.WaitForCompletion();
|
||||
|
||||
Debug.Log($"[GoogleSheetManager] '{key}' 로딩 결과: {sprite} / 상태: {handle.Status}");
|
||||
|
||||
if (handle.Status == AsyncOperationStatus.Succeeded && sprite != null)
|
||||
{
|
||||
field.SetValue(dataInstance, sprite);
|
||||
Debug.Log($"[GoogleSheetManager] {fieldName} <- {sprite.name} 반영됨");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"[GoogleSheetManager] Sprite 로드 실패 또는 null: {key}");
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
// ✅ Enum 처리
|
||||
if (field.FieldType.IsEnum)
|
||||
{
|
||||
string enumRaw = prop.Value.ToString();
|
||||
string formatted = NormalizeEnumKey(enumRaw);
|
||||
string formatted = NormalizeEnumKey(prop.Value.ToString());
|
||||
value = Enum.TryParse(field.FieldType, formatted, out var parsed)
|
||||
? parsed
|
||||
: Activator.CreateInstance(field.FieldType);
|
||||
}
|
||||
// ✅ Color 처리
|
||||
else if (field.FieldType == typeof(Color))
|
||||
{
|
||||
if (ColorUtility.TryParseHtmlString(prop.Value.ToString(), out var color))
|
||||
value = color;
|
||||
else
|
||||
value = Color.white;
|
||||
}
|
||||
// ✅ 기본 타입 처리
|
||||
else
|
||||
{
|
||||
value = Convert.ChangeType(prop.Value.ToString(), field.FieldType);
|
||||
@ -593,7 +656,6 @@ private bool CreateGoogleSheetSo()
|
||||
list.Add(dataInstance);
|
||||
}
|
||||
|
||||
// 4. SO의 필드에 리스트 할당
|
||||
FieldInfo listField = soType.GetField($"{sheetName}List",
|
||||
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
|
||||
@ -607,12 +669,12 @@ private bool CreateGoogleSheetSo()
|
||||
Debug.LogError($"[GoogleSheetManager] {soType.Name}에 {sheetName}List 필드가 없습니다.");
|
||||
allSuccess = false;
|
||||
}
|
||||
}
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
Debug.Log("✅ 시트별 ScriptableObject 생성 및 데이터 반영 완료");
|
||||
}
|
||||
|
||||
Debug.Log("✅ 시트별 ScriptableObject 생성 및 데이터 반영 완료");
|
||||
return allSuccess;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b8a0f41319f9ca4296c486723e89735
|
||||
TextScriptImporter:
|
||||
guid: 216d49d821b41f24788e428fbf995b8c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
BIN
Assets/_Datas/03.Image/Gold.png
Normal file
BIN
Assets/_Datas/03.Image/Gold.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
143
Assets/_Datas/03.Image/Gold.png.meta
Normal file
143
Assets/_Datas/03.Image/Gold.png.meta
Normal file
@ -0,0 +1,143 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e15933f76da90e742866563b5cd9e45f
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 64
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: WindowsStoreApps
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user