예제 #1
0
        public async static Task <DialogueResponse> PostDialogueRequestAsync(this HttpClient client, string apiKey, DialogueRequest request)
        {
            var response = new DialogueResponse();

            var queryString = new NameValueCollection();

            queryString[API_KEY] = apiKey;

            var path = DOCOMO_API_DIALOGUE_PATH + ToQueryString(queryString);

            client.BaseAddress = new Uri(DOCOMO_API_HOST);
            client.DefaultRequestHeaders
            .Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

            var serReq = new DataContractJsonSerializer(typeof(DialogueRequest));

            using (var ms = new MemoryStream())
            {
                serReq.WriteObject(ms, request);
                ms.Position = 0;

                using (var sr = new StreamReader(ms))
                {
                    var content = new StringContent(sr.ReadToEnd(), System.Text.Encoding.UTF8, "application/json");

                    var r = await client.PostAsync(path, content).ConfigureAwait(false);

                    var serRes = new DataContractJsonSerializer(typeof(DialogueResponse));
                    response            = serRes.ReadObject(await r.Content.ReadAsStreamAsync()) as DialogueResponse;
                    response.StatusCode = r.StatusCode;
                }
            }

            return(response);
        }
예제 #2
0
    public DialogueResponse GetDialogueResponse(XmlNode node)
    {
        XmlNodeList nodeContent = node.ChildNodes;

        DialogueResponse response = new DialogueResponse();

        foreach (XmlNode nodeItem in nodeContent)
        {
            XmlAttributeCollection attributes = nodeItem.Attributes;

            if (nodeItem.Name == "condition" || nodeItem.Name == "logic")
            {
                response.Conditions = ParseConditionList(nodeItem);
            }
            else if (nodeItem.Name == "text")
            {
                response.Text = nodeItem.InnerText;
            }
            else if (nodeItem.Name == "event")
            {
                response.Events.Add(attributes["name"].Value);
            }
        }

        return(response);
    }
예제 #3
0
    public DialogueNode GetDialogueNode(string id)
    {
        XmlElement node = CurrentDialogXML.GetElementById(id);

        if (node == null)
        {
            return(null);
        }

        XmlNodeList  nodeContent  = node.ChildNodes;
        DialogueNode dialogueNode = new DialogueNode();

        foreach (XmlNode nodeItem in nodeContent)
        {
            if (nodeItem.Name == "response")
            {
                DialogueResponse response = GetDialogueResponse(nodeItem);
                dialogueNode.Responses.Add(response);
            }
            else if (nodeItem.Name == "option")
            {
                Topic option = GetDialogueOption(nodeItem);
                dialogueNode.Options.Add(option);
            }
        }

        return(dialogueNode);
    }
예제 #4
0
 public void ContinueDialog(DialogueResponse response = null)
 {
     if (response == null)
     {
         Debug.Log("ContinueDialog upper!");
         //No response so no trigger for a new dialogue chain
         newDialogueChain = false;
         //No longer waiting for player input
         this._waitForPlayer = false;
     }
     else
     {
         Debug.Log("ContinueDialog lower!");
         //Update dialogue chain index based on response
         newDialogueIndex = response.DialogueIndex;
         //Set flag indicating there is a new dialogue chain
         newDialogueChain = true;
         //Close response box
         CloseResponseBox();
         //Reset flag for waiting on dialog choice
         this.DialogueChoice = false;
         //Continue
         this._waitForPlayer = false;
     }
 }
예제 #5
0
    IEnumerator PlayingInteraction(DialogueResponse response)
    {
        if (response.interaction != null)
        {
            yield return(new WaitForSecondsRealtime(decayTime));

            response.interaction.Invoke();
        }
    }
예제 #6
0
        private void AddResponseData(DialogueResponse response)
        {
            var responseItem = new DarkListItem(response.Text.Truncate(20))
            {
                Tag = response
            };

            this.lstResponses.Items.Add(responseItem);
        }
    public void DialogResponsePicked(int responseIndex)
    {
        DialogueResponse dialogueResponse = ((ResponseDialogueMoment)selectedDialogue.dialogMoments[momentIndex]).responses[responseIndex];
        float            loyaltyChange    = dialogueResponse.loyaltyEffect;

        selectedCharacter.ChangeLoyalty(loyaltyChange);

        DialogueMoment followUpMoment = dialogueResponse.followUpMoment;

        Delegates.Instance.ContinueDialogueListeners(followUpMoment);
    }
예제 #8
0
    /// <summary>
    /// Sets the display elements.
    /// </summary>
    /// <param name="item">The item to which this object corresponds.</param>
    public void SetDisplayElements(DialogueResponse response)
    {
        if (bgImage == null)
        {
            bgImage = GetComponentInChildren <Image>();
        }

        //Get color to be used for selection state
        StartingColor = bgImage.color;
        //Set display text to match response text
        this.gameObject.GetComponent <Text>().text = response.Text;
    }
예제 #9
0
        public static DialogueResponse Unmarshall(UnmarshallerContext _ctx)
        {
            DialogueResponse dialogueResponse = new DialogueResponse();

            dialogueResponse.HttpResponse  = _ctx.HttpResponse;
            dialogueResponse.RequestId     = _ctx.StringValue("Dialogue.RequestId");
            dialogueResponse.TextResponse  = _ctx.StringValue("Dialogue.TextResponse");
            dialogueResponse.Interruptible = _ctx.BooleanValue("Dialogue.Interruptible");
            dialogueResponse.Action        = _ctx.StringValue("Dialogue.Action");
            dialogueResponse.ActionParams  = _ctx.StringValue("Dialogue.ActionParams");

            return(dialogueResponse);
        }
예제 #10
0
        private void BtnAddResponse_Click(object sender, EventArgs e)
        {
            var response = new DialogueResponse()
            {
                Text = "Enter your response text here..."
            };

            if (_selectedBranch != null)
            {
                _selectedBranch.AddResponse(response);
                this.AddResponseData(response);
            }
        }
예제 #11
0
        void OnRemoveDialogueResponse(string modFileName, DialogueResponse response)
        {
            var modFile  = modFiles[modFileName];
            var registry = recordItemRegistry[modFileName];

            var index = GetItemIndex(registry, response);

            if (index == -1)
            {
                throw new ArgumentException();
            }

            modFile.RemoveRecord(registry[index].Item1);
            registry.RemoveAt(index);
        }
예제 #12
0
    GameObject ReadDialogueEvidence(XmlReader reader)
    {
        GameObject temp = new GameObject("dialogueEvidence");

        temp.AddComponent <DialogueEvidence>();
        temp.GetComponent <DialogueEvidence>().filepath = reader.GetAttribute("filepath");
        temp.GetComponent <DialogueEvidence>().opener   = reader.GetAttribute("opener");

        Read(reader);

        while (reader.Name == "dialogueLine")
        {
            DialogueLine line = new DialogueLine();
            line.id   = reader.GetAttribute("id");
            line.text = reader.GetAttribute("text");
            line.associatedEvidence = reader.GetAttribute("associatedEvidence");

            if (line.associatedEvidence != null)
            {
                objects[line.associatedEvidence].transform.parent = temp.transform;
            }


            //print(line.id);

            temp.GetComponent <DialogueEvidence>().lines.Add(line.id, line);

            DialogueResponse lastResp = null;
            while (Read(reader) && (reader.Name == "dialogueResponse" || reader.Name == "requirements"))
            {
                if (reader.Name == "dialogueResponse")
                {
                    DialogueResponse resp = new DialogueResponse();
                    resp.text     = reader.GetAttribute("text");
                    resp.directTo = reader.GetAttribute("directTo");

                    line.responses.Add(resp);
                    lastResp = resp;
                }
                else if (reader.Name == "requirements")
                {
                    lastResp.requirements = ReadRequirements(reader);
                }
            }
        }

        return(temp);
    }
