Exemplo n.º 1
0
        private void InitiateBillingConnection(PBMessenger messenger)
        {
            BillingClient.Config config = new BillingClient.Config()
            {
                SvrAPI  = SvrAPI,
                Channel = messenger.To((byte)CoreMessageTypeExtend.kBilling),
                OnClose = reason =>
                {
                    BillingConnected = false;
                    LogSys.Log(LOG_TYPE.WARN, "Billing connection close: " + (null != reason ? reason : ""));
                }
            };

            BillingClient.Instance.Initiate(config, sys_ecode =>
            {
                if (sys_ecode == SysECode.Good)
                {
                    BillingConnected = true;
                    LogSys.Log(LOG_TYPE.INFO, ConsoleColor.Green, "Billing connected");
                }
                else
                {
                    LogSys.Log(LOG_TYPE.ERROR, "Billing connect failed: " + sys_ecode.ToString());
                }
            });
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public void Initiate(PBMessenger messenger, ServiceAPI svr_api)
 {
     SvrAPI           = svr_api;
     BillingConnected = false;
     MessageInitiate(messenger);
     if (!OptionCollection.Instance.Get <LobbyConfig>().BillingDisable)
     {
         LogSys.Log(LOG_TYPE.INFO, "Initiate Billing connection");
         InitiateBillingConnection(messenger);
     }
     else
     {
         LogSys.Log(LOG_TYPE.INFO, "Billing disable");
     }
     svr_api.AddTimer(0, 500, (api, s, c) => Tick());
 }
Exemplo n.º 4
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());
    }