// TODO: перенести логику подписки на события в GameManager - загрузка ресурсов private GameObject createButton(GameObject go, int id) { GameObject newButton = NGUITools.AddChild(go, Prefab); newButton.transform.parent = go.transform; newButton.transform.localPosition = new Vector3(newButton.transform.position.x, newButton.transform.position.y, 0); ColorSelector colorSelector = newButton.GetComponent <ColorSelector>(); colorSelector.ResetPosition(); colorSelector.Index = id; colorSelector.UpdateColliderSize(); UIEventListener.Get(newButton).onClick += OnClickEventHandler; return(newButton); }
private void Start() { UIPencilAtlasCustomCreator.CreateAtlas(PaletteManager.selectedPaletteName); int btnsCount = MaterialManager.Materials.Length; for (int i = 0; i < btnsCount; i++) { GameObject selectorObject = createButton(gameObject, i); ColorSelector selector = selectorObject.GetComponent <ColorSelector>(); selector.ColorSelectorManager = _colorSelectorManager; ColorSelectors.Add(selector); selector.UISprite.sprite2D = SpriteList[i]; selector.UpdateColliderSize(); } grid.Reposition(); grid.transform.parent.GetComponent <UIScrollView>().ResetPosition(); _colorSelectorManager.UiGrid = grid; _colorSelectorManager.ColorSelectors = ColorSelectors; }
private void ShowFirstCS() { ActiveColorSelector = ColorSelectors[ColorSelectors.Count - 1]; MaterialManager.Active = MaterialManager.Materials.Length - 1; }
public void HideColorSelector(ColorSelector colorSelector) { colorSelector.Hide(); }
public void ShowColorSelector(ColorSelector colorSelector) { colorSelector.Show(); }