public void ShowItem(File file) { GameObject newButton = Instantiate(sampleButton) as GameObject; ButtonBehaviorController button = newButton.GetComponent <ButtonBehaviorController> (); button.nameLabel.text = "Name: " + file.name + "\n" + "User: " + file.userName; button.button.onClick = file.thingToDo; newButton.transform.SetParent(panelFileList); scrollRect.normalizedPosition = new Vector2(0f, 0f); }
private void ShowButton(string taskName, List <Level> levelList) { GameObject newButton = Instantiate(sampleButton) as GameObject; ButtonBehaviorController button = newButton.GetComponent <ButtonBehaviorController> (); button.nameLabel.text = taskName; button.button.onClick.AddListener(() => { ShowPanelWorkspaces(levelList); }); button.button.onClick.AddListener(() => { selectedTask = taskName; }); newButton.transform.SetParent(contentPanel); scrollRect.normalizedPosition = new Vector2(0f, 0f); }
private void ShowButton(Level l) { GameObject newButton = Instantiate(sampleButton) as GameObject; ButtonBehaviorController button = newButton.GetComponent <ButtonBehaviorController> (); button.nameLabel.text = l.name; button.button.onClick = l.thingToDo; button.button.onClick.AddListener(() => { panelWorkspaces.SetActive(false); }); newButton.transform.SetParent(contentPanelWorkspaces); scrollRectWorkspaces.normalizedPosition = new Vector2(0f, 0f); }
public void ClearList() { itemList = new List <Item> (); List <GameObject> children = new List <GameObject>(); foreach (Transform child in contentPanel.transform) { children.Add(child.gameObject); } children.ForEach(child => Destroy(child)); currentButton = null; }
public void ShowItem(Item item) { GameObject newButton = Instantiate(sampleButton) as GameObject; ButtonBehaviorController button = newButton.GetComponent <ButtonBehaviorController> (); button.nameLabel.text = item.rState.Name; button.button.onClick = item.thingToDo; button.rState = item.rState; button.button.onClick.AddListener(button.OnClickButton); newButton.transform.SetParent(contentPanel); item.rState.button = button; scrollRect.normalizedPosition = new Vector2(0f, 0f); }
public void RemoveItem(Item item) { itemList.Remove(item); GameObject buttonToRemove = new GameObject(); foreach (Transform b in contentPanel.transform) { if (b.GetComponent <ButtonBehaviorController> ().rState == item.rState) { buttonToRemove = b.gameObject; break; } } Destroy(buttonToRemove); currentButton = null; }
public void OnClickRState(ButtonBehaviorController b) { ColorBlock cb; if (currentButton != null) { cb = currentButton.button.colors; cb.normalColor = new Color(1f, 1f, 1f); currentButton.button.colors = cb; } currentButton = b; cb = currentButton.button.colors; cb.normalColor = new Color(1f, 0.5f, 0.5f); currentButton.button.colors = cb; behaviorDesigner.GoToRobotState(currentButton.rState); panelModuleSettingController.UpdateSliderControlInfo(); }