示例#1
0
        // UI event
        public string OnUserInput()
        {
            string      value = "";
            OnUserInput oo    = new OnUserInput(this.s, this.header);
            Type        t     = oo.GetType();
            MethodInfo  mi    = t.GetMethod(this.reference(0));

            try
            {
                object o = mi.Invoke(oo, null);
                value = (string)o;
            }
            catch (NullReferenceException)
            {
            }
            return(value);
        }
示例#2
0
 // UI event
 public string OnUserInput()
 {
     string value = "";
     OnUserInput oo = new OnUserInput(this.s, this.header);
     Type t = oo.GetType();
     MethodInfo mi = t.GetMethod(this.reference(0));
     try
     {
         object o = mi.Invoke(oo, null);
         value = (string)o;
     }
     catch (NullReferenceException)
     {
     }
     return value;
 }
        public void GetNextMessage()
        {
            string message = Console.ReadLine();

            OnUserInput?.Invoke(this, message);
        }
示例#4
0
    void Update()
    {
        if (chatBox.text == "" && done == true)
        {
            SendMessageToChat("What can I do for you?", Message.MessageType.info);
            done = false;
        }

        if (chatBox.text != "")
        {
            if (Input.GetKeyDown(KeyCode.Return))
            {
                SendMessageToChat(" Question: " + chatBox.text, Message.MessageType.userMessage);
                chatBox.text = chatBox.text.ToLower();
                // Profanity Check
                if (chatBox.text.Contains("f**k") || chatBox.text.Contains("ass") || chatBox.text.Contains("shit"))
                {
                    SendMessageToChat("Answer: I'm sorry but I can't help you if you are rude to me. Feel free to me ask another question, but without the profanity, please.", Message.MessageType.userMessage);
                    _questionOptions = false;
                }
                // Sizing Guide
                else if (chatBox.text.Contains("size") || chatBox.text.Contains("fit"))
                {
                    SendMessageToChat("Answer: Would you like to see the OneStop sizing guide?", Message.MessageType.userMessage);
                    _questionOptions = true;
                    OnUserInput?.Invoke(this, System.EventArgs.Empty);

                    YB.onClick.AddListener(TaskOnClick);
                    NB.onClick.AddListener(Clicked);
                }
                // Colour Check - Product Specifications
                else if (chatBox.text.Contains("colo")) // American 'Color' and Australian/British 'Colour'
                {
                    SendMessageToChat("Answer: The range of colours are black, blue, green, red, orange, yellow, pink and purple.", Message.MessageType.userMessage);
                    _questionOptions = false;
                }
                // Material Check - Product Specifications
                else if (chatBox.text.Contains("material") || chatBox.text.Contains("made"))
                {
                    SendMessageToChat("Answer: This product is made from 100% Cotton. Is there anything else I can help you with?", Message.MessageType.userMessage);
                    _questionOptions = false;

                    YB.onClick.AddListener(TaskOnClick3);
                    NB.onClick.AddListener(Clicked);
                }
                // Product Review / Seller Review - Potential Ban System
                else if (chatBox.text.Contains("trust") || chatBox.text.Contains("rating") || chatBox.text.Contains("review") || chatBox.text.Contains("report"))
                {
                    SendMessageToChat("Answer: This seller has a OneStop Rating of 4.7/5. Would you like to submit a review?", Message.MessageType.userMessage);
                    _questionOptions = true;
                    OnUserInput?.Invoke(this, System.EventArgs.Empty);

                    YB.onClick.AddListener(TaskOnClick1);
                    NB.onClick.AddListener(Clicked);
                }
                // Delivery Tracking System
                else if ((chatBox.text.Contains("where") && chatBox.text.Contains("my")) || chatBox.text.Contains("when") || chatBox.text.Contains("delivery") || chatBox.text.Contains("track"))
                {
                    SendMessageToChat("Answer: OneStop Delivery Tracking is only available for OneStop account holders. Please contact the seller directly or would you like to sign up for free?", Message.MessageType.userMessage);
                    _questionOptions = true;
                    OnUserInput?.Invoke(this, System.EventArgs.Empty);

                    YB.onClick.AddListener(TaskOnClick2);
                    NB.onClick.AddListener(Clicked);
                }
                // Shopping Cart / Purchase Screen - Guest Checkout / Member Checkout
                else if (chatBox.text.Contains("pay") || chatBox.text.Contains("check") || chatBox.text.Contains("buy"))
                {
                    SendMessageToChat("Answer: Receive 10% off your entire cart if you sign up today for free or you can use OneStop's quick and easy guest checkout. Do you want to go to your shopping cart?", Message.MessageType.userMessage);
                    _questionOptions = true;
                    OnUserInput?.Invoke(this, System.EventArgs.Empty);

                    YB.onClick.AddListener(TaskOnClick4);
                    NB.onClick.AddListener(Clicked);
                }
                // Invalid Question / Input
                else
                {
                    SendMessageToChat("Answer: Sorry, I'm a dumb sloth and I couldn't understand your question. Please try again.", Message.MessageType.userMessage);
                    _questionOptions = false;
                }
                // _panelManager.SetTextOrChoice();
                // SendMessageToChat(username + ": " + chatBox.text, Message.MessageType.userMessage);
                chatBox.text = "";
            }
        }
        {
            if (!chatBox.isFocused && Input.GetKeyDown(KeyCode.Return))
            {
                chatBox.ActivateInputField();
            }
        }

        if (!chatBox.isFocused)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                SendMessageToChat("You pressed the space bar!", Message.MessageType.info);
                Debug.Log("Space");
            }
        }
        _scrollbar.value = 0;
    }
示例#5
0
 void Clicked()
 {
     SendMessageToChat("Answer: Sorry, I'm a dumb sloth and I couldn't understand your question. Please try again.", Message.MessageType.userMessage);
     _questionOptions = false;
     OnUserInput?.Invoke(this, System.EventArgs.Empty);
 }