public MainWindow(string currentUserRole, string currentUsername) { InitializeComponent(); this.DataContext = this; AllMapObjectTypes = MapObjectType.AllMapObjectTypesAvailableForSearch; _currentUserRole = currentUserRole; _currentUsername = currentUsername; _canvas = this.Canvas; _fileRepository = new FileRepository("test.json"); _mapObjectController = new MapObjectController(new MapObjectServices(_fileRepository)); _allMapObjects = new List <MapObject>(); this.DataContext = this; MockupObjects mockupObjects = new MockupObjects(); _allMapObjects = mockupObjects.AllMapObjects; ChangeEditButtonVisibility(); // uncomment only when you want to save the map for the first time saveMap(); LoadInitialMapOnCanvas(); RestrictUsersAccessBasedOnRole(); SetDataToUIControls(); }
public List <SearchResultDTO> GetSearchResult() { List <EquipmentRelocationDto> searchResult = new SchedulingServerController().GetEquipmentRelocationAppointments(eqRequest); IMapObjectController mapObjectController = new MapObjectController(); List <SearchResultDTO> retVal = new List <SearchResultDTO>(); IEquipmentServerController equipmentServerController = new EquipmentServerController(); for (int i = 0; i < searchResult.Count(); i++) { EquipmentRelocationDto equipmentRelocationDto = searchResult.ElementAt(i); MapObject mo = mapObjectController.GetMapObjectById(equipmentRelocationDto.SourceRoomId); var equipments = equipmentServerController.GetEquipmentByRoomId(mo.Id); string amount = ""; foreach (EquipmentDto eq in equipments) { if (eq.Name.Equals(equipment)) { amount = eq.Quantity.ToString(); break; } } string timeInterval = equipmentRelocationDto.TimeInterval.Start.ToString() + "-" + equipmentRelocationDto.TimeInterval.End.ToString(); EquipmentRelocationSearchResultDTO searchResultDTO = new EquipmentRelocationSearchResultDTO() { Content = equipmentRelocationDto.SourceRoomId.ToString() + AllConstants.ContentSeparator + equipmentRelocationDto.DestinationRoomId.ToString() + AllConstants.ContentSeparator + amount + AllConstants.ContentSeparator + timeInterval, EquipmentRelocationDto = equipmentRelocationDto }; retVal.Add(searchResultDTO); } return(retVal); }
public List <SearchResultDTO> GetSearchResult() { IEnumerable <EquipmentDto> searchResult = new EquipmentServerController().GetEquipmentByRoomId(schedulingDto.SourceRoomId); List <SearchResultDTO> retVal = new List <SearchResultDTO>(); IMapObjectController mapObjectController = new MapObjectController(); IEquipmentServerController equipmentServerController = new EquipmentServerController(); for (int i = 0; i < searchResult.Count(); i++) { EquipmentDto equipmentDto = searchResult.ElementAt(i); MapObject mo = mapObjectController.GetMapObjectById(equipmentDto.RoomId); string amount = "0"; string timeInterval = schedulingDto.TimeInterval.Start.ToString() + "-" + schedulingDto.TimeInterval.End.ToString(); EquipmentSeparationDto equipmentSeparationDto = new EquipmentSeparationDto() { SourceRoomId = schedulingDto.SourceRoomId, SourceQuantity = equipmentDto.Quantity, DestinationRoomId = schedulingDto.DestinationRoomId, DestinationQuantity = 0, Name = equipmentDto.Name }; EquipmentSeparationSearchResultDTO searchResultDTO = new EquipmentSeparationSearchResultDTO() { Content = equipmentDto.Name + AllConstants.ContentSeparator + equipmentDto.Quantity + AllConstants.ContentSeparator + equipmentDto.Name + AllConstants.ContentSeparator + amount, EquipmentSeparationDto = equipmentSeparationDto }; retVal.Add(searchResultDTO); } return(retVal); }
private void AddAdvancedSearchButton(int row, int mapObjectId) { Button advancedSearchBtn = CreateAdvancedSearchButton(); Grid.SetRow(advancedSearchBtn, row); Grid.SetColumn(advancedSearchBtn, DynamicGrid.ColumnDefinitions.Count - 1); DynamicGrid.Children.Add(advancedSearchBtn); advancedSearchBtn.Click += (s, e) => { MapObject chosenMapObject = new MapObjectController().GetMapObjectById(mapObjectId); selectedObjectId = chosenMapObject.Id; if (chosenMapObject.MapObjectDescription == null) { ShowHospitalMapPage(); } else { MapObjectDescription description = chosenMapObject.MapObjectDescription; ShowBuildingPage(description.FloorNumber, description.BuildingId); } this.Close(); }; }
public void Find_non_existing_map_object() { MapObjectController mapObjectController = new MapObjectController(); MapObject mapObject = mapObjectController.GetMapObjectById(101); Assert.Null(mapObject); }
void Start() { GameObject startPoint = GameObject.Find("StartPoint"); transform.position = startPoint.transform.position; currentPoint = startPoint.GetComponent <MapObjectController> (); currentNeighbors = currentPoint.neighbors; moving = false; }
public void Search_by_filled_text_box_and_empty_combo_box() { MapObjectController mapObjectController = new MapObjectController(); var searchedMapObjects = new List <MapObject>(); searchedMapObjects = mapObjectController.SearchMapObjects("Info", AllConstants.EmptyComboBox); Assert.NotEmpty(searchedMapObjects); }
public void Search_by_filled_text_box_and_filled_combo_box() { MapObjectController mapObjectController = new MapObjectController(); var searchedMapObjects = new List <MapObject>(); searchedMapObjects = mapObjectController.SearchMapObjects("Informations 1", "Informations"); Assert.NotEmpty(searchedMapObjects); }
public BuildingPage(int id, int selectedFloor = 0) { InitializeComponent(); this.id = id; this.selectedFloor = selectedFloor; List <MapObject> mapObjectsInBuilding = new MapObjectController().GetAllBuildingMapObjects(id); InsertMapObjectsToFloor(mapObjectsInBuilding); SetFloorComboBox(mapObjectsInBuilding); SetFloorLegend(); CanvasService.AddObjectToCanvas(floor.GetAllFloorMapObjects(), canvas); }
public RenovationSchedulingDialog(int roomId) { InitializeComponent(); DataContext = this; _renovatonService = new RenovationService(); _mapObjectController = new MapObjectController(new MapObjectServices(_fileRepository)); InitialRoomId = roomId; SetDataToUIControls(); IsAlternativeAppointmentsSectionVisible = false; }
public void AddRoomSelectionEvent() { RoomSelectionEventDTO roomSelectionEventDTO = new RoomSelectionEventDTO(MainWindow._currentUsername, (int)Id); MapObjectController mapObjectController = new MapObjectController(new MapObjectServices(_fileRepository)); MapObject building = mapObjectController.GetMapObjectById(BuildingId); ((Building)building.MapObjectEntity).AddBuildingSelectionEvent(); EventSourcingService eventSourcingService = new EventSourcingService(); eventSourcingService.AddRoomSelectionEvent(roomSelectionEventDTO); }
private void SetLight() { if (stage == 0) { streetLight = MapObjectController.GetStreetLight(StreetLightType.STOPLIGHTGREEN, spriteId); } else if (stage == 1) { streetLight = MapObjectController.GetStreetLight(StreetLightType.STOPLIGHTAMBER, spriteId); } else { streetLight = MapObjectController.GetStreetLight(StreetLightType.STOPLIGHTRED, spriteId); } }
private void AddLight(Tile[,] tileGrid, int tileX, int tileY, int bitIndex, int skipper) { StreetLightType streetLightType; if (skipper == citySkip) { streetLightType = StreetLightType.STREETLIGHTCITY; } else { streetLightType = StreetLightType.STREETLIGHTCOUNTRY; } StreetLight streetLight = MapObjectController.GetStreetLight(streetLightType, bitIndex); MapObject mapObject = new MapObject(streetLight, tileX, tileY, Color.White, 1f); tileGrid[tileX, tileY].AddMapObject(mapObject, false, false, true, null, false); }
public List <SearchResultDTO> GetSearchResult() { IEquipmentServerController equipmentServerController = new EquipmentServerController(); IMapObjectController mapObjectController = new MapObjectController(); List <EquipmentDto> searchResult = equipmentServerController.GetEquipmentByType(type).ToList(); List <SearchResultDTO> retVal = new List <SearchResultDTO>(); for (int i = 0; i < searchResult.Count(); i++) { EquipmentDto equipmentDto = searchResult.ElementAt(i); MapObject mo = mapObjectController.GetMapObjectById(equipmentDto.RoomId); SearchResultDTO searchResultDTO = new SearchResultDTO() { MapObjectId = mo.Id, Content = equipmentDto.Quantity + AllConstants.ContentSeparator + MapObjectSearchResult.MapObjectToRow(mo) }; retVal.Add(searchResultDTO); } return(retVal); }
public List <SearchResultDTO> GetSearchResult() { IMapObjectController mapObjectController = new MapObjectController(); List <SearchResultDTO> retVal = new List <SearchResultDTO>(); for (int i = 0; i < searchResult.Count(); i++) { RecommendationDto recommendationDto = searchResult.ElementAt(i); MapObject mo = mapObjectController.GetMapObjectById(recommendationDto.RoomId); string doctor = recommendationDto.Doctor.Person.Name + " " + recommendationDto.Doctor.Person.Surname; string timeInterval = recommendationDto.TimeInterval.Start.ToString() + "-" + recommendationDto.TimeInterval.End.ToString(); AppointmentSearchResultDTO searchResultDTO = new AppointmentSearchResultDTO() { MapObjectId = mo.Id, Content = mo.Name + AllConstants.ContentSeparator + doctor + AllConstants.ContentSeparator + timeInterval, RecommendationDto = recommendationDto }; retVal.Add(searchResultDTO); } return(retVal); }
public List <SearchResultDTO> GetSearchResult() { List <RenovationDto> searchResult = new SchedulingServerController().GetRenovationAppointments(scheduling); IMapObjectController mapObjectController = new MapObjectController(); List <SearchResultDTO> retVal = new List <SearchResultDTO>(); for (int i = 0; i < searchResult.Count(); i++) { RenovationDto renovationDto = searchResult.ElementAt(i); MapObject mo = mapObjectController.GetMapObjectById(renovationDto.SourceRoomId); string timeInterval = renovationDto.TimeInterval.Start.ToString() + "-" + renovationDto.TimeInterval.End.ToString(); RenovationSearchResultDTO searchResultDTO = new RenovationSearchResultDTO() { Content = renovationDto.SourceRoomId.ToString() + AllConstants.ContentSeparator + timeInterval, RenovationDto = renovationDto }; retVal.Add(searchResultDTO); } return(retVal); }
public List <SearchResultDTO> GetSearchResult() { IMedicationServerController medicationServerController = new MedicationServerController(); IMapObjectController mapObjectController = new MapObjectController(); List <MedicationDto> searchResults = medicationServerController.GetAllMedicationByName(name).ToList(); List <SearchResultDTO> retVal = new List <SearchResultDTO>(); MapObject mo = mapObjectController.GetMapObjectById(AllConstants.StorageRoomId); for (int i = 0; i < searchResults.Count(); i++) { MedicationDto medicationDto = searchResults.ElementAt(i); SearchResultDTO searchResultDTO = new SearchResultDTO() { MapObjectId = mo.Id, Content = medicationDto.Quantity + AllConstants.ContentSeparator + MapObjectSearchResult.MapObjectToRow(mo) }; retVal.Add(searchResultDTO); } return(retVal); }
//Instead of just having a level //make the level determine the chance of a tree landing there public AddingTrees(Tile[,] tileGrid, double[,] treeMap, LoadingInfo loadingInfo) { Random rnd = GameController.GetRandomWithSeed(); double treeLevel = 0; //-6 to positive 6 float percentDone = 0; float percentJump = 100f / CreatingWorld.worldWidth; for (int x = 0; x < CreatingWorld.worldWidth; x++) { percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.AddingTrees, percentDone); for (int y = 0; y < CreatingWorld.worldHeight; y++) { //basically between 0 and 200 int i = (int)((treeMap[x, y] + 8)) * 10; if (rnd.Next(0, 200) < i) { if (treeMap[x, y] > treeLevel) { if (tileGrid[x, y].GetChildObject() == null && tileGrid[x, y].GetLandType() == Game.LandType.OPEN) { float p = (float)(rnd.Next(500, 800)) / 1000f; int type = rnd.Next(0, 8); Tree tree = MapObjectController.GetTree(type); MapObject mapObject = new MapObject(tree, x, y, Color.White, p); TileLogistic tileLogistic = TileLogisticsController.GetTileLogistic(LandType.TREE, 0); tileGrid[x, y].AddMapObject(mapObject, false, false, true, tileLogistic, true); } } } } } }
protected override void Initialize() { debugDrawTimeStopwatch = new Stopwatch(); // Window.IsBorderless = false; Data.SetSettings(); ScreenController.graphicsDevice = GraphicsDevice; DisplayController.Init(this); EngineController.Init(); GraphicsManager.Init(Content); AudioManager.Init(Content); //Game specific init. this could probably be done in game load GroundLayerController.Init(); AngleStuff.Init(); PieceController.Init(); ShadowSpriteController.Init(); MapObjectController.Init(); TileLogisticsController.Init(); GraphicsDevice.Clear(Color.White); IsMouseVisible = true; base.Initialize(); ScreenController.ChangeScreen(new MenuMain()); }
private void UpdateAdditionalInformation() { IMapObjectController mapObjectController = new MapObjectController(); mapObjectController.Update(mapObject); }
void Update() { if (moving) { if (Vector2.Distance(transform.position, targetPosition.position) < 0.02f) { transform.position = targetPosition.position; moving = false; } else { float step = speed * Time.deltaTime; transform.position = Vector3.MoveTowards(transform.position, targetPosition.position, step); } } else { if (Input.GetButtonDown("StartLevel")) { if (currentPoint.isLevel) { SceneManager.LoadScene(currentPoint.levelName); } } else if (Input.GetAxis("Horizontal") > 0.5f) { if (currentNeighbors [0] != null) // move right { targetPosition = currentNeighbors[0].gameObject.transform; currentPoint = currentNeighbors [0]; currentNeighbors = currentPoint.neighbors; moving = true; } } else if (Input.GetAxis("Horizontal") < -0.5f) { if (currentNeighbors [2] != null) // move left { targetPosition = currentNeighbors[2].gameObject.transform; currentPoint = currentNeighbors [2]; currentNeighbors = currentPoint.neighbors; moving = true; } } else if (Input.GetAxis("Vertical") > 0.5f) { if (currentNeighbors [3] != null) // move up { targetPosition = currentNeighbors[3].gameObject.transform; currentPoint = currentNeighbors [3]; currentNeighbors = currentPoint.neighbors; moving = true; } } else if (Input.GetAxis("Vertical") < -0.5f) { if (currentNeighbors [1] != null) // move down { targetPosition = currentNeighbors[1].gameObject.transform; currentPoint = currentNeighbors [1]; currentNeighbors = currentPoint.neighbors; moving = true; } } } }