/// <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> /// Reset the available dialogue options for the player /// </summary> public void ResetQuestions(PostRaceEventState current, List <PostRaceEventState> replies) { UpdateSelected(null); var eventMember = current.CrewMember; //set text and onclick handlers for each question UI object for (var i = 0; i < _questions.Length; i++) { if (replies.Count <= i) { _questions[i].Active(false); continue; } _questions[i].Active(true); var subjects = current.Subjects.Select(s => Localization.HasKey(s) ? Localization.Get(s) : Regex.Replace(s, @"((?<=\p{Ll})\p{Lu})|((?!\A)\p{Lu}(?>\p{Ll}))", " $0")).ToArray(); _questions[i].GetComponentInChildren <Text>().text = Localization.GetAndFormat(replies[i].Dialogue.Utterance, false, subjects); var currentReply = replies[i]; var postRaceEvent = GetComponentInParent <PostRaceEventUI>(); var question = _questions[i]; var button = _questions[i].GetComponent <Button>(); button.onClick.RemoveAllListeners(); button.onClick.AddListener(() => UpdateSelected(question)); button.onClick.AddListener(() => postRaceEvent.SendReply(currentReply)); } //display the button for closing the pop-up and update the displayed character mood if there are no more dialogue options if (replies.Count == 0) { //update displayed avatar moods if (eventMember != null) { _avatarDisplay.UpdateMood(eventMember.GetMood()); } foreach (var crewMember in UIManagement.TeamSelection.CrewMembers) { crewMember.UpdateAvatar(crewMember.CrewMember.GetMood()); } } }