Esempio n. 1
0
 void OnDestroy()
 {
     if (onDestroyFn != null)
     {
         onDestroyFn.call();
     }
     updateFn = null;
     if (lua != null)
     {
         lua.luaState.Close();
     }
     lua       = null;
     _instance = null;
     if (net != null)
     {
         net.Dispose();
     }
     net = null;
     if (ChatNet != null)
     {
         ChatNet.Dispose();
     }
     ChatNet = null;
     luacache.Clear();
 }
Esempio n. 2
0
 void Start()
 {
     net     = LNet.instance;
     ChatNet = LNet.ChatInstance;
     lua.init(null, () =>
              { LoadBundle(true); });
 }
Esempio n. 3
0
 static public int Send(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(Msg)))
         {
             LNet self = (LNet)checkSelf(l);
             Msg  a1;
             checkType(l, 2, out a1);
             self.Send(a1);
             return(0);
         }
         else if (matchType(l, argc, 2, typeof(System.Byte[])))
         {
             LNet          self = (LNet)checkSelf(l);
             System.Byte[] a1;
             checkType(l, 2, out a1);
             self.Send(a1);
             return(0);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
        public IActionResult GetRes()
        {
            try
            {
                SberClasses.Register_toSber   register_toSber   = Config.GetSessionValue <SberClasses.Register_toSber>(HttpContext, Config.ss_SberValues_register_toSber);
                SberClasses.Register_fromSber register_fromSber = Config.GetSessionValue <SberClasses.Register_fromSber>(HttpContext, Config.ss_SberValues_register_fromSber);

                var getOrderStatusExtended_toSber = new SberClasses.GetOrderStatusExtended_toSber()
                {
                    orderId     = register_fromSber.orderId,
                    orderNumber = register_toSber.orderNumber,
                    password    = register_toSber.password,
                    userName    = register_toSber.userName
                };

                var getOrderStatusExtended_fromSber = LNet.reqResp <SberClasses.GetOrderStatusExtended_fromSber>(HttpContext, _sb_context, getOrderStatusExtended_toSber, LNet.addr_getOrderStatusExtended, HttpMethod.Post);

                Config.SetSessionValue(HttpContext, Config.ss_SberValues_getOrderStatusExtended_toSber, getOrderStatusExtended_toSber);
                Config.SetSessionValue(HttpContext, Config.ss_SberValues_getOrderStatusExtended_fromSber, getOrderStatusExtended_fromSber);

                ViewData[Config.vd_ServerMessagePay] = $"Операция {getOrderStatusExtended_fromSber.orderNumber} на {(int)(getOrderStatusExtended_fromSber.amount/100)}руб. {(getOrderStatusExtended_fromSber.amount % 100)}коп. ушла";
                ViewData[Config.vd_TmpStatus + register_toSber.orderNumber] = getOrderStatusExtended_fromSber.errorCode;
                ViewData[Config.vd_TmpValue + register_toSber.orderNumber]  = getOrderStatusExtended_fromSber.orderNumber;
                return(View("PayResult"));
            }
            catch (Exception e)
            {
                Log.Write(e);
                return(RedirectToAction("Error"));
            }
        }
Esempio n. 5
0
 void Start()
 {
     net = LNet.instance;
     ChatNet = LNet.ChatInstance;
     //LoadBundle(true);
     lua.init(null, () =>
     { LoadBundle(true); });
 }
Esempio n. 6
0
 static public int Update(IntPtr l)
 {
     try {
         LNet self = (LNet)checkSelf(l);
         self.Update();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 7
0
 static public int get_Port(IntPtr l)
 {
     try {
         LNet self = (LNet)checkSelf(l);
         pushValue(l, self.Port);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 8
0
 static public int get_onConnectionTimeoutFn(IntPtr l)
 {
     try {
         LNet self = (LNet)checkSelf(l);
         pushValue(l, self.onConnectionTimeoutFn);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 9
0
    void OnDestroy()
    {
        if (onDestroyFn != null) onDestroyFn.Call();
        updateFn = null;
        if (lua != null) lua.Destroy();
        lua = null;
        _instance = null;
        if(net!=null)net.Dispose();
        net = null;
		if(ChatNet!=null)ChatNet.Dispose();
        ChatNet = null;
        luacache.Clear();
    }
Esempio n. 10
0
    public static LNet New()
    {
        if (lNetObj == null)
        {
            lNetObj = new GameObject("LNet");
        }
        var cnet = lNetObj.AddComponent <LNet>();

        if (_main == null)
        {
            _main = cnet;
        }
        return(cnet);
    }
Esempio n. 11
0
 static public int set_onIntervalFn(IntPtr l)
 {
     try {
         LNet             self = (LNet)checkSelf(l);
         SLua.LuaFunction v;
         checkType(l, 2, out v);
         self.onIntervalFn = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 12
0
 static public int set_timeoutMiliSecond(IntPtr l)
 {
     try {
         LNet         self = (LNet)checkSelf(l);
         System.Int32 v;
         checkType(l, 2, out v);
         self.timeoutMiliSecond = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 13
0
 static public int set_pingDelay(IntPtr l)
 {
     try {
         LNet          self = (LNet)checkSelf(l);
         System.Single v;
         checkType(l, 2, out v);
         self.pingDelay = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 14
0
 static public int OnApplicationPause(IntPtr l)
 {
     try {
         LNet           self = (LNet)checkSelf(l);
         System.Boolean a1;
         checkType(l, 2, out a1);
         self.OnApplicationPause(a1);
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 15
0
 static public int Connect(IntPtr l)
 {
     try {
         LNet          self = (LNet)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         self.Connect(a1, a2);
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 16
0
 void Start()
 {
     net = LNet.instance;
     ChatNet = LNet.ChatInstance;
     LoadBundle(true);
 }
Esempio n. 17
0
        public IActionResult Index(string card, string sum)
        {
            try
            {
                var register_toSber = new SberClasses.Register_toSber();



                if (string.IsNullOrEmpty(card) || !int.TryParse(card, out int account))
                {
                    ViewData[Config.vd_ServerMessagePay] = "Неверный номер";
                    return(View());
                }
                else
                {
                    if (sum == null || !decimal.TryParse(sum, out decimal decamount))
                    {
                        ViewData[Config.vd_ServerMessagePay] = "Неверная сумма";
                        return(View());
                    }
                    else
                    {
                        var    amount = (int)(decamount * 100);
                        object sia_v  = new Rc.Validate()
                        {
                            account = account,
                            amount  = decamount
                        };

                        var isOk = _rc_context.SpExec(Config.DbPrefixRc + "Validate", ref sia_v) && ((Rc.Validate)sia_v).error_code == 0;

                        if (!isOk)
                        {
                            ViewData[Config.vd_ServerMessagePay] = "Номер карты не зарегистрирован";
                            return(View());
                        }

                        if (((Rc.Validate)sia_v).tariff_price > 0)
                        {
                            register_toSber.amount = (int)(((Rc.Validate)sia_v).tariff_price * 100);
                        }
                        else
                        {
                            register_toSber.amount = amount;
                        }

                        register_toSber.userName    = LNet.apiLogin;
                        register_toSber.password    = LNet.apiPass;
                        register_toSber.orderNumber = Guid.NewGuid().ToString();
                        register_toSber.returnUrl   = Config.ReturnUrl + "result";

                        Config.SetSessionValue(HttpContext, Config.ss_OrderInfo, new Sb.OrderInfo()
                        {
                            amount      = decamount,
                            emiss       = account,
                            orderNumber = register_toSber.orderNumber
                        });

                        var register_fromSber = LNet.reqResp <SberClasses.Register_fromSber>(HttpContext, _sb_context, register_toSber, LNet.addr_register, HttpMethod.Post);

                        if ((register_fromSber.errorCode ?? 0) != 0)
                        {
                            ViewData[Config.vd_ServerMessagePay] = register_fromSber.errorMessage;// "Проблема соединения с сервером, попробуйте еще раз";
                            return(View());
                        }


                        Config.SetSessionValue(HttpContext, Config.ss_SberValues_register_toSber, register_toSber);
                        Config.SetSessionValue(HttpContext, Config.ss_SberValues_register_fromSber, register_fromSber);

                        ViewData[Config.vd_Redirect] = register_fromSber.formUrl;
                    }
                }


                return(View());
            }
            catch (Exception e)
            {
                Log.Write(e);
                try
                {
                    HttpContext.Session.Clear();
                }
                catch { }
                return(Index());
                //return RedirectToAction("Error");
            }
        }
Esempio n. 18
0
 public static LNet New()
 {
     if (lNetObj == null) lNetObj = new GameObject("LNet");
     var cnet = lNetObj.AddComponent<LNet>();
     if (_main == null) _main = cnet;
     return cnet;
 }
Esempio n. 19
0
 void Start()
 {
     net     = LNet.instance;
     ChatNet = LNet.ChatInstance;
     LoadBundle(true);
 }
Esempio n. 20
0
 public void Dispose()
 {
     this.Close();
     isbegin = false;
     client = null;
     breader = null;
     onAppErrorFn = null;
     onConnectionCloseFn = null;
     onConnectionFn = null;
     onMessageReceiveFn = null;
     onConnectionTimeoutFn = null;
     onReConnectFn = null;
     onAppPauseFn = null;
     onIntervalFn = null;
     if ( bChatInst )
     {
         _instChat = null;
     }
     else _inst = null;
 }