mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-09-23 15:41:48 +08:00
Compare commits
5 Commits
fdee669343
...
e2c06258ad
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e2c06258ad | ||
b50c868b6d | |||
67bd98d451 | |||
1ce79154d2 | |||
b74c61b8ba |
@ -1,7 +1,7 @@
|
|||||||
import { DefaultProps, ElementLocator, Font } from '@motajs/render';
|
import { DefaultProps, ElementLocator, Font } from '@motajs/render';
|
||||||
import { computed, defineComponent, reactive, ref } from 'vue';
|
import { computed, defineComponent, reactive, ref } from 'vue';
|
||||||
import { Background, Selection } from './misc';
|
import { Background, Selection } from './misc';
|
||||||
import { TextContent, TextContentExpose, TextContentProps } from './textbox';
|
import { TextContent, TextContentProps } from './textbox';
|
||||||
import { TextAlign } from './textboxTyper';
|
import { TextAlign } from './textboxTyper';
|
||||||
import { Page, PageExpose } from './page';
|
import { Page, PageExpose } from './page';
|
||||||
import { GameUI, IUIMountable, SetupComponentOptions } from '@motajs/system-ui';
|
import { GameUI, IUIMountable, SetupComponentOptions } from '@motajs/system-ui';
|
||||||
@ -83,7 +83,6 @@ export const ConfirmBox = defineComponent<
|
|||||||
ConfirmBoxEmits,
|
ConfirmBoxEmits,
|
||||||
keyof ConfirmBoxEmits
|
keyof ConfirmBoxEmits
|
||||||
>((props, { emit, attrs }) => {
|
>((props, { emit, attrs }) => {
|
||||||
const content = ref<TextContentExpose>();
|
|
||||||
const height = ref(200);
|
const height = ref(200);
|
||||||
const selected = ref(props.defaultYes ? true : false);
|
const selected = ref(props.defaultYes ? true : false);
|
||||||
const yesSize = ref<[number, number]>([0, 0]);
|
const yesSize = ref<[number, number]>([0, 0]);
|
||||||
@ -95,7 +94,7 @@ export const ConfirmBox = defineComponent<
|
|||||||
});
|
});
|
||||||
const yesText = computed(() => props.yesText ?? '确认');
|
const yesText = computed(() => props.yesText ?? '确认');
|
||||||
const noText = computed(() => props.noText ?? '取消');
|
const noText = computed(() => props.noText ?? '取消');
|
||||||
const pad = computed(() => props.pad ?? 32);
|
const pad = computed(() => props.pad ?? 24);
|
||||||
const yesLoc = computed<ElementLocator>(() => {
|
const yesLoc = computed<ElementLocator>(() => {
|
||||||
const y = height.value - pad.value;
|
const y = height.value - pad.value;
|
||||||
return [props.width / 3, y, void 0, void 0, 0.5, 1];
|
return [props.width / 3, y, void 0, void 0, 0.5, 1];
|
||||||
@ -151,7 +150,6 @@ export const ConfirmBox = defineComponent<
|
|||||||
/>
|
/>
|
||||||
<TextContent
|
<TextContent
|
||||||
{...attrs}
|
{...attrs}
|
||||||
ref={content}
|
|
||||||
loc={contentLoc.value}
|
loc={contentLoc.value}
|
||||||
text={props.text}
|
text={props.text}
|
||||||
width={props.width - pad.value * 2}
|
width={props.width - pad.value * 2}
|
||||||
|
@ -173,25 +173,26 @@ export const TextContent = defineComponent<
|
|||||||
const renderContent = (canvas: MotaOffscreenCanvas2D) => {
|
const renderContent = (canvas: MotaOffscreenCanvas2D) => {
|
||||||
const ctx = canvas.ctx;
|
const ctx = canvas.ctx;
|
||||||
ctx.textBaseline = 'top';
|
ctx.textBaseline = 'top';
|
||||||
renderable.forEach(v => {
|
for (const data of renderable) {
|
||||||
switch (v.type) {
|
if (data.cut) break;
|
||||||
|
switch (data.type) {
|
||||||
case TextContentType.Text: {
|
case TextContentType.Text: {
|
||||||
if (v.text.length === 0) return;
|
if (data.text.length === 0) continue;
|
||||||
ctx.fillStyle = v.fillStyle;
|
ctx.fillStyle = data.fillStyle;
|
||||||
ctx.strokeStyle = v.strokeStyle;
|
ctx.strokeStyle = data.strokeStyle;
|
||||||
ctx.font = v.font;
|
ctx.font = data.font;
|
||||||
const text = v.text.slice(0, v.pointer);
|
const text = data.text.slice(0, data.pointer);
|
||||||
|
|
||||||
if (props.fill ?? true) {
|
if (props.fill ?? true) {
|
||||||
ctx.fillText(text, v.x, v.y);
|
ctx.fillText(text, data.x, data.y);
|
||||||
}
|
}
|
||||||
if (props.stroke) {
|
if (props.stroke) {
|
||||||
ctx.strokeText(text, v.x, v.y);
|
ctx.strokeText(text, data.x, data.y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TextContentType.Icon: {
|
case TextContentType.Icon: {
|
||||||
const { renderable: r, x: dx, y: dy, width, height } = v;
|
const { renderable: r, x: dx, y: dy, width, height } = data;
|
||||||
const render = r.render;
|
const render = r.render;
|
||||||
const [x, y, w, h] = render[0];
|
const [x, y, w, h] = render[0];
|
||||||
const icon = r.autotile ? r.image[0] : r.image;
|
const icon = r.autotile ? r.image[0] : r.image;
|
||||||
@ -199,7 +200,7 @@ export const TextContent = defineComponent<
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderFunc = (data: TyperRenderable[]) => {
|
const renderFunc = (data: TyperRenderable[]) => {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -95,6 +95,7 @@
|
|||||||
"61": "Unexpected recursive call of $1.update?$2 in render function. Please ensure you have to do this, if you do, ignore this warn.",
|
"61": "Unexpected recursive call of $1.update?$2 in render function. Please ensure you have to do this, if you do, ignore this warn.",
|
||||||
"62": "Recursive fallback fonts in '$1'.",
|
"62": "Recursive fallback fonts in '$1'.",
|
||||||
"63": "Uncaught promise error in waiting box component. Error reason: $1",
|
"63": "Uncaught promise error in waiting box component. Error reason: $1",
|
||||||
|
"64": "Text node type and block type mismatch: '$1' vs '$2'",
|
||||||
"1001": "Item-detail extension needs 'floor-binder' and 'floor-damage' extension as dependency.",
|
"1001": "Item-detail extension needs 'floor-binder' and 'floor-damage' extension as dependency.",
|
||||||
"1101": "Cannot add new effect to point effect instance, for there's no more reserve space for it. Please increase the max count of the instance."
|
"1101": "Cannot add new effect to point effect instance, for there's no more reserve space for it. Please increase the max count of the instance."
|
||||||
}
|
}
|
||||||
|
@ -1222,21 +1222,7 @@ actions.prototype._clickAction = function (x, y, px, py) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
////// 自定义事件时,按下某个键的操作 //////
|
////// 自定义事件时,按下某个键的操作 //////
|
||||||
actions.prototype._keyDownAction = function (keycode) {
|
actions.prototype._keyDownAction = function (keycode) {};
|
||||||
if (core.status.event.data.type == 'choices') {
|
|
||||||
this._keyDownChoices(keycode);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
core.status.event.data.type == 'confirm' &&
|
|
||||||
(keycode == 37 || keycode == 39)
|
|
||||||
) {
|
|
||||||
core.status.event.selection = 1 - core.status.event.selection;
|
|
||||||
core.playSound('光标移动');
|
|
||||||
core.drawConfirmBox(core.status.event.ui.text);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
////// 自定义事件时,放开某个键的操作 //////
|
////// 自定义事件时,放开某个键的操作 //////
|
||||||
actions.prototype._keyUpAction = function (keycode) {
|
actions.prototype._keyUpAction = function (keycode) {
|
||||||
|
Loading…
Reference in New Issue
Block a user