/// <summary> /// Adds a panel to the menu list /// </summary> public void AddPanel() { //generate a random key for the menu to be added int key = Random.Range(1, 1000); //keep looking for another key if we already have a menu with his key while (ListMenus.Find(x => x.key == key) != null) { key = Random.Range(1, 1000); } //add a new menu to the menu list ListMenus.Add(new Menu(key)); }
/// <summary> /// Adds the menu's from the list to the dictionary as a pair(key, value) /// </summary> public void Init() { menus.Clear(); //clear the dictionary ListMenus.ForEach(x => menus.Add(x.key, x.value)); //copy the listMenu to the dictionary DisableAllMenus(); //disable all menus }