示例#1
0
        private static void updateRoomHome(string name)
        {
            RoomInfoEntity entity = RoomStore.GetRoom(name);

            if (entity != null)
            {
                int num_of_paths = DrawingStore.GetNumberOfPaths(entity.HomeX, entity.HomeY);
                if (num_of_paths < Config.MOVE_HOME_THRESHOLD)
                {
                    return;
                }

#if GO_SLOWER
                num_of_paths = DrawingStore.GetNumberOfPaths(entity.HomeX, entity.HomeY + 1);
                if (num_of_paths < Config.MOVE_HOME_THRESHOLD)
                {
                    return;
                }

                num_of_paths = DrawingStore.GetNumberOfPaths(entity.HomeX, entity.HomeY - 1);
                if (num_of_paths < Config.MOVE_HOME_THRESHOLD)
                {
                    return;
                }
#endif
                if (entity.HomeX < 0)
                {
                    if (entity.HomeY < 0)
                    {
                        entity.HomeX--;
                    }
                    else
                    {
                        entity.HomeY++;
                    }
                }
                else
                if (entity.HomeY < 0)
                {
                    entity.HomeY--;
                }
                else
                {
                    entity.HomeX++;
                }

                Warehouse.RoomsTable.Execute(TableOperation.Replace(entity));                      // Throws StorageException ((412) Precondition Failed) if the entity is modified in between.

                RoomsPond.Notify(name);
            }
        }
示例#2
0
        public RoomInfo GetRoom(string name /*case may be incorrect.*/)
        {
            //RoomHomeManager.UpdateRoomHome(name);

            RoomInfo room_info = RoomsPond.Get(name);

            if (room_info != null)
            {
                RoomHomeManager.UpdateRoomHome(room_info.Name);

                GroupManager.EnterRoom(Groups, Context.ConnectionId, room_info.Name);
            }
            return(room_info);
        }