Пример #1
0
        bool Get(IChunkCache cache, int i)
        {
            var content = new byte[1024];

            PackUnpack.PackInt32BE(content, 0, i);
            return(cache.Get(CalcHash(content)).Result.Length == 1024);
        }
Пример #2
0
 public override void Initialize()
 {
     this._player       = (IPlayer)this.Game.Services.GetService(typeof(IPlayer));
     this._world        = (IWorld)this.Game.Services.GetService(typeof(IWorld));
     this._chunkCache   = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));
     this._blockStorage = (IBlockStorage)this.Game.Services.GetService(typeof(IBlockStorage));
 }
Пример #3
0
        void Put(IChunkCache cache, int i)
        {
            var content = new byte[1024];

            PackUnpack.PackInt32BE(content, 0, i);
            cache.Put(CalcHash(content), ByteBuffer.NewAsync(content));
        }
Пример #4
0
 public override void Initialize()
 {
     this._player = (IPlayer) this.Game.Services.GetService(typeof (IPlayer));
     this._world = (IWorld) this.Game.Services.GetService(typeof (IWorld));
     this._chunkCache = (IChunkCache) this.Game.Services.GetService(typeof (IChunkCache));
     this._blockStorage = (IBlockStorage) this.Game.Services.GetService(typeof (IBlockStorage));
 }
Пример #5
0
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._chunkCache = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));

            // init the block array.
            Blocks = new Block[CacheWidthInBlocks * CacheLenghtInBlocks * Chunk.HeightInBlocks];
        }
Пример #6
0
        /// <summary>
        /// Initializes the statistics service.
        /// </summary>
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._player       = (IPlayer)this.Game.Services.GetService(typeof(IPlayer));
            this._fogger       = (IFogger)this.Game.Services.GetService(typeof(IFogger));
            this._world        = (IWorld)this.Game.Services.GetService(typeof(IWorld));
            this._chunkStorage = (IChunkStorage)this.Game.Services.GetService(typeof(IChunkStorage));
            this._chunkCache   = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));

            base.Initialize();
        }
Пример #7
0
        public override void Initialize()
        {
            Logger.Trace("init()");

            this.FlyingEnabled = true;
            this.Weapon        = new Shovel(Game);
            this.LoadContent();

            // import required services.
            this._camera     = (ICamera)this.Game.Services.GetService(typeof(ICamera));
            this._chunkCache = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));

            this.Weapon.Initialize();
        }
Пример #8
0
        /// <summary>
        /// Initializes the debug-bar service.
        /// </summary>
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._player       = (IPlayer)this.Game.Services.GetService(typeof(IPlayer));
            this._fogger       = (IFogger)this.Game.Services.GetService(typeof(IFogger));
            this._world        = (IWorld)this.Game.Services.GetService(typeof(IWorld));
            this._chunkStorage = (IChunkStorage)this.Game.Services.GetService(typeof(IChunkStorage));
            this._chunkCache   = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));
            this._assetManager = (IAssetManager)this.Game.Services.GetService(typeof(IAssetManager));

            if (this._assetManager == null)
            {
                throw new NullReferenceException("Can not find asset manager component.");
            }

            base.Initialize();
        }
Пример #9
0
        /// <summary>
        /// Initializes the input manager.
        /// </summary>
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._world                 = (IWorld)this.Game.Services.GetService(typeof(IWorld));
            this._player                = (IPlayer)this.Game.Services.GetService(typeof(IPlayer));
            this._graphicsManager       = (IGraphicsManager)this.Game.Services.GetService(typeof(IGraphicsManager));
            this._cameraController      = (ICameraControlService)this.Game.Services.GetService(typeof(ICameraControlService));
            this._ingameDebuggerService = (IInGameDebuggerService)this.Game.Services.GetService(typeof(IInGameDebuggerService));
            this._fogger                = (IFogger)this.Game.Services.GetService(typeof(IFogger));
            this._skyService            = (ISkyService)this.Game.Services.GetService(typeof(ISkyService));
            this._chunkCache            = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));
            this._bloomService          = (IBloomService)this.Game.Services.GetService(typeof(IBloomService));

            // get current mouse & keyboard states.
            this._previousKeyboardState = Keyboard.GetState();
            this._previousMouseState    = Mouse.GetState();

            base.Initialize();
        }
Пример #10
0
        public override void Initialize()
        {
            Logger.Trace("init()");

            this.FlyingEnabled = true;
            this.Weapon        = new Shovel(Game);

            // import required services.
            this._camera       = (ICamera)this.Game.Services.GetService(typeof(ICamera));
            this._chunkCache   = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));
            this._blockStorage = (IBlockStorage)this.Game.Services.GetService(typeof(IBlockStorage));

            this._assetManager = (IAssetManager)this.Game.Services.GetService(typeof(IAssetManager));
            if (this._assetManager == null)
            {
                throw new NullReferenceException("Can not find asset manager component.");
            }

            this.LoadContent();

            this.Weapon.Initialize();
        }
Пример #11
0
 public PlanetResourceManager(IChunkCache chunkCache)
 {
     _chunkCache = chunkCache;
 }
