diff --git a/src/Visual novel/Assets/_Project/Scenes/0.Bootstrap.unity b/src/Visual novel/Assets/_Project/Scenes/0.Bootstrap.unity index e635d58..a9b8276 100644 --- a/src/Visual novel/Assets/_Project/Scenes/0.Bootstrap.unity +++ b/src/Visual novel/Assets/_Project/Scenes/0.Bootstrap.unity @@ -120,6 +120,41 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &786270577 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 109254, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} + m_PrefabInstance: {fileID: 1155182340} + m_PrefabAsset: {fileID: 0} +--- !u!114 &786270582 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786270577} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_MoveRepeatDelay: 0.5 + m_MoveRepeatRate: 0.1 + m_XRTrackingOrigin: {fileID: 0} + m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_DeselectOnBackgroundClick: 1 + m_PointerBehavior: 0 + m_CursorLockBehavior: 0 --- !u!1001 &1155182340 PrefabInstance: m_ObjectHideFlags: 0 @@ -416,10 +451,14 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -18 objectReference: {fileID: 0} - m_RemovedComponents: [] + m_RemovedComponents: + - {fileID: 11492840, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 109254, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} + insertIndex: -1 + addedObject: {fileID: 786270582} m_SourcePrefab: {fileID: 100100000, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} --- !u!1 &1611659631 GameObject: @@ -459,7 +498,7 @@ Transform: m_GameObject: {fileID: 1611659631} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 79.3, y: 159.35703, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Bootstrap/Bootstrap.cs b/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Bootstrap/Bootstrap.cs index 0d35aec..24843bf 100644 --- a/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Bootstrap/Bootstrap.cs +++ b/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Bootstrap/Bootstrap.cs @@ -17,7 +17,7 @@ namespace Infrastructure.ScenesManagers.Bootstrap { public class Bootstrap : MonoBehaviour, ICoroutineRunner { - private void Awake() + private void Start() { ServicesInitialize(); GameLoading(); diff --git a/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Loading/Loading.cs b/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Loading/Loading.cs index 836e669..26fba39 100644 --- a/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Loading/Loading.cs +++ b/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Loading/Loading.cs @@ -2,112 +2,104 @@ using System; using System.Threading.Tasks; -using Data.Dynamic; using Infrastructure.Services; using Infrastructure.Services.LocalisationDataLoad; using Infrastructure.Services.LocalizationUI; -using Infrastructure.Services.SaveLoadData; using Infrastructure.Services.UIFactory; using UnityEngine; -using UnityEngine.Events; using UnityEngine.SceneManagement; #endregion namespace Infrastructure.ScenesManagers.Loading { - public class Loading : MonoBehaviour - { - private string _language = ""; - private ILocalisationDataLoadService _localisationDataLoad; - private ILocalizerUI _localizerUI; - private IUIFactoryService _uiFactory; - private IUIFactoryInfoService _uiFactoryInfo; - - private async void Start() - { - InitializedServices(); - await CreatedUI(); - RegisterLocalizableUI(); - await LoadData(); - LocalisationUI(); - StartGame(); - } - - private void InitializedServices() - { - _localisationDataLoad = ServicesContainer.GetService(); - _uiFactoryInfo = ServicesContainer.GetService(); - _uiFactory = ServicesContainer.GetService(); - _localizerUI = ServicesContainer.GetService(); - } - - private async Task CreatedUI() - { - await _uiFactory.CreatedBackgroundScreen(); - _uiFactoryInfo.BackgroundUI.SetBackgroundColor(Color.black); - - await _uiFactory.CreatedChooseLanguageScreen(); - _uiFactoryInfo.ChooseLanguageUI.SetActivePanel(true); - - await _uiFactory.CreatedDialogueScreen(); - _uiFactoryInfo.DialogueUI.SetActivePanel(false); - - await _uiFactory.CreatedMainMenuScreen(); - _uiFactoryInfo.MainMenuUI.SetActivePanel(false); - - await _uiFactory.CreatedConfirmationScreen(); - _uiFactoryInfo.ConfirmationUI.SetActivePanel(false); - - await _uiFactory.CreatedSaveLoadScreen(); - _uiFactoryInfo.SaveLoadUI.SetActivePanel(false); - - await _uiFactory.CreatedLastWordsScreen(); - _uiFactoryInfo.LastWordsUI.SetActivePanel(false); - } - - private void RegisterLocalizableUI() - { - _localizerUI.Register(_uiFactoryInfo.DialogueUI); - _localizerUI.Register(_uiFactoryInfo.MainMenuUI); - _localizerUI.Register(_uiFactoryInfo.ConfirmationUI); - _localizerUI.Register(_uiFactoryInfo.SaveLoadUI); - } - - private async Task LoadData() - { - var localizationsInfo = _localisationDataLoad.GetLocalizationsInfo(); - var addLanguageInScrollView = new Action( - _uiFactoryInfo.ChooseLanguageUI.ScrollViewLanguages.AddLanguageInScrollView); - - foreach (var localizationInfo in localizationsInfo) - { - addLanguageInScrollView.Invoke( - localizationInfo.Language, - () => _language = localizationInfo.Language); - } - - await Task.Run( - () => - { - while (_language == "") - { - } - }); - - _localisationDataLoad.Load(_language); - } - - private void LocalisationUI() - { - var uiLocalisation = _localisationDataLoad.GetUILocalisation(); - _localizerUI.Localize(uiLocalisation); - } - - private void StartGame() - { - SceneManager.LoadScene("2.Meta"); - _uiFactoryInfo.ChooseLanguageUI.SetActivePanel(false); - } - } + public class Loading : MonoBehaviour + { + private string _language = ""; + private ILocalisationDataLoadService _localisationDataLoad; + private ILocalizerUI _localizerUI; + private IUIFactoryService _uiFactory; + private IUIFactoryInfoService _uiFactoryInfo; + + private async void Start() + { + InitializedServices(); + await CreatedUI(); + RegisterLocalizableUI(); + LoadData(() => + { + LocalisationUI(); + StartGame(); + }); + } + + private void InitializedServices() + { + _localisationDataLoad = ServicesContainer.GetService(); + _uiFactoryInfo = ServicesContainer.GetService(); + _uiFactory = ServicesContainer.GetService(); + _localizerUI = ServicesContainer.GetService(); + } + + private async Task CreatedUI() + { + await _uiFactory.CreatedBackgroundScreen(); + _uiFactoryInfo.BackgroundUI.SetBackgroundColor(Color.black); + + await _uiFactory.CreatedChooseLanguageScreen(); + _uiFactoryInfo.ChooseLanguageUI.SetActivePanel(true); + + await _uiFactory.CreatedDialogueScreen(); + _uiFactoryInfo.DialogueUI.SetActivePanel(false); + + await _uiFactory.CreatedMainMenuScreen(); + _uiFactoryInfo.MainMenuUI.SetActivePanel(false); + + await _uiFactory.CreatedConfirmationScreen(); + _uiFactoryInfo.ConfirmationUI.SetActivePanel(false); + + await _uiFactory.CreatedSaveLoadScreen(); + _uiFactoryInfo.SaveLoadUI.SetActivePanel(false); + + await _uiFactory.CreatedLastWordsScreen(); + _uiFactoryInfo.LastWordsUI.SetActivePanel(false); + } + + private void RegisterLocalizableUI() + { + _localizerUI.Register(_uiFactoryInfo.DialogueUI); + _localizerUI.Register(_uiFactoryInfo.MainMenuUI); + _localizerUI.Register(_uiFactoryInfo.ConfirmationUI); + _localizerUI.Register(_uiFactoryInfo.SaveLoadUI); + } + + private void LoadData(Action onCompleted) + { + var localizationsInfo = _localisationDataLoad.GetLocalizationsInfo(); + + foreach (var localizationInfo in localizationsInfo) + { + _uiFactoryInfo.ChooseLanguageUI.ScrollViewLanguages.AddLanguageInScrollView( + localizationInfo.Language, + () => + { + _language = localizationInfo.Language; + _localisationDataLoad.Load(_language); + onCompleted?.Invoke(); + }); + } + } + + private void LocalisationUI() + { + var uiLocalisation = _localisationDataLoad.GetUILocalisation(); + _localizerUI.Localize(uiLocalisation); + } + + private void StartGame() + { + SceneManager.LoadScene("2.Meta"); + _uiFactoryInfo.ChooseLanguageUI.SetActivePanel(false); + } + } } \ No newline at end of file diff --git a/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Meta/Meta.cs b/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Meta/Meta.cs index f2a376a..8490b78 100644 --- a/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Meta/Meta.cs +++ b/src/Visual novel/Assets/_Project/Scripts/Infrastructure/ScenesManagers/Meta/Meta.cs @@ -25,7 +25,7 @@ public class Meta : MonoBehaviour private IUIFactoryInfoService _uiFactoryInfo; private ISoundsService _soundsService; - private void Awake() + private void Start() { InitializedServices(); diff --git a/src/Visual novel/Assets/_Project/Scripts/UI/MainMenu/ButtonsUI.cs b/src/Visual novel/Assets/_Project/Scripts/UI/MainMenu/ButtonsUI.cs index eedda63..d237b0e 100644 --- a/src/Visual novel/Assets/_Project/Scripts/UI/MainMenu/ButtonsUI.cs +++ b/src/Visual novel/Assets/_Project/Scripts/UI/MainMenu/ButtonsUI.cs @@ -20,6 +20,13 @@ public class ButtonsUI : MonoBehaviour [SerializeField] private TextMeshProUGUI _startGameButtonText; [SerializeField] private TextMeshProUGUI _exitButtonText; + private void Awake() + { +#if UNITY_WEBGL + _exitButton.gameObject.SetActive(false); +#endif + } + public void RegisterLoadGameButtonCallback(UnityAction action) { _loadGameButton.RegisterNewCallback(action); diff --git a/src/Visual novel/Assets/_Project/Scripts/UI/MainMenu/MainMenuUI.cs b/src/Visual novel/Assets/_Project/Scripts/UI/MainMenu/MainMenuUI.cs index 2d04a1f..f9f40c9 100644 --- a/src/Visual novel/Assets/_Project/Scripts/UI/MainMenu/MainMenuUI.cs +++ b/src/Visual novel/Assets/_Project/Scripts/UI/MainMenu/MainMenuUI.cs @@ -1,5 +1,6 @@ #region +using System; using Data.Localization.UILocalisation; using Infrastructure.Services.LocalizationUI; using UnityEngine;