/// <summary> /// Select an employee, fill in the information and display the window. /// This attaches to the skill changed events. /// </summary> /// <param name="workplace">Workplace which basic information should be displayed</param> public void Select(Workplace workplace) { if (workplace.Mission != null) { this.workplace = workplace; Name.text = workplace.Mission.GetName(); SkillProgressUi.SetMission(workplace.Mission); UpdateRemainingTime(); FloatWindow.Select(workplace.gameObject); WorkplaceInfoOpened.Raise(); } }
/// <summary> /// Select an employee, fill in the information and display the window. /// This attaches to the skill changed events. /// </summary> /// <param name="employee">Employee whos basic information should be displayed</param> public void Select(Employee employee) { this.employee = employee; Name.text = employee.Name; foreach (var skill in employee.EmployeeData.Skills) { var go = Instantiate(SkillPrefab, SkillContainer.transform, false); go.GetComponentsInChildren <Text>().First().text = skill.Level.ToString(); go.GetComponentsInChildren <Image>().First().sprite = skill.GetSprite(); UnityAction skillChanged = () => go.GetComponent <Text>().text = skill.Level.ToString(); skill.SkillEvent.AddListener(skillChanged); skillEvents.Add(skill, skillChanged); } FloatWindow.Select(employee.gameObject); }