Exemple #1
0
 //============================================================
 // <T>保存资源。</T>
 //============================================================
 public void SaveResource()
 {
     _resource.Code    = RInt.Parse(txtCode.Text);
     _resource.AlignCd = REnum.ToValue <ERcPictureAlign>(cboAlignCd.Text);
     _resource.Location.Parse(txtLocation.Text);
     _resource.Padding.Parse(txtPadding.Text);
 }
Exemple #2
0
 //============================================================
 // <T>加载配置信息。</T>
 //
 // @param xconfig 配置节点
 // @param name 名称
 //============================================================
 public void LoadConfig(FXmlNode xconfig, string name)
 {
     if (xconfig.Contains(name + "_font"))
     {
         _font = xconfig.Get(name + "_font");
     }
     if (xconfig.Contains(name + "_color"))
     {
         _color = ColorTranslator.FromHtml(xconfig.Get(name + "_color"));
     }
     if (xconfig.Contains(name + "_size"))
     {
         _size = RInt.Parse(xconfig.Get(name + "_size"));
     }
     if (xconfig.Contains(name + "_bold"))
     {
         _bold = xconfig.GetBoolean(name + "_bold");
     }
     if (xconfig.Contains(name + "_italic"))
     {
         _italic = xconfig.GetBoolean(name + "_italic");
     }
     if (xconfig.Contains(name + "_strikeout"))
     {
         _strikeout = xconfig.GetBoolean(name + "_strikeout");
     }
     if (xconfig.Contains(name + "_underline"))
     {
         _underline = xconfig.GetBoolean(name + "_underline");
     }
 }
Exemple #3
0
        //============================================================
        public void ExportMerge(FDrModel model)
        {
            SIntSize    size   = new SIntSize(_width, _height);
            Form        form   = new Form();
            FDxDevice3D device = RDxCore.Adapter.CreateDevice(form.Handle, size.Width, size.Height);

            device.ModeWireFrame = false;
            // 设置几何体
            FDxRegion region = new FDxRegion();
            // 设置目标
            FDxBufferedTexture texture = new FDxBufferedTexture();

            texture.Device = device;
            texture.Create(size.Width, size.Height);
            device.SetRenderTarget(texture);
            // 渲染几何体
            FDxTechnique technique = RDxCore.TechniqueConsole.Get(device, "light.map");
            int          index     = 0;

            foreach (INamePair <FDrGeometry> pair in model.Mesh.GeometryDictionary)
            {
                FDrLightGeometry geometry = new FDrLightGeometry();
                geometry.Device = device;
                geometry.LoadResource(pair.Value);
                region.Renderables.Clear();
                region.Renderables.Push(geometry);
                // 绘制结果
                technique.Draw(region);
                // 保存内容
                texture.SaveFile(model.Directory + "/" + RInt.Pad(index, 3) + ".png");
                index++;
            }
        }
Exemple #4
0
 //============================================================
 // <T>加载设置节点。</T>
 //
 // @param xconfig 配置节点
 //============================================================
 public void LoadConfig(FXmlNode xconfig)
 {
     // 加载属性
     _name = xconfig.Get("name");
     if (xconfig.Contains("color"))
     {
         _color = Color.FromArgb(RInt.ParseHex(xconfig.Get("color")));
     }
     _font  = xconfig.Get("font", null);
     _size  = xconfig.GetInteger("size", 0);
     _align = xconfig.Get("align", null);
     // 加载效果器集合
     foreach (FXmlNode xnode in xconfig.Nodes)
     {
         if (xnode.IsName("Property"))
         {
             FTplStyleProperty property = new FTplStyleProperty();
             property.LoadConfig(xnode);
             _properties.Push(property);
         }
         else if (xnode.IsName("Filter"))
         {
             string     typeName = xnode.Get("type_name");
             FTplFilter filter   = CreateFilter(typeName);
             filter.LoadConfig(xnode);
             _filters.Push(filter);
         }
     }
 }
        //============================================================
        // <T>扫描资源。</T>
        //============================================================
        public override void Scan()
        {
            base.Scan();
            // 扫描所有文件
            _optionValid = true;
            FStrings fileNames = RDirectory.ListFiles(_directory);

            fileNames.Sort();
            foreach (string fileName in fileNames)
            {
                // 文件是否图片
                string name = fileName.Substring(fileName.LastIndexOf("\\") + 1);
                if (name.EndsWith(".png"))
                {
                    name = name.Substring(0, name.Length - 4);
                    // 是否符合命名标准
                    if (5 == name.Length)
                    {
                        int direction  = RInt.Parse(name.Substring(0, 1));
                        int frameIndex = RInt.Parse(name.Substring(1)) - 1;
                        // 同步剪辑
                        FRsResourceClip  clip  = SyncClip(direction);
                        FRsResourceFrame frame = new FRsResourceFrame();
                        frame.FileName = fileName;
                        clip.PushFrame(frame);
                        // 设置有效
                        _optionValid = true;
                    }
                    else
                    {
                        RMoCore.TrackConsole.Write(this, "Scan", "Invalid picture define. (file_name={0})", fileName);
                    }
                }
            }
            // 检查剪辑帧数相等
            FRsResourceClip firstClip = FristClip;

            if (null != firstClip)
            {
                foreach (FRsResourceClip clip in _clips)
                {
                    if (clip != null)
                    {
                        if (firstClip.FrameCount != clip.FrameCount)
                        {
                            RMoCore.TrackConsole.Write(this, "Scan", "Animation clip frame is differenty. (first_frames={0}, clip_frames={1})",
                                                       firstClip.FrameCount, clip.FrameCount);
                        }
                    }
                }
            }
            string _configName = _directory + "\\config.xml";

            if (RFile.Exists(_configName))
            {
                FXmlDocument xdoc = new FXmlDocument();
                xdoc.LoadFile(_configName);
                LoadConfig(xdoc.Root);
            }
        }
