示例#1
0
        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;
            }
        }
示例#2
0
 private void AreaClosed(AreaDataObservable area)
 {
     CameraReset();
     _loadedArea.Delete();
     _loadedAreaData = null;
     _objectPainter.Delete();
     _objectPainter = null;
 }
示例#3
0
 private void LoadExistingData()
 {
     Areas.Clear();
     foreach (var loaded in _moduleDataService.LoadAll <AreaData>())
     {
         AreaDataObservable area = _observableDataFactory.CreateAndMap <AreaDataObservable, AreaData>(loaded);
         Areas.Add(area);
     }
 }
示例#4
0
        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;
        }
示例#5
0
 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;
 }
示例#6
0
        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;
        }
示例#7
0
        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);
            }
        }
示例#8
0
 private void AreaCreated(AreaDataObservable area)
 {
     Areas.Add(area);
     IsAreaListExpanded = true;
 }
示例#9
0
 private void AreaClosed(AreaDataObservable area)
 {
     ClearActiveTilesetImage();
     TileGridVisibility = Visibility.Hidden;
 }
示例#10
0
 private void AreaOpened(AreaDataObservable area)
 {
     IsAreaOpened = true;
 }
示例#11
0
 private void AreaClosed(AreaDataObservable obj)
 {
     IsAreaOpened = false;
 }