Ejemplo n.º 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);
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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];
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 11
0
 public PlanetResourceManager(IChunkCache chunkCache)
 {
     _chunkCache = chunkCache;
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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];
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 19
0
 public ChunkLoader(IChunkCache cache, int range, Index3 center)
 {
     _center = center;
     _maxRange = range;
     _cache = cache;
 }
Ejemplo n.º 20
0
 public override void Initialize()
 {
     // import required services.
     this._chunkCache = (IChunkCache)this.Game.Services.GetService(typeof(IChunkCache));
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 22
0
 public override void Initialize()
 {
     // import required services.
     this._chunkCache = (IChunkCache) this.Game.Services.GetService(typeof (IChunkCache));
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 24
0
 public ChunkLoader(IChunkCache cache, int range, Index3 center)
 {
     _center   = center;
     _maxRange = range;
     _cache    = cache;
 }