Skip to content

Commit

Permalink
Merge pull request #207 from OpenWebGAL/dev
Browse files Browse the repository at this point in the history
4.4.8
  • Loading branch information
MakinoharaShoko authored Dec 31, 2023
2 parents d6195ed + 597a83e commit 0aed418
Show file tree
Hide file tree
Showing 93 changed files with 6,267 additions and 5,113 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules
.idea
.vscode
release
bundle
yarn.lock
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": false,
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"lint": "concurrently \"yarn lint:terre\" \"yarn lint:origine\"",
"nsis-bundle": "node ./nsis-version-sync.js && makensis ./installer.nsi",
"dev:terre": "cd packages/terre2 && yarn start:debug",
"dev:origine": "cd packages/origine2 && vite --host=3002",
"dev:origine": "cd packages/origine2 && yarn dev",
"dev:start-dev-server": "cd packages/dev-server && node index.js",
"openapi": "cd packages/origine2 && yarn openapi",
"lint:terre": "cd packages/terre2 && yarn lint",
Expand Down
12 changes: 7 additions & 5 deletions packages/origine2/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "webgal-origine-2",
"private": true,
"version": "4.4.7",
"version": "4.4.8",
"license": "MPL-2.0",
"scripts": {
"dev": "vite --host=3000",
"dev": "vite --port=3000 --host",
"build": "node version-sync.js && tsc && vite build --base=./",
"build-lowram": "node version-sync.js && tsc && node --max_old_space_size=512000 ./node_modules/bin/vite build --base=./",
"preview": "vite preview",
Expand All @@ -22,6 +22,7 @@
"i18next": "^22.4.15",
"lodash": "^4.17.21",
"material-icon-theme": "^4.27.0",
"mitt": "^3.0.1",
"monaco-editor": "^0.34.1",
"monaco-editor-textmate": "^4.0.0",
"monaco-textmate": "^3.0.1",
Expand All @@ -32,9 +33,10 @@
"react-dom": "^18.0.0",
"react-i18next": "^12.2.2",
"react-redux": "^8.0.1",
"redux-persist": "^6.0.0",
"sass": "^1.51.0",
"swr": "^2.2.4",
"webgal-parser": "^4.4.7"
"webgal-parser": "latest"
},
"devDependencies": {
"@types/lodash": "^4.14.182",
Expand All @@ -43,7 +45,7 @@
"@types/react-dom": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"@vitejs/plugin-react": "^1.3.0",
"@vitejs/plugin-react": "^4.0.4",
"esbuild": "^0.18.11",
"eslint": "^8.13.0",
"eslint-config-alloy": "^4.5.1",
Expand All @@ -53,6 +55,6 @@
"swagger-typescript-api": "^13.0.3",
"tsx": "^3.14.0",
"typescript": "^4.6.3",
"vite": "^2.9.7"
"vite": "^4.4.9"
}
}
19 changes: 11 additions & 8 deletions packages/origine2/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "./App.css";
import {logger} from "./utils/logger";
import DashBoard from "./pages/dashboard/DashBoard";
import {Provider} from "react-redux";
import {origineStore} from "./store/origineStore";
import {origineStore, persistor} from "./store/origineStore";
import Editor from "./pages/editor/Editor";
import {useEffect} from "react";
import "@icon-park/react/styles/index.css";
Expand All @@ -12,13 +12,14 @@ import * as monaco from "monaco-editor";
import Translation from "./components/translation/Translation";
import {lspSceneName} from "@/runtime/WG_ORIGINE_RUNTIME";
import './config/themes/theme.css';
import {PersistGate} from 'redux-persist/integration/react';

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

// 防止多次注册,语言在初次进入的时候注册
monaco.languages.register({ id: "webgal" });
monaco.languages.register({id: "webgal"});
/**
* LSP
*/
Expand All @@ -29,7 +30,7 @@ function App() {
textDocument: {
uri: lspSceneName.value
},
position: { line: position.lineNumber - 1, character: position.column - 1 }
position: {line: position.lineNumber - 1, character: position.column - 1}
};

