Exemplo n.º 1
0
        public override UniTask InitializeAsync()
        {
            tipsSelectedState = stateManager.GlobalState.GetState <TipsSelectedState>() ?? new TipsSelectedState();

            var records = textManager.GetAllRecords(managedTextCategory);

            foreach (var record in records)
            {
                var unlockableId = $"{unlockableIdPrefix}/{record.Key}";
                var title        = record.Value.GetBefore(separatorLiteral) ?? record.Value;
                var selectedOnce = tipsSelectedState.TryGetValue(unlockableId, out var selected) && selected;
                var item         = TipsListItem.Instantiate(itemPrefab, unlockableId, title, selectedOnce, HandleItemClicked);
                item.transform.SetParent(itemsContainer, false);
                listItems.Add(item);
            }

            foreach (var item in listItems)
            {
                item.SetUnlocked(unlockableManager.ItemUnlocked(item.UnlockableId));
            }

            TipsCount = listItems.Count;

            return(UniTask.CompletedTask);
        }