/// <summary> /// Loads the 3D rendering engine into memory and initializes it. /// </summary> private void LoadEngine() { this.waitDialog = new EngineLoadingDialog(this.ControlHost); this.waitDialog.Size = new Size(500, 200); this.waitDialog.Location = new Point(100, 100); this.waitDialog.BackgroundImage = new DXImage(this.ControlHost.Device, @"images\dialog.jpg"); this.ChildDialog = this.waitDialog; this.waitDialog.Show(); this.percentLoadedScaleFactor = .25F; Grid grid = ClientApplication.Instance.ServerInstance.Grid; this.percentLoadedScaleFactor = 1.0F; this.engine = new GameEngine(this.ControlHost.Device, grid); this.engine.StatusChanged += new EventHandler <StatusChangedEventArgs>(this.StatusChanged); this.engine.InitializeEngine(ClientApplication.Instance.Tileset); this.waitDialog.Close(); this.ChildDialog = null; }
private void StatusChanged(object sender, StatusChangedEventArgs e) { int percent = 0; if (this.waitDialog == null) { this.waitDialog = new EngineLoadingDialog(this.ControlHost); this.waitDialog.Show(); } if (this.percentLoadedScaleFactor < 1.0f) { percent = Convert.ToInt32(e.PercentDone * this.percentLoadedScaleFactor); } else { percent = 25 + ((75 * e.PercentDone) / 100); } this.waitDialog.UpdatePercent(percent, e.Message); }