public Area(DS1File level, List <DT1Texture> tiles) { this.level = level; this.tiles = tiles; }
protected override void LoadContent() { Diablo2ReaderFactory.Context = System.Threading.SynchronizationContext.Current; // The CefBrowser must be created on the UI thread //browser = ToDisposeContent(new SharpDXCefBrowser(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height)); loadingScreen = Content.Load <Texture2D>(@"data\global\ui\loading\loadingscreen.dc6"); loadingEffect = Content.Load <Effect>("LoadingEffect"); // Instantiate a SpriteBatch spriteBatch = ToDisposeContent(new SpriteBatch(GraphicsDevice)); // Loads the balls texture (32 textures (32x32) stored vertically => 32 x 1024 ). // The [Balls.dds] file is defined with the build action [ToolkitTexture] in the project ballsTexture = Content.Load <Texture2D>("Balls"); // Loads a sprite font // The [Arial16.xml] file is defined with the build action [ToolkitFont] in the project arial16Font = Content.Load <SpriteFont>("Arial16"); billboard = ToDisposeContent(GeometricPrimitive.Plane.New(GraphicsDevice, billboardWidth, billboardHeight)); // 1.8 * 30 plane = ToDisposeContent(GeometricPrimitive.Plane.New(GraphicsDevice, 5, 5)); player = ToDisposeContent(GeometricPrimitive.Cylinder.New(GraphicsDevice, 3, 1, 32, true)); basicEffect = ToDisposeContent(new BasicEffect(GraphicsDevice) { View = Matrix.LookAtLH(cameraPosition + cameraOffset, cameraPosition, Vector3.UnitZ), World = Matrix.Identity }); CalculateResize(); texture = Content.Load <Texture2D>("GeneticaMortarlessBlocks"); floorEffect = Content.Load <Effect>("FloorEffect"); basicEffect.Texture = texture; basicEffect.TextureEnabled = true; quadEffect = Content.Load <Effect>("QuadEffect"); Task.Run(() => { level = Content.Load <DS1File>(@"data\global\tiles\act1\town\townn1.ds1"); cameraPosition = new Vector3(level.Width / 2 * 5, level.Height / 2 * 5, 0); loadingProgress++; foreach (var file in level.files) { //try //{ tiles.Add(Content.Load <DT1Texture>(file.Substring(4).Replace(".tg1", ".dt1"))); //} //catch (Exception ex) //{ // tiles.Add(new DT1Texture()); //Texture2D.New(GraphicsDevice, Image.New(new ImageDescription() { ArraySize = 1, Width = 128, Height = 128, Depth = 1, Format = SharpDX.DXGI.Format.B8G8R8A8_UNorm, Dimension = TextureDimension.Texture2D }))); //} loadingProgress++; } tristram = new Area(level, tiles); loadingProgress++; loading = false; }); base.LoadContent(); }