Exemple #6
0
        //============================================================
        // <T>下拉框选择改变事件处理。</T>
        //============================================================
        private void cbxTileCatalog_SelectedIndexChanged(object sender, EventArgs e)
        {
            // 获取组对应编号
            string text      = cbxTileCatalog.Text;
            int    catalogId = RInt.Parse(text.Substring(0, 1));
            // 找到对应组
            FMbMapTileCatalog tileCatalog = RMobileManager.MapTileConsole.FindMapTileCatalog(catalogId);

            // 填充瓦片集合
            imageTileList.Images.Clear();

            int imageIndex = 0;

            // 清空
            lvwTile.BeginUpdate();
            lvwTile.Items.Clear();
            foreach (FMbMapTile mapTile in tileCatalog.MapTiles)
            {
                Bitmap image = mapTile.Resource;
                imageTileList.Images.Add(image);
                InnerBuildTile(mapTile.Id, imageIndex);
                imageIndex++;
            }
            lvwTile.EndUpdate();
        }
Exemple #7
0
        //============================================================
        // <T>解析颜色字符串为数字。</T>
        //
        // @param source 字符串
        // @return 整数
        //============================================================
        public static int ParseHex(string source)
        {
            // 解析内容
            if (RString.IsEmpty(source))
            {
                return(0);
            }
            if (!RInt.IsHex(source))
            {
                return(0);
            }
            string value = source.Trim();

            if (value.Length == 0)
            {
                return(0);
            }
            // 去除前缀
            if (value.StartsWith("#"))
            {
                value = value.Substring(1);
            }
            if (value.StartsWith("0x"))
            {
                value = value.Substring(2);
            }
            // 转换为数字
            int result = Convert.ToInt32(value, 16);

            if (value.Length <= 6)
            {
                result |= 0xFF << 24;
            }
            return(result);
        }
Exemple #8
0
        //============================================================
        // <T>加载文件夹信息,取得地址。</T>
        // <P>加载文件下文件信息,取得文件地址。</P>
        //
        // @param directory 文件路径。
        //============================================================
        public void LoadDirectory(string directory)
        {
            // 加载给定路径下面的文件夹.
            FStrings paths = RDirectory.ListDirectories(directory);
            int      count = paths.Count;

            for (int n = 0; n < count; n++)
            {
                // 检查文件夹
                string path = paths[n];
                if (path.Contains(".svn"))
                {
                    continue;
                }
                // 取得文件夹类型名称。
                string name  = path.Substring(path.LastIndexOf("\\") + 1);
                string id    = name.Substring(0, name.IndexOf('-'));
                string label = name.Substring(name.IndexOf('-') + 1).Trim();
                // 文件夹的全路径地址。
                FDsMap map = new FDsMap();
                map.Resource.Directory = path;
                map.Resource.Tid       = RInt.Parse(id);
                map.Resource.Name      = name;
                map.Resource.Label     = label;
                map.Resource.LoadDirectory();
                _maps.Push(map.Resource);
            }
        }
