Beispiel #1
0
    private void Awake()
    {
        if (_GInstance == null)
        {
            _GInstance = this;
        }

        DontDestroyOnLoad(this.gameObject);
    }
 static public int ShutdownConn(IntPtr l)
 {
     try {
         NetConnHelper self = (NetConnHelper)checkSelf(l);
         self.ShutdownConn();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_isConnected(IntPtr l)
 {
     try {
         NetConnHelper self = (NetConnHelper)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.isConnected);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_socketState(IntPtr l)
 {
     try {
         NetConnHelper self = (NetConnHelper)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.socketState);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_onFailedReceiveMsg(IntPtr l)
 {
     try {
         NetConnHelper self = (NetConnHelper)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.onFailedReceiveMsg);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #6
0
 /// <summary>
 /// release memory.
 /// </summary>
 public void SafeRelease()
 {
     _onFailedReceiveMsg.RemoveAllListeners();
     _onFailedSendMsg.RemoveAllListeners();
     _onSocketStateChanged.RemoveAllListeners();
     if (null != m_socket)
     {
         m_socket.Close();
         m_socket      = null;
         m_socketState = ESocketState.ESS_Invalid;
         _GInstance    = null;
     }
 }
 static public int ThreadSleep(IntPtr l)
 {
     try {
         NetConnHelper self = (NetConnHelper)checkSelf(l);
         System.Int32  a1;
         checkType(l, 2, out a1);
         self.ThreadSleep(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int ReceiveMessage(IntPtr l)
 {
     try {
         NetConnHelper self = (NetConnHelper)checkSelf(l);
         System.Byte[] a1;
         self.ReceiveMessage(out a1);
         pushValue(l, true);
         pushValue(l, a1);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int DoSendMsg(IntPtr l)
 {
     try {
         NetConnHelper self = (NetConnHelper)checkSelf(l);
         System.Byte[] a1;
         checkArray(l, 2, out a1);
         self.DoSendMsg(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int Connect(IntPtr l)
 {
     try {
         NetConnHelper self = (NetConnHelper)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         var ret = self.Connect(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }