/// <summary> /// calls through pickColorItemComponent event /// </summary> private void OnPickColorItemComponentPick(PickColorItemComponent pickColorItemComponent) { if (SetPickedColorAction == null) { return; } SetPickedColorAction.Invoke(pickColorItemComponent.pickColorItem.Color); SetPickedColorAction = null; ShowPanel(false, null); }
/// <summary> /// clear items, choose non dublicated colors, create items /// </summary> public void GenerateItems(Transform panel, GameObject prefab, Color[] validColors) { ClearItems(); for (int i = 0; i < validColors.Length; i++) { GameObject pickColorItemGmaobject = GameObject.Instantiate(prefab) as GameObject; items.Add(pickColorItemGmaobject); pickColorItemGmaobject.transform.SetParent(panel); PickColorItemComponent pickColorItemComponent = pickColorItemGmaobject.GetComponent <PickColorItemComponent>(); IPickColorItem pickColorItem = new PickColorItem(validColors[i]); pickColorItemComponent.Init(pickColorItem); } }