public void TabClick(int index) { currentTab = tabs[index]; currentTab.Load(); int i = 0; foreach (TabView item in tabs) { Transform tab = transform.Find("Tabs").GetChild(i); Image img = tab.Find("Image").GetComponent <Image>(); img.enabled = currentTab == item; i++; } }
List <TabView> BuildTabs() { Wardrobe w = ScriptableObject.CreateInstance <Wardrobe>(); w = Wardrobe.Singleton; List <TabView> t = new List <TabView>(); // Build 'Hair' tab TabView hair = new TabView(); FeatureView hairHair = new FeatureView(w.locations[1], cs.locations[1]); hair.features.Add(hairHair); t.Add(hair); // Build 'Body' Tab TabView body = new TabView(); FeatureView skin = new FeatureView(w.locations[0], cs.locations[0]); FeatureView eyes = new FeatureView(w.locations[2], cs.locations[2]); body.features.Add(skin); body.features.Add(eyes); t.Add(body); // Build 'Clothes' tab TabView clothes = new TabView(); FeatureView top = new FeatureView(w.locations[3], cs.locations[3]); FeatureView pants = new FeatureView(w.locations[4], cs.locations[4]); FeatureView shoes = new FeatureView(w.locations[5], cs.locations[5]); clothes.features.Add(top); clothes.features.Add(pants); clothes.features.Add(shoes); t.Add(clothes); return(t); }