예제 #13
0
        public static DialogueResponse Unmarshall(UnmarshallerContext context)
        {
            DialogueResponse dialogueResponse = new DialogueResponse();

            dialogueResponse.HttpResponse   = context.HttpResponse;
            dialogueResponse.RequestId      = context.StringValue("Dialogue.RequestId");
            dialogueResponse.Success        = context.BooleanValue("Dialogue.Success");
            dialogueResponse.Code           = context.StringValue("Dialogue.Code");
            dialogueResponse.Message        = context.StringValue("Dialogue.Message");
            dialogueResponse.HttpStatusCode = context.IntegerValue("Dialogue.HttpStatusCode");

            DialogueResponse.Dialogue_Feedback feedback = new DialogueResponse.Dialogue_Feedback();
            feedback.Content          = context.StringValue("Dialogue.Feedback.Content");
            feedback.Action           = context.StringValue("Dialogue.Feedback.Action");
            feedback.ActionParams     = context.StringValue("Dialogue.Feedback.ActionParams");
            dialogueResponse.Feedback = feedback;

            return(dialogueResponse);
        }
예제 #14
0
    void AdjustResponse(DialogueElement element)
    {
        if (element.firstPlayerOption.isPositive)
        {
            currentPositiveResponse = element.firstPlayerOption;
        }
        else if (element.secondPlayerOption.isPositive)
        {
            currentPositiveResponse = element.secondPlayerOption;
        }

        if (!element.firstPlayerOption.isPositive)
        {
            currentNegativeResponse = element.firstPlayerOption;
        }
        else if (!element.secondPlayerOption.isPositive)
        {
            currentNegativeResponse = element.secondPlayerOption;
        }
    }
예제 #15
0
    //played via button
    public void PlayResponse(bool isPositive)
    {
        EnableMenu(true);
        nameSlot.text = generalPlayerName;

        if (isPositive)
        {
            if (currentPositiveResponse != null)
            {
                textSlot.text = currentPositiveResponse.text;

                StartCoroutine(PlayingInteraction(currentPositiveResponse));

                currentPositiveResponse = null;
            }
            else
            {
                EnableMenu(false, true);
                Debug.Log("the end1");
            }
        }
        else
        {
            if (currentNegativeResponse != null)
            {
                textSlot.text = currentNegativeResponse.text;

                StartCoroutine(PlayingInteraction(currentNegativeResponse));

                Invoke("DisableMenu", decayTime);

                currentNegativeResponse = null;
            }
            else
            {
                EnableMenu(false, true);
                Debug.Log("the end2");
            }
        }
    }
예제 #16
0
    public override List <Dialogue> Dialogues()
    {
        List <Dialogue> dialogues = new List <Dialogue>();

        DialogueResponse[] options = null;

        List <DialogueMoment> dialogueMomentsList = null;

        dialogueMomentsList = new List <DialogueMoment>();
        dialogueMomentsList.Add(new TextDialogueMoment("Hi and stuff"));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        dialogueMomentsList.Add(new TextDialogueMoment("What do you think of me?"));
        options = new DialogueResponse[] { new DialogueResponse("You suck", -0.8f, "How dare you!?"), new DialogueResponse("Not much", -0.2f, "I see..."), new DialogueResponse("You're the best!", 0.5f) };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        dialogueMomentsList.Add(new TextDialogueMoment("What do you think of me?"));
        options = new DialogueResponse[] { new DialogueResponse("You suck", -0.8f, "How dare you!?"), new DialogueResponse("Not much", -0.2f, "I see..."), new DialogueResponse("You're the best!", 0.5f) };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        dialogueMomentsList.Add(new TextDialogueMoment("What do you think of me?"));
        options = new DialogueResponse[] { new DialogueResponse("You suck", -0.8f, "How dare you!?"), new DialogueResponse("Not much", -0.2f, "I see..."), new DialogueResponse("You're the best!", 0.5f) };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        dialogueMomentsList.Add(new TextDialogueMoment("What do you think of me?"));
        options = new DialogueResponse[] { new DialogueResponse("You suck", -0.8f, "How dare you!?"), new DialogueResponse("Not much", -0.2f, "I see..."), new DialogueResponse("You're the best!", 0.5f) };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        return(dialogues);
    }
예제 #17
0
        private void OnResponseSelected(DialogueResponse response)
        {
            _selectedResponse = response;

            this.responsePanel.Show();

            this.txtResponseText.Text = response.Text;

            this.cmbNextBranch.Items.Clear();

            this.cmbNextBranch.Items.Add("None");

            foreach (var branch in _dialogue.Branches)
            {
                this.cmbNextBranch.Items.Add(branch.Name);
            }

            if (_dialogue.Script != null)
            {
                this.FillScriptData();
            }
            else
            {
                this.cmbDisplayCond.Items.Clear();
                this.cmbResponseFunction.Items.Clear();

                this.cmbDisplayCond.Items.Add("None");
                this.cmbResponseFunction.Items.Add("None");
            }

            if (!string.IsNullOrEmpty(response.Condition))
            {
                if (!this.cmbDisplayCond.Items.Contains(response.Condition))
                {
                    DarkMessageBox.ShowError($"Function {response.Condition} does not exist for response condition.", "Script Error!");
                    this.cmbDisplayCond.SelectedIndex = 0;
                }
                else
                {
                    this.cmbDisplayCond.SelectedItem = response.Condition;
                }
            }
            else
            {
                this.cmbDisplayCond.SelectedIndex = 0;
            }

            if (!string.IsNullOrEmpty(response.Function))
            {
                if (!this.cmbResponseFunction.Items.Contains(response.Function))
                {
                    DarkMessageBox.ShowError($"Function {response.Function} does not exist for response function.", "Script Error!");
                    this.cmbResponseFunction.SelectedIndex = 0;
                }
                else
                {
                    this.cmbResponseFunction.SelectedItem = response.Function;
                }
            }
            else
            {
                this.cmbResponseFunction.SelectedIndex = 0;
            }

            if (!string.IsNullOrEmpty(response.Next))
            {
                if (!this.cmbNextBranch.Items.Contains(response.Next))
                {
                    DarkMessageBox.ShowError($"Branch {response.Next} does not exist for response Next property.", "Dialogue Error!");
                    this.cmbNextBranch.SelectedIndex = 0;
                }
                else
                {
                    this.cmbNextBranch.SelectedItem = response.Next;
                }
            }
            else
            {
                this.cmbNextBranch.SelectedIndex = 0;
            }
        }
