Inheritance: MonoBehaviour
Example #1
0
 void EnqueueEntry(AbilityMenuEntry entry)
 {
     currentEntries.Remove(entry);
     reusableEntries.Enqueue(entry);
     entry.Selected = false;
     entry.Locked   = false;
     entry.transform.SetParent(null, false);
     entry.gameObject.SetActive(false);
 }
Example #2
0
    // methods for getting and returning menu entries from the pool
    AbilityMenuEntry Dequeue()
    {
        Poolable         p     = GameObjectPoolController.Dequeue(EntryPoolKey);
        AbilityMenuEntry entry = p.GetComponent <AbilityMenuEntry>();

        entry.transform.SetParent(panel.transform, false);
        entry.transform.localScale = Vector3.one;
        entry.gameObject.SetActive(true);
        entry.Reset();
        return(entry);
    }
Example #3
0
 public void Load(string title, params string[] options)
 {
     Clear();
     titleLabel.text = title;
     for (int i = 0; i < options.Length; ++i)
     {
         AbilityMenuEntry entry = DequeueEntry();
         entry.Title = options[i];
         currentEntries.Add(entry);
     }
     SetSelection(0);
 }
Example #4
0
 //load and display
 public void Show(string title, List <string> options)
 {
     canvas.SetActive(true);
     Clear();
     titleLabel.text = title;
     for (int i = 0; i < options.Count; ++i)
     {
         AbilityMenuEntry entry = Dequeue();
         entry.Title = options[i];
         menuEntries.Add(entry);
     }
     SetSelection(0);
     TogglePos(ShowKey);
 }
Example #5
0
    AbilityMenuEntry DequeueEntry()
    {
        if (reusableEntries.Count > 0)
        {
            AbilityMenuEntry entry = reusableEntries.Dequeue();
            entry.gameObject.SetActive(true);
            entry.transform.SetParent(transform, false);
            return(entry);
        }

        GameObject instance = Instantiate(entryPrefab) as GameObject;

        instance.transform.SetParent(transform, false);
        return(instance.GetComponent <AbilityMenuEntry>());
    }
Example #6
0
    void Enqueue(AbilityMenuEntry entry)
    {
        Poolable p = entry.GetComponent <Poolable>();

        GameObjectPoolController.Enqueue(p);
    }
 void EnqueueEntry(AbilityMenuEntry entry)
 {
     currentEntries.Remove(entry);
     reusableEntries.Enqueue(entry);
     entry.Selected = false;
     entry.Locked = false;
     entry.transform.SetParent(null, false);
     entry.gameObject.SetActive(false);
 }
Example #8
0
 void Enqueue(AbilityMenuEntry entry)
 {
     Poolable p = entry.GetComponent<Poolable>();
     GameObjectPoolController.Enqueue(p);
 }