private void InitializeMeetingInfo() { foreach (Transform child in content.GetComponentInChildren <Transform>()) { Destroy(child.gameObject); } if (meeting != null) { title.text = meeting.GetTitle(); var tasks = meeting.GetTasks(); float contentWidth = content.sizeDelta.x; float contentHeight = taskRenderer.sizeDelta.y * (tasks.Count + EmptyTaskSpace); content.sizeDelta = new Vector2(contentWidth, contentHeight); for (int i = 0; i < tasks.Count; i++) { var taskRendererInstance = Instantiate(taskRenderer) as RectTransform; taskRendererInstance.SetParent(content); taskRendererInstance.anchoredPosition = new Vector2(0, -i * taskRenderer.sizeDelta.y); var task = tasks[i]; SetUpTaskUI(task, taskRendererInstance.gameObject); } } else { CreateMeeting(); } }
private void CreateMeetingUI(Meeting meeting, GameObject attendanceInstance) { var title = attendanceInstance.GetComponentInChildren <Text>(); title.text = meeting.GetTitle(); var buttons = attendanceInstance.GetComponentsInChildren <Button>(); var attendButton = buttons.Where(b => string.Compare(b.name, AttendButtonName, true) == 0).FirstOrDefault(); if (!attendButton) { Debug.LogError("The edit button must have \"" + AttendButtonName + "\" within its name!", attendanceInstance.gameObject); } attendButton.onClick.AddListener(() => AttendMeeting(meeting)); }
private void CreateMeetingUI(Meeting meeting, GameObject meetingInstance) { var title = meetingInstance.GetComponentInChildren <Text>(); title.text = meeting.GetTitle(); var buttons = meetingInstance.GetComponentsInChildren <Button>(); var editButton = buttons.Where(b => string.Compare(b.name, EditButtonName, true) == 0).FirstOrDefault(); var cancelButton = buttons.Where(b => string.Compare(b.name, CancelButtonName, true) == 0).FirstOrDefault(); if (!editButton) { Debug.LogError("The edit button must have \"" + EditButtonName + "\" within its name!", meetingInstance.gameObject); } if (!cancelButton) { Debug.LogError("The edit button must have \"" + CancelButtonName + "\" within its name!", meetingInstance.gameObject); } editButton.onClick.AddListener(() => EditMeeting(meeting)); cancelButton.onClick.AddListener(() => CancelMeeting(meeting)); }