Exemple #9
0
        //============================================================
        // <T>数据解包。</T>
        //
        // @param pack 打包字符串
        // @return 处理结果
        //============================================================
        public bool Unpack(string pack)
        {
            // 循环开始的截取字符串的起始位置
            int position = 0;

            // 循环开始
            while (position < pack.Length)
            {
                // 读取name和value的值
                int    nameLLength = RInt.Parse(pack.Substring(position, 1));
                int    nameLength  = RInt.Parse(pack.Substring(1 + position, nameLLength));
                string name        = pack.Substring(1 + nameLLength + position, nameLength);
                // 判断下一位是否为空
                if (1 + nameLLength + nameLength + position == pack.Length)
                {
                    throw new Exception("Pack string is invalid.");
                }
                int    valueLLength = RInt.Parse(pack.Substring(1 + position + nameLLength + nameLength, 1));
                int    valueLength  = RInt.Parse(pack.Substring(1 + position + nameLLength + nameLength + 1, valueLLength));
                string value        = pack.Substring(1 + position + nameLLength + nameLength + valueLLength + 1, valueLength);
                // 存入截取的数值
                Set(name, value);
                //从新计算下个循环开始的位置
                position = nameLLength + 1 + nameLength + valueLLength + 1 + valueLength + position;
            }
            return(0 != _count);
        }
Exemple #10
0
 //============================================================
 // <T>加载配置文件。</T>
 //============================================================
 public void LoadConfig(FXmlNode config)
 {
     if (config.Contains("template_id"))
     {
         _templateId = RInt.Parse(config.Get("template_id"));
     }
 }
Exemple #11
0
 //============================================================
 public void Parse(string value)
 {
     string[] items = value.Split(',');
     V1 = RInt.Parse(items[0]);
     V2 = RInt.Parse(items[1]);
     V3 = RInt.Parse(items[2]);
 }
Exemple #12
0
 //============================================================
 // <T>解析字符串。</T>
 //
 // @param value 字符串
 //============================================================
 public void Parse(string value)
 {
     if (null == value)
     {
         X = Y = Z = 0;
     }
     else
     {
         string[] items = value.Split(',');
         if (1 == items.Length)
         {
             X = Y = Z = RInt.Parse(value);
         }
         else if (2 == items.Length)
         {
             X = RInt.Parse(items[0]);
             Y = RInt.Parse(items[1]);
             Z = 0;
         }
         else if (3 == items.Length)
         {
             X = RInt.Parse(items[0]);
             Y = RInt.Parse(items[1]);
             Z = RInt.Parse(items[2]);
         }
         else
         {
             throw new FFatalException("Invalid string.");
         }
     }
 }
Exemple #13
0
    static void Main()
    {
        var  h = Console.ReadLine().Split();
        RInt a = h[0], b = h[1];

        Console.WriteLine(a + b);
    }
 //============================================================
 // <T>存储渲染过程信息。</T>
 //============================================================
 public void SavePass()
 {
     // 存储属性
     _pass.Name = txtName.Text;
     // 存储设置
     _pass.RenderTargetSize.Width  = RInt.Parse(txtRenderTargetWidth.Text);
     _pass.RenderTargetSize.Height = RInt.Parse(txtRenderTargetHeight.Text);
 }
Exemple #15
0
 //============================================================
 // <T>文本变更事件。</T>
 //============================================================
 private void txtCode_TextChanged(object sender, System.EventArgs e)
 {
     _resource.Code = RInt.Parse(txtCode.Text);
     if (PropertyChanged != null)
     {
         PropertyChanged(this, _resource, "code");
     }
 }
Exemple #16
0
 //============================================================
 // <T>字体大小变更事件。</T>
 //============================================================
 private void txtSize_TextChanged(object sender, System.EventArgs e)
 {
     _font.Size = RInt.Parse(txtSize.Text);
     if (PropertyChanged != null)
     {
         PropertyChanged(this, _font, "font.size");
     }
 }
Exemple #17
0
        //============================================================
        // <T>调色板颜色数选中事件。</T>
        //
        // @param sender 事件产生者
        // @param e 数据对象
        //============================================================
        private void rbnPaletteColor_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton button = sender as RadioButton;

            if ((null != button) && (null != button.Tag))
            {
                _resourcePicture.QualityPalette = RInt.Parse(button.Tag.ToString());
            }
        }
Exemple #18
0
 //============================================================
 // <T>保存资源。</T>
 //============================================================
 public void SaveResource()
 {
     _font.FontName  = cboFontName.Text;
     _font.Color     = RColor.ParseHex(txtColor.Text);
     _font.Size      = RInt.Parse(txtSize.Text);
     _font.Bold      = chkBold.Checked;
     _font.Italic    = chkItalic.Checked;
     _font.Underline = chkUnderline.Checked;
     _font.Strikeout = chkStrikeout.Checked;
 }
