IEnumerator DisplayConversation(Conversation conversation) { /*Loop through each conversation line in the conversation lines array and set the UI elements to * equal the variables in the conversation entry. If the sprite that is being passed in is not the * player sprite then change the scale to -1 and move it to the right side of the screen. * Start the StepConversationText coroutine which will display each character one by one at the previously defined * speed. Lastly, wait for player input using the nextLine boolean and until the UI text element equals the conversation line text * Set the next line variable back to false and set the step speed back to the defined speed and then clear the UI elements. * Loop if there are anymore conversation lines in the array. * Set talking to false when conversation is complete */ talking = true; foreach (var conversationLine in conversation.ConversationLines) { currentConversationLine = conversationLine; conversationLengthInCharacters = currentConversationLine.ConversationText.Length; characterImage.sprite = currentConversationLine.CharacterDisplayPicture; StartCoroutine(StepConversationText(conversation, conversationLengthInCharacters)); yield return(new WaitUntil(() => nextLine == true && characterDialogue.text == currentConversationLine.ConversationText)); nextLine = false; stepSpeed = definedSpeed; characterDialogue.text = ""; } talking = false; dialogueCanvas.gameObject.SetActive(false); }
IEnumerator DisplayConversation(Conversation conversation) { talking = true; foreach (var conversationLine in conversation.ConversationLines) { currentConversationLine = conversationLine; conversationTextWidth = currentConversationLine.ConversationText.Length * fontSpacing; scaledTextureRect = new Rect(currentConversationLine.DisplayPic.textureRect.x / currentConversationLine.DisplayPic.texture.width, currentConversationLine.DisplayPic.textureRect.y / currentConversationLine.DisplayPic.texture.height, currentConversationLine.DisplayPic.textureRect.width / currentConversationLine.DisplayPic.texture.width, currentConversationLine.DisplayPic.textureRect.height / currentConversationLine.DisplayPic.texture.height); for (int i = 0; i <= currentConversationLine.ConversationText.Length; i++) { currentText = currentConversationLine.ConversationText.Substring(0, i); if (i >= conversationLine.ConversationText.Length) { delay = 1f; } yield return(new WaitForSeconds(delay)); } delay = 0.05f; } talking = false; yield return(null); }
public void DisplayConversation(Conversation conversation, LLT.Variables.FloatVariable numPensamiento) { Scene m_Scene; m_Scene = SceneManager.GetActiveScene(); if (m_Scene.name == "CeldaBlur" || m_Scene.name == "Celda") { Debug.Log("En " + m_Scene.name); // if (numPensamiento.Value == 0f ) return; currentConversationLine = conversation.ConversationLines[(int)numPensamiento.Value]; StopAllCoroutines(); StartCoroutine(TypeSentence(currentConversationLine.ConversationText)); // Debug.Log("Esta es la linea de la celda " + currentConversationLine.ConversationText); } else { Debug.Log("Estoy en " + m_Scene.name); foreach (var conversationLine in conversation.ConversationLines) { currentConversationLine = conversationLine; if (currentConversationLine != null) { StopAllCoroutines(); StartCoroutine(TypeSentence(currentConversationLine.ConversationText)); // Debug.Log("Esta es la linea " + currentConversationLine.ConversationText); } } } }
private void Start() { DialogueDBAdmin.DeleteDatabase("F****r.db"); DialogueDBAdmin.CreateUniDialogueDB("F****r.db"); //SQLiteConnection _connection = new SQLiteConnection("Assets/StreamingAssets/F****r.db", SQLiteOpenFlags.ReadWrite); DialogueDBConnection _connection = new DialogueDBConnection("F****r.db", SQLiteOpenFlags.ReadWrite); DialogueDBManager _dbManager = new DialogueDBManager(_connection); ConversationEntry con1 = new ConversationEntry("asd1", -1); ConversationEntry con2 = new ConversationEntry("asd2", -1); ConversationEntry con3 = new ConversationEntry("asd3", -1); ConversationEntry con4 = new ConversationEntry("asd4", -1); ConversationEntry con5 = new ConversationEntry("asd5", -1); ContentEntry coe1 = new ContentEntry("fff1", "ccc1", -1); ContentEntry coe2 = new ContentEntry("fff2", "ccc2", -1); ContentEntry coe3 = new ContentEntry("fff3", "ccc3", -1); ContentEntry coe4 = new ContentEntry("fff4", "ccc4", -1); ContentEntry coe5 = new ContentEntry("fff5", "ccc5", -1); ExecutionEntry exe1 = new ExecutionEntry("eee1", -1); ExecutionEntry exe2 = new ExecutionEntry("eee2", -1); ExecutionEntry exe3 = new ExecutionEntry("eee3", -1); ExecutionEntry exe4 = new ExecutionEntry("eee4", -1); ExecutionEntry exe5 = new ExecutionEntry("eee5", -1); ConditionEntry cod1 = new ConditionEntry("ddd1", -1, -1); ConditionEntry cod2 = new ConditionEntry("ddd2", -1, -1); ConditionEntry cod3 = new ConditionEntry("ddd3", -1, -1); ConditionEntry cod4 = new ConditionEntry("ddd4", -1, -1); ConditionEntry cod5 = new ConditionEntry("ddd5", -1, -1); _dbManager.InsertEntry(con1); _dbManager.InsertEntry(con2); _dbManager.InsertEntry(con3); _dbManager.InsertEntry(con4); _dbManager.InsertEntry(con5); _dbManager.InsertEntry(coe1); _dbManager.InsertEntry(coe2); _dbManager.InsertEntry(coe3); _dbManager.InsertEntry(coe4); _dbManager.InsertEntry(coe5); _dbManager.InsertEntry(exe1); _dbManager.InsertEntry(exe2); _dbManager.InsertEntry(exe3); _dbManager.InsertEntry(exe4); _dbManager.InsertEntry(exe5); _dbManager.InsertEntry(cod1); _dbManager.InsertEntry(cod2); _dbManager.InsertEntry(cod3); _dbManager.InsertEntry(cod4); _dbManager.InsertEntry(cod5); List <ExecutionEntry> list = _connection.Query <ExecutionEntry>("SELECT *, MAX(ID) FROM ExecutionEntry;"); foreach (ExecutionEntry ee in list) { Debug.Log(ee.ExecutionCode); } }
public TopicEntry GetTopic(CreatureEntity collocutor, int conversationIndex, TopicEntry parentTopic, string phrase) { TopicEntry result = null; DialogEntry dlg = Dialog; ConversationEntry curConvers = dlg.GetConversation(conversationIndex); if (parentTopic == null) { result = curConvers.GetTopic(0); } else { for (int i = 0; i < parentTopic.TopicsCount; i++) { TopicEntry subTopic = parentTopic.GetTopic(i); if ((subTopic.Phrase == phrase)) { result = subTopic; break; } } } return(result); }
public void AddConversation(Conversation conversation) { ConversationEntry entry = Tuple.Create(conversation.Id, conversation); LinkedListNode node = orderList.AddFirst(entry); conversations.Add(conversation.Id, node); }
IEnumerator DisplayConversation(Conversation conversation) { talking = true; foreach (var conversationLine in conversation.ConversationLines) { currentConversationLine = conversationLine; textHolder.text = currentConversationLine.ConversationText; imageHolder.sprite = currentConversationLine.DisplayPic; yield return(new WaitForSeconds(3)); } talking = false; }
IEnumerator DisplayConversation(Conversation conversation) { talking = true; foreach (var conversationLine in conversation.ConversationLines) { currentCoversationLine = conversationLine; conversationTextWidth = conversationLine.ConversationText.Length * fontSpacing; yield return(new WaitForSeconds(3)); } talking = false; }
IEnumerator DisplayConversation(Conversation conversation) { /*Loop through each conversation line in the conversation lines array and set the UI elements to * equal the variables in the conversation entry. If the sprite that is being passed in is not the * player sprite then change the scale to -1 and move it to the right side of the screen. * Start the StepConversationText coroutine which will display each character one by one at the previously defined * speed. Lastly, wait for player input using the nextLine boolean and until the UI text element equals the conversation line text * Set the next line variable back to false and set the step speed back to the defined speed and then clear the UI elements. * Loop if there are anymore conversation lines in the array. * Set talking to false when conversation is complete */ talking = true; foreach (var conversationLine in conversation.ConversationLines) { currentConversationLine = conversationLine; conversationLengthInCharacters = currentConversationLine.ConversationText.Length; characterName.text = currentConversationLine.SpeakingCharacterName; characterImage.sprite = currentConversationLine.CharacterDisplayPicture; if (characterImage.sprite.name == "Player") { characterImage.transform.localScale = new Vector3(1, 1, 1); characterImage.rectTransform.anchoredPosition = new Vector2(-Mathf.Abs(characterImage.rectTransform.anchoredPosition.x), characterImage.rectTransform.anchoredPosition.y); } else { characterImage.transform.localScale = new Vector3(-1, 1, 1); characterImage.rectTransform.anchoredPosition = new Vector2(Mathf.Abs(characterImage.rectTransform.anchoredPosition.x), characterImage.rectTransform.anchoredPosition.y); } characterImage.color = Color.white; StartCoroutine(StepConversationText(conversation, conversationLengthInCharacters)); yield return(new WaitUntil(() => nextLine == true && characterDialogue.text == currentConversationLine.ConversationText)); nextLine = false; stepSpeed = definedSpeed; characterDialogue.text = ""; characterName.text = ""; } talking = false; characterImage.color = Color.clear; }
IEnumerator DisplayConversation(Conversation conversation) { talking = true; foreach (var conversationLine in conversation.ConversationLines) { currentConversationLine = conversationLine; conversationTextWidith = currentConversationLine.ConversationText.Length * fontSpacing; scaledTextureRect = new Rect( currentConversationLine.DisplayPic.textureRect.x / currentConversationLine.DisplayPic.texture.width, currentConversationLine.DisplayPic.textureRect.y / currentConversationLine.DisplayPic.texture.height, currentConversationLine.DisplayPic.textureRect.width / currentConversationLine.DisplayPic.texture.width, currentConversationLine.DisplayPic.textureRect.height / currentConversationLine.DisplayPic.texture.height); yield return(new WaitForSeconds(3)); } talking = false; }
static EitriBrain() { SfDialog = new DialogEntry(); ConversationEntry defConvers = SfDialog.AddConversation(); defConvers.Name = BaseLocale.GetStr(RS.rs_EitriTopic); TopicEntry rootTopic = defConvers.AddTopic(); rootTopic.Answer = BaseLocale.GetStr(RS.rs_EitriSaid) + "\"" + BaseLocale.GetStr(RS.rs_Eitri1) + "\"."; TopicEntry topic = rootTopic.AddTopic(); topic.Condition = "player.hasItem('PlatinumAnvil')"; topic.Phrase = BaseLocale.GetStr(RS.rs_Eitri_Yes); topic.Answer = BaseLocale.GetStr(RS.rs_Eitri3) + " " + BaseLocale.GetStr(RS.rs_Eitri4); topic.Action = "player.transferItem(NPC, 'PlatinumAnvil'); NPC.transferItem(player, 'DwarvenArm');"; topic = rootTopic.AddTopic(); topic.Phrase = BaseLocale.GetStr(RS.rs_Eitri_No); topic.Answer = BaseLocale.GetStr(RS.rs_Eitri2); }
static VictimBrain() { SfAgnarDialog = new DialogEntry(); ConversationEntry defConvers = SfAgnarDialog.AddConversation(BaseLocale.GetStr(RS.rs_Sacrifice)); TopicEntry rootTopic = defConvers.AddTopic(); rootTopic.Answer = BaseLocale.GetStr(RS.rs_Agnar_IsStrungUp) + " " + BaseLocale.GetStr(RS.rs_VictimPleads); TopicEntry topic1 = rootTopic.AddTopic(); topic1.Phrase = BaseLocale.GetStr(RS.rs_Agnar_KickOutStump); topic1.Answer = BaseLocale.GetStr(RS.rs_SacrificeAward); topic1.Action = "NPC.sacrificeVictim();"; TopicEntry topic2 = rootTopic.AddTopic(); topic2.Phrase = BaseLocale.GetStr(RS.rs_SetHimFree); topic2.Answer = BaseLocale.GetStr(RS.rs_VictimFree); topic2.Action = "NPC.freeVictim();"; TopicEntry topic3 = rootTopic.AddTopic(); topic3.Phrase = BaseLocale.GetStr(RS.rs_DoNothing); topic3.Answer = ""; SfHaddingrDialog = new DialogEntry(); defConvers = SfHaddingrDialog.AddConversation(BaseLocale.GetStr(RS.rs_Sacrifice)); rootTopic = defConvers.AddTopic(); rootTopic.Answer = BaseLocale.GetStr(RS.rs_Haddingr_IsPinned) + " " + BaseLocale.GetStr(RS.rs_VictimPleads); topic1 = rootTopic.AddTopic(); topic1.Phrase = BaseLocale.GetStr(RS.rs_Haddingr_TwistSpear); topic1.Answer = BaseLocale.GetStr(RS.rs_SacrificeAward); topic1.Action = "NPC.sacrificeVictim();"; topic2 = rootTopic.AddTopic(); topic2.Phrase = BaseLocale.GetStr(RS.rs_SetHimFree); topic2.Answer = BaseLocale.GetStr(RS.rs_VictimFree); topic2.Action = "NPC.freeVictim();"; topic3 = rootTopic.AddTopic(); topic3.Phrase = BaseLocale.GetStr(RS.rs_DoNothing); topic3.Answer = ""; SfKetillDialog = new DialogEntry(); defConvers = SfKetillDialog.AddConversation(BaseLocale.GetStr(RS.rs_Sacrifice)); rootTopic = defConvers.AddTopic(); rootTopic.Answer = BaseLocale.GetStr(RS.rs_Ketill_IsDangling) + " " + BaseLocale.GetStr(RS.rs_VictimPleads); topic1 = rootTopic.AddTopic(); topic1.Phrase = BaseLocale.GetStr(RS.rs_Ketill_DrownHim); topic1.Answer = BaseLocale.GetStr(RS.rs_SacrificeAward); topic1.Action = "NPC.sacrificeVictim();"; topic2 = rootTopic.AddTopic(); topic2.Phrase = BaseLocale.GetStr(RS.rs_SetHimFree); topic2.Answer = BaseLocale.GetStr(RS.rs_VictimFree); topic2.Action = "NPC.freeVictim();"; topic3 = rootTopic.AddTopic(); topic3.Phrase = BaseLocale.GetStr(RS.rs_DoNothing); topic3.Answer = ""; }