Пример #1
0
    public void AddMessage(string[] parameter)
    {
        Debug.Log("Adding");
        user_gui.GUI_Debug("Added Message Item");
        MessageItem item = MessageItem.CreateInstance("MessageItem") as MessageItem;

        item.AddText(parameter[0], parameter[1]);
        Info.MessageItems.Add(item);
    }
Пример #2
0
    /// <summary>
    /// Button functions
    /// </summary>

    void SetNewMessageItem()
    {
        if (Interactor.SelectedObject.GetComponent <MotorScript>() != null)
        {
            GUI_Debug("Added new Chat Message");
            MessageItem item = MessageItem.CreateInstance("MessageItem") as MessageItem;
            item.AddText(MessageInputString, UnityEngine.SystemInfo.deviceName);
            Interactor.SelectedObject.GetComponent <MotorScript>().Info.MessageItems.Add(item);

            // Add to current chat display this message
            GameObject go = GameObject.Instantiate(MessageItemTemplateObject, ChatWindowContent.transform);
            go.transform.Find("Text").GetComponent <UnityEngine.UI.Text>().text          = item.MessageText;
            go.transform.Find("SignatureText").GetComponent <UnityEngine.UI.Text>().text = item.SignatureText;

            // Send Message via Network
            GameObject g = GameObject.Find("LocalPlayer");
            if (g != null)
            {
                string[] param = new string[] { MessageInputString, UnityEngine.SystemInfo.deviceName, Interactor.SelectedObject.transform.parent.name };
                g.SendMessage("SendMessageViaNetwork", param, SendMessageOptions.DontRequireReceiver);
            }
        }
    }