示例#1
0
    void ApplyChange(byte x, byte y, IconChangeType changeType, ushort value)
    {
        switch (changeType)
        {
        case IconChangeType.Underlay: ChangeUnderlay(x, y, value); break;

        case IconChangeType.Overlay: ChangeOverlay(x, y, value); break;

        case IconChangeType.Wall: break;     // N/A for 2D map

        case IconChangeType.Floor: break;    // N/A for 2D map

        case IconChangeType.Ceiling: break;  // N/A for 2D map

        case IconChangeType.NpcMovement: break;

        case IconChangeType.NpcSprite: break;

        case IconChangeType.Chain: _mapData.SetZoneChain(x, y, value); break;

        case IconChangeType.BlockHard: PlaceBlock(x, y, value, true); break;

        case IconChangeType.BlockSoft: PlaceBlock(x, y, value, false); break;

        case IconChangeType.Trigger: _mapData.SetZoneTrigger(x, y, (TriggerTypes)value); break;

        default: throw new ArgumentOutOfRangeException(nameof(changeType), changeType, $"Unexpected change type \"{changeType}\"");
        }
    }
示例#2
0
        void ApplyChange(byte x, byte y, IconChangeType changeType, ushort value, MapChange.Enum2 unk3)
        {
            switch (changeType)
            {
            case IconChangeType.Underlay: ChangeUnderlay(x, y, value); break;

            case IconChangeType.Overlay: ChangeOverlay(x, y, value); break;

            case IconChangeType.Wall: break;     // N/A for 2D map

            case IconChangeType.Floor: break;    // N/A for 2D map

            case IconChangeType.Ceiling: break;  // N/A for 2D map

            case IconChangeType.NpcMovement: break;

            case IconChangeType.NpcSprite: break;

            case IconChangeType.Chain: ChangeTileEventChain(x, y, value); break;

            case IconChangeType.BlockHard: PlaceBlock(x, y, value, true); break;

            case IconChangeType.BlockSoft: PlaceBlock(x, y, value, false); break;

            case IconChangeType.Trigger: ChangeTileEventTrigger(x, y, value); break;

            default: throw new ArgumentOutOfRangeException();
            }
        }
示例#3
0
        public void Modify(byte x, byte y, IconChangeType changeType, ushort value, bool isTemporary)
        {
            ApplyChange(x, y, changeType, value);
            var collection = isTemporary ? TempChanges : PermChanges;

            collection.Update(Id, x, y, changeType, value);
        }
示例#4
0
 public ChangeIconEvent(short x, short y, EventScopes scopes, IconChangeType changeType, ushort value)
 {
     X          = x;
     Y          = y;
     Scopes     = scopes;
     ChangeType = changeType;
     Value      = value;
 }
示例#5
0
 public ChangeIconEvent(short x, short y, EventScope scope, IconChangeType changeType, ushort value, ChangeIconLayers layers)
 {
     X          = x;
     Y          = y;
     Scope      = scope;
     ChangeType = changeType;
     Value      = value;
     Layers     = layers;
 }
示例#6
0
 public IMapLayer CreateMapLayer(
     LogicalMap2D logicalMap,
     ITexture tileset,
     Func <int, TileData> getTileFunc,
     DrawLayer layer,
     IconChangeType iconChangeType)
 {
     return(new MapLayer(logicalMap, tileset, getTileFunc, layer, iconChangeType));
 }
示例#7
0
    public void Update(MapId mapId, byte x, byte y, IconChangeType type, ushort value)
    {
        foreach (var c in this)
        {
            if (c.MapId != mapId || c.X != x || c.Y != y || c.ChangeType != type)
            {
                continue;
            }

            c.Value = value;
            return;
        }

        Add(new MapChange {
            MapId = mapId, X = x, Y = y, ChangeType = type
        });
    }
示例#8
0
        public void Update(MapId mapId, byte x, byte y, IconChangeType type, ushort value)
        {
            var change = this.FirstOrDefault(c =>
                                             c.MapId == mapId &&
                                             c.X == x &&
                                             c.Y == y &&
                                             c.ChangeType == type);

            if (change == null)
            {
                change = new MapChange {
                    MapId = mapId, X = x, Y = y, ChangeType = type
                };
                Add(change);
            }

            change.Value = value;
        }
示例#9
0
 public void Modify(byte x, byte y, IconChangeType changeType, ushort value, bool isTemporary)
 {
     ApplyChange(x, y, changeType, value, MapChange.Enum2.Norm);
     // Add / update temp/perm changes
 }
示例#10
0
 public DirtyTileEventArgs(int x, int y, IconChangeType type)
 {
     X    = x;
     Y    = y;
     Type = type;
 }
示例#11
0
 public IMapLayer CreateMapLayer(LogicalMap2D logicalMap, ITexture tileset, Func <int, TileData> getTileFunc, DrawLayer layer,
                                 IconChangeType iconChangeType)
 {
     throw new NotImplementedException();
 }
示例#12
0
 protected void OnDirty(int x, int y, IconChangeType type) => Dirty?.Invoke(this, new DirtyTileEventArgs(x, y, type));
示例#13
0
        public TileLayer(LogicalMap2D logicalMap, ITexture tileset, Func <int, TileData> tileFunc, DrawLayer drawLayer, IconChangeType iconChangeType)
        {
            On <RenderEvent>(e => Render());

            _logicalMap        = logicalMap;
            _logicalMap.Dirty += (sender, args) =>
            {
                if (args.Type == iconChangeType)
                {
                    _dirty.Add((args.X, args.Y));
                }
            };
            _tileset   = tileset;
            _tileFunc  = tileFunc;
            _drawLayer = drawLayer;
        }