40 lines
1006 B
C#
40 lines
1006 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PaymentUI : MonoBehaviour
|
|
{
|
|
[SerializeField] private RectTransform GameModesRoot;
|
|
[SerializeField] private GameObject GameModeViewPrefab;
|
|
|
|
private bool initialized = false;
|
|
|
|
public void Initialize(Dictionary<GameMode, bool> gameModeAccesses)
|
|
{
|
|
Generate(gameModeAccesses);
|
|
initialized = true;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!initialized) return;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
private void Generate(Dictionary<GameMode, bool> gameModeAccesses)
|
|
{
|
|
foreach (var gameModeAccess in gameModeAccesses)
|
|
{
|
|
var go = Instantiate(GameModeViewPrefab, GameModesRoot);
|
|
|
|
if(go.TryGetComponent<GameModeView>(out var view))
|
|
view.Setup(gameModeAccess.Key, gameModeAccess.Value);
|
|
else
|
|
Debug.LogWarning($"Префаб не настроен или не содержит компонент GameModeView", this);
|
|
}
|
|
}
|
|
}
|