public void OnRefreshView() { //Set the toggle group to values off. FilesLayoutGroup.SetAllTogglesOff(); //Lets go through and get the list of levels in the selected library. //And activate icons accordinly. for (int i = 0; i < GameLibrary.ActiveLibrary.LibrarySize; i++) { //Go through and label the files. //reference the current icon. FileIconToggle file = _iconList[i]; //Set the label. file.Label = GameLibrary.GetObjectStackFromActiveLibraryAtIndex(i).name; //library.GetAtIndexAtSelectedLibrary(i).name; //Set the index value of the toggle. file.IndexReference = i; //Maybe we set the icon, depending on library? //Enable the obeject. file.gameObject.SetActive(true); } //Do we test if we ran out of icons in the cache to activate? Maybe somewhere. }
public override void OnInit() { //Call base init. base.OnInit(); //lets create that cache now. //Start by creating the list. _iconList = new List <FileIconToggle>(); //Then we go through and create and disable the amount of icons we going to cache. for (int i = 0; i < fileIconCacheAmount; i++) { //Instanutate from the template here. //Setting the parent within the call. FileIconToggle file = Instantiate(templateIcon, FilesLayout.transform) as FileIconToggle; //push onto the list here. _iconList.Add(file); //Lets also disable them. //No need to set values here as they are set on refresh call. file.gameObject.SetActive(false); //Let us set the group. file.MyToggleGroup = FilesLayoutGroup; //Set the highlight color. //file.HighlightColor = _handler.SystemWindowColor; //And that should be it. List created and obtained. } //update the dropdown based on whats in our library. List <string> library_list = new List <string>(); foreach (StackLibrary lib in GameLibrary.AvailableLibraries) { library_list.Add(lib.name); } LibraryDropDownList.AddOptions(library_list); }