Skip to content

Commit

Permalink
补文档
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Mar 22, 2018
1 parent 55f4421 commit 9138315
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/sample/xresconv_conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<include desc="可以包含其他文件配置,然后本文件里的配置将会覆盖或合并配置,相对于当前xml的目录">sample.xml</include>
<global>
<work_dir desc="工作目录,相对于当前xml的目录">../xresloader/sample</work_dir>
<xresloader_path desc="xresloader地址,相对于当前xml的目录">../target/xresloader-1.4.1.jar</xresloader_path>
<xresloader_path desc="xresloader地址,相对于当前xml的目录">../target/xresloader-1.4.2.jar</xresloader_path>

<proto desc="协议类型,对应xresloader的-p选项">protobuf</proto>
<output_type desc="输出类型,对应xresloader的-t选项">json</output_type>
<proto_file desc="协议描述文件,对应xresloader的-f选项">proto_v3/kind.pb</proto_file>

<output_dir desc="输出目录,对应xresloader的-o选项"></output_dir>
<data_src_dir desc="数据源(Excel查找)目录,对应xresloader的-d选项"></data_src_dir>
<data_version desc="数据版本号,对应xresloader的留空则自动生成">1.0.0.0</data_version>
<data_version desc="数据版本号,对应xresloader的--data-version选项,留空则自动生成">1.0.0.0</data_version>

<rename desc="重命名规则,正则表达式:/搜索模式/替换内容/,对应xresloader的-n选项">/(?i)\.bin$/\.json/</rename>

Expand Down
33 changes: 32 additions & 1 deletion source/users/advance_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,38 @@

上面这个表,如果 ``消耗值`` 这一列出现了[0, 1000]和[2000-3000]以外的值,转表工具会转表不通过并予以提示。

还有一个特殊的用法是,比如我们有技能要对单位的属性加成。
还有一个特殊的用法是,比如我们有技能要对单位的属性加成。然后我们定义单位属性的proto如下:

.. code-block:: proto
message unit_attribute {
int32 hp = 1;
int32 mp = 2;
int32 power = 3;
}
message skill_effect {
int32 id = 1;
int32 level = 2;
int32 func_type = 3;
int32 attr_type = 4;
int32 value = 5;
}
然后我们可以定义技能功能表如下:

+-----------+---------+-------------+--------------------------+-----------+
| 技能ID | 等级 | 功能类别 | 属性 ||
+===========+=========+=============+==========================+===========+
| id | level | func_type | attr_type@unit_attribute | value |
+-----------+---------+-------------+--------------------------+-----------+
| 20001 | 1 | | hp | 100 |
+-----------+---------+-------------+--------------------------+-----------+
| 20001 | 2 | 1001 | hp | 200 |
+-----------+---------+-------------+--------------------------+-----------+

使用 ``skill_effect`` 转出如上的表, ``属性`` 这个字段的验证器设为了 ``unit_attribute`` ,``attr_type`` 的类型是int32。
这时在转出数据的时候,转出的数据是 ``unit_attribute.hp`` 的字段编号 ``1`` 。

只导出部分字段
---------------------------------------------
Expand Down
47 changes: 46 additions & 1 deletion source/users/xresconv.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
批量转表工具
=============================================

在实际项目中,我们一般会同时涉及几十甚至上百张表。
.. _xresloader: https://github.com/xresloader/xresloader
.. _xresconv-cli: https://github.com/xresloader/xresconv-cli
.. _xresconv-gui: https://github.com/xresloader/xresconv-gui
.. _xresconv-conf: https://github.com/xresloader/xresconv-conf

在实际项目中,我们一般会同时涉及几十甚至上百张表。为了统一配置,我们提供了批量转表工具。
批量转表分为 `命令行批量转表工具-xresconv-cli <xresconv-cli>`_ 和 `GUI批量转表工具-xresconv-gui <xresconv-gui>`_ 两个工具。

前者用于服务器和客户端发布流程的集成,后者主要提供给临时转表和策划验证数据时可以拿来转出部分数据。
这两个工具都以 `批量转表配置模板仓库-xresconv-conf <xresconv-conf>`_ 种的配置为配置规范。具体的配置说明如下:

.. literalinclude:: ../sample/xresconv_conf.xml
:language: xml
:encoding: utf-8

如上时所有支持的标签的说明及示例配置。

除了前面章节提及过的字段外,还有一些特别的配置。

+ ``//root/include`` : 包含其他配置文件。相当于把其他配置文件离得配置复制过来。然后这个文件里有重复得配置则覆盖之。
+ ``//root/global/work_dir`` : 运行 `xresloader`_ 的目录。如果是相对目录的话相对于xml配置文件。
+ ``//root/global/xresloader_path`` : `xresloader`_ 的jar包的路径。如果是相对目录的话相对于xml配置文件。
+ ``//root/global/java_option`` : 用于传给java命令。所有的条目都会附加到java选项种。比如示例种的 ``-Xmx2048m`` 用于设置最大堆为2GB,用于对于比较大的Excel导表的时候可能会临时占用较高内存。
+ ``//root/global/default_scheme`` : 默认的导表映射关系的配置(详见 :doc:`./data_mapping` )。对所有转换条目都会附加这里面的配置项。
+ ``//root/list/item/scheme`` : 导表映射关系的配置(详见 :doc:`./data_mapping` )。如果和上面 ``default_scheme`` 冲突则会覆盖默认配置,仅对这个条目生效。


其他得配置看内容应该比较容易理解,唯一有个仅用于 `GUI工具 <xresconv-gui>`_ 的配置: ``//root/gui/set_name`` 需要特别说明一下。
这是里面必须是一个有效的javascript函数,参数是

.. code-block:: javascript
item_data: {
id: ID,
file: 文件名,
scheme: 涉及的scheme表名称,
name: 该条目名称,
cat: 该条目的分类,
options: [ 选项列表 ],
desc: 描述信息,
scheme_data: { 转换规则数据 }
}
这个结构。在 `GUI工具 <xresconv-gui>`_ 显示每个条目的时候会运行这个函数并传入上述结构,在函数离我们可以通过改变 ``name`` 和 ``desc`` 来改变 `GUI工具 <xresconv-gui>`_ 工具的显示内容。

比如我们有个项目所有的表都有个统一前缀,我们就可以在该函数移除掉这个前缀。

0 comments on commit 9138315

Please sign in to comment.