구글 시트 데이터 최신화

This commit is contained in:
NTG_Lenovo 2025-08-12 13:28:23 +09:00
parent fad3ba39c8
commit 4dd450ea32
28 changed files with 3918 additions and 304 deletions

View File

@ -34,7 +34,7 @@ Material:
m_LightmapFlags: 2
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
m_CustomRenderQueue: 2450
stringTagMap:
RenderType: TransparentCutout
disabledShaderPasses:
@ -47,6 +47,10 @@ Material:
m_Texture: {fileID: 2800000, guid: 9e3e41f5375f0477ea843b5f6aff3e9c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Emiss:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@ -59,6 +63,10 @@ Material:
m_Texture: {fileID: 2800000, guid: 5065b680750834465b52cebe19f5b46e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OpacityMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@ -97,6 +105,7 @@ Material:
- _Smoothness: 0.5
- _SrcBlend: 1
- _Surface: 0
- _UseOpacityMask: 0
- _WorkflowMode: 1
- _ZTest: 4
- _ZWrite: 1

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 21d0d76d7f889ce45b40db20dddf3851
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 50c2a4b526b61864083332f609fde611
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,35 @@
// <auto-generated>
using System;
using UnityEngine;
namespace DDD
{
public enum CustomerType
{
None = 0,
Normal,
Special
}
[Serializable]
public class CustomerData : IId
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]
[field: SerializeField]
public string Id { get; set; }
/// <summary>손님 타입</summary>
[Tooltip("손님 타입")]
public CustomerType CustomerType;
/// <summary>스파인 스킨 키 값</summary>
[Tooltip("스파인 스킨 키 값")]
public string SpineSkinKey;
/// <summary>선호 맛들</summary>
[Tooltip("선호 맛들")]
public string FavoriteTastes;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 24a354acd91b9d944aeb01375a9e9c4e

View File

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

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 090ee4c808412044090f3281830e08f6

View File

@ -0,0 +1,24 @@
// <auto-generated>
using System;
using UnityEngine;
namespace DDD
{
[Serializable]
public class CustomerPoolData : IId
{
/// <summary>식별번호</summary>
[Tooltip("식별번호")]
[field: SerializeField]
public string Id { get; set; }
/// <summary>손님 최대 수</summary>
[Tooltip("손님 최대 수")]
public int CustomerLimitCount;
/// <summary>등장 손님들</summary>
[Tooltip("등장 손님들")]
public string Customers;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9bad451e3ceb644459533d83a8144378

View File

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

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8c31b1b5bf70f3f4e80ff11973c8eb8c

Binary file not shown.

View File

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

Binary file not shown.

View File

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

Binary file not shown.

View File

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

View File

@ -23,8 +23,9 @@ public class GoogleSheetManager : ScriptableObject
[LabelText("선택 버전"), ValueDropdown(nameof(GetVersionOptions))]
[SerializeField] private int _selectedVersionIndex;
[SerializeField] private bool _isBusy;
private string _lastJsonCache;
private bool _isBusy;
private IGoogleSheetSource _source;
private IJsonDiffer _differ;
@ -306,7 +307,7 @@ private int GetSnapshotCountSafe()
return (log != null && log.Logs != null) ? log.Logs.Count : 0;
}
private async Task<bool> GuardAsync(Func<Task> body, string tag)
private async Task<bool> GuardAsync(Func<Task> body, string tag, int timeoutMs = 90000)
{
if (_isBusy)
{
@ -317,9 +318,21 @@ private async Task<bool> GuardAsync(Func<Task> body, string tag)
_isBusy = true;
try
{
await body();
// 본문과 타임아웃 중 먼저 끝나는 쪽을 기다린다
var work = body();
var done = await Task.WhenAny(work, Task.Delay(timeoutMs));
if (done != work)
throw new TimeoutException($"[{tag}] {timeoutMs}ms 타임아웃");
// body() 내부 예외 전파
await work;
return true;
}
catch (OperationCanceledException)
{
Debug.LogWarning($"[{tag}] 취소됨");
return false;
}
catch (Exception e)
{
Debug.LogError($"[{tag}] 실행 중 예외: {e}");
@ -339,14 +352,23 @@ await GuardAsync(async () =>
if (_settings == null) { Debug.LogError("Settings So가 없습니다."); return; }
BuildServices();
Debug.Log("[FetchJsonOnly] 시작");
var json = await _source.FetchAllJsonAsync();
Debug.Log("[FetchJsonOnly] 1) 시작");
var fetchTask = _source.FetchAllJsonAsync();
// 네트워크 대기를 한 번 더 보호 (HttpClient/UnityWebRequest가 내부 타임아웃 실패 시 대비)
var done = await Task.WhenAny(fetchTask, Task.Delay(_settings.HttpTimeoutSeconds * 2000));
if (done != fetchTask)
throw new TimeoutException("[FetchJsonOnly] 소스에서 응답 지연(추가 타임아웃)");
var json = await fetchTask;
Debug.Log($"[FetchJsonOnly] 2) 페치 완료 len={(json?.Length ?? 0)}");
if (string.IsNullOrWhiteSpace(json))
{
Debug.LogWarning("[FetchJsonOnly] 가져온 JSON이 비어있습니다.");
return;
}
Debug.Log("[FetchJsonOnly] 3) 메인스레드에서 저장/임포트 예약");
await RunOnMainThread(() =>
{
var full = GoogleSheetSettingsSo.AssetToFull(_settings.JsonWorkFileAssetPath);
@ -358,7 +380,7 @@ await RunOnMainThread(() =>
AssetDatabase.ImportAsset(_settings.JsonWorkFileAssetPath);
});
Debug.Log("[FetchJsonOnly] 완료");
Debug.Log("[FetchJsonOnly] 4) 완료");
}, tag: "FetchJsonOnly");
}