//============================================================ // <T>存储配置信息。</T> // // @param xconfig 配置信息 //============================================================ public void SaveConfig(FXmlNode xconfig) { xconfig.Set("name", _name); // 读取过程集合 if (!_passes.IsEmpty()) { foreach (FDrScenePass pass in _passes) { pass.SaveConfig(xconfig.CreateNode("Pass")); } } }
//============================================================ // <T>绘制层。</T> //============================================================ public void DrawLayers() { FObjects <FMbMapLayer> layers = _map.Layers; if (!layers.IsEmpty()) { int count = layers.Count; for (int n = 0; n < count; n++) { FMbMapLayer layer = layers[n]; if (layer.OptionValid) { _cellSize = layer.CellSize; _cellCount = layer.CellCount; FObjects <FMbMapCell> cells = layer.MapCell; int cellCount = cells.Count; for (int x = 0; x < cellCount; x++) { FMbMapCell cell = cells[x]; int resourceId = cell.ResourceId; if (0 == resourceId) { continue; } SIntPoint2 cellIndex = cell.Index; FMbMapTile mapTile = RMobileManager.MapTileConsole.FindMapTile(resourceId); if (null != mapTile) { DrawMapTile(mapTile, cellIndex); } } } // 绘制方格 DrawLine(); } } }
//============================================================ // <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 xconfig 配置信息 //============================================================ public void SaveConfig(FXmlNode xconfig) { // 材质属性 xconfig.Set("source", _source); _matrix.Parse(); if (_matrix.IsChanged) { _matrix.SaveSingleConfig(xconfig.CreateNode("Matrix")); } // 存储动画集合 if (!_movies.IsEmpty()) { FXmlNode xmovies = xconfig.CreateNode("Movies"); foreach (FDrSceneMovie movie in _movies) { movie.SaveConfig(xmovies.CreateNode("Movie")); } } // 存储材质集合 if (!_materials.IsEmpty()) { FXmlNode xmaterials = xconfig.CreateNode("Materials"); foreach (FDrSceneMaterial material in _materials) { material.SaveConfig(xmaterials.CreateNode("Material")); } } // 存储渲染集合 if (!_renderables.IsEmpty()) { FXmlNode xrenderables = xconfig.CreateNode("Renderables"); foreach (FDrSceneRenderable renderable in _renderables) { renderable.SaveConfig(xrenderables.CreateNode("Renderable")); } } }
//============================================================ // <T>判断是否含有子目录。</T> // // @return 是否含有 //============================================================ public bool HasFolder() { return((null != _folders) ? !_folders.IsEmpty() : false); }
//============================================================ // <T>判断是否含有子对象。</T> // // @return 是否含有 //============================================================ public bool HasObject() { return((_objects != null) ? !_objects.IsEmpty() : false); }