Пример #1
0
 public RegionInfo(string name, int id, int parent, Point spawnPosition)
 {
     Id = id;
     Name = name;
     Parent = parent;
     SpawnPosition = spawnPosition;
 }
        /// <inheritdoc/>
        public Task SaveAsync(Point index, IChunk chunk)
        {
            if (!_chunks.ContainsKey(index))
                _chunks[index] = chunk;

            return Task.CompletedTask;
        }
Пример #3
0
 public RegionInfo AddRegion(string name, int parentRegionId, Point spawnPosition)
 {
     var id = _regions.Keys.Max() + 1;
     var newRegion = new RegionInfo(name, id, parentRegionId, spawnPosition);
     _regions.Add(id, newRegion);
     return newRegion;
 }
Пример #4
0
        public SpriteSheet(CanvasBitmap image, IEnumerable<string> names, OB.Point size, int padding)
        {
            _image = image;
            _size = size;
            _padding = padding;

            _spriteSize = new OB.Point(
                ((int)image.SizeInPixels.Width - size.X * padding) / size.X,
                ((int)image.SizeInPixels.Height - size.Y * padding) / size.Y);

            var i = 0;

            foreach (var name in names)
            {
                if (!string.IsNullOrWhiteSpace(name))
                {
                    var x = i % size.X;
                    var y = i / size.X;
                    _names[name] = new OB.Point(x, y);
                }
                i++;
            }
        }
Пример #5
0
 public void SetMetadata(Point position, TileMetadata value)
     => _tileMetadata[Size * position.Y + position.X] = value;
Пример #6
0
 public TileMetadata GetMetadata(Point position)
     => _tileMetadata[Size * position.Y + position.X];
Пример #7
0
 public TileInfo this[Point position]
 {
     get { return this[position.X, position.Y]; }
     set { this[position.X, position.Y] = value; }
 }
Пример #8
0
 public PlayerInfo WithPosition(Point newPosition)
     => new PlayerInfo(Id, DisplayName, newPosition);
Пример #9
0
 public PlayerInfo(string id, string displayName, Point position)
 {
     Id = id;
     DisplayName = displayName;
     Position = position;
 }
 /// <inheritdoc/>
 public Task<IChunk> LoadAsync(Point index, CancellationToken cancellation)
 {
     return Task.FromResult(_chunks.TryGetValue(index));
 }
 /// <inheritdoc/>
 public Task DeleteAsync(Point index)
 {
     _chunks.Remove(index);
     return Task.CompletedTask;
 }
Пример #12
0
 public AreaSpawnResult(ITransactionWithMoveSupport transaction, bool isSuccessful, IEnumerable<FollowUpEvent> followUpEvents, Point spawnPosition)
     : base(transaction, isSuccessful, followUpEvents)
 {
     SpawnPosition = spawnPosition;
 }