Skip to content

Commit 46c794f

Browse files
committed
修复: 结构体单元格中使用切分导致数据导出问题
1 parent 19504a9 commit 46c794f

14 files changed

+30
-20
lines changed

README.md

-6
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,6 @@ https://github.com/davyxu/tabtoy/blob/master/exportorv2/sample
122122

123123
https://github.com/davyxu/tabtoy/blob/master/doc/Manual_V2.md
124124

125-
# 旧版第五代导出器文档(tabtoy v1)
126-
127-
已停止开发
128-
129-
https://github.com/davyxu/tabtoy/blob/master/doc/Manual_V1.md
130-
131125

132126
# 备注
133127

doc/Manual_V2.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104

105105
注意: 整形数值类在电子表格中的分隔符推荐使用分号";" 切忌使用逗号"," 因逗号为电子表格默认的大数分割符
106106

107+
不能使用值切割对结构体字段进行操作,多个结构体请标记repeated类型并放置在多个单元格
108+
107109
* 默认值
108110

109111
格式: Default: "YourDefaultValue"
@@ -185,39 +187,39 @@
185187

186188
此行不解析, 但请保留, 并以中文编写注释, 方便查看
187189

188-
### 对象类型 列
190+
### 对象类型(ObjectType)
189191

190192
* 以_或英文开头的标示符,不能包含中文
191193

192194
* 对象类型可以是枚举或结构体, 通过是否有枚举值自动区分
193195

194-
### 字段名 列
196+
### 字段名(FieldName)
195197

196198
* 以_或英文开头的标示符,不能包含中文
197199

198200
* 字段名归属对象类型
199201

200-
### 字段类型 列
202+
### 字段类型(FieldType)
201203

202204
* 参考 数据表单(DataSheet)的类型
203205

204206
* 结构体字段不能再次包含结构体, 但可以是枚举
205207

206208
* 枚举字段类型必须是int32
207209

208-
### 枚举值 列
210+
### 枚举值(Value)
209211

210212
* 此处填写时, 表示对象类型为枚举
211213

212214
* 枚举首值必须为0
213215

214216
* 枚举值不能重复
215217

216-
### 注释 列
218+
### 注释(Comment)
217219

218220
* 注释将出现在代码生成的代码注释中
219221

220-
### 特性 列
222+
### 特性(Meta)
221223

222224
* pbt文本描述, 参考 数据表单(DataSheet)的字段特性
223225

