예제 #1
0
        private static async Task CreateWorld(RunicMagicDbContext context)
        {
            if (!context.Rooms.Any())
            {
                var startingRoom = new RoomRecord(0, "The starting room", @"
You are standing in a small room. It is quite nondistinct. It seems
like the gods have put a lot of effort into ensuring a world exists at
all, and not much into making it look nice. Surely they will do so
at a later point in time.".Trim());

                var secondRoom = new RoomRecord(0, "The second room", @"
You are standing in a small room. It is gray and dark, almost no light
penetrates through the solid rock. Frankly, it is amazing the light of
the gods reaches here at all. Then again: they are gods.".Trim());

                startingRoom.Links.Add(new RoomLinkRecord(startingRoom, secondRoom, Direction.NORTH.Value));
                secondRoom.Links.Add(new RoomLinkRecord(secondRoom, startingRoom, Direction.SOUTH.Value));

                context.Rooms.Add(startingRoom);
                context.Rooms.Add(secondRoom);

                await context.SaveChangesAsync();
            }
        }
예제 #2
0
 internal SavedWorldState(IRunicMagicContextProvider contextProvider)
 {
     _context = contextProvider.Context;
 }