Exemplo n.º 1
0
        public static void LoginInit()
        {
            LogMgr.GMSwitch  = ClientSetting.Instance.GetBoolValue("GMSwitch");
            LogMgr.DebugInfo = ClientSetting.Instance.GetBoolValue("DebugInfo");
            m_isDebug        = ClientSetting.Instance.GetBoolValue("IS_DEBUG");
            //isTriggerMovie = ClientSetting.Instance.GetBoolValue("TriggerMovie");
            bool bErrorpt = ClientSetting.Instance.GetBoolValue("IS_PT_ERROR");;

            if (m_isDebug == false)
            {
                UnityLog     = new MsgLog(LogNull);
                UnityError   = new MsgLog(LogErrorNull);
                UnityWarning = new MsgLog(LogWarningNull);
                if (bErrorpt)
                {
                    UnityError = new MsgLog(UnityEngine.Debug.LogError);
                }
            }
            else
            {
                //UnityLog = new MsgLog(unityLog);
                UnityLog     = new MsgLog(UnityEngine.Debug.Log);
                UnityError   = new MsgLog(UnityEngine.Debug.LogError);
                UnityWarning = new MsgLog(UnityEngine.Debug.LogWarning);
            }
        }
Exemplo n.º 2
0
        public override bool TrySend(ArraySegment <byte> segment)
        {
            bool state = false;

            try
            {
                state = base.TrySend(segment);
                if (!state)
                {
                    UserInfo users  = Gongyong.userlist.Find(u => u.session.SessionID == SessionID);
                    var      mjUser = Gongyong.mulist.Find(w => w.Openid.Equals(users.openid));
                    if (mjUser != null && users != null)
                    {
                        MsgLog msg = new MsgLog()
                        {
                            msg    = segment,
                            openid = users.openid,
                            RoomID = mjUser.RoomID
                        };
                        Gongyong.msg.Add(msg);
                        users.ConnTime = DateTime.Now;
                    }
                }
                return(state);
            }
            catch (Exception ex)
            {
                this.Logger.Error(ex.Message);
                return(state);
            }
        }
Exemplo n.º 3
0
 public static void init()
 {
     if (m_isDebug == false)
     {
         UnityLog     = new MsgLog(LogNull);
         UnityError   = new MsgLog(LogErrorNull);
         UnityWarning = new MsgLog(LogWarningNull);
     }
     else
     {
         //UnityLog = new MsgLog(unityLog);
         UnityLog     = new MsgLog(UnityEngine.Debug.Log);
         UnityError   = new MsgLog(UnityEngine.Debug.LogError);
         UnityWarning = new MsgLog(UnityEngine.Debug.LogWarning);
     }
 }
Exemplo n.º 4
0
        public ActionResult QueryByExample()
        {
            NHibernateHelper _NHibernateHelper = new NHibernateHelper();
            ISession         _ISession         = _NHibernateHelper.GetSession();

            MsgLog msg = new MsgLog()
            {
                ID = 155
            };
            IList <MsgLog> list = _ISession.CreateCriteria(typeof(MsgLog))
                                  .Add(Example.Create(msg))
                                  .List <MsgLog>();


            return(View());
        }
Exemplo n.º 5
0
        public ActionResult Index()
        {
            NHibernateHelper _NHibernateHelper = new NHibernateHelper();
            ISession         _ISession         = _NHibernateHelper.GetSession();

            MsgLog msgLog = new MsgLog {
                fromUser = "******", toUser = "******", InfoID = 100, CreteTime = DateTime.Now
            };
            NHibernateSample _sample = new NHibernateSample(_ISession);

            _sample.CreateMsgLog(msgLog);

            MsgLog customer   = _sample.GetMsgLogById(137);
            int    customerId = customer.ID;

            return(View());
        }
Exemplo n.º 6
0
        public static void SetLogSwitch(bool value)
        {
            m_isDebug = value;
            if (m_isDebug == false)
            {
                //Application.targetFrameRate = 60;//此处限定60帧

                UnityLog     = new MsgLog(LogNull);
                UnityError   = new MsgLog(LogErrorNull);
                UnityWarning = new MsgLog(LogWarningNull);
            }
            else
            {
                Application.targetFrameRate = 0;//  调试状态下不锁

                UnityLog     = new MsgLog(UnityEngine.Debug.Log);
                UnityError   = new MsgLog(UnityEngine.Debug.LogError);
                UnityWarning = new MsgLog(UnityEngine.Debug.LogWarning);
            }
        }
