Exemplo n.º 1
0
        public Task 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(Task.CompletedTask);
        }
Exemplo n.º 2
0
        private async void HandleSlotClicked(string id)
        {
            var slot = grid.GetSlot(id);

            if (!unlockableManager.ItemUnlocked(slot.UnlockableId))
            {
                return;
            }

            var cgTexture = await slot.LoadCGTextureAsync();

            viewerImage.texture = cgTexture;
            viewerPanel.Show();
        }