Skip to content

Commit 9b65f68

Browse files
committed
feat(editor): begin add editor ui
add all needed new actions, inputs; add menu; show initing... info;
1 parent 7e3c53f commit 9b65f68

File tree

163 files changed

+2265
-53
lines changed

Some content is hidden

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

163 files changed

+2265
-53
lines changed

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.14",
3+
"version": "1.3.17",
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: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { state as meta3dState, getContribute as getContributeMeta3D, api } from
22
import { actionContribute, service as editorWholeService } from "meta3d-editor-whole-protocol/src/service/ServiceType"
33
import { actionName, characterType, state, uiData } from "meta3d-action-mod-career-add-careerfeature-protocol"
44
import { eventName, inputData } from "meta3d-action-mod-career-add-careerfeature-protocol/src/EventType"
5+
import { actionName as infoActionName, state as infoState } from "meta3d-action-mod-career-info-protocol"
56
import { careerFeatureName, getData } from "./CareerFeatureData"
67
import { getRandomFloat, getRandomInteger, randomSelect, convertDecimalToPercent, getDecimal } from "./NumberUtils"
78

@@ -59,30 +60,46 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
5960
return {
6061
actionName: actionName,
6162
init: (meta3dState) => {
62-
return _buildAllDefaultCareerFeatures(api).then(data => {
63-
let allDefaultCareerFeatures = api.immutable.createListOfData(data)
64-
65-
return api.action.setActionState(meta3dState, actionName, {
66-
...api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName)),
67-
allDefaultCareerFeatures: allDefaultCareerFeatures,
68-
})
63+
meta3dState = api.action.setActionState(meta3dState, infoActionName, {
64+
...api.nullable.getExn(api.action.getActionState<infoState>(meta3dState, infoActionName)),
65+
info: api.nullable.return("加载中...")
6966
})
70-
.then(meta3dState => {
71-
let eventSourcingService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState)
7267

73-
return new Promise((resolve, reject) => {
74-
resolve(eventSourcingService.on<inputData>(meta3dState, eventName, 0, (meta3dState,) => {
75-
meta3dState = api.action.setActionState(meta3dState, actionName, {
76-
...api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName)),
77-
isShowModal: true,
78-
})
68+
setTimeout(() => {
69+
let meta3dState = api.readState()
70+
71+
_buildAllDefaultCareerFeatures(api).then(data => {
72+
let allDefaultCareerFeatures = api.immutable.createListOfData(data)
7973

80-
return Promise.resolve(meta3dState)
81-
}, (meta3dState) => {
82-
return Promise.resolve(meta3dState)
83-
}))
74+
return api.action.setActionState(meta3dState, actionName, {
75+
...api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName)),
76+
allDefaultCareerFeatures: allDefaultCareerFeatures,
8477
})
8578
})
79+
.then(meta3dState => {
80+
return api.action.setActionState(meta3dState, infoActionName, {
81+
...api.nullable.getExn(api.action.getActionState<infoState>(meta3dState, infoActionName)),
82+
info: api.nullable.getEmpty()
83+
})
84+
})
85+
.then(api.writeState)
86+
}, 0)
87+
88+
let eventSourcingService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState)
89+
90+
return new Promise((resolve, reject) => {
91+
resolve(eventSourcingService.on<inputData>(meta3dState, eventName, 0, (meta3dState,) => {
92+
meta3dState = api.action.setActionState(meta3dState, actionName, {
93+
...api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName)),
94+
isShowModal: true,
95+
})
96+
97+
return Promise.resolve(meta3dState)
98+
}, (meta3dState) => {
99+
return Promise.resolve(meta3dState)
100+
}))
101+
})
102+
86103
},
87104
handler: (meta3dState, uiData) => {
88105
return new Promise<meta3dState>((resolve, reject) => {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.DS_Store
2+
.merlin
3+
.log
4+
.ninja_log
5+
.cmi
6+
.ast
7+
.cmt
8+
.bsdeps
9+
.compiler.log
10+
11+
.idea/
12+
.vscode/
13+
jest_0/
14+
reference/
15+
node_modules/
16+
mine/
17+
dist/
18+
lib/bs/
19+
.bs.js
20+
.gen.tsx
21+
lib/js/
22+
lib/es6_global/
23+
24+
coverage
25+
26+
dist/
27+
28+
npm-debug
29+
30+
.bsb.lock
31+
32+
yarn.lock
33+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
var gulp = require("gulp");
2+
var path = require("path");
3+
var fs = require("fs");
4+
var publish = require("meta3d-tool-publish")
5+
var bundle = require("meta3d-tool-bundle-to-custom")
6+
var clipboard = require('clipboardy')
7+
8+
gulp.task("publish_local_env_bundle", function (done) {
9+
let filePath = "./src/Main.ts"
10+
11+
let bundleContent = bundle.bundle(
12+
bundle.getLocalModulePath(
13+
filePath
14+
),
15+
fs.readFileSync(filePath, "utf-8")
16+
)
17+
18+
let clipedBundleContent = `import { api } from "meta3d-type"
19+
import { service as editorWholeService } from "meta3d-editor-whole-protocol/src/service/ServiceType"
20+
` + bundleContent
21+
clipedBundleContent = clipedBundleContent.replace(/getContribute\s\=\s\(api\)/g, "getContribute = (api:api)")
22+
23+
clipboard.default.writeSync(
24+
clipedBundleContent
25+
)
26+
27+
28+
29+
publish.publishBundledContribute(
30+
"local",
31+
path.join(__dirname, "package.json"),
32+
bundleContent
33+
).then(() => {
34+
done()
35+
})
36+
});
37+
38+
39+
40+
// gulp.task("publish_local_env", function (done) {
41+
// publish.publishContribute(
42+
// "local",
43+
// path.join(__dirname, "package.json"),
44+
// path.join(__dirname, "dist/static/js", "main.js")
45+
// ).then(() => {
46+
// done()
47+
// })
48+
// });
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "meta3d-action-mod-career-info",
3+
"version": "1.3.1",
4+
"publisher": "meta3d",
5+
"repoLink": "",
6+
"protocol": {
7+
"name": "meta3d-action-mod-career-info-protocol"
8+
},
9+
"license": "MIT",
10+
"scripts": {
11+
"watch": "tsc -w -noEmit",
12+
"webpack": "webpack --config webpack.config.js",
13+
"meta3d:publish_dev_auto": "yarn version --patch --no-git-tag-version && yarn meta3d:publish_dev",
14+
"meta3d:publish_dev": "cross-env NODE_ENV=development npm run webpack && gulp publish_local_env_bundle",
15+
"meta3d:publish_pro": "cross-env NODE_ENV=production npm run webpack && gulp publish_production_env_bundle"
16+
},
17+
"keywords": [],
18+
"dependencies": {
19+
"meta3d-action-mod-career-info-protocol": "^1.3.0",
20+
"meta3d-editor-whole-protocol": "^1.3.0",
21+
"meta3d-type": "^1.3.0"
22+
},
23+
"devDependencies": {
24+
"clean-webpack-plugin": "^4.0.0",
25+
"cross-env": "^7.0.3",
26+
"cz-customizable": "^6.3.0",
27+
"gulp": "^4.0.2",
28+
"meta3d-tool-publish": "^1.3.0",
29+
"source-map-loader": "^3.0.0",
30+
"ts-loader": "^9.2.6",
31+
"typescript": "^5.1.0",
32+
"webpack": "^5.62.1",
33+
"webpack-cli": "^4.9.1"
34+
}
35+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { state as meta3dState, api, getContribute as getContributeMeta3D } from "meta3d-type"
2+
import { actionContribute, service as editorWholeService } from "meta3d-editor-whole-protocol/src/service/ServiceType"
3+
import { actionName, state, uiData } from "meta3d-action-mod-career-info-protocol"
4+
import { eventName, inputData } from "meta3d-action-mod-career-info-protocol/src/EventType"
5+
6+
export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> = (api) => {
7+
return {
8+
actionName: actionName,
9+
init: (meta3dState) => {
10+
let eventSourcingService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState)
11+
12+
return new Promise((resolve, reject) => {
13+
resolve(eventSourcingService.on<inputData>(meta3dState, eventName, 0, (meta3dState, value) => {
14+
meta3dState = api.action.setActionState(meta3dState, actionName, {
15+
...api.nullable.getExn(api.action.getActionState<state>(meta3dState, actionName)),
16+
info: value
17+
})
18+
19+
return Promise.resolve(meta3dState)
20+
}, (meta3dState) => {
21+
return Promise.resolve(meta3dState)
22+
}))
23+
})
24+
},
25+
handler: (meta3dState, uiData) => {
26+
return new Promise<meta3dState>((resolve, reject) => {
27+
let eventSourcingService = api.nullable.getExn(api.getPackageService<editorWholeService>(meta3dState, "meta3d-editor-whole-protocol")).event(meta3dState).eventSourcing(meta3dState)
28+
29+
resolve(eventSourcingService.addEvent<inputData>(meta3dState, {
30+
name: eventName,
31+
isOnlyRead: true,
32+
inputData: [
33+
uiData
34+
]
35+
}))
36+
})
37+
},
38+
createState: (meta3dState) => {
39+
return {
40+
info: api.nullable.getEmpty()
41+
}
42+
}
43+
}
44+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES6",
4+
"module": "ES6",
5+
"moduleResolution": "node",
6+
"sourceMap": true,
7+
"resolveJsonModule": true,
8+
"esModuleInterop": true,
9+
"jsx": "react",
10+
// "noEmit": true,
11+
// "noUnusedLocals": true,
12+
// "noUnusedParameters": true,
13+
"noImplicitReturns": true,
14+
"lib": [
15+
"DOM",
16+
"ESNext",
17+
],
18+
"types": [],
19+
"strict": true
20+
},
21+
"include": [
22+
"./src"
23+
]
24+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
const path = require('path');
2+
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
3+
4+
module.exports = {
5+
entry: "./src/Main.ts",
6+
mode: process.env.NODE_ENV.trim() == 'production' ? 'production' : 'development',
7+
output: {
8+
path: path.resolve(__dirname, 'dist'),
9+
filename: 'static/js/[name].js',
10+
library: {
11+
name: 'Contribute',
12+
type: 'window',
13+
},
14+
},
15+
16+
// Enable sourcemaps for debugging webpack's output.
17+
// devtool: "source-map",
18+
19+
resolve: {
20+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'],
21+
modules: ['node_modules']
22+
},
23+
24+
module: {
25+
rules: [
26+
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
27+
{
28+
test: /\.tsx?$/,
29+
exclude: /node_modules/,
30+
use: "ts-loader"
31+
},
32+
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
33+
{
34+
enforce: 'pre',
35+
test: /\.js$/,
36+
loader: "source-map-loader"
37+
},
38+
]
39+
},
40+
plugins: [
41+
/**
42+
* All files inside webpack's output.path directory will be removed once, but the
43+
* directory itself will not be. If using webpack 4+'s default configuration,
44+
* everything under <PROJECT_DIR>/dist/ will be removed.
45+
* Use cleanOnceBeforeBuildPatterns to override this behavior.
46+
*
47+
* During rebuilds, all webpack assets that are not used anymore
48+
* will be removed automatically.
49+
*
50+
* See `Options and Defaults` for information
51+
*/
52+
new CleanWebpackPlugin(),
53+
// new HtmlWebpackPlugin({
54+
// template: './user.html',
55+
// filename: 'user.html',
56+
// }),
57+
],
58+
// When importing a module whose path matches one of the following, just
59+
// assume a corresponding global variable exists and use that instead.
60+
// This is important because it allows us to avoid bundling all of our
61+
// dependencies, which allows browsers to cache those libraries between builds.
62+
externals: {
63+
}
64+
};

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.37",
3+
"version": "1.3.38",
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ let _buildDistFileContent = (state, characterType, features) => {
8282
// title: api.getLanguageDataByData(state, _getTextData(), "Title"),
8383
title: "${state.displayName_cn}",
8484
iconId: "${_buildIconId(state)}",
85-
needGem: 2000,
85+
needGem: ${state.needGem},
8686
getCareerFeatureData: (state) => api.MutableRecordUtils.createFromObject(${_buildFeatures(features)}),
8787
};
8888
},
@@ -185,6 +185,7 @@ export let getContribute: getContributeMeta3D<actionContribute<uiData, state>> =
185185
author: "",
186186
readme: "",
187187
// version: "0.0.1",
188+
needGem: 2000,
188189
}
189190
}
190191
}

0 commit comments

Comments
 (0)