Exemple #19
0
 //============================================================
 // <T>保存资源。</T>
 //============================================================
 public void SaveResource()
 {
     // 检查参数
     if (_resource == null)
     {
         return;
     }
     // 保存属性
     _resource.Code = RInt.Parse(txtCode.Text);
 }
Exemple #20
0
 //============================================================
 // <T>加载设置节点。</T>
 //
 // @param xconfig 配置节点
 //============================================================
 public override void LoadConfig(FXmlNode xconfig)
 {
     base.LoadConfig(xconfig);
     _color    = Color.FromArgb(RInt.ParseHex(xconfig.Get("color")));
     _alpha    = xconfig.GetFloat("alpha");
     _blurX    = xconfig.GetInteger("blur_x");
     _blurY    = xconfig.GetInteger("blur_y");
     _strength = xconfig.GetInteger("strength");
     _quality  = xconfig.GetInteger("quality");
     _inner    = xconfig.GetBoolean("inner");
     _knockout = xconfig.GetBoolean("knockout");
 }
Exemple #21
0
 public void ReadFooter(FCsvLine line)
 {
     _stopped     = true;
     line._type   = FCsvLineType.Footer;
     _defineCount = RInt.Parse(line.Last);
     if (_readedCount != _defineCount)
     {
         _status = FCsvReadStatus.InvalidCount;
     }
     _footerLines.Push(line);
     _logger.Debug(this, "ReadFooter", "Read footer count={0}/{1}", _readedCount, _defineCount);
 }
Exemple #22
0
 //============================================================
 // <T>根据属性名称,获得整数属性内容。</T>
 //
 // @param name 属性名称
 // @param defaultValue 默认内容
 // @return 属性内容
 //============================================================
 public int GetInteger(string name, int defaultValue)
 {
     if (null != _attributes)
     {
         string value = _attributes.Find(name);
         if (!RString.IsEmpty(value))
         {
             return(RInt.Parse(value));
         }
     }
     return(defaultValue);
 }
Exemple #23
0
        //============================================================
        // <T>递归加载文件信息。</T>
        //
        // @param folders 文件集合
        // @author TYFNG 1203024
        //============================================================
        protected void ScanFolder(FRsResourceFolder parentFolder)
        {
            // 处理所有子文件夹
            FStrings directoryNames = RDirectory.ListDirectories(parentFolder.Directory);

            foreach (string directoryName in directoryNames)
            {
                if (-1 != directoryName.IndexOf(".svn"))
                {
                    continue;
                }
                string fileName = directoryName.Substring(directoryName.LastIndexOf("\\") + 1);
                // 解析动画资源
                if (fileName.StartsWith("RA-"))
                {
                    string name      = fileName.Substring(3);
                    string fullName  = name;
                    string label     = name;
                    int    codeIndex = name.IndexOf("-");
                    if (-1 != codeIndex)
                    {
                        name = name.Substring(0, codeIndex);
                    }
                    name = name.Replace(".", "");
                    // 创建图片资源
                    int code = RInt.Parse(name);
                    FRsResourceAnimation animation = CreateResource(ERsResource.Animation, code) as FRsResourceAnimation;
                    animation.Folder    = parentFolder;
                    animation.Code      = code;
                    animation.Name      = name;
                    animation.Label     = label;
                    animation.FullLabel = parentFolder.FullLabel + "\\" + label;
                    animation.Keyword   = label.Replace(".", "");
                    animation.Directory = directoryName;
                    animation.Scan();
                    parentFolder.Resources.Push(animation);
                }
                else
                {
                    // 创建子文件夹
                    FRsResourceFolder folder = new FRsResourceFolder();
                    folder.Label     = fileName;
                    folder.FullLabel = parentFolder.FullLabel + "\\" + fileName;
                    folder.Directory = directoryName;
                    parentFolder.Folders.Push(folder);
                    // 扫描子文件夹
                    ScanFolder(folder);
                }
            }
            // 扫描文件夹
            parentFolder.Scan();
        }
Exemple #24
0
 //============================================================
 // <T>解析字符串。</T>
 //
 // @param value 字符串
 //============================================================
 public virtual void Parse(string value)
 {
     string[] data = value.Split(',');
     if (2 == data.Length)
     {
         Width  = RInt.Parse(data[0]);
         Height = RInt.Parse(data[1]);
     }
     else
     {
         throw new FFatalException("Invalid size format ({0})", value);
     }
 }
