Skip to content

Commit 79b5f73

Browse files
committed
feat(editor): publish: check feature range
1 parent 320920f commit 79b5f73

3 files changed

Lines changed: 74 additions & 9 deletions

File tree

contributes/meta3d-action-mod-career-publish-to-game/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "meta3d-action-mod-career-publish-to-game",
3-
"version": "1.3.58",
3+
"version": "1.3.60",
44
"publisher": "meta3d",
55
"protocol": {
66
"name": "meta3d-action-mod-career-publish-to-game-protocol"

contributes/meta3d-action-mod-career-publish-to-game/src/Main.ts

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,54 @@ let _buildIconId = (state: state, isChinese) => {
158158
return `${_buildUniqueName(state, isChinese)}_icon`
159159
}
160160

161+
let _unifyCareerFeatureValueToArray = (value) => {
162+
if (Array.isArray(value)) {
163+
return value
164+
}
165+
166+
return [value]
167+
}
168+
169+
let _range = (a, b) => {
170+
let res = []
171+
for (let i = a; i <= b; i++) {
172+
res.push(i)
173+
}
174+
175+
return res
176+
}
177+
178+
let _isFeaturesInRange = (api: api, features) => {
179+
return features.reduce((result, { values, minValue, maxValue }) => {
180+
if (!result) {
181+
return result
182+
}
183+
184+
let valueCount = values.count()
185+
186+
minValue = api.nullable.getWithDefault(
187+
api.nullable.map(_unifyCareerFeatureValueToArray, minValue),
188+
_range(0, valueCount - 1).map(_ => -Infinity)
189+
)
190+
maxValue = api.nullable.getWithDefault(
191+
api.nullable.map(_unifyCareerFeatureValueToArray, maxValue),
192+
_range(0, valueCount - 1).map(_ => Infinity)
193+
)
194+
195+
return values.reduce((result, value, i) => {
196+
if (!result) {
197+
return result
198+
}
199+
200+
return value >= minValue[i] && value <= maxValue[i]
201+
}, result)
202+
}, true)
203+
}
204+
161205
let _check = (api: api, state: state, isChinese, features) => {
162206
let {
163207
displayName_cn,
164208
displayName_en,
165-
// repoLink,
166-
author,
167209
readme,
168210
} = state
169211

@@ -184,6 +226,9 @@ let _check = (api: api, state: state, isChinese, features) => {
184226
else if (features.count() <= 0) {
185227
message = api.nullable.return(isChinese ? "请选择职业特性" : "Please select the career features")
186228
}
229+
else if (!_isFeaturesInRange(api, features)) {
230+
message = api.nullable.return(isChinese ? "职业特性值超出范围" : "Career feature's value exceed the specified range")
231+
}
187232

188233
return api.nullable.getWithDefault(
189234
api.nullable.map((message) => {

doc/1.3.1.org

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,27 @@ TODO need gem should limit
12221222
TODO whole->jump miss username
12231223

12241224

1225+
* DONE update
1226+
1227+
TODO check value range when publish
1228+
1229+
1230+
1231+
# 第一个问题:
1232+
# 在电脑端创建职业模组时,可编辑数值的职业预设特性在进行手动输入时,最终值会默认在后面增加两个0(例如设定值为100,最终值会变为10000)。并且会导致模组无法发布
1233+
1234+
1235+
1236+
TODO update cn
1237+
TODO update en
1238+
1239+
1240+
1241+
1242+
1243+
1244+
1245+
12251246
* TODO update
12261247

12271248

@@ -1238,13 +1259,12 @@ TODO publish in package assemble: name, description should can be empty
12381259

12391260

12401261

1241-
第一个问题:
1242-
在电脑端创建职业模组时,可编辑数值的职业预设特性在进行手动输入时,最终值会默认在后面增加两个0(例如设定值为100,最终值会变为10000)。并且会导致模组无法发布
1243-
1244-
1262+
还有,在发布模组时,总是出现这个:
1263+
发布失败
12451264

1265+
TODO add handleNetwork api
1266+
retry 3 times
12461267

1268+
rewrite error message
12471269

12481270

1249-
还有,在发布模组时,总是出现这个:
1250-
发布失败

0 commit comments

Comments
 (0)