data, state 관리 로직 전부 수정
ScriptableSingleton 모두 삭제
This commit is contained in:
parent
dcd5a0c2d8
commit
6d9e7a7f51
BIN
Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset
(Stored with Git LFS)
BIN
Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset
(Stored with Git LFS)
Binary file not shown.
@ -338,6 +338,7 @@ PrefabInstance:
|
||||
- {fileID: 3365694194251356714, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
- {fileID: 127430239903465757, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
- {fileID: 7606279200344222219, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
- {fileID: 3095965496140440094, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects:
|
||||
- targetCorrespondingSourceObject: {fileID: 4993183601549197863, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
@ -359,6 +360,9 @@ PrefabInstance:
|
||||
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 388082324973004231}
|
||||
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 152577516172191389}
|
||||
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 8993310060139522557}
|
||||
@ -431,6 +435,18 @@ MonoBehaviour:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
--- !u!114 &152577516172191389
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7316134055819320434}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6ea5b6b4333d6fa4392d4d0a09d97242, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &8993310060139522557
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
8
Assets/_DDD/_Addressables/So/GameData.meta
Normal file
8
Assets/_DDD/_Addressables/So/GameData.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afe0250614f8af643a95058970e9f647
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/GameData/GameData.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/GameData/GameData.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Assets/_DDD/_Addressables/So/GameData/GameLocalizationData.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/GameData/GameLocalizationData.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 094ff53715c99c54ea7e6702a6933228
|
||||
guid: acb945af9ef1953408e259003ddee155
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
BIN
Assets/_DDD/_Addressables/So/GameDataSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Addressables/So/GameDataSo.asset
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/_DDD/_Addressables/So/GameLocalizationDataSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Addressables/So/GameLocalizationDataSo.asset
(Stored with Git LFS)
Binary file not shown.
8
Assets/_DDD/_Addressables/So/GameState.meta
Normal file
8
Assets/_DDD/_Addressables/So/GameState.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 713d65ef3d932164c97b5250f647bf77
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/GameState/GameLevelState.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/GameState/GameLevelState.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c702efebbff4144429b6f07cf841bc42
|
||||
guid: fc0639e78dfcb4b47ac6ec82ee0d6213
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
BIN
Assets/_DDD/_Addressables/So/GameState/GameState.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/GameState/GameState.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fac99a2d5b6eb240a64b9e010a22ac4
|
||||
guid: 57f96cac976cace4b8107ab44edb0f71
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
BIN
Assets/_DDD/_Addressables/So/GameStateSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Addressables/So/GameStateSo.asset
(Stored with Git LFS)
Binary file not shown.
8
Assets/_DDD/_Addressables/So/RestaurantData.meta
Normal file
8
Assets/_DDD/_Addressables/So/RestaurantData.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 899d2f22a3c355740897ec6bdf2fb6d1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantData/RestaurantData.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantData/RestaurantData.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4af913216da4468ea23c8f910d86644
|
||||
guid: 2d86890c5ef774c4aae6870f0eeef0f5
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
BIN
Assets/_DDD/_Addressables/So/RestaurantData/RestaurantManagementData.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantData/RestaurantManagementData.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1263bd88e8e68a94b853d23b321ed172
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantData/RestaurantPlayerData.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantData/RestaurantPlayerData.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ad1a2be148524d4884f22ff233862e1
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantDataSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Addressables/So/RestaurantDataSo.asset
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/_DDD/_Addressables/So/RestaurantPlayerDataSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Addressables/So/RestaurantPlayerDataSo.asset
(Stored with Git LFS)
Binary file not shown.
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddb0db863be8f254bb8a8f07d39a960e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/_DDD/_Addressables/So/RestaurantState.meta
Normal file
8
Assets/_DDD/_Addressables/So/RestaurantState.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3afa6356ede647e47a79b8b1cd285b5e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantCustomerState.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantCustomerState.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eade044ef7a61604d8dcf56168d40026
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantEnvironmentState.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantEnvironmentState.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93204a2af0c46094696d74538897e540
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantManagementState.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantManagementState.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2b9375a9a66227409de828e13255ea2
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantPlayerState.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantPlayerState.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6b2937b862326145a9a94a56e7c3192
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantRunState.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantRunState.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d463f7458658794396953c3bd77ad57
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantState.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantState/RestaurantState.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cd28a9cdddf5dd4e9c729431a345509
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -45,3 +45,15 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_persistent: 1
|
||||
_gameData:
|
||||
m_AssetGUID: e12b1e83b4adb034fb3525c202663954
|
||||
m_SubObjectName:
|
||||
m_SubObjectType:
|
||||
m_SubObjectGUID:
|
||||
m_EditorAssetChanged: 1
|
||||
_gameState:
|
||||
m_AssetGUID: 57f96cac976cace4b8107ab44edb0f71
|
||||
m_SubObjectName:
|
||||
m_SubObjectType:
|
||||
m_SubObjectGUID:
|
||||
m_EditorAssetChanged: 1
|
||||
|
@ -45,3 +45,15 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_persistent: 1
|
||||
_restaurantData:
|
||||
m_AssetGUID: 2d86890c5ef774c4aae6870f0eeef0f5
|
||||
m_SubObjectName:
|
||||
m_SubObjectType:
|
||||
m_SubObjectGUID:
|
||||
m_EditorAssetChanged: 1
|
||||
_restaurantState:
|
||||
m_AssetGUID: 9cd28a9cdddf5dd4e9c729431a345509
|
||||
m_SubObjectName:
|
||||
m_SubObjectType:
|
||||
m_SubObjectGUID:
|
||||
m_EditorAssetChanged: 1
|
||||
|
BIN
Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset
(Stored with Git LFS)
Binary file not shown.
@ -2,17 +2,20 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class GameController : Singleton<GameController>, IManager, IGameFlowHandler
|
||||
{
|
||||
private static readonly List<Type> GameFlowControllerTypes = new();
|
||||
|
||||
public GameDataSo GetGameData() => GameDataSo.instance;
|
||||
public GameStateSo GetGameState() => GameStateSo.instance;
|
||||
[SerializeField] private AssetReference _gameData;
|
||||
[SerializeField] private AssetReference _gameState;
|
||||
|
||||
public GameData GameData { get; private set; }
|
||||
public GameState GameState { get; private set; }
|
||||
|
||||
private List<FlowController> _gameFlowControllers = new();
|
||||
private static readonly List<Type> GameFlowControllerTypes = new();
|
||||
|
||||
public void PreInit()
|
||||
{
|
||||
@ -22,7 +25,8 @@ public void PreInit()
|
||||
public async Task Init()
|
||||
{
|
||||
await LoadData();
|
||||
await GameDataSo.instance.LoadData();
|
||||
await GameData.LoadData();
|
||||
await GameState.LoadData();
|
||||
await InitializeAllFlowControllers();
|
||||
}
|
||||
|
||||
@ -53,9 +57,21 @@ private async Task InitializeAllFlowControllers()
|
||||
}
|
||||
}
|
||||
|
||||
private Task LoadData()
|
||||
private async Task LoadData()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
var gameDataHandle = _gameData.LoadAssetAsync<GameData>();
|
||||
var gameStateHandle = _gameState.LoadAssetAsync<GameState>();
|
||||
|
||||
await gameDataHandle.Task;
|
||||
await gameStateHandle.Task;
|
||||
|
||||
GameData = gameDataHandle.Result;
|
||||
GameState = gameStateHandle.Result;
|
||||
|
||||
Debug.Assert(GameData != null, "GameData is null");
|
||||
Debug.Assert(GameState != null, "GameState is null");
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
|
40
Assets/_DDD/_Scripts/GameData/GameData.cs
Normal file
40
Assets/_DDD/_Scripts/GameData/GameData.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "GameData", menuName = "GameData/GameData")]
|
||||
public class GameData : ScriptableObject
|
||||
{
|
||||
[SerializeField] private AssetReference _gameLocalizationData;
|
||||
|
||||
public GameLocalizationData LocalizationData { get; private set; }
|
||||
|
||||
private bool _isLoaded;
|
||||
|
||||
public async Task LoadData()
|
||||
{
|
||||
if (_isLoaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var gameLocalizationDataHandle = _gameLocalizationData.LoadAssetAsync<GameLocalizationData>();
|
||||
await gameLocalizationDataHandle.Task;
|
||||
|
||||
LocalizationData = gameLocalizationDataHandle.Result;
|
||||
Debug.Assert(LocalizationData != null, "GameLocalizationData is null");
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (_isLoaded == false) return;
|
||||
|
||||
_gameLocalizationData.ReleaseAsset();
|
||||
_isLoaded = false;
|
||||
}
|
||||
}
|
||||
}
|
2
Assets/_DDD/_Scripts/GameData/GameData.cs.meta
Normal file
2
Assets/_DDD/_Scripts/GameData/GameData.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8cbc44b1cb7bac479f9786f96c5dc80
|
@ -1,47 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.Localization.SmartFormat.PersistentVariables;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "GameDataSo", menuName = "GameData/GameDataSo", order = 0)]
|
||||
public class GameDataSo : ScriptableSingleton<GameDataSo>
|
||||
{
|
||||
[Header("Asset References")]
|
||||
[SerializeField] private AssetReference _gameLocalizationDataSo;
|
||||
|
||||
public GameLocalizationDataSo GameLocalizationData { get; private set; }
|
||||
|
||||
private bool _isLoaded;
|
||||
|
||||
public async Task LoadData()
|
||||
{
|
||||
if (_isLoaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var smartStringHandle = _gameLocalizationDataSo.LoadAssetAsync<GameLocalizationDataSo>();
|
||||
|
||||
await smartStringHandle.Task;
|
||||
|
||||
GameLocalizationData = smartStringHandle.Result;
|
||||
|
||||
Debug.Assert(GameLocalizationData != null, "SmartStringVariableGroup is null");
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
_gameLocalizationDataSo.ReleaseAsset();
|
||||
|
||||
_isLoaded = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba8a1173c4b34e247b6e12aa3833848f
|
@ -3,8 +3,8 @@
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "GameLocalizationDataSo", menuName = "GameData/GameLocalizationDataSo")]
|
||||
public class GameLocalizationDataSo : ScriptableObject
|
||||
[CreateAssetMenu(fileName = "GameLocalizationData", menuName = "GameData/GameLocalizationData")]
|
||||
public class GameLocalizationData : ScriptableObject
|
||||
{
|
||||
public VariablesGroupAsset SmartStringVariableGroup;
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c518e485d790cf446a3d0e7e9b5e2348
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5d17e00386b555438f1598afa5f10d6
|
@ -97,7 +97,7 @@ public string GetString(string key)
|
||||
var entryRef = key;
|
||||
var locale = LocalizationSettings.SelectedLocale;
|
||||
|
||||
VariablesGroupAsset variables = GameDataSo.instance.GameLocalizationData.SmartStringVariableGroup;
|
||||
VariablesGroupAsset variables = GameController.Instance.GameData.LocalizationData.SmartStringVariableGroup;
|
||||
if (variables != null)
|
||||
{
|
||||
_singleArgBuffer.Clear();
|
||||
|
@ -50,8 +50,8 @@ public void PreInit() { }
|
||||
|
||||
public async Task Init()
|
||||
{
|
||||
var gameLevelStateSo = GameStateSo.instance.GameLevelStateSo;
|
||||
var restaurantStateSo = RestaurantState.instance.ManagementState;
|
||||
var gameLevelStateSo = GameController.Instance.GameState.LevelState;
|
||||
var restaurantStateSo = RestaurantController.Instance.RestaurantState.ManagementState;
|
||||
|
||||
// 예시: day 초기 세팅 (없으면 생성, 타입 다르면 교체)
|
||||
Set(_smartStringKeys[smartStringKey.Day], gameLevelStateSo.Level);
|
||||
@ -71,7 +71,7 @@ public void PostInit()
|
||||
EventBus.Register<SmartVariablesDirtyEvent>(this);
|
||||
}
|
||||
|
||||
private RestaurantManagementStateSo GetRestaurantState() => RestaurantState.instance.ManagementState;
|
||||
private RestaurantManagementState GetRestaurantState() => RestaurantController.Instance.RestaurantState.ManagementState;
|
||||
|
||||
public void Invoke(SmartVariablesDirtyEvent evt)
|
||||
{
|
||||
@ -113,7 +113,7 @@ public void RefreshChecklistTargets()
|
||||
|
||||
public void RefreshDay()
|
||||
{
|
||||
var gameLevelStateSo = GameStateSo.instance.GameLevelStateSo;
|
||||
var gameLevelStateSo = GameController.Instance.GameState.LevelState;
|
||||
Set(_smartStringKeys[smartStringKey.Day], gameLevelStateSo.Level);
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ public void SetEnum<TEnum>(string key, TEnum value) where TEnum : struct
|
||||
return null;
|
||||
}
|
||||
|
||||
var smartStringVariableGroup = GameDataSo.instance.GameLocalizationData.SmartStringVariableGroup;
|
||||
var smartStringVariableGroup = GameController.Instance.GameData.LocalizationData.SmartStringVariableGroup;
|
||||
|
||||
if (smartStringVariableGroup.TryGetValue(key, out var existing))
|
||||
{
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class GameLevelStateSo : ScriptableObject
|
||||
[CreateAssetMenu(fileName = "GameLevelState", menuName = "GameState/GameLevelState")]
|
||||
public class GameLevelState : ScriptableObject
|
||||
{
|
||||
public int Level = 1;
|
||||
|
2
Assets/_DDD/_Scripts/GameState/GameLevelState.cs.meta
Normal file
2
Assets/_DDD/_Scripts/GameState/GameLevelState.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39c94e10e2c3ed94db2c04949059499e
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b38b5ba62c327b48a2a8f60869bf45a
|
40
Assets/_DDD/_Scripts/GameState/GameState.cs
Normal file
40
Assets/_DDD/_Scripts/GameState/GameState.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "GameState", menuName = "GameState/GameState")]
|
||||
public class GameState : ScriptableObject
|
||||
{
|
||||
[SerializeField] private AssetReference _gameLevelState;
|
||||
|
||||
public GameLevelState LevelState { get; private set; }
|
||||
|
||||
private bool _isLoaded;
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (_isLoaded == false) return;
|
||||
|
||||
_gameLevelState.ReleaseAsset();
|
||||
_isLoaded = false;
|
||||
}
|
||||
|
||||
public async Task LoadData()
|
||||
{
|
||||
if (_isLoaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var gameLevelStateHandle = _gameLevelState.LoadAssetAsync<GameLevelState>();
|
||||
await gameLevelStateHandle.Task;
|
||||
|
||||
LevelState = gameLevelStateHandle.Result;
|
||||
Debug.Assert(LevelState != null, "GameLevelState is null");
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
2
Assets/_DDD/_Scripts/GameState/GameState.cs.meta
Normal file
2
Assets/_DDD/_Scripts/GameState/GameState.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd102dd3c3e47a1459dc9fe624f7cb0c
|
@ -1,17 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "GameStateSo", menuName = "GameState/GameStateSo")]
|
||||
public class GameStateSo : ScriptableSingleton<GameStateSo>
|
||||
{
|
||||
public GameLevelStateSo GameLevelStateSo { get; private set; }
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
GameLevelStateSo = CreateInstance<GameLevelStateSo>();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b8aa6c32ff3e8b49bc8365e3a6e2218
|
@ -25,11 +25,11 @@ public class ChecklistView : MonoBehaviour, IEventHandler<TodayMenuAddedEvent>,
|
||||
{ChecklistLocalizationKey.Checklist3, "checklist_3"},
|
||||
};
|
||||
|
||||
private RestaurantManagementStateSo restaurantManagementStateSo;
|
||||
private RestaurantManagementState restaurantManagementStateSo;
|
||||
|
||||
public void Initalize()
|
||||
{
|
||||
restaurantManagementStateSo = RestaurantState.instance.ManagementState;
|
||||
restaurantManagementStateSo = RestaurantController.Instance.RestaurantState.ManagementState;
|
||||
|
||||
_checklistDatas = new List<ChecklistData>(3);
|
||||
_checklistDatas = GetComponentsInChildren<ChecklistData>().ToList();
|
||||
|
@ -40,7 +40,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
||||
|
||||
public RuntimeAnimatorController GetAnimatorController()
|
||||
{
|
||||
return RestaurantDataSo.instance.ManagementData.InventorySlotUiAnimatorController;
|
||||
return RestaurantController.Instance.RestaurantData.ManagementData.InventorySlotUiAnimatorController;
|
||||
}
|
||||
|
||||
public void OnInventoryChanged(ItemSlotUi ui)
|
||||
|
@ -10,8 +10,8 @@ public class InventoryView : MonoBehaviour, IEventHandler<InventoryChangedEvent>
|
||||
{
|
||||
[SerializeField] private Transform _slotParent;
|
||||
|
||||
private RestaurantManagementDataSo restaurantManagementDataSo;
|
||||
private RestaurantManagementStateSo restaurantManagementStateSo;
|
||||
private RestaurantManagementData restaurantManagementDataSo;
|
||||
private RestaurantManagementState restaurantManagementStateSo;
|
||||
private InventoryCategoryType _currenInventoryCategoryType = InventoryCategoryType.Food;
|
||||
|
||||
private readonly Dictionary<string, ItemSlotUi> _slotLookup = new();
|
||||
@ -38,8 +38,8 @@ private void OnDisable()
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
restaurantManagementStateSo = RestaurantState.instance.ManagementState;
|
||||
restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData;
|
||||
restaurantManagementStateSo = RestaurantController.Instance.RestaurantState.ManagementState;
|
||||
restaurantManagementDataSo = RestaurantController.Instance.RestaurantData.ManagementData;
|
||||
Debug.Assert(restaurantManagementDataSo != null, "_todayMenuDataSo != null");
|
||||
|
||||
Clear();
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Localization.Components;
|
||||
@ -22,7 +21,7 @@ public class ItemDetailView : MonoBehaviour, IEventHandler<ItemSlotSelectedEvent
|
||||
[SerializeField] private HorizontalLayoutGroup _tasteHashTagContentLayoutGroup;
|
||||
[SerializeField] private RectTransform _tasteHashTagContent2;
|
||||
|
||||
private RestaurantManagementDataSo restaurantManagementDataSo;
|
||||
private RestaurantManagementData restaurantManagementDataSo;
|
||||
|
||||
private List<TasteHashTagSlotUi> _tasteHashTagSlotUis = new();
|
||||
private ItemViewModel _currentItemViewModel;
|
||||
@ -40,11 +39,6 @@ private void Start()
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (restaurantManagementDataSo == null)
|
||||
{
|
||||
restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData;
|
||||
}
|
||||
|
||||
EventBus.Register<ItemSlotSelectedEvent>(this);
|
||||
}
|
||||
|
||||
@ -53,6 +47,11 @@ private void OnDisable()
|
||||
EventBus.Unregister<ItemSlotSelectedEvent>(this);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
restaurantManagementDataSo = RestaurantController.Instance.RestaurantData.ManagementData;
|
||||
}
|
||||
|
||||
public void Invoke(ItemSlotSelectedEvent evt)
|
||||
{
|
||||
Show(evt.Model);
|
||||
|
@ -60,7 +60,7 @@ private void UpdateHoldProgress()
|
||||
|
||||
private void ProcessCompleteBatchAction()
|
||||
{
|
||||
if (RestaurantState.instance.ManagementState.GetChecklistStates().Any(state => state == false))
|
||||
if (RestaurantController.Instance.RestaurantState.ManagementState.GetChecklistStates().Any(state => state == false))
|
||||
{
|
||||
ShowChecklistFailedPopup();
|
||||
}
|
||||
@ -115,6 +115,7 @@ private void InitializeViews()
|
||||
{
|
||||
_checklistView.Initalize();
|
||||
_inventoryView.Initialize();
|
||||
_itemDetailView.Initialize();
|
||||
_todayMenuView.Initialize();
|
||||
_todayRestaurantStateView.Initialize();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ public void OnAdded(ItemSlotUi itemSlotUi)
|
||||
|
||||
if (inventorySlotUiStrategy.CanCrafting(itemSlotUi))
|
||||
{
|
||||
RestaurantState.instance.ManagementState.TryAddTodayMenu(itemSlotUi.Model);
|
||||
RestaurantController.Instance.RestaurantState.ManagementState.TryAddTodayMenu(itemSlotUi.Model);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -25,7 +25,7 @@ public void OnRemoved(ItemSlotUi itemSlotUi)
|
||||
{
|
||||
if (itemSlotUi.Strategy is InventorySlotUiStrategy) return;
|
||||
|
||||
RestaurantState.instance.ManagementState.TryRemoveTodayMenu(itemSlotUi.Model);
|
||||
RestaurantController.Instance.RestaurantState.ManagementState.TryRemoveTodayMenu(itemSlotUi.Model);
|
||||
}
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
||||
}
|
||||
|
||||
string markSpriteKey = null;
|
||||
if (RestaurantState.instance.ManagementState.IsCookwareMatched(ui.Model.Id))
|
||||
if (RestaurantController.Instance.RestaurantState.ManagementState.IsCookwareMatched(ui.Model.Id))
|
||||
{
|
||||
markSpriteKey = SpriteConstants.CheckYesSpriteKey;
|
||||
}
|
||||
@ -51,7 +51,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
||||
|
||||
public RuntimeAnimatorController GetAnimatorController()
|
||||
{
|
||||
return RestaurantDataSo.instance.ManagementData.TodayMenuSlotUiAnimatorController;
|
||||
return RestaurantController.Instance.RestaurantData.ManagementData.TodayMenuSlotUiAnimatorController;
|
||||
}
|
||||
}
|
||||
}
|
@ -12,8 +12,8 @@ public class TodayMenuView : MonoBehaviour, IEventHandler<TodayMenuAddedEvent>,
|
||||
private List<ItemSlotUi> _foodSlots;
|
||||
private List<ItemSlotUi> _drinkSlots;
|
||||
|
||||
private RestaurantManagementStateSo restaurantManagementStateSo;
|
||||
private RestaurantManagementDataSo restaurantManagementDataSo;
|
||||
private RestaurantManagementState restaurantManagementStateSo;
|
||||
private RestaurantManagementData restaurantManagementDataSo;
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
@ -23,8 +23,8 @@ private void OnDestroy()
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
restaurantManagementStateSo = RestaurantState.instance.ManagementState;
|
||||
restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData;
|
||||
restaurantManagementStateSo = RestaurantController.Instance.RestaurantState.ManagementState;
|
||||
restaurantManagementDataSo = RestaurantController.Instance.RestaurantData.ManagementData;
|
||||
|
||||
foreach (Transform child in _todayFoodContent)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ public void OnAdded(ItemSlotUi itemSlotUi)
|
||||
|
||||
if (inventorySlotUiStrategy.CanCrafting(itemSlotUi))
|
||||
{
|
||||
RestaurantState.instance.ManagementState.TryAddTodayCookware(itemSlotUi.Model);
|
||||
RestaurantController.Instance.RestaurantState.ManagementState.TryAddTodayCookware(itemSlotUi.Model);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -25,7 +25,7 @@ public void OnRemoved(ItemSlotUi itemSlotUi)
|
||||
{
|
||||
if (itemSlotUi.Strategy is InventorySlotUiStrategy) return;
|
||||
|
||||
RestaurantState.instance.ManagementState.TryRemoveTodayCookware(itemSlotUi.Model);
|
||||
RestaurantController.Instance.RestaurantState.ManagementState.TryRemoveTodayCookware(itemSlotUi.Model);
|
||||
}
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
||||
}
|
||||
|
||||
string markSpriteKey = null;
|
||||
if (RestaurantState.instance.ManagementState.IsTodayMenuMatched(ui.Model.Id))
|
||||
if (RestaurantController.Instance.RestaurantState.ManagementState.IsTodayMenuMatched(ui.Model.Id))
|
||||
{
|
||||
markSpriteKey = SpriteConstants.CheckYesSpriteKey;
|
||||
}
|
||||
@ -34,7 +34,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
||||
|
||||
public RuntimeAnimatorController GetAnimatorController()
|
||||
{
|
||||
return RestaurantDataSo.instance.ManagementData.TodayMenuSlotUiAnimatorController;
|
||||
return RestaurantController.Instance.RestaurantData.ManagementData.TodayMenuSlotUiAnimatorController;
|
||||
}
|
||||
}
|
||||
}
|
@ -12,8 +12,8 @@ public class TodayRestaurantStateView : MonoBehaviour, IEventHandler<TodayMenuAd
|
||||
private List<ItemSlotUi> _workerSlots;
|
||||
private List<ItemSlotUi> _cookwareSlots;
|
||||
|
||||
private RestaurantManagementStateSo restaurantManagementStateSo;
|
||||
private RestaurantManagementDataSo restaurantManagementDataSo;
|
||||
private RestaurantManagementState restaurantManagementStateSo;
|
||||
private RestaurantManagementData restaurantManagementDataSo;
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
@ -23,8 +23,8 @@ private void OnDestroy()
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
restaurantManagementStateSo = RestaurantState.instance.ManagementState;
|
||||
restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData;
|
||||
restaurantManagementStateSo = RestaurantController.Instance.RestaurantState.ManagementState;
|
||||
restaurantManagementDataSo = RestaurantController.Instance.RestaurantData.ManagementData;
|
||||
|
||||
foreach (Transform child in _todayWorkerContent)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
||||
|
||||
public RuntimeAnimatorController GetAnimatorController()
|
||||
{
|
||||
return RestaurantDataSo.instance.ManagementData.TodayMenuSlotUiAnimatorController;
|
||||
return RestaurantController.Instance.RestaurantData.ManagementData.TodayMenuSlotUiAnimatorController;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RestaurantPlayerAnimation : RestaurantCharacterAnimation
|
||||
{
|
||||
private RestaurantPlayerMovement _restaurantPlayerMovement;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
_restaurantPlayerMovement = GetComponent<RestaurantPlayerMovement>();
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
_restaurantPlayerMovement.OnMoving += OnMove;
|
||||
_restaurantPlayerMovement.OnDashing += OnDash;
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
|
||||
if (_restaurantPlayerMovement)
|
||||
{
|
||||
_restaurantPlayerMovement.OnMoving -= OnMove;
|
||||
_restaurantPlayerMovement.OnDashing -= OnDash;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMove(bool isMoving)
|
||||
{
|
||||
string animationName = isMoving ? RestaurantPlayerAnimationType.Walk : RestaurantPlayerAnimationType.Idle;
|
||||
_spineController.PlayAnimation(animationName, true);
|
||||
}
|
||||
|
||||
private void OnDash(float dashTime)
|
||||
{
|
||||
_spineController.PlayAnimationDuration(RestaurantPlayerAnimationType.Dash, false, duration:dashTime);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ea5b6b4333d6fa4392d4d0a09d97242
|
@ -5,11 +5,11 @@ namespace DDD
|
||||
{
|
||||
public class RestaurantPlayerInput : MonoBehaviour
|
||||
{
|
||||
private RestaurantPlayerDataSo _playerDataSo;
|
||||
private RestaurantPlayerData _playerDataSo;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_playerDataSo = RestaurantDataSo.instance.PlayerData;
|
||||
_playerDataSo = RestaurantController.Instance.RestaurantData.PlayerData;
|
||||
_playerDataSo.OpenManagementUiAction = InputManager.Instance.GetAction(InputActionMaps.Restaurant, nameof(RestaurantActions.OpenManagementUi));
|
||||
|
||||
_playerDataSo.OpenManagementUiAction.performed += OnOpenManagementUi;
|
||||
|
@ -6,7 +6,7 @@ namespace DDD
|
||||
{
|
||||
public class RestaurantPlayerInteraction : RestaurantCharacterInteraction
|
||||
{
|
||||
private RestaurantPlayerDataSo _restaurantPlayerDataSo;
|
||||
private RestaurantPlayerData _restaurantPlayerDataSo;
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
@ -17,7 +17,7 @@ protected override void Start()
|
||||
|
||||
private Task Initialize()
|
||||
{
|
||||
_restaurantPlayerDataSo = RestaurantDataSo.instance.PlayerData;
|
||||
_restaurantPlayerDataSo = RestaurantController.Instance.RestaurantData.PlayerData;
|
||||
Debug.Assert(_restaurantPlayerDataSo != null, "_restaurantPlayerDataSo is null");
|
||||
|
||||
_restaurantPlayerDataSo!.InteractAction = InputManager.Instance.GetAction(InputActionMaps.Restaurant, nameof(RestaurantActions.Interact));
|
||||
|
@ -13,7 +13,7 @@ public class RestaurantPlayerMovement : RestaurantCharacterMovement, ICurrentDir
|
||||
|
||||
private Rigidbody _rigidbody;
|
||||
private BoxCollider _boxCollider;
|
||||
private RestaurantPlayerDataSo _playerDataSo;
|
||||
private RestaurantPlayerData _playerDataSo;
|
||||
|
||||
private Vector3 _inputDirection;
|
||||
private Vector3 _currentDirection;
|
||||
@ -81,7 +81,7 @@ private System.Threading.Tasks.Task InitializePlayerData()
|
||||
{
|
||||
try
|
||||
{
|
||||
_playerDataSo = RestaurantDataSo.instance.PlayerData;
|
||||
_playerDataSo = RestaurantController.Instance.RestaurantData.PlayerData;
|
||||
SubscribeToInputEvents();
|
||||
_isInitialized = true;
|
||||
}
|
||||
@ -294,13 +294,13 @@ public MovementDebugVisualizer(Transform transform)
|
||||
}
|
||||
|
||||
public void UpdateVisualization(Vector3 position, Vector3 inputDirection,
|
||||
Vector3 currentVelocity, RestaurantPlayerDataSo playerDataSo)
|
||||
Vector3 currentVelocity, RestaurantPlayerData playerDataSo)
|
||||
{
|
||||
UpdateInputLine(position, inputDirection, playerDataSo);
|
||||
UpdateVelocityLine(position, currentVelocity, playerDataSo);
|
||||
}
|
||||
|
||||
private void UpdateInputLine(Vector3 origin, Vector3 inputDirection, RestaurantPlayerDataSo playerDataSo)
|
||||
private void UpdateInputLine(Vector3 origin, Vector3 inputDirection, RestaurantPlayerData playerDataSo)
|
||||
{
|
||||
if (inputDirection != Vector3.zero)
|
||||
{
|
||||
@ -324,7 +324,7 @@ private void UpdateInputLine(Vector3 origin, Vector3 inputDirection, RestaurantP
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateVelocityLine(Vector3 origin, Vector3 velocity, RestaurantPlayerDataSo playerDataSo)
|
||||
private void UpdateVelocityLine(Vector3 origin, Vector3 velocity, RestaurantPlayerData playerDataSo)
|
||||
{
|
||||
float speed = velocity.magnitude;
|
||||
if (speed > playerDataSo.VelocityMinThreshold)
|
||||
|
@ -4,39 +4,21 @@ namespace DDD
|
||||
{
|
||||
public class RestaurantCharacterAnimation : MonoBehaviour
|
||||
{
|
||||
private RestaurantPlayerMovement _restaurantPlayerMovement;
|
||||
private SpineController _spineController;
|
||||
|
||||
private void Awake()
|
||||
protected SpineController _spineController;
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
_restaurantPlayerMovement = GetComponent<RestaurantPlayerMovement>();
|
||||
_spineController = GetComponent<SpineController>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
protected virtual void Start()
|
||||
{
|
||||
_restaurantPlayerMovement.OnMoving += OnMove;
|
||||
_restaurantPlayerMovement.OnDashing += OnDash;
|
||||
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
protected virtual void OnDestroy()
|
||||
{
|
||||
if (_restaurantPlayerMovement)
|
||||
{
|
||||
_restaurantPlayerMovement.OnMoving -= OnMove;
|
||||
_restaurantPlayerMovement.OnDashing -= OnDash;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMove(bool isMoving)
|
||||
{
|
||||
string animationName = isMoving ? RestaurantPlayerAnimation.Walk : RestaurantPlayerAnimation.Idle;
|
||||
_spineController.PlayAnimation(animationName, true);
|
||||
}
|
||||
|
||||
private void OnDash(float dashTime)
|
||||
{
|
||||
_spineController.PlayAnimationDuration(RestaurantPlayerAnimation.Dash, false, duration:dashTime);
|
||||
|
||||
}
|
||||
|
||||
public bool IsPlayingAnimation()
|
||||
|
@ -5,7 +5,7 @@ namespace DDD
|
||||
{
|
||||
public class RestaurantEnvironmentController : FlowController
|
||||
{
|
||||
private RestaurantEnvironmentStateSo _environmentState;
|
||||
private RestaurantEnvironmentState _environmentState;
|
||||
public override Task InitializeController()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@ -13,7 +13,7 @@ public override Task InitializeController()
|
||||
|
||||
public override Task InitializeState()
|
||||
{
|
||||
_environmentState = RestaurantState.instance.EnvironmentState;
|
||||
_environmentState = RestaurantController.Instance.RestaurantState.EnvironmentState;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ public override Task InitializeController()
|
||||
public override Task InitializeState()
|
||||
{
|
||||
// Load default asset
|
||||
RestaurantState.instance.ManagementState.InitializeReadyForRestaurant();
|
||||
RestaurantController.Instance.RestaurantState.ManagementState.InitializeReadyForRestaurant();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ namespace DDD
|
||||
{
|
||||
public class RestaurantRunController : FlowController
|
||||
{
|
||||
RestaurantCustomerStateSo _restaurantCustomerStateSo;
|
||||
RestaurantCustomerState _restaurantCustomerStateSo;
|
||||
public override Task InitializeController()
|
||||
{
|
||||
_restaurantCustomerStateSo = RestaurantState.instance.CustomerState;
|
||||
_restaurantCustomerStateSo = RestaurantController.Instance.RestaurantState.CustomerState;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 545b3710d04aa3e48923f79f03b5dfc5
|
@ -15,7 +15,7 @@ public override Task RunFlowTask()
|
||||
{
|
||||
// TODO : Base prefab from EnvironmentDataSo
|
||||
|
||||
var props = RestaurantState.instance.EnvironmentState.Props;
|
||||
var props = RestaurantController.Instance.RestaurantState.EnvironmentState.Props;
|
||||
foreach (var prop in props)
|
||||
{
|
||||
// TODO : Instantiate and Initialize
|
||||
|
@ -20,7 +20,7 @@ public override Task RunFlowTask()
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
var playerPrefab = RestaurantDataSo.instance.PlayerData.PlayerPrefab;
|
||||
var playerPrefab = RestaurantController.Instance.RestaurantData.PlayerData.PlayerPrefab;
|
||||
if (playerPrefab == null)
|
||||
{
|
||||
Debug.LogError("PlayerPrefab이 설정되지 않았습니다!");
|
||||
|
@ -2,11 +2,20 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RestaurantController : Singleton<RestaurantController>, IManager, IGameFlowHandler
|
||||
{
|
||||
[SerializeField] private AssetReference _restaurantData;
|
||||
[SerializeField] private AssetReference _restaurantState;
|
||||
|
||||
public RestaurantData RestaurantData { get; private set; }
|
||||
public RestaurantState RestaurantState { get; private set; }
|
||||
|
||||
private List<FlowController> _restaurantFlowControllers = new();
|
||||
|
||||
// static definitions
|
||||
private static readonly List<Type> RestaurantFlowControllerTypes = new()
|
||||
{
|
||||
@ -17,11 +26,6 @@ public class RestaurantController : Singleton<RestaurantController>, IManager, I
|
||||
typeof(RestaurantGlobalMessageController)
|
||||
};
|
||||
|
||||
public RestaurantState GetRestaurantState() => RestaurantState.instance;
|
||||
public RestaurantDataSo RestaurantData() => RestaurantDataSo.instance;
|
||||
|
||||
private List<FlowController> _restaurantFlowControllers = new();
|
||||
|
||||
public void PreInit()
|
||||
{
|
||||
RegisterFlowHandler();
|
||||
@ -30,7 +34,8 @@ public void PreInit()
|
||||
public async Task Init()
|
||||
{
|
||||
await LoadData();
|
||||
await RestaurantDataSo.instance.LoadData();
|
||||
await RestaurantData.LoadData();
|
||||
await RestaurantState.LoadData();
|
||||
await InitializeAllFlowControllers();
|
||||
}
|
||||
|
||||
@ -57,13 +62,23 @@ private async Task InitializeAllFlowControllers()
|
||||
|
||||
foreach (var restaurantFlowController in _restaurantFlowControllers)
|
||||
{
|
||||
await restaurantFlowController.InitializeState();
|
||||
await restaurantFlowController.InitializeState();
|
||||
}
|
||||
}
|
||||
|
||||
private Task LoadData()
|
||||
private async Task LoadData()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
var restaurantDataHandle = _restaurantData.LoadAssetAsync<RestaurantData>();
|
||||
var restaurantStateHandle = _restaurantState.LoadAssetAsync<RestaurantState>();
|
||||
|
||||
await restaurantDataHandle.Task;
|
||||
await restaurantStateHandle.Task;
|
||||
|
||||
RestaurantData = restaurantDataHandle.Result;
|
||||
RestaurantState = restaurantStateHandle.Result;
|
||||
|
||||
Debug.Assert(RestaurantData != null, "RestaurantData is null");
|
||||
Debug.Assert(RestaurantState != null, "RestaurantState is null");
|
||||
}
|
||||
|
||||
public async Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
|
@ -1,10 +1,9 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "RestaurantManagementDataSo", menuName = "RestaurantData/RestaurantManagementDataSo", order = 0)]
|
||||
public class RestaurantManagementDataSo : ScriptableObject
|
||||
[CreateAssetMenu(fileName = "RestaurantManagementData", menuName = "RestaurantData/RestaurantManagementData")]
|
||||
public class RestaurantManagementData : ScriptableObject
|
||||
{
|
||||
public ItemSlotUi ItemSlotUiPrefab;
|
||||
public TasteHashTagSlotUi TasteHashTagSlotUiPrefab;
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08fe1f67882cd7e459327a221731e453
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3aa53e94b0504f26bb0cee017d1dddbc
|
||||
timeCreated: 1755167516
|
@ -3,22 +3,22 @@
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "RestaurantPlayerDataSo", menuName = "RestaurantData/RestaurantPlayerDataSo")]
|
||||
public class RestaurantPlayerDataSo : ScriptableObject
|
||||
[CreateAssetMenu(fileName = "RestaurantPlayerData", menuName = "RestaurantData/RestaurantPlayerData")]
|
||||
public class RestaurantPlayerData : ScriptableObject
|
||||
{
|
||||
public GameObject PlayerPrefab;
|
||||
|
||||
public bool IsDrawLineDebug = true;
|
||||
|
||||
public bool IsMoveEnabled = true;
|
||||
public float MoveSpeed = 7f;
|
||||
public float MoveSpeed = 8.5f;
|
||||
public float Acceleration = 70f;
|
||||
public float Deceleration = 350f;
|
||||
|
||||
public bool IsDashEnabled = true;
|
||||
public float DashSpeed = 20f;
|
||||
public float DashTime = 0.2f;
|
||||
public float DashCooldown = 2f;
|
||||
public float DashCooldown = 0.5f;
|
||||
|
||||
[Tooltip("슬라이딩이 적용되지 않는 충돌체 레이어 (Ground 등)")]
|
||||
public LayerMask IgnoreSlidingLayerMask;
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 371f83c380e45a24fabb460707edb4fe
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5583898a24cc9c7419aec8b01ee0fde4
|
50
Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs
Normal file
50
Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "RestaurantData", menuName = "RestaurantData/RestaurantData", order = 0)]
|
||||
public class RestaurantData : ScriptableObject
|
||||
{
|
||||
[SerializeField] private AssetReference _restaurantPlayerData;
|
||||
[SerializeField] private AssetReference _restaurantManagementData;
|
||||
|
||||
public RestaurantPlayerData PlayerData { get; private set; }
|
||||
public RestaurantManagementData ManagementData { get; private set; }
|
||||
|
||||
private bool _isLoaded;
|
||||
|
||||
public async Task LoadData()
|
||||
{
|
||||
if (_isLoaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var restaurantPlayerDataHandle = _restaurantPlayerData.LoadAssetAsync<RestaurantPlayerData>();
|
||||
var restaurantManagementDataHandle = _restaurantManagementData.LoadAssetAsync<RestaurantManagementData>();
|
||||
|
||||
await restaurantPlayerDataHandle.Task;
|
||||
await restaurantManagementDataHandle.Task;
|
||||
|
||||
PlayerData = restaurantPlayerDataHandle.Result;
|
||||
ManagementData = restaurantManagementDataHandle.Result;
|
||||
|
||||
Debug.Assert(PlayerData != null, "RestaurantPlayerData is null");
|
||||
Debug.Assert(ManagementData != null, "RestaurantManagementData is null");
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (_isLoaded == false) return;
|
||||
|
||||
_restaurantPlayerData.ReleaseAsset();
|
||||
_restaurantManagementData.ReleaseAsset();
|
||||
|
||||
_isLoaded = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7629f78e30fa6a24d9fa5d09124410e4
|
@ -1,53 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "RestaurantDataSo", menuName = "RestaurantData/RestaurantDataSo", order = 0)]
|
||||
public class RestaurantDataSo : ScriptableSingleton<RestaurantDataSo>
|
||||
{
|
||||
[Header("Asset References")]
|
||||
[SerializeField] private AssetReference _restaurantPlayerDataSo;
|
||||
[SerializeField] private AssetReference _restaurantManagementDataSo;
|
||||
|
||||
public RestaurantPlayerDataSo PlayerData { get; private set; }
|
||||
public RestaurantManagementDataSo ManagementData { get; private set; }
|
||||
|
||||
private bool _isLoaded;
|
||||
|
||||
public async Task LoadData()
|
||||
{
|
||||
if (_isLoaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var playerHandle = _restaurantPlayerDataSo.LoadAssetAsync<RestaurantPlayerDataSo>();
|
||||
var managementHandle = _restaurantManagementDataSo.LoadAssetAsync<RestaurantManagementDataSo>();
|
||||
|
||||
await playerHandle.Task;
|
||||
await managementHandle.Task;
|
||||
|
||||
PlayerData = playerHandle.Result;
|
||||
ManagementData = managementHandle.Result;
|
||||
|
||||
Debug.Assert(PlayerData != null, "PlayerData is null");
|
||||
Debug.Assert(ManagementData != null, "ManagementData is null");
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
_restaurantPlayerDataSo.ReleaseAsset();
|
||||
_restaurantManagementDataSo.ReleaseAsset();
|
||||
|
||||
_isLoaded = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f47eda10f73c497d9894967fae3cd2d8
|
||||
timeCreated: 1755165774
|
@ -13,9 +13,9 @@ public bool ExecuteInteraction(IInteractor interactor, IInteractable interactabl
|
||||
return true;
|
||||
}
|
||||
|
||||
private RestaurantManagementStateSo GetManagementState()
|
||||
private RestaurantManagementState GetManagementState()
|
||||
{
|
||||
return RestaurantState.instance.ManagementState;
|
||||
return RestaurantController.Instance.RestaurantState.ManagementState;
|
||||
}
|
||||
|
||||
public bool CanExecuteInteraction(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payloadSo = null)
|
||||
|
@ -4,13 +4,12 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Sirenix.OdinInspector;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "RestaurantCustomerStateSo", menuName = "RestaurantState/RestaurantCustomerStateSo")]
|
||||
public class RestaurantCustomerStateSo : ScriptableObject, IGameFlowHandler
|
||||
[CreateAssetMenu(fileName = "RestaurantCustomerState", menuName = "RestaurantState/RestaurantCustomerState")]
|
||||
public class RestaurantCustomerState : ScriptableObject, IGameFlowHandler
|
||||
{
|
||||
[Title("스폰 제어")]
|
||||
[Tooltip("플로우 시작 후 첫 손님이 등장하기까지 대기 시간(초)")]
|
||||
@ -53,7 +52,7 @@ private async Task InitializeRunRestaurant()
|
||||
{
|
||||
_iCustomerFactory = new CustomerFactory();
|
||||
|
||||
var currentGameLevel = GameStateSo.instance.GameLevelStateSo.Level;
|
||||
var currentGameLevel = GameController.Instance.GameState.LevelState.Level;
|
||||
if (_levelDataSo == null)
|
||||
{
|
||||
_levelDataSo = DataManager.Instance.GetDataSo<LevelDataSo>();
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d17772ed772b03418ae2167783a305c
|
@ -16,8 +16,9 @@ public RestaurantPropLocation(string id, Vector2 position)
|
||||
Position = position;
|
||||
}
|
||||
}
|
||||
|
||||
public class RestaurantEnvironmentStateSo : ScriptableObject
|
||||
|
||||
[CreateAssetMenu(fileName = "RestaurantEnvironmentState", menuName = "RestaurantState/RestaurantEnvironmentState")]
|
||||
public class RestaurantEnvironmentState : ScriptableObject
|
||||
{
|
||||
public List<RestaurantPropLocation> Props = new List<RestaurantPropLocation>();
|
||||
public List<RestaurantPropLocation> Objects = new List<RestaurantPropLocation>();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user