void DungeonChanged() { Dungeon dungeon = Project.GetDungeon(dungeonSpinButton.ValueAsInt); dungeonEventWrapper.ReplaceEventSource(dungeon); floorSpinButton.Adjustment.Upper = dungeon.NumFloors - 1; if (floorSpinButton.ValueAsInt >= dungeon.NumFloors) { floorSpinButton.Value = dungeon.NumFloors - 1; } var vrg = dungeon.ValueReferenceGroup; if (dungeonVre != null) { dungeonVre.ReplaceValueReferenceGroup(vrg); } else { dungeonVre = new ValueReferenceEditor(Project, vrg, "Base Data"); dungeonVre.ShowAll(); dungeonVreContainer.Add(dungeonVre); } minimap.SetMap(dungeon); minimap.Floor = floorSpinButton.ValueAsInt; RoomChanged(); }
// Called when room index (or season) is changed void OnRoomChanged() { if (ActiveRoom == null) { return; } eventGroup.Lock(); roomSpinButton.Value = ActiveRoom.Index; warpEditor.SetMap(ActiveRoom.Index >> 8, ActiveRoom.Index & 0xff); SetTileset(ActiveRoomLayout.Tileset); if (roomVre == null) { // This only runs once roomVre = new ValueReferenceEditor(Project, ActiveRoom.ValueReferenceGroup); roomVre.AddWidgetToRight("Tileset", editTilesetButton); roomVreHolder.Add(roomVre); roomVre.ShowAll(); roomTilesetModifiedEventWrapper.Bind <ValueModifiedEventArgs>("ModifiedEvent", (sender, args) => SetTileset((sender as ValueReference).GetIntValue(), ActiveSeason)); } else { roomVre.ReplaceValueReferenceGroup(ActiveRoom.ValueReferenceGroup); } // Watch for changes to this room's tileset roomTilesetModifiedEventWrapper.ReplaceEventSource(ActiveRoom.ValueReferenceGroup["Tileset"]); // Watch for changes to the chest UpdateChestData(); eventGroup.Unlock(); UpdateLayoutGroupWarning(); }