//============================================================ // <T>绘制出生点。</T> //============================================================ public void DrawBirths() { FObjects <FMbMapBirth> births = _map.Births; if (!births.IsEmpty()) { int count = births.Count; for (int n = 0; n < count; n++) { FMbMapBirth birth = births[n]; SIntPoint2 location = birth.Location; // 获取敌机集合 FObjects <FMbMapBirthEnemy> enemys = birth.BirthEnemys; int enemyCount = enemys.Count; for (int x = 0; x < enemyCount; x++) { FMbMapBirthEnemy birthEnemy = enemys[x]; int templateId = birthEnemy.TemplateId; FMbTplEnemy enemy = RMobileManager.TemplateConsole.EnemyConsole.FingById(templateId); int resourceRid = enemy.ResourceRid; // 获取资源图片 FRsResourcePicture resource = RContent2dManager.ResourceConsole.FindOpen(resourceRid) as FRsResourcePicture; Bitmap resourceMap = resource.Bitmap.Native; // 创建绘制对象 FDxBitmap bitmap = null; if (!_dxBitmapSet.Contains(resourceRid.ToString())) { bitmap = _context.Device.CreateBitmap(resourceMap); _dxBitmapSet.Set(resourceRid.ToString(), bitmap); } else { bitmap = _dxBitmapSet.Get(resourceRid.ToString()); } _context.DrawBitmap(bitmap, location.X - _location.X, location.Y - _location.Y); } } } }
//============================================================ // <T>绘制资源。</T> // // @param resource 资源 // @param rectangle 范围 //============================================================ public void DrawResource(FUiPicture resource, SIntRectangle rectangle) { if (resource.HasBitmap()) { // 获得坐标 float scale = _context.Scale; int x = resource.Location.X; int y = resource.Location.Y; // 绘制资源 FDxContext2d context = _context.Context; if (resource.AlignCd == ERcPictureAlign.Square) { context.DrawBitmapPadding(resource.bitmap, rectangle, x, y, ControlResource.Size.Width, ControlResource.Size.Height, resource.Padding, scale); } else { SIntSize2 size = resource.bitmap.Size; context.DrawBitmap(resource.bitmap, rectangle, x, y, size.Width, size.Height, scale); } } }
//============================================================ // <T>绘制处理。</T> // // @param sender 发送者 // @param e:event 事件 //============================================================ public void DrawPreviewLayers() { if (!_designLayers) { return; } FUiControlLayers layers = _designFrame.PreviewLayers; if (!layers.IsEmpty()) { float scale = _context.Scale; FDxContext2d context = _context.Context; SIntPoint2 position = _designFrame.CalculateDisplayPosition(); int count = layers.Count; for (int n = count - 1; n >= 0; n--) { FUiControlLayer layer = layers[n]; if (layer.OptionVisible) { context.DrawBitmap(layer.Bitmap, position.X, position.Y, (int)(layer.Size.Width * scale), (int)(layer.Size.Height * scale), 1.0f); } } } }