exportorv2/i18n/en_us.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func init() {
2222
File_TypeSheetKeepSingleton: "File: Type sheet only need ONE in a file",
2323
DataSheet_ValueConvertError: "DataSheet: Cell value convert error",
2424
DataSheet_ValueRepeated: "DataSheet: Duplicated cell value",
25+
DataHeader_StructCellCannotSplit: "DataHeader: Struct cell can not have 'ListSpliter', make struct element in multi-cell",
2526
DataHeader_TypeNotFound: "DataHeader: Type not found",
2627
DataHeader_MetaParseFailed: "DataHeader: Meta parse failed",
2728
DataHeader_DuplicateFieldName: "DataHeader: Duplicated field name",

exportorv2/i18n/i18n.go

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const (
2626
File_TypeSheetKeepSingleton
2727
DataSheet_ValueConvertError
2828
DataSheet_ValueRepeated
29+
DataHeader_StructCellCannotSplit
2930
DataHeader_TypeNotFound
3031
DataHeader_MetaParseFailed
3132
DataHeader_DuplicateFieldName

exportorv2/i18n/zh_cn.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func init() {
2222
File_TypeSheetKeepSingleton: "文件: 类型表在一个表中只能有一份",
2323
DataSheet_ValueConvertError: "数据表: 单元格转换错误",
2424
DataSheet_ValueRepeated: "数据表: 单元格值重复",
25+
DataHeader_StructCellCannotSplit: "数据头: 结构体单元格不能进行切分操作,请将多个结构体元素放在多个单元格实现",
2526
DataHeader_TypeNotFound: "数据头: 未知类型",
2627
DataHeader_MetaParseFailed: "数据头: 特性解析错误",
2728
DataHeader_DuplicateFieldName: "数据头: 重复的字段名",

exportorv2/sample/Config.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated by github.com/davyxu/tabtoy
2-
// Version: 2.3.1
2+
// Version: 2.3.2
33
// DO NOT EDIT!!
44
using System.Collections.Generic;
55
using System.IO;

exportorv2/sample/Config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated by github.com/davyxu/tabtoy
2-
// Version: 2.3.1
2+
// Version: 2.3.2
33
// DO NOT EDIT!!
44
package table
55

exportorv2/sample/Config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Tool": "github.com/davyxu/tabtoy",
3-
"Version": "2.3.1",
3+
"Version": "2.3.2",
44
"Sample":[
55
{ "ID": 100, "Name": "黑猫警长", "NumericalRate": 0.6, "ItemID": 100, "Type": 0, "SkillID":[ 4, 6, 7 ], "SingleStruct": { "HP": 100, "AttackRate": 1.2 }, "StrStruct":[ { "HP": 3, "ExType": 21 }, { "AttackRate": 3.5 } ] },
66
{ "ID": 101, "Name": "葫芦\n", "NumericalRate": 0.8, "ItemID": 100, "BuffID":[ 3, 1 ], "Type": 21, "SkillID":[ 1 ] },

exportorv2/sample/Config.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Generated by github.com/davyxu/tabtoy
2-
-- Version: 2.3.1
2+
-- Version: 2.3.2
33

44
local tab = {
55
Sample = {

exportorv2/sample/Config.pbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Generated by github.com/davyxu/tabtoy
2-
# Version: 2.3.1
2+
# Version: 2.3.2
33
Sample: [
44
{ID: 100, Name: "黑猫警长", NumericalRate: 0.6, ItemID: 100, Type: Fighter, SkillID:[ 4, 6, 7 ], SingleStruct: { HP: 100, AttackRate: 1.2 }, StrStruct:[ { HP: 3, ExType: Power }, { AttackRate: 3.5 } ] },
55
{ID: 101, Name: "葫芦\n", NumericalRate: 0.8, ItemID: 100, BuffID:[ 3, 1 ], Type: Power, SkillID:[ 1 ] },

exportorv2/sample/Config.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated by github.com/davyxu/tabtoy
2-
// Version: 2.3.1
2+
// Version: 2.3.2
33
// DO NOT EDIT!!
44

55
syntax = "proto3";

exportorv2/sample/table/tableindex.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Generated by github.com/davyxu/tabtoy
2-
// Version: 2.3.1
2+
// Version: 2.3.2
33
// DO NOT EDIT!!
44
package table
55

exportorv2/sheet_dataheader.go

+11
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ func (self *DataHeader) ParseProtoField(index int, sheet *Sheet, localFD *model.
152152
def = exist
153153

154154
} else {
155+
156+
// 普通表头合法性检查
157+
158+
// 结构体单元格不能进行切分
159+
if def.Type == model.FieldType_Struct && def.ListSpliter() != "" {
160+
sheet.Row = DataSheetRow_FieldMeta
161+
log.Errorf("%s '%s'", i18n.String(i18n.DataHeader_StructCellCannotSplit),
162+
def.Name)
163+
goto ErrorStop
164+
}
165+
155166
self.HeaderByName[def.Name] = def
156167
self.headerFields = append(self.headerFields, def)
157168
}

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var paramProtoVersion = flag.Int("protover", 3, "output .proto file version, 2 o
3434
var paramLanguage = flag.String("lan", "en_us", "set output language")
3535
var paramGoImportPackage = flag.String("goimportpkg", "gamedef", "golang import package path")
3636

37-
const Version = "2.3.1"
37+
const Version = "2.3.2"
3838

3939
func main() {
4040

0 commit comments

Comments
 (0)