示例#1
0
        public Session(string userName, bool tempMode, bool shadowMode = false, NetClient netClient = null)
        {
            //_vccWorker = new VerifyCodeCheckWorker() { Session = this };
            //_vccWorker.StartAliveCheck();
            UserName      = userName;
            TemporaryMode = tempMode;
            ShadowMode    = shadowMode;
            NetClient     = netClient;

            UserKeyData = UserKeyDataMap.Current[userName];
            if (UserKeyData == null)
            {
                UserKeyData = new UserKeyData();
                if (!tempMode)
                {
                    UserKeyDataMap.Current[userName] = UserKeyData;
                }
            }
            UserProfile = new UserProfile(UserName, TemporaryMode, shadowMode);
            SessionData = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);

            //候补订单
            BackupOrderCart = new BackupCart(this);

            _serviceKernel = AppContext.ExtensionManager.GlobalKernel.BeginLifetimeScope(c =>
            {
                c.RegisterInstance(this).AsImplementedInterfaces().AsSelf();
                c.RegisterInstance(NetClient).AsImplementedInterfaces().AsSelf();
                c.RegisterInstance(BackupOrderCart).AsImplementedInterfaces().AsSelf();
                c.RegisterInstance(UserProfile).AsImplementedInterfaces().AsSelf();
            });
        }
示例#2
0
 // Use this for initialization
 void Awake()
 {
     ins = this;
 }