add project files

This commit is contained in:
Boris Nikolaev
2026-08-14 01:58:31 +03:00
parent 9134cad79b
commit 5f1e94b653
4399 changed files with 12286903 additions and 0 deletions
@@ -0,0 +1,83 @@
using UnityEngine;
using OHM.UnityToolkit.UI;
using UnityEngine.Serialization;
public class UIRootController : MonoBehaviour
{
[SerializeField]
[FormerlySerializedAs("appController")]
private AppController _appController;
public UIMainMenu mainMenu;
public UICoreGame coreGame;
public UIGameOver gameOver;
public UIVictory victory;
public UIHud hud;
private void Awake()
{
InitSubMenus();
hud.Setup(_appController);
_appController.onGameExited.AddListener(OnGameExited);
_appController.coreGame.onGameStarted.AddListener(OnCoreGameStarted);
_appController.coreGame.onGameOver.AddListener(OnGameOver);
_appController.onLevelCleared.AddListener(OnGameWon);
}
private void Start()
{
if (mainMenu != null)
{
mainMenu.Show();
}
}
private void InitSubMenus()
{
UIMenu[] menus = GetComponentsInChildren<UIMenu>(true);
for (int i = 0; i < menus.Length; i++)
{
menus[i].Setup(_appController);
}
}
public void OnGameExited()
{
if (mainMenu != null)
{
mainMenu.Show();
}
GetComponent<UIMenusController>().HideAllExcept(mainMenu);
}
public void OnCoreGameStarted()
{
if (coreGame != null)
{
coreGame.Show();
}
GetComponent<UIMenusController>().HideAllExcept(coreGame);
}
public void OnGameOver()
{
if (gameOver != null)
{
gameOver.Show();
}
GetComponent<UIMenusController>().HideAllExcept(gameOver);
}
public void OnGameWon()
{
if (victory != null)
{
victory.Show();
}
GetComponent<UIMenusController>().HideAllExcept(victory);
}
}