46 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
/// <summary>
/// Главный загрузчик.
/// </summary>
public class MainBootstrap : MonoBehaviour
{
[SerializeField] private ConfigCatalog ConfigCatalog;
[SerializeField] private In.InputType InputType;
private void Awake() => InitializeMangers();
private void InitializeMangers()
{
if (ConfigCatalog == null)
{
Debug.LogError("Не указан каталог конфигов", this);
return;
}
var catalogValidatinResult = ConfigCatalog.ValidateReferences();
if (!catalogValidatinResult.OK)
{
Debug.LogError($"Ошибка в каталоге конфига: \n{catalogValidatinResult.message}", this);
return;
}
#region Инициализации
UnityMainThreadDispatcher.Initialize();
ComPortController.Initialize(ControllerConfig.LoadOrCreate());
ComPortController.PaymentReceived += WalletManager.OnCoin;
WalletManager.Initialize(ConfigCatalog.WalletManagerConfig);
GameModesHolder.Initialize(ConfigCatalog.GameModesConfig);
In.Initialize(In.GetInputSourceByType(InputType));
#endregion
Debug.Log("Главный загрузчик отработал");
BootstrapperState.MainBootstraped = true;
SceneLoader.LoadScene("Menu");
}
}