public LayerController AddLayer() { if (layers.Count >= MaxLayerCount) { return(null); } var layer = Instantiate(LayerPrototype); var layerController = layer.GetComponent <LayerController>(); layerController.OnClickedEvent += OnLayerClicked; layerController.OnPressedEvent += OnLayerPressed; layerController.OnDragedEvent += OnLayerDraged; layerController.OnReleasedEvent += OnLayerReleased; layerController.OnChangedEvent += OnLayerChanged; layerController.Init(LayerTabRect, Vector2.zero); layers.Insert(0, layerController); LayerTabFitter.Fit(layers.ToArray()); if (OnLayerAddedEvent != null) { OnLayerAddedEvent(layerController); } return(layerController); }
void Start() { AddColor(Color.white); AddColor(Color.black); ColorSwatchFitter.Fit(colorCards.ToArray()); ColorTabController.Fit(); }