コード例 #1
0
        private List <Action <JsonObject> > m_cOnDisconnect; //on the disconnect

        /// <summary>
        /// Init this instance.
        /// </summary>
        internal static TranspotUpdate Init()
        {
            GameObject     obj   = new GameObject("Socket");
            TranspotUpdate trans = obj.AddComponent <TranspotUpdate>();

            return(trans);
        }
コード例 #2
0
 public void start(TranspotUpdate Updater)
 {
     this.m_cUpdater = Updater;
     this.m_cUpdater.SetUpdate(Update);
     this.m_cUpdater._Start();
     this.receive();
 }
コード例 #3
0
        // The bulk of the clean-up code
        protected virtual void Dispose(bool disposing)
        {
            if (this.disposed)
            {
                return;
            }

            if (disposing)
            {
#if LUZEXI
                this.m_cUpdater._Destory();
                this.m_cUpdater = null;

                // free managed resources
                this.protocol.close();
                this.socket.Shutdown(SocketShutdown.Both);
                this.socket.Close();
                this.disposed = true;
#else
                // free managed resources
                this.protocol.close();
                this.socket.Shutdown(SocketShutdown.Both);
                this.socket.Close();
                this.disposed = true;

                //Call disconnect callback
                eventManager.InvokeOnEvent(EVENT_DISCONNECT, null);
#endif
            }
        }
コード例 #4
0
        public bool connect(JsonObject user, Action <JsonObject> handshakeCallback)
        {
            try{
#if LUZEXI
                this.m_cUpdater = TranspotUpdate.Init();
                protocol.start(user, handshakeCallback, this.m_cUpdater);
#else
                protocol.start(user, handshakeCallback);
#endif
                return(true);
            }catch (Exception e) {
                Console.WriteLine(e.ToString());
                return(false);
            }
        }
コード例 #5
0
 internal void start(JsonObject user, Action <JsonObject> callback, TranspotUpdate updater)
 {
     this.transporter.start(updater);