Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string bot = (string)whichBotTestComboBox.SelectedItem;

            ConversationalItem ci = null;

            try
            {
                ci = Conversational.Instance.GetBotConversationByID(bot, int.Parse(textBox1.Text));
            }
            catch (FormatException)
            {
                MessageBox.Show("Please enter only numbers.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (ci != null)
            {
                ChangeConversation(ci);
            }
            else
            {
                MessageBox.Show("There is no conversation at ID: " + textBox1.Text + "\nPlease check your logic", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        void objList_SelectedIndexChange(ListBox sender)
        {
            objUpdates.Items.Clear();
            ProjectEntities.VBFactionManager.ObjectiveManager.Objective o = obj.Objectives[objList.SelectedIndex];

            ConversationalItem ci = Conversational.Instance.GetBotConversationByID("missions", o.DataBaseIndex());

            foreach (int index in o.LogEntries)
            {
                objUpdates.Items.Add(ci.ConversationalResponseItems.ResponseItems[index].Response);
            }
        }
Example #3
0
        private void LoadConversation(string selectedBot)
        {
            ConversationalItem ci = Conversational.Instance.GetBotFirstConversationItem(selectedBot);

            if (ci != null)
            {
                ChangeConversation(ci);
            }
            else
            {
                tableLayoutPanel1.Visible = false;

                MessageBox.Show("This bot has no conversations to test, please add some...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        public void LoadConversation(string selectedBot, VBCharacter tmpent)
        {
            BotName     = selectedBot;
            convPartner = tmpent;

            ConversationalItem ci = Conversational.Instance.GetBotFirstConversationItem(selectedBot);

            if (ci != null)
            {
                ChangeConversation(ci);
            }
            else
            {
                // Bot Not Found In File!
            }
        }
Example #5
0
        private void conversationResponseListBox_MouseClick(object sender, MouseEventArgs e)
        {
            string botName = (string)whichBotTestComboBox.SelectedItem;

            int selectedItem = conversationResponseListBox.IndexFromPoint(e.X, e.Y);

            if (selectedItem == -1)
            {
            }
            else
            {
                ConversationalResponseItem cri = (ConversationalResponseItem)conversationResponseListBox.Items[selectedItem];

                if (cri.EngineCommand != "")
                {
                    MessageBox.Show("Parse engine command " + cri.EngineCommand);
                }

                if (cri.To != 0)
                {
                    ConversationalItem ci = Conversational.Instance.GetBotConversationByID(botName, cri.To);

                    if (ci != null)
                    {
                        ChangeConversation(ci);
                    }
                    else
                    {
                        tableLayoutPanel1.Visible = false;

                        MessageBox.Show("There is no conversation at ID: " + cri.To.ToString() + "\nPlease check your logic", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    tableLayoutPanel1.Visible = false;

                    whichBotTestComboBox.SelectedIndex = 0;
                    whichBotTestComboBox.Text          = string.Empty;

                    MessageBox.Show("You have completed your conversation with " + botName, "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    tabControl.SelectTab(tabPageConfig);
                }
            }
        }
Example #6
0
        private void ChangeConversation(ConversationalItem ci)
        {
            string selectedBot = ci.BotName;

            conversationSayTextBox.Text = ci.Say;

            conversationResponseListBox.Items.Clear();

            foreach (ConversationalResponseItem responseItem in ci.ConversationalResponseItems.ResponseItems)
            {
                conversationResponseListBox.Items.Add(responseItem);
            }

            currentIDTextBox.Text = ci.ConversationID.ToString();

            tableLayoutPanel1.Visible = true;
        }
Example #7
0
        private void ChangeConversation(ConversationalItem ci)
        {
            string selectedBot = ci.BotName;

            conversationSayTextBox.Text = ci.Say;
            conversationResponseListBox.Items.Clear();

            foreach (ConversationalResponseItem responseItem in ci.ConversationalResponseItems.ResponseItems)
            {
                if (responseItem.VisibilityOptions != "")
                {
                    bool shouldAdd = false;

                    if (responseItem.VisibilityOptions != "")
                    {
                        string[] commandsList = responseItem.VisibilityOptions.Split(' ');

                        foreach (string command in commandsList)
                        {
                            shouldAdd = ParseVisibilityCommand(command.Split('$'));
                        }
                    }
                    else
                    {
                        shouldAdd = true;
                    }

                    if (shouldAdd)
                    {
                        conversationResponseListBox.Items.Add(responseItem);
                    }
                }
                else
                {
                    AddListboxResponse(conversationResponseListBox, responseItem);
                }
            }
        }
Example #8
0
        void conversationResponseListBox_SelectedIndexChange(ListBox sender)
        {
            int selectedItem = conversationResponseListBox.SelectedIndex;

            if (selectedItem == -1)
            {
            }
            else
            {
                ConversationalResponseItem cri = (ConversationalResponseItem)conversationResponseListBox.Items[conversationResponseListBox.SelectedIndex];

                if (cri.EngineCommand != "")
                {
                    string[] commandsList = cri.EngineCommand.Split(' ');

                    foreach (string command in commandsList)
                    {
                        ParseEngineCommand(command.Split('$'));
                    }
                }

                if (cri.To != 0)
                {
                    ConversationalItem ci = Conversational.Instance.GetBotConversationByID(BotName, cri.To);

                    if (ci != null)
                    {
                        ChangeConversation(ci);
                    }
                }
                else
                {
                    SetShouldDetach();
                }
            }
        }