Ejemplo n.º 1
0
    private void RepopulateList()
    {
        bool hasSelectedParticle = false;

        foreach (ScrollingListItemUI entry in entries.Values)
        {
            Destroy(entry.gameObject);
        }
        entries.Clear();
        List <ParticleEffectListing> list = particleEffectSystem.ListAll();

        ui.particlesList.noneText.gameObject.SetActive(list.Count == 0);
        foreach (ParticleEffectListing listing in list)
        {
            ScrollingListItemUI entry = Instantiate(particleEntryPrefab, ui.particlesList.contentRect.transform);
            entry.gameObject.SetActive(true);
            entry.textField.text = listing.name;
            // entry.Set(listing);
            entry.button.onClick.AddListener(() => SelectParticleEffect(listing.id));
            string name = listing.name;
            entries.Add(listing.id, entry);
            if (listing.id == selectedParticleEffectId)
            {
                hasSelectedParticle = true;
            }
        }
        if (!hasSelectedParticle)
        {
            SelectParticleEffect(null);
        }
        else
        {
            UpdateSelectedParticleUI();
        }
    }
Ejemplo n.º 2
0
 public void Open(System.Action <Util.Maybe <ulong> > callback)
 {
     Util.FindIfNotSet(this, ref behaviorSystem);
     this.callback = callback;
     BehaviorSystem.SavedCardPacks packs = behaviorSystem.GetCardPacks();
     if (packs.cardPacks.Count > 0)
     {
         noItemsObject.SetActive(false);
     }
     foreach (BehaviorSystem.SavedCardPack pack in packs.cardPacks)
     {
         ScrollingListItemUI item = Instantiate(scrollingListItemPrefab, scrollingList.transform);
         item.textField.text = pack.workshopName;
         item.name           = pack.workshopId.ToString();
         item.button.onClick.AddListener(() =>
         {
             if (selectedItem != null)
             {
                 selectedItem.actorListItemSelected.SetActive(false);
             }
             selectedItem = item;
             selectedItem.actorListItemSelected.SetActive(true);
         });
         scrollingListItems.Add(item);
         item.gameObject.SetActive(true);
     }
     gameObject.SetActive(true);
 }
Ejemplo n.º 3
0
    public void Setup()
    {
        Util.FindIfNotSet(this, ref particleEffectSystem);

        ScrollingListItemUI entry = Instantiate(ui.particlePickerItemTemplate, ui.particlePickerList.transform);

        entry.gameObject.SetActive(true);
        entry.textField.text = "<none>";
        entry.button.onClick.AddListener(() => OnParticleEffectClicked(null));
    }
Ejemplo n.º 4
0
    private ScrollingListItemUI CreateNewSoundListItem()
    {
        ui.soundsList.noneText.gameObject.SetActive(false);
        ScrollingListItemUI listItem = Instantiate(soundItemTemplate, ui.soundsList.contentRect.transform);

        listItem.button.onClick.AddListener(() => SetSelectedSound(listItem));
        listItem.gameObject.SetActive(true);
        listItems.Add(listItem);
        return(listItem);
    }
Ejemplo n.º 5
0
    private void Close()
    {
        selectedItem = null;
        foreach (ScrollingListItemUI item in scrollingListItems)
        {
            Destroy(item.gameObject);
        }
        scrollingListItems.Clear();
        noItemsObject.SetActive(true);

        gameObject.SetActive(false);
    }
Ejemplo n.º 6
0
    void SetSelectedSound(ScrollingListItemUI item)
    {
        CloseDialogs();

        if (item != null)
        {
            string      id     = item.name;
            SoundEffect effect = soundEffectSystem.GetSoundEffect(id);
            if (effect == null)
            {
                // Someone remotely deleted this sound...
                Refresh();
                return;
            }
            else
            {
                ui.exportDropdownMenu.gameObject.SetActive(false);
                ui.copyButton.gameObject.SetActive(true);
                ui.trashButton.gameObject.SetActive(true);
                if (effect.content.effectType == SoundEffectType.Synthesized)
                {
                    // Launch the synthesized sound editor.
                    synthSoundEditor.Open(id);
                }
                else if (effect.content.effectType == SoundEffectType.SteamWorkshop)
                {
                    // Launch the imported sound editor.
                    importedSoundEditor.Open(id);
                }
                else
                {
                    // TODO: launch editor appropriate for this type of sound.
                }
            }
        }
        else
        {
            ui.copyButton.gameObject.SetActive(false);
            ui.trashButton.gameObject.SetActive(false);
        }

        if (selectedListItem != null)
        {
            selectedListItem.actorListItemSelected.SetActive(false);
        }
        selectedListItem = item;
        if (selectedListItem != null)
        {
            selectedListItem.actorListItemSelected.SetActive(true);
        }

        onSoundSelected?.Invoke(selectedListItem?.name);
    }
Ejemplo n.º 7
0
    private void RepopulateList()
    {
        foreach (ScrollingListItemUI entry in entries.Values)
        {
            Destroy(entry.gameObject);
        }
        entries.Clear();

        List <ParticleEffectListing> list = particleEffectSystem.ListAll();

        foreach (ParticleEffectListing listing in list)
        {
            ScrollingListItemUI entry = Instantiate(ui.particlePickerItemTemplate, ui.particlePickerList.transform);
            entry.gameObject.SetActive(true);
            entry.textField.text = listing.name;
            // entry.Set(listing);
            entry.button.onClick.AddListener(() => OnParticleEffectClicked(listing.id));
            string name = listing.name;
            entries.Add(listing.id, entry);
        }
    }
Ejemplo n.º 8
0
 private void UpdateSoundListItem(ScrollingListItemUI listItem, SoundEffectListing listing)
 {
     listItem.name           = listing.id;
     listItem.textField.text = listing.name;
 }