diff --git a/components.d.ts b/components.d.ts index d5a61d2..d508c8b 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,10 +7,12 @@ export {} declare module '@vue/runtime-core' { export interface GlobalComponents { + AButton: typeof import('ant-design-vue/es')['Button'] ADivider: typeof import('ant-design-vue/es')['Divider'] ASelect: typeof import('ant-design-vue/es')['Select'] ASelectOption: typeof import('ant-design-vue/es')['SelectOption'] ASlider: typeof import('ant-design-vue/es')['Slider'] + Box: typeof import('./src/components/box.vue')['default'] BoxAnimate: typeof import('./src/components/boxAnimate.vue')['default'] EnemyOne: typeof import('./src/components/enemyOne.vue')['default'] Scroll: typeof import('./src/components/scroll.vue')['default'] diff --git a/index.html b/index.html index df7f105..ae68d05 100644 --- a/index.html +++ b/index.html @@ -193,6 +193,7 @@
+
diff --git a/public/libs/actions.js b/public/libs/actions.js index fe3cfce..ee0a3af 100644 --- a/public/libs/actions.js +++ b/public/libs/actions.js @@ -888,7 +888,11 @@ actions.prototype._getClickLoc = function (x, y) { if (core.domStyle.isVertical) { statusBar.x = 3; - statusBar.y = core.dom.statusBar.offsetHeight + 3; + statusBar.y = + core.dom.statusBar.offsetHeight + + 3 + + 32 * core.values.statusCanvasRowsOnMobile + + 9; } else { statusBar.x = core.dom.statusBar.offsetWidth + 3; statusBar.y = 3; diff --git a/public/libs/control.js b/public/libs/control.js index d1c6b9d..68a7ab3 100644 --- a/public/libs/control.js +++ b/public/libs/control.js @@ -4274,7 +4274,10 @@ control.prototype._resize_gameGroup = function (obj) { gameGroup.style.width = totalWidth + 'px'; gameGroup.style.height = totalHeight + 'px'; gameGroup.style.left = (obj.clientWidth - totalWidth) / 2 + 'px'; - gameGroup.style.top = (obj.clientHeight - totalHeight) / 2 + 'px'; + gameGroup.style.top = + (obj.clientHeight - totalHeight) / 2 + + (core.domStyle.isVertical ? totalHeight / 8 : 0) + + 'px'; // floorMsgGroup var floorMsgGroup = core.dom.floorMsgGroup; floorMsgGroup.style = obj.globalAttribute.floorChangingStyle; @@ -4437,8 +4440,8 @@ control.prototype._resize_statusBar = function (obj) { (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0) ); } - core.dom.statusCanvas.style.display = - core.flags.statusCanvas && !obj.extendToolbar ? 'block' : 'none'; + core.dom.statusCanvas.style.display = 'none'; + statusBar.style.display = 'none'; }; control.prototype._resize_status = function (obj) { diff --git a/public/main.js b/public/main.js index ef3f0ff..bf13921 100644 --- a/public/main.js +++ b/public/main.js @@ -616,7 +616,6 @@ main.prototype.listen = function () { ////// 鼠标移动时 ////// main.dom.data.onmousemove = function (e) { try { - e.stopPropagation(); var loc = main.core.actions._getClickLoc(e.clientX, e.clientY); if (loc == null) return; main.core.onmove(loc); @@ -628,7 +627,6 @@ main.prototype.listen = function () { ////// 鼠标放开时 ////// main.dom.data.onmouseup = function (e) { try { - e.stopPropagation(); var loc = main.core.actions._getClickLoc(e.clientX, e.clientY); if (loc == null) return; main.core.onup(loc); diff --git a/public/project/data.js b/public/project/data.js index 62bef5e..ae1a138 100644 --- a/public/project/data.js +++ b/public/project/data.js @@ -62,6 +62,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "money.png", "mount.jpg", "plot1.jpg", + "skill.png", "skill0.png", "skill1.png", "skill2.png", @@ -684,7 +685,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "enableRouteFolding": false, "disableShopOnDamage": false, "blurFg": true, - "extendToolbar": false, + "extendToolbar": true, "enableEnemyPoint": null } } \ No newline at end of file diff --git a/public/project/images/IQ.png b/public/project/images/IQ.png index c9a9708..2302c8f 100644 Binary files a/public/project/images/IQ.png and b/public/project/images/IQ.png differ diff --git a/public/project/images/atk.png b/public/project/images/atk.png index 41d57ca..311abb5 100644 Binary files a/public/project/images/atk.png and b/public/project/images/atk.png differ diff --git a/public/project/images/def.png b/public/project/images/def.png index 48252e8..a50e410 100644 Binary files a/public/project/images/def.png and b/public/project/images/def.png differ diff --git a/public/project/images/exp.png b/public/project/images/exp.png index 61d4bc3..77f1b0a 100644 Binary files a/public/project/images/exp.png and b/public/project/images/exp.png differ diff --git a/public/project/images/hp.png b/public/project/images/hp.png index 6e9803e..e03284d 100644 Binary files a/public/project/images/hp.png and b/public/project/images/hp.png differ diff --git a/public/project/images/money.png b/public/project/images/money.png index cd80803..b2c1155 100644 Binary files a/public/project/images/money.png and b/public/project/images/money.png differ diff --git a/public/project/images/skill.png b/public/project/images/skill.png new file mode 100644 index 0000000..d7afaea Binary files /dev/null and b/public/project/images/skill.png differ diff --git a/public/project/plugins.js b/public/project/plugins.js index 9abcfeb..7486f89 100644 --- a/public/project/plugins.js +++ b/public/project/plugins.js @@ -9289,5 +9289,35 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.plugin.statusBarStatus.value = !core.plugin.statusBarStatus.value; }; + + control.prototype.showStatusBar = function () { + if (main.mode == 'editor') return; + core.removeFlag('hideStatusBar'); + core.plugin.showStatusBar.value = true; + core.dom.tools.hard.style.display = 'block'; + core.dom.toolBar.style.display = 'block'; + }; + + control.prototype.hideStatusBar = function (showToolbox) { + if (main.mode == 'editor') return; + + // 如果原本就是隐藏的,则先显示 + if (!core.domStyle.showStatusBar) this.showStatusBar(); + if (core.isReplaying()) showToolbox = true; + core.plugin.showStatusBar.value = false; + + core.setFlag('hideStatusBar', true); + core.setFlag('showToolbox', showToolbox || null); + if ( + (!core.domStyle.isVertical && !core.flags.extendToolbar) || + !showToolbox + ) { + for (var i = 0; i < toolItems.length; ++i) + toolItems[i].style.display = 'none'; + } + if (!core.domStyle.isVertical && !core.flags.extendToolbar) { + core.dom.toolBar.style.display = 'none'; + } + }; } }; diff --git a/src/App2.vue b/src/App2.vue new file mode 100644 index 0000000..3b52644 --- /dev/null +++ b/src/App2.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/src/components/box.vue b/src/components/box.vue new file mode 100644 index 0000000..125b553 --- /dev/null +++ b/src/components/box.vue @@ -0,0 +1,313 @@ + + + + + diff --git a/src/components/scroll.vue b/src/components/scroll.vue index c2323e7..65ac76e 100644 --- a/src/components/scroll.vue +++ b/src/components/scroll.vue @@ -13,16 +13,21 @@ import { onMounted, onUnmounted, onUpdated } from 'vue'; import { cancelGlobalDrag, useDrag, useWheel } from '../plugin/use'; +let main: HTMLDivElement; + const props = defineProps<{ now?: number; type?: 'vertical' | 'horizontal'; drag?: boolean; width?: number; + update?: boolean; + noScroll?: boolean; }>(); const emits = defineEmits<{ (e: 'update:now', value: number): void; (e: 'update:drag', value: boolean): void; + (e: 'update:update'): void; }>(); let now = 0; @@ -54,6 +59,7 @@ function draw() { } else if (now < 0) { now = 0; } + if (props.noScroll) return; const w = ctx.canvas.width; const h = ctx.canvas.height; emits('update:now', now); @@ -86,6 +92,23 @@ async function calHeight() { const style = getComputedStyle(content); total = parseFloat(style[canvasAttr]); res(''); + + const canvas = ctx.canvas; + const style2 = getComputedStyle(canvas); + canvas.style.width = `${width}px`; + canvas.width = width * scale; + canvas.height = parseFloat(style2.height) * scale; + if (props.noScroll) canvas.style.width = `0px`; + + if (props.type === 'horizontal') { + main.style.flexDirection = 'column'; + canvas.style.height = `${width}px`; + canvas.style.width = '98%'; + canvas.style.margin = '0 1% 0 1%'; + canvas.width = parseFloat(style2.width) * scale; + canvas.height = width * scale; + if (props.noScroll) canvas.style.height = `0px`; + } }); }); } @@ -126,42 +149,30 @@ function contentDrag(x: number, y: number) { } onMounted(async () => { - const div = document.getElementById(`scroll-div-${id}`) as HTMLDivElement; - const canvas = document.getElementById(`scroll-${id}`) as HTMLCanvasElement; + main = document.getElementById(`scroll-div-${id}`) as HTMLDivElement; const d = document.getElementById(`content-${id}`) as HTMLDivElement; - ctx = canvas.getContext('2d') as CanvasRenderingContext2D; content = d; + const canvas = document.getElementById(`scroll-${id}`) as HTMLCanvasElement; + ctx = canvas.getContext('2d') as CanvasRenderingContext2D; - const style = getComputedStyle(canvas); - canvas.style.width = `${width}px`; - canvas.width = width * scale; - canvas.height = parseFloat(style.height) * scale; - - if (props.type === 'horizontal') { - div.style.flexDirection = 'column'; - canvas.style.height = `${width}px`; - canvas.style.width = '98%'; - canvas.style.margin = '0 1% 0 1%'; - canvas.width = parseFloat(style.width) * scale; - canvas.height = width * scale; + if (!props.noScroll) { + // 绑定滚动条拖拽事件 + useDrag( + canvas, + canvasDrag, + (x, y) => { + fromSelf = true; + last = props.type === 'horizontal' ? x : y; + content.style.transition = ''; + }, + () => { + setTimeout(() => emits('update:drag', false)); + fromSelf = false; + }, + true + ); } - // 绑定滚动条拖拽事件 - useDrag( - canvas, - canvasDrag, - (x, y) => { - fromSelf = true; - last = props.type === 'horizontal' ? x : y; - content.style.transition = ''; - }, - () => { - setTimeout(() => emits('update:drag', false)); - fromSelf = false; - }, - true - ); - // 绑定文本拖拽事件 useDrag( content, diff --git a/src/main.ts b/src/main.ts index 7470915..7cc4045 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,8 @@ import { createApp } from 'vue'; import App from './App.vue'; +import App2 from './App2.vue'; import './styles.less'; import 'ant-design-vue/dist/antd.dark.css'; createApp(App).mount('#root'); +createApp(App2).mount('#root2'); diff --git a/src/plugin/uiController.ts b/src/plugin/uiController.ts index 9b32bda..ffa2149 100644 --- a/src/plugin/uiController.ts +++ b/src/plugin/uiController.ts @@ -3,10 +3,12 @@ import { Component, markRaw, ref, Ref, watch } from 'vue'; import Book from '../ui/book.vue'; import Toolbox from '../ui/toolbox.vue'; import Equipbox from '../ui/equipbox.vue'; +import StatusBar from '../ui/statusBar.vue'; export const bookOpened = ref(false); export const toolOpened = ref(false); export const equipOpened = ref(false); +export const showStatusBar = ref(false); export const transition = ref(true); export const noClosePanel = ref(false); @@ -40,7 +42,14 @@ export default function init() { } }); }); - return { uiStack, transition, bookOpened, toolOpened, equipOpened }; + return { + uiStack, + transition, + bookOpened, + toolOpened, + equipOpened, + showStatusBar + }; } async function showApp() { diff --git a/src/source/data.d.ts b/src/source/data.d.ts index d47bad3..8b64a07 100644 --- a/src/source/data.d.ts +++ b/src/source/data.d.ts @@ -51,6 +51,7 @@ type ImageIds = | 'money.png' | 'mount.jpg' | 'plot1.jpg' + | 'skill.png' | 'skill0.png' | 'skill1.png' | 'skill2.png' diff --git a/src/styles.less b/src/styles.less index 631c0dd..fd57455 100644 --- a/src/styles.less +++ b/src/styles.less @@ -74,3 +74,9 @@ font-family: Fira Code; src: url(/src/fonts/FiraCode-Regular.ttf); } + +#non-ui { + position: absolute; + z-index: 999; + user-select: none; +} diff --git a/src/types/plugin.d.ts b/src/types/plugin.d.ts index 38f8d1f..82245fa 100644 --- a/src/types/plugin.d.ts +++ b/src/types/plugin.d.ts @@ -47,6 +47,9 @@ interface PluginDeclaration extends PluginUtils { /** 状态栏信息,取反后刷新状态栏 */ readonly statusBarStatus: Ref; + /** 是否显示状态栏 */ + readonly showStatusBar: Ref; + /** ui栈 */ readonly uiStack: Ref; diff --git a/src/ui/book.vue b/src/ui/book.vue index 1471d4b..0cf31ae 100644 --- a/src/ui/book.vue +++ b/src/ui/book.vue @@ -242,7 +242,7 @@ onUnmounted(async () => { #none { width: 100%; height: 100%; - font-size: 10vw; + font-size: 6vw; display: flex; justify-content: center; align-items: center; diff --git a/src/ui/statusBar.vue b/src/ui/statusBar.vue index 702e4ca..8b0e7e3 100644 --- a/src/ui/statusBar.vue +++ b/src/ui/statusBar.vue @@ -1,18 +1,117 @@