mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-09-23 15:41:48 +08:00
Compare commits
4 Commits
24d9c63de3
...
b50c868b6d
Author | SHA1 | Date | |
---|---|---|---|
b50c868b6d | |||
67bd98d451 | |||
1ce79154d2 | |||
b74c61b8ba |
@ -1,7 +1,7 @@
|
||||
import { DefaultProps, ElementLocator, Font } from '@motajs/render';
|
||||
import { computed, defineComponent, reactive, ref } from 'vue';
|
||||
import { Background, Selection } from './misc';
|
||||
import { TextContent, TextContentExpose, TextContentProps } from './textbox';
|
||||
import { TextContent, TextContentProps } from './textbox';
|
||||
import { TextAlign } from './textboxTyper';
|
||||
import { Page, PageExpose } from './page';
|
||||
import { GameUI, IUIMountable, SetupComponentOptions } from '@motajs/system-ui';
|
||||
@ -83,7 +83,6 @@ export const ConfirmBox = defineComponent<
|
||||
ConfirmBoxEmits,
|
||||
keyof ConfirmBoxEmits
|
||||
>((props, { emit, attrs }) => {
|
||||
const content = ref<TextContentExpose>();
|
||||
const height = ref(200);
|
||||
const selected = ref(props.defaultYes ? true : false);
|
||||
const yesSize = ref<[number, number]>([0, 0]);
|
||||
@ -95,7 +94,7 @@ export const ConfirmBox = defineComponent<
|
||||
});
|
||||
const yesText = computed(() => props.yesText ?? '确认');
|
||||
const noText = computed(() => props.noText ?? '取消');
|
||||
const pad = computed(() => props.pad ?? 32);
|
||||
const pad = computed(() => props.pad ?? 24);
|
||||
const yesLoc = computed<ElementLocator>(() => {
|
||||
const y = height.value - pad.value;
|
||||
return [props.width / 3, y, void 0, void 0, 0.5, 1];
|
||||
@ -151,7 +150,6 @@ export const ConfirmBox = defineComponent<
|
||||
/>
|
||||
<TextContent
|
||||
{...attrs}
|
||||
ref={content}
|
||||
loc={contentLoc.value}
|
||||
text={props.text}
|
||||
width={props.width - pad.value * 2}
|
||||
|
@ -173,25 +173,26 @@ export const TextContent = defineComponent<
|
||||
const renderContent = (canvas: MotaOffscreenCanvas2D) => {
|
||||
const ctx = canvas.ctx;
|
||||
ctx.textBaseline = 'top';
|
||||
renderable.forEach(v => {
|
||||
switch (v.type) {
|
||||
for (const data of renderable) {
|
||||
if (data.cut) break;
|
||||
switch (data.type) {
|
||||
case TextContentType.Text: {
|
||||
if (v.text.length === 0) return;
|
||||
ctx.fillStyle = v.fillStyle;
|
||||
ctx.strokeStyle = v.strokeStyle;
|
||||
ctx.font = v.font;
|
||||
const text = v.text.slice(0, v.pointer);
|
||||
if (data.text.length === 0) continue;
|
||||
ctx.fillStyle = data.fillStyle;
|
||||
ctx.strokeStyle = data.strokeStyle;
|
||||
ctx.font = data.font;
|
||||
const text = data.text.slice(0, data.pointer);
|
||||
|
||||
if (props.fill ?? true) {
|
||||
ctx.fillText(text, v.x, v.y);
|
||||
ctx.fillText(text, data.x, data.y);
|
||||
}
|
||||
if (props.stroke) {
|
||||
ctx.strokeText(text, v.x, v.y);
|
||||
ctx.strokeText(text, data.x, data.y);
|
||||
}
|
||||
break;
|
||||
}
|
||||
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 [x, y, w, h] = render[0];
|
||||
const icon = r.autotile ? r.image[0] : r.image;
|
||||
@ -199,7 +200,7 @@ export const TextContent = defineComponent<
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
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.",
|
||||
"62": "Recursive fallback fonts in '$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.",
|
||||
"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) {
|
||||
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._keyDownAction = function (keycode) {};
|
||||
|
||||
////// 自定义事件时,放开某个键的操作 //////
|
||||
actions.prototype._keyUpAction = function (keycode) {
|
||||
|
Loading…
Reference in New Issue
Block a user