51 lines
No EOL
1.5 KiB
C#
51 lines
No EOL
1.5 KiB
C#
using ShiroginSDK.Runtime.Services.Registry;
|
|
using ShiroginSDK.Runtime.Shared.Constants;
|
|
using UnityEngine;
|
|
|
|
namespace ShiroginSDK.Runtime.Core.SDK
|
|
{
|
|
/// <summary>
|
|
/// Entry point for initializing all ShiroginSDK systems in correct order.
|
|
/// </summary>
|
|
public class ShiroginInitializer : MonoBehaviour
|
|
{
|
|
[Tooltip(
|
|
"Optional: Assign SDKConfig directly. If left empty, it will be loaded from Resources/ShiroginConfig.")]
|
|
[SerializeField]
|
|
private ShiroginConfig config;
|
|
|
|
public static ShiroginInitializer Instance { get; private set; }
|
|
|
|
private void Awake()
|
|
{
|
|
// Singleton check
|
|
if (Instance != null && Instance != this)
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
Instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
|
|
// Load config if not assigned
|
|
if (config == null)
|
|
config = Resources.Load<ShiroginConfig>(SDKConstants.ConfigResourcePath);
|
|
|
|
if (config == null)
|
|
{
|
|
Debug.LogError(
|
|
"[ShiroginSDK] ❌ SDKConfig not found! Please create one under Resources/ShiroginConfig.asset.");
|
|
return;
|
|
}
|
|
|
|
InitializeServices();
|
|
}
|
|
|
|
private void InitializeServices()
|
|
{
|
|
Debug.Log("[ShiroginSDK] 🚀 Starting service initialization...");
|
|
ShiroginServiceRegistry.InitializeAll();
|
|
}
|
|
}
|
|
} |