private void AreaPropertiesChanged(AreaDataObservable area) { bool changed = false; AreaData updatedArea = _objectMapper.Map <AreaData>(area); if (updatedArea.Width != _loadedAreaData.Width || updatedArea.Height != _loadedAreaData.Height) { var map = _loadedArea.GetComponent <Map>(); map.Resize(updatedArea.Width, updatedArea.Height); var paintable = _objectPainter.GetComponent <Paintable>(); paintable.AreaHeight = updatedArea.Height; paintable.AreaWidth = updatedArea.Width; changed = true; } if (updatedArea.TilesetGlobalID != _loadedAreaData.TilesetGlobalID) { // TODO: Blank out existing tiles and load new tileset spritesheet. changed = true; } if (changed) { _loadedAreaData = updatedArea; } }
private void AreaClosed(AreaDataObservable area) { CameraReset(); _loadedArea.Delete(); _loadedAreaData = null; _objectPainter.Delete(); _objectPainter = null; }
private void LoadExistingData() { Areas.Clear(); foreach (var loaded in _moduleDataService.LoadAll <AreaData>()) { AreaDataObservable area = _observableDataFactory.CreateAndMap <AreaDataObservable, AreaData>(loaded); Areas.Add(area); } }
private void AreaOpened(AreaDataObservable area) { TilesetData tileset = _moduleDataService.Load <TilesetData>(area.TilesetGlobalID); ResourceItemData data = _resourceService.GetResourceByName(ResourceType.Tileset, tileset.ResourceName); ActiveTilesetImage = BitmapImageHelpers.LoadFromBytes(data.Data); ActiveTilesetImageWidth = ActiveTilesetImage.Width; ActiveTilesetImageHeight = ActiveTilesetImage.Height; TileGridVisibility = Visibility.Visible; }
private void ClearForm() { Name = string.Empty; Tag = string.Empty; Resref = string.Empty; Width = 1; Height = 1; LocalVariables.Clear(); SelectedTileset = null; _editingArea = null; OnAreaHeartbeat = string.Empty; OnAreaEnter = string.Empty; OnAreaExit = string.Empty; }
private void AreaOpened(AreaDataObservable area) { CameraReset(); _loadedAreaData = _objectMapper.Map <AreaData>(area); _loadedArea = _entityFactory.Create <Area, AreaData>(_loadedAreaData); Texture2D texture = _loadedArea.GetComponent <Renderable>().Texture; _objectPainter = _entityFactory.Create <ObjectPainter, Texture2D>(texture); Paintable paintable = _objectPainter.GetComponent <Paintable>(); paintable.AreaHeight = _loadedAreaData.Height; paintable.AreaWidth = _loadedAreaData.Width; }
private void AreaPropertiesOpened(AreaDataObservable area) { _editingArea = area; Name = area.Name; Tag = area.Tag; Resref = area.Resref; Width = area.Width; Height = area.Height; SelectedTileset = Tilesets.SingleOrDefault(x => x.GlobalID == area.TilesetGlobalID); LocalVariables.Clear(); foreach (var @string in area.LocalVariables.LocalStrings) { LocalVariables.LocalStrings.Add(@string); } foreach (var @double in area.LocalVariables.LocalDoubles) { LocalVariables.LocalDoubles.Add(@double); } }
private void AreaCreated(AreaDataObservable area) { Areas.Add(area); IsAreaListExpanded = true; }
private void AreaClosed(AreaDataObservable area) { ClearActiveTilesetImage(); TileGridVisibility = Visibility.Hidden; }
private void AreaOpened(AreaDataObservable area) { IsAreaOpened = true; }
private void AreaClosed(AreaDataObservable obj) { IsAreaOpened = false; }