コード例 #1
0
        void Awake()
        {
            _TextMessageView.SendToServerAsObservable().Subscribe(message =>
            {
                _MessagingHub.SendTextMessageToServer(message);
            })
            .AddTo(this);

            _TextMessageView.SendToAllClientsAsObservable().Subscribe(message =>
            {
                _MessagingHub.SendTextMessageToAllClients(message);
            })
            .AddTo(this);

            _MessagingHub.OnReceivedTextMessageAsObservable().Subscribe(item =>
            {
                Debug.Log("[SimpleMultiplayer] Sender ID: " + item.senderId + ", TextMessage: " + item.message);
            })
            .AddTo(this);
        }