예제 #18
0
    public List <Topic> GetNPCTopics(Character npc, Character initiator)
    {
        List <Topic> topics = new List <Topic>();

        if (npc.GetComponent <Trader>() != null)
        {
            topics.Add(new Topic("3", "Trade", TopicType.Trade));
        }

        topics.Add(new Topic("5", "Change Subject", TopicType.Return));
        topics.Add(new Topic("4", "Goodbye", TopicType.Exit));

        //topics.Add(new Topic("1", "This place", TopicType.Info));
        //topics.Add(new Topic("2", "Life in the Zone", TopicType.Info));

        XmlNodeList topicList = CurrentDialogXML.GetElementsByTagName("topic");

        int tempIndex = 0;

        if (topicList.Count > 0)
        {
            foreach (XmlNode topic in topicList)
            {
                string id       = topic.Attributes["id"].Value;
                string response = "";
                string nextNode = "";
                string title    = "";

                XmlNodeList nodeContent = topic.ChildNodes;
                foreach (XmlNode nodeItem in nodeContent)
                {
                    XmlAttributeCollection attributes = nodeItem.Attributes;


                    if (nodeItem.Name == "response")
                    {
                        DialogueResponse resp = GetDialogueResponse(nodeItem);
                        response = resp.Text;
                    }

                    if (nodeItem.Name == "next_node")
                    {
                        nextNode = attributes["id"].Value;
                    }

                    if (nodeItem.Name == "title")
                    {
                        title = nodeItem.InnerText;
                    }
                }

                if (id == "")
                {
                    id = "temp" + tempIndex;
                }
                if (title == "")
                {
                    title = GetTopicTitle(id);
                }

                Topic newTopic = new Topic(id, title, TopicType.Info);

                newTopic.Response = response;
                newTopic.NextNode = nextNode;


                topics.Add(newTopic);


                tempIndex++;
            }
        }

        return(topics);
    }
예제 #19
0
        public static List<DialogueResponse> getDialogueRoot(int day, Character.Player player)
        {
            int id = 0;
            List<int> children = new List<int>();
            int Rday = 0;
            List<Condition> conditions = new List<Condition>();
            List<effect> effects = new List<effect>();
            string text = "";

            int ResponseCounter = 0;

            List<DialogueResponse> RootResponses = new List<DialogueResponse>();

            //select all dialogueResponse elements with attribute root=1, on a day which matches the current day, and the players current location.

            string strExpression = "/dialogue/dialogueResponse[@root='1' and @day='" + day.ToString() + "' and @location='" + player.Location.ToString() + "']/*";

            XPathDocument dialogueFile = new XPathDocument(DialogueFileLocation);
            XPathNavigator nav = dialogueFile.CreateNavigator();
            XPathNodeIterator nodeIter = nav.Select(strExpression);

            while (nodeIter.MoveNext())
            {

                //we've located the dialogueResponses we're interested in. Now we need to read and assign their child elements.

                switch (nodeIter.Current.Name)
                {

                    case "children":
                        //read and parse this comma delimited string, turn it into a List<int> object
                        String ChildrenString = nodeIter.Current.Value;
                        string[] childrenArray = ChildrenString.Split(',');
                        foreach (string s in childrenArray)
                        {
                            children.Add(Convert.ToInt32(s));
                        }
                        break;
                    case "condition":
                        //create condition and add it to condition list.
                        Condition condition = new Condition();
                        //go through condition attribute values and populate the condition object with them.
                        String subject = nodeIter.Current.GetAttribute("subject","");
                        condition.Subject = subject;

                        String attribute = nodeIter.Current.GetAttribute("attribute", "");
                        condition.Attribute = attribute;

                        String upperLimit = nodeIter.Current.GetAttribute("upperLimit", "");
                        if (upperLimit != "")
                        condition.UpperLimit = Convert.ToInt32(upperLimit);

                        String lowerLimit = nodeIter.Current.GetAttribute("lowerLimit", "");
                        if (lowerLimit != "")
                        condition.LowerLimit = Convert.ToInt32(lowerLimit);

                        String value = nodeIter.Current.Value;
                        if (value !="")
                        condition.Value = Convert.ToInt32(value);

                        String type = nodeIter.Current.GetAttribute("type", "");
                            condition.Type = type;

                        String decisionID = nodeIter.Current.GetAttribute("id", "");
                        if (decisionID != "")
                            condition.DecisionID = Convert.ToInt32(decisionID);

                        conditions.Add(condition);
                        break;

                    case "effect":
                        effect effect = new effect();

                        String effectType = nodeIter.Current.GetAttribute("type","");
                        effect.type = effectType;

                        String effectSubject = nodeIter.Current.GetAttribute("subject", "");
                        effect.Subject = effectSubject;

                        String effectAttribute = nodeIter.Current.GetAttribute("attribute", "");
                        effect.Attribute = effectAttribute;

                        String effectChange = nodeIter.Current.GetAttribute("change", "");
                        if(effectChange != "")
                            effect.change = Convert.ToInt32(effectChange);

                        String effectDecisionId = nodeIter.Current.GetAttribute("id", "");
                        if (effectDecisionId != "")
                            effect.DecisionID = Convert.ToInt32(effectDecisionId);

                        String decisionValue = nodeIter.Current.Value;
                        int n;
                        if (Int32.TryParse(decisionValue, out n))
                            effect.DecisionValue = Convert.ToInt32(decisionValue);

                        String effectDescription = nodeIter.Current.GetAttribute("desc", "");
                        effect.Description = effectDescription;

                        effects.Add(effect);

                        break;

                    case "text":
                        text = nodeIter.Current.Value;
                        break;

                    case "id":
                        //add one to the response counter - we got a new response!
                        ResponseCounter += 1;
                        id = Convert.ToInt32(nodeIter.Current.Value);
                        //Now we can create a new response object and fill it.

                        DialogueResponse Response = new DialogueResponse();

                        Response.ID = id;
                        Response.Text = text;
                        Response.children = children;
                        Response.Conditions = conditions;
                        Response.Effects = effects;
                        //Add new response to response list

                        RootResponses.Add(Response);

                        //reset values to default for the next dialogue

                        id = 0;
                        text = "";
                        children = new List<int>();
                        conditions = new List<Condition>();
                        break;
                }

                //throw new System.InvalidOperationException("No Root Dialogue was found!");
            }
            ParseResponses(RootResponses, player);
            return RootResponses;
        }
예제 #20
0
	public DialogueResponse GetDialogueResponse(XmlNode node)
	{
		XmlNodeList nodeContent = node.ChildNodes;

		DialogueResponse response = new DialogueResponse();

		foreach(XmlNode nodeItem in nodeContent)
		{
			if(nodeItem.Name == "condition")
			{
				DialogueCondition condition = new DialogueCondition();
				condition.ID = nodeItem.InnerText;
				if(condition.ID.Length > 0)
				{
					XmlAttributeCollection attributes = nodeItem.Attributes;
					if(attributes["type"] != null)
					{
						if(attributes["type"].Value == "and")
						{
							condition.IsAND = true;
						}
						else
						{
							condition.IsAND = false;
						}
					}
					else
					{
						condition.IsAND = true;
					}
					response.Conditions.Add(condition);
				}
			}
			else if(nodeItem.Name == "text")
			{
				response.Text = nodeItem.InnerText;
			}
			else if(nodeItem.Name == "event")
			{
				response.Events.Add(nodeItem.InnerText);
			}
		}

		return response;
	}
예제 #21
0
 public void SetupButton(DialogueResponse dialogue)
 {
     response.text = dialogue.playerResponse;
     keyWord       = dialogue.keyWord;
     skillWord     = dialogue.skillToCheck;
 }
