Exemple #1
0
    void MakeBalloon(ReceivedInformation _recievedClientInfo) // 풍선 생성기
    {
        GameObject realballoon;

        var balloon = Instantiate(Balloon, BalloonRoom.transform);

        realballoon = balloon as GameObject;
        realballoon.gameObject.transform.Find("ground").Find("Text").GetComponent <Text>().text = _recievedClientInfo.ReceiveMessage;


        if (_recievedClientInfo.ReceiveObject == gameObject) // 내 풍선일 때.
        {
            realballoon.GetComponent <RectTransform>().pivot = new Vector2(1f, 0.5f);
            realballoon.transform.Find("username").GetComponent <Text>().text = "Me";
            realballoon.transform.Find("ground").GetComponent <Image>().color = Color.white;
            realballoon.transform.Find("ground").GetComponent <RectTransform>().localScale = new Vector3(-1f, 1f, 1f);
            realballoon.transform.Find("ground").Find("Text").GetComponent <RectTransform>().localScale = new Vector3(-1f, 1f, 1f);
            print("(Client)My information! (From) : " + _recievedClientInfo.ReceiveObject.name);
        }
        else // 상대 풍선일 때
        {
            realballoon.GetComponent <RectTransform>().pivot = new Vector2(0f, 0.5f);
            realballoon.transform.Find("username").GetComponent <Text>().text = _recievedClientInfo.ReceiveObject.transform.Find("Myname").GetComponent <Text>().text;
            realballoon.transform.Find("ground").GetComponent <Image>().color = Color.yellow;
            print("(Client)Other information! (From) : " + gameObject.name);
        }

        Canvas.ForceUpdateCanvases();
        transform.Find("Room").Find("Scroll View").GetComponent <ScrollRect>().verticalNormalizedPosition = 0f;
        Canvas.ForceUpdateCanvases();
    }
Exemple #2
0
    public void ReceiveInfoFromServer(ToSendInfo _InfoFromServer) // 서버가 보낸 정보 받기 , 말풍선 생성
    {
        Receivedinfo = new ReceivedInformation(_InfoFromServer.RecOb, _InfoFromServer.RecMes);
        print("(Client)(Received)From : " + Receivedinfo.ReceiveObject);
        print("(Client)(Received)Said : " + Receivedinfo.ReceiveMessage);

        MakeBalloon(Receivedinfo); // 말풍선
    }
Exemple #3
0
    void MakeBalloon(ReceivedInformation _recievedClientInfo) // 풍선 생성기
    {
        GameObject realballoon;

        var balloon = Instantiate(Balloon, BalloonRoom.transform);

        realballoon = balloon as GameObject;
        realballoon.gameObject.transform.Find("Text").GetComponent <Text>().text = Receivedinfo.ReceiveMessage;
        //realballoon.gameObject.transform.Find("Name").GetComponent<Text>().text = Receivedinfo.ReceiveObject.name;

        if (_recievedClientInfo.ReceiveObject == gameObject) // 내 풍선일 때.
        {
            realballoon.GetComponent <Image>().color = Color.white;
            print("(Client)My information! (From) : " + Receivedinfo.ReceiveObject.name);
        }
        else // 상대 풍선일 때
        {
            realballoon.GetComponent <Image>().color = Color.yellow;
            print("(Client)Other information! (From) : " + gameObject.name);
        }
    }