Skip to content

Commit cdd5a2f

Browse files
Merge pull request #207 from OpenWebGAL/dev
4.4.8
2 parents 0c16ef8 + 9e3b13a commit cdd5a2f

File tree

93 files changed

+6267
-5113
lines changed

Some content is hidden

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

93 files changed

+6267
-5113
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
node_modules
22
.idea
3-
.vscode
43
release
54
bundle
65
yarn.lock

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.formatOnSave": false,
3+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"lint": "concurrently \"yarn lint:terre\" \"yarn lint:origine\"",
88
"nsis-bundle": "node ./nsis-version-sync.js && makensis ./installer.nsi",
99
"dev:terre": "cd packages/terre2 && yarn start:debug",
10-
"dev:origine": "cd packages/origine2 && vite --host=3002",
10+
"dev:origine": "cd packages/origine2 && yarn dev",
1111
"dev:start-dev-server": "cd packages/dev-server && node index.js",
1212
"openapi": "cd packages/origine2 && yarn openapi",
1313
"lint:terre": "cd packages/terre2 && yarn lint",

packages/origine2/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "webgal-origine-2",
33
"private": true,
4-
"version": "4.4.7",
4+
"version": "4.4.8",
55
"license": "MPL-2.0",
66
"scripts": {
7-
"dev": "vite --host=3000",
7+
"dev": "vite --port=3000 --host",
88
"build": "node version-sync.js && tsc && vite build --base=./",
99
"build-lowram": "node version-sync.js && tsc && node --max_old_space_size=512000 ./node_modules/bin/vite build --base=./",
1010
"preview": "vite preview",
@@ -22,6 +22,7 @@
2222
"i18next": "^22.4.15",
2323
"lodash": "^4.17.21",
2424
"material-icon-theme": "^4.27.0",
25+
"mitt": "^3.0.1",
2526
"monaco-editor": "^0.34.1",
2627
"monaco-editor-textmate": "^4.0.0",
2728
"monaco-textmate": "^3.0.1",
@@ -32,9 +33,10 @@
3233
"react-dom": "^18.0.0",
3334
"react-i18next": "^12.2.2",
3435
"react-redux": "^8.0.1",
36+
"redux-persist": "^6.0.0",
3537
"sass": "^1.51.0",
3638
"swr": "^2.2.4",
37-
"webgal-parser": "^4.4.7"
39+
"webgal-parser": "latest"
3840
},
3941
"devDependencies": {
4042
"@types/lodash": "^4.14.182",
@@ -43,7 +45,7 @@
4345
"@types/react-dom": "^18.0.0",
4446
"@typescript-eslint/eslint-plugin": "^5.18.0",
4547
"@typescript-eslint/parser": "^5.18.0",
46-
"@vitejs/plugin-react": "^1.3.0",
48+
"@vitejs/plugin-react": "^4.0.4",
4749
"esbuild": "^0.18.11",
4850
"eslint": "^8.13.0",
4951
"eslint-config-alloy": "^4.5.1",
@@ -53,6 +55,6 @@
5355
"swagger-typescript-api": "^13.0.3",
5456
"tsx": "^3.14.0",
5557
"typescript": "^4.6.3",
56-
"vite": "^2.9.7"
58+
"vite": "^4.4.9"
5759
}
5860
}

packages/origine2/src/App.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import "./App.css";
22
import {logger} from "./utils/logger";
33
import DashBoard from "./pages/dashboard/DashBoard";
44
import {Provider} from "react-redux";
5-
import {origineStore} from "./store/origineStore";
5+
import {origineStore, persistor} from "./store/origineStore";
66
import Editor from "./pages/editor/Editor";
77
import {useEffect} from "react";
88
import "@icon-park/react/styles/index.css";
@@ -12,13 +12,14 @@ import * as monaco from "monaco-editor";
1212
import Translation from "./components/translation/Translation";
1313
import {lspSceneName} from "@/runtime/WG_ORIGINE_RUNTIME";
1414
import './config/themes/theme.css';
15+
import {PersistGate} from 'redux-persist/integration/react';
1516

