Danro/Assets/Scripts/Managers/GlobalsManager.cs
Danil Iarosh 9555479967 feat(game): implement payment system and UI improvements
- Added PaymentManager integration with GameManager
- Implemented credit-based lives increment system
- Updated UI layout and anchor positions in MainMenu scene
- Added AddCredit input action bindings for keyboard and gamepad
- Refactored GameManager to use StartingLives, MaxLives properties
- Added UICreditsTextController for displaying credits and lives- Fixed prefab initialization order and component dependencies
- Updated ComWrapper serialization and prize checking logic
- Removed obsolete setLivesToDefaultAfterFirstLose setting
- Improved scene loading and player spawn management
2025-11-11 17:51:51 +03:00

53 lines
2.2 KiB
C#

using System;
using RR.Game2D.Core.Managers;
using UnityEngine;
using UnityEngine.InputSystem;
namespace RR.Common.Managers
{
public class GlobalsManager : MonoBehaviour
{
private SettingsManager _settingsManager;
private ComWrapper _comWrapper;
private In _in;
private PrizeSystem _prizeSystem;
private PaymentManager _paymentManager;
private ComInputToInputSystemAdapter _adapter;
private void Awake()
{
GameManager.Logger.Log(name ,"Initializing global objects...");
_settingsManager = GetComponent<SettingsManager>();
_comWrapper = GetComponent<ComWrapper>();
_in = GetComponent<In>();
_prizeSystem = GetComponent<PrizeSystem>();
_paymentManager = GetComponent<PaymentManager>();
_adapter = GetComponent<ComInputToInputSystemAdapter>();
if (_comWrapper == null) gameObject.AddComponent<ComWrapper>();
if (_in == null) gameObject.AddComponent<In>();
if (_prizeSystem == null) gameObject.AddComponent<PrizeSystem>();
if (_settingsManager == null) gameObject.AddComponent<SettingsManager>();
if (_paymentManager == null) gameObject.AddComponent<PaymentManager>();
if (_adapter == null) gameObject.AddComponent<ComInputToInputSystemAdapter>();
_settingsManager.Initialize();
GameManager.Logger.Log(name, "SettingsManager successfully initialized.");
_comWrapper.Initialize();
GameManager.Logger.Log(name, "ComWrapper successfully initialized.");
_in.Initialize();
GameManager.Logger.Log(name, "In.cs successfully initialized.");
_prizeSystem.Initialize();
GameManager.Logger.Log(name, "PrizeSystem successfully initialized.");
_paymentManager.Initialize();
GameManager.Logger.Log(name, "PaymentManager successfully initialized.");
_adapter.Initialize();
GameManager.Logger.Log(name, "InputAdapter successfully initialized.");
}
}
}