protected override void EditPart() { RPGConversation s = (RPGConversation)currentItem; EditorGUILayout.Separator(); ConditionsUtils.Conditions(s.conditions, Data); for (int i = 0; i < s.conversationParagraphs.Count; i++) { EditorGUILayout.BeginVertical(skin.box); //EditorGUILayout.BeginHorizontal(); //EditorGUILayout.EndHorizontal(); AddParagraph(s.conversationParagraphs[i], i); if (GUILayout.Button("Delete Paragraph", GUILayout.Width(400))) { s.conversationParagraphs.Remove(s.conversationParagraphs[i]); break; } EditorGUILayout.EndVertical(); } if (GUILayout.Button("Add paragraph", GUILayout.Width(400))) { RPGParagraph p = new RPGParagraph(); s.conversationParagraphs.Add(p); } currentItem = s; }
public void AddParagraph(RPGParagraph s, int j) { EditorUtils.Label("paragraph id: "+j); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("base paragraph?"); s.isBaseParagraph = EditorGUILayout.Toggle(s.isBaseParagraph, GUILayout.Width(50)); EditorGUILayout.PrefixLabel("Display timer"); s.displayTimer = EditorGUILayout.FloatField(s.displayTimer, GUILayout.Width(100)); EditorGUILayout.PrefixLabel("owner NPC"); s.ownerNPCID = EditorUtils.IntPopup(s.ownerNPCID, Data.npcEditor.items, FieldTypeEnum.Middle); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("NPC text"); s.ParagraphText = EditorGUILayout.TextArea(s.ParagraphText, GUILayout.Width(700)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Next Paragraph Interaction"); s.nextParagraphCondition = (NextParagraphInteraction)EditorGUILayout.EnumPopup(s.nextParagraphCondition, GUILayout.Width(300)); EditorGUILayout.EndHorizontal(); for (int i = 0; i < s.nextParagraphIDs.Count; i++) { EditorGUILayout.BeginHorizontal(); s.nextParagraphIDs[i] = EditorGUILayout.IntField( s.nextParagraphIDs[i], GUILayout.Width(100)); if(GUILayout.Button("Remove", GUILayout.Width(200))) { s.nextParagraphIDs.Remove(s.nextParagraphIDs[i]); break; } EditorGUILayout.EndHorizontal(); } if(GUILayout.Button("Add Next Paragraph ID", GUILayout.Width(300))) { s.nextParagraphIDs.Add(1); } GUIUtils.ConditionsEvents(s.Conditions, s.Actions, Data); for (int i = 0; i < s.LineTexts.Count; i++) { EditorGUILayout.BeginVertical(skin.box); AddLinetext(s.LineTexts[i], i); if (GUILayout.Button("Delete Player Reply" + i, GUILayout.Width(200))) { s.LineTexts.Remove(s.LineTexts[i]); break; } EditorGUILayout.EndVertical(); } if (GUILayout.Button("Add Player Reply", GUILayout.Width(200))) { LineText p = new LineText(); s.LineTexts.Add(p); } }
public IEnumerator DisplaySpeaker(RPGParagraph newParagraph) { if(isSpeakerDisplayed && newParagraph.ownerNPCID != activeNPCid) { if(isSpeechBubbleDisplayed) { //speechBubbleTween.tweenGroup = 0; speechBubbleOutroTween.Play(true); isSpeechBubbleDisplayed = false; yield return new WaitForSeconds(0.1f); } //transition out the current speaker speakerCameraTween.Play(false); isSpeakerDisplayed = false; yield return new WaitForSeconds(0.25f); Destroy(speakerObject); } activeNPCid = newParagraph.ownerNPCID; if(string.IsNullOrEmpty( activeParagraph.ParagraphText)) { if(isSpeechBubbleDisplayed) { //speechBubbleTween.tweenGroup = 0; speechBubbleOutroTween.Play(true); isSpeechBubbleDisplayed = false; yield return new WaitForSeconds(0.1f); } } speechText.text = activeParagraph.ParagraphText; if(activeParagraph.nextParagraphCondition == NextParagraphInteraction.NextClick) { nextArrow.SetActive(true); nextCollider.enabled = true; waitForNextClick = true; } else { nextArrow.SetActive(false); nextCollider.enabled = false; waitForNextClick = false; } if(!isSpeakerDisplayed && newParagraph.ownerNPCID > 0) { speakerObject = Instantiate(Resources.Load(GeneralData.GetNPCByID(newParagraph.ownerNPCID).speakerPrefabPath) as GameObject) as GameObject; speakerObject.transform.parent = speakerRoot; speakerObject.transform.localPosition = Vector3.zero; speakerCameraTween.Play(true); yield return new WaitForSeconds(0.25f); isSpeakerDisplayed = true; } if(!isSpeechBubbleDisplayed && !string.IsNullOrEmpty(speechText.text)) { //speechBubbleTween.tweenGroup = 1; speechBubbleIntroTween.Play(true); isSpeechBubbleDisplayed = true; yield return new WaitForSeconds(0.2f); } yield return null; }
public void DisplayParagraph(RPGParagraph newParagraph) { //Debug.Log("display paragraph "); PlayerManager.Instance.Hero.questLog.CheckParagraph(activeConversation, activeConversation.conversationParagraphs.IndexOf(newParagraph)); activeParagraph = newParagraph; affirmativeLinetext = null; negativeLinetext = null; for (int i = 0; i < activeParagraph.LineTexts.Count; i++) { if(activeParagraph.LineTexts[i].lineTextType == LineTextType.affirmative) { affirmativeLinetext = activeParagraph.LineTexts[i]; Debug.Log(activeParagraph.LineTexts[i].CanYouDisplay()); affirmativeButton.SetActive(activeParagraph.LineTexts[i].CanYouDisplay()); } else if(activeParagraph.LineTexts[i].lineTextType == LineTextType.negative) { negativeLinetext = activeParagraph.LineTexts[i]; negativeButton.SetActive(activeParagraph.LineTexts[i].CanYouDisplay()); } } if(affirmativeLinetext == null) affirmativeButton.SetActive(false); else { affirmativeText.text = affirmativeLinetext.Text; } if(negativeLinetext == null) { negativeText.text = "Done"; } else { negativeText.text = negativeLinetext.Text; } //negativeButton.SetActive(true); activeParagraph.DoEvents(); if(!NeedsQuestInfo()) HideQuestInfo(); displaySpeakerJob = Job.make(DisplaySpeaker(newParagraph)); if(activeParagraph.displayTimer > 0) displayParagraphTimerJob = Job.make(ParagraphTimeOut(activeParagraph.displayTimer)); //StartCoroutine(DisplaySpeaker(newParagraph)); }