public NewSessionHandler(IDriverContext context, SessionManager sessionManager, IUACPomptHandler uacHandler, IUtils utils) { this.context = context; this.sessionManager = sessionManager; this.uacHandler = uacHandler; this.utils = utils; }
public MainWindow() { var persist = new PersistenceManager(); sessionManager = new SessionManager(persist); manager = new GameManager(persist); InitializeComponent(); }
public static void Initialize() { ModuleMgr = ModuleManager.GetInstance(); PatchMgr = PatchManager.GetInstance(); RealmMgr = RealmManager.GetInstance(); SessionMgr = SessionManager.GetInstance(); }
public static CounterCache GetCounterCache(Cache cache, SessionManager manager) { try { if (s_CounterCache.Expired) { lock (s_CounterCache) { if (s_CounterCache.Expired) { s_CounterCache.Flush(manager); } } } } catch(Exception ex) { manager.BlogService.EventLogWriteEntry(string.Format("GetCounterCache failed to flush the cache. {0}", ex.Message), EventLogEntryType.Error); s_CounterCache = new CounterCache(); } return s_CounterCache; }
public static void Initialize() { ClientDB = ClientDBManager.GetInstance(); Redirect = RedirectManager.GetInstance(); Session = SessionManager.GetInstance(); Player = PlayerManager.GetInstance(); Spawns = SpawnManager.GetInstance(); }
public GameRoomSession(SessionManager manager, Lobby.LobbySession lobbySession, Lobby.GameRoomItem gameRoom) : base(manager) { _lobbySession = lobbySession; GameRoom = gameRoom; _lobbySession.GameRoomJoining(this); _lobbySession.DisplayToggled += _lobbySession_DisplayToggled; }
protected MetaSpace(string title, RECT aframe) :base(title, aframe.Left, aframe.Top, aframe.Width, aframe.Height) { fSurfaces = new List<UISurface>(); // Add the channel for commands fSessionManager = new SessionManager(); fControlChannel = new SpaceControlChannel(fSessionManager, fSessionManager.UniqueSessionName, this); }
public ActionResult CreateAchievementDefinitions() { var sm = new SessionManager(); using (var s = sm.GetSession()) { using (var tx = s.BeginTransaction()) { AchievementDefinition ad = new AchievementDefinition(); ad.Code = @" ProgramTriggers: MemoryTriggers: livesChanged = 0xC001; JS: var lives = 10; function initialize(state) { } function getState() { return lives; } function reset() { lives = 11; } function livesChanged(val) { lives= val; } "; ad.Description = "This is a test"; ad.Id = Guid.NewGuid().ToString("N"); ad.LockedImageUrl = "Lock.png"; ad.LongDisplayFormat = "<Something></Something>"; ad.RomMd5 = "47d736575f9a22f7490d62c76ed7c933"; ad.ShortDisplayFormat = "<TextBlock></TextBlock>"; ad.TimeStamp = DateTime.UtcNow; ad.UnlockedImageUrl = "Unlocked.png"; ad.Title = "A Winner Is You!"; s.SaveOrUpdate(ad); tx.Commit(); } } return base.Redirect("Home"); }
public static void Initialize() { Character = CharacterManager.GetInstance(); ClientDB = ClientDBManager.GetInstance(); GameAccount = GameAccountManager.GetInstance(); Redirect = RedirectManager.GetInstance(); Session = SessionManager.GetInstance(); Player = PlayerManager.GetInstance(); Spawns = SpawnManager.GetInstance(); }
/// <summary> /// /// </summary> /// <param name="personFetchHandler"></param> /// <param name="handler"></param> /// <param name="communicateToken"></param> /// <param name="seed"></param> public SessionServer(PersonFetchHandler personFetchHandler, SSOLoginHandler handler, String communicateToken, string seed) { this._commToken = communicateToken; this._ssoHandler = handler; ISessionSet set = SessionManager.GetDefaultSessionSet(); this._sessionManager = new SessionManager(set, personFetchHandler, seed ?? "tmpssokas"); this._ssoHandler = handler; }
public WebsocketMessageServer(string prefix, string protocol, int accept_depth, SessionManager.DelegateSessionMessage onMessage, CompletionQueue completion_queue) { this.protocol = protocol; this.completion_queue = completion_queue; session_manager = new SessionManager(onMessage, completion_queue); listener.Prefixes.Add(prefix); listener.Start(); for (int i = 0; i < accept_depth; i++) GetContextAsyncLoop(); }
public SpaceControlChannel(SessionManager sessManager, string participantName, MetaSpace aSpace) { fSessionManager = sessManager; fParticipantName = participantName; fSharedSpace = aSpace; fSession = fSessionManager.Session; fChunkDecoder = new SpaceCommandDecoder(); fChunkDecoder.AddSpaceController(aSpace); AddChannels(); }
// Use this for initialization void Start() { // create hand & gesture generators, if we dont have them yet OpenNIContext.OpenNode(NodeType.Hands); OpenNIContext.OpenNode(NodeType.Gesture); // init session manager sessionManager = new SessionManager(OpenNIContext.Context, "Click", "RaiseHand"); sessionManager.SessionStart += new System.EventHandler<PositionEventArgs>(sessionManager_SessionStart); sessionManager.SessionEnd += new System.EventHandler(sessionManager_SessionEnd); sessionManager.AddListener(broadcaster); }
//On load instantiate the picking UI void OnNetworkLoadedLevel () { manager = SessionManager.Instance; psinfoscript = PlayerServerInfo.Instance; numberOfStages = psinfoscript.numStages; picks = new string[numberOfStages]; for(int i = 0; i < picks.Length; i++) { picks[i] = "empty"; } if(Network.isServer){ // GameObject picklabel = (GameObject)Network.Instantiate(allUI, new Vector3(0, 0, 0), transform.rotation, 0); } }
void Start() { this.sessionManager = new SessionManager(); var session1 = this.sessionManager.AddSession(1); var session2 = this.sessionManager.AddSession(2); var session3 = this.sessionManager.AddSession(3); var cube1 = CubeController.Initialize(session1); CubeController.Initialize(session2); CubeController.Initialize(session3); cube1.ChangeColor(true); }
public SessionsControl(SessionManager sessionManager) { InitializeComponent(); this.sessionManager = sessionManager; //Remove visual debugging colours BackColor = Color.White; tvSessions.BackColor = Color.White; TabText = "PuTTY Sessions"; LoadSessionData(); }
void Awake(){ inLobby = true; //MasterServer.ipAddress = "38.104.224.202"; //Important playbtn = GameObject.Find("playBtn"); hudTools = GetComponent<HUDTools>(); if(SessionManager.Instance == null){ Transform manager = (Transform)Instantiate (sessionManagerPrefab, sessionManagerPrefab.position, Quaternion.identity); sessionManager = manager.GetComponent<SessionManager>(); } else sessionManager = SessionManager.Instance; }
/// <summary> /// /// </summary> /// <param name="set"></param> /// <param name="personFetchHandler"></param> /// <param name="handler"></param> /// <param name="communicateToken"></param> /// <param name="seed">随机种子</param> public SessionServer(ISessionSet set, PersonFetchHandler personFetchHandler, SSOLoginHandler handler, String communicateToken, string seed) { if (set == null) { throw new ArgumentNullException("set is null"); } this._commToken = communicateToken; this._ssoHandler = handler; this._sessionManager = new SessionManager(set, personFetchHandler, seed ?? "tmpssokas"); }
void Setup() { //build the context Context = new Context(CONFIG); //build the session manager SeshManager = new SessionManager(Context,"RaiseHand","RaiseHand"); SeshManager.SetQuickRefocusTimeout(15000); //build the flow router Flowy = new FlowRouter(); //build the Broadcaster }
public TcpMessageServer(int accept_depth, short port, SessionManager.DelegateSessionMessage onMessage, CompletionQueue completion_queue) { listener.Bind(new IPEndPoint(IPAddress.Any, port)); this.completion_queue = completion_queue; session_manager = new SessionManager(onMessage, completion_queue); listener.Listen(5); //SOMAXCONN for (int i = 0; i < accept_depth; i++) { SocketAsyncEventArgs accept_event = new SocketAsyncEventArgs(); accept_event.Completed += accept_event_Completed; listener.AcceptAsync(accept_event); } }
static void Main() { Logger.Info("Process starting"); AppDomain.CurrentDomain.UnhandledException += (sender, e) => { Logger.Fatal("Unhandled exception: " + e.ExceptionObject); Logger.Info("Process exiting"); }; ThreadPool.SetMaxThreads(10, 1); LoadSettings(); SessionManager = new SessionManager(); RoomManager = new RoomManager(); DelayManager = new DelayManager(); Steam = new Steam(); _taskScheduler = new TaskScheduler(); _taskScheduler.Add(TimeSpan.FromSeconds(0.5), () => { SessionManager.Update(); RoomManager.Update(); DelayManager.Update(); Steam.Update(); }); _taskScheduler.Add(TimeSpan.FromHours(1), () => { var t = Util.GetUnixTimestamp(DateTime.UtcNow - TimeSpan.FromDays(30)); LoginToken.RemoveOlderThan(t); }); _taskScheduler.Add(TimeSpan.FromMinutes(2.5), () => { if (Steam.Status == Steam.ConnectionStatus.Connected) { Steam.Bot.PersonaState = EPersonaState.Online; } }); while (true) { _taskScheduler.Run(); Thread.Sleep(10); } }
protected void Button1_Click(object sender, EventArgs e) { SessionManager manager = new SessionManager(); ISession session = manager.GetSession(); ArrayList list = (ArrayList)session.CreateSQLQuery("select name as _userName,pwd as _password from test").SetResultTransformer(NHibernate.Transform.Transformers.AliasToBean(typeof(User))).List(); //int r = session.CreateSQLQuery("insert into test(name,pwd,displayname) VALUES(?,?,?)") // .SetString(0, "'") // .SetString(1, "' and 1=1") // .SetString(2, "''").ExecuteUpdate(); session.Close(); ArrayList list2 = new ArrayList(); for (int i = 0; i < 20; i++) { session = manager.GetSession(); session.CreateSQLQuery("select name as _userName,pwd as _password from test").SetResultTransformer(NHibernate.Transform.Transformers.AliasToBean(typeof(User))).List(); list2.Add(session); } }
void Awake(){ if(Instance != null && Instance != this){ Destroy(gameObject); return; } Instance = this; DontDestroyOnLoad(this); psInfo = PlayerServerInfo.Instance; networkView.group = SETUP; playerCounter = -1; levelPrefix = 0; arenaIndex = -2;// lobby is -1 numberOfRounds = psInfo.numStages; arenas = new string[numberOfRounds]; for (int i = 0; i < arenas.Length; i++) { arenas[i] = "empty"; } }
protected override void OnActionExecuting(ActionExecutingContext ctx) { base.OnActionExecuting(ctx); sessionManager = new SessionManager(this.HttpContext.Session); if (sessionManager.User == null) { //if the user was loaded from a auth cookie, grab the user name from it and load the user details, and place it in the session variable var identity = HttpContext.User.Identity as System.Security.Principal.IIdentity; if (identity != null) { System.Web.Security.FormsIdentity fi = identity as System.Web.Security.FormsIdentity; if (fi != null) { DatabaseInterface db = new DatabaseInterface(); var user = db.GetUserById(new ObjectId(fi.Name)); if (user != null) { sessionManager.User = user; } } } } }
/// <summary> /// /// </summary> /// <returns></returns> public IAsyncResult CreateNetwork(Game game, NetworkSessionType sessionType, int maxLocalGamers, int maxGamers, int privateGamerSlots, NetworkSessionProperties sessionProperties, bool AllowHostMigration, bool AllowJoinInProgress) { SessionManager sessionManager = new SessionManager(game); IAsyncResult asyncResult = sessionManager.CreateSession(sessionType, maxLocalGamers, maxGamers, privateGamerSlots, sessionProperties); /* if (networkHelper.NetworkGameSession != null) { if (AllowHostMigration == true) networkHelper.NetworkGameSession.AllowHostMigration = true; if (AllowJoinInProgress == true) networkHelper.NetworkGameSession.AllowJoinInProgress = true; return asyncResult; } else { //throw new Exception("Session was not Created"); return asyncResult; }*/ return asyncResult; }
protected void Session_Start(object sender, EventArgs e) { SessionManager.TouchSession(Context); }
public void Flush(SessionManager manager) { if (mRequests == null) return; List<TransitBrowser> browsers = new List<TransitBrowser>(); List<TransitReferrerHost> rhs = new List<TransitReferrerHost>(); List<TransitReferrerSearchQuery> rsqs = new List<TransitReferrerSearchQuery>(); // TODO: use a unique sorted collection foreach(HttpRequest request in mRequests) { try { if (request.Browser != null) { TransitBrowser browser = new TransitBrowser(); browser.Name = request.Browser.Browser; browser.Platform = request.Browser.Platform; browser.Version = request.Browser.Version; browsers.Add(browser); } string host = string.Empty; try { host = request.Url.Host; } catch (ArgumentException) { // host isn't available on localhost } string urlreferrer = string.Empty; try { if (request.UrlReferrer != null) { urlreferrer = request.UrlReferrer.Host; } } catch (ArgumentException) { // referrer host not available } // don't track navigation between pages if (! string.IsNullOrEmpty(urlreferrer) && urlreferrer != host) { TransitReferrerHost rh = new TransitReferrerHost(); rh.Name = request.UrlReferrer.Host; rh.LastSource = request.UrlReferrer.ToString(); rh.LastUrl = request.RawUrl; rh.RequestCount = 1; rhs.Add(rh); string q = request.QueryString["q"]; if (string.IsNullOrEmpty(q)) q = request.QueryString["s"]; if (string.IsNullOrEmpty(q)) q = request.QueryString["search"]; if (string.IsNullOrEmpty(q)) q = request.QueryString["query"]; if (!string.IsNullOrEmpty(q)) { TransitReferrerSearchQuery trsq = new TransitReferrerSearchQuery(); trsq.RequestCount = 1; trsq.SearchQuery = q; rsqs.Add(trsq); } } } catch (Exception ex) { manager.BlogService.EventLogWriteEntry(string.Format("CreateOrUpdateStats for a single request failed. {0}", ex.Message), EventLogEntryType.Warning); } } try { manager.BlogService.CreateOrUpdateStats( manager.Ticket, browsers.ToArray(), rhs.ToArray(), rsqs.ToArray()); } catch (Exception ex) { manager.BlogService.EventLogWriteEntry(string.Format("CreateOrUpdateStats failed. {0}", ex.Message), EventLogEntryType.Error); } mRequests = new List<HttpRequest>(); try { manager.BlogService.IncrementPostCounters(manager.Ticket, mPostCounters.ToArray()); } catch (Exception ex) { manager.BlogService.EventLogWriteEntry(string.Format("IncrementPostCounters failed. {0}", ex.Message), EventLogEntryType.Error); } mPostCounters = new List<int>(); try { manager.BlogService.IncrementImageCounters(manager.Ticket, mImageCounters.ToArray()); } catch (Exception ex) { manager.BlogService.EventLogWriteEntry(string.Format("IncrementImageCounters failed. {0}", ex.Message), EventLogEntryType.Error); } mImageCounters = new List<int>(); LastFlush = DateTime.UtcNow; }
private void GetTopics(object sender, EventArgs e) { categories.DataSource = SessionManager.GetCachedCollection <TransitTopic>( "GetTopics", SessionManager.Ticket, null); categories.DataBind(); }
public void OnAuthorization(AuthorizationContext filterContext) { SessionManager.StoreInSession(filterContext, "OnAuthorization"); }
/// <summary> /// Add a event listener for when the AR Tracking is lost. /// </summary> /// <param name="callback"></param> public void OnARTrackingLost(Action callback) { SessionManager?.OnARTrackingLost(callback); }
private void InitializeSessionManager(String userName, String password, String serverName) { try { JabberID jd = new JabberID(userName); // Create a session using user credentials ConnectionOptions opts = new ConnectionOptions(serverName, jd.Server); //Session session = Session.Login(userName, password, Resource, serverName, Thread.CurrentThread.CurrentCulture); Session session = Session.Login(jd.UserName, password, Resource, true, opts); m_sessionMgr = new SessionManager(session); } catch (PacketException ex) { MessageBox.Show(string.Concat("Unable to Login :"******"Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (StreamException ex) { MessageBox.Show(string.Concat("Unable to Login :"******"Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch { MessageBox.Show("Login failed. Please check the username and password and try again.", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ResetSession(); } }
public void UpdateActorStatus(RoomActor Actor) { Vector2 Redirection = mRedirectGrid[Actor.Position.X, Actor.Position.Y]; if (Redirection != null) { Actor.Position = new Vector3(Redirection.X, Redirection.Y, GetUserStepHeight(Redirection)); } RoomTileEffect Effect = mTileEffects[Actor.Position.X, Actor.Position.Y]; if (Effect == null) { return; } Dictionary <string, string> CurrentStatusses = Actor.UserStatusses; if (Effect.Type == RoomTileEffectType.Sit && !CurrentStatusses.ContainsKey("mv")) { string OldStatus = (CurrentStatusses.ContainsKey("sit") ? CurrentStatusses["sit"] : string.Empty); string NewStatus = Math.Round(Effect.InteractionHeight, 1).ToString().Replace(',', '.'); if (Actor.BodyRotation != Effect.Rotation) { Actor.BodyRotation = Effect.Rotation; Actor.HeadRotation = Effect.Rotation; Actor.UpdateNeeded = true; } if (NewStatus != OldStatus) { Actor.SetStatus("sit", NewStatus); Actor.UpdateNeeded = true; } } else if (CurrentStatusses.ContainsKey("sit")) { Actor.RemoveStatus("sit"); Actor.UpdateNeeded = true; } if (Effect.Type == RoomTileEffectType.Lay && !CurrentStatusses.ContainsKey("mv")) { string OldStatus = (CurrentStatusses.ContainsKey("lay") ? CurrentStatusses["lay"] : string.Empty); string NewStatus = Math.Round(Effect.InteractionHeight, 1).ToString().Replace(',', '.'); if (Actor.BodyRotation != Effect.Rotation) { Actor.BodyRotation = Effect.Rotation; Actor.HeadRotation = Effect.Rotation; Actor.UpdateNeeded = true; } if (OldStatus != NewStatus) { Actor.SetStatus("lay", NewStatus); Actor.UpdateNeeded = true; } } else if (CurrentStatusses.ContainsKey("lay")) { Actor.RemoveStatus("lay"); Actor.UpdateNeeded = true; } if (Effect.Type == RoomTileEffectType.Effect) { if ((Actor.AvatarEffectId != Effect.EffectId || !Actor.AvatarEffectByItem)) { Actor.ApplyEffect(Effect.EffectId, true, true); } } else if (Actor.AvatarEffectByItem) { int ClearEffect = 0; if (Actor.Type == RoomActorType.UserCharacter) { Session SessionObject = SessionManager.GetSessionByCharacterId(Actor.ReferenceId); if (SessionObject != null) { ClearEffect = SessionObject.CurrentEffect; } } else { Bot BotObject = (Bot)Actor.ReferenceObject; if (BotObject != null) { ClearEffect = BotObject.Effect; } } Actor.ApplyEffect(ClearEffect, true, true); } if (Actor.Type == RoomActorType.UserCharacter && Effect.QuestData > 0) { Session SessionObject = SessionManager.GetSessionByCharacterId(Actor.ReferenceId); if (SessionObject != null) { QuestManager.ProgressUserQuest(SessionObject, QuestType.EXPLORE_FIND_ITEM, Effect.QuestData); } } }
protected override void Dispose(bool disposing) { if (disposing) { // Dispose managed } // Dispose unmanaged if (!IsInvalid) { try { _mainThreadNotification.Set(); lock (_eventQueueLock) { Monitor.Pulse(_eventQueueLock); } if (_callbacks != null) { _callbacks.Dispose(); _callbacks = null; } PlaylistTrackManager.RemoveAll(this); TrackManager.DisposeAll(this); LinkManager.RemoveAll(this); UserManager.RemoveAll(this); PlaylistContainerManager.RemoveAll(this); PlaylistManager.RemoveAll(this); ContainerPlaylistManager.RemoveAll(this); ArtistManager.RemoveAll(); AlbumManager.RemoveAll(); SessionManager.Remove(Handle); lock (Spotify.Mutex) { Error error = Error.OK; if (ConnectionState == ConnectionState.LoggedIn) { error = Spotify.sp_session_logout(Handle); Debug.WriteLineIf(error != Error.OK, error.GetMessage()); } Ensure(() => error = Spotify.sp_session_release(Handle)); Debug.WriteLineIf(error != Error.OK, error.GetMessage()); } } catch { // Ignore } finally { Debug.WriteLine("Session disposed"); } } base.Dispose(disposing); }
public string GetRssTitle() { return(SessionManager.GetSetting("title", "Untitled")); }
public SessionController(AccountManager accountManager, SessionManager sessionManager, JwtTokenGenerator tokenGenerator) { _accountManager = accountManager; _sessionManager = sessionManager; _tokenGenerator = tokenGenerator; }
/// <summary> /// Add a event listener for when the AR Tracking regained after it was lost. /// </summary> /// <param name="callback"></param> public void OnARTrackingRestored(Action callback) { SessionManager?.OnARTrackingRestored(callback); }
/// <summary> /// Returns a string describing the current AR session tracking status /// </summary> /// <returns></returns> public string GetARSessionInfoString() { return(SessionManager != null?SessionManager.GetSessionInfoString() : "None"); }
/// <summary> /// Returns a string describing the current AR Session provider, e.g., AR Foundation or Vuforia. /// </summary> /// <returns></returns> public string GetARSessionProviderString() { return(SessionManager != null?SessionManager.GetProviderString() : "None"); }
public static int Increment(HttpRequest request, Cache cache, SessionManager manager) { return GetCounterCache(cache, manager).Add(request); }
public void PerformUpdate() { List <RoomActor> ActorsToUpdate = new List <RoomActor>(); List <RoomActor> ActorsToRemove = new List <RoomActor>(); // Copy collection Dictionary <uint, RoomActor> ActorsCopy = new Dictionary <uint, RoomActor>(); List <RoomActor>[,] NewUserGrid = new List <RoomActor> [mCachedModel.Heightmap.SizeX, mCachedModel.Heightmap.SizeY]; lock (mActorSyncRoot) { foreach (KeyValuePair <uint, RoomActor> CopyItem in mActors) { ActorsCopy.Add(CopyItem.Key, CopyItem.Value); } } foreach (RoomActor Actor in ActorsCopy.Values) { // If the room is unloaded, allow no actors if (mUnloaded) { ActorsToRemove.Add(Actor); continue; } // The idle time is increased in every step. if (Actor.Type == RoomActorType.UserCharacter) { Actor.IncreaseIdleTime(Actor.ReferenceId == Info.OwnerId); } // If this is a bot, allow the brain to process this update tick. if (Actor.Type == RoomActorType.AiBot) { ((Bot)Actor.ReferenceObject).Brain.PerformUpdate(this); } // Remove any walking statusses (they will be re-applied below if neccessary) if (Actor.UserStatusses.ContainsKey("mv")) { Actor.RemoveStatus("mv"); Actor.UpdateNeeded = true; } // Update actor position if neccessary if (Actor.PositionToSet != null) { // Check if the new position is in the door if (Actor.Type == RoomActorType.UserCharacter && Actor.PositionToSet.X == mCachedModel.DoorPosition.X && Actor.PositionToSet.Y == mCachedModel.DoorPosition.Y) { ActorsToRemove.Add(Actor); continue; } // Update the actual position Actor.Position = new Vector3(Actor.PositionToSet.X, Actor.PositionToSet.Y, (Math.Round(GetUserStepHeight(Actor.PositionToSet), 1))); Actor.PositionToSet = null; // Handle any "MoveToAndInteract" events if this was the last step if (!Actor.IsMoving && Actor.MoveToAndInteract > 0 && Actor.Type == RoomActorType.UserCharacter) { Item Item = GetItem(Actor.MoveToAndInteract); if (Item != null) { ItemEventDispatcher.InvokeItemEventHandler(SessionManager.GetSessionByCharacterId( Actor.ReferenceId), Item, this, ItemEventType.Interact, Actor.MoveToAndInteractData); } Actor.MoveToAndInteract = 0; Actor.MoveToAndInteractData = 0; } } // If there are more steps to be made, handle it. if (Actor.IsMoving) { // Check if moving to door if (!Actor.IsLeavingRoom && Actor.Pathfinder.Target.X == mCachedModel.DoorPosition.X && Actor.Pathfinder.Target.Y == mCachedModel.DoorPosition.Y) { Actor.IsLeavingRoom = true; } // Get the next step from the pathfinder Vector2 NextStep = Actor.GetNextStep(); // If the user is leaving and has exceeded 11 steps, help him out by instantly // removing them. if (Actor.LeaveStepsTaken >= 11) { ActorsToRemove.Add(Actor); continue; } // If the pathfinder reports no more steps to be made, this is the last step. bool LastStep = !Actor.IsMoving; // Check that the next step is valid and allowed if (NextStep != null && ((!Actor.ClippingEnabled && IsValidPosition(NextStep)) || IsValidStep(Actor.Position.GetVector2(), NextStep, LastStep, NewUserGrid))) { // Update "mv" status Actor.SetStatus("mv", NextStep.X + "," + NextStep.Y + "," + (Math.Round(GetUserStepHeight(NextStep), 1)).ToString().Replace(',', '.')); Actor.PositionToSet = NextStep; // Update new/temporary grid with our new move to position if (NewUserGrid[NextStep.X, NextStep.Y] == null) { NewUserGrid[NextStep.X, NextStep.Y] = new List <RoomActor>(); } NewUserGrid[NextStep.X, NextStep.Y].Add(Actor); // Remove any "sit" statusses if (Actor.UserStatusses.ContainsKey("sit")) { Actor.RemoveStatus("sit"); } // Remove any "lay" statusses if (Actor.UserStatusses.ContainsKey("lay")) { Actor.RemoveStatus("lay"); } // Update rotation Actor.BodyRotation = Rotation.Calculate(Actor.Position.GetVector2(), NextStep); Actor.HeadRotation = Actor.BodyRotation; // Request update for next @B cycle Actor.UpdateNeeded = true; } else { // Invalid step: tell pathfinder to stop and mark current position on temporary grid Actor.StopMoving(); if (NewUserGrid[NextStep.X, NextStep.Y] == null) { NewUserGrid[NextStep.X, NextStep.Y] = new List <RoomActor>(); } NewUserGrid[NextStep.X, NextStep.Y].Add(Actor); } } else { if (NewUserGrid[Actor.Position.X, Actor.Position.Y] == null) { NewUserGrid[Actor.Position.X, Actor.Position.Y] = new List <RoomActor>(); } NewUserGrid[Actor.Position.X, Actor.Position.Y].Add(Actor); } // If the actor is leaving and has stopped walking, help them out by removing them. if (!Actor.IsMoving && Actor.IsLeavingRoom && Actor.Type == RoomActorType.UserCharacter) { ActorsToRemove.Add(Actor); continue; } // Update status (apply any sit/lay/effect) UpdateActorStatus(Actor); // Add this actor to the update list if this has been requested if (Actor.UpdateNeeded) { ActorsToUpdate.Add(Actor); Actor.UpdateNeeded = false; } } // Remove all actors that need to be removed foreach (RoomActor Actor in ActorsToRemove) { lock (mActorSyncRoot) { if (ActorsToUpdate.Contains(Actor)) { ActorsToUpdate.Remove(Actor); } } switch (Actor.Type) { default: RemoveActorFromRoom(Actor.Id); break; case RoomActorType.UserCharacter: HardKickUser(Actor.ReferenceId); break; } } // Send update list (if there are any updates) to room if (ActorsToUpdate.Count > 0) { BroadcastMessage(RoomUserStatusListComposer.Compose(ActorsToUpdate)); } // Update tick on all items -- List <Item> ItemCopy = null; lock (mItemSyncRoot) { ItemCopy = mItems.Values.ToList(); } foreach (Item Item in ItemCopy) { Item.Update(this); } // Invalidate door position NewUserGrid[mCachedModel.DoorPosition.X, mCachedModel.DoorPosition.Y] = null; // Update user grid to our new version lock (mActorSyncRoot) { mUserGrid = NewUserGrid; } if (mMusicController != null && mMusicController.IsPlaying) { mMusicController.Update(this); } }
public static int IncrementPostCounter(int id, Cache cache, SessionManager manager) { return GetCounterCache(cache, manager).AddPostCounter(id); }
/// <summary> /// 回复客户端消息 /// </summary> /// <param name="ID"></param> /// <param name="data"></param> public void Reply(string ID, WSProtocal data) { var ut = SessionManager.Get(ID); ReplyBase((WSUserToken)ut, data); }
private void ResetSession() { m_currentUser = null; CurrentActiveWindow = null; Contacts.Clear(); m_ActiveChatUsers.Clear(); if (null != m_mainWindow) { m_mainWindow.Dispose(); m_mainWindow = null; } if (m_sessionMgr != null) { m_sessionMgr.Dispose(); m_sessionMgr = null; } }
public static Int32 getDefaultPersonaIdx() { using (ISession session = SessionManager.getSessionFactory().OpenSession()) return(session.Load <UserEntity>(1).defaultPersonaIdx); }
protected void Page_Load(object sender, EventArgs e) { SessionManager = new SessionManager(Session); lblUserName.Text = SessionManager.UserNameSession; }
/// <summary> /// Handles the UniGrid's OnAction event. /// </summary> /// <param name="actionName">Name of item (button) that throws event</param> /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param> protected void UniGridSites_OnAction(string actionName, object actionArgument) { SiteInfo si = SiteInfoProvider.GetSiteInfo(ValidationHelper.GetInteger(actionArgument, 0)); if (si != null) { string siteName = si.SiteName; switch (actionName) { case "editSite": URLHelper.Redirect("Site_Edit_Frameset.aspx?siteid=" + actionArgument); break; case "delete": URLHelper.Redirect("site_delete.aspx?siteid=" + actionArgument); break; case "editContent": { // Make url for site in form 'http(s)://sitedomain/application/cmsdesk'. string sitedomain = si.DomainName.TrimEnd('/'); string application = null; // Support of multiple web sites on single domain if (!sitedomain.Contains("/")) { application = ResolveUrl("~/.").TrimEnd('/'); } // Application includes string '/cmsdesk'. application += "/cmsdesk/"; string url = URLHelper.Url.Scheme + "://" + sitedomain + application; ltlScript.Text = ScriptHelper.GetScript("window.open('" + url + "');"); } break; case "openLiveSite": { // Make url for site in form 'http(s)://sitedomain/application'. string sitedomain = si.DomainName.TrimEnd('/'); string application = null; // Support of multiple web sites on single domain if (!sitedomain.Contains("/")) { application = ResolveUrl("~/.").TrimEnd('/'); } string url = URLHelper.Url.Scheme + "://" + sitedomain + application + "/"; ltlScript.Text = ScriptHelper.GetScript("window.open('" + url + "');"); } break; case "start": try { SiteInfoProvider.RunSite(siteName); } catch (Exception ex) { ShowError(GetString("Site_List.ErrorMsg"), ex.Message, null); } break; case "stop": SiteInfoProvider.StopSite(siteName); SessionManager.Clear(siteName); break; case "export": URLHelper.Redirect("~/CMSModules/ImportExport/SiteManager/ExportSite.aspx?siteid=" + actionArgument); break; } } }