Esempio n. 1
0
	    // Use this for initialization
	    void Start()
	    {
			this.chatView.SetActive (true);
	        Application.runInBackground = true;
	        scroll_view_heigth = ((RectTransform)this.scroll_view.transform).sizeDelta.y;

	        photon_enemy = PhotonNetwork.otherPlayers[0];
	        user_enemy = (User)photon_enemy.allProperties["User"];
	        string txt_chat = "Vous jouez contre : " + user_enemy.username;
	        InstanciateMessage(txt_chat, Chat.EVENT);

	        channel_name = PhotonNetwork.room.name;
	        int alea = rand.Next(1000);
	        UserName = User.Instance.username + alea.ToString();

	        chatClient = new ChatClient(this);
	        chatClient.Connect(APP_ID, APP_VERSION, new AuthValues(UserName));

	        inputField.onEndEdit.AddListener(val =>
	            {
	                if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
	                {
	                    SendMessageToOtherClient(inputField.text);
	                    inputField.text = "";
	                }
	            });
	    }