Exemplo n.º 1
0
        public void Init()
        {
            netClient.AttachStub(s2cStub);
            netClient.AttachProxy(c2sProxy);

            netClient.Init(false);

            s2cStub.OnNotifyJoin  += OnNotifyJoin;
            s2cStub.OnNotifyLeave += OnNotifyLeave;
            s2cStub.OnResJoin     += OnResJoin;
            s2cStub.OnResLeave    += OnResLeave;
            s2cStub.OnResLogin    += OnResLogin;
            s2cStub.OnResLogout   += OnResLogout;
            s2cStub.OnResUserList += OnResUserList;
            s2cStub.OnNotifyChat  += OnNotifyChat;
        }
Exemplo n.º 2
0
        public void Init(string app_identifier)
        {
            net_client.AttachStub(s2c_stub);
            net_client.AttachProxy(c2s_proxy);

            net_client.Init(app_identifier, false, false);

            heartbeat_timer = new Timer(e => {
                if (is_login && net_client != null && net_client.connection != null)
                {
                    //Console.WriteLine("Send Heartbeat...[ThreadID:{0}]", Thread.CurrentThread.ManagedThreadId);
                    c2s_proxy.Heartbeat(net_client.connection);
                }
            }, null, 0, kHeartbeatInterval);

            s2c_stub.OnResLogin      += new S2C.Stub.ResLoginDelegate(s2c_stub_OnResLogin);
            s2c_stub.OnResSend       += new S2C.Stub.ResSendDelegate(s2c_stub_OnResSend);
            s2c_stub.OnResSendAll    += new S2C.Stub.ResSendAllDelegate(s2c_stub_OnResSendAll);
            s2c_stub.OnNotifyLogin   += new S2C.Stub.NotifyLoginDelegate(s2c_stub_OnNotifyLogin);
            s2c_stub.OnNotifyLogout  += new S2C.Stub.NotifyLogoutDelegate(s2c_stub_OnNotifyLogout);
            s2c_stub.OnNotifySend    += new S2C.Stub.NotifySendDelegate(s2c_stub_OnNotifySend);
            s2c_stub.OnNotifySendAll += new S2C.Stub.NotifySendAllDelegate(s2c_stub_OnNotifySendAll);
        }