Example #1
0
    public override void RecvProcess()
    {
        UInt64 Protocol = TCPClient.Instance.GetProtocol() & (UInt64)FULL_CODE.PROTOCOL;

        Debug.Log(string.Format("temp = {0:x}", Protocol));

        string msg;

        switch ((PROTOCOL)Protocol)
        {
        case PROTOCOL.RECV:
            UnPackingData(TCPClient.Instance.UnPackingData(), out msg);
            m_Chat = GameObject.Find("TCPClientServer").GetComponent <Chat_Manager>();
            m_Chat.OnClientReceivedMessage(msg);
            break;
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        //Get references to other scripts on the player's gameobject
        variablesScript = GetComponent <variables>();
        gameManager     = GameObject.Find("GameManager");
        chatManager     = gameManager.GetComponent <Chat_Manager>();
        chatInput       = gameManager.GetComponent <GameManager_References>().chatInput.GetComponent <InputField>();
        playerIDScript  = GetComponent <Player_ID>();

        if (isLocalPlayer)       //If its the local player
        //Get the chat send button from the references stored in the GameManager
        {
            chatSend = gameManager.GetComponent <GameManager_References>().chatSendButton.GetComponent <Button>();
            chatSend.onClick.AddListener(SendChat); //Add a listener to that button

            //Add listeners to the inputbox for the chat
            chatInput.onValueChanged.AddListener(Typing);
            chatInput.onEndEdit.AddListener(ExitEditing);
        }
    }