private void AddElement(List <ListUpgrade> types) { List <RectTransform> rectList = new List <RectTransform>(); for (int i = 0; i < types.Count; i++) { int capture = i; GUIInteractableIcon e = Instantiate(Element); rectList.Add(e.transform as RectTransform); e.Placeholder.text = types[i].ToString().InsertSpace(); e.InteractableChange(SyncData.CurrentBaseUpgrade[types[capture]].Level > 0); e.OnClickEvents += delegate { OnSelected(types[capture]); }; elementCount = (elementCount + 1) % ColumnNum; if (elementCount == 0 || types.Count - 1 == i) { curRow.Add(rectList); rectList.Clear(); curRow = Instantiate(rowLayoutPrefab, ScrollView.Content); curRow.ElementSize = ElementSize; rows.Add(curRow); } } }
private void SetupIllustrationGroup() { typeName = IllustrationGroup.GetChild(0).GetComponentInChildren <TextMeshProUGUI>(); illusImg = IllustrationGroup.GetChild(0).GetComponentInChildren <GUIInteractableIcon>(); upgradeBtn = IllustrationGroup.GetChild(1).GetComponent <GUIInteractableIcon>(); levelBar = IllustrationGroup.GetChild(2).GetComponent <GUIProgressSlider>(); }
protected override void OnEnable() { base.OnEnable(); Owner = target as GUIInteractableIcon; onClickEvents = new SerializedPropertyDrawer(serializedObject, "onClick"); transitionType = Owner.Button.transition; colorBlock = new SerializedPropertyDrawer(serializedObject, "colorBlock"); spriteBlock = new SerializedPropertyDrawer(serializedObject, "spriteBlock"); }