碧血红天的HomePage

导出配置表管理工具

没事干编写了一个把Excl配置表导出为proto的工具。

首先,我们需要把Excl数据转换成proto能够识别的数据格式。一般把数据的结构生成.proto文件,格式如下:

// 
// @file:  alliance_shop.proto
// 

syntax = "proto3"; 
option java_package = "com.rg.slg"; 

message alliance_shop{
	// int
	int32 itemId = 1;
	// int
	int32 showType = 2;
	// int
	int32 batchBuy = 3;
	// int
	int32 batchAdd = 4;
	// int
	int32 buyPrice = 5;
	// int
	int32 addPrice = 6;
	// int
	int32 maxStore = 7;
}

message alliance_shop_Array{
	repeated alliance_shop items = 1;
}

然后把数据内容生成一个.txt文件:

items {
	itemId:250002001
	showType:4
	batchBuy:1
	batchAdd:1
	buyPrice:120000
	addPrice:40000
	maxStore:99
}
items {
	itemId:200004224
	showType:4
	batchBuy:1
	batchAdd:1
	buyPrice:150000
	addPrice:50000
	maxStore:99
}
items {
	itemId:420001144
	showType:4
	batchBuy:1
	batchAdd:1
	buyPrice:100000
	addPrice:30000
	maxStore:99
}

然后可以通过protobuff提供的protoc.exe工具生成对应的pb和data文件。

excl编写的表头如下:

前3行是固定顺序和意义。verify开始的行是验证规则标记行,现在验证的规则有:

notnull: 内容项不能为空,无参数。  
unique:内容项必须唯一,无参数。  
ref:关联的其它Sheet的某个列的值,参数第一个是sheet名字,第二个是数据列的名字。  
refex:关联的其它文件的heet的某个列的值,参数第一个是文件名字带后缀,参数第二个是sheet名字,第三个是数据列的名字。  
refOr0:关联的其它Sheet的某个列的值,但是允许是0,参数第一个是sheet名字,第二个是数据列的名字。  
range:内容值得范围限定,第一个参数是下限,第二个参数是上限。  
res:关联项目中得资源是否存在,需要全局配置中配置三工程路径。此数据需要是Assets/打头得内容。  
fmt:数据得格式检测,参数1为正则表达式的值,比如^\\d+;\\d+;\\d+$。配置一个34;22;1这样的数据结构。  

可以直接公共ExportProto.exe工具进行数据导出为pb,data和移动导出文件目录。导出可以使用Sheet为一个文件导出或者一个属性列为一个文件的导出。它可带的参数如:

现在附上一个管理工具,避免策划人员去操作批处理:

可以根据选中的Excl进行全表导出和是否进行验证。右键点击按钮,可以编辑按钮的cmd命令,只能执行一个命令。

工程源码:

整合的工具:

需要自行修改里面的配置

11 评论

  1. certainly like your web site but you need to check the spelling on several of your posts. Several of them are rife with spelling issues and I in finding it very bothersome to tell the truth however I will definitely come back again.

  2. Contact us ; Help yourself. Visit our Learn & Support area for how-to’s and helpful resources. ; We’re here 24/7 to answer your QuickBooks questions.
    Visit Here :- https://contactquickbook.com/

  3. Thank you for the sensible critique. Me and my neighbor were just preparing to do some research on this. We got a grab a book from our local library but I think I learned more clear from this post. I am very glad to see such magnificent info being shared freely out there.

  4. Those are yours alright! . We at least need to get these people stealing images to start blogging! They probably just did a image search and grabbed them. They look good though!

  5. I went over this website and I believe you have a lot of fantastic info, saved to favorites (:.

  6. excellent points altogether, you simply gained a new reader. What would you suggest about your post that you made a few days ago? Any positive?

  7. Christmas Caribbean beach Check out the Christmas decorations at Disney’s Caribbean Beach Resort & Disney’s Riviera Resort! CARIBBEAN CHRISTMAS 4 NIGHT BAHAMAS & PERFECT DAY voyage.
    Christmas Caribbean beach

  8. Hello! I’m at work browsing your blog from my new iphone! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the great work!

  9. Attractive section of content. I just stumbled upon your site and in accession capital to assert that I acquire actually enjoyed account your blog posts. Anyway I’ll be subscribing to your augment and even I achievement you access consistently rapidly.

  10. I was looking through some of your blog posts on this site and I conceive this site is real instructive! Continue posting.

发表评论