46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
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");
|
||
}
|
||
}
|