Exemple #25
0
 //============================================================
 // <T>解析字符串。</T>
 //
 // @param value 字符串
 //============================================================
 public bool Parse(string value)
 {
     if (value != null)
     {
         string[] items = value.Split(',');
         if (items.Length == 2)
         {
             X = RInt.Parse(items[0]);
             Y = RInt.Parse(items[1]);
             return(true);
         }
     }
     return(false);
 }
Exemple #26
0
 //============================================================
 // <T>解析字符串。</T>
 //
 // @param value 字符串
 //============================================================
 public virtual bool Parse(string value)
 {
     if (!RString.IsEmpty(value))
     {
         string[] data = value.Split(',');
         if (data.Length == 2)
         {
             Width  = RInt.Parse(data[0]);
             Height = RInt.Parse(data[1]);
             return(true);
         }
     }
     return(false);
 }
Exemple #27
0
 //============================================================
 // <T>解析字符串。</T>
 //
 // @param value 字符串
 //============================================================
 public bool Parse(string value)
 {
     if (null != value)
     {
         string[] items = value.Split(',');
         if (3 == items.Length)
         {
             _color = ColorTranslator.FromHtml(items[0]);
             _width = RInt.Parse(items[1]);
             _style = RUiLineStyle.Parse(items[2]);
         }
     }
     return(false);
 }
Exemple #28
0
 //============================================================
 // <T>加载配置信息。</T>
 //
 // @param xconfig 配置节点
 // @param name 名称
 //============================================================
 public void LoadConfig(FXmlNode xconfig, string name)
 {
     if (xconfig.Contains(name + "_color"))
     {
         _color = ColorTranslator.FromHtml(xconfig.Get(name + "_color"));
     }
     if (xconfig.Contains(name + "_width"))
     {
         _width = RInt.Parse(xconfig.Get(name + "_width"));
     }
     if (xconfig.Contains(name + "_style_cd"))
     {
         _style = RUiLineStyle.Parse(xconfig.Get(name + "_style_cd"));
     }
 }
Exemple #29
0
 //============================================================
 // <T>解析字符串。</T>
 //
 // @param value 字符串
 //============================================================
 public bool Parse(string value)
 {
     if (RString.IsEmpty(value))
     {
         return(false);
     }
     string[] items = value.Split(',');
     if (items.Length == 3)
     {
         _color = RColor.ParseHex(items[0]);
         _width = RInt.Parse(items[1]);
         _style = RUiLineStyle.Parse(items[2]);
     }
     return(false);
 }
 //============================================================
 //<T>保存</T>
 //
 // @author DYWEN 20120602
 //============================================================
 public override void SaveResource(FRsResource resource)
 {
     base.SaveResource(resource);
     if (_checkd == Check.SYSTEM)
     {
         _resourceAnimation.FrameDelay = RInt.Parse(txtFrameDelay.Text);
         //_resourceAnimation.Id = RInt.Parse(txtId.Text);
     }
     if (_showBarycenter)
     {
         _currentClip.ValidBarycenter.X = RInt.Parse(txtbaryCenterX.Text);
         _currentClip.ValidBarycenter.Y = RInt.Parse(txtbaryCenterY.Text);
     }
     if (_showBloodPoint)
     {
         _currentClip.Blood.X = RInt.Parse(BloodX.Text);
         _currentClip.Blood.Y = RInt.Parse(BloodY.Text);
     }
     if (_showRidePoint)
     {
         _currentClip.RidePoint.X = RInt.Parse(txtRidePointX.Text);
         _currentClip.RidePoint.Y = RInt.Parse(txtRidePointY.Text);
     }
     //if (_showWingPoint) {
     //   _currentClip.WingPoint.X = RInt.Parse(txtWingPointX.Text);
     //   _currentClip.WingPoint.Y = RInt.Parse(txtWingPointY.Text);
     //}
     if (ranPalettePixel1.Checked)
     {
         _resourceAnimation.QualityCd = ERsResourceQuality.Min;
     }
     if (ranPalettePixel2.Checked)
     {
         _resourceAnimation.QualityCd = ERsResourceQuality.Lower;
     }
     if (ranPalettePixel3.Checked)
     {
         _resourceAnimation.QualityCd = ERsResourceQuality.Middle;
     }
     if (ranPalettePixel4.Checked)
     {
         _resourceAnimation.QualityCd = ERsResourceQuality.High;
     }
     if (ranPalettePixel5.Checked)
     {
         _resourceAnimation.QualityCd = ERsResourceQuality.Max;
     }
 }