public ContextMenuPresenter(ContextMenuViewData data, Vector3 position) { Assert.ArgumentNotNull(data, nameof(data)); this.data = data; menu = GameObject.Instantiate(data.contextMenuPrefab); menu.GetComponent <ContextMenuDestroyer> ().OnDestroy += Dispose; var rectTransform = menu.GetComponent <RectTransform> (); rectTransform.SetParent(data.canvas.transform); rectTransform.position = position; }
public LayerStackPresenter(LayerStackViewData layerData, ContextMenuViewData contextMenuData, LayerStack stack) { Assert.NotNull(layerData, nameof(layerData)); Assert.NotNull(contextMenuData, nameof(contextMenuData)); Assert.NotNull(stack, nameof(stack)); this.layerData = layerData; this.contextMenuData = contextMenuData; this.stack = stack; layerData.createLayerButton.onClick.AddListener(() => stack.CreateLayer()); layerData.createAffectorButton.onClick.AddListener(() => { if (activeLayer != null) { AddAffector(activeLayer); } }); stack.OnLayerCreate += OnLayerCreate; stack.OnLayerDelete += OnLayerDelete; }