Exemplo n.º 7
0
        public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo)
        {
            System.Net.IPEndPoint clientipe = (System.Net.IPEndPoint)session.RemoteEndPoint;

            MsgLog msglog = new MsgLog();

            session.Logger.Debug("登陆sssionID--------" + session.SessionID);

            string fileName = string.Empty; //文件名
            string headImg  = string.Empty; //头像图片

            session.Logger.Debug("登录游戏----------" + DateTime.Now);
            var        userinfo  = SendLogin.ParseFrom(requestInfo.Body);
            mjuserinfo usermodel = new mjuserinfo();

            mjuserinfo model = new mjuserinfo()
            {
                nickname = HttpUtility.UrlEncode(userinfo.Nickname),
                openid   = userinfo.Openid,
                city     = userinfo.City,
                headimg  = userinfo.Headimg,
                province = userinfo.Province,
                unionid  = userinfo.Unionid,
                sex      = int.Parse(userinfo.Sex)
            };

            usermodel = AddUser(model, session);



            session.Logger.Debug("登录用户openid:" + userinfo.Openid + "|昵称:" + userinfo.Nickname + "----------" + DateTime.Now);
            UserInfo olduser = Gongyong.userlist.Find(u => u.openid == userinfo.Openid);

            if (olduser == null)
            {
                UserInfo user = new UserInfo()
                {
                    city = userinfo.City,
                    //判断图片是否保存至图片服务器,保存相应头像地址
                    headimg  = usermodel.headimg,
                    nickname = userinfo.Nickname,
                    openid   = userinfo.Openid,
                    province = userinfo.Province,
                    session  = session,
                    sex      = userinfo.Sex,
                    unionid  = userinfo.Unionid,
                    Lat      = userinfo.Latitude,
                    UserID   = int.Parse(usermodel.id.ToString()),
                    UserIP   = clientipe.Address.ToString()
                };
                Gongyong.userlist.Add(user);
                ReturnLogin log = ReturnLogin.CreateBuilder().SetLoginstat(1).SetUserID(int.Parse(usermodel.id.ToString())).Build();
                byte[]      msg = log.ToByteArray();

                session.TrySend(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1002, msg.Length, requestInfo.MessageNum, msg)));


                session.Logger.Debug("登录游戏成功----------" + DateTime.Now);
            }
            else
            {
                if (olduser.session.Connected)
                {
                    ReturnLogin log = ReturnLogin.CreateBuilder().SetLoginstat(2).SetUserID(int.Parse(usermodel.id.ToString())).Build();
                    byte[]      msg = log.ToByteArray();

                    session.TrySend(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1002, msg.Length, requestInfo.MessageNum, msg)));

                    session.Logger.Debug("登录游戏失败,当前对象存在----------" + DateTime.Now);
                    session.Logger.Debug("sssionID--------" + session.SessionID);
                }
                else
                {
                    mjuser mju = Gongyong.mulist.Find(u => u.Openid == userinfo.Openid);
                    if (mju != null)
                    {
                        SendCL(session, userinfo.Openid, requestInfo);
                    }


                    olduser.session = session;
                    ReturnLogin log = ReturnLogin.CreateBuilder().SetLoginstat(1).SetUserID(int.Parse(usermodel.id.ToString())).Build();
                    byte[]      msg = log.ToByteArray();
                    session.TrySend(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1002, msg.Length, requestInfo.MessageNum, msg)));
                    session.Logger.Debug("登录游戏成功,当前对象存在----------" + DateTime.Now);
                }
            }
        }
Exemplo n.º 8
0
 public int Save(MsgLog item)
 {
     return(Dal.Submit(item));
 }
Exemplo n.º 9
0
 public void CreateMsgLog(MsgLog msglog)
 {
     Session.Save(msglog);
     Session.Flush();
 }
Exemplo n.º 10
0
 public int Save(MsgLog p)
 {
     return(da.Save(p));
 }