예제 #1
0
 public void DestroyTransport()
 {
     if (transport == null)
     {
         return;
     }
     transport.StopTransport();
     DestroyImmediate(transport);
     transport = null;
 }
예제 #2
0
        public void CreateTransport()
        {
            //Debug.Log("Bridge: CreateTransport");

            if (transport != null)
            {
                Debug.LogError("Bridge: CreateTransport: called multiple times!");
                return;
            }

        #if UNITY_EDITOR
            #if USE_SOCKETIO
            if (useSocketIO)
            {
                transport = gameObject.AddComponent <BridgeTransportSocketIO>();
            }
            else
            {
            #endif
                    #if USE_CEF
            transport = gameObject.AddComponent <BridgeTransportCEF>();
                    #else
            transport = gameObject.AddComponent <BridgeTransportWebView>();
                    #endif
            #if USE_SOCKETIO
        }
            #endif
        #else
            #if UNITY_WEBGL
            transport = gameObject.AddComponent <BridgeTransportWebGL>();
            #else
                #if USE_SOCKETIO && UNITY_EDITOR
            if (useSocketIO)
            {
                transport = gameObject.AddComponent <BridgeTransportSocketIO>();
            }
            else
            {
                #endif
            transport = gameObject.AddComponent <BridgeTransportWebView>();
                #if USE_SOCKETIO && UNITY_EDITOR
        }
                #endif
            #endif
        #endif

            //Debug.Log("Bridge: CreateTransport: created transport: " + transport);

            //Debug.Log("Bridge: CreateTransport: initializing transport: this: " + this);
            transport.Init(this);

            //Debug.Log("Bridge: CreateTransport: starting transport");
            transport.StartTransport();
            //Debug.Log("Bridge: CreateTransport: started transport");
        }
예제 #3
0
 public void DestroyTransport()
 {
     transport.StopTransport();
     Destroy(transport);
     transport = null;
 }