コード例 #1
0
        // Use this for initialization
        void Start()
        {
            _gameClient = ClientLab.GetGameClient();

            chatPanel.SetActive(false);

            friendBtn.onClick.AddListener(() =>
            {
                // 此处显示好友列表, 并将当前接收的消息传入android界面
                CallAndroidMethod.StartFriendListDialog();
                // chatPanel.SetActive(true);
            });
            squareBtn.onClick.AddListener(() =>
            {
                print(ArUtils.GetObjectSizeByCollider(role));
                Vector3 chatBubblePosition =
                    Camera.main
                    .WorldToScreenPoint(
                        role.transform.position +
                        new Vector3(
                            0,
                            ArUtils.GetObjectSizeByCollider(role).y / 2,
                            0)) +
                    new Vector3(0, 100, 0);
                var chatBubble = Instantiate(chatBubblePrefab, chatBubblePosition, Quaternion.Euler(new Vector3())) as GameObject;
                chatBubble.transform.SetParent(GameObject.Find("Canvas").transform);
                BubbleController bubbleController = chatBubble.GetComponent <BubbleController>();
                bubbleController.SetMessage("hello\nhello\bhello");
                bubbleController.SetTimeDelay(1);
            });
            quietImage.GetComponent <PointerClickEventTrigger>()
            .onPointerClick
            .AddListener(() =>
            {
                chatPanel.SetActive(false);
            });

            submitButton.onClick.AddListener(() =>
            {
                if (chatInput.text != "")
                {
                    _gameClient.ChatToUser(otherName, chatInput.text);
                }
            });
        }