예제 #22
0
        public static DialogueResponse getResponses(int day, List<int> ChoiceChildren, Character.Player player)
        {
            string childrenString = "";
             int childCounter = 0;

             int id = 0;
             List<int> children = new List<int>();
             int responseDay = 0;
             List<Condition> conditions = new List<Condition>();
             List<effect> effects = new List<effect>();
             string text = "";

             int ResponseCounter = 0;
             List<DialogueResponse> UnparsedResponses = new List<DialogueResponse>();

             foreach (int child in ChoiceChildren)
             {
                 childCounter += 1;
                 if (childCounter < ChoiceChildren.Count)
                 {
                     childrenString = childrenString + "id = " + child + " or ";
                 }
                 else
                 {
                     childrenString = childrenString + "id = " + child;
                 }
             }

             string strExpression = "/dialogue/dialogueResponse[(" + childrenString + ") and @day='" + day.ToString() + "']/*";
             XPathDocument dialogueFile = new XPathDocument(DialogueFileLocation);
             XPathNavigator nav = dialogueFile.CreateNavigator();
             XPathNodeIterator nodeIter = nav.Select(strExpression);

             //we've selected all the child dialogue choices. Now we need to read them into dialogueChoice objects.
             while (nodeIter.MoveNext())
             {
                 switch (nodeIter.Current.Name)
                 {

                     case "children":
                         //read and parse this comma delimited string, turn it into a List<int> object
                         String ChildrenString = nodeIter.Current.Value;
                         string[] childrenArray = ChildrenString.Split(',');
                         foreach (string s in childrenArray)
                         {
                             children.Add(Convert.ToInt32(s));
                         }
                         break;
                     case "condition":
                         //create condition and add it to condition list.
                         Condition condition = new Condition();
                         //go through condition attribute values and populate the condition object with them.
                         String subject = nodeIter.Current.GetAttribute("subject", "");
                         condition.Subject = subject;

                         String attribute = nodeIter.Current.GetAttribute("attribute", "");
                         condition.Attribute = attribute;

                         String upperLimit = nodeIter.Current.GetAttribute("upperLimit", "");
                         if (upperLimit != "")
                             condition.UpperLimit = Convert.ToInt32(upperLimit);

                         String lowerLimit = nodeIter.Current.GetAttribute("lowerLimit", "");
                         if (lowerLimit != "")
                             condition.LowerLimit = Convert.ToInt32(lowerLimit);

                         String value = nodeIter.Current.Value;
                         if (value != "")
                             condition.Value = Convert.ToInt32(value);

                         String type = nodeIter.Current.GetAttribute("type", "");
                         condition.Type = type;

                         String decisionID = nodeIter.Current.GetAttribute("id", "");
                         if (decisionID != "")
                             condition.DecisionID = Convert.ToInt32(decisionID);

                         conditions.Add(condition);
                         break;

                     case "effect":
                         effect effect = new effect();

                         String effectType = nodeIter.Current.GetAttribute("type", "");
                         effect.type = effectType;

                         String effectSubject = nodeIter.Current.GetAttribute("subject", "");
                         effect.Subject = effectSubject;

                         String effectAttribute = nodeIter.Current.GetAttribute("attribute", "");
                         effect.Attribute = effectAttribute;

                         String effectChange = nodeIter.Current.GetAttribute("change", "");
                         if (effectChange != "")
                             effect.change = Convert.ToInt32(effectChange);

                         String effectDecisionId = nodeIter.Current.GetAttribute("id", "");
                         if (effectDecisionId != "")
                             effect.DecisionID = Convert.ToInt32(effectDecisionId);

                         String decisionValue = nodeIter.Current.Value;
                         int n;
                         if (Int32.TryParse(decisionValue, out n))
                          effect.DecisionValue = Convert.ToInt32(decisionValue);

                         String effectDescription = nodeIter.Current.GetAttribute("desc", "");
                         effect.Description = effectDescription;

                         effects.Add(effect);

                         break;

                     case "text":
                         text = nodeIter.Current.Value;
                         break;

                     case "id":
                         //add one to the response counter - we got a new response!
                         ResponseCounter += 1;
                         id = Convert.ToInt32(nodeIter.Current.Value);
                         //Now we can create a new response object and fill it.

                         DialogueResponse Response = new DialogueResponse();

                         Response.Day = day;
                         Response.ID = id;
                         Response.Text = text;
                         Response.children = children;
                         Response.Conditions = conditions;
                         Response.Effects = effects;
                         //Add new response to response list

                         UnparsedResponses.Add(Response);

                         //reset values to default for the next dialogue

                         id = 0;
                         text = "";
                         children = new List<int>();
                         conditions = new List<Condition>();
                         break;
                 }
             }
             DialogueResponse parsedResponses = ParseResponses(UnparsedResponses, player);

             return parsedResponses;
        }
