/// <summary> /// Create a new CrewMember object /// </summary> private CrewMemberUI CreateCrewMember(CrewMember cm, Transform parent, bool usable) { var crewMember = Instantiate(_crewPrefab, parent, false); crewMember.name = cm.SplitName(); crewMember.SetUp(usable, cm, cm.GetMood()); return(crewMember); }
/// <summary> /// Update the avatar expression and border color using the string provided. Partially used for debugging /// </summary> public void ForcedMoodChange(string moodChange) { var mood = AvatarMood.Neutral; switch (moodChange) { case "negative": mood = CrewMember.Name.Length % 2 == 0 ? AvatarMood.StronglyDisagree : AvatarMood.Disagree; break; case "positive": mood = CrewMember.Name.Length % 2 == 0 ? AvatarMood.StronglyAgree : AvatarMood.Agree; break; case "accurate": mood = AvatarDisplay.GetMood(CrewMember.GetMood()); break; } _avatarDisplay.UpdateMood(mood); _borderImage.color = ShowEmotion ? AvatarDisplay.MoodColor(mood) : Current ? Color.grey : Color.black; }
/// <summary> /// Populate the information required in the pop-up /// </summary> public void Display() { if (!gameObject.activeInHierarchy) { return; } //ActionAllowance display _allowanceBar.fillAmount = GameManagement.ActionAllowancePercentage; _allowanceText.text = GameManagement.ActionAllowance.ToString(); //CrewMember avatar var mood = _currentMember.GetMood(); _avatarDisplay.SetAvatar(_currentMember.Avatar, mood); _avatarDisplay.GetComponent <Image>().color = new UnityEngine.Color(0, 1, 1); _avatarDisplay.Parent().GetComponent <Image>().color = AvatarDisplay.MoodColor(mood); //CrewMember information var currentRole = _currentMember.BoatPosition(); _nameText.text = _currentMember.Name; _ageText.text = _currentMember.Age.ToString(); //set up button if CrewMember is positioned, hide if not _roleButton.gameObject.Active(currentRole != Position.Null); if (currentRole != Position.Null) { _roleButton.onClick.RemoveAllListeners(); _roleButton.onClick.AddListener(() => UIManagement.PositionDisplay.SetUpDisplay(currentRole, TrackerTriggerSource.TeamManagementScreen.ToString())); _roleButton.transform.FindImage("Image").sprite = UIManagement.TeamSelection.RoleLogos[currentRole.ToString()]; } //set stat bar fill amount (foreground) and sprite (background) foreach (var skill in _skills) { var skillvalue = _currentMember.RevealedSkills[(Skill)Enum.Parse(typeof(Skill), skill.name)]; skill.FindImage("Foreground Bar").fillAmount = skillvalue * 0.1f; skill.FindImage("Hidden Image").enabled = skillvalue == 0; skill.FindImage("Skill Image").enabled = skillvalue != 0; } foreach (var question in _questions) { var configKey = (ConfigKey)Enum.Parse(typeof(ConfigKey), $"{question.name}Cost"); question.FindText("Cost/Amount").text = configKey.ValueString(true, _currentMember); question.GetComponent <Button>().interactable = configKey.Affordable(_currentMember); } _fireButton.transform.FindText("Cost/Amount").text = ConfigKey.FiringCost.ValueString(); _fireButton.interactable = GameManagement.CanRemoveFromCrew; if (!_fireButton.interactable) { if (!ConfigKey.FiringCost.Affordable()) { FeedbackHoverOver("FIRE_BUTTON_HOVER_ALLOWANCE"); } else if (!GameManagement.CrewEditAllowed) { FeedbackHoverOver(Localization.GetAndFormat("FIRE_BUTTON_HOVER_LIMIT", false, GameManagement.StartingCrewEditAllowance)); } else if (!GameManagement.Team.CanRemoveFromCrew()) { FeedbackHoverOver("FIRE_BUTTON_HOVER_CREW_LIMIT"); } else if (GameManagement.ShowTutorial) { FeedbackHoverOver("FIRE_BUTTON_HOVER_TUTORIAL"); } } else { FeedbackHoverOver(); } //display revealed opinions for each other active CrewMember DisplayOpinions(); var managerOpinionImage = transform.FindComponentInChildren <Image>("Manager Opinion"); var managerOpinion = _currentMember.RevealedCrewOpinions[GameManagement.ManagerName]; managerOpinionImage.sprite = GetOpinionIcon(managerOpinion); OnLanguageChange(); }