Пример #12
0
        /// <summary>
        /// Initializes the input manager.
        /// </summary>
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._world = (IWorld) this.Game.Services.GetService(typeof (IWorld));
            this._player = (IPlayer) this.Game.Services.GetService(typeof (IPlayer));
            this._graphicsManager = (IGraphicsManager) this.Game.Services.GetService(typeof (IGraphicsManager));
            this._cameraController = (ICameraControlService) this.Game.Services.GetService(typeof (ICameraControlService));
            this._ingameDebuggerService =(IInGameDebuggerService) this.Game.Services.GetService(typeof (IInGameDebuggerService));
            this._fogger = (IFogger) this.Game.Services.GetService(typeof (IFogger));
            this._skyService = (ISkyService) this.Game.Services.GetService(typeof (ISkyService));
            this._chunkCache = (IChunkCache) this.Game.Services.GetService(typeof (IChunkCache));
            this._bloomService = (IBloomService) this.Game.Services.GetService(typeof (IBloomService));

            // get current mouse & keyboard states.
            this._previousKeyboardState = Keyboard.GetState();
            this._previousMouseState = Mouse.GetState();

            base.Initialize();
        }
Пример #13
0
        public override void Initialize()
        {
            Logger.Trace("init()");

            this.FlyingEnabled = true;
            this.Weapon = new Shovel(Game);
            this.LoadContent();

            // import required services.
            this._camera = (ICamera) this.Game.Services.GetService(typeof (ICamera));
            this._chunkCache = (IChunkCache) this.Game.Services.GetService(typeof (IChunkCache));

            this.Weapon.Initialize();
        }
Пример #14
0
        /// <summary>
        /// Initializes the debug-bar service.
        /// </summary>
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.            
            this._player = (IPlayer)this.Game.Services.GetService(typeof(IPlayer));
            this._fogger = (IFogger)this.Game.Services.GetService(typeof(IFogger));
            this._world = (IWorld)this.Game.Services.GetService(typeof(IWorld));
            this._chunkStorage = (IChunkStorage)this.Game.Services.GetService(typeof(IChunkStorage));
            this._chunkCache = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));
            this._assetManager = (IAssetManager)this.Game.Services.GetService(typeof(IAssetManager));

            if (this._assetManager == null)
                throw new NullReferenceException("Can not find asset manager component.");

            base.Initialize();
        }
Пример #15
0
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._chunkCache = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));

            // init the block array.
            Blocks = new Block[CacheWidthInBlocks * CacheLenghtInBlocks * Chunk.HeightInBlocks];
        }
Пример #16
0
        /// <summary>
        /// Initializes the statistics service.
        /// </summary>
        public override void Initialize()
        {
            Logger.Trace("init()");

            // import required services.
            this._player = (IPlayer) this.Game.Services.GetService(typeof (IPlayer));
            this._fogger = (IFogger) this.Game.Services.GetService(typeof (IFogger));
            this._world = (IWorld) this.Game.Services.GetService(typeof (IWorld));
            this._chunkStorage = (IChunkStorage) this.Game.Services.GetService(typeof (IChunkStorage));
            this._chunkCache = (IChunkCache) this.Game.Services.GetService(typeof (IChunkCache));

            base.Initialize();
        }
Пример #17
0
 void Put(IChunkCache cache, int i)
 {
     var content = new byte[1024];
     PackUnpack.PackInt32BE(content, 0, i);
     cache.Put(CalcHash(content), ByteBuffer.NewAsync(content));
 }
 public PlanetResourceManager(IChunkCache chunkCache)
 {
     _chunkCache = chunkCache;
 }
Пример #19
0
 public ChunkLoader(IChunkCache cache, int range, Index3 center)
 {
     _center = center;
     _maxRange = range;
     _cache = cache;
 }
Пример #20
0
 public override void Initialize()
 {
     // import required services.
     this._chunkCache = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));
 }
Пример #21
0
 bool Get(IChunkCache cache, int i)
 {
     var content = new byte[1024];
     PackUnpack.PackInt32BE(content, 0, i);
     return cache.Get(CalcHash(content)).Result.Length == 1024;
 }
Пример #22
0
 public override void Initialize()
 {
     // import required services.
     this._chunkCache = (IChunkCache) this.Game.Services.GetService(typeof (IChunkCache));
 }
Пример #23
0
        public override void Initialize()
        {
            Logger.Trace("init()");

            this.FlyingEnabled = true;
            this.Weapon = new Shovel(Game);

            // import required services.
            this._camera = (ICamera) this.Game.Services.GetService(typeof (ICamera));
            this._chunkCache = (IChunkCache) this.Game.Services.GetService(typeof (IChunkCache));
            this._blockStorage = (IBlockStorage) this.Game.Services.GetService(typeof (IBlockStorage));

            this._assetManager = (IAssetManager)this.Game.Services.GetService(typeof(IAssetManager));
            if (this._assetManager == null)
                throw new NullReferenceException("Can not find asset manager component.");

            this.LoadContent();

            this.Weapon.Initialize();
        }
Пример #24
0
 public ChunkLoader(IChunkCache cache, int range, Index3 center)
 {
     _center   = center;
     _maxRange = range;
     _cache    = cache;
 }