1617
function App() {
1718
useEffect(() => {
1819
logger.info("Welcome to WebGAL live editor!");
1920

2021
// 防止多次注册,语言在初次进入的时候注册
21-
monaco.languages.register({ id: "webgal" });
22+
monaco.languages.register({id: "webgal"});
2223
/**
2324
* LSP
2425
*/
@@ -29,7 +30,7 @@ function App() {
2930
textDocument: {
3031
uri: lspSceneName.value
3132
},
32-
position: { line: position.lineNumber - 1, character: position.column - 1 }
33+
position: {line: position.lineNumber - 1, character: position.column - 1}
3334
};
3435

3536
const data = {
@@ -41,7 +42,7 @@ function App() {
4142
// 处理 LSP 的响应
4243
const result = {
4344
suggestions: response.data.items.map((suggestion: any) => {
44-
return { ...suggestion, kind: mapLspKindToMonacoKind(suggestion.kind) };
45+
return {...suggestion, kind: mapLspKindToMonacoKind(suggestion.kind)};
4546
})
4647
};
4748
resolve(result);
@@ -52,11 +53,13 @@ function App() {
5253
});
5354
return (
5455
// 将编辑器的根元素占满整个视口
55-
<div className="App" style={{ width: "100vw", height: "100vh", overflow: "hidden" }}>
56+
<div className="App" style={{width: "100vw", height: "100vh", overflow: "hidden"}}>
5657
<Provider store={origineStore}>
57-
<Translation />
58-
<DashBoard />
59-
<Editor />
58+
<PersistGate loading={null} persistor={persistor}>
59+
<Translation/>
60+
<DashBoard/>
61+
<Editor/>
62+
</PersistGate>
6063
</Provider>
6164
</div>
6265
);

packages/origine2/src/api/Api.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,17 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
316316
* @summary Open Game Assets Dictionary
317317
* @request GET:/api/manageGame/openGameAssetsDict/{gameName}
318318
*/
319-
manageGameControllerOpenGameAssetsDict: (gameName: string, params: RequestParams = {}) =>
319+
manageGameControllerOpenGameAssetsDict: (
320+
gameName: string,
321+
query: {
322+
subFolder: string;
323+
},
324+
params: RequestParams = {},
325+
) =>
320326
this.request<void, any>({
321327
path: `/api/manageGame/openGameAssetsDict/${gameName}`,
322328
method: 'GET',
329+
query: query,
323330
...params,
324331
}),
325332

packages/origine2/src/common.scss

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/origine2/src/components/TagTitleWrapper/tagTitleWrapper.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.title_wrapper{
22
display: flex;
33
align-items: center;
4-
padding: 5px 7px 5px 10px;
4+
padding: 8px;
55
}
66

77
.title{

packages/origine2/src/config/info.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export interface Info {
44
}
55

66
export const __INFO: Info = {
7-
version: '4.4.7',
8-
buildTime: '2023-10-28T09:57:19.863Z', // 编译时会通过 version-sync.js 自动更新
7+
version: '4.4.8',
8+
buildTime: '2023-12-30T03:22:49.651Z', // 编译时会通过 version-sync.js 自动更新
99
};

packages/origine2/src/config/swagger.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@
122122
"schema": {
123123
"type": "string"
124124
}
125+
},
126+
{
127+
"name": "subFolder",
128+
"required": true,
129+
"in": "query",
130+
"schema": {
131+
"type": "string"
132+
}
125133
}
126134
],
127135
"responses": {

packages/origine2/src/config/themes/theme.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
--terre-primary: rgba(0, 92, 175, 1);
2929
--terre-primary-5pct: rgba(0, 92, 175, 0.05);
3030
--terre-primary-10pct: rgba(0, 92, 175, 0.1);
31+
--border-md: 1px solid var(--black-10pct);
32+
--box-shadow-md: 0 1px 2px var(--black-10pct);
3133
--addSentence-sentenceTypeButton-background: var(--black-5pct);
3234
--addSentence-sentenceTypeButton-hover-background: var(--black-0pct);
3335
--app-header-background: var(--gray-dark);

packages/origine2/src/hooks/useHashRoute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function useHashRoute() {
3737
const result = decodeHash();
3838
if (result.editingGameName !== '') {
3939
dispatch(setDashboardShow(false));
40-
dispatch(setEditingGame(result.editingGameName));
40+
dispatch(setEditingGame(decodeURIComponent(result.editingGameName)));
4141
if (result.currentTag !== '') {
4242
const currentTagJsonStr = decodeURIComponent(result.currentTag);
4343
let tagObj: null | ITag = null;
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
1-
import { useState } from "react";
1+
import {useState} from "react";
22

3-
export function useValue<T>(initialState: T) {
4-
const [value, setValue] = useState<T>(initialState);
3+
const holdMap = new Map();
4+
5+
export function useValue<T>(initialState: T, isHold?: boolean, key?: string) {
6+
const holdKey = key ?? '__value_hold_key__';
7+
const fromHoldValue = holdMap.get(holdKey);
8+
const [value, setValue] = useState<T>(fromHoldValue ?? initialState);
59
return {
6-
value,
7-
set: function(newValue: T) {
8-
this.value = newValue;
10+
_value: value,
11+
set: function (newValue: T) {
12+
this._value = newValue;
13+
if (isHold) {
14+
holdMap.set(holdKey, newValue);
15+
}
916
setValue(newValue);
17+
},
18+
get value() {
19+
if (isHold) {
20+
const result = holdMap.get(holdKey);
21+
if (result) {
22+
return result as T;
23+
}
24+
}
25+
return this._value;
26+
},
27+
set value(newValue) {
28+
this.set(newValue);
1029
}
1130
};
1231
}

packages/origine2/src/main.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { jp } from "./translations/jp";
1010
import 'primereact/resources/themes/fluent-light/theme.css';
1111
import "primereact/resources/primereact.min.css";
1212
import "./primereact.scss";
13-
import './common.scss';
1413

1514
function initTranslation() {
1615
i18n.use(initReactI18next) // passes i18n down to react-i18next

packages/origine2/src/pages/editor/ChooseFile/ChooseFile.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface IChooseFile {
1414
onChange: (choosedFileDescription: IFileDescription | null) => void;
1515
// 拓展名,要加.
1616
extName: string[];
17+
ignoreFiles?: string[];
1718
}
1819

1920
export interface IFileDescription {
@@ -36,7 +37,8 @@ export default function ChooseFile(props: IChooseFile) {
3637
* 更新当前目录内的文件
3738
*/
3839
getFileList(gameName, currentDirName, props.extName).then(result => {
39-
currentDirFiles.set(result);
40+
const filteredFileList = result.filter(file => !props.ignoreFiles?.includes(file.name));
41+
currentDirFiles.set(filteredFileList);
4042
});
4143
};
4244

packages/origine2/src/pages/editor/ChooseFile/chooseFile.module.scss

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,3 @@
3131
flex:1;
3232
overflow: auto;
3333
}
34-
35-
.choseFileButton > span > svg > path:nth-child(1) {
36-
fill: var(--iconPark-icon-chooseFile-fill);
37-
stroke: var(--iconPark-icon-chooseFile-stroke-first);
38-
}
39-
40-
.choseFileButton > span > svg > path:nth-child(2) {
41-
stroke: var(--iconPark-icon-chooseFile-stroke-second);
42-
}
43-
44-
.choseFileButton > span > svg > path:nth-child(3) {
45-
stroke: var(--iconPark-icon-chooseFile-stroke-third);
46-
}

packages/origine2/src/pages/editor/Editor.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
import TopBar from "./Topbar/Topbar";
22
import styles from "./editor.module.scss";
33
import EditorSideBar from "./EditorSidebar/EditorSidebar";
4-
import EditorSidebarControl from "./EditorSidebar/EditorSidebarControl";
5-
import { useSelector } from "react-redux";
4+
import {useDispatch, useSelector} from "react-redux";
65
import { RootState } from "@/store/origineStore";
76
import MainArea from "./MainArea/MainArea";
87
import { Splitter, SplitterPanel } from "primereact/splitter";
9-
import {useHashRoute} from "@/hooks/useHashRoute";
8+
import { useHashRoute } from "@/hooks/useHashRoute";
9+
import {statusActions} from "@/store/statusReducer";
1010

1111

1212
export default function Editor() {
1313
const isShowDashboard = useSelector((state: RootState) => state.status.dashboard.showDashBoard);
1414
const editorState = useSelector((state: RootState) => state.status.editor);
1515
const isShowPreview = editorState.showPreview;
16+
const dispatch = useDispatch();
1617
const currentTag = editorState.currentSidebarTag;
1718
useHashRoute();
19+
const isAutoHideToolbar = useSelector((state:RootState)=>state.userData.isAutoHideToolbar);
20+
21+
function handleMainAreaClick(){
22+
if(isAutoHideToolbar){
23+
dispatch(statusActions.setCurrentTopbarTab(undefined));
24+
}
25+
}
26+
1827
return <>
1928
{!isShowDashboard && <div className={styles.editor}>
2029
<TopBar />
21-
<div className={styles.container}>
22-
<EditorSidebarControl />
30+
<div className={styles.container} onClick={()=>handleMainAreaClick()}>
2331
{/* <Splitter style={{ height: "100%", flex: 1 }}> */}
2432
{/* <SplitterPanel size={15} minSize={15} */}
2533
{/* style={{ display: (isShowPreview || currentTag !== 0) ? undefined : "none" }}><EditorSideBar /></SplitterPanel> */}

0 commit comments

Comments
 (0)