const data = {
Expand All @@ -41,7 +42,7 @@ function App() {
// 处理 LSP 的响应
const result = {
suggestions: response.data.items.map((suggestion: any) => {
return { ...suggestion, kind: mapLspKindToMonacoKind(suggestion.kind) };
return {...suggestion, kind: mapLspKindToMonacoKind(suggestion.kind)};
})
};
resolve(result);
Expand All @@ -52,11 +53,13 @@ function App() {
});
return (
// 将编辑器的根元素占满整个视口
<div className="App" style={{ width: "100vw", height: "100vh", overflow: "hidden" }}>
<div className="App" style={{width: "100vw", height: "100vh", overflow: "hidden"}}>
<Provider store={origineStore}>
<Translation />
<DashBoard />
<Editor />
<PersistGate loading={null} persistor={persistor}>
<Translation/>
<DashBoard/>
<Editor/>
</PersistGate>
</Provider>
</div>
);
Expand Down
9 changes: 8 additions & 1 deletion packages/origine2/src/api/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,17 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @summary Open Game Assets Dictionary
* @request GET:/api/manageGame/openGameAssetsDict/{gameName}
*/
manageGameControllerOpenGameAssetsDict: (gameName: string, params: RequestParams = {}) =>
manageGameControllerOpenGameAssetsDict: (
gameName: string,
query: {
subFolder: string;
},
params: RequestParams = {},
) =>
this.request<void, any>({
path: `/api/manageGame/openGameAssetsDict/${gameName}`,
method: 'GET',
query: query,
...params,
}),

Expand Down
24 changes: 0 additions & 24 deletions packages/origine2/src/common.scss

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.title_wrapper{
display: flex;
align-items: center;
padding: 5px 7px 5px 10px;
padding: 8px;
}

.title{
Expand Down
4 changes: 2 additions & 2 deletions packages/origine2/src/config/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export interface Info {
}

export const __INFO: Info = {
version: '4.4.7',
buildTime: '2023-10-28T09:57:19.863Z', // 编译时会通过 version-sync.js 自动更新
version: '4.4.8',
buildTime: '2023-12-30T03:22:49.651Z', // 编译时会通过 version-sync.js 自动更新
};
8 changes: 8 additions & 0 deletions packages/origine2/src/config/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@
"schema": {
"type": "string"
}
},
{
"name": "subFolder",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down
2 changes: 2 additions & 0 deletions packages/origine2/src/config/themes/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
--terre-primary: rgba(0, 92, 175, 1);
--terre-primary-5pct: rgba(0, 92, 175, 0.05);
--terre-primary-10pct: rgba(0, 92, 175, 0.1);
--border-md: 1px solid var(--black-10pct);
--box-shadow-md: 0 1px 2px var(--black-10pct);
--addSentence-sentenceTypeButton-background: var(--black-5pct);
--addSentence-sentenceTypeButton-hover-background: var(--black-0pct);
--app-header-background: var(--gray-dark);
Expand Down
2 changes: 1 addition & 1 deletion packages/origine2/src/hooks/useHashRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function useHashRoute() {
const result = decodeHash();
if (result.editingGameName !== '') {
dispatch(setDashboardShow(false));
dispatch(setEditingGame(result.editingGameName));
dispatch(setEditingGame(decodeURIComponent(result.editingGameName)));
if (result.currentTag !== '') {
const currentTagJsonStr = decodeURIComponent(result.currentTag);
let tagObj: null | ITag = null;
Expand Down
31 changes: 25 additions & 6 deletions packages/origine2/src/hooks/useValue.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
import { useState } from "react";
import {useState} from "react";

export function useValue<T>(initialState: T) {
const [value, setValue] = useState<T>(initialState);
const holdMap = new Map();

export function useValue<T>(initialState: T, isHold?: boolean, key?: string) {
const holdKey = key ?? '__value_hold_key__';
const fromHoldValue = holdMap.get(holdKey);
const [value, setValue] = useState<T>(fromHoldValue ?? initialState);
return {
value,
set: function(newValue: T) {
this.value = newValue;
_value: value,
set: function (newValue: T) {
this._value = newValue;
if (isHold) {
holdMap.set(holdKey, newValue);
}
setValue(newValue);
},
get value() {
if (isHold) {
const result = holdMap.get(holdKey);
if (result) {
return result as T;
}
}
return this._value;
},
set value(newValue) {
this.set(newValue);
}
};
}
1 change: 0 additions & 1 deletion packages/origine2/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { jp } from "./translations/jp";
import 'primereact/resources/themes/fluent-light/theme.css';
import "primereact/resources/primereact.min.css";
import "./primereact.scss";
import './common.scss';

function initTranslation() {
i18n.use(initReactI18next) // passes i18n down to react-i18next
Expand Down
4 changes: 3 additions & 1 deletion packages/origine2/src/pages/editor/ChooseFile/ChooseFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface IChooseFile {
onChange: (choosedFileDescription: IFileDescription | null) => void;
// 拓展名,要加.
extName: string[];
ignoreFiles?: string[];
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,3 @@
flex:1;
overflow: auto;
}

.choseFileButton > span > svg > path:nth-child(1) {
fill: var(--iconPark-icon-chooseFile-fill);
stroke: var(--iconPark-icon-chooseFile-stroke-first);
}

.choseFileButton > span > svg > path:nth-child(2) {
stroke: var(--iconPark-icon-chooseFile-stroke-second);
}

.choseFileButton > span > svg > path:nth-child(3) {
stroke: var(--iconPark-icon-chooseFile-stroke-third);
}
18 changes: 13 additions & 5 deletions packages/origine2/src/pages/editor/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
import TopBar from "./Topbar/Topbar";
import styles from "./editor.module.scss";
import EditorSideBar from "./EditorSidebar/EditorSidebar";
import EditorSidebarControl from "./EditorSidebar/EditorSidebarControl";
import { useSelector } from "react-redux";
import {useDispatch, useSelector} from "react-redux";
import { RootState } from "@/store/origineStore";
import MainArea from "./MainArea/MainArea";
import { Splitter, SplitterPanel } from "primereact/splitter";
import {useHashRoute} from "@/hooks/useHashRoute";
import { useHashRoute } from "@/hooks/useHashRoute";
import {statusActions} from "@/store/statusReducer";


export default function Editor() {
const isShowDashboard = useSelector((state: RootState) => state.status.dashboard.showDashBoard);
const editorState = useSelector((state: RootState) => state.status.editor);
const isShowPreview = editorState.showPreview;
const dispatch = useDispatch();
const currentTag = editorState.currentSidebarTag;
useHashRoute();
const isAutoHideToolbar = useSelector((state:RootState)=>state.userData.isAutoHideToolbar);

function handleMainAreaClick(){
if(isAutoHideToolbar){
dispatch(statusActions.setCurrentTopbarTab(undefined));
}
}

return <>
{!isShowDashboard && <div className={styles.editor}>
<TopBar />
<div className={styles.container}>
<EditorSidebarControl />
<div className={styles.container} onClick={()=>handleMainAreaClick()}>
{/* <Splitter style={{ height: "100%", flex: 1 }}> */}
{/* <SplitterPanel size={15} minSize={15} */}
{/* style={{ display: (isShowPreview || currentTag !== 0) ? undefined : "none" }}><EditorSideBar /></SplitterPanel> */}
Expand Down
Loading

0 comments on commit 0aed418

Please sign in to comment.