void Awake() { if (ROOMS != null && ROOMS.Count > 0 && !InstanceIsSet()) { _instance = this; } }
public RoomsController(IUnityContainer container, IEventAggregator eventAggregator, RoomCollection rooms, ITabHeaderNotificationProvider <IEnumerable <Room> > tabHeaderNotification) { if (null == container) { throw new ArgumentNullException("container"); } if (null == eventAggregator) { throw new ArgumentNullException("eventAggregator"); } if (null == rooms) { throw new ArgumentNullException("rooms"); } if (null == tabHeaderNotification) { throw new ArgumentNullException("tabHeaderNotification"); } this.m_Rooms = rooms; this.m_Container = container; this.m_EventAggregator = eventAggregator; this.m_TabHeaderNotification = tabHeaderNotification; this.m_ChattingRoomsDictionary = new RoomsDictionary(); this.SubscribeEvents(); }
public void get_underworld_sprite_params_and_overlord() { var romData = Utilities.LoadRom("rando.sfc"); RoomCollection rc = new RoomCollection(romData, new Random(), new SpriteGroupCollection(romData, new Random(), new SpriteRequirementCollection()), new SpriteRequirementCollection()); rc.LoadRooms(); // invert the masks byte byte0mask = (byte)~SpriteConstants.SpriteSubtypeByte0RemoveMask; byte byte1mask = (byte)~SpriteConstants.OverlordRemoveMask; foreach (var r in rc.Rooms) { var sprites = r.Sprites.Where(x => (x.byte0 & byte0mask) > 0 || (x.byte1 & byte1mask) > 0); if (sprites.Any()) { output.WriteLine($"room: {r.RoomId} ({r.RoomName})"); foreach (var s in sprites) { output.WriteLine($"addr: {s.Address.ToString("X8")} \tID: {((s.byte1 & byte1mask) == 0xE0 ? s.SpriteId + 0x100 : s.SpriteId).ToString("X2")} \tName: { SpriteConstants.GetSpriteName(((s.byte1 & byte1mask) == 0xE0 ? s.SpriteId + 0x100 : s.SpriteId)) } \tBits: {Convert.ToString((((s.byte0 & byte0mask) >> 2) | ((s.byte1 & byte1mask) >> 5)), 2).PadLeft(5, '0')} \tHM P: {(((s.byte0 & byte0mask) >> 2) | ((s.byte1 & byte1mask) >> 5)).ToString("X2")}"); } output.WriteLine(""); } } }
public void CollectRooms(RoomCollection rooms, string strMySid) { var RoomCollection = ConnectionHelper.DB.GetCollection <RoomEntity>("RoomEntity"); var UserCollection = ConnectionHelper.DB.GetCollection <UserEntity>("UserEntity"); var FindRoomsQuery = Query <RoomEntity> .EQ(r => r.UserSid, strMySid); var FindedRooms = RoomCollection.Find(FindRoomsQuery); foreach (RoomEntity r in FindedRooms) { IList <string> ActiveMemberNickNames = new List <string>(); foreach (string strUserSid in r.ActiveMemberSids) { if (strMySid == strUserSid) { continue; } var FindUserQuery = Query <UserEntity> .EQ(u => u.Sid, strUserSid); var FindedUser = UserCollection.FindOne(FindUserQuery); if (null != FindedUser) { ActiveMemberNickNames.Add(FindedUser.NickName); } } rooms.Add(new Room(r.Sid, ActiveMemberNickNames, r.UnReadMsgCount, r.LastMsgSummary, r.LastMsgDate, r.ThumbnailPath, rooms)); } }
//Feature Rendering //Decoration Rendering #endregion private void HandleDebug() { if (debugShowCells) { foreach (var cell in CellCollection.cells.Values) { cellDebug.RenderCellDebug(cell.position, cell.type); } } if (debugShowRoomBase) { foreach (var room in RoomCollection.GetAll()) { roomDebug.RenderRoomDebug(room); } } if (debugShowDoors) { nodeDebug.RenderDoorNodes(); } if (debugShowRoomScaffolds) { RoomCollection.GetAll().ForEach(x => roomDebug.RenderRoomScaffoldingDebug(x)); roomDebug.RenderRoomScaffoldingDoorDebug(); } if (debugShowPOI) { nodeDebug.RenderPOI(); } }
public void CollectRooms(RoomCollection rooms, string strMySid) { m_Logger.Log("Mocking CollectRooms Raised", Category.Info, Priority.None); /* * rooms.Add(new RoomEntity * ("0", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/1.png", UriKind.Relative)) * , "Paul", 0,2, "Bye! See you!", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ("1", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/2.png", UriKind.Relative)), * "Jacob, Angel ,Lucas,Grace ", 5, 0, "Really?", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ("2", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/3.png", UriKind.Relative)), * "Michael , Landon ,Isaac ", 4, 38, "When is your birthday?", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ("3", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/4.png", UriKind.Relative)), * "Alexander , Evan ,Isaiah,Taylor,Hannah ", 6, 0, "Oh, i see...", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "4", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/5.png", UriKind.Relative)), * "William , Mason ,Emma ", 4, 17, "Anyway, i will get there", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "5", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/6.png", UriKind.Relative)), * "Joshua , Gavin ,Olivia ", 4, 0, "Shut up!!!", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ("6", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/7.png", UriKind.Relative)), * "Daniel , Nicholas ,Sophia ", 4, 0, "Can i see?", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "7", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/8.png", UriKind.Relative)), * "Jayden , Caleb ,Ava ", 4, 0, "i wanaa go home....ohoh", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "8", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/9.png", UriKind.Relative)), * "Noah , Jonathan ,Emily ", 4, 0, "tell me how am i supposed live without you..?", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "9", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/10.png", UriKind.Relative)), * "Anthony , Dylan ,Madison ", 4, 0, "Bye! bye...bye...", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "10", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/11.png", UriKind.Relative)), * "Christopher , Tyler ,Abigail ", 4, 0, "i'm Crying now...", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "11", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/12.png", UriKind.Relative)), * "Aiden , Samuel ,Chloe ", 4, 0, "Did you see that?", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "12", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/13.png", UriKind.Relative)), * "Matthew , John ,Mia ", 4, 0, "Maybe. On september?", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ("13", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/14.png", UriKind.Relative)), * "David , Jackson ,Elizabeth ", 4, 0, "How are you David?", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ("14", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/15.png", UriKind.Relative)), * "Andrew , Nathan ,Alexis ", 4, 0, "Just 3 days remain..", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "15", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/16.png", UriKind.Relative)), * "Joseph , Gabriel ,Addison ", 4, 0, "Remember!", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ( "16", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/17.png", UriKind.Relative)), * "Logan , Elijah ,Ella ", 4, 0, "Perfect! wonderful!!", DateTime.Now.ToShortDateString())); * rooms.Add(new RoomEntity * ("17", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/18.png", UriKind.Relative)), * "Ryan , Benjamin ,Samantha ", 4, 0, "let me see your info..", DateTime.Now.ToShortDateString()));*/ }
// Use this for initialization void Start() { roomCollection = FindObjectOfType <RoomCollection>() as RoomCollection; GameManager.instance.RegisterEnemyToRadarHelper(this); if (!animator) { animator = GetComponentInChildren <Animator>(); } currentHealth = maxHealth; Frustum frustum = GetComponent <Frustum>(); //m_networkFrustum = frustum.gameObject; //TODO: maybe change to add isServer? //if (isServer) { //m_networkFrustum = Instantiate (frustumPrefab, transform.GetChild (0).position, transform.GetChild (0).rotation) as GameObject; //NetworkServer.Spawn (m_networkFrustum); //m_networkFrustum.transform.parent = transform.GetChild(0).transform; frustum.PostStart(); //} damageTextPool = GetComponent <ObjectPool>(); charge = GetComponent <GhostCharge>(); if (isServer) { Rpc_SetTarget(roomCollection.GetRandomPositionInRoom()); } }
public User(string username, bool guartOn, bool alarmOn, bool keyOnOff, bool datX, int cellgroup, string catRoom, int floor) { InitializeComponent(); InstanceContext instanceContext = new InstanceContext(new ClientServiceCallback()); _clientService = new ClientServiceClient(instanceContext); RommsL = this.Resources["RoomsDataSource"] as RoomCollection; _keysCollectionL = this.Resources["KeysDataSource"] as KeysCollection; _floorId = floor; //определение сом порта этажа // todo надо переписать под универсальную строку коннекта когда будет создан админ // string conn = @"Data Source=microsoft-pc;Initial Catalog=ALFA;Integrated Security=True"; // SqlConnection sqlComPort = new SqlConnection(conn); // sqlComPort.Open(); // string infoAboutComPort = @"SELECT ComPort FROM Floors // WHERE (FloorName = '" + _floorId + "')"; // SqlCommand sqlinfoAboutComPort = new SqlCommand(infoAboutComPort, sqlComPort); // SqlDataReader rezultat = sqlinfoAboutComPort.ExecuteReader(); // rezultat.Read(); // _yComPort = (string)rezultat["ComPort"]; // rezultat.Close(); // sqlComPort.Close(); // ну согласись, лучше чем верхняя портянка, даже если предположить что ты не знаешь Linq то тут все понятно AlfaEntities alfaEntities = new AlfaEntities(); // todo ошибочно считается что не может быть ситуации когда забит этаж и не указан ком порт, надо обработать это исключение _yComPort = (from floorse in alfaEntities.Floors where floorse.FloorId == _floorId select floorse.ComPort).FirstOrDefault(); }
public void get_list_of_goodies() { var romData = Utilities.LoadRom("rando.sfc"); var spriteRequirements = new SpriteRequirementCollection(); SpriteGroupCollection sgc = new SpriteGroupCollection(romData, new Random(), spriteRequirements); sgc.LoadSpriteGroups(); RoomCollection rc = new RoomCollection(romData, new Random(), sgc, spriteRequirements); rc.LoadRooms(); OverworldAreaCollection areas = new OverworldAreaCollection(romData, new Random(), new SpriteGroupCollection(romData, new Random(), new SpriteRequirementCollection()), new SpriteRequirementCollection()); var spriteGroupsJson = JsonConvert.SerializeObject(sgc.SpriteGroups.Select(x => new { x.GroupId, x.DungeonGroupId, x.SubGroup0, x.SubGroup1, x.SubGroup2, x.SubGroup3 }), Formatting.Indented); var roomJson = JsonConvert.SerializeObject(rc.Rooms.Select(x => new { x.RoomId, x.RoomName, x.GraphicsBlockId }), Formatting.Indented); var roomSpritesJson = JsonConvert.SerializeObject(rc.Rooms.Select(x => new { x.RoomId, Sprites = new { Sprites = x.Sprites.Select(y => new { y.SpriteId, y.SpriteName, y.Address, y.HasAKey, y.IsOverlord }) } }), Formatting.Indented); var areaJson = JsonConvert.SerializeObject(areas.OverworldAreas.Select(x => new { x.AreaId, x.AreaName, x.GraphicsBlockId }), Formatting.Indented); var areaSpritesJson = JsonConvert.SerializeObject(areas.OverworldAreas.Select(x => new { x.AreaId, Sprites = new { Sprites = x.Sprites.Select(y => new { y.SpriteId, y.SpriteName }) } }), Formatting.Indented); output.WriteLine(spriteGroupsJson); output.WriteLine(roomJson); output.WriteLine(roomSpritesJson); output.WriteLine(areaJson); output.WriteLine(areaSpritesJson); }
public ServerDataManager() { //房间初始化 allRoom = new RoomCollection(); OffLineRooms = new ConcurrentDictionary <string, int>(); // Log4Debug("数据处理准备就绪。"); }
void LoadPreRequisites() { roomParentTransform = new GameObject("Level").transform; roomCollection = RoomCollection.Instance; roomCollection.Load(Application.dataPath + "/StreamingAssets/XML/room_collection.xml"); RoomData.BaseSize = roomCollection.BaseSize; roomFactory = new RoomFactory(); }
// Use this for initialization void Start() { maxPlayers = FindObjectOfType <NetManager>().maxPlayers; ghostBehaviour = GetComponent <GhostBehaviour>(); roomCollection = roomCollection = FindObjectOfType <RoomCollection>(); animator = GetComponentInChildren <Animator>(); ResetFleeTimer(); ResetCooldownTimer(); }
private void AddRoomCommandExecute(object o) { var rnd = new Random(); var room = new Room(rnd.Next(0, 100), rnd.Next(50, 200), (RoomType)rnd.Next(0, 4), (RoomSubtype)rnd.Next(0, 3), rnd.Next(20, 80)); _hotel.AddRoom(room); RoomCollection.Add(new RoomModel(room)); RoomCollectionView.Refresh(); }
public void Refresh() { RoomCollection.Clear(); foreach (var room in _hotel.GetAllRoomsWithBookings()) { RoomCollection.Add(new RoomModel(room)); } SortRoomsSelectedType = SortRoomsTypes[0]; ShownDateTime = DateTime.Now.Date; }
public void should_load_all_sprites_for_dungeon_rooms() { //RomData romData = Utilities.LoadRom("rando.sfc"); RomData romData = Utilities.LoadRom("..\\..\\..\\20170104 Testing\\Enemizer 6.0 - ER_er-no-glitches-0.4.7_normal-open-ganon_297664836.sfc"); Random rand = new Random(0); RoomCollection rc = new RoomCollection(romData, rand, new SpriteGroupCollection(romData, rand, new SpriteRequirementCollection()), new SpriteRequirementCollection()); rc.LoadRooms(); foreach (var r in rc.Rooms) { output.WriteLine($"RoomId: {r.RoomId}, RoomName: {r.RoomName}, RoomGfx: {r.GraphicsBlockId}, sprite count: {r.Sprites.Count}, sprites: {String.Join(",", r.Sprites.Select(x => (x.IsOverlord ? "1" : "") + x.SpriteId.ToString("X2") + (x.HasAKey ? "(HasKey)" : "") ))}"); } }
Room spawnRoom(RoomInfo roomInfo) { int doorMask = 0; /* Construct the door mask. * This is used to filter out invalid rooms. */ for ( Directions d = Directions.NORTH; d <= Directions.WEST; d++ ) { if (roomInfo.neighbors[(int)d] != null) { doorMask += 1 << (int)d; } } RoomCollection rooms = roomPrefabs[(int)roomInfo.type]; /* Filter out all rooms that do not match the doors needed. */ List <Room> validRooms = rooms.rooms.FindAll(r => ((r.doorMask ^ doorMask) & doorMask) == 0); /* Select a random room to instantiate. */ int index = Random.Range(0, validRooms.Count); Room room = Instantiate <Room>(validRooms[index], dungeon.transform); room.x = roomInfo.x; room.y = roomInfo.y; room.type = roomInfo.type; /* Remove the colliders from the room where there are doors instead. */ for ( Directions d = Directions.NORTH; d <= Directions.WEST; d++ ) { bool noDoor = (doorMask & 1 << (int)d) == 0; /* If there is no door, the collider should be enabled. * Otherwise, it should be diabled. */ room.doorwayColliders[(int)d].enabled = noDoor; } room.transform.position = new Vector2(roomInfo.x * room.width, roomInfo.y * room.height); room.UnLoad(); return(room); }
public int Pack(out List <PlacedObject> placedObjs, List <PlaceableObject> objectsToPlace, bool[,] roomLayout, PlacementScoreRequirement scoreReq = PlacementScoreRequirement.DontCare, bool includeDistance = false, float acceptProbability = 1f) { var templateRoom = new Room(roomLayout, _freeBoolValue); var roomIds = objectsToPlace.SelectMany(obj => obj.RoomsIn).Distinct(); var rooms = new Dictionary <int, Room>(); foreach (var r in roomIds) { var room = templateRoom.CloneBase(); room.Id = r; rooms[r] = room; } // sort objectsByScore var objectsToPlaceSorted = objectsToPlace.OrderBy( obj => - obj.TilesNeeded * obj.RoomsIn.Count ); // pack objects placedObjs = new List <PlacedObject>(); foreach (var obj in objectsToPlaceSorted) { IRoom objRooms = new RoomCollection(obj.RoomsIn.Select(roomId => rooms[roomId])); RectanglePlacer placer = new RectanglePlacer(objRooms); var placedObj = placer.Place(obj, scoreReq, includeDistance, acceptProbability); if (placedObj == null) { placedObjs = null; return(int.MaxValue); } placedObjs.Add(placedObj); } Debug.Assert(placedObjs.Count == objectsToPlace.Count); var score = placedObjs.Sum(placedObj => placedObj.WallScore); //UnityEngine.Debug.Log("[RectPlacer] Finished First Fit"); //UnityEngine.Debug.Log("[RectPlacer] WallScore: " + score); //Helper.PrintToConsole(placedObjs); return(score); }
public GMXFile() { Sprites = new SpriteCollection(); Sound = new SoundCollection(); Backgrounds = new BackgroundCollection(); Paths = new PathCollection(); Scripts = new ScriptCollection(); Fonts = new FontCollection(); TimeLines = new TimeLineCollection(); Objects = new ObjectCollection(); Rooms = new RoomCollection(); Includes = new IncludedFileCollection(); Configs = new ConfigCollection(); ResourceTree = new ResourceTree(); }
private void Application_Startup(object sender, StartupEventArgs e) { var context = new HotelContext(); IUserRepository userRepository = new UserRepository(context); IManagerRepository managerRepository = new ManagerRepository(context); IVisitorRepository visitorRepository = new VisitorRepository(context); IManagerInfoRepository managerInfoRepository = new ManagerInfoRepository(context); IVisitorInfoRepository visitorInfoRepository = new VisitorInfoRepository(context); IRoomRepository roomRepository = new RoomRepository(context); IBookingRepository bookingRepository = new BookingRepository(context); UserCollection userCollection = new UserCollection(userRepository); ManagerCollection managerCollection = new ManagerCollection(managerRepository); VisitorCollection visitorCollection = new VisitorCollection(visitorRepository); ManagerInfoCollection managerInfoCollection = new ManagerInfoCollection(managerInfoRepository); VisitorInfoCollection visitorInfoCollection = new VisitorInfoCollection(visitorInfoRepository); RoomCollection roomCollection = new RoomCollection(roomRepository); BookingCollection bookingCollection = new BookingCollection(bookingRepository); IHotelSystem hotel = new HotelSystem(userCollection, managerCollection, visitorCollection, managerInfoCollection, visitorInfoCollection, roomCollection, bookingCollection); if (hotel.GetUser("root") is null) { hotel.AddUser(new Manager { Login = "******", Password = "******", Salary = 123, ManagerInfo = new ManagerInfo { Name = "lola", Surname = "brown", Email = "www@fw", StartDate = new DateTime(1999, 12, 12) } }); } Window mainWindow = new MainWindow(); IDialogService dialogService = new DialogService.DialogService(mainWindow); dialogService.Register <RoomAboutDialogWindowModel, RoomAboutDialogWindow>(); dialogService.Register <RoomBookingsDialogWindowModel, RoomBookingsDialogWindow>(); dialogService.Register <AddBookingDialogWindowModel, AddBookingDialogWindow>(); MainController mainController = new MainController(hotel, mainWindow, dialogService); mainController.LoadLoginDashboard(); }
public ChatManager( ConnectionManager connectionManager, IChatServiceProxy chatServiceProxy, AccountManager accountManager) : base(connectionManager) { _chatServiceProxy = chatServiceProxy; _accountManager = accountManager; _accountManager.LoggedIn += OnLoggedIn; //Messages = new ObservableCollection<Event>(); OnlineUsers = new ObservableCollection<Profile>(); UserDirectory = new Dictionary<int, Profile> (); Rooms = new RoomCollection (); _updateBuilder = new ChatUpdateBuilder (); }
public GameMakerFile() { Sprites = new SpriteCollection(); Sounds = new SoundCollection(); Backgrounds = new BackgroundCollection(); Paths = new PathCollection(); Scripts = new ScriptCollection(); Fonts = new FontCollection(); TimeLines = new TimeLineCollection(); Objects = new ObjectCollection(); Rooms = new RoomCollection(); Triggers = new TriggerCollection(); Includes = new IncludedFileCollection(); Constants = new ConstantCollection(); Information = new GameInformation(); Settings = new GameSettings(); ResourceTree = new ResourceTree(); }
public GameMakerFile() { Sprites = new SpriteCollection(); Sounds = new SoundCollection(); Backgrounds = new BackgroundCollection(); Paths = new PathCollection(); Scripts = new ScriptCollection(); Fonts = new FontCollection(); TimeLines = new TimeLineCollection(); Objects = new ObjectCollection(); Rooms = new RoomCollection(); Triggers = new TriggerCollection(); Includes = new IncludedFileCollection(); Constants = new ConstantCollection(); Information = new GameInformation(); Settings = new GameSettings(); ResourceTree = new ResourceTree(); }
public void Test() { Room r1 = new Room(); r1.UserId = 1; r1.Name = "Room One"; Room r2 = new Room(); r2.UserId = 2; r2.Name = "Room Two"; RoomCollection roomCollection = new RoomCollection(); roomCollection.Add(r1); roomCollection.Add(r2); foreach (int roomId in roomCollection.Keys) { Console.WriteLine("Room number: {0} - Room name: {1}", roomId, roomCollection[roomId]); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); RoomCollection room_collection_script = (RoomCollection)target; string reload_rooms_button_text; reload_rooms_button_text = "Update Rooms"; if (GUILayout.Button(reload_rooms_button_text)) { room_collection_script.UpdateRooms(); } if (GUILayout.Button("Print Room Adjacencies")) { string msg = "Room adjacencies:"; foreach (RoomObject room in RoomCollection.ROOMS) { msg += "\nRoom" + room.id.ToString() + ": ["; bool first_element = true; foreach (int i in room.adjacent_rooms) { if (!first_element) { msg += ", "; } else { first_element = false; } msg += i.ToString(); } msg += "]"; } Debug.Log(msg); } if (GUILayout.Button("Recalculate Room Adjacencies")) { room_collection_script.DetectRoomAdjacencies(); } }
private void Start() { if (levelSize == null) { return; } var startingPoint = new LevelCoordinate { Height = 0, Width = Random.Range(0, levelSize.Width) }; levelRenderer = GetComponent <LevelRenderer>(); roomCollection = GetComponent <RoomCollection>(); layoutCreator = new FourByFourLayout(roomCollection.GetRoomTypes(), startingPoint); bounds = levelRenderer.RenderBaseLevel(layoutCreator); }
public void Load(string path) { var serializer = new XmlSerializer(typeof(RoomCollection)); RoomCollection rc = null; using (var stream = new FileStream(path, FileMode.Open)) { rc = serializer.Deserialize(stream) as RoomCollection; } if (rc != null) { foreach (RoomData rd in rc.rooms) { if (rooms.Where(x => x.Name == rd.Name).FirstOrDefault() == null) { rooms.Add(rd); } } } postDeserialization(); }
public static void ClaimRooms(this Region region) { //Elevation cells are grouped into their own room to prevent complications while (region.GetCells().Where(x => x.type == CellType.Elevation).Any(x => !x.claimedByRoom)) { var elevationGroups = region.GetCells().Where(x => x.type == CellType.Elevation) .GroupBy(g => new Vector2(g.position.x, g.position.y)); foreach (var elevationGroup in elevationGroups) { var room = new Room(); if (!ClaimRoom(elevationGroup.ToList(), ref room)) { continue; } room.regionId = region.id; RoomCollection.Add(room); } } //Until all cells are claimed by a room while (region.GetCells().Any(x => !x.claimedByRoom)) { var cellsLeftToClaim = region.GetCells().Where(x => !x.claimedByRoom).ToList(); var rootCell = cellsLeftToClaim[Random.Range(0, cellsLeftToClaim.Count)]; var claimSize = region.greedyClaiming ? region.maximumRoomSize : Random.Range(1, region.maximumRoomSize + 1); var projection = ProjectRoom(rootCell, ref cellsLeftToClaim, Random.Range(1, region.maximumRoomSize + 1), region.claimChance, region.roomClaimingStrategy); if (projection.Any()) { var room = new Room(); if (!ClaimRoom(projection, ref room)) { continue; } room.regionId = region.id; RoomCollection.Add(room); } } }
private void loadRomButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == true) { RomData romData = LoadRom(ofd.FileName); var spriteRequirements = new SpriteRequirementCollection(); SpriteGroupCollection sgc = new SpriteGroupCollection(romData, new Random(), spriteRequirements); sgc.LoadSpriteGroups(); RoomCollection rc = new RoomCollection(romData, new Random(), spriteRequirements); rc.LoadRooms(); var vm = new VM(); vm.spriteGroupCollection = sgc; vm.roomCollection = rc; this.DataContext = vm; } }
public static void ScaffoldRoomNodes() { foreach (var room in RoomCollection.GetAll()) { var scaffold = new Scaffold { roomId = room.id }; Elevation_Parse(room, ref scaffold); Floor_ParseMain(room, ref scaffold); Floor_ParseConnectors(room, ref scaffold); Floor_ParseColumns(room, ref scaffold); Wall_ParseMain(room, ref scaffold); Wall_ParseConnector(room, ref scaffold); Ceiling_Parse(room, ref scaffold); Level.roomScaffolds.Add(room.id, scaffold); } CleanScaffolding(); }
private void FillRoomStack() { roomQueue = new Queue <Property.Room>(); repeatRooms = new List <Property.Room>(); RoomCollection collect = Resources.Load <RoomCollection> ("Config/NormalRoomStack"); List <Property.Room> roomList = collect.roomList; #if UNITY_EDITOR roomList = new List <Property.Room>(); roomList.AddRange(collect.roomList); #endif ShuffleRoom(ref roomList); foreach (var room in roomList) { roomQueue.Enqueue(room); if (!room.Identical) { repeatRooms.Add(room); } } }
protected abstract void ProcessResource( RoomCollection aRooms );
protected abstract void ProcessResource(RoomCollection aRooms);
protected override void ProcessResource( RoomCollection aRooms ) { if ( !aRooms.Any() ) return; OnCategoryProcessing( ResourceTypes.Rooms ); Directory.CreateDirectory( Directories.Rooms ); var previous = SetCurrentDirectory( Directories.Rooms ); foreach ( var room in aRooms ) { var document = new XElement( "Room", CreateIndexedResourceNodes( room ), new XElement( "RoomCaption", room.RoomCaption ), new XElement( "Width", room.Width ), new XElement( "Height", room.Height ), new XElement( "SnapX", room.SnapX ), new XElement( "SnapY", room.SnapY ), new XElement( "Speed", room.Speed ), new XElement( "CreationCode", EscapeText( room.CreationCode ) ), new XElement( "IsometricGrid", room.IsometricGrid ), new XElement( "Persistent", room.Persistent ), new XElement( "ViewsEnabled", room.ViewsEnabled ), new XElement( "DrawBackgroundColor", room.DrawBackgroundColor ), new XElement( "BackgroundColor", ColorTranslator.ToHtml( room.BackgroundColor ) ), new XElement( "Backgrounds", from background in room.Backgrounds select new XElement( "Background", new XComment( "Node below refers to: " + FindResourceName( m_gmk.Backgrounds, background.BackgroundIndex ) ), new XElement( "BackgroundIndex", background.BackgroundIndex ), new XElement( "X", background.X ), new XElement( "Y", background.Y ), new XElement( "HorizontalSpeed", background.HorizontalSpeed ), new XElement( "VerticalSpeed", background.VerticalSpeed ), new XElement( "Visible", background.Visible ), new XElement( "ForegroundImage", background.ForegroundImage ), new XElement( "TileHorizontally", background.TileHorizontally ), new XElement( "TileVertically", background.TileVertically ), new XElement( "Stretch", background.Stretch ) ) ), new XElement( "Views", from view in room.Views select new XElement( "View", new XElement( "Visible", view.Visible ), new XElement( "X", view.X ), new XElement( "Y", view.Y ), new XElement( "Width", view.Width ), new XElement( "Height", view.Height ), new XElement( "PortX", view.PortX ), new XElement( "PortY", view.PortY ), new XElement( "PortWidth", view.PortWidth ), new XElement( "PortHeight", view.PortHeight ), new XElement( "HorizontalBorder", view.HorizontalBorder ), new XElement( "VerticalBorder", view.VerticalBorder ), new XElement( "HorizontalSpacing", view.HorizontalSpacing ), new XElement( "VerticalSpacing", view.VerticalSpacing ), new XComment( "Node below refers to: " + FindResourceName( m_gmk.Objects, view.FollowedObject ) ), new XElement( "FollowedObject", view.FollowedObject ) ) ), new XElement( "Instances", from instance in room.Instances select new XElement( "Instance", new XElement( "ID", instance.ID ), new XComment( "Node below refers to: " + FindResourceName( m_gmk.Objects, instance.ObjectIndex ) ), new XElement( "ObjectIndex", instance.ObjectIndex ), new XElement( "X", instance.X ), new XElement( "Y", instance.Y ), new XElement( "Locked", instance.Locked ), new XElement( "CreationCode", EscapeText( instance.CreationCode ) ) ) ), new XElement( "Tiles", from tile in room.Tiles select new XElement( "Tile", new XElement( "ID", tile.ID ), new XComment( "Node below refers to: " + FindResourceName( m_gmk.Backgrounds, tile.BackgroundIndex ) ), new XElement( "BackgroundIndex", tile.BackgroundIndex ), new XElement( "X", tile.X ), new XElement( "Y", tile.Y ), new XElement( "TileX", tile.TileX ), new XElement( "TileY", tile.TileY ), new XElement( "Width", tile.Width ), new XElement( "Height", tile.Height ), new XElement( "Depth", tile.Depth ), new XElement( "Locked", tile.Locked ) ) ), new XElement( "RememberRoomSettings", room.RememberRoomSettings ), new XElement( "RoomEditorTab", room.RoomEditorTab ), new XElement( "RoomEditorWidth", room.RoomEditorWidth ), new XElement( "RoomEditorHeight", room.RoomEditorHeight ), new XElement( "ShowGrid", room.ShowGrid ), new XElement( "ShowObjects", room.ShowObjects ), new XElement( "ShowTiles", room.ShowTiles ), new XElement( "ShowBackgrounds", room.ShowBackgrounds ), new XElement( "ShowForegrounds", room.ShowForegrounds ), new XElement( "ShowViews", room.ShowViews ), new XElement( "DeleteObjectsOutsideOfRoom", room.DeleteObjectsOutsideOfRoom ), new XElement( "DeleteTilesOutsideOfRoom", room.DeleteTilesOutsideOfRoom ), new XElement( "HorizontalScrollbarPosition", room.HorizontalScrollbarPosition ), new XElement( "VerticalScrollbarPosition", room.VerticalScrollbarPosition ) ); SaveDocument( document, SafeResourceFilename( room ) + ".xml" ); OnResourceProcessed( room.Name ); } OnCategoryProcessed( ResourceTypes.Rooms ); SetCurrentDirectory( previous ); }
private void RemoveRoomCommandExecute(object o) { _hotel.RemoveRoom(SelectedRoom.Id); RoomCollection.Remove(SelectedRoom); RoomCollectionView.Refresh(); }
public GameServer() { Channels = new ChannelCollection(); Rooms = new RoomCollection(); Players = new PlayerCollection(); Logger = new Logger() { WriteToConsole = true }; _packetLogger = new PacketLogger(); Logger.Load(Path.Combine("logs", string.Format("game_{0}.log", DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss")))); AppDomain.CurrentDomain.UnhandledException += (s, e) => { Error(s, new ExceptionEventArgs((Exception)e.ExceptionObject)); Environment.Exit(0); }; _packetLogger.Load("game_packets.log"); Logger.Info("Loading game_config.xml..."); GameConfig.Load(); Logger.Info("Setting up servers..."); _server = new TcpServer(IPAddress.Parse(GameConfig.Instance.IP), GameConfig.Instance.Port); _server.PacketReceived += HandlePacket; _server.ClientDisconnected += ClientDisconnected; _server.Error += Error; var isMono = Type.GetType("Mono.Runtime") != null; switch (GameConfig.Instance.AuthRemote.Binding) { case "pipe": if (isMono) { Logger.Error("pipe is not supported in mono, use http!"); Environment.Exit(1); return; } _authRemoteClient = new RemoteClient(ERemoteBinding.Pipe, string.Format("localhost/AuthServer/{0}/", SHA256.ComputeHash(GameConfig.Instance.AuthRemote.Password))); break; case "tcp": if (isMono) { Logger.Error("pipe is not supported in mono, use http!"); Environment.Exit(1); return; } _authRemoteClient = new RemoteClient(ERemoteBinding.Pipe, string.Format("{0}:{1}/AuthServer/{2}/", GameConfig.Instance.AuthRemote.Server, GameConfig.Instance.AuthRemote.Port, SHA256.ComputeHash(GameConfig.Instance.AuthRemote.Password))); break; case "http": _authRemoteClient = new RemoteClient(ERemoteBinding.Http, string.Format("{0}:{1}/AuthServer/{2}/", GameConfig.Instance.AuthRemote.Server, GameConfig.Instance.AuthRemote.Port, SHA256.ComputeHash(GameConfig.Instance.AuthRemote.Password))); break; default: Logger.Error("Invalid remote binding '{0}' for AuthRemote", GameConfig.Instance.AuthRemote.Binding); Environment.Exit(1); break; } Logger.Info("Loading plugins... {0}",AppDomain.CurrentDomain.BaseDirectory); _pluginManager.Load(); foreach (var plugin in _pluginManager.Plugins) Logger.Info("Loaded {0}", plugin.Name); }
protected override void ProcessResource(RoomCollection aRooms) { var files = GetXmlFiles(Directories.Rooms); if (files.Any()) { OnCategoryProcessing(ResourceTypes.Rooms); var previous = SetCurrentDirectory(Directories.Rooms); foreach (var file in files) { var document = LoadXml(file); if (document != null) { var room = new Room() { Name = GetElement(document, "Name").Value, ID = GetElementValue <int>(document, "ID"), RoomCaption = GetElement(document, "RoomCaption").Value, Width = GetElementValue <int>(document, "Width"), Height = GetElementValue <int>(document, "Height"), SnapX = GetElementValue <int>(document, "SnapX"), SnapY = GetElementValue <int>(document, "SnapY"), Speed = GetElementValue <int>(document, "Speed"), CreationCode = GetElement(document, "CreationCode").Value, IsometricGrid = GetElementValue <bool>(document, "IsometricGrid"), Persistent = GetElementValue <bool>(document, "Persistent"), ViewsEnabled = GetElementValue <bool>(document, "ViewsEnabled"), DrawBackgroundColor = GetElementValue <bool>(document, "DrawBackgroundColor"), BackgroundColor = Drawing.ColorTranslator.FromHtml(GetElement(document, "BackgroundColor").Value), RememberRoomSettings = GetElementValue <bool>(document, "RememberRoomSettings"), RoomEditorTab = GetElementValue <RoomEditorTabs>(document, "RoomEditorTab"), RoomEditorWidth = GetElementValue <int>(document, "RoomEditorWidth"), RoomEditorHeight = GetElementValue <int>(document, "RoomEditorHeight"), ShowGrid = GetElementValue <bool>(document, "ShowGrid"), ShowObjects = GetElementValue <bool>(document, "ShowObjects"), ShowTiles = GetElementValue <bool>(document, "ShowTiles"), ShowBackgrounds = GetElementValue <bool>(document, "ShowBackgrounds"), ShowForegrounds = GetElementValue <bool>(document, "ShowForegrounds"), ShowViews = GetElementValue <bool>(document, "ShowViews"), DeleteObjectsOutsideOfRoom = GetElementValue <bool>(document, "DeleteObjectsOutsideOfRoom"), DeleteTilesOutsideOfRoom = GetElementValue <bool>(document, "DeleteTilesOutsideOfRoom"), HorizontalScrollbarPosition = GetElementValue <int>(document, "HorizontalScrollbarPosition"), VerticalScrollbarPosition = GetElementValue <int>(document, "VerticalScrollbarPosition") }; room.Backgrounds.AddRange(from element in document.Element("Backgrounds").Elements("Background") select new Room.Background() { BackgroundIndex = GetElementValue <int>(element, "BackgroundIndex"), X = GetElementValue <int>(element, "X"), Y = GetElementValue <int>(element, "Y"), HorizontalSpeed = GetElementValue <int>(element, "HorizontalSpeed"), VerticalSpeed = GetElementValue <int>(element, "VerticalSpeed"), Visible = GetElementValue <bool>(element, "Visible"), ForegroundImage = GetElementValue <bool>(element, "ForegroundImage"), TileHorizontally = GetElementValue <bool>(element, "TileHorizontally"), TileVertically = GetElementValue <bool>(element, "TileVertically"), Stretch = GetElementValue <bool>(element, "Stretch") }); room.Views.AddRange(from element in document.Element("Views").Elements("View") select new Room.View() { Visible = GetElementValue <bool>(element, "Visible"), FollowedObject = GetElementValue <int>(element, "FollowedObject"), // ? X = GetElementValue <int>(element, "X"), Y = GetElementValue <int>(element, "Y"), Width = GetElementValue <int>(element, "Width"), Height = GetElementValue <int>(element, "Height"), PortX = GetElementValue <int>(element, "PortX"), PortY = GetElementValue <int>(element, "PortY"), PortWidth = GetElementValue <int>(element, "PortWidth"), PortHeight = GetElementValue <int>(element, "PortHeight"), HorizontalBorder = GetElementValue <int>(element, "HorizontalBorder"), VerticalBorder = GetElementValue <int>(element, "VerticalBorder"), HorizontalSpacing = GetElementValue <int>(element, "HorizontalSpacing"), VerticalSpacing = GetElementValue <int>(element, "VerticalSpacing") }); room.Instances.AddRange(from element in document.Element("Instances").Elements("Instance") select new Room.Instance() { ID = GetElementValue <int>(element, "ID"), ObjectIndex = GetElementValue <int>(element, "ObjectIndex"), X = GetElementValue <int>(element, "X"), Y = GetElementValue <int>(element, "Y"), Locked = GetElementValue <bool>(element, "Locked"), CreationCode = GetElement(element, "CreationCode").Value }); room.Tiles.AddRange(from element in document.Element("Tiles").Elements("Tile") select new Room.Tile() { ID = GetElementValue <int>(element, "ID"), BackgroundIndex = GetElementValue <int>(element, "BackgroundIndex"), X = GetElementValue <int>(element, "X"), Y = GetElementValue <int>(element, "Y"), TileX = GetElementValue <int>(element, "TileX"), TileY = GetElementValue <int>(element, "TileY"), Width = GetElementValue <int>(element, "Width"), Height = GetElementValue <int>(element, "Height"), Depth = GetElementValue <int>(element, "Depth"), Locked = GetElementValue <bool>(element, "Locked") }); aRooms.Add(room); } OnAbortProcessingCallback(); } if (aRooms.Any()) { aRooms.LastInstanceID = aRooms.Max(room => { if (room.Instances.Any()) { return(room.Instances.Max(instance => instance.ID)); } else { return(99999); } }) + 1; aRooms.LastTileID = aRooms.Max(room => { if (room.Tiles.Any()) { return(room.Tiles.Max(tile => tile.ID)); } else { return(999999); } }) + 1; } OnCategoryProcessed(ResourceTypes.Rooms); SetCurrentDirectory(previous); } }
public Room(RoomCollection owner, EServerType serverType = EServerType.Game) { CreationTime = DateTime.Now; RoundStartTime = DateTime.Now; StartTime = DateTime.Now; RoomCollection = owner; ServerType = serverType; }
private void LoadRooms(TabPage roomTypeTab) { try { long TypeID = ((RoomType)roomTypeTab.Tag).Typeid; KryptonPanel roomOutlinePane = new KryptonPanel(); TableLayoutPanel roomLayoutPane = new TableLayoutPanel(); RoomCollection mRoomColl = new RoomCollection(); if (TypeID > -1) mRoomColl.Where(Room.TypeidColumn.ColumnName, TypeID).Load(); else mRoomColl.Load(); roomLayoutPane.RowCount = mRoomColl.Count >= 26 ? mRoomColl.Count - 1 : 25; roomLayoutPane.ColumnCount = 12; roomLayoutPane.Size = new Size(ROOM_BUTTON_WIDTH * roomLayoutPane.RowCount + 3, ROOM_BUTTON_HEIGHT * roomLayoutPane.ColumnCount + 3); int currRowIndex = 0; int currColIndex = 0; roomLayoutPane.SuspendLayout(); foreach (Room room in mRoomColl) { var roomButton = new KryptonButton { Name = ("RM" + room.Roomid), Size = new Size(ROOM_BUTTON_WIDTH, ROOM_BUTTON_HEIGHT), Text = (room.Name.Trim().ToLowerInvariant().StartsWith("room") ? room.Name : "Room " + room.Name), Tag = room }; CreateRoomMenu(roomButton); roomLayoutPane.Controls.Add(roomButton); roomLayoutPane.SetRow(roomButton, currRowIndex); roomLayoutPane.SetColumn(roomButton, currColIndex); if (currColIndex == roomLayoutPane.ColumnCount) { currRowIndex++; currColIndex = 0; } else { currColIndex++; } } roomLayoutPane.ResumeLayout(); roomLayoutPane.BackColor = Color.Transparent; roomOutlinePane.Dock = DockStyle.Fill; roomOutlinePane.Controls.Add(roomLayoutPane); roomTypeTab.Controls.Add(roomOutlinePane); //Add to Current Tab } catch (Exception ex) { } }