diff --git a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset index ae5cdaee8..61fb24fef 100644 --- a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset +++ b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf20b1702cb92dfbe98f6340e6533f0300e44761cbafdff9bee0fb3404e673ad -size 23805 +oid sha256:d20a85268616dfd7559e8b9efe1e58f72a9cb6a91cad858e4f790a7704c44fc5 +size 26385 diff --git a/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab b/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab index 09f102b91..0117c967a 100644 --- a/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab @@ -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 diff --git a/Assets/_DDD/_Addressables/So/GameData.meta b/Assets/_DDD/_Addressables/So/GameData.meta new file mode 100644 index 000000000..735f3d219 --- /dev/null +++ b/Assets/_DDD/_Addressables/So/GameData.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: afe0250614f8af643a95058970e9f647 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Addressables/So/GameData/GameData.asset b/Assets/_DDD/_Addressables/So/GameData/GameData.asset new file mode 100644 index 000000000..07df3339f --- /dev/null +++ b/Assets/_DDD/_Addressables/So/GameData/GameData.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ee22eb98f65214d577983951e58f21cdcffed74244711225db4f48309efdd2e +size 566 diff --git a/Assets/_DDD/_Addressables/So/GameDataSo.asset.meta b/Assets/_DDD/_Addressables/So/GameData/GameData.asset.meta similarity index 100% rename from Assets/_DDD/_Addressables/So/GameDataSo.asset.meta rename to Assets/_DDD/_Addressables/So/GameData/GameData.asset.meta diff --git a/Assets/_DDD/_Addressables/So/GameData/GameLocalizationData.asset b/Assets/_DDD/_Addressables/So/GameData/GameLocalizationData.asset new file mode 100644 index 000000000..93cf810b8 --- /dev/null +++ b/Assets/_DDD/_Addressables/So/GameData/GameLocalizationData.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b12a8bd4ec1daad5ac96e457f9d8e7e171b3e1f8ab796324d1f8725d2dd952d +size 505 diff --git a/Assets/_DDD/_Addressables/So/GameStateSo.asset.meta b/Assets/_DDD/_Addressables/So/GameData/GameLocalizationData.asset.meta similarity index 79% rename from Assets/_DDD/_Addressables/So/GameStateSo.asset.meta rename to Assets/_DDD/_Addressables/So/GameData/GameLocalizationData.asset.meta index fbacb442f..dee8702eb 100644 --- a/Assets/_DDD/_Addressables/So/GameStateSo.asset.meta +++ b/Assets/_DDD/_Addressables/So/GameData/GameLocalizationData.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 094ff53715c99c54ea7e6702a6933228 +guid: acb945af9ef1953408e259003ddee155 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/_DDD/_Addressables/So/SmartStringGroup.asset b/Assets/_DDD/_Addressables/So/GameData/SmartStringGroup.asset similarity index 100% rename from Assets/_DDD/_Addressables/So/SmartStringGroup.asset rename to Assets/_DDD/_Addressables/So/GameData/SmartStringGroup.asset diff --git a/Assets/_DDD/_Addressables/So/SmartStringGroup.asset.meta b/Assets/_DDD/_Addressables/So/GameData/SmartStringGroup.asset.meta similarity index 100% rename from Assets/_DDD/_Addressables/So/SmartStringGroup.asset.meta rename to Assets/_DDD/_Addressables/So/GameData/SmartStringGroup.asset.meta diff --git a/Assets/_DDD/_Addressables/So/GameDataSo.asset b/Assets/_DDD/_Addressables/So/GameDataSo.asset deleted file mode 100644 index 66addf929..000000000 --- a/Assets/_DDD/_Addressables/So/GameDataSo.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bdecceb246289260286a99a01d924c12f90d1675b42abf4244f0307fdea369e1 -size 570 diff --git a/Assets/_DDD/_Addressables/So/GameLocalizationDataSo.asset b/Assets/_DDD/_Addressables/So/GameLocalizationDataSo.asset deleted file mode 100644 index a36bdf731..000000000 --- a/Assets/_DDD/_Addressables/So/GameLocalizationDataSo.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4cf8faae2b8c78c1804a7581c456f2c1e9791c7e977df782208bee8e54ed9b05 -size 507 diff --git a/Assets/_DDD/_Addressables/So/GameStateSo.asset b/Assets/_DDD/_Addressables/So/GameStateSo.asset deleted file mode 100644 index 26ffef5b3..000000000 --- a/Assets/_DDD/_Addressables/So/GameStateSo.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9141b1f43166655e46607dc6f63a13c25ab60fa517c58c97d59dd0199031d376 -size 411 diff --git a/Assets/_DDD/_Addressables/So/RestaurantData.meta b/Assets/_DDD/_Addressables/So/RestaurantData.meta new file mode 100644 index 000000000..cb8bf03b3 --- /dev/null +++ b/Assets/_DDD/_Addressables/So/RestaurantData.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 899d2f22a3c355740897ec6bdf2fb6d1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantData.asset b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantData.asset new file mode 100644 index 000000000..1738a474b --- /dev/null +++ b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantData.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f38d7227d17b6d46090e24c935f39c6f5187d8d53fbfedd1a29cf6f35dd1f82 +size 745 diff --git a/Assets/_DDD/_Addressables/So/RestaurantDataSo.asset.meta b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantData.asset.meta similarity index 79% rename from Assets/_DDD/_Addressables/So/RestaurantDataSo.asset.meta rename to Assets/_DDD/_Addressables/So/RestaurantData/RestaurantData.asset.meta index 0f70d8cd2..8d31b42c4 100644 --- a/Assets/_DDD/_Addressables/So/RestaurantDataSo.asset.meta +++ b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantData.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c702efebbff4144429b6f07cf841bc42 +guid: 2d86890c5ef774c4aae6870f0eeef0f5 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantManagementData.asset b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantManagementData.asset new file mode 100644 index 000000000..e3b105226 --- /dev/null +++ b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantManagementData.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8995b564fc56bef77202c03a2b1244f5ad12c848bc8d03682df227b505d2a2a8 +size 1003 diff --git a/Assets/_DDD/_Addressables/So/GameLocalizationDataSo.asset.meta b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantManagementData.asset.meta similarity index 79% rename from Assets/_DDD/_Addressables/So/GameLocalizationDataSo.asset.meta rename to Assets/_DDD/_Addressables/So/RestaurantData/RestaurantManagementData.asset.meta index e7c439ff0..db38a2b36 100644 --- a/Assets/_DDD/_Addressables/So/GameLocalizationDataSo.asset.meta +++ b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantManagementData.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9fac99a2d5b6eb240a64b9e010a22ac4 +guid: 1263bd88e8e68a94b853d23b321ed172 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantPlayerData.asset b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantPlayerData.asset new file mode 100644 index 000000000..da1a7b9da --- /dev/null +++ b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantPlayerData.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0feba0ccb8fc9f02626e4858a5dd9323f0537d17e6eb48261decfa1a5b55eff +size 1994 diff --git a/Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset.meta b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantPlayerData.asset.meta similarity index 79% rename from Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset.meta rename to Assets/_DDD/_Addressables/So/RestaurantData/RestaurantPlayerData.asset.meta index f065b1be5..9333877a1 100644 --- a/Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset.meta +++ b/Assets/_DDD/_Addressables/So/RestaurantData/RestaurantPlayerData.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d4af913216da4468ea23c8f910d86644 +guid: 1ad1a2be148524d4884f22ff233862e1 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/_DDD/_Addressables/So/RestaurantDataSo.asset b/Assets/_DDD/_Addressables/So/RestaurantDataSo.asset deleted file mode 100644 index 86c404522..000000000 --- a/Assets/_DDD/_Addressables/So/RestaurantDataSo.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e3e71453eefb8324f2f75708608b31b51a57ce3fd649c1f1132423c729b0f5ab -size 751 diff --git a/Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset b/Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset deleted file mode 100644 index d41d91a49..000000000 --- a/Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a622cbf827458ecee7b3b432db797b6784ac35ea1891015ff36cd0724f451ff2 -size 1005 diff --git a/Assets/_DDD/_Addressables/So/RestaurantPlayerDataSo.asset b/Assets/_DDD/_Addressables/So/RestaurantPlayerDataSo.asset deleted file mode 100644 index bf784e973..000000000 --- a/Assets/_DDD/_Addressables/So/RestaurantPlayerDataSo.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c5dac55c49e139f8386dcacf4c7fdfd1c3f6c5c8d7a4062a4fa93764e962ef2a -size 2001 diff --git a/Assets/_DDD/_Addressables/So/RestaurantPlayerDataSo.asset.meta b/Assets/_DDD/_Addressables/So/RestaurantPlayerDataSo.asset.meta deleted file mode 100644 index dca4d19af..000000000 --- a/Assets/_DDD/_Addressables/So/RestaurantPlayerDataSo.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ddb0db863be8f254bb8a8f07d39a960e -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/_DDD/_ScriptAssets/Prefabs/GameController.prefab b/Assets/_DDD/_ScriptAssets/Prefabs/GameController.prefab index 8f00f38eb..70a2042cd 100644 --- a/Assets/_DDD/_ScriptAssets/Prefabs/GameController.prefab +++ b/Assets/_DDD/_ScriptAssets/Prefabs/GameController.prefab @@ -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 diff --git a/Assets/_DDD/_ScriptAssets/Prefabs/RestaurantController.prefab b/Assets/_DDD/_ScriptAssets/Prefabs/RestaurantController.prefab index 922f1da23..26e824944 100644 --- a/Assets/_DDD/_ScriptAssets/Prefabs/RestaurantController.prefab +++ b/Assets/_DDD/_ScriptAssets/Prefabs/RestaurantController.prefab @@ -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 diff --git a/Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset b/Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset index 39efc89d5..cfa713405 100644 --- a/Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset +++ b/Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b96712e0293df2bec2b51abf1b2ec239a4aaae75a3d2cfa311159772391598a +oid sha256:2cc6e792afdc31275ecdb437ed91664bf5775f4941fd12acec40b2e92647c871 size 1504 diff --git a/Assets/_DDD/_Scripts/GameController/GameController.cs b/Assets/_DDD/_Scripts/GameController/GameController.cs index ef28e2fc6..e55d54ab9 100644 --- a/Assets/_DDD/_Scripts/GameController/GameController.cs +++ b/Assets/_DDD/_Scripts/GameController/GameController.cs @@ -2,27 +2,30 @@ using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; +using UnityEngine.AddressableAssets; namespace DDD { public class GameController : Singleton, IManager, IGameFlowHandler { - private static readonly List GameFlowControllerTypes = new(); - - public GameDataSo GetGameData() => GameDataSo.instance; - public GameStateSo GetGameState() => GameStateSo.instance; + [SerializeField] private AssetReference _gameData; + + public GameData GameData { get; private set; } + public GameState GameState { get; private set; } private List _gameFlowControllers = new(); + private static readonly List GameFlowControllerTypes = new(); public void PreInit() { + LoadOrCreateRestaurantState(); RegisterFlowHandler(); } public async Task Init() { await LoadData(); - await GameDataSo.instance.LoadData(); + await GameData.LoadData(); await InitializeAllFlowControllers(); } @@ -30,6 +33,12 @@ public void PostInit() { } + private void LoadOrCreateRestaurantState() + { + // TODO : Load states from saved files. if none, create them. + GameState = ScriptableObject.CreateInstance(); + } + private void RegisterFlowHandler() { GameFlowManager.Instance.FlowHandlers.Add(this); @@ -53,9 +62,17 @@ private async Task InitializeAllFlowControllers() } } - private Task LoadData() + private async Task LoadData() { - return Task.CompletedTask; + var gameDataHandle = _gameData.LoadAssetAsync(); + + await gameDataHandle.Task; + + GameData = gameDataHandle.Result; + + Debug.Assert(GameData != null, "GameData is null"); + + await Task.CompletedTask; } public async Task OnReadyNewFlow(GameFlowState newFlowState) diff --git a/Assets/_DDD/_Scripts/GameData/GameData.cs b/Assets/_DDD/_Scripts/GameData/GameData.cs new file mode 100644 index 000000000..f6bc5666c --- /dev/null +++ b/Assets/_DDD/_Scripts/GameData/GameData.cs @@ -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(); + 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; + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameData/GameData.cs.meta b/Assets/_DDD/_Scripts/GameData/GameData.cs.meta new file mode 100644 index 000000000..5f99b4bf7 --- /dev/null +++ b/Assets/_DDD/_Scripts/GameData/GameData.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f8cbc44b1cb7bac479f9786f96c5dc80 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameData/GameDataSo.cs b/Assets/_DDD/_Scripts/GameData/GameDataSo.cs deleted file mode 100644 index 9569c6f9c..000000000 --- a/Assets/_DDD/_Scripts/GameData/GameDataSo.cs +++ /dev/null @@ -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 - { - [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(); - - 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; - } - } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameData/GameDataSo.cs.meta b/Assets/_DDD/_Scripts/GameData/GameDataSo.cs.meta deleted file mode 100644 index c302b4a7a..000000000 --- a/Assets/_DDD/_Scripts/GameData/GameDataSo.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: ba8a1173c4b34e247b6e12aa3833848f \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameData/GameLocalizationDataSo.cs b/Assets/_DDD/_Scripts/GameData/GameLocalizationData.cs similarity index 51% rename from Assets/_DDD/_Scripts/GameData/GameLocalizationDataSo.cs rename to Assets/_DDD/_Scripts/GameData/GameLocalizationData.cs index 932733072..cbd91a96e 100644 --- a/Assets/_DDD/_Scripts/GameData/GameLocalizationDataSo.cs +++ b/Assets/_DDD/_Scripts/GameData/GameLocalizationData.cs @@ -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; } diff --git a/Assets/_DDD/_Scripts/GameData/GameLocalizationData.cs.meta b/Assets/_DDD/_Scripts/GameData/GameLocalizationData.cs.meta new file mode 100644 index 000000000..bbfc95b8a --- /dev/null +++ b/Assets/_DDD/_Scripts/GameData/GameLocalizationData.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c518e485d790cf446a3d0e7e9b5e2348 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameData/GameLocalizationDataSo.cs.meta b/Assets/_DDD/_Scripts/GameData/GameLocalizationDataSo.cs.meta deleted file mode 100644 index f56966f61..000000000 --- a/Assets/_DDD/_Scripts/GameData/GameLocalizationDataSo.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: a5d17e00386b555438f1598afa5f10d6 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs index 3e5b16402..5d04adfdd 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs @@ -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(); diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/SmartStringVariables.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/SmartStringVariables.cs index 506679cb5..8234cca30 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/SmartStringVariables.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/SmartStringVariables.cs @@ -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(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(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)) { diff --git a/Assets/_DDD/_Scripts/GameState/GameLevelStateSo.cs b/Assets/_DDD/_Scripts/GameState/GameLevelState.cs similarity index 95% rename from Assets/_DDD/_Scripts/GameState/GameLevelStateSo.cs rename to Assets/_DDD/_Scripts/GameState/GameLevelState.cs index 8c621a0dc..ecaae8fda 100644 --- a/Assets/_DDD/_Scripts/GameState/GameLevelStateSo.cs +++ b/Assets/_DDD/_Scripts/GameState/GameLevelState.cs @@ -2,7 +2,7 @@ namespace DDD { - public class GameLevelStateSo : ScriptableObject + public class GameLevelState : ScriptableObject { public int Level = 1; diff --git a/Assets/_DDD/_Scripts/GameState/GameLevelState.cs.meta b/Assets/_DDD/_Scripts/GameState/GameLevelState.cs.meta new file mode 100644 index 000000000..692fdaf89 --- /dev/null +++ b/Assets/_DDD/_Scripts/GameState/GameLevelState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 39c94e10e2c3ed94db2c04949059499e \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameState/GameLevelStateSo.cs.meta b/Assets/_DDD/_Scripts/GameState/GameLevelStateSo.cs.meta deleted file mode 100644 index c08a282d1..000000000 --- a/Assets/_DDD/_Scripts/GameState/GameLevelStateSo.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 8b38b5ba62c327b48a2a8f60869bf45a \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameState/GameState.cs b/Assets/_DDD/_Scripts/GameState/GameState.cs new file mode 100644 index 000000000..e87610fc5 --- /dev/null +++ b/Assets/_DDD/_Scripts/GameState/GameState.cs @@ -0,0 +1,17 @@ +using UnityEngine; +using UnityEngine.AddressableAssets; + +namespace DDD +{ + public class GameState : ScriptableObject + { + [SerializeField] private AssetReference _gameLevelState; + + public GameLevelState LevelState { get; private set; } + + private void OnEnable() + { + LevelState = CreateInstance(); + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameState/GameState.cs.meta b/Assets/_DDD/_Scripts/GameState/GameState.cs.meta new file mode 100644 index 000000000..25fcefe95 --- /dev/null +++ b/Assets/_DDD/_Scripts/GameState/GameState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cd102dd3c3e47a1459dc9fe624f7cb0c \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameState/GameStateSo.cs b/Assets/_DDD/_Scripts/GameState/GameStateSo.cs deleted file mode 100644 index 67134ae2f..000000000 --- a/Assets/_DDD/_Scripts/GameState/GameStateSo.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Threading.Tasks; -using UnityEditor; -using UnityEngine; - -namespace DDD -{ - [CreateAssetMenu(fileName = "GameStateSo", menuName = "GameState/GameStateSo")] - public class GameStateSo : ScriptableSingleton - { - public GameLevelStateSo GameLevelStateSo { get; private set; } - - private void OnEnable() - { - GameLevelStateSo = CreateInstance(); - } - } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameState/GameStateSo.cs.meta b/Assets/_DDD/_Scripts/GameState/GameStateSo.cs.meta deleted file mode 100644 index ee8a46b05..000000000 --- a/Assets/_DDD/_Scripts/GameState/GameStateSo.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 9b8aa6c32ff3e8b49bc8365e3a6e2218 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ChecklistView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ChecklistView.cs index 61e3289e9..5ebdb649c 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ChecklistView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ChecklistView.cs @@ -25,11 +25,11 @@ public class ChecklistView : MonoBehaviour, IEventHandler, {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(3); _checklistDatas = GetComponentsInChildren().ToList(); diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs index 4b63493be..e179eb69a 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs @@ -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) diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventoryView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventoryView.cs index 3058a987c..13b7c0912 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventoryView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventoryView.cs @@ -10,8 +10,8 @@ public class InventoryView : MonoBehaviour, IEventHandler { [SerializeField] private Transform _slotParent; - private RestaurantManagementDataSo restaurantManagementDataSo; - private RestaurantManagementStateSo restaurantManagementStateSo; + private RestaurantManagementData restaurantManagementDataSo; + private RestaurantManagementState restaurantManagementStateSo; private InventoryCategoryType _currenInventoryCategoryType = InventoryCategoryType.Food; private readonly Dictionary _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(); diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ItemDetailView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ItemDetailView.cs index 789e8214b..dcc9dfa26 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ItemDetailView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ItemDetailView.cs @@ -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 _tasteHashTagSlotUis = new(); private ItemViewModel _currentItemViewModel; @@ -40,11 +39,6 @@ private void Start() private void OnEnable() { - if (restaurantManagementDataSo == null) - { - restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData; - } - EventBus.Register(this); } @@ -53,6 +47,11 @@ private void OnDisable() EventBus.Unregister(this); } + public void Initialize() + { + restaurantManagementDataSo = RestaurantController.Instance.RestaurantData.ManagementData; + } + public void Invoke(ItemSlotSelectedEvent evt) { Show(evt.Model); diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/RestaurantManagementUi.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/RestaurantManagementUi.cs index b094e25b9..28977f600 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/RestaurantManagementUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/RestaurantManagementUi.cs @@ -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(); } diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs index 5b0739b2a..32ff38f3d 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs @@ -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); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs index 308158b71..47a9bf655 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs @@ -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; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs index 7d6c74aa7..cb08f7142 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs @@ -12,8 +12,8 @@ public class TodayMenuView : MonoBehaviour, IEventHandler, private List _foodSlots; private List _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) { diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs index c264c502e..443aef47a 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs @@ -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); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs index 6948c8f64..92830d63c 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs @@ -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; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs index 70f0a82b1..c97db971e 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs @@ -12,8 +12,8 @@ public class TodayRestaurantStateView : MonoBehaviour, IEventHandler _workerSlots; private List _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) { diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs index 3919264cc..82a01cb85 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs @@ -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; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerAnimation.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerAnimation.cs new file mode 100644 index 000000000..0c140f5f2 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerAnimation.cs @@ -0,0 +1,47 @@ +using UnityEngine; + +namespace DDD +{ + public class RestaurantPlayerAnimation : RestaurantCharacterAnimation + { + private RestaurantPlayerMovement _restaurantPlayerMovement; + + protected override void Awake() + { + base.Awake(); + + _restaurantPlayerMovement = GetComponent(); + } + + 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); + } + + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerAnimation.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerAnimation.cs.meta new file mode 100644 index 000000000..bf6653ff9 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerAnimation.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6ea5b6b4333d6fa4392d4d0a09d97242 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs index 3d71fce80..4d5160068 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs @@ -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; diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs index bf58e577b..7ea8e0740 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs @@ -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)); diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs index 5257a9761..578d6779c 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs @@ -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) diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterAnimation.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterAnimation.cs index 51ea4eeb4..13c0d4069 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterAnimation.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterAnimation.cs @@ -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(); _spineController = GetComponent(); } - 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() diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantEnvironmentController.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantEnvironmentController.cs index e8b8cc896..609f59a57 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantEnvironmentController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantEnvironmentController.cs @@ -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; } diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantManagementController.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantManagementController.cs index 053b3d9b9..e16b28c25 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantManagementController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantManagementController.cs @@ -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; } diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs index 6972d1e1b..ca7338ba9 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs @@ -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; } diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Run/Customer/RestaurantCustomerStateSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Run/Customer/RestaurantCustomerStateSo.cs.meta deleted file mode 100644 index cbadc045a..000000000 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Run/Customer/RestaurantCustomerStateSo.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 545b3710d04aa3e48923f79f03b5dfc5 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantEnvironment.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantEnvironment.cs index c203fa67c..e61d338a5 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantEnvironment.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantEnvironment.cs @@ -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 diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantPlayer.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantPlayer.cs index b6da0e8c4..fbee756b5 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantPlayer.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantPlayer.cs @@ -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이 설정되지 않았습니다!"); diff --git a/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs b/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs index 4817f6d83..e3d82a1a2 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs @@ -2,11 +2,19 @@ using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; +using UnityEngine.AddressableAssets; namespace DDD { public class RestaurantController : Singleton, IManager, IGameFlowHandler { + [SerializeField] private AssetReference _restaurantData; + + public RestaurantData RestaurantData { get; private set; } + public RestaurantState RestaurantState { get; private set; } + + private List _restaurantFlowControllers = new(); + // static definitions private static readonly List RestaurantFlowControllerTypes = new() { @@ -17,20 +25,16 @@ public class RestaurantController : Singleton, IManager, I typeof(RestaurantGlobalMessageController) }; - public RestaurantState GetRestaurantState() => RestaurantState.instance; - public RestaurantDataSo RestaurantData() => RestaurantDataSo.instance; - - private List _restaurantFlowControllers = new(); - public void PreInit() { + LoadOrCreateRestaurantState(); RegisterFlowHandler(); } public async Task Init() { await LoadData(); - await RestaurantDataSo.instance.LoadData(); + await RestaurantData.LoadData(); await InitializeAllFlowControllers(); } @@ -38,6 +42,12 @@ public void PostInit() { } + private void LoadOrCreateRestaurantState() + { + // TODO : Load states from saved files. if none, create them. + RestaurantState = ScriptableObject.CreateInstance(); + } + private void RegisterFlowHandler() { GameFlowManager.Instance.FlowHandlers.Add(this); @@ -57,13 +67,19 @@ 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(); + + await restaurantDataHandle.Task; + + RestaurantData = restaurantDataHandle.Result; + + Debug.Assert(RestaurantData != null, "RestaurantData is null"); } public async Task OnReadyNewFlow(GameFlowState newFlowState) diff --git a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementData.cs similarity index 63% rename from Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs rename to Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementData.cs index f771274ff..e760073a7 100644 --- a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementData.cs @@ -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; diff --git a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementData.cs.meta b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementData.cs.meta new file mode 100644 index 000000000..145c72e16 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementData.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 08fe1f67882cd7e459327a221731e453 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs.meta deleted file mode 100644 index ed04a0518..000000000 --- a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 3aa53e94b0504f26bb0cee017d1dddbc -timeCreated: 1755167516 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerDataSo.cs b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerData.cs similarity index 86% rename from Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerDataSo.cs rename to Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerData.cs index 3b65efbdc..6d47993fb 100644 --- a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerDataSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerData.cs @@ -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; diff --git a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerData.cs.meta b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerData.cs.meta new file mode 100644 index 000000000..9e2697f87 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerData.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 371f83c380e45a24fabb460707edb4fe \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerDataSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerDataSo.cs.meta deleted file mode 100644 index 91a52aca2..000000000 --- a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantPlayerDataSo.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 5583898a24cc9c7419aec8b01ee0fde4 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs b/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs new file mode 100644 index 000000000..c87be817e --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs @@ -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(); + var restaurantManagementDataHandle = _restaurantManagementData.LoadAssetAsync(); + + 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; + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs.meta b/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs.meta new file mode 100644 index 000000000..c1aa4f2a3 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 7629f78e30fa6a24d9fa5d09124410e4 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs b/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs deleted file mode 100644 index 8fb226113..000000000 --- a/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs +++ /dev/null @@ -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 - { - [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(); - var managementHandle = _restaurantManagementDataSo.LoadAssetAsync(); - - 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; - } - } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs.meta deleted file mode 100644 index 08261b57c..000000000 --- a/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f47eda10f73c497d9894967fae3cd2d8 -timeCreated: 1755165774 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantEvent/Solvers/RestaurantOpenEventSolver.cs b/Assets/_DDD/_Scripts/RestaurantEvent/Solvers/RestaurantOpenEventSolver.cs index 62895bf8d..ec7aaa66d 100644 --- a/Assets/_DDD/_Scripts/RestaurantEvent/Solvers/RestaurantOpenEventSolver.cs +++ b/Assets/_DDD/_Scripts/RestaurantEvent/Solvers/RestaurantOpenEventSolver.cs @@ -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) diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Run/Customer/RestaurantCustomerStateSo.cs b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs similarity index 94% rename from Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Run/Customer/RestaurantCustomerStateSo.cs rename to Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs index c1287e258..9e9f1ca13 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Run/Customer/RestaurantCustomerStateSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs @@ -4,13 +4,11 @@ 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 + public class RestaurantCustomerState : ScriptableObject, IGameFlowHandler { [Title("스폰 제어")] [Tooltip("플로우 시작 후 첫 손님이 등장하기까지 대기 시간(초)")] @@ -53,7 +51,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(); diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs.meta new file mode 100644 index 000000000..c7d5d8b53 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3d17772ed772b03418ae2167783a305c \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentStateSo.cs b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentState.cs similarity index 88% rename from Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentStateSo.cs rename to Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentState.cs index 495215698..75313179a 100644 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentStateSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentState.cs @@ -16,8 +16,8 @@ public RestaurantPropLocation(string id, Vector2 position) Position = position; } } - - public class RestaurantEnvironmentStateSo : ScriptableObject + + public class RestaurantEnvironmentState : ScriptableObject { public List Props = new List(); public List Objects = new List(); diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentState.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentState.cs.meta new file mode 100644 index 000000000..d2e6658c6 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 455a13ee6f37a9045b991a04bd50990e \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentStateSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentStateSo.cs.meta deleted file mode 100644 index 70b77fd9b..000000000 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantEnvironmentStateSo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 0c87c6773ca54d81ab1d8c2e218081c4 -timeCreated: 1752729814 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementStateSo.cs b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs similarity index 98% rename from Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementStateSo.cs rename to Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs index 56e8cebf1..7b375b979 100644 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementStateSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs @@ -1,12 +1,11 @@ using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Sirenix.OdinInspector; using UnityEngine; namespace DDD { - public class RestaurantManagementStateSo : ScriptableObject + public class RestaurantManagementState : ScriptableObject { // TODO : 데이터에서 초기화하고, 동적으로 변경 [Title("오늘의 레스토랑 상태")] @@ -85,9 +84,9 @@ public bool IsOpenable() return _isOpenable; } - public RestaurantManagementDataSo GetManagementData() + public RestaurantManagementData GetManagementData() { - return RestaurantDataSo.instance.ManagementData; + return RestaurantController.Instance.RestaurantData.ManagementData; } public bool TryAddTodayMenu(ItemViewModel model) diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs.meta new file mode 100644 index 000000000..8be914f57 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c7e8d13f86beb24448dfdf32a9a2ec84 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementStateSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementStateSo.cs.meta deleted file mode 100644 index 745e5a34c..000000000 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementStateSo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 417ea9eca99e49afbf587feb3ca92d1b -timeCreated: 1753423256 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerState.cs b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerState.cs new file mode 100644 index 000000000..b5a8deaf1 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerState.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace DDD +{ + public class RestaurantPlayerState : ScriptableObject + { + + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerState.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerState.cs.meta new file mode 100644 index 000000000..f00f9d218 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: be875321f169f8c4d954d79de98044cd \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerStateSo.cs b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerStateSo.cs deleted file mode 100644 index 96f4154f2..000000000 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerStateSo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEngine; - -namespace DDD -{ - public class RestaurantPlayerStateSo : ScriptableObject - { - - } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerStateSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerStateSo.cs.meta deleted file mode 100644 index 602cfff1d..000000000 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantPlayerStateSo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: cc65892536714c08bc2cd202851e0c0f -timeCreated: 1755168640 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunStateSo.cs b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunState.cs similarity index 50% rename from Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunStateSo.cs rename to Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunState.cs index da9add6fa..7f730ffcc 100644 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunStateSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunState.cs @@ -2,7 +2,7 @@ namespace DDD { - public class RestaurantRunStateSo : ScriptableObject + public class RestaurantRunState : ScriptableObject { } diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunState.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunState.cs.meta new file mode 100644 index 000000000..06405ba81 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6aa8d89cce5661e4e8719edbeb38d268 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunStateSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunStateSo.cs.meta deleted file mode 100644 index bbf49ab16..000000000 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantRunStateSo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 692fb4e2437a48768e4bcf5a57d2883d -timeCreated: 1755153808 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs b/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs index 2b74641a5..1d3533637 100644 --- a/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs @@ -1,24 +1,22 @@ -using UnityEditor; using UnityEngine; namespace DDD { - public class RestaurantState : ScriptableSingleton + public class RestaurantState : ScriptableObject { - public RestaurantManagementStateSo ManagementState { get; private set; } - public RestaurantRunStateSo RunState { get; private set; } - public RestaurantEnvironmentStateSo EnvironmentState { get; private set; } - public RestaurantPlayerStateSo PlayerState { get; private set; } - public RestaurantCustomerStateSo CustomerState { get; private set; } - - // TODO : Load from disk(SaveData) + public RestaurantManagementState ManagementState { get; private set; } + public RestaurantRunState RunState { get; private set; } + public RestaurantEnvironmentState EnvironmentState { get; private set; } + public RestaurantPlayerState PlayerState { get; private set; } + public RestaurantCustomerState CustomerState { get; private set; } + private void OnEnable() { - ManagementState = CreateInstance(); - RunState = CreateInstance(); - EnvironmentState = CreateInstance(); - PlayerState = CreateInstance(); - CustomerState = CreateInstance(); + ManagementState = CreateInstance(); + RunState = CreateInstance(); + EnvironmentState = CreateInstance(); + PlayerState = CreateInstance(); + CustomerState = CreateInstance(); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Utilities/Constants.cs b/Assets/_DDD/_Scripts/Utilities/Constants.cs index 5b5fd16a6..b383b9120 100644 --- a/Assets/_DDD/_Scripts/Utilities/Constants.cs +++ b/Assets/_DDD/_Scripts/Utilities/Constants.cs @@ -35,7 +35,7 @@ public static class DataConstants public const string CustomerNpcPrefab = "CustomerNpc"; } - public static class RestaurantPlayerAnimation + public static class RestaurantPlayerAnimationType { public const string Idle = "Idle"; public const string Walk = "RunFast";