diff --git a/.gitignore b/.gitignore index 7e413df..ba0a052 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,7 @@ dam1.png dam2.png dam3.png dam4.png -meeting.md \ No newline at end of file +meeting.md + +special.csv +script/special.ts diff --git a/src/components/colomn.vue b/src/components/colomn.vue index cf44493..0c72619 100644 --- a/src/components/colomn.vue +++ b/src/components/colomn.vue @@ -2,7 +2,7 @@
返回游戏 返回
diff --git a/src/core/main/custom/toolbar.ts b/src/core/main/custom/toolbar.ts index 0438cd6..208275d 100644 --- a/src/core/main/custom/toolbar.ts +++ b/src/core/main/custom/toolbar.ts @@ -1,7 +1,13 @@ import { EmitableEvent, EventEmitter } from '@/core/common/eventEmitter'; import { KeyCode } from '@/plugin/keyCodes'; import { flipBinary, has } from '@/plugin/utils'; -import { FunctionalComponent, nextTick, reactive } from 'vue'; +import { + FunctionalComponent, + markRaw, + nextTick, + reactive, + shallowReactive +} from 'vue'; import { createToolbarComponents } from '../init/toolbar'; import { gameKey } from '../init/hotkey'; import { unwarpBinary } from './hotkey'; @@ -12,7 +18,7 @@ interface CustomToolbarEvent extends EmitableEvent { add: (item: ValueOf) => void; delete: (item: ValueOf) => void; set: (id: string, data: Partial) => void; - emit: (id: string) => void; + emit: (id: string, item: ValueOf) => void; } interface ToolbarItemBase { @@ -70,7 +76,7 @@ const comMap: { export class CustomToolbar extends EventEmitter { static num: number = 0; - static list: CustomToolbar[] = []; + static list: CustomToolbar[] = shallowReactive([]); items: ValueOf[] = reactive([]); num: number = CustomToolbar.num++; @@ -97,7 +103,7 @@ export class CustomToolbar extends EventEmitter { add(item: Omit) { // @ts-ignore const data: ToolbarItemMap[K] = { - com: comMap[item.type], + com: markRaw(comMap[item.type]), ...item } as ToolbarItemMap[K]; this.items.push(data); @@ -141,7 +147,7 @@ export class CustomToolbar extends EventEmitter { emitTool(id: string) { const item = this.items.find(v => v.id === id); if (!item) return this; - this.emit(id); + this.emit('emit', id, item); if (item.type === 'hotkey') { // 按键 const assist = item.assist | this.assistKey; diff --git a/src/core/main/init/settings.tsx b/src/core/main/init/settings.tsx index 8e62a64..e3bf6b4 100644 --- a/src/core/main/init/settings.tsx +++ b/src/core/main/init/settings.tsx @@ -8,7 +8,7 @@ interface Components { BooleanSetting: SettingComponent; NumberSetting: SettingComponent; HotkeySetting: SettingComponent; - ToolbarSetting: SettingComponent; + ToolbarEditor: SettingComponent; } export function createSettingComponents() { @@ -17,7 +17,7 @@ export function createSettingComponents() { BooleanSetting, NumberSetting, HotkeySetting, - ToolbarSetting + ToolbarEditor }; return com; } @@ -104,15 +104,14 @@ function HotkeySetting(props: SettingComponentProps) { ); } -function ToolbarSetting(props: SettingComponentProps) { - // todo: toolSetting.vue +function ToolbarEditor(props: SettingComponentProps) { return (
diff --git a/src/core/main/init/ui.ts b/src/core/main/init/ui.ts index 12a3404..b237ac5 100644 --- a/src/core/main/init/ui.ts +++ b/src/core/main/init/ui.ts @@ -16,7 +16,8 @@ mainUi.register( new GameUi('shop', UI.Shop), new GameUi('achievement', UI.Achievement), new GameUi('bgm', UI.BgmList), - new GameUi('hotkey', UI.Hotkey) + new GameUi('hotkey', UI.Hotkey), + new GameUi('toolEditor', UI.ToolEditor) // todo: 把游戏主 div 加入到 mainUi 里面 ); mainUi.showAll(); diff --git a/src/core/main/setting.ts b/src/core/main/setting.ts index 501d53f..14e600f 100644 --- a/src/core/main/setting.ts +++ b/src/core/main/setting.ts @@ -391,7 +391,7 @@ mainSetting .register('fixed', '定点查看', true, COM.BooleanSetting) .register('hotkey', '快捷键', false, COM.HotkeySetting) .setDisplayFunc('hotkey', () => '') - .register('toolbar', '自定义工具栏', false, COM.BooleanSetting) + .register('toolbar', '自定义工具栏', false, COM.ToolbarEditor) .setDisplayFunc('toolbar', () => '') ) .register( diff --git a/src/ui/index.ts b/src/ui/index.ts index 697cbcf..8812989 100644 --- a/src/ui/index.ts +++ b/src/ui/index.ts @@ -21,3 +21,4 @@ export { default as Study } from './study.vue'; export { default as Toolbox } from './toolbox.vue'; export { default as Hotkey } from './hotkey.vue'; export { default as Toolbar } from './toolbar.vue'; +export { default as ToolEditor } from './toolEditor.vue'; diff --git a/src/ui/toolEditor.vue b/src/ui/toolEditor.vue new file mode 100644 index 0000000..06a7901 --- /dev/null +++ b/src/ui/toolEditor.vue @@ -0,0 +1,140 @@ + + + + +