Skip to content

Commit d122d3d

Browse files
committed
feat(editor): update publish: close publish modal after publish; show publish... info;
1 parent 1ed8a8c commit d122d3d

83 files changed

Lines changed: 138 additions & 61 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

contributes/meta3d-action-mod-career-add-careerfeature/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-add-careerfeature",
3-
"version": "1.3.17",
3+
"version": "1.3.18",
44
"publisher": "meta3d",
55
"protocol": {
66
"name": "meta3d-action-mod-career-add-careerfeature-protocol"

contributes/meta3d-action-mod-career-add-careerfeature/src/Main.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,8 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
6565
info: api.nullable.return("加载中...")
6666
})
6767

68-
setTimeout(() => {
69-
let meta3dState = api.readState()
70-
71-
_buildAllDefaultCareerFeatures(api).then(data => {
68+
api.flow.deferExec((meta3dState) => {
69+
return _buildAllDefaultCareerFeatures(api).then(data => {
7270
let allDefaultCareerFeatures = api.immutable.createListOfData(data)
7371

7472
return api.action.setActionState(meta3dState, actionName, {
@@ -82,8 +80,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
8280
info: api.nullable.getEmpty()
8381
})
8482
})
85-
.then(api.writeState)
86-
}, 0)
83+
})
8784

8885
let eventSourcingService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState)
8986

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.38",
3+
"version": "1.3.46",
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: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { actionName as addCareerFeatureActionName, characterType, state as addCa
88
import { actionName as selectCharacterTypeActionName, state as selectCharacterTypeState } from "meta3d-action-mod-career-selectcharactertype-protocol"
99
import { actionName as loadModPreviewActionName, state as loadModPreviewState } from "meta3d-action-mod-career-load-modpreview-protocol"
1010
import { actionName as loadCareerPreviewActionName, state as loadCareerPreviewState } from "meta3d-action-mod-career-load-careerpreview-protocol"
11+
import { actionName as infoActionName, state as infoState } from "meta3d-action-mod-career-info-protocol"
1112

1213
//TODO duplicate
1314
let _isCharacterTypeEqual = (characterType1: characterType, characterType2: characterType) => {
@@ -116,17 +117,33 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
116117
return _isCharacterTypeEqual(d.characterType, characterType_)
117118
})
118119

119-
let assetIconBase64 = api.action.getActionState<loadModPreviewState>(meta3dState, loadModPreviewActionName).preview
120-
let careerIconBase64 = api.action.getActionState<loadCareerPreviewState>(meta3dState, loadCareerPreviewActionName).preview
121-
122-
let state = api.action.getActionState<state>(meta3dState, actionName)
120+
let assetIconBase64 = api.nullable.getWithDefault(
121+
api.action.getActionState<loadModPreviewState>(meta3dState, loadModPreviewActionName).preview,
122+
""
123+
)
124+
let careerIconBase64 = api.nullable.getWithDefault(
125+
api.action.getActionState<loadCareerPreviewState>(meta3dState, loadCareerPreviewActionName).preview,
126+
""
127+
)
123128

124129
console.log("publish mod")
125130

126-
return _base64ToUint8Array(assetIconBase64).then(uint8Array => {
127-
return api.backend.publishMod(
128-
// "local",
129-
` {
131+
132+
meta3dState = api.action.setActionState<state>(meta3dState, actionName, {
133+
...api.action.getActionState<state>(meta3dState, actionName),
134+
isShowModal: false
135+
})
136+
meta3dState = api.action.setActionState<infoState>(meta3dState, infoActionName, {
137+
...api.action.getActionState<infoState>(meta3dState, infoActionName),
138+
info: api.nullable.return("正在发布中...")
139+
})
140+
141+
api.flow.deferExec((meta3dState) => {
142+
return _base64ToUint8Array(assetIconBase64).then(uint8Array => {
143+
let state = api.action.getActionState<state>(meta3dState, actionName)
144+
145+
return api.backend.publishMod(
146+
` {
130147
"name": "${_buildUniqueName(state)}",
131148
"mod": {
132149
"protocolName": "career-protocol",
@@ -139,26 +156,31 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
139156
]
140157
}
141158
}`,
142-
`${state.readme}`,
143-
_buildDistFileContent(state, characterType_, features),
144-
[
159+
`${state.readme}`,
160+
_buildDistFileContent(state, characterType_, features),
145161
[
146-
`./${_buildIconId(state)}.png`,
147-
uint8Array
162+
[
163+
`./${_buildIconId(state)}.png`,
164+
uint8Array
165+
],
148166
],
149-
],
150-
careerIconBase64
151-
).then(_ => {
152-
console.log("publish success")
153-
154-
// meta3dState = api.action.setActionState<state>(meta3dState, actionName, {
155-
// ...state,
156-
// version: state.version + 1
157-
// })
158-
159-
return meta3dState
167+
careerIconBase64
168+
)
169+
.then(() => {
170+
meta3dState = api.action.setActionState<infoState>(meta3dState, infoActionName, {
171+
...api.action.getActionState<infoState>(meta3dState, infoActionName),
172+
info: api.nullable.getEmpty()
173+
})
174+
175+
return meta3dState
176+
})
160177
})
178+
.catch(e => {
179+
api.message.error(e)
180+
})
161181
})
182+
183+
return Promise.resolve(meta3dState)
162184
}, (meta3dState) => {
163185
return Promise.resolve(meta3dState)
164186
}))

contributes/meta3d-ui-control-modal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "meta3d-ui-control-modal",
3-
"version": "1.3.1",
3+
"version": "1.3.5",
44
"publisher": "meta3d",
55
"displayName": "模态框",
66
"repoLink": "https://github.com/Meta3D-Technology/Meta3D/tree/master/contributes/meta3d-ui-control-modal",

defaults/meta3d-commonlib/lib/bs/.bsdeps

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ src\log 0x1.a5a64897c2f18p+30
1818
src\copy 0x1.a5a64897c0e59p+30
1919
src\contract 0x1.a5a64897bfdf9p+30
2020
===
21-
D:\Github\Meta3D\node_modules\rescript\win32\rescript.exe 0x1.a5e5ad7507ef9p+30
21+
D:\Github\Meta3D\node_modules\rescript\win32\rescript.exe 0x1.a5e61fd3d796dp+30
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Start(99071971)
2-
#Done(99072795)
1+
#Start(106391664)
2+
#Done(106392359)
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)