mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-10-20 13:02:58 +08:00
docs: 同步 template 文档
This commit is contained in:
parent
b782aee922
commit
9e6d2e9924
@ -131,4 +131,4 @@ export const MyUI = defineComponent(() => {
|
||||
- 如果不允许交互,那么光标也不会显示
|
||||
- 同 `zIndex` 下,后插入的元素会在上层,但是这也意味着如果是动态插入的元素(例如由于响应式更改而插入了一个新元素),会显示在后面代码的元素之上
|
||||
4. **常见问题**
|
||||
- 参考 [指南](../../guide/ui-faq.md)
|
||||
- 参考 [指南](../../guide/ui/faq.md)
|
||||
|
@ -32,10 +32,10 @@ interface SpriteProps extends BaseProps {
|
||||
|
||||
通过 `render` 函数实现 **动态绘制**,可结合:
|
||||
|
||||
- 基础定位/变换参数(继承 `BaseProps`)
|
||||
- 动画系统(`useAnimation`)
|
||||
- 帧回调(`onTick`)
|
||||
- 自定义图形绘制(路径/滤镜/混合模式)
|
||||
- 基础定位/变换参数(继承 `BaseProps`)
|
||||
- 动画系统(`useAnimation`)
|
||||
- 帧回调(`onTick`)
|
||||
- 自定义图形绘制(路径/滤镜/混合模式)
|
||||
|
||||
**注意**,这个标签虽然非常基础,但是应该并不常用,因为很多内容都有对应的标签可以实现(例如线可以使用 `g-line` 标签等),因此如果你在考虑使用此标签,请确认你必须使用它,或是你的场景对性能非常敏感。
|
||||
|
||||
@ -43,7 +43,7 @@ interface SpriteProps extends BaseProps {
|
||||
|
||||
## 使用示例
|
||||
|
||||
以下的示例代码均应该在**组件内部**编写,哪里是组件内部请参考[指南](../../guide/ui.md)。
|
||||
以下的示例代码均应该在**组件内部**编写,哪里是组件内部请参考[指南](../../guide/ui/ui.md)。
|
||||
|
||||
### 示例 1:基础图形
|
||||
|
||||
@ -67,9 +67,9 @@ const render = (canvas: MotaOffscreenCanvas2D) => {
|
||||
|
||||
**效果**:
|
||||
|
||||
- 100x100 红色方块,中心点位于 (200,200)
|
||||
- 45 度旋转,蓝色描边
|
||||
- 80% 不透明度
|
||||
- 100x100 红色方块,中心点位于 (200,200)
|
||||
- 45 度旋转,蓝色描边
|
||||
- 80% 不透明度
|
||||
|
||||
---
|
||||
|
||||
@ -102,8 +102,8 @@ return () => <sprite loc={loc.value} scale={scale.value} render={render} />;
|
||||
|
||||
**效果**:
|
||||
|
||||
- 矩形横向放大 1.5 倍,横向位置移动 100px
|
||||
- 2 秒线性动画
|
||||
- 矩形横向放大 1.5 倍,横向位置移动 100px
|
||||
- 2 秒线性动画
|
||||
|
||||
---
|
||||
|
||||
@ -137,8 +137,8 @@ return () => (
|
||||
|
||||
**效果**:
|
||||
|
||||
- 鼠标悬浮时添加模糊滤镜
|
||||
- 鼠标悬浮显示指针光标
|
||||
- 鼠标悬浮时添加模糊滤镜
|
||||
- 鼠标悬浮显示指针光标
|
||||
|
||||
---
|
||||
|
||||
|
@ -11,7 +11,7 @@ graph LR
|
||||
|
||||
## 类描述
|
||||
|
||||
`UIController` 是 UI 控制系统的核心类,负责管理 UI 实例的显示栈、背景控制以及多种显示模式。继承自 `EventEmitter`,支持事件监听。想要编写 UI 请参考[深度指南](../../guide/ui.md)。
|
||||
`UIController` 是 UI 控制系统的核心类,负责管理 UI 实例的显示栈、背景控制以及多种显示模式。继承自 `EventEmitter`,支持事件监听。想要编写 UI 请参考[深度指南](../../guide/ui/ui.md)。
|
||||
|
||||
---
|
||||
|
||||
@ -37,8 +37,8 @@ graph LR
|
||||
function constructor(id: string): UIController;
|
||||
```
|
||||
|
||||
- **参数**
|
||||
- `id`: 控制器的唯一标识符(若重复会触发警告日志)
|
||||
- **参数**
|
||||
- `id`: 控制器的唯一标识符(若重复会触发警告日志)
|
||||
|
||||
**示例**
|
||||
|
||||
@ -84,9 +84,9 @@ function setBackground<T extends UIComponent>(
|
||||
|
||||
设置背景 UI 并初始化其实例。
|
||||
|
||||
- **参数**
|
||||
- `back`: 背景 UI 配置实例
|
||||
- `vBind`: 传递给背景组件的 Props 对象
|
||||
- **参数**
|
||||
- `back`: 背景 UI 配置实例
|
||||
- `vBind`: 传递给背景组件的 Props 对象
|
||||
|
||||
**示例**
|
||||
|
||||
@ -156,12 +156,12 @@ function open<T extends UIComponent>(
|
||||
|
||||
打开一个新 UI 实例并加入栈中。
|
||||
|
||||
- **参数**
|
||||
- `ui`: UI 配置实例
|
||||
- `vBind`: 组件 Props
|
||||
- `alwaysShow`: 是否强制显示(默认 `false`)
|
||||
- **返回值**
|
||||
打开的 UI 实例,可以用于关闭等操作
|
||||
- **参数**
|
||||
- `ui`: UI 配置实例
|
||||
- `vBind`: 组件 Props
|
||||
- `alwaysShow`: 是否强制显示(默认 `false`)
|
||||
- **返回值**
|
||||
打开的 UI 实例,可以用于关闭等操作
|
||||
|
||||
**示例**
|
||||
|
||||
@ -191,8 +191,8 @@ function closeAll(ui?: IGameUI): void;
|
||||
|
||||
关闭所有或指定类型的所有 UI 实例。
|
||||
|
||||
- **参数**
|
||||
- `ui`(可选): 指定要关闭的 UI 类型,不填时表示关闭所有 UI
|
||||
- **参数**
|
||||
- `ui`(可选): 指定要关闭的 UI 类型,不填时表示关闭所有 UI
|
||||
|
||||
---
|
||||
|
||||
@ -222,7 +222,7 @@ function showAll(stack?: boolean): void;
|
||||
function showCustom(config: IUICustomConfig): void;
|
||||
```
|
||||
|
||||
切换显示模式:使用自定义模式(需实现 `IUICustomConfig`),参考[指南](../../guide/ui-system.md#自定义显示模式)
|
||||
切换显示模式:使用自定义模式(需实现 `IUICustomConfig`),参考[指南](../../guide/ui/system.md#自定义显示模式)
|
||||
|
||||
---
|
||||
|
||||
|
@ -408,4 +408,4 @@ const userData = await waitbox(
|
||||
4. **额外参考**
|
||||
- [组件 ConfirmBox](./组件%20ConfirmBox.md)
|
||||
- [组件 Choices](./组件%20Choices.md)
|
||||
- [组件 Waitbox](./组件%20Waitbox.md)
|
||||
- [组件 WaitBox](./组件%20WaitBox.md)
|
||||
|
85
docs/api/user-client-modules/组件 FloorSelector.md
Normal file
85
docs/api/user-client-modules/组件 FloorSelector.md
Normal file
@ -0,0 +1,85 @@
|
||||
# FloorSelector 楼层选择器组件 API 文档
|
||||
|
||||
本文档由 `DeepSeek R1` 模型生成并微调。
|
||||
|
||||
## 组件描述
|
||||
|
||||
楼层选择器组件用于在地图浏览或地图选择场景中切换不同楼层,其尺寸与内置状态栏组件匹配,适合在地图浏览时将状态栏替换为此组件。
|
||||
|
||||
---
|
||||
|
||||
## Props 属性说明
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 描述 |
|
||||
| -------- | ------------ | ------ | -------------------- |
|
||||
| `floors` | `FloorIds[]` | 必填 | 可选择的楼层 ID 数组 |
|
||||
| `now` | `number` | - | 当前选中的楼层索引 |
|
||||
|
||||
---
|
||||
|
||||
## Events 事件说明
|
||||
|
||||
| 事件名 | 参数类型 | 触发时机 |
|
||||
| ------------ | ------------------------------------ | ---------------------- |
|
||||
| `close` | - | 点击关闭按钮时触发 |
|
||||
| `update` | `(floor: number, floorId: FloorIds)` | 当选中的楼层改变时触发 |
|
||||
| `update:now` | `(value: number)` | v-model 双向绑定事件 |
|
||||
|
||||
---
|
||||
|
||||
## Slots 插槽说明
|
||||
|
||||
无插槽
|
||||
|
||||
---
|
||||
|
||||
## Exposed Methods 暴露方法
|
||||
|
||||
无暴露方法
|
||||
|
||||
---
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础用法 - 地图浏览界面
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { FloorSelector, STATUS_BAR_HEIGHT } from '@user/client-modules';
|
||||
|
||||
export const MapBrowserCom = defineComponent(() => {
|
||||
const currentFloor = ref(0);
|
||||
|
||||
// 可用的楼层列表
|
||||
const availableFloors = core.floorIds;
|
||||
|
||||
const handleFloorChange = (floorIndex: number, floorId: string) => {
|
||||
console.log(`切换到楼层: ${floorId} (索引: ${floorIndex})`);
|
||||
// 这里可以执行切换楼层的逻辑
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
console.log('关闭楼层选择器');
|
||||
// 返回主界面或执行其他关闭逻辑
|
||||
};
|
||||
|
||||
return () => (
|
||||
<FloorSelector
|
||||
loc={[0, 0, 180, STATUS_BAR_HEIGHT]}
|
||||
floors={availableFloors}
|
||||
v-model:now={currentFloor.value}
|
||||
onUpdate={handleFloorChange}
|
||||
onClose={handleClose}
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **尺寸匹配**: 组件设计为与内置状态栏尺寸匹配,可直接替换
|
||||
2. **索引基准**: 楼层索引从 0 开始
|
||||
3. **内置集成**: 通常不需要直接使用,因为样板已内置完整的地图浏览界面
|
||||
4. **倒序排列**: 楼层列表会自动倒序排列
|
113
docs/api/user-client-modules/组件 Input.md
Normal file
113
docs/api/user-client-modules/组件 Input.md
Normal file
@ -0,0 +1,113 @@
|
||||
# Input 输入框组件 API 文档
|
||||
|
||||
本文档由 `DeepSeek` 生成并微调。
|
||||
|
||||
## 组件描述
|
||||
|
||||
输入框组件用于接收用户的文本输入,支持单行和多行模式,提供边框样式自定义和实时/确认两种值变化事件。
|
||||
|
||||
---
|
||||
|
||||
## Props 属性说明
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 描述 |
|
||||
| ------------------------- | ------------------- | ------- | ----------------------------------------------------- |
|
||||
| `placeholder` | `string` | - | 输入框的提示内容 |
|
||||
| `value` | `string` | - | 输入框的值 |
|
||||
| `multiline` | `boolean` | `false` | 是否是多行输入,多行输入时允许换行 |
|
||||
| `border` | `string` | - | 边框颜色 |
|
||||
| `circle` | `RectRCircleParams` | - | 边框圆角 |
|
||||
| `borderWidth` | `number` | - | 边框宽度 |
|
||||
| `pad` | `number` | - | 内边距 |
|
||||
| 继承自 `TextContentProps` | - | - | [查看完整属性](./组件%20TextContent#Props%20属性说明) |
|
||||
|
||||
---
|
||||
|
||||
## Events 事件说明
|
||||
|
||||
| 事件名 | 参数类型 | 触发时机 |
|
||||
| -------------- | ----------------- | ---------------------------------------- |
|
||||
| `change` | `(value: string)` | 当输入框的值被确认时触发,例如失焦时 |
|
||||
| `input` | `(value: string)` | 当输入框的值发生改变时触发,例如实时输入 |
|
||||
| `update:value` | `(value: string)` | v-model 双向绑定事件 |
|
||||
|
||||
---
|
||||
|
||||
## Slots 插槽说明
|
||||
|
||||
无插槽
|
||||
|
||||
---
|
||||
|
||||
## Exposed Methods 暴露方法
|
||||
|
||||
无暴露方法
|
||||
|
||||
---
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础用法 - 单行输入框
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { Input } from '@user/client-modules';
|
||||
|
||||
export const MyCom = defineComponent(() => {
|
||||
const inputValue = ref('');
|
||||
|
||||
const handleChange = (value: string) => {
|
||||
console.log('输入确认:', value);
|
||||
};
|
||||
|
||||
const handleInput = (value: string) => {
|
||||
console.log('实时输入:', value);
|
||||
};
|
||||
|
||||
return () => (
|
||||
<Input
|
||||
placeholder="请输入文本"
|
||||
v-model={inputValue.value}
|
||||
onChange={handleChange}
|
||||
onInput={handleInput}
|
||||
loc={[208, 208, 300, 40, 0.5, 0.5]}
|
||||
border="#ccc"
|
||||
borderWidth={1}
|
||||
circle={[4]}
|
||||
pad={8}
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 多行文本输入
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { Input } from '@user/client-modules';
|
||||
|
||||
export const MyCom = defineComponent(() => {
|
||||
const multilineValue = ref('');
|
||||
|
||||
return () => (
|
||||
<Input
|
||||
multiline
|
||||
placeholder="请输入多行文本..."
|
||||
v-model={multilineValue.value}
|
||||
loc={[208, 208, 300, 120, 0.5, 0.5]}
|
||||
border="#007acc"
|
||||
borderWidth={2}
|
||||
circle={[8]}
|
||||
pad={12}
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **事件区别**:`input` 事件在每次输入时触发,`change` 事件在失焦或确认时触发
|
||||
2. **多行模式**:启用 `multiline` 后支持换行输入,高度需要足够容纳多行文本
|
||||
3. **样式继承**:支持从 `TextContentProps` 继承文本相关样式属性
|
315
docs/api/user-client-modules/组件 InputBox.md
Normal file
315
docs/api/user-client-modules/组件 InputBox.md
Normal file
@ -0,0 +1,315 @@
|
||||
# InputBox 输入对话框组件 API 文档
|
||||
|
||||
本文档由 `DeepSeek` 生成并微调。
|
||||
|
||||
## 组件描述
|
||||
|
||||
输入对话框组件是一个完整的弹出式输入界面,包含提示文本、输入框、确认和取消按钮。适用于需要用户输入文本的交互场景,提供了便捷的异步获取输入方法。
|
||||
|
||||
---
|
||||
|
||||
## Props 属性说明
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 描述 |
|
||||
| ------------------------- | ---------------- | -------- | ----------------------------------------------------- |
|
||||
| `loc` | `ElementLocator` | 必填 | 输入框对话框的位置 |
|
||||
| `input` | `InputProps` | - | 传递给内部 Input 组件的配置参数 |
|
||||
| `winskin` | `ImageIds` | - | 窗口皮肤图片ID,用于对话框背景绘制 |
|
||||
| `color` | `CanvasStyle` | - | 对话框背景颜色(未设置 winskin 时生效) |
|
||||
| `border` | `CanvasStyle` | - | 对话框边框颜色(未设置 winskin 时生效) |
|
||||
| `pad` | `number` | - | 对话框内部所有元素的内边距 |
|
||||
| `inputHeight` | `number` | - | 内部输入框区域的高度 |
|
||||
| `text` | `string` | - | 对话框顶部的提示文本 |
|
||||
| `yesText` | `string` | `"确认"` | 确认按钮的显示文本 |
|
||||
| `noText` | `string` | `"取消"` | 取消按钮的显示文本 |
|
||||
| `selFont` | `Font` | - | 确认/取消按钮的字体样式 |
|
||||
| `selFill` | `CanvasStyle` | - | 确认/取消按钮的文本颜色 |
|
||||
| 继承自 `TextContentProps` | - | - | [查看完整属性](./组件%20TextContent#Props%20属性说明) |
|
||||
|
||||
---
|
||||
|
||||
## Events 事件说明
|
||||
|
||||
| 事件名 | 参数类型 | 触发时机 |
|
||||
| -------------- | ----------------- | ------------------------------------------ |
|
||||
| `confirm` | `(value: string)` | 当确认输入框的内容时触发 |
|
||||
| `cancel` | `(value: string)` | 当取消时触发 |
|
||||
| `change` | `(value: string)` | 继承自 Input 组件 - 输入框值被确认时触发 |
|
||||
| `input` | `(value: string)` | 继承自 Input 组件 - 输入框值实时变化时触发 |
|
||||
| `update:value` | `(value: string)` | 继承自 Input 组件 - v-model 双向绑定 |
|
||||
|
||||
---
|
||||
|
||||
## Slots 插槽说明
|
||||
|
||||
无插槽
|
||||
|
||||
---
|
||||
|
||||
## Exposed Methods 暴露方法
|
||||
|
||||
无暴露方法
|
||||
|
||||
---
|
||||
|
||||
## 工具函数
|
||||
|
||||
### `getInput(controller, text, loc, width, props?)`
|
||||
|
||||
弹出一个输入框并异步返回用户输入的结果。
|
||||
|
||||
**参数**
|
||||
|
||||
- `controller: IUIMountable` - UI 控制器
|
||||
- `text: string` - 提示文本内容
|
||||
- `loc: ElementLocator` - 确认框的位置
|
||||
- `width: number` - 确认框的宽度
|
||||
- `props?: InputBoxProps` - 额外的配置属性(可选)
|
||||
|
||||
**返回值**: `Promise<string>`
|
||||
|
||||
### `getInputNumber(controller, text, loc, width, props?)`
|
||||
|
||||
与 `getInput` 类似,但会将结果转换为数字。
|
||||
|
||||
**参数**: 同 `getInput`
|
||||
**返回值**: `Promise<number>`
|
||||
|
||||
---
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础用法 - 组件形式
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { InputBox } from '@user/client-modules';
|
||||
|
||||
export const MyCom = defineComponent(() => {
|
||||
const handleConfirm = (value: string) => {
|
||||
console.log('用户输入:', value);
|
||||
// 处理用户输入
|
||||
};
|
||||
|
||||
const handleCancel = (value: string) => {
|
||||
console.log('用户取消输入,最后值为:', value);
|
||||
};
|
||||
|
||||
return () => (
|
||||
<InputBox
|
||||
text="请输入您的姓名:"
|
||||
loc={[240, 240, 300, 180, 0.5, 0.5]}
|
||||
input={{
|
||||
placeholder: '在此输入姓名',
|
||||
border: '#007acc',
|
||||
borderWidth: 1,
|
||||
circle: [4],
|
||||
pad: 8
|
||||
}}
|
||||
color="#ffffff"
|
||||
border="#cccccc"
|
||||
borderWidth={2}
|
||||
pad={16}
|
||||
inputHeight={40}
|
||||
yesText="确定"
|
||||
noText="取消"
|
||||
onConfirm={handleConfirm}
|
||||
onCancel={handleCancel}
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 使用 getInput 工具函数(推荐)
|
||||
|
||||
```tsx
|
||||
import { defineComponent } from 'vue';
|
||||
import { getInput, getInputNumber } from '@user/client-modules';
|
||||
|
||||
export const MyCom = defineComponent(props => {
|
||||
const handleGetName = async () => {
|
||||
// 获取文本输入
|
||||
const name = await getInput(
|
||||
props.controller,
|
||||
'请输入您的姓名:',
|
||||
[208, 208, void 0, void 0, 0.5, 0.5],
|
||||
280,
|
||||
{
|
||||
input: {
|
||||
placeholder: '姓名'
|
||||
},
|
||||
color: '#f8f8f8'
|
||||
}
|
||||
);
|
||||
|
||||
if (name) {
|
||||
console.log('用户姓名:', name);
|
||||
// 处理姓名
|
||||
} else {
|
||||
console.log('用户取消了输入');
|
||||
}
|
||||
};
|
||||
|
||||
const handleGetAge = async () => {
|
||||
// 获取数字输入
|
||||
const age = await getInputNumber(
|
||||
props.controller,
|
||||
'请输入您的年龄:',
|
||||
[208, 208, void 0, void 0, 0.5, 0.5],
|
||||
280
|
||||
);
|
||||
|
||||
if (!isNaN(age)) {
|
||||
console.log('用户年龄:', age);
|
||||
// 处理年龄
|
||||
}
|
||||
};
|
||||
|
||||
return () => (
|
||||
<container>
|
||||
<text
|
||||
loc={[240, 180, void 0, void 0, 0.5, 0.5]}
|
||||
onClick={handleGetName}
|
||||
text="输入姓名"
|
||||
/>
|
||||
<text
|
||||
loc={[240, 220, void 0, void 0, 0.5, 0.5]}
|
||||
onClick={handleGetAge}
|
||||
text="输入年龄"
|
||||
/>
|
||||
</container>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 带自定义样式的输入对话框
|
||||
|
||||
```tsx
|
||||
import { defineComponent } from 'vue';
|
||||
import { getInput } from '@user/client-modules';
|
||||
|
||||
export const StyledInputCom = defineComponent(props => {
|
||||
const handleStyledInput = async () => {
|
||||
const value = await getInput(
|
||||
props.controller,
|
||||
'请输入任务描述:',
|
||||
[240, 240, void 0, void 0, 0.5, 0.5],
|
||||
320,
|
||||
{
|
||||
text: '任务创建',
|
||||
input: {
|
||||
placeholder: '描述任务内容...',
|
||||
multiline: true,
|
||||
border: '#4CAF50',
|
||||
borderWidth: 2,
|
||||
circle: 8,
|
||||
pad: 12
|
||||
},
|
||||
color: '#ffffff',
|
||||
border: '#4CAF50',
|
||||
borderWidth: 3,
|
||||
pad: 20,
|
||||
inputHeight: 80,
|
||||
yesText: '创建',
|
||||
noText: '取消',
|
||||
selFill: '#4CAF50'
|
||||
}
|
||||
);
|
||||
|
||||
if (value) {
|
||||
console.log('创建任务:', value);
|
||||
}
|
||||
};
|
||||
|
||||
return () => (
|
||||
<text
|
||||
loc={[240, 240, void 0, void 0, 0.5, 0.5]}
|
||||
onClick={handleStyledInput}
|
||||
text="创建新任务"
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 游戏中的设置界面
|
||||
|
||||
```tsx
|
||||
import { defineComponent } from 'vue';
|
||||
import { getInput } from '@user/client-modules';
|
||||
|
||||
export const SettingsCom = defineComponent(props => {
|
||||
const settings = ref({
|
||||
playerName: '玩家',
|
||||
serverIP: '127.0.0.1'
|
||||
});
|
||||
|
||||
const changePlayerName = async () => {
|
||||
const newName = await getInput(
|
||||
props.controller,
|
||||
'修改玩家名称:',
|
||||
[240, 240, void 0, void 0, 0.5, 0.5],
|
||||
280,
|
||||
{
|
||||
input: {
|
||||
value: settings.value.playerName,
|
||||
placeholder: '玩家名称',
|
||||
border: '#FF9800',
|
||||
borderWidth: 1
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (newName) {
|
||||
settings.value.playerName = newName;
|
||||
console.log('玩家名称已更新:', newName);
|
||||
}
|
||||
};
|
||||
|
||||
const changeServerIP = async () => {
|
||||
const newIP = await getInput(
|
||||
props.controller,
|
||||
'修改服务器IP:',
|
||||
[240, 240, void 0, void 0, 0.5, 0.5],
|
||||
280,
|
||||
{
|
||||
input: {
|
||||
value: settings.value.serverIP,
|
||||
placeholder: '服务器IP地址',
|
||||
border: '#2196F3',
|
||||
borderWidth: 1
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (newIP) {
|
||||
settings.value.serverIP = newIP;
|
||||
console.log('服务器IP已更新:', newIP);
|
||||
}
|
||||
};
|
||||
|
||||
return () => (
|
||||
<container loc={[240, 240, 300, 200, 0.5, 0.5]}>
|
||||
<text
|
||||
loc={[0, -40, void 0, void 0, 0.5, 0.5]}
|
||||
onClick={changePlayerName}
|
||||
text={`玩家名称: ${settings.value.playerName}`}
|
||||
/>
|
||||
<text
|
||||
loc={[0, 0, void 0, void 0, 0.5, 0.5]}
|
||||
onClick={changeServerIP}
|
||||
text={`服务器IP: ${settings.value.serverIP}`}
|
||||
/>
|
||||
</container>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **推荐使用工具函数**: `getInput` 和 `getInputNumber` 提供了更简洁的异步输入获取方式
|
||||
2. **宽度设置**: 在使用工具函数时,高度由组件自动计算,只需指定宽度
|
||||
3. **皮肤优先级**: 如果设置了 `winskin`,则 `color` 和 `border` 设置将失效
|
||||
4. **异步处理**: 工具函数返回 Promise,需要使用 `await` 或 `.then()` 处理结果
|
||||
5. **空值处理**: 用户取消输入时,`getInput` 返回空字符串,`getInputNumber` 返回 `NaN`
|
184
docs/api/user-client-modules/组件 List.md
Normal file
184
docs/api/user-client-modules/组件 List.md
Normal file
@ -0,0 +1,184 @@
|
||||
# List 列表组件 API 文档
|
||||
|
||||
本文档由 `DeepSeek` 生成并微调。
|
||||
|
||||
## 组件描述
|
||||
|
||||
列表组件用于展示可选择的项目列表,内置滚动条功能和选中项高亮效果。适用于菜单选择、内容导航、设置选项等场景。
|
||||
|
||||
---
|
||||
|
||||
## Props 属性说明
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 描述 |
|
||||
| ------------ | -------------------- | ------ | ------------------------------- |
|
||||
| `list` | `[string, string][]` | 必填 | 列表内容,[id, 显示文本] 的数组 |
|
||||
| `selected` | `string` | 必填 | 当前选中的项 ID |
|
||||
| `loc` | `ElementLocator` | 必填 | 列表的位置和尺寸 |
|
||||
| `lineHeight` | `number` | `18` | 每行的高度 |
|
||||
| `font` | `Font` | - | 列表项的字体样式 |
|
||||
| `winskin` | `ImageIds` | - | 使用 winskin 作为光标背景 |
|
||||
| `color` | `CanvasStyle` | - | 使用指定样式作为光标背景 |
|
||||
| `border` | `CanvasStyle` | - | 使用指定样式作为光标边框 |
|
||||
| `alphaRange` | `[number, number]` | - | 选择图标的不透明度范围 |
|
||||
|
||||
---
|
||||
|
||||
## Events 事件说明
|
||||
|
||||
| 事件名 | 参数类型 | 触发时机 |
|
||||
| ----------------- | ----------------- | ---------------------- |
|
||||
| `update` | `(key: string)` | 当用户选中某一项时触发 |
|
||||
| `update:selected` | `(value: string)` | v-model 双向绑定事件 |
|
||||
|
||||
---
|
||||
|
||||
## Slots 插槽说明
|
||||
|
||||
无插槽
|
||||
|
||||
---
|
||||
|
||||
## Exposed Methods 暴露方法
|
||||
|
||||
无暴露方法
|
||||
|
||||
---
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础用法 - 简单列表
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { List } from '@user/client-modules';
|
||||
|
||||
export const MyCom = defineComponent(() => {
|
||||
const selectedItem = ref('item1');
|
||||
|
||||
// 列表数据:[id, 显示文本]
|
||||
const listData = [
|
||||
['item1', '第一项'],
|
||||
['item2', '第二项'],
|
||||
['item3', '第三项'],
|
||||
['item4', '第四项']
|
||||
];
|
||||
|
||||
const handleSelect = (key: string) => {
|
||||
console.log('选中项:', key);
|
||||
selectedItem.value = key;
|
||||
};
|
||||
|
||||
return () => (
|
||||
<List
|
||||
list={listData}
|
||||
v-model:selected={selectedItem.value}
|
||||
loc={[0, 0, 100, 300, 0, 0]}
|
||||
selected={selectedItem.value}
|
||||
onUpdate={handleSelect}
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 带样式的列表
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { List } from '@user/client-modules';
|
||||
|
||||
export const StyledListCom = defineComponent(() => {
|
||||
const selected = ref('opt2');
|
||||
|
||||
const options = [
|
||||
['opt1', '开始游戏'],
|
||||
['opt2', '游戏设置'],
|
||||
['opt3', '帮助文档'],
|
||||
['opt4', '关于我们']
|
||||
];
|
||||
|
||||
return () => (
|
||||
<List
|
||||
list={options}
|
||||
v-model:selected={selected.value}
|
||||
loc={[0, 0, 100, 300, 0, 0]}
|
||||
lineHeight={24}
|
||||
color="#e3f2fd"
|
||||
border="#2196f3"
|
||||
borderWidth={1}
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 使用皮肤图片的列表
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { List } from '@user/client-modules';
|
||||
|
||||
export const SkinnedListCom = defineComponent(() => {
|
||||
const currentSelection = ref('cat');
|
||||
|
||||
const animalList = [
|
||||
['cat', '猫咪'],
|
||||
['dog', '小狗'],
|
||||
['bird', '小鸟'],
|
||||
['fish', '小鱼']
|
||||
];
|
||||
|
||||
const handleUpdate = key => {
|
||||
const item = animalList.find(item => item[0] === key)?.[1];
|
||||
currentSelection.value = key;
|
||||
console.log('选择了:', item);
|
||||
};
|
||||
|
||||
return () => (
|
||||
<List
|
||||
list={animalList}
|
||||
selected={currentSelection.value}
|
||||
loc={[0, 0, 100, 300, 0, 0]}
|
||||
winskin="winskin.png"
|
||||
lineHeight={20}
|
||||
onUpdate={handleUpdate}
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 长列表滚动示例
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { List } from '@user/client-modules';
|
||||
|
||||
export const ScrollListCom = defineComponent(() => {
|
||||
const selected = ref('item5');
|
||||
|
||||
// 创建长列表数据
|
||||
const longList = Array.from({ length: 20 }, (_, i) => [
|
||||
`item${i + 1}`,
|
||||
`列表项 ${i + 1}`
|
||||
]);
|
||||
|
||||
return () => (
|
||||
<List
|
||||
list={longList}
|
||||
v-model:selected={selected.value}
|
||||
loc={[0, 0, 100, 300, 0, 0]}
|
||||
lineHeight={20}
|
||||
color="#fff3e0"
|
||||
border="#ff9800"
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **数据格式**: `list` 属性需要 `[id, text]` 格式的二维数组
|
||||
2. **选中状态**: `selected` 需要与列表项中的 id 匹配
|
||||
3. **滚动支持**: 自动显示滚动条
|
||||
4. **样式优先级**: 如果设置了 `winskin`,则 `color` 和 `border` 设置将失效
|
226
docs/api/user-client-modules/组件 ListPage.md
Normal file
226
docs/api/user-client-modules/组件 ListPage.md
Normal file
@ -0,0 +1,226 @@
|
||||
# ListPage 列表页面组件 API 文档
|
||||
|
||||
本文档由 `DeepSeek` 生成并微调。
|
||||
|
||||
## 组件描述
|
||||
|
||||
列表页面组件结合了列表选择和内容展示功能,左侧显示可选项列表,右侧显示选中项的详细内容。适用于说明文档、设置界面、内容导航等场景。
|
||||
|
||||
---
|
||||
|
||||
## Props 属性说明
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 描述 |
|
||||
| ------------------ | ---------------- | ------- | ---------------------------------------------- |
|
||||
| `loc` | `ElementLocator` | 必填 | 组件整体位置和尺寸 |
|
||||
| `basis` | `number` | - | 列表区域所占比例 |
|
||||
| `right` | `boolean` | `false` | 列表是否排列在右侧 |
|
||||
| `close` | `boolean` | `false` | 是否显示关闭按钮 |
|
||||
| `closeLoc` | `ElementLocator` | - | 关闭按钮的位置(相对于组件定位) |
|
||||
| 继承自 `ListProps` | - | - | [查看完整属性](./组件%20List#Props%20属性说明) |
|
||||
|
||||
---
|
||||
|
||||
## Events 事件说明
|
||||
|
||||
| 事件名 | 参数类型 | 触发时机 |
|
||||
| ----------------- | ----------------- | ------------------------------------ |
|
||||
| `close` | - | 当用户点击关闭按钮时触发 |
|
||||
| `update` | `(key: string)` | 继承自 List - 当用户选中某一项时触发 |
|
||||
| `update:selected` | `(value: string)` | 继承自 List - v-model 双向绑定事件 |
|
||||
|
||||
---
|
||||
|
||||
## Slots 插槽说明
|
||||
|
||||
### `default`
|
||||
|
||||
接收当前选中的 key 并返回对应的内容
|
||||
|
||||
**参数**
|
||||
|
||||
- `key: string` 当前选中的项 ID
|
||||
|
||||
### 具名插槽
|
||||
|
||||
以列表项 ID 为名称的具名插槽,用于定义每个选项对应的详细内容
|
||||
|
||||
---
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础用法 - 说明文档界面
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { ListPage } from '@user/client-modules';
|
||||
|
||||
export const HelpCom = defineComponent(() => {
|
||||
const selected = ref('intro');
|
||||
|
||||
const helpTopics = [
|
||||
['intro', '功能介绍'],
|
||||
['usage', '使用方法'],
|
||||
['settings', '设置说明'],
|
||||
['faq', '常见问题']
|
||||
];
|
||||
|
||||
return () => (
|
||||
<ListPage
|
||||
list={helpTopics}
|
||||
v-model:selected={selected.value}
|
||||
loc={[208, 208, 400, 300, 0.5, 0.5]}
|
||||
basis={0.3}
|
||||
>
|
||||
{{
|
||||
// 使用具名插槽定义每个选项的内容
|
||||
intro: () => (
|
||||
<container>
|
||||
<text text="这里是最新版本的功能介绍..." loc={[0, 0]} />
|
||||
<text text="欢迎使用本系统" loc={[0, 40]} />
|
||||
</container>
|
||||
),
|
||||
usage: () => (
|
||||
<container>
|
||||
<text text="使用方法指南" loc={[0, 0]} />
|
||||
<text text="1. 点击左侧菜单选择功能" loc={[0, 40]} />
|
||||
<text text="2. 在右侧查看详细说明" loc={[0, 80]} />
|
||||
</container>
|
||||
),
|
||||
settings: () => <text text="设置说明内容..." loc={[0, 0]} />,
|
||||
faq: () => <text text="常见问题解答..." loc={[0, 0]} />
|
||||
}}
|
||||
</ListPage>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 使用默认插槽
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { ListPage } from '@user/client-modules';
|
||||
|
||||
export const SimpleCom = defineComponent(() => {
|
||||
const selected = ref('item1');
|
||||
|
||||
const items = [
|
||||
['item1', '选项一'],
|
||||
['item2', '选项二'],
|
||||
['item3', '选项三']
|
||||
];
|
||||
|
||||
return () => (
|
||||
<ListPage
|
||||
list={items}
|
||||
v-model:selected={selected.value}
|
||||
loc={[208, 208, 350, 250, 0.5, 0.5]}
|
||||
>
|
||||
{key => (
|
||||
<container>
|
||||
<text
|
||||
text={`当前选中: ${items.find(item => item[0] === key)?.[1]}`}
|
||||
loc={[0, 0]}
|
||||
/>
|
||||
<text text={`ID: ${key}`} loc={[0, 30]} />
|
||||
</container>
|
||||
)}
|
||||
</ListPage>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 带关闭按钮的弹窗
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { ListPage } from '@user/client-modules';
|
||||
|
||||
export const ModalCom = defineComponent(props => {
|
||||
const selected = ref('weapon');
|
||||
|
||||
const gameItems = [
|
||||
['weapon', '武器'],
|
||||
['armor', '防具'],
|
||||
['potion', '药水'],
|
||||
['material', '材料']
|
||||
];
|
||||
|
||||
const handleClose = () => {
|
||||
props.controller.close(props.instance);
|
||||
console.log('关闭物品栏');
|
||||
};
|
||||
|
||||
return () => (
|
||||
<ListPage
|
||||
list={gameItems}
|
||||
v-model:selected={selected.value}
|
||||
loc={[208, 208, 400, 320, 0.5, 0.5]}
|
||||
close
|
||||
// 设定关闭按钮的位置
|
||||
closeLoc={[0, 300]}
|
||||
basis={0.35}
|
||||
onClose={handleClose}
|
||||
>
|
||||
{{
|
||||
weapon: () => (
|
||||
<container>
|
||||
<text text="武器列表" loc={[0, 0]} />
|
||||
<text text="• 长剑" loc={[0, 30]} />
|
||||
<text text="• 弓箭" loc={[0, 60]} />
|
||||
<text text="• 法杖" loc={[0, 90]} />
|
||||
</container>
|
||||
),
|
||||
armor: () => <text text="防具装备信息..." loc={[0, 0]} />,
|
||||
potion: () => <text text="药水效果说明..." loc={[0, 0]} />,
|
||||
material: () => <text text="合成材料列表..." loc={[0, 0]} />
|
||||
}}
|
||||
</ListPage>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 列表在右侧的布局
|
||||
|
||||
```tsx
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { ListPage } from '@user/client-modules';
|
||||
|
||||
export const RightListCom = defineComponent(() => {
|
||||
const selected = ref('profile');
|
||||
|
||||
const menuItems = [
|
||||
['profile', '个人资料'],
|
||||
['security', '安全设置'],
|
||||
['privacy', '隐私设置'],
|
||||
['notifications', '通知设置']
|
||||
];
|
||||
|
||||
return () => (
|
||||
<ListPage
|
||||
list={menuItems}
|
||||
v-model:selected={selected.value}
|
||||
loc={[240, 240, 500, 280, 0.5, 0.5]}
|
||||
right
|
||||
basis={0.4}
|
||||
>
|
||||
{key => (
|
||||
<container>
|
||||
<text text="显示一些内容..." loc={[0, 60]} />
|
||||
<text text="这里是详细的设置内容..." loc={[0, 0]} />
|
||||
</container>
|
||||
)}
|
||||
</ListPage>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **插槽使用**: 可以使用具名插槽(以列表项 ID 为名)或默认插槽来定义内容
|
||||
2. **布局控制**: 通过 `basis` 控制列表区域比例,`right` 控制列表位置
|
||||
3. **关闭功能**: 设置 `close` 为 `true` 显示关闭按钮,通过 `closeLoc` 自定义位置
|
||||
4. **事件处理**: `close` 事件需要手动处理界面关闭逻辑
|
||||
5. **内容更新**: 切换列表选项时,右侧内容会自动更新为对应插槽的内容
|
119
docs/api/user-client-modules/组件 Thumbnail.md
Normal file
119
docs/api/user-client-modules/组件 Thumbnail.md
Normal file
@ -0,0 +1,119 @@
|
||||
# Thumbnail 地图缩略图组件 API 文档
|
||||
|
||||
本文档由 `DeepSeek` 生成并微调。
|
||||
|
||||
## 组件描述
|
||||
|
||||
地图缩略图组件用于在游戏界面中显示当前楼层的迷你地图,可展示地图布局、角色位置、伤害区域等信息。适用于小地图显示、地图预览等场景。
|
||||
|
||||
---
|
||||
|
||||
## Props 属性说明
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 描述 |
|
||||
| ---------- | ---------------- | ------ | -------------------------------------- |
|
||||
| `loc` | `ElementLocator` | 必填 | 缩略图的位置和尺寸 |
|
||||
| `floorId` | `FloorIds` | 必填 | 楼层 ID |
|
||||
| `padStyle` | `CanvasStyle` | - | 缩略图填充样式 |
|
||||
| `map` | `Block[]` | - | 楼层信息 |
|
||||
| `hero` | `HeroStatus` | - | 角色信息 |
|
||||
| `damage` | `boolean` | - | 是否显示地图伤害 |
|
||||
| `all` | `boolean` | - | 是否完全展示地图(false 时只显示部分) |
|
||||
| `noHD` | `boolean` | - | 是否使用高清模式 |
|
||||
| `size` | `number` | - | 缩略图的比例(1 表示与实际地图一致) |
|
||||
|
||||
---
|
||||
|
||||
## Events 事件说明
|
||||
|
||||
无事件
|
||||
|
||||
---
|
||||
|
||||
## Slots 插槽说明
|
||||
|
||||
无插槽
|
||||
|
||||
---
|
||||
|
||||
## Exposed Methods 暴露方法
|
||||
|
||||
无暴露方法
|
||||
|
||||
---
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 基础用法 - 显示当前楼层缩略图
|
||||
|
||||
```tsx
|
||||
import { defineComponent } from 'vue';
|
||||
import { Thumbnail } from '@user/client-modules';
|
||||
|
||||
export const MiniMapCom = defineComponent(() => {
|
||||
return () => (
|
||||
<Thumbnail
|
||||
loc={[400, 50, 120, 120, 1, 0]}
|
||||
floorId="main_floor"
|
||||
padStyle="#2c3e50"
|
||||
size={0.1}
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 带角色位置的小地图
|
||||
|
||||
```tsx
|
||||
import { defineComponent } from 'vue';
|
||||
import { Thumbnail } from '@user/client-modules';
|
||||
|
||||
export const GameHUDCom = defineComponent(props => {
|
||||
const heroStatus: HeroStatus = {
|
||||
// 角色状态信息
|
||||
loc: { x: 100, y: 150 }
|
||||
// ... 其他角色属性
|
||||
};
|
||||
|
||||
return () => (
|
||||
<container loc={[400, 50, 150, 150, 1, 0]}>
|
||||
<Thumbnail
|
||||
loc={[0, 0, 150, 150, 0.5, 0.5]}
|
||||
floorId="dungeon_1"
|
||||
hero={heroStatus}
|
||||
padStyle="#34495e"
|
||||
damage
|
||||
size={0.08}
|
||||
/>
|
||||
<text text="小地图" loc={[0, 0]} />
|
||||
</container>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
### 完整地图预览
|
||||
|
||||
```tsx
|
||||
import { defineComponent } from 'vue';
|
||||
import { Thumbnail } from '@user/client-modules';
|
||||
|
||||
export const MapPreviewCom = defineComponent(() => {
|
||||
return () => (
|
||||
<Thumbnail
|
||||
loc={[240, 240, 300, 300, 0.5, 0.5]}
|
||||
floorId="boss_arena"
|
||||
all
|
||||
padStyle="#1a1a1a"
|
||||
size={0.3}
|
||||
/>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **楼层标识**: `floorId` 必须与游戏中的楼层标识匹配
|
||||
2. **比例控制**: `size` 参数控制缩略图与实际地图的比例关系
|
||||
3. **显示范围**: `all` 为 false 时,大地图只会显示当前可视区域
|
@ -28,7 +28,7 @@ lang: zh-CN
|
||||
|
||||
相比于 2.10.3 及 2.A,有如下改动:
|
||||
|
||||
- [系统说明](./system)
|
||||
- [UI 编写](./ui)
|
||||
- [UI 系统](./ui/system)
|
||||
- [音频系统](./audio)
|
||||
- [系统说明](./system.md)
|
||||
- [UI 编写](./ui/ui.md)
|
||||
- [UI 系统](./ui/system.md)
|
||||
- [音频系统](./audio.md)
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
## 定义动画属性
|
||||
|
||||
我们以一个自定义 UI 为例,来讲述如何编写一段动画。自定义 UI 参考[此指南](./new-ui.md)和[此教程](../../guide/ui.md)。
|
||||
我们以一个自定义 UI 为例,来讲述如何编写一段动画。自定义 UI 参考[此指南](./new-ui.md)和[此教程](../../guide/ui/ui.md)。
|
||||
|
||||
假设自定义 UI 在 `packages-user/client-modules/src/render/ui` 文件夹下,我们需要引入 `transitioned` 接口,并调用它定义动画属性:
|
||||
|
||||
|
@ -275,7 +275,7 @@ export const MyCom = defineComponent(props => {
|
||||
|
||||
- [ConfirmBox](../../api/user-client-modules/组件%20ConfirmBox.md)
|
||||
- [Choices](../../api/user-client-modules/组件%20Choices.md)
|
||||
- [Waitbox](../../api/user-client-modules/组件%20Waitbox.md)
|
||||
- [WaitBox](../../api/user-client-modules/组件%20WaitBox.md)
|
||||
- [getConfirm](../../api/user-client-modules/functions.md#getconfirm)
|
||||
- [getChoice](../../api/user-client-modules/functions.md#getchoice)
|
||||
- [waitbox](../../api/user-client-modules/functions.md#waitbox)
|
||||
- [waitbox 方法](../../api/user-client-modules/functions.md#waitbox)
|
||||
|
@ -14,7 +14,7 @@
|
||||
- [新增勇士属性](./status-bar.md#拓展-新增勇士属性) (既包含客户端,也包含数据端)
|
||||
- [编写新 UI](./new-ui.md)
|
||||
- [UI 与组件的区别](./new-ui.md#拓展-ui-与组件的区别)
|
||||
- [UI 编写参考](../ui.md)
|
||||
- [UI 编写参考](../ui/ui.md)
|
||||
- [新增按键](./hotkey.md)
|
||||
- [添加辅助按键](./hotkey.md#拓展-添加辅助按键)
|
||||
- [在 UI 内实现按键](./hotkey.md#拓展-在-ui-内实现按键)
|
||||
@ -36,7 +36,6 @@
|
||||
- [用函数声明属性](./special.md#拓展-用函数声明属性)
|
||||
- [地图伤害](./special.md#拓展-地图伤害)
|
||||
- [光环属性](./special.md#拓展-光环属性)
|
||||
- [输出回合数](./special.md#拓展-输出回合数)
|
||||
- [主动技能](./skill.md)
|
||||
- [多技能设计思路](./skill.md#拓展-多技能设计思路)
|
||||
- [战后自动关闭技能](./skill.md#拓展-战后自动关闭技能)
|
||||
|
@ -82,7 +82,7 @@ controller.close(ins);
|
||||
|
||||
## UI 编写参考
|
||||
|
||||
参考[此文档](../ui.md),此文档将会教你如何从头开始编写一个 UI,并解释 UI 运行与渲染的基本逻辑。
|
||||
参考[此文档](../ui/ui.md),此文档将会教你如何从头开始编写一个 UI,并解释 UI 运行与渲染的基本逻辑。
|
||||
|
||||
## 拓展-UI 与组件的区别
|
||||
|
||||
|
@ -53,7 +53,7 @@ export function toggleSkill1() {
|
||||
import { getSkill1Enabled } from '../machanism/skill'; // [!code ++]
|
||||
|
||||
export function calDamageWith(
|
||||
info: UserEnemyInfo,
|
||||
info: EnemyInfo,
|
||||
hero: Partial<HeroStatus>
|
||||
): number | null {
|
||||
// ... 原有内容
|
||||
@ -241,7 +241,7 @@ export function getEnabledSkill() {
|
||||
import { getEnabledSkill, SkillType } from './skill';
|
||||
|
||||
export function calDamageWith(
|
||||
info: UserEnemyInfo,
|
||||
info: EnemyInfo,
|
||||
hero: Partial<HeroStatus>
|
||||
): number | null {
|
||||
// ... 原有内容
|
||||
@ -260,7 +260,7 @@ export function calDamageWith(
|
||||
import { getEnabledSkill, SkillType } from './skill';
|
||||
|
||||
export function calDamageWith(
|
||||
info: UserEnemyInfo,
|
||||
info: EnemyInfo,
|
||||
hero: Partial<HeroStatus>
|
||||
): number | null {
|
||||
// ... 原有内容
|
||||
|
@ -26,13 +26,13 @@ export const specials: SpecialDeclaration[] = [
|
||||
|
||||
## 实现特殊属性
|
||||
|
||||
打开 `packages-user/data-state/src/enemy/damage.ts`,在文件最后的 `calDamageWith` 函数中编写:
|
||||
打开 `packages-user/data-state/src/enemy/damage.ts`,在文件最后的 `calDamageWithTurn` 函数中编写:
|
||||
|
||||
```ts
|
||||
export function calDamageWith(
|
||||
info: UserEnemyInfo,
|
||||
export function calDamageWithTurn(
|
||||
info: EnemyInfo,
|
||||
hero: Partial<HeroStatus>
|
||||
): number | null {
|
||||
): DamageWithTurn {
|
||||
// ... 原有内容
|
||||
|
||||
// 在需要降低勇士伤害的地方将勇士伤害乘以 0.9 即可
|
||||
@ -102,13 +102,13 @@ export const specials: SpecialDeclaration[] = [
|
||||
|
||||
### 属性实现
|
||||
|
||||
修改 `damage.ts` `calDamageWith` 中的实现:
|
||||
修改 `damage.ts` `calDamageWithTurn` 中的实现:
|
||||
|
||||
```ts
|
||||
export function calDamageWith(
|
||||
info: UserEnemyInfo,
|
||||
export function calDamageWithTurn(
|
||||
info: EnemyInfo,
|
||||
hero: Partial<HeroStatus>
|
||||
): number | null {
|
||||
): DamageWithTurn {
|
||||
// ... 原有内容
|
||||
|
||||
// 在乘以 1 - (myAttr / 100),除以 100 是因为 myAttr 是百分制
|
||||
@ -210,10 +210,11 @@ class DamageEnemy {
|
||||
|
||||
### 自定义形状
|
||||
|
||||
如果想要自定义光环形状,我们打开 `packages-user/data-utils/src/range.ts`,拉到最后可以看到形状定义,目前包含两个:
|
||||
如果想要自定义光环形状,我们打开 `packages-user/data-utils/src/range.ts`,拉到最后可以看到形状定义,目前默认的包含这些:
|
||||
|
||||
- `square`: 中心点+边长的正方形
|
||||
- `rect`: 左上角坐标+宽高的矩形
|
||||
- `manhattan`: 曼哈顿距离,坐标之和小于半径
|
||||
|
||||
我们以曼哈顿距离为例,展示如何自定义形状。
|
||||
|
||||
@ -262,27 +263,3 @@ col.applyHalo(
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## 拓展-输出回合数
|
||||
|
||||
样板默认的 `calDamageWith` 函数只允许输出伤害值,而有时候我们可能会需要战斗的回合数,这时候我们需要修改一下这部分内容,将伤害计算逻辑单独提出来,命名为 `calDamageWithTurn`,然后在 `calDamageWith` 中调用它。在需要回合数的时候,我们调用 `calDamageWithTurn` 函数即可,如下例所示:
|
||||
|
||||
```ts
|
||||
/** 包含回合数的伤害计算 */
|
||||
export function calDamageWithTurn(
|
||||
info: UserEnemyInfo,
|
||||
hero: Partial<HeroStatus>
|
||||
) {
|
||||
// ... 原本 calDamageWith 的计算逻辑,记得删除最后返回伤害的那一行返回值
|
||||
|
||||
// 返回回合数和伤害
|
||||
return { turn, damage };
|
||||
}
|
||||
|
||||
export function calDamageWith(info: UserEnemyInfo, hero: Partial<HeroStatus>) {
|
||||
// 调用单独提出的函数计算伤害值
|
||||
const damageInfo = calDamageWithTurn(info, hero);
|
||||
// 如果伤害不存在,那么返回无穷大
|
||||
return damageInfo?.damage ?? Infinity;
|
||||
}
|
||||
```
|
||||
|
@ -210,7 +210,7 @@ const realStatus: (keyof HeroStatus)[] = [
|
||||
|
||||
```ts
|
||||
export function calDamageWith(
|
||||
info: UserEnemyInfo,
|
||||
info: EnemyInfo,
|
||||
hero: Partial<HeroStatus>
|
||||
): number {
|
||||
// ... 原有逻辑
|
||||
@ -224,4 +224,4 @@ export function calDamageWith(
|
||||
|
||||
## 拓展-了解 UI 编写的基本逻辑
|
||||
|
||||
参考[此文档](./ui.md),此文档将会教你如何从头开始编写一个 UI,并解释 UI 运行与渲染的基本逻辑。
|
||||
参考[此文档](../ui/ui.md),此文档将会教你如何从头开始编写一个 UI,并解释 UI 运行与渲染的基本逻辑。
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
## 常见需求实现指南
|
||||
|
||||
参考[此文档](./implements.md)
|
||||
参考[此文档](./implements/index.md)
|
||||
|
||||
## 热重载
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
当你**制作完游戏**后,点击构建游戏,即可自动构建游戏,构建结果在 `dist` 文件夹,会自动打包到 `dist.zip` 压缩包,发塔或更新上传此压缩包即可。
|
||||
|
||||
此帮助文档远比 2.x 的文档易读,也更容易理解,建议多阅读此文档来解决自己的问题,如果问题很复杂,或是短时间内解决不了,再去造塔群询问。
|
||||
此帮助文档远比 2.x 的文档易读,也更容易理解,但是遇到问题时我们依然建议直接在造塔群询问,因为你可能不能判断文档中是否有关于你的问题的解答。
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
|
@ -27,7 +27,7 @@ type ElementLocator = [
|
||||
- `w` `h`: 元素的长宽,描述了在没有缩放时元素的矩形长宽,默认是没有放缩的。
|
||||
- `ax` `ay`: 元素的锚点位置,描述了元素参考点的位置,所有位置变换等将以此点作为参考点。0 表示元素最左侧或最上侧,1 表示最右侧或最下侧,可以填不在 0-1 范围内的值,例如 `[-1, 1]` 表示锚点横坐标在元素左侧一个元素宽度的位置,纵坐标在元素下边缘的位置。
|
||||
|
||||

|
||||

|
||||
|
||||
示例如下:
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
Unexpected error when posting danmaku. Error info: $1
|
||||
```
|
||||
|
||||
- 报错原因:发送弹幕时发生报错。
|
||||
- 解决方案:查看后面的 Error info,检查报错信息内容,按照报错信息修复问题。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 报错原因:发送弹幕时发生报错。
|
||||
- 解决方案:查看后面的 Error info,检查报错信息内容,按照报错信息修复问题。
|
||||
|
||||
## ERROR CODE 2
|
||||
|
||||
@ -15,8 +17,8 @@ Unexpected error when posting danmaku. Error info: $1
|
||||
Unexpected loading error in loading resource '$1/$2'. Error info: $3
|
||||
```
|
||||
|
||||
- 报错原因:加载资源时发生报错,可能是资源不存在,或者是网络问题。
|
||||
- 解决方案:查看后面的 Error info,检查报错信息内容,按照报错信息修复问题。
|
||||
- 报错原因:加载资源时发生报错,可能是资源不存在,或者是网络问题。
|
||||
- 解决方案:查看后面的 Error info,检查报错信息内容,按照报错信息修复问题。
|
||||
|
||||
## ERROR CODE 3
|
||||
|
||||
@ -24,8 +26,10 @@ Unexpected loading error in loading resource '$1/$2'. Error info: $3
|
||||
Syntax error in parsing CSS: Unexpected ':'. Col: $1. CSS string: '$2
|
||||
```
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
|
||||
## ERROR CODE 4
|
||||
|
||||
@ -33,8 +37,10 @@ Syntax error in parsing CSS: Unexpected ':'. Col: $1. CSS string: '$2
|
||||
Syntax error in parsing CSS: Unexpected ';'. Col: $1. CSS string: '$2'
|
||||
```
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
|
||||
## ERROR CODE 5
|
||||
|
||||
@ -42,8 +48,10 @@ Syntax error in parsing CSS: Unexpected ';'. Col: $1. CSS string: '$2'
|
||||
Syntax error in parsing CSS: Missing property name after '-'. Col: $1. CSS string: '$2'
|
||||
```
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
|
||||
## ERROR CODE 6
|
||||
|
||||
@ -51,8 +59,10 @@ Syntax error in parsing CSS: Missing property name after '-'. Col: $1. CSS strin
|
||||
Syntax error in parsing CSS: Unexpected end of css, expecting ':'. Col: $1. CSS string: '$2'
|
||||
```
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
|
||||
## ERROR CODE 7
|
||||
|
||||
@ -60,8 +70,10 @@ Syntax error in parsing CSS: Unexpected end of css, expecting ':'. Col: $1. CSS
|
||||
Syntax error in parsing CSS: Unexpected end of css, expecting property value. Col: $1. CSS string: '$2'
|
||||
```
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 报错原因:解析 CSS 时报错,一般是在发送弹幕时引起。
|
||||
- 解决方案:检查弹幕 CSS 语法是否正确。
|
||||
|
||||
## ERROR CODE 8
|
||||
|
||||
@ -69,8 +81,10 @@ Syntax error in parsing CSS: Unexpected end of css, expecting property value. Co
|
||||
Post danmaku with not allowed css. Info: $1
|
||||
```
|
||||
|
||||
- 报错原因:弹幕 CSS 中使用了不允许的 css 属性类型。
|
||||
- 解决方案:目前仅支持 `color` `background-color` `font-size: x%` 属性。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 报错原因:弹幕 CSS 中使用了不允许的 css 属性类型。
|
||||
- 解决方案:目前仅支持 `color` `background-color` `font-size: x%` 属性。
|
||||
|
||||
## ERROR CODE 9
|
||||
|
||||
@ -78,8 +92,8 @@ Post danmaku with not allowed css. Info: $1
|
||||
Cannot initialize shader program. Error info: $1
|
||||
```
|
||||
|
||||
- 报错原因:不能够初始化着色器脚本,可能是着色器代码中有语法错误,或者是定义了不存在的变量等。
|
||||
- 解决方案:查看报错内容,根据报错内容解决。
|
||||
- 报错原因:不能够初始化着色器脚本,可能是着色器代码中有语法错误,或者是定义了不存在的变量等。
|
||||
- 解决方案:查看报错内容,根据报错内容解决。
|
||||
|
||||
## ERROR CODE 10
|
||||
|
||||
@ -87,8 +101,8 @@ Cannot initialize shader program. Error info: $1
|
||||
Cannot compile $1 shader. Error info: $2
|
||||
```
|
||||
|
||||
- 报错原因:不能编译着色器脚本,可能是语法错误,设备不支持 OpenGL 等原因。
|
||||
- 解决方案:查看报错内容,根据报错内容解决。
|
||||
- 报错原因:不能编译着色器脚本,可能是语法错误,设备不支持 OpenGL 等原因。
|
||||
- 解决方案:查看报错内容,根据报错内容解决。
|
||||
|
||||
## ERROR CODE 11
|
||||
|
||||
@ -96,8 +110,8 @@ Cannot compile $1 shader. Error info: $2
|
||||
Cache depth cannot larger than 31.
|
||||
```
|
||||
|
||||
- 报错原因:`BlockCache` 最大允许 31 层深度缓存。
|
||||
- 解决方案:降低缓存深度。
|
||||
- 报错原因:`BlockCache` 最大允许 31 层深度缓存。
|
||||
- 解决方案:降低缓存深度。
|
||||
|
||||
## ERROR CODE 12
|
||||
|
||||
@ -105,8 +119,8 @@ Cache depth cannot larger than 31.
|
||||
Cannot move while status is not 'moving'. Call 'readyMove' first.
|
||||
```
|
||||
|
||||
- 报错原因:调用移动时没有调用 `readyMove` 准备移动。
|
||||
- 解决方案:在移动前先调用 `readyMove`。
|
||||
- 报错原因:调用移动时没有调用 `readyMove` 准备移动。
|
||||
- 解决方案:在移动前先调用 `readyMove`。
|
||||
|
||||
## ERROR CODE 13
|
||||
|
||||
@ -118,8 +132,8 @@ Cannot move while status is not 'moving'. Call 'readyMove' first.
|
||||
Cannot find log message for $1 code $2.
|
||||
```
|
||||
|
||||
- 报错原因:不能找到错误代码 $2 的消息。
|
||||
- 解决方案:避免使用 `logger` 输出不存在的错误代码。
|
||||
- 报错原因:不能找到错误代码 $2 的消息。
|
||||
- 解决方案:避免使用 `logger` 输出不存在的错误代码。
|
||||
|
||||
## ERROR CODE 17
|
||||
|
||||
@ -127,17 +141,17 @@ Cannot find log message for $1 code $2.
|
||||
Cannot use shader program for shader element that does not belong to it.
|
||||
```
|
||||
|
||||
- 报错原因:在一个着色器上使用了不属于这个着色器的着色器程序。
|
||||
- 解决方案:确保使用的着色器程序是由着色器对象自身创建的。
|
||||
- 报错原因:在一个着色器上使用了不属于这个着色器的着色器程序。
|
||||
- 解决方案:确保使用的着色器程序是由着色器对象自身创建的。
|
||||
|
||||
## ERROR CODE 18
|
||||
|
||||
```txt
|
||||
Cannot delete shader program for shader element that does not belong to
|
||||
Cannot delete shader program for shader element that does not belong to it.
|
||||
```
|
||||
|
||||
- 报错原因:在一个着色器上删除了不属于这个着色器的着色器程序。
|
||||
- 解决方案:确保删除的着色器程序是由着色器对象自身创建的。
|
||||
- 报错原因:在一个着色器上删除了不属于这个着色器的着色器程序。
|
||||
- 解决方案:确保删除的着色器程序是由着色器对象自身创建的。
|
||||
|
||||
## ERROR CODE 19
|
||||
|
||||
@ -145,8 +159,8 @@ Cannot delete shader program for shader element that does not belong to
|
||||
Cannot create MotaRenderer instance for nonexistent canvas.
|
||||
```
|
||||
|
||||
- 报错原因:在一个不存在的画布上创建了渲染器对象。
|
||||
- 解决方案:确保目标画布存在。
|
||||
- 报错原因:在一个不存在的画布上创建了渲染器对象。
|
||||
- 解决方案:确保目标画布存在。
|
||||
|
||||
## ERROR CODE 20
|
||||
|
||||
@ -154,8 +168,8 @@ Cannot create MotaRenderer instance for nonexistent canvas.
|
||||
Cannot create render element for tag '$1', since there's no registration for it.
|
||||
```
|
||||
|
||||
- 报错原因:不能创建 $1 标签,因为没有注册这个标签。
|
||||
- 解决方案:确保你已经在 `tagMap` 注册了这个标签。
|
||||
- 报错原因:不能创建 $1 标签,因为没有注册这个标签。
|
||||
- 解决方案:确保你已经在 `tagMap` 注册了这个标签。
|
||||
|
||||
## ERROR CODE 21
|
||||
|
||||
@ -163,8 +177,8 @@ Cannot create render element for tag '$1', since there's no registration for it.
|
||||
Incorrect render prop type is delivered. key: '$1', expected type: '$2', delivered type: '$3'
|
||||
```
|
||||
|
||||
- 报错原因:向元素中传入了错误类型的参数(props)。
|
||||
- 解决方案:确保传入元素的 $1 参数的类型是 $2。
|
||||
- 报错原因:向元素中传入了错误类型的参数(props)。
|
||||
- 解决方案:确保传入元素的 $1 参数的类型是 $2。
|
||||
|
||||
## ERROR CODE 22
|
||||
|
||||
@ -172,8 +186,8 @@ Incorrect render prop type is delivered. key: '$1', expected type: '$2', deliver
|
||||
Incorrect props for custom tag. Please ensure you have delivered 'item' prop and other required props.
|
||||
```
|
||||
|
||||
- 报错原因:没有向 `cutsom` 标签传入 `item` 参数。
|
||||
- 解决方案:确保传入了 `item` 参数和需要的所有参数。
|
||||
- 报错原因:没有向 `cutsom` 标签传入 `item` 参数。
|
||||
- 解决方案:确保传入了 `item` 参数和需要的所有参数。
|
||||
|
||||
## ERROR CODE 23
|
||||
|
||||
@ -181,8 +195,8 @@ Incorrect props for custom tag. Please ensure you have delivered 'item' prop and
|
||||
Cannot get reader when fetching '$1'.
|
||||
```
|
||||
|
||||
- 报错原因:流式加载 URL $1 时不能获取 `StreamReader`。
|
||||
- 解决方案:检查加载的 URL 是否合法,检查浏览器版本是否过老。
|
||||
- 报错原因:流式加载 URL $1 时不能获取 `StreamReader`。
|
||||
- 解决方案:检查加载的 URL 是否合法,检查浏览器版本是否过老。
|
||||
|
||||
## ERROR CODE 24
|
||||
|
||||
@ -190,8 +204,8 @@ Cannot get reader when fetching '$1'.
|
||||
Cannot decode source type of '$1', since there is no registered decoder for that type.
|
||||
```
|
||||
|
||||
- 报错原因:音频系统中的流式音频源不能解析 $1 格式的音频,因为没有对应的解码器。
|
||||
- 解决方案:如果不是 `opus` `ogg` 格式的音频,请使用 `ElementSource`。
|
||||
- 报错原因:音频系统中的流式音频源不能解析 $1 格式的音频,因为没有对应的解码器。
|
||||
- 解决方案:如果不是 `opus` `ogg` 格式的音频,请使用 `ElementSource`。
|
||||
|
||||
## ERROR CODE 25
|
||||
|
||||
@ -199,8 +213,8 @@ Cannot decode source type of '$1', since there is no registered decoder for that
|
||||
Unknown audio type. Header: '$1'
|
||||
```
|
||||
|
||||
- 报错原因:未知的音频类型。
|
||||
- 解决方案:目前仅支持 `mp3` `wav` `flac` `opus` `ogg` `aac` 格式的音频。
|
||||
- 报错原因:未知的音频类型。
|
||||
- 解决方案:目前仅支持 `mp3` `wav` `flac` `opus` `ogg` `aac` 格式的音频。
|
||||
|
||||
## ERROR CODE 26
|
||||
|
||||
@ -208,5 +222,5 @@ Unknown audio type. Header: '$1'
|
||||
Uncaught error when fetching stream data from '$1'. Error info: $2.
|
||||
```
|
||||
|
||||
- 报错原因:流式加载时报错。
|
||||
- 解决方案:查看报错内容,根据报错内容解决问题。
|
||||
- 报错原因:流式加载时报错。
|
||||
- 解决方案:查看报错内容,根据报错内容解决问题。
|
||||
|
@ -6,8 +6,8 @@
|
||||
Resource with type of 'none' is loaded.
|
||||
```
|
||||
|
||||
- 警告原因:不能加载 `none` 类型的资源。
|
||||
- 解决方案:加载资源时填写资源类型。
|
||||
- 警告原因:不能加载 `none` 类型的资源。
|
||||
- 解决方案:加载资源时填写资源类型。
|
||||
|
||||
## WARN CODE 2
|
||||
|
||||
@ -15,8 +15,8 @@ Resource with type of 'none' is loaded.
|
||||
Repeat load of resource '$1/$2'.
|
||||
```
|
||||
|
||||
- 警告原因:同一个资源被加载了两次。
|
||||
- 解决方案:避免对同一个资源调用两次加载。
|
||||
- 警告原因:同一个资源被加载了两次。
|
||||
- 解决方案:避免对同一个资源调用两次加载。
|
||||
|
||||
## WARN CODE 3
|
||||
|
||||
@ -24,8 +24,10 @@ Repeat load of resource '$1/$2'.
|
||||
Unknown danmaku tag: $1
|
||||
```
|
||||
|
||||
- 警告原因:出现了未知的弹幕标签(指 `[xxx:xxx]`)
|
||||
- 解决方案:目前仅支持 `[i:xxx]` 标签,如果需要显示方括号,请使用 `\[\]`。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 警告原因:出现了未知的弹幕标签(指 `[xxx:xxx]`)
|
||||
- 解决方案:目前仅支持 `[i:xxx]` 标签,如果需要显示方括号,请使用 `\[\]`。
|
||||
|
||||
## WARN CODE 4
|
||||
|
||||
@ -33,8 +35,10 @@ Unknown danmaku tag: $1
|
||||
Ignored a mismatched ']' in danmaku.
|
||||
```
|
||||
|
||||
- 警告原因:出现了不能匹配的右方括号。
|
||||
- 解决方案:如果需要显示方括号,请使用 `\[\]`。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 警告原因:出现了不能匹配的右方括号。
|
||||
- 解决方案:如果需要显示方括号,请使用 `\[\]`。
|
||||
|
||||
## WARN CODE 5
|
||||
|
||||
@ -42,8 +46,10 @@ Ignored a mismatched ']' in danmaku.
|
||||
Repeat post danmaku.
|
||||
```
|
||||
|
||||
- 警告原因:同一个弹幕被发送了两次。
|
||||
- 解决方案:确保一个弹幕实例只调用了一次 `post` 方法。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 警告原因:同一个弹幕被发送了两次。
|
||||
- 解决方案:确保一个弹幕实例只调用了一次 `post` 方法。
|
||||
|
||||
## WARN CODE 6
|
||||
|
||||
@ -51,8 +57,10 @@ Repeat post danmaku.
|
||||
Registered special danmaku element: $1.
|
||||
```
|
||||
|
||||
- 警告原因:要注册的弹幕标签已经存在。
|
||||
- 解决方案:避免使用同一个标签名,如果内容不一样请换一个标签名。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 警告原因:要注册的弹幕标签已经存在。
|
||||
- 解决方案:避免使用同一个标签名,如果内容不一样请换一个标签名。
|
||||
|
||||
## WARN CODE 7
|
||||
|
||||
@ -64,8 +72,8 @@ Registered special danmaku element: $1.
|
||||
Incomplete render data is put. None will be filled to the lacked data.
|
||||
```
|
||||
|
||||
- 警告原因:使用 `<layer>` 标签时,向地图渲染传入了不完整的地图信息(数据长度不是指定宽度的倍数),不完整的部分将会补零。
|
||||
- 解决方案:确保传入的地图信息长度是 `width` 参数的倍数。
|
||||
- 警告原因:使用 `<layer>` 标签时,向地图渲染传入了不完整的地图信息(数据长度不是指定宽度的倍数),不完整的部分将会补零。
|
||||
- 解决方案:确保传入的地图信息长度是 `width` 参数的倍数。
|
||||
|
||||
## WARN CODE 9
|
||||
|
||||
@ -73,8 +81,8 @@ Incomplete render data is put. None will be filled to the lacked data.
|
||||
Data transfered is partially (or totally) out of range. Overflowed data will be ignored.
|
||||
```
|
||||
|
||||
- 警告原因:使用 `<layer>` 标签时,传入地图的渲染数据有一部分(或全部都)在地图之外,在地图之外的部分将会被忽略。
|
||||
- 解决方案:确保传入的地图信息没有在地图之外的部分。
|
||||
- 警告原因:使用 `<layer>` 标签时,传入地图的渲染数据有一部分(或全部都)在地图之外,在地图之外的部分将会被忽略。
|
||||
- 解决方案:确保传入的地图信息没有在地图之外的部分。
|
||||
|
||||
## WARN CODE 10
|
||||
|
||||
@ -82,8 +90,8 @@ Data transfered is partially (or totally) out of range. Overflowed data will be
|
||||
Cannot resolve big image of enemy '$1'.
|
||||
```
|
||||
|
||||
- 警告原因:无法解析怪物 $1 的大怪物贴图(绑定贴图),可能是因为图片不存在。
|
||||
- 解决方案:确保此怪物绑定的贴图已经在全塔属性注册。
|
||||
- 警告原因:无法解析怪物 $1 的大怪物贴图(绑定贴图),可能是因为图片不存在。
|
||||
- 解决方案:确保此怪物绑定的贴图已经在全塔属性注册。
|
||||
|
||||
## WARN CODE 11
|
||||
|
||||
@ -91,8 +99,8 @@ Cannot resolve big image of enemy '$1'.
|
||||
Cannot resolve material $1. Material not exists.
|
||||
```
|
||||
|
||||
- 警告原因:不能解析指定类型 $1 的素材,因为对应的素材文件不存在。
|
||||
- 解决方案:检查 `enemys.png` `npcs.png` 等素材文件是否存在。
|
||||
- 警告原因:不能解析指定类型 $1 的素材,因为对应的素材文件不存在。
|
||||
- 解决方案:检查 `enemys.png` `npcs.png` 等素材文件是否存在。
|
||||
|
||||
## WARN CODE 12
|
||||
|
||||
@ -100,7 +108,7 @@ Cannot resolve material $1. Material not exists.
|
||||
Cannot mark buffable with a non-number status. Key: '$1'.
|
||||
```
|
||||
|
||||
- 暂时碰不到这个报错。
|
||||
- 暂时碰不到这个报错。
|
||||
|
||||
## WARN CODE 13
|
||||
|
||||
@ -108,7 +116,7 @@ Cannot mark buffable with a non-number status. Key: '$1'.
|
||||
Cannot set buff of non-number status. Key: '$1'.
|
||||
```
|
||||
|
||||
- 暂时碰不到这个报错。
|
||||
- 暂时碰不到这个报错。
|
||||
|
||||
## WARN CODE 14
|
||||
|
||||
@ -116,7 +124,7 @@ Cannot set buff of non-number status. Key: '$1'.
|
||||
Cannot add status of non-number status. Key: '$1'.
|
||||
```
|
||||
|
||||
- 暂时碰不到这个报错。
|
||||
- 暂时碰不到这个报错。
|
||||
|
||||
## WARN CODE 15
|
||||
|
||||
@ -124,8 +132,8 @@ Cannot add status of non-number status. Key: '$1'.
|
||||
Cannot get item of a non-item block on loc: $1,$2,$3.
|
||||
```
|
||||
|
||||
- 警告原因:不能获取一个不存在物品的图块上的物品对象。
|
||||
- 解决方案:提前判断那一格是不是物品,或确保要获取的格子包含物品。
|
||||
- 警告原因:不能获取一个不存在物品的图块上的物品对象。
|
||||
- 解决方案:提前判断那一格是不是物品,或确保要获取的格子包含物品。
|
||||
|
||||
## WARN CODE 16
|
||||
|
||||
@ -133,7 +141,7 @@ Cannot get item of a non-item block on loc: $1,$2,$3.
|
||||
Override repeated state key: '$1'.
|
||||
```
|
||||
|
||||
- 暂时碰不到这个报错。
|
||||
- 暂时碰不到这个报错。
|
||||
|
||||
## WARN CODE 17
|
||||
|
||||
@ -141,8 +149,8 @@ Override repeated state key: '$1'.
|
||||
Floor-damage extension needs 'floor-binder' extension as dependency.
|
||||
```
|
||||
|
||||
- 警告原因:楼层伤害拓展需要以楼层绑定拓展作为依赖。
|
||||
- 解决方案:确保添加伤害拓展时也添加了楼层绑定拓展。
|
||||
- 警告原因:楼层伤害拓展需要以楼层绑定拓展作为依赖。
|
||||
- 解决方案:确保添加伤害拓展时也添加了楼层绑定拓展。
|
||||
|
||||
## WARN CODE 18
|
||||
|
||||
@ -150,8 +158,10 @@ Floor-damage extension needs 'floor-binder' extension as dependency.
|
||||
Uncaught error in posting like info for danmaku. Danmaku id: $1.
|
||||
```
|
||||
|
||||
- 警告原因:为弹幕点赞时出现报错。
|
||||
- 解决方案:可能是网络问题,检查网络。
|
||||
> 应该不会遇到这个报错,因为样板并不内置弹幕系统。
|
||||
|
||||
- 警告原因:为弹幕点赞时出现报错。
|
||||
- 解决方案:可能是网络问题,检查网络。
|
||||
|
||||
## WARN CODE 19
|
||||
|
||||
@ -159,8 +169,10 @@ Uncaught error in posting like info for danmaku. Danmaku id: $1.
|
||||
Repeat light id: '$1'
|
||||
```
|
||||
|
||||
- 警告原因:重复的光源 id。
|
||||
- 解决方案:避免光源 id 出现重复。
|
||||
> 应该不会遇到这个报错,因为样板并不内置点光源。
|
||||
|
||||
- 警告原因:重复的光源 id。
|
||||
- 解决方案:避免光源 id 出现重复。
|
||||
|
||||
## WARN CODE 20
|
||||
|
||||
@ -168,8 +180,8 @@ Repeat light id: '$1'
|
||||
Cannot apply animation to camera operation that does not belong to it.
|
||||
```
|
||||
|
||||
- 警告原因:不能向摄像机对象添加不属于它的动画操作。
|
||||
- 解决方案:确保添加的动画操作是由这个摄像机对象创建的。
|
||||
- 警告原因:不能向摄像机对象添加不属于它的动画操作。
|
||||
- 解决方案:确保添加的动画操作是由这个摄像机对象创建的。
|
||||
|
||||
## WARN CODE 21
|
||||
|
||||
@ -177,8 +189,8 @@ Cannot apply animation to camera operation that does not belong to it.
|
||||
Cannot apply transition to camera operation that does not belong to it.
|
||||
```
|
||||
|
||||
- 警告原因:不能向摄像机对象添加不属于它的渐变操作。
|
||||
- 解决方案:确保添加的渐变操作是由这个摄像机对象创建的。
|
||||
- 警告原因:不能向摄像机对象添加不属于它的渐变操作。
|
||||
- 解决方案:确保添加的渐变操作是由这个摄像机对象创建的。
|
||||
|
||||
## WARN CODE 22
|
||||
|
||||
@ -186,8 +198,8 @@ Cannot apply transition to camera operation that does not belong to it.
|
||||
There is already an active camera for delivered render item. Consider using 'Camera.for' or disable the active camera to avoid some exceptions.
|
||||
```
|
||||
|
||||
- 警告原因:在目标渲染元素上,现在已经有了一个已激活的摄像机对象,这可能导致两个摄像机操作冲突,产生问题。
|
||||
- 解决方案:考虑使用 [`Camera.for`](../../api/motajs-render-elements/Camera.md#Camera.for) 方法,或先禁用已激活的摄像机,再使用当前摄像机
|
||||
- 警告原因:在目标渲染元素上,现在已经有了一个已激活的摄像机对象,这可能导致两个摄像机操作冲突,产生问题。
|
||||
- 解决方案:考虑使用 [`Camera.for`](../../api/motajs-render-elements/Camera.md#Camera.for) 方法,或先禁用已激活的摄像机,再使用当前摄像机
|
||||
|
||||
## WARN CODE 23
|
||||
|
||||
@ -195,8 +207,8 @@ There is already an active camera for delivered render item. Consider using 'Cam
|
||||
Render item with id of '$1' has already exists. Please avoid repeat id since it may cause issues when use 'getElementById'.
|
||||
```
|
||||
|
||||
- 警告原因:两个渲染元素的 id 出现了重复,这会导致调用 `getElementById` 时出现问题。
|
||||
- 解决方案:避免出现重复的 id。
|
||||
- 警告原因:两个渲染元素的 id 出现了重复,这会导致调用 `getElementById` 时出现问题。
|
||||
- 解决方案:避免出现重复的 id。
|
||||
|
||||
## WARN CODE 24
|
||||
|
||||
@ -204,8 +216,8 @@ Render item with id of '$1' has already exists. Please avoid repeat id since it
|
||||
Uniform block can only be used in glsl version es 300.
|
||||
```
|
||||
|
||||
- 警告原因:UBO(Uniform Block Object) 只能在 GLSL ES 300 版本的着色器脚本中使用。
|
||||
- 解决方案:如果需要使用 UBO,考虑换用 es 300 版本的着色器脚本。
|
||||
- 警告原因:UBO(Uniform Block Object) 只能在 GLSL ES 300 版本的着色器脚本中使用。
|
||||
- 解决方案:如果需要使用 UBO,考虑换用 es 300 版本的着色器脚本。
|
||||
|
||||
## WARN CODE 25
|
||||
|
||||
@ -213,8 +225,8 @@ Uniform block can only be used in glsl version es 300.
|
||||
Cannot activate weather since there's no weather with id of '$1'.
|
||||
```
|
||||
|
||||
- 警告原因:不能启用不存在的天气类型。
|
||||
- 解决方案:确保要启用的天气类型正确且存在,不存在则需要自行注册。
|
||||
- 警告原因:不能启用不存在的天气类型。
|
||||
- 解决方案:确保要启用的天气类型正确且存在,不存在则需要自行注册。
|
||||
|
||||
## WARN CODE 26
|
||||
|
||||
@ -222,8 +234,8 @@ Cannot activate weather since there's no weather with id of '$1'.
|
||||
Cannot set attribute when only element number specified. Use 'pointer' or 'pointerI' instead.
|
||||
```
|
||||
|
||||
- 警告原因:使用 `defineAttribute` 时指定了不存在的顶点属性类型。
|
||||
- 解决方案:如果需要传递数组,考虑使用 `defineAttribArray` 而不是 `defineAttribute`。
|
||||
- 警告原因:使用 `defineAttribute` 时指定了不存在的顶点属性类型。
|
||||
- 解决方案:如果需要传递数组,考虑使用 `defineAttribArray` 而不是 `defineAttribute`。
|
||||
|
||||
## WARN CODE 27
|
||||
|
||||
@ -231,7 +243,7 @@ Cannot set attribute when only element number specified. Use 'pointer' or 'point
|
||||
Cannot vertex attribute integer point when specified as float. Use 'set' or 'pointer' instead.
|
||||
```
|
||||
|
||||
- 遇不到这个报错
|
||||
- 遇不到这个报错
|
||||
|
||||
## WARN CODE 28
|
||||
|
||||
@ -239,8 +251,8 @@ Cannot vertex attribute integer point when specified as float. Use 'set' or 'poi
|
||||
Redefinition of shader $1: '$2'
|
||||
```
|
||||
|
||||
- 警告原因:定义了重复的着色器变量/顶点属性/UBO 等。
|
||||
- 解决方案:避免对同一个变量调用多次 `defineXxxx`。
|
||||
- 警告原因:定义了重复的着色器变量/顶点属性/UBO 等。
|
||||
- 解决方案:避免对同一个变量调用多次 `defineXxxx`。
|
||||
|
||||
## WARN CODE 29
|
||||
|
||||
@ -248,8 +260,8 @@ Redefinition of shader $1: '$2'
|
||||
Cannot define new texture since texture index is larger than max texture count.
|
||||
```
|
||||
|
||||
- 警告原因:定义的纹理数量超过了设备支持的上限。
|
||||
- 解决方案:考虑将多个纹理合并为同一个纹理作为图集,然后使用顶点属性或一致变量进行裁剪。
|
||||
- 警告原因:定义的纹理数量超过了设备支持的上限。
|
||||
- 解决方案:考虑将多个纹理合并为同一个纹理作为图集,然后使用顶点属性或一致变量进行裁剪。
|
||||
|
||||
## WARN CODE 30
|
||||
|
||||
@ -257,8 +269,8 @@ Cannot define new texture since texture index is larger than max texture count.
|
||||
Cannot use indices named $1 since no definition for it. Please define it in advance.
|
||||
```
|
||||
|
||||
- 警告原因:要作为顶点索引的索引数组不存在,因为没有定义。
|
||||
- 解决方案:提前定义索引数组。
|
||||
- 警告原因:要作为顶点索引的索引数组不存在,因为没有定义。
|
||||
- 解决方案:提前定义索引数组。
|
||||
|
||||
## WARN CODE 31
|
||||
|
||||
@ -266,8 +278,8 @@ Cannot use indices named $1 since no definition for it. Please define it in adva
|
||||
Cannot use indices since the indices instance is not belong to the program.
|
||||
```
|
||||
|
||||
- 警告原因:使用的顶点索引数组不属于当前着色器程序。
|
||||
- 解决方案:确保使用的顶点索引数组是由当前着色器程序创建的。
|
||||
- 警告原因:使用的顶点索引数组不属于当前着色器程序。
|
||||
- 解决方案:确保使用的顶点索引数组是由当前着色器程序创建的。
|
||||
|
||||
## WARN CODE 32
|
||||
|
||||
@ -275,8 +287,8 @@ Cannot use indices since the indices instance is not belong to the program.
|
||||
Sub-image exceeds texture dimensions, auto adjusting size.
|
||||
```
|
||||
|
||||
- 警告原因:使用 `IShaderTexture.sub` 时,传入的图像数据超出了纹理大小。
|
||||
- 解决方案:确保传入的图片不会超出纹理大小。如果需要修改纹理大小,请使用 `IShaderTexture.set` 方法。
|
||||
- 警告原因:使用 `IShaderTexture.sub` 时,传入的图像数据超出了纹理大小。
|
||||
- 解决方案:确保传入的图片不会超出纹理大小。如果需要修改纹理大小,请使用 `IShaderTexture.set` 方法。
|
||||
|
||||
## WARN CODE 33
|
||||
|
||||
@ -284,8 +296,7 @@ Sub-image exceeds texture dimensions, auto adjusting size.
|
||||
Cannot modify MotaOffscreenCanvas2D that is freezed.
|
||||
```
|
||||
|
||||
- 警告原因:不能修改已冻结的画布属性。
|
||||
- 解决方案:如果这个画布后续还需要修改属性,那么就不要冻结它。
|
||||
- 遇不到这个报错。
|
||||
|
||||
## WARN CODE 34
|
||||
|
||||
@ -293,8 +304,8 @@ Cannot modify MotaOffscreenCanvas2D that is freezed.
|
||||
Repeated render tag registration: '$1'.
|
||||
```
|
||||
|
||||
- 警告原因:注册了重复的渲染标签。
|
||||
- 解决方案:确保注册的渲染标签名称不重复。
|
||||
- 警告原因:注册了重复的渲染标签。
|
||||
- 解决方案:确保注册的渲染标签名称不重复。
|
||||
|
||||
## WARN CODE 35
|
||||
|
||||
@ -302,8 +313,8 @@ Repeated render tag registration: '$1'.
|
||||
Cannot append child on plain render item, please ensure you have overrided 'appendChild' method in your own element.
|
||||
```
|
||||
|
||||
- 警告原因:默认的渲染元素中,只有一部分可以添加子元素,而其他的不能添加。
|
||||
- 解决方案:不要在不能添加子元素的元素里面添加子元素。如果是自定义元素,请确保实现了 `appendChild` 方法。
|
||||
- 警告原因:默认的渲染元素中,只有一部分可以添加子元素,而其他的不能添加。
|
||||
- 解决方案:不要在不能添加子元素的元素里面添加子元素。如果是自定义元素,请确保实现了 `appendChild` 方法。
|
||||
|
||||
## WARN CODE 36
|
||||
|
||||
@ -311,8 +322,8 @@ Cannot append child on plain render item, please ensure you have overrided 'appe
|
||||
Cannot remove child on plain render item, please ensure you have overrided 'removeChild' method in your own element.
|
||||
```
|
||||
|
||||
- 警告原因:默认的渲染元素中,只有一部分可以移除子元素,而其他的不能移除。
|
||||
- 解决方案:不要在不能移除子元素的元素里面移除子元素。如果是自定义元素,请确保实现了 `removeChild` 方法。
|
||||
- 警告原因:默认的渲染元素中,只有一部分可以移除子元素,而其他的不能移除。
|
||||
- 解决方案:不要在不能移除子元素的元素里面移除子元素。如果是自定义元素,请确保实现了 `removeChild` 方法。
|
||||
|
||||
## WARN CODE 37
|
||||
|
||||
@ -320,8 +331,8 @@ Cannot remove child on plain render item, please ensure you have overrided 'remo
|
||||
Cannot execute 'requestSort' on plain render item, please ensure you have overrided 'requestSort' method in your own element.
|
||||
```
|
||||
|
||||
- 警告原因:默认的渲染元素中,只有一部分可以拥有排序功能,而其他的不能排序。
|
||||
- 解决方案:不要在不能拥有子元素的元素上调用 `requestSort`。如果是自定义元素,请确保实现了 `requestSort` 方法。
|
||||
- 警告原因:默认的渲染元素中,只有一部分可以拥有排序功能,而其他的不能排序。
|
||||
- 解决方案:不要在不能拥有子元素的元素上调用 `requestSort`。如果是自定义元素,请确保实现了 `requestSort` 方法。
|
||||
|
||||
## WARN CODE 38
|
||||
|
||||
@ -329,8 +340,8 @@ Cannot execute 'requestSort' on plain render item, please ensure you have overri
|
||||
Using plain text in jsx is strongly not recommended, since you can hardly modify its attributes. Consider using Text element instead.
|
||||
```
|
||||
|
||||
- 警告原因:在 JSX 中直接填写文字内容是极其不推荐的,因为你几乎不能修改它的任何属性。
|
||||
- 解决方案:考虑使用 `text` 标签替代。
|
||||
- 警告原因:在 JSX 中直接填写文字内容是极其不推荐的,因为你几乎不能修改它的任何属性。
|
||||
- 解决方案:考虑使用 `text` 标签替代。
|
||||
|
||||
## WARN CODE 39
|
||||
|
||||
@ -338,13 +349,13 @@ Using plain text in jsx is strongly not recommended, since you can hardly modify
|
||||
Plain text is not supported outside Text element.
|
||||
```
|
||||
|
||||
- 警告原因:不能在 `text` 元素外使用变量作为文字,例如:
|
||||
- 警告原因:不能在 `text` 元素外使用变量作为文字,例如:
|
||||
|
||||
```tsx
|
||||
<container>{text.value}</container>
|
||||
```
|
||||
|
||||
- 解决方案:换用 `text` 标签。
|
||||
- 解决方案:换用 `text` 标签。
|
||||
|
||||
## WARN CODE 40
|
||||
|
||||
@ -352,7 +363,7 @@ Plain text is not supported outside Text element.
|
||||
Cannot return canvas that is not provided by this pool.
|
||||
```
|
||||
|
||||
- 遇不到这个报错。
|
||||
- 遇不到这个报错。
|
||||
|
||||
## WARN CODE 41
|
||||
|
||||
@ -360,8 +371,8 @@ Cannot return canvas that is not provided by this pool.
|
||||
Width of text content components must be positive. receive: $1
|
||||
```
|
||||
|
||||
- 警告原因:`TextContent` 组件的宽度必须是正值,而你可能传入了一个负值或 0。
|
||||
- 解决方案:确保宽度属性是正值。
|
||||
- 警告原因:`TextContent` 组件的宽度必须是正值,而你可能传入了一个负值或 0。
|
||||
- 解决方案:确保宽度属性是正值。
|
||||
|
||||
## WARN CODE 42
|
||||
|
||||
@ -369,8 +380,8 @@ Width of text content components must be positive. receive: $1
|
||||
Repeated Textbox id: '$1'.
|
||||
```
|
||||
|
||||
- 警告原因:`Textbox` 组件使用了重复的 id。
|
||||
- 解决方案:避免 `Textbox` 组件的 id 重复。
|
||||
- 警告原因:`Textbox` 组件使用了重复的 id。
|
||||
- 解决方案:避免 `Textbox` 组件的 id 重复。
|
||||
|
||||
## WARN CODE 43
|
||||
|
||||
@ -378,8 +389,8 @@ Repeated Textbox id: '$1'.
|
||||
Cannot set icon of '$1', since it does not exists. Please ensure you have delivered correct icon id or number.
|
||||
```
|
||||
|
||||
- 警告原因:向 `icon` 元素中传入了不存在的图标。
|
||||
- 解决方案:确保传入的图标 id 或数字是正确的。
|
||||
- 警告原因:向 `icon` 元素中传入了不存在的图标。
|
||||
- 解决方案:确保传入的图标 id 或数字是正确的。
|
||||
|
||||
## WARN CODE 44
|
||||
|
||||
@ -387,8 +398,8 @@ Cannot set icon of '$1', since it does not exists. Please ensure you have delive
|
||||
Unexpected end when loading stream audio, reason: '$1'
|
||||
```
|
||||
|
||||
- 警告原因:加载流式音频时被意外中断。
|
||||
- 解决方案:根据原因解决。
|
||||
- 警告原因:加载流式音频时被意外中断。
|
||||
- 解决方案:根据原因解决。
|
||||
|
||||
## WARN CODE 45
|
||||
|
||||
@ -396,8 +407,8 @@ Unexpected end when loading stream audio, reason: '$1'
|
||||
Audio route with id of '$1' has already existed. New route will override old route.
|
||||
```
|
||||
|
||||
- 警告原因:id 为 $1 的音频路由已经存在,新的路由将会覆盖旧路由。
|
||||
- 解决方案:确保音频路由不会重复。
|
||||
- 警告原因:id 为 $1 的音频路由已经存在,新的路由将会覆盖旧路由。
|
||||
- 解决方案:确保音频路由不会重复。
|
||||
|
||||
## WARN CODE 46
|
||||
|
||||
@ -405,8 +416,8 @@ Audio route with id of '$1' has already existed. New route will override old rou
|
||||
Cannot pipe new StreamReader object when stream is loading.
|
||||
```
|
||||
|
||||
- 警告原因:在流式加载过程中无法将流加载对象泵入其他对象。
|
||||
- 解决方案:在流式加载前就执行 `pipe` 方法。
|
||||
- 警告原因:在流式加载过程中无法将流加载对象泵入其他对象。
|
||||
- 解决方案:在流式加载前就执行 `pipe` 方法。
|
||||
|
||||
## WARN CODE 47
|
||||
|
||||
@ -414,8 +425,8 @@ Cannot pipe new StreamReader object when stream is loading.
|
||||
Audio stream decoder for audio type '$1' has already existed.
|
||||
```
|
||||
|
||||
- 警告原因:$1 类型的音频解码器已经存在。
|
||||
- 解决方案:不要为同一种类型的音频注册多种解码器。
|
||||
- 警告原因:$1 类型的音频解码器已经存在。
|
||||
- 解决方案:不要为同一种类型的音频注册多种解码器。
|
||||
|
||||
## WARN CODE 48
|
||||
|
||||
@ -423,8 +434,8 @@ Audio stream decoder for audio type '$1' has already existed.
|
||||
Sample rate in stream audio must be constant.
|
||||
```
|
||||
|
||||
- 警告原因:流式音频中,音频的采样率应该保持一致。
|
||||
- 解决方案:确保音频的采样率不会改变,如果会的话,请换一个音频。
|
||||
- 警告原因:流式音频中,音频的采样率应该保持一致。
|
||||
- 解决方案:确保音频的采样率不会改变,如果会的话,请换一个音频。
|
||||
|
||||
## WARN CODE 49
|
||||
|
||||
@ -432,8 +443,8 @@ Sample rate in stream audio must be constant.
|
||||
Repeated patch for '$1', key: '$2'.
|
||||
```
|
||||
|
||||
- 警告原因:对同一个 2.x 样板接口重写了两次。
|
||||
- 解决方案:将两次重写合并为一次。
|
||||
- 警告原因:对同一个 2.x 样板接口重写了两次。
|
||||
- 解决方案:将两次重写合并为一次。
|
||||
|
||||
## WARN CODE 50
|
||||
|
||||
@ -441,5 +452,5 @@ Repeated patch for '$1', key: '$2'.
|
||||
Unknown audio extension name: '$1'
|
||||
```
|
||||
|
||||
- 警告原因:未知的文件拓展名 $1。
|
||||
- 解决方案:换一个类型的音频。
|
||||
- 警告原因:未知的文件拓展名 $1。
|
||||
- 解决方案:换一个类型的音频。
|
||||
|
@ -6,8 +6,8 @@
|
||||
Cannot decode sound '$1', since audio file may not supported by 2.b.
|
||||
```
|
||||
|
||||
- 警告原因:不能解码音效 $1,可能因为文件类型不支持。
|
||||
- 解决方案:换一个音乐文件格式,建议使用 `opus` 格式。
|
||||
- 警告原因:不能解码音效 $1,可能因为文件类型不支持。
|
||||
- 解决方案:换一个音乐文件格式,建议使用 `opus` 格式。
|
||||
|
||||
## WARN CODE 52
|
||||
|
||||
@ -15,8 +15,8 @@ Cannot decode sound '$1', since audio file may not supported by 2.b.
|
||||
Cannot play sound '$1', since there is no added data named it.
|
||||
```
|
||||
|
||||
- 警告原因:播放了不存在的音效。
|
||||
- 解决方案:确保要播放音效名称正确。
|
||||
- 警告原因:播放了不存在的音效。
|
||||
- 解决方案:确保要播放音效名称正确。
|
||||
|
||||
## WARN CODE 53
|
||||
|
||||
@ -24,8 +24,8 @@ Cannot play sound '$1', since there is no added data named it.
|
||||
Cannot $1 audio route '$2', since there is not added route named it.
|
||||
```
|
||||
|
||||
- 警告原因:不能对 $2 路由执行 $1(播放、暂停等)操作,因为没有名字叫这个的音频路由。
|
||||
- 解决方案:确保要操作的路由存在。
|
||||
- 警告原因:不能对 $2 路由执行 $1(播放、暂停等)操作,因为没有名字叫这个的音频路由。
|
||||
- 解决方案:确保要操作的路由存在。
|
||||
|
||||
## WARN CODE 54
|
||||
|
||||
@ -33,8 +33,8 @@ Cannot $1 audio route '$2', since there is not added route named it.
|
||||
Missing start tag for '$1', index: $2.
|
||||
```
|
||||
|
||||
- 警告原因:在 `TextContent` 组件中,匹配不到转义字符 $1 的起始位置。
|
||||
- 解决方案:确保每个转义字符包含起始标签。
|
||||
- 警告原因:在 `TextContent` 组件中,匹配不到转义字符 $1 的起始位置。
|
||||
- 解决方案:确保每个转义字符包含起始标签。
|
||||
|
||||
## WARN CODE 55
|
||||
|
||||
@ -42,8 +42,8 @@ Missing start tag for '$1', index: $2.
|
||||
Unchildable tag '$1' should follow with param.
|
||||
```
|
||||
|
||||
- 警告原因:在 `TextContent` 组件中,没有子标签的转义字符(`\i`)后面必须跟着参数。
|
||||
- 解决方案:确保 `\i` 后面紧跟着图标名称,例如 `\i[greenSlime]`。
|
||||
- 警告原因:在 `TextContent` 组件中,没有子标签的转义字符(`\i`)后面必须跟着参数。
|
||||
- 解决方案:确保 `\i` 后面紧跟着图标名称,例如 `\i[greenSlime]`。
|
||||
|
||||
## WARN CODE 56
|
||||
|
||||
@ -51,8 +51,8 @@ Unchildable tag '$1' should follow with param.
|
||||
Method '$1' has been deprecated. Consider using '$2' instead.
|
||||
```
|
||||
|
||||
- 警告原因:接口 $1 已经弃用。
|
||||
- 解决方案:考虑换为 $2。
|
||||
- 警告原因:接口 $1 已经弃用。
|
||||
- 解决方案:考虑换为 $2。
|
||||
|
||||
## WARN CODE 57
|
||||
|
||||
@ -60,8 +60,8 @@ Method '$1' has been deprecated. Consider using '$2' instead.
|
||||
Repeated UI controller id '$1'.
|
||||
```
|
||||
|
||||
- 警告原因:重复的 UI 控制器 id。
|
||||
- 解决方案:避免 UI 控制器的 id 重复。
|
||||
- 警告原因:重复的 UI 控制器 id。
|
||||
- 解决方案:避免 UI 控制器的 id 重复。
|
||||
|
||||
## WARN CODE 58
|
||||
|
||||
@ -69,8 +69,8 @@ Repeated UI controller id '$1'.
|
||||
Fail to set ellipse round rect, since length of 'ellipse' property should only be 2, 4, 6 or 8. delivered: $1
|
||||
```
|
||||
|
||||
- 警告原因:椭圆模式的圆角矩形传入的参数数组需要是 2,4,6,8 长度,而传入了 $1 长度的数组。
|
||||
- 解决方案:确保传入参数正确。
|
||||
- 警告原因:椭圆模式的圆角矩形传入的参数数组需要是 2,4,6,8 长度,而传入了 $1 长度的数组。
|
||||
- 解决方案:确保传入参数正确。
|
||||
|
||||
## WARN CODE 59
|
||||
|
||||
@ -78,8 +78,8 @@ Fail to set ellipse round rect, since length of 'ellipse' property should only b
|
||||
Unknown icon '$1' in parsing text content.
|
||||
```
|
||||
|
||||
- 警告原因:在 `TextContent` 中出现了未知的图标。
|
||||
- 解决方案:确保 `\i` 后的图标参数正确。
|
||||
- 警告原因:在 `TextContent` 中出现了未知的图标。
|
||||
- 解决方案:确保 `\i` 后的图标参数正确。
|
||||
|
||||
## WARN CODE 60
|
||||
|
||||
@ -87,8 +87,8 @@ Unknown icon '$1' in parsing text content.
|
||||
Repeated Tip id: '$1'.
|
||||
```
|
||||
|
||||
- 警告原因:`Tip` 组件的 id 重复。
|
||||
- 解决方案:避免 id 重复。
|
||||
- 警告原因:`Tip` 组件的 id 重复。
|
||||
- 解决方案:避免 id 重复。
|
||||
|
||||
## WARN CODE 61
|
||||
|
||||
@ -96,8 +96,8 @@ Repeated Tip id: '$1'.
|
||||
Unexpected recursive call of $1.update?$2 in render function. Please ensure you have to do this, if you do, ignore this warn.
|
||||
```
|
||||
|
||||
- 警告原因:在渲染元素的渲染函数中出现了递归 `update` 调用,这会导致元素一直更新而且难以察觉,同时也会引起性能问题。
|
||||
- 解决方案:避免在渲染函数中调用 `update` 方法。如果你必须这么做,请忽视这个警告。
|
||||
- 警告原因:在渲染元素的渲染函数中出现了递归 `update` 调用,这会导致元素一直更新而且难以察觉,同时也会引起性能问题。
|
||||
- 解决方案:避免在渲染函数中调用 `update` 方法。如果你必须这么做,请忽视这个警告。
|
||||
|
||||
## WARN CODE 62
|
||||
|
||||
@ -105,8 +105,8 @@ Unexpected recursive call of $1.update?$2 in render function. Please ensure you
|
||||
Recursive fallback fonts in '$1'.
|
||||
```
|
||||
|
||||
- 警告原因:字体回退出现了循环。例如 `font1` -> `font2` -> `font1`。
|
||||
- 解决方案:避免出现循环字体回退。
|
||||
- 警告原因:字体回退出现了循环。例如 `font1` -> `font2` -> `font1`。
|
||||
- 解决方案:避免出现循环字体回退。
|
||||
|
||||
## WARN CODE 63
|
||||
|
||||
@ -114,5 +114,23 @@ Recursive fallback fonts in '$1'.
|
||||
Uncaught promise error in waiting box component. Error reason: $1
|
||||
```
|
||||
|
||||
- 警告原因:在等待 box 组件(选择框、确认框等)时,出现了异步报错。
|
||||
- 解决方案:根据报错内容解决问题。
|
||||
- 警告原因:在等待 box 组件(选择框、确认框等)时,出现了异步报错。
|
||||
- 解决方案:根据报错内容解决问题。
|
||||
|
||||
## WARN CODE 64
|
||||
|
||||
```txt
|
||||
Text node type and block type mismatch: '$1' vs '$2'
|
||||
```
|
||||
|
||||
- 警告原因:多行文本(TextContent)解析时节点类型和分块类型不一致。
|
||||
- 解决方案:理应不会遇到这个问题,如果遇到了,请到造塔群寻求帮助。
|
||||
|
||||
## WARN CODE 65
|
||||
|
||||
```txt
|
||||
Cannot bind a weather controller twice.
|
||||
```
|
||||
|
||||
- 警告原因:一个天气控制器不能绑定到两个元素上。
|
||||
- 解决方案:如果两个元素需要天气,那么请创建两个天气控制器,一个天气控制器只能绑定一个,且不能解绑。
|
||||
|
Loading…
Reference in New Issue
Block a user