Exemple #1
0
        public void SetArea(Area a)
        {
            if (area == null || a.Index != area.Index)
            {
                Stream groupAreasFile = GetAreaMappingFile();
                groupAreasFile.Position = Index & 0xff;
                int lastValue = groupAreasFile.ReadByte() & 0x80;
                groupAreasFile.Position = Index & 0xff;
                groupAreasFile.WriteByte((byte)((a.Index & 0x7f) | lastValue));

                var handler       = new Area.TileModifiedHandler(ModifiedTileCallback);
                var layoutHandler = new Area.LayoutGroupModifiedHandler(ModifiedLayoutGroupCallback);
                if (area != null)
                {
                    area.TileModifiedEvent        -= handler;
                    area.LayoutGroupModifiedEvent -= layoutHandler;
                }
                a.TileModifiedEvent        += handler;
                a.LayoutGroupModifiedEvent += layoutHandler;

                cachedImage = null;

                area = a;

                UpdateRoomData();
            }
        }
Exemple #2
0
        public void SetArea(Area a)
        {
            if (area == null || a.Index != area.Index) {
                Stream groupAreasFile = Project.GetBinaryFile("rooms/group" + (Index>>8) + "Areas.bin");
                groupAreasFile.Position = Index&0xff;
                int lastValue = groupAreasFile.ReadByte() & 0x80;
                groupAreasFile.Position = Index&0xff;
                groupAreasFile.WriteByte((byte)((a.Index&0x7f) | lastValue));

                var handler = new Area.TileModifiedHandler(ModifiedTileCallback);
                var layoutHandler = new Area.LayoutGroupModifiedHandler(ModifiedLayoutGroupCallback);
                if (area != null) {
                    area.TileModifiedEvent -= handler;
                    area.LayoutGroupModifiedEvent -= layoutHandler;
                }
                a.TileModifiedEvent += handler;
                a.LayoutGroupModifiedEvent += layoutHandler;

                cachedImage = null;

                area = a;

                UpdateRoomData();
            }
        }