public virtual void Initialize(string label, Action callback, DevUILUAButton luaButton, DevUIView view) { base.Initialize(); this.luaButton = luaButton; this.view = view; labelOutput.text = label; executeButton.onClick.AddListener(callback.Invoke); //Setup buttons if (luaButton.createdDynamically) { deleteButton.onClick.AddListener(Delete); } else { IsEditable = false; } luaCommandInput.text = luaButton.LuaCommand; nameInput.text = luaButton.name; luaButton.luaCommandProperty.Subscribe(e => { luaCommandInput.text = e; }).AddTo(this); }
void AddLuaButton() { DevUILUAButton newButton = new DevUILUAButton("No Name", "print('Dummy Command')") { createdDynamically = true }; myView.AddElement(newButton); }
void SpawnLuaButton(DevUILUAButton luaButton, bool activateInEditMode) { GameObject devUIElementGO = Instantiate(uiLUAButtonPrefab) as GameObject; UIViewLUAButton button = devUIElementGO.GetComponent <UIViewLUAButton>(); button.Initialize(luaButton.name, luaButton.Execute, luaButton, myView); devUIElementGO.transform.SetParent(contentContainer, false); uiElements.Add(luaButton, devUIElementGO); button.ActivateEditMode(activateInEditMode); }