This class is passed into the MsgHandler delegate, providing the message received.
Inheritance: System.EventArgs
Esempio n. 1
0
    async void msgSystMsg(object caller, NATS.Client.MsgHandlerEventArgs income)
    {
        Debug.Log(caller);
        var inst_msg = RoomMsg.Parser.ParseFrom(income.Message.Data);

        Debug.Log(inst_msg.Message);
        Debug.Log(inst_msg.MsgType.ToString());
        if (inst_msg.MsgType == RoomMsg.Types.MsgType.SystemInfo)
        {
            if (inst_msg.Message == "Dueler:GameSet:Ready" && this.Connecter.IsHost)
            {
                isReady = true;
                this.DuelerStatus.text = "Ready!";
            }
            else if (inst_msg.Message == "Host:GameSet:Ready" && !this.Connecter.IsHost)
            {
                isReady = true;
                this.HostStatus.text = "Ready";
            }
            else if (inst_msg.Message.Contains("UPDATE_ROOM:pw::") && !this.Connecter.IsHost)
            {
                string _pw      = inst_msg.Message.Replace("UPDATE_ROOM:pw::", "");
                var    roomInfo = await this.Connecter.GetRoom(this.Connecter.CurrentRoom.Key, _pw, !this.Connecter.IsWatcher);

                updatePanel_init(roomInfo);
            }
            else if (inst_msg.Message.Contains("CardChange::"))
            {
                OnConnecterUpdate_CardChange(inst_msg);
            }
        }
    }
Esempio n. 2
0
        private void ReactiveHandler(object sender, Original.MsgHandlerEventArgs e)
        {
            bool match = this._ctx.DeserializeAndCheckSimpleJson(e.Message.Data, this._n);

            Debug.Assert(match);
            ++_n;
            if (this._n >= this._ctx.LoopCount)
            {
                this._cde.Signal();
            }
        }
    public void EventGenMessage(NATS.Client.MsgHandlerEventArgs income)
    {
        var        msg   = RoomMsg.Parser.ParseFrom(income.Message.Data);
        GameObject title = (GameObject)Instantiate(NamePref, ChatPanel.transform);

        title.GetComponent <Text>().text =
            msg.FmName +
            "\t< id : " + msg.FromId.ToString() + ">";

        if (msg.MsgType == RoomMsg.Types.MsgType.UserText)
        {
            GameObject info = (GameObject)Instantiate(DespPref, ChatPanel.transform);
            info.GetComponent <Text>().text = msg.Message;
        }
        return;
    }
Esempio n. 4
0
        private void ExpectedReplyHandler(object sender, MsgHandlerEventArgs args)
        {
            if ("bar".Equals(args.Message.Reply) == false)
                Assert.Fail("Expected \"bar\", received: " + args.Message);

            lock(mu)
            {
                received = true;
                Monitor.Pulse(mu);
            }
        }
Esempio n. 5
0
        private void CheckReceivedAndValidHandler(object sender, MsgHandlerEventArgs args)
        {
            System.Console.WriteLine("Received msg.");

            if (compare(args.Message.Data, omsg) == false)
                Assert.Fail("Messages are not equal.");

            if (args.Message.ArrivalSubcription != asyncSub)
                Assert.Fail("Subscriptions do not match.");

            lock (mu)
            {
                received = true;
                Monitor.Pulse(mu);
            }
        }
Esempio n. 6
0
            public void msgHandlerToEncoderHandler(Object sender, MsgHandlerEventArgs args)
            {
                try
                {
                    byte[] data = args.msg != null ? args.msg.Data : null;
                    ehev.obj = c.onDeserialize(data);
                }
                catch (Exception ex)
                {
                    c.lastEx = new NATSException("Unable to deserialize message.", ex);
                    return;
                }

                ehev.subject = args.msg.Subject;
                ehev.reply = args.msg.Reply;
                ehev.msg = args.msg;

                try
                {
                    mh(this, ehev);
                }
                catch (Exception)
                {
                    /* ignore user thrown exceptions */
                }
            }
Esempio n. 7
0
 private void incrReceivedMessageHandler(object sender,
     MsgHandlerEventArgs args)
 {
     Interlocked.Increment(ref received);
 }
Esempio n. 8
0
 private void incrReceivedMessageHandler(object sender,
     MsgHandlerEventArgs args)
 {
     System.Console.WriteLine("Received message on subject {0}.",
         args.Message.Subject);
     Interlocked.Increment(ref received);
 }