예제 #23
0
    public override List <Dialogue> Dialogues()
    {
        List <Dialogue> dialogues = new List <Dialogue>();

        DialogueResponse[] options        = null;
        string             prompt         = "";
        string             optionText     = "";
        string             optionResponse = "";
        DialogueResponse   option0        = null;
        DialogueResponse   option1        = null;
        DialogueResponse   option2        = null;
        DialogueResponse   option3        = null;

        List <DialogueMoment> dialogueMomentsList = null;

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = "Ahh yes it is very good to be here, no? I am very pleased to have been invited to talk alliances with such a noble and august family as yours. ";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "I am very grateful you could attend.";
        optionResponse = "Oh well now my young prince ..  is this what you call hospitality? I am truly astonished you think it beneath you offer me some refreshment. If you don’t have the foresight to know something as simple as “your noble guests require your attention” I don’t know how you expect me to trust that you can know the much more complicated and deadly business of War.";
        option0        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "It is my great pleasure to be able to host you at this meeting of my War Council. [offer him some water]";
        optionResponse = "What is this? Water? My dear prince, I am no common farmer and am frankly astonished you would treat me as such. You surely must know a noble guest requires a noble drink.";
        option1        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "It is my great pleasure to be able to host you at this meeting of my War Council. [offer him some fine wine]";
        optionResponse = "Ahh thank you! My my this is a fine vintage you have .. it pairs nicely with the boiled sheep your chef has prepared.";
        option2        = new DialogueResponse(optionText, 0.2f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = "But enough about hospitality .. let us move on to the more pressing matter of War. What are your plans for the coming engagement?";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "I have a most cunning plan that will lure Hildegaard’s barbarian horde into a deadly trap. While I can’t reveal the details until you’ve committed your forces, I can say its deviousness would make even your storied grandfather proud.";
        optionResponse = "Oh well I certainly must have no idea what you mean by that comment! My grandfather was a most noble man .. not some lowborn common who engages in the kind of illicit or ‘devious’ behavior.. why I never!";
        option0        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "With your help, most honorable Viscount Philip, we will ride out with superior numbers and crush the barbarian invaders in honorable and noble combat.";
        optionResponse = "I suppose that would work if you have the numbers .. though it pains me to remind you really ought to refer to me by my full and proper title .. the First Elector and Lord Protector of the Order of the Sacred Flame isn’t some trivial string of words that we added to the family name for no reason!";
        option1        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "The plan is hardly important .. with The Right Honorable Viscount Philip du Conneaut, First Elector and Lord Protector of the Order of the Sacred Flame riding into the fray at my right hand, there is no way Fate would allow us to fail!";
        optionResponse = "Ahh such bravado! How wonderful! Lesser men might think war just a numbers game but you seem to realize the true importance of noble intention and in determining an event’s outcome!";
        option2        = new DialogueResponse(optionText, 0.6f, optionResponse);
        optionText     = "Ahh I must apologize …  please excuse me, while I attend to my other guests.";
        optionResponse = "";
        option3        = new DialogueResponse(optionText, 0.0f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2, option3 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = "But enough of this talk of war .. you really must share your secret for this delicious meal! I don’t think I’ve ever had boiled sheep and skewered peppers this good before in my life .. and I say this as a man who has enjoyed all the delights Bergiminy has to offer..";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "[summon the chef to explain how the meal was prepared]";
        optionResponse = "Oh dear me .. do you .. do you really expect me to talk with a servant about cooking? Clearly I meant to have your chef speak with my chef, my dear prince .. honestly I don’t know what kind of person you take me for but I am not one who sullies himself with the common drudgery of cooking!";
        option0        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "You know .. I really couldn’t say why it’s so good, as I don’t bother myself with going-ons of my lowly kitchen servants. But I am glad you like it .. the First Elector and Lord Protector of the Order of the Sacred Flame deserves no less.";
        optionResponse = "Ahh then perhaps it is best left a mystery .. still though .. if your chef should suddenly go missing .. don’t be too upset if it turns out I kidnapped them! Hahahaa of course I am joking .. I would never do something so tawdry as that.";
        option1        = new DialogueResponse(optionText, 0f, optionResponse);
        optionText     = "I will be sure to have my chef speak with yours before your party departs .. and that you don’t leave without a cask of our finest wine.";
        optionResponse = "Oh how kind! You certainly know how a man of ancient and noble lineage such as myself deserves to be treated.";
        option2        = new DialogueResponse(optionText, 0.2f, optionResponse);
        optionText     = "Ahh I must apologize …  please excuse me, while I attend to my other guests.";
        optionResponse = "";
        option3        = new DialogueResponse(optionText, 0.0f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2, option3 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        return(dialogues);
    }
예제 #24
0
        public static DialogueResponse ParseResponses(List<DialogueResponse> responses, Character.Player player)
        {
            DialogueResponse finalResponse = new DialogueResponse();

            bool saveResponse = true;

            foreach (DialogueResponse response in responses)
            {
                saveResponse = true;
                //cycle through each condition, and see if it applies.
                for (int i = 0; i < response.Conditions.Count; i++)
                {
                    Condition currentCondition = response.Conditions[i];
                    //there are two types of conditions, ones based on decisions, and ones based relationships. They have different requirnments to be valid.
                    switch (currentCondition.Type)
                    {
                        case ("rel"):
                            //check if this condition has all the necessary attributes. If not, throw an error.
                            if (currentCondition.Subject == null || currentCondition.Attribute == null || currentCondition.UpperLimit == null || currentCondition.LowerLimit == null)
                            {
                                throw new System.InvalidOperationException("This condition is a type 'rel' but doesnt have the necessary attributes: Subject, Attribute, Compare, Value");
                            }
                            else
                            {
                                //test condition

                                if (currentCondition.Subject != "player")
                                {
                                    Character.NPC npcSubject = (Quarantine.NPCs.Find(npc => npc.Name == currentCondition.Subject));
                                    //we found the NPC who is the subject of this condition

                                    var property = typeof(Character.NPC).GetProperty(currentCondition.Attribute);

                                    var propValue = Convert.ToInt32(property.GetValue(npcSubject, null));

                                    Console.WriteLine(String.Format("{0} is the subject; his/her {1} attribute has a value of {2}", npcSubject.Name, property.Name, propValue));

                                    //find out if this condition is met. If not, remove its parent response from the list

                                    if (propValue <= currentCondition.UpperLimit && propValue >= currentCondition.LowerLimit)
                                    {
                                        Console.WriteLine("Response Condition Accepted!, {0} is between the lower limit {1} and the upper limit {2}", property.Name, currentCondition.LowerLimit, currentCondition.UpperLimit);
                                        finalResponse = response;
                                    }
                                    else
                                    {
                                        saveResponse = false;
                                    }

                                }
                                else
                                {
                                    // subject of this condition is the player.
                                }
                                //Let's set a value
                                //property.SetValue(npcSubject, 99, null);

                                //var newPropValue = property.GetValue(npcSubject, null);

                                //Console.WriteLine(String.Format("{0} has a value of {1}", property.Name, newPropValue));

                            }
                            break;
                        case ("dec"):
                            //check if this condition has all the necessary attributes If not, throw an error.
                            if (currentCondition.DecisionID == 0 || currentCondition.Value == 0)
                            {
                                throw new System.InvalidOperationException("This condition is a type 'dec' but doesnt have the necessary attributes: DecisionID, Value");
                            }
                            else
                            {

                                //see if the given value matches the player's given value for this decision, if it exists.
                                Character.Player currentPlayer = Quarantine.Player;
                                if ((player.decisions.FindIndex(decision => decision.id == currentCondition.DecisionID)) != null)
                                {
                                    //the player has made this decision
                                    int index = (player.decisions.FindIndex(decision => decision.id == currentCondition.DecisionID));

                                    if (player.decisions[index].value == currentCondition.Value)
                                    {
                                    }
                                    else
                                    {
                                        saveResponse = false;
                                    }

                                }
                                else
                                {
                                    //the player has not made this choice, or their choice doesnt match the condition.
                                    saveResponse = false;
                                }

                            }
                            break;
                    }
                }
                //remove it from the list of responses if necessary
                if (saveResponse == true)
                {
                   finalResponse = response;
                }
            }
            return finalResponse;
        }
예제 #25
0
파일: LeeHub.cs 프로젝트: travo12/GameCode
 public void SendMessage(string message)
 {
     var response = new DialogueResponse {Dialogue = message };
     Clients.Caller.DisplayDialogue(response);
 }
예제 #26
0
        /*deserialization test
        public static string TestFileLocation = @"C:\Users\Robbie\Desktop\vidya\Quarantine\TestXML.xml";

        [DataContract(Name = "DialogueTest", Namespace = "")]
        public class DialogueTest
        {
            [DataMember]
            public int id;

            [DataMember]
            public bool Root;

            [DataMember]
            public List<int> children;

            [DataMember]
            public int Day;

            [DataMember]
            public List<Condition> Conditions;

            [DataMember]
            public string Text;

            [DataMember]
            public string Effect;
        }

        public static DialogueTest getDialogueTest(int day, List<int> ChoiceChildren)
        {
            DataContractSerializer dcs = new DataContractSerializer(typeof(DialogueTest));
            FileStream fs = new FileStream(TestFileLocation, FileMode.Open);
            XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(fs, new XmlDictionaryReaderQuotas());

            DialogueTest test = (DialogueTest)dcs.ReadObject(reader);

            return test;
        }

        //end deserialization test*/
        public static void parseEffects(DialogueResponse response)
        {
            if (response.Effects.Count > 0)
            {
                foreach (effect e in response.Effects)
                {
                    switch (e.type)
                    {
                        case "immediate":
                            // look for subject, attribute, etc
                            if(e.Subject != null && e.Attribute != null && e.change != null)
                            {
                                Character.ModifyCharacter(e.Subject, e.Attribute, e.change);
                            }
                            break;
                        case "timed":
                            // look for subject attribute, howlong, etc
                            break;
                        case "decision":
                            //look for decisionID, decision value, etc

                            Character.decision decision= new Character.decision();

                            int value = Convert.ToInt32(e.DecisionValue);

                            decision.id = e.DecisionID;
                            decision.value = value;
                            decision.description = e.Description;
                            break;
                    }
                }
            }
        }
예제 #27
0
    public void RefreshDialogue(string newNodeID, bool showResponse)
    {
        //if loading a new node, first create a dialogue entry for it and push into
        //the stack.



        if (newNodeID != "")
        {
            //create dialogue entry
            //Debug.Log("new node ID " + newNodeID);
            DialogueNode node = GameManager.Inst.DBManager.DBHandlerDialogue.GetDialogueNode(newNodeID);

            if (showResponse)
            {
                DialogueResponse response = EvaluateResponse(node.Responses);
                if (response != null)
                {
                    DialogueEntry entry = CreateDialogueEntry(GetSpeakerName(), ParseDialogueText(response.Text), false);

                    _entries.Push(entry);

                    //check if response has an event
                    if (response.Events != null && response.Events.Count > 0)
                    {
                        foreach (string e in response.Events)
                        {
                            if (GameManager.Inst.QuestManager.Scripts.ContainsKey(e))
                            {
                                StoryEventScript script = GameManager.Inst.QuestManager.Scripts[e];
                                script.Trigger(new object[] {});
                            }
                        }
                    }
                }
            }

            //create dialogue options relevant to this node
            foreach (Topic option in node.Options)
            {
                if (EvaluateTopicConditions(option.Conditions))
                {
                    DialogueOptionEntry optionEntry = new DialogueOptionEntry();

                    GameObject o = GameObject.Instantiate(Resources.Load("TopicEntry")) as GameObject;
                    optionEntry.Text      = o.GetComponent <UILabel>();
                    optionEntry.Text.text = option.Title;
                    TopicReference reference = o.GetComponent <TopicReference>();
                    reference.Topic = option;
                    UIButton button = o.GetComponent <UIButton>();
                    button.onClick.Add(new EventDelegate(this, "OnSelectTopic"));

                    _options.Add(optionEntry);
                }
            }
        }

        //create topics entry
        Character    target = GameManager.Inst.PlayerControl.SelectedPC.MyAI.BlackBoard.InteractTarget;
        List <Topic> topics = GameManager.Inst.DBManager.DBHandlerDialogue.GetNPCTopics(target, null);

        foreach (Topic topic in topics)
        {
            //if we are not at root node then don't show info topics
            if (topic.Type == TopicType.Info && _currentNodeID != _rootNode)
            {
                continue;
            }

            //if topic is not known to player, don't show it

            if (topic.Type == TopicType.Info && !GameManager.Inst.PlayerProgress.IsTopicDiscovered(topic.ID))
            {
                continue;
            }


            TopicEntry entry = new TopicEntry();

            GameObject o = GameObject.Instantiate(Resources.Load("TopicEntry")) as GameObject;
            entry.Text      = o.GetComponent <UILabel>();
            entry.Text.text = topic.Title;
            TopicReference reference = o.GetComponent <TopicReference>();
            reference.Topic = topic;
            UIButton button = o.GetComponent <UIButton>();
            button.onClick.Add(new EventDelegate(this, "OnSelectTopic"));
            BoxCollider2D collider = o.GetComponent <BoxCollider2D>();
            collider.size = new Vector2(collider.size.x, 27);
            entry.Type    = topic.Type;

            _topics.Add(entry);
        }

        //now make a copy of the stack, and start popping entries out of it, and arrange them under the dialog panel
        Stack <DialogueEntry> copy = new Stack <DialogueEntry>(_entries.Reverse());
        float currentY             = -260;

        _totalHeight = 0;
        int i = 0;

        while (copy.Count > 0)
        {
            DialogueEntry entry = copy.Pop();
            entry.SpeakerName.transform.parent = DialogueEntryAnchor.transform;
            entry.SpeakerName.MakePixelPerfect();
            entry.Text.transform.parent = DialogueEntryAnchor.transform;
            entry.Text.MakePixelPerfect();

            float height = Mathf.Max(entry.SpeakerName.height * 1f, entry.Text.height * 1f);


            entry.SpeakerName.transform.localPosition = new Vector3(-150, currentY + height, 0);
            entry.Text.transform.localPosition        = new Vector3(22, currentY + height, 0);



            currentY      = currentY + height + 15;
            _totalHeight += (height + 15);


            if (_totalHeight < 400)
            {
                DialogueEntryAnchor.localPosition = new Vector3(-210, 0 - _totalHeight, 0);
                _dialogueAnchorTarget             = new Vector3(-210, 175 - _totalHeight, 0);
            }
            else
            {
                DialogueEntryAnchor.localPosition = new Vector3(-210, -220, 0);
                _dialogueAnchorTarget             = new Vector3(-210, -175, 0);
            }


            i++;
        }
        //now re-add collider to fix collider size

        NGUITools.AddWidgetCollider(DialogueScroll.gameObject);

        /*
         * if(_intro != null)
         * {
         *      _intro.transform.parent = DialogueEntryAnchor.transform;
         *      _intro.MakePixelPerfect();
         *      _intro.transform.localPosition = new Vector3(-150, currentY + _intro.height, 0);
         * }
         */

        //arrange topic entries
        currentY = 200;
        TopicScroll.ResetPosition();
        foreach (TopicEntry entry in _topics)
        {
            entry.Text.transform.parent = TopicAnchor.transform;
            entry.Text.MakePixelPerfect();


            entry.Text.transform.localPosition = new Vector3(0, currentY, 0);

            currentY = currentY - entry.Text.height;



            if (entry.Text.text == "Goodbye")
            {
                currentY = currentY - 15;
            }

            if (entry.Type != TopicType.Info)
            {
                entry.Text.color = new Color(0.5f, 0.5f, 0.8f);
            }
        }

        //now re-add collider to fix collider size
        //NGUITools.AddWidgetCollider(TopicScroll.gameObject, false);

        float currentX = -128;

        foreach (DialogueOptionEntry entry in _options)
        {
            entry.Text.transform.parent = DialogueOptionScroll.transform;
            entry.Text.MakePixelPerfect();
            entry.Text.width = entry.Text.text.Length * 15;
            entry.Text.transform.localPosition = new Vector3(currentX, 78, 0);

            BoxCollider2D collider = entry.Text.GetComponent <BoxCollider2D>();
            collider.size = new Vector2(collider.size.x, 27);

            currentX = currentX + entry.Text.width + 20;
        }
    }
예제 #28
0
        void OnGUI()
        {
            if (dialogue == null)
            {
                return;
            }
            if (!isActive)
            {
                if (GUI.Button(new Rect(Screen.width * .5f, Screen.height * .5f, 200, 22), "Start Dialogue"))
                {
                    isActive = true;
                    dialogueController.startDialogue(this, this);
                }

                return;
            }

            const float uiRespHeight          = 22;
            const float uiRespBlockHeight     = uiRespHeight + 3;
            const float uiContentHeaderHeight = 20;
            const float uiContentOffset       = uiContentHeaderHeight + 3;
            const float uiContentHeight       = 105;
            const float uiResponseHeight      = 6 * uiRespHeight + 8;
            const float uiFullHeight          = uiContentHeight + uiResponseHeight;
            const float m = 4;

            float sw = Screen.width - 2 * m;
            float sh = Screen.height - m;

            Rect fullRect = new Rect(m, sh - uiFullHeight, sw, uiFullHeight);

            DialogueContent content = dialogueController.getCurrentContent();

            DialogueResponse[] responses   = dialogueController.getCurrentResponses();
            string             contentTxt  = content.text;
            string             charNameTxt = dialogue.characters[content.speakerId].name;

            GUI.BeginGroup(fullRect);
            GUI.Box(new Rect(0, 0, fullRect.width, fullRect.height), "");

            // Content block:
            Rect contRect   = new Rect(m, m + uiContentOffset, fullRect.width - 2 * m, uiContentHeight);
            Rect headerRect = new Rect(contRect.x, 0, contRect.width, uiContentHeaderHeight);

            GUI.Label(headerRect, string.Format("<b>{0}:</b>", charNameTxt));
            GUI.Label(contRect, contentTxt);

            // Response block:
            Rect respRect = new Rect(contRect.x, fullRect.height - uiResponseHeight - m, contRect.width, uiResponseHeight);

            GUI.BeginGroup(respRect);

            // Show all available response options:
            for (int i = 0; i < responses.Length; ++i)
            {
                Rect             iRespRect = new Rect(0, i * uiRespBlockHeight, respRect.width, uiRespHeight);
                DialogueResponse response  = responses[i];
                string           iRespTxt  = response.responseText;

                // Display each response as a simple button:
                if (GUI.Button(iRespRect, iRespTxt))
                {
                    // Call onto dialogue controller to select this response:
                    dialogueController.selectResponse(i);
                }
            }

            GUI.EndGroup();
            GUI.EndGroup();

            // Quest popup:
            float       questPopupDelta   = Time.time - uiQuestPopupTime;
            const float questPopupMaxTime = 3.0f;

            if (questPopupDelta < questPopupMaxTime)
            {
                Color prevCol = GUI.color;

                float alpha = 1 - Mathf.Clamp01((questPopupDelta - 1.0f) / (questPopupMaxTime - 1.0f));
                GUI.color = new Color(1, 0.75f, 0, alpha);
                GUI.Box(new Rect(Screen.width * .5f - 180, 128, 360, 60), "New Quest:\n<b>Saving the princess.</b>");

                GUI.color = prevCol;
            }
        }
 private void SetupResponse()
 {
     currentResponse = currentScene.GetLine(currentLineIndex).Response; //Get the response (next, complete, accept, etc) of this dialogue line
     rightButton.GetComponentInChildren <TextMeshProUGUI>().SetText(currentResponse.ResponseText);
 }
예제 #30
0
    public override List <Dialogue> Dialogues()
    {
        List <Dialogue> dialogues = new List <Dialogue>();

        DialogueResponse[] options        = null;
        string             prompt         = "";
        string             optionText     = "";
        string             optionResponse = "";
        DialogueResponse   option0        = null;
        DialogueResponse   option1        = null;
        DialogueResponse   option2        = null;
        DialogueResponse   option3        = null;

        List <DialogueMoment> dialogueMomentsList = null;

        dialogueMomentsList = new List <DialogueMoment>();
        dialogueMomentsList.Add(new TextDialogueMoment("Hello my old friend. I am pleased to have been invited to this Great Council of War. Could you get me something to drink?"));
        option0 = new DialogueResponse("I am very grateful you could attend. [pass him a flagon of water]", 0.0f, "");
        option1 = new DialogueResponse("We are overjoyed at your presence .. I hope to count you among friends on the battlefield [pass him a mug of beer]", 0.0f, "");
        option2 = new DialogueResponse("Our families have a long history together, I couldn’t imagine you not being here [summon a servant to take his order]", 0.0f, "");
        options = new DialogueResponse[] { option0, option1, option2 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        dialogueMomentsList.Add(new TextDialogueMoment("It is good that you have called on me.  Of course our families have a long history of cooperation .. our allegiance in the upcoming battle will echo previous glorious events of our past."));
        optionText     = "I am glad I can count on your support! This is really just another time when we can help each other - just as my family once helped your country out of times of famine you can help us defeat these dreaded barbarians.";
        optionResponse = "Oh my. Well now, I really don’t think it is appropriate of you to bring up such an embarrassing moment in our history. I do not like to be reminded of the time mismanagement and fate conspired to starve so many hundreds of my subjects and we were forced to beg for assistance.";
        option0        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "Yes of course. It will be just like when your grandfather Reginaldus II lead a glorious charge against the main enemy line and saved my grandfather from almost certain doom.";
        optionResponse = "Do you really expect me to fight for someone who can’t even be bothered to remember their history correctly?? My great-grandfather rescued your family’s armies with a surprise attack from the left flank .. hardly the same thing as a frontal charge! For your own sake, I certainly hope you are less inept when the actual battle occurs!";
        option1        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "Indeed our actions will echo previous events. Just as your ancestor Reginaldus II executed a surprise flanking maneuver against the enemy line, I expect you to be no less daring in the upcoming battle.";
        optionResponse = "Ha yes! A great moment in our share pasts. As every great general knows, the key to victory is knowledge of the past. I hope to supporting you similarly on the battlefield.";
        option2        = new DialogueResponse(optionText, 0.2f, optionResponse);
        optionText     = "Ah, yes, of course. Please excuse me, I must attend to my other guests.";
        optionResponse = "";
        option3        = new DialogueResponse(optionText, 0.0f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2, option3 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = "Anyway .. I hope that this will be another opportunity for me to prove myself as my forebears have .. to live up to our long standing credo..";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "Of course .. you absolutely live up to your family’s famous motto: \"The flame of Truth the sword of Justice\"";
        optionResponse = "Well no that isn’t it at all.. Given your apparent disinterest in our affairs it might be time to reevaluate our family’s historic support of your rule.";
        option0        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "Of course .. you absolutely live up to your familiy’s famous motto .. \"Bringing Justice with the Flaming Sword of Truth\"";
        optionResponse = "Well no that isn’t it at all.. Given your apparent disinterest in our affairs it might be time to reevaluate our family’s historic support of your rule";
        option1        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "Of course .. you absolutely live up to your familiy’s famous motto .. \"The Light of Truth the Sword of Justice\"";
        optionResponse = "Ho ho yes that is it word for word! Clearly you care a great deal about my family and our alliance.";
        option2        = new DialogueResponse(optionText, 0.2f, optionResponse);
        optionText     = "Ah, yes, of course. Please excuse me, I must attend to my other guests.";
        optionResponse = "";
        option3        = new DialogueResponse(optionText, 0.0f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2, option3 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        return(dialogues);
    }
예제 #31
0
    public override List <Dialogue> Dialogues()
    {
        List <Dialogue>       dialogues           = new List <Dialogue>();
        List <DialogueMoment> dialogueMomentsList = null;

        DialogueResponse[] options        = null;
        string             prompt         = "";
        string             optionText     = "";
        string             optionResponse = "";
        DialogueResponse   option0        = null;
        DialogueResponse   option1        = null;
        DialogueResponse   option2        = null;
        DialogueResponse   option3        = null;

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = "This is a quite the magnificent fortress you have .. you must be very proud of all you have accomplished. But I didn’t make this trip to spin compliments .. let’s get down to business.";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "Yes of course .. it must have been a very difficult trip. Would you care for refreshment? [offer her a mug of beer]";
        optionResponse = "Oh well I would never drink .. you must know that! How could you not know that? I will try not to judge you by this one mistake too harshly.";
        option0        = new DialogueResponse(optionText, -0.2f, optionResponse);
        optionText     = "Yes I am very proud of my family’s home .. and I am very glad you were able to make it to my War Council. [offer her some wine]";
        optionResponse = "What is this? Oh well I would never drink .. you must know that! How could you not know that? I will try not to judge you by this one mistake too harshly.";
        option1        = new DialogueResponse(optionText, -0.2f, optionResponse);
        optionText     = "It is my great pleasure to be able to host you at this meeting of my War Council. [offer her some water]";
        optionResponse = "Oh well thank you! You are very kind for offer a weary traveler some refreshing water. This is just the stuff to rejuvenate the mind and cleanse the spirit.";
        option2        = new DialogueResponse(optionText, 0.2f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = "I am troubled to hear of the return of Hildegaard and her barbarian army. The last time they tried to invade their propaganda about overthrowing our aristocratic dynasties and replacing them with democratic institutions that respected all people equally before the law almost saw the common people desert their divinely ordained rulers!";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "The common people never know what’s best for them. It is best for everyone that enlightened nobles such as ourselves take up the burden of ruling over these lands.";
        optionResponse = "Yes everyone has their place, as decided by God.. all we can do is play our part in His Divine Plan.";
        option0        = new DialogueResponse(optionText, 0f, optionResponse);
        optionText     = "Truthfully it could be in all of our best interests if we adopted some modest reforms .. for example, I think everyone knows the Divine Right of The Aristocrats is just a tool for holding on to power, rather than an actual mandate from heaven.";
        optionResponse = "How dare you utter such blasphemy! I will never know why God chooses to work through such flawed nobles as yourself.. but He has placed you in your position and it is not my place to question Him";
        option1        = new DialogueResponse(optionText, -0.5f, optionResponse);
        optionText     = "Hidlegaard is a menace that threatens the legitimacy of us all. It is imperative for all of our sakes that we band together to stop her and her minions once and for all!";
        optionResponse = "Yes it would seem so .. but I put my faith in Our Divine Lord .. and less so in the plots of us mere mortals. If it is His Will than we shall be victorious.";
        option2        = new DialogueResponse(optionText, 0f, optionResponse);
        optionText     = "Ahh I must apologize …  please excuse me, while I attend to my other guests.";
        optionResponse = "";
        option3        = new DialogueResponse(optionText, 0.0f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2, option3 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = " I must say, this dinner has been wonderful. The boiled sheep is some of the best I have ever had. Tell me, what kind of sheep is it?";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "You know, I honestly don’t know what kind it is .. I’ve never really been able to taste the difference between different kinds of sheep. But I imagine you can .. your lands are rich with sheep, if I am remembering my geography correctly. ";
        optionResponse = "Well of course I can tell the difference .. how can anyone not tell the difference? Really, these kinds of details are important. If I can trust you to keep up with the little things during a polite dinner party, how on earth can I trust you will keep track of the details that can win or lose a battle? You must do better, young prince.";
        option0        = new DialogueResponse(optionText, -0.3f, optionResponse);
        optionText     = "(Lie) The meat is from Cotswald sheep .. the same for which your lands are famous, if I am remembering correctly.";
        optionResponse = "Cotswald? COTSWALD? HOW DARE YOU BRING UP THE HATED COTSWALD BREED! MY FAMILY WOULD NEVER BE CAUGHT RAISING SUCH AN INFERIOR KIND OF SHEEP! HARUMPH";
        option1        = new DialogueResponse(optionText, -2f, optionResponse);
        optionText     = "(Lie) They meat is from Corriedale sheep .. the same for which your lands are famous, if I am remembering correctly.";
        optionResponse = "Oh you flatter an old woman.. not only do you remember about my family’s prized sheep but you honor me by serving it to us all for dinner. You are truly a clever one!";
        option2        = new DialogueResponse(optionText, 1f, optionResponse);
        optionText     = "Ahh I must apologize …  please excuse me, while I attend to my other guests.";
        optionResponse = "";
        option3        = new DialogueResponse(optionText, 0.0f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2, option3 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        return(dialogues);
    }
예제 #32
0
    public override List <Dialogue> Dialogues()
    {
        List <Dialogue>       dialogues           = new List <Dialogue>();
        List <DialogueMoment> dialogueMomentsList = null;

        DialogueResponse[] options        = null;
        string             prompt         = "";
        string             optionText     = "";
        string             optionResponse = "";
        DialogueResponse   option0        = null;
        DialogueResponse   option1        = null;
        DialogueResponse   option2        = null;
        DialogueResponse   option3        = null;

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = "Dang ol I tell you hwat mang but I am just pleased as a scoundrel that y’all would invite me out here for your Great War Council.";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "It wouldn’t think of hosting a War Council without calling upon our old allies in Nova Bama. It is in times like these that all of us must band together – Hildegaard is a threat to the very foundations of our culture.";
        optionResponse = "Well now ain’t this just the height of insult – did you not prepare for our consult? When you address Lord Kevin, he most high, you must rhyme your words, or expect no reply";
        option0        = new DialogueResponse(optionText, -0.4f, optionResponse);
        optionText     = "I thank you for making the trip .. it must have been a long journey, please have some refreshment.";
        optionResponse = "Well now ain’t this just the height of insult – did you not prepare for our consult? When you address Lord Kevin, he most high, you must rhyme your words, or expect no reply!";
        option1        = new DialogueResponse(optionText, -0.4f, optionResponse);
        optionText     = "We see ourselves blessed to host such a guest. [offer him some fresh sheep meat]";
        optionResponse = "It pleases me that you honor paradigm, that when you speak it is in rough rhyme so you can expect my support when it comes wartime.";
        option2        = new DialogueResponse(optionText, 0.4f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = "Though I am not proud of it, I’ll tell you true .. things are getting kind of rough out in the bayou. But I can promise that if can make it worthwhile me and mine then you and yours will end up just fine.";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "(Lie) Oh? Oh! Right of course.. certainly if you pledge your support to my cause I will personally make sure you are amply rewarded with as much gold as you can carry.";
        optionResponse = "ell now ain’t this just the height of insult – did you not prepare for our consult? When you address Lord Kevin, he most high, you must rhyme your words, or expect no reply!";
        option0        = new DialogueResponse(optionText, -0.4f, optionResponse);
        optionText     = "(Truth) I must appeal to your sense of honor, and take the risk I’ll be a goner .. for at this time we have no gold to spare and all I can promise is my support in any future warfare.";
        optionResponse = "I appreciate the rhyme, I’ll give you that .. but I need an offer of gold if you want help skinning this cat.  ";
        option1        = new DialogueResponse(optionText, 0f, optionResponse);
        optionText     = "(Lie) Name your price in silver or gold, and you have my word you’ll be rich till yer old!";
        optionResponse = "I’m glad we could come to an understanding, it’ll help me clear all my debts outstanding.";
        option2        = new DialogueResponse(optionText, 0.6f, optionResponse);
        optionText     = "Ahh I must apologize …  please excuse me, while I attend to my other guests.";
        optionResponse = "";
        option3        = new DialogueResponse(optionText, 0.0f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2, option3 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        dialogueMomentsList = new List <DialogueMoment>();
        prompt = "Well it seems this evening is coming to a close, and things have gone well as far as that goes. But before I depart and head back to my lands, could you to tell me where your plan stands?";
        dialogueMomentsList.Add(new TextDialogueMoment(prompt));
        optionText     = "The plan is to ride out and meet Hildegaard head in the field .. with a little luck and noble allies at my side, we’ll take the day and crush the barbarian invaders.";
        optionResponse = "Well now ain’t this just the height of insult – did you not prepare for our consult? When you address Lord Kevin, he most high, you must rhyme your words, or expect no reply!";
        option0        = new DialogueResponse(optionText, -0.4f, optionResponse);
        optionText     = "I will unite my allies and bring them to the field. Then we’ll all fight together, and make Hildegaard yield!";
        optionResponse = "I appreciate the rhyme, I’ll give you that .. but I need an offer of gold if you want help skinning this cat.  ";
        option1        = new DialogueResponse(optionText, 0f, optionResponse);
        optionText     = "(Lie) My allies and I will march to battle and we’ll stomp out Hildegaard’s rabble. And I promise to you that my allies so bold will find their pockets heavy, laden with gold.";
        optionResponse = "If golds on offer, you can count me in. And when I fight for money I usually win.";
        option2        = new DialogueResponse(optionText, 0.2f, optionResponse);
        optionText     = "Ahh I must apologize …  please excuse me, while I attend to my other guests.";
        optionResponse = "";
        option3        = new DialogueResponse(optionText, 0.0f, optionResponse);
        options        = new DialogueResponse[] { option0, option1, option2, option3 };
        dialogueMomentsList.Add(new ResponseDialogueMoment(options));
        dialogues.Add(new Dialogue(dialogueMomentsList.ToArray()));

        return(dialogues);
    }