static object PerformMemberwiseClone(ref object o)
        {
            var ins = new UnityEngine.NetworkReachability();

            ins = (UnityEngine.NetworkReachability)o;
            return(ins);
        }
    static int IntToEnum(IntPtr L)
    {
        int arg0 = (int)LuaDLL.lua_tonumber(L, 1);

        UnityEngine.NetworkReachability o = (UnityEngine.NetworkReachability)arg0;
        ToLua.Push(L, o);
        return(1);
    }
 static int GetNetworkStatus(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 0);
         UnityEngine.NetworkReachability o = CommonHelper.GetNetworkStatus();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #4
0
 static int GetNetState(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         NativeManager obj = (NativeManager)ToLua.CheckObject(L, 1, typeof(NativeManager));
         UnityEngine.NetworkReachability o = obj.GetNetState();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
        static void WriteBackInstance(CSHotFix.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref UnityEngine.NetworkReachability instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.Object:
            {
                __mStack[ptr_of_this_method->Value] = instance_of_this_method;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.NetworkReachability[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
            }
            break;
            }
        }
    static int set_CurrentReachability(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            YX_APIManage obj = (YX_APIManage)o;
            UnityEngine.NetworkReachability arg0 = (UnityEngine.NetworkReachability)ToLua.CheckObject(L, 2, typeof(UnityEngine.NetworkReachability));
            obj.CurrentReachability = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index CurrentReachability on a nil value" : e.Message));
        }
    }
    static int get_CurrentReachability(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            YX_APIManage obj = (YX_APIManage)o;
            UnityEngine.NetworkReachability ret = obj.CurrentReachability;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index CurrentReachability on a nil value" : e.Message));
        }
    }
Beispiel #8
0
    //public void CheckNetState()
    //{
    //    if (socket == null)
    //    {
    //        return;
    //    }
    //    //DateTime start = DateTime.Now;
    //    UnityEngine.NetworkReachability state = UnityEngine.Application.internetReachability;
    //    if (state == UnityEngine.NetworkReachability.NotReachable)
    //    {
    //        IsNetStateChange = true;
    //        UnityEngine.Debug.Log("IsNetStateChange = true" + state.ToString());
    //    }
    //    else if (NetState != state)//处理3G 2G的情况
    //    {
    //        UnityEngine.Debug.Log("IsNetStateChange = true" + state.ToString());
    //        IsNetStateChange = true;
    //    }
    //    //UnityEngine.Debug.Log("CheckTime" + DateTime.Now.Subtract(start).TotalMilliseconds );
    //}

    /// <summary>
    /// 打开连接
    /// </summary>
    public void Open()
    {
        UnityEngine.NetworkReachability state = UnityEngine.Application.internetReachability;
        if (state != UnityEngine.NetworkReachability.NotReachable)
        {
            _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            try
            {
                _socket.Connect(_host, _port);
            }
            catch
            {
                //socket.Dispose();
                _socket = null;
                throw;
            }
            _thread = new Thread(new ThreadStart(CheckReceive));
            _thread.Start();
        }
    }
 static void Push(IntPtr L, UnityEngine.NetworkReachability arg)
 {
     ToLua.Push(L, arg);
 }