public void SetToStoryChoice(ConversationUI conversationUI, StoryChoice storyChoice) { m_ConversationUI = conversationUI; m_CurrentStoryChoice = storyChoice; var factionIcon = GetCurrentFactionIcon(storyChoice); if ((storyChoice.conditions.CheckConditions() == false && storyChoice.conditions.Length > 0)) { choiceText.text = "Should not be visible, son"; state = State.Hidden; gameObject.SetActive(false); } else if (storyChoice.enabledConditions.CheckConditions() == false && storyChoice.enabledConditions.Length > 0) { var rawMainText = storyChoice.definition.choiceText; rawMainText = rawMainText.Replace("%FACTIONMEMBER", storyChoice.parentStoryNode.parentLocation.owningFaction.definition.memberName); rawMainText = rawMainText.Replace("%FACTION", storyChoice.parentStoryNode.parentLocation.owningFaction.definition.name); rawMainText = rawMainText.Replace("%RIVALFACTIONMEMBER", Game.instance.definitions.factionDefinitions[storyChoice.parentStoryNode.parentLocation.owningFaction.definition.rivalFaction].memberName); rawMainText = rawMainText.Replace("%RIVALFACTION", Game.instance.definitions.factionDefinitions[storyChoice.parentStoryNode.parentLocation.owningFaction.definition.rivalFaction].name); rawMainText = rawMainText.Replace("%LOCATION", storyChoice.parentStoryNode.parentLocation.definition.name); rawMainText = rawMainText.Replace("%GOLD", Game.instance.world.gold.ToString()); rawMainText = rawMainText.Replace("%PAWNS", Game.instance.world.pawns.ToString()); rawMainText = rawMainText.Replace("%REPUTATION", storyChoice.parentStoryNode.parentLocation.owningFaction.reputation.ToString()); choiceText.text = rawMainText; state = State.Disabled; choiceText.fontStyle = FontStyles.Strikethrough; choiceText.color = disabledTextColor; m_Button.onClick.AddListener(OnPressedDisabled); gameObject.SetActive(true); if (factionIcon != null) { factionIcon.color = Color.black; factionIcon.gameObject.SetActive(true); } } else { var rawMainText = storyChoice.definition.choiceText; rawMainText = rawMainText.Replace("%FACTIONMEMBER", storyChoice.parentStoryNode.parentLocation.owningFaction.definition.memberName); rawMainText = rawMainText.Replace("%FACTION", storyChoice.parentStoryNode.parentLocation.owningFaction.definition.name); rawMainText = rawMainText.Replace("%RIVALFACTIONMEMBER", Game.instance.definitions.factionDefinitions[storyChoice.parentStoryNode.parentLocation.owningFaction.definition.rivalFaction].memberName); rawMainText = rawMainText.Replace("%RIVALFACTION", Game.instance.definitions.factionDefinitions[storyChoice.parentStoryNode.parentLocation.owningFaction.definition.rivalFaction].name); rawMainText = rawMainText.Replace("%LOCATION", storyChoice.parentStoryNode.parentLocation.definition.name); rawMainText = rawMainText.Replace("%GOLD", Game.instance.world.gold.ToString()); rawMainText = rawMainText.Replace("%PAWNS", Game.instance.world.pawns.ToString()); rawMainText = rawMainText.Replace("%REPUTATION", storyChoice.parentStoryNode.parentLocation.owningFaction.reputation.ToString()); choiceText.text = rawMainText; state = State.Visible; choiceText.color = regularTextColor; m_Button.onClick.AddListener(OnPressedValid); gameObject.SetActive(true); if (factionIcon != null) { factionIcon.gameObject.SetActive(true); } } }
private IEnumerator DelayedStart() { yield return(new WaitForEndOfFrame()); m_ConversationUI = Game.instance.conversationUI; }