コード例 #1
0
ファイル: LoginSystem.cs プロジェクト: myl2232/ArkCrossEngine
        private void MessageInitiate(PBMessenger messenger)
        {
            messenger.AddChannel((byte)CoreMessageTypeExtend.kBilling,
                                 DashFire.Billing.MessageMapping.Query,
                                 DashFire.Billing.MessageMapping.Query);

            JsonMessageDispatcher.RegisterMessageHandler((int)JsonMessageID.Login, typeof(JsonMessageLogin), OnLogin);
            JsonMessageDispatcher.RegisterMessageHandler((int)JsonMessageID.CYPConfirmResult, typeof(JsonMessageCYPConfirmResult), ForwardToLoginSession);
            JsonMessageDispatcher.RegisterMessageHandler((int)JsonMessageID.CreateNick, typeof(JsonMessageCreateNick), ForwardToLoginSession);
        }
コード例 #2
0
    public override void OnInit(string[] parameters)
    {
        Console.WriteLine("TestMessenger1 Initialize");
        messenger_ = new PBMessenger((byte)Channel.Count, SvrAPI);
        messenger_.AddChannel((byte)Channel.A, Assembly.GetExecutingAssembly());
        messenger_.To((byte)Channel.A).Register <Person>((msg, fh, s) =>
        {
            Console.WriteLine("Get message Person:");
            Console.WriteLine("Id   : " + msg.Id);
            Console.WriteLine("Name : " + msg.Name);
            Console.WriteLine("Email: " + msg.Email);
        });

        Console.WriteLine("TestMessenger1 Online");
        Console.WriteLine("TestMessenger1 Send Message");

        messenger_.To((byte)Channel.A).Send("TestMessenger2",
                                            Person.CreateBuilder().SetId(1)
                                            .SetName("llisper")
                                            .SetEmail("*****@*****.**")
                                            .Build());
    }