Beispiel #1
0
        public static World GetWorld(
            AsyncRPGDataContext db_context,
            ICacheAdapter cache,
            int game_id)
        {
            string world_identifier = GetWorldCacheIdentifier(game_id);
            World  world            = (World)cache[world_identifier];

            if (world == null)
            {
                world = WorldBuilderCache.GetWorldBuilder(db_context, cache).LazyLoadWorld(db_context, game_id);

                cache[world_identifier] = world;
            }

            return(world);
        }
Beispiel #2
0
        public static bool BuildWorld(
            AsyncRPGDataContext db_context,
            ICacheAdapter cache,
            int game_id,
            out string result)
        {
            World world = null;

            bool success =
                WorldBuilderCache.GetWorldBuilder(db_context, cache).BuildWorld(db_context, game_id, out world, out result);

            if (success)
            {
                string world_identifier = GetWorldCacheIdentifier(game_id);

                cache[world_identifier] = world;
            }

            return(success);
        }