Ejemplo n.º 1
0
    public void Send()
    {
        var text = inputField.text;

        if (text == string.Empty)
        {
            return;
        }

        print("sending: '" + text + "'");

        Message message = new Message(username.options[username.value].text, text, DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).Ticks, Platform.Mockup);

        try
        {
            ChatAPI.NotifyNewMessageToListeners(message);
        }
        catch (Exception e)
        {
            throw e;
        }
        finally
        {
            inputField.text = string.Empty;
            inputField.ActivateInputField();

            if (chatHistory)
            {
                chatHistory.Add(message);
            }
        }
    }
Ejemplo n.º 2
0
    private void NotifyChatAPI(string line)
    {
        if (debugPrintAll)
        {
            print("Trying to notify");
        }

        FBMessage fb_msg = JsonUtility.FromJson <FBMessage>(line);

        DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
        long     timestamp = (long)(DateTime.Now.ToUniversalTime() - unixStart).TotalSeconds;

        // Linking the two classes together, oops!

        Message msg = new Message(fb_msg.from.name, fb_msg.message, timestamp, Platform.Facebook);

        ChatAPI.NotifyNewMessageToListeners(msg);
    }
Ejemplo n.º 3
0
    private void SendNextMessage()
    {
        if (_messageToSend.Count == 0)
        {
            throw new System.Exception("List must not be null, you damn morron");
        }

        MessageToSend toSend = _messageToSend[_messageIndex];

        _messageIndex++;
        if (_messageIndex >= _messageToSend.Count)
        {
            _messageIndex = 0;
        }

        Message msg = new Message(
            toSend._userName, toSend._message
            , GetTimestamp(DateTime.Now), Platform.Mockup
            );

        ChatAPI.NotifyNewMessageToListeners(msg);
    }
    // Update is called once per frame
    void GenerateAndSendMessage(string pseudo, string message)
    {
        Message msg = new Message(pseudo, message, GetTime(), Platform.Twitch);

        ChatAPI.NotifyNewMessageToListeners(msg);
    }