mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-18 20:09:27 +08:00
refactor: delete pop.ts
This commit is contained in:
parent
4102893916
commit
fc3a8fb81f
@ -157,7 +157,6 @@ type InterfaceType = keyof SystemInterfaceMap;
|
|||||||
|
|
||||||
interface PluginInterface {
|
interface PluginInterface {
|
||||||
// 渲染进程定义的插件
|
// 渲染进程定义的插件
|
||||||
pop_r: typeof import('../plugin/pop');
|
|
||||||
use_r: typeof import('../plugin/use');
|
use_r: typeof import('../plugin/use');
|
||||||
fly_r: typeof import('../plugin/ui/fly');
|
fly_r: typeof import('../plugin/ui/fly');
|
||||||
chase_r: typeof import('../plugin/chase');
|
chase_r: typeof import('../plugin/chase');
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import * as fly from './ui/fly';
|
import * as fly from './ui/fly';
|
||||||
import * as chase from './chase';
|
import * as chase from './chase';
|
||||||
import * as completion from './completion';
|
import * as completion from './completion';
|
||||||
import * as pop from './pop';
|
|
||||||
import * as use from './use';
|
import * as use from './use';
|
||||||
import * as gameCanvas from './fx/gameCanvas';
|
import * as gameCanvas from './fx/gameCanvas';
|
||||||
import * as animateController from './animateController';
|
import * as animateController from './animateController';
|
||||||
@ -13,7 +12,6 @@ import './loopMap';
|
|||||||
Mota.Plugin.register('fly_r', fly);
|
Mota.Plugin.register('fly_r', fly);
|
||||||
Mota.Plugin.register('chase_r', chase);
|
Mota.Plugin.register('chase_r', chase);
|
||||||
Mota.Plugin.register('completion_r', completion, completion.init);
|
Mota.Plugin.register('completion_r', completion, completion.init);
|
||||||
Mota.Plugin.register('pop_r', pop, pop.init);
|
|
||||||
Mota.Plugin.register('use_r', use);
|
Mota.Plugin.register('use_r', use);
|
||||||
Mota.Plugin.register('gameCanvas_r', gameCanvas);
|
Mota.Plugin.register('gameCanvas_r', gameCanvas);
|
||||||
Mota.Plugin.register(
|
Mota.Plugin.register(
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
// 示例插件:文字弹出
|
|
||||||
// todo: 重写
|
|
||||||
|
|
||||||
let pop: any[] = [];
|
|
||||||
|
|
||||||
let time = 0;
|
|
||||||
|
|
||||||
export function init() {
|
|
||||||
// core.registerAnimationFrame('pop', true, popValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 弹出文字
|
|
||||||
*/
|
|
||||||
function popValue(t: number) {
|
|
||||||
if (t - time < 15) return;
|
|
||||||
let ctx = core.getContextByName('pop')!;
|
|
||||||
if (!ctx) ctx = core.createCanvas('pop', 0, 0, core._PX_, core._PY_, 90);
|
|
||||||
core.clearMap(ctx);
|
|
||||||
let count = 0;
|
|
||||||
pop.forEach(function (one) {
|
|
||||||
// 由frame计算出dy
|
|
||||||
const dy = 6 - one.frame * 0.2;
|
|
||||||
const dx = 1;
|
|
||||||
one.py -= dy;
|
|
||||||
one.px += dx;
|
|
||||||
one.frame++;
|
|
||||||
// 绘制
|
|
||||||
if (one.frame >= 60) core.setAlpha(ctx, 3 - one.frame / 30);
|
|
||||||
else core.setAlpha(ctx, 1);
|
|
||||||
core.fillBoldText(
|
|
||||||
ctx,
|
|
||||||
one.value,
|
|
||||||
one.px,
|
|
||||||
one.py,
|
|
||||||
'#f22',
|
|
||||||
'#000',
|
|
||||||
'24px normal'
|
|
||||||
);
|
|
||||||
if (one.frame >= 90) count++;
|
|
||||||
});
|
|
||||||
if (count > 0) pop.splice(0, count);
|
|
||||||
time = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加弹出文字
|
|
||||||
* @param px 弹出的横坐标
|
|
||||||
* @param py 弹出的纵坐标
|
|
||||||
* @param value 弹出的文字
|
|
||||||
*/
|
|
||||||
export function addPop(px: number, py: number, value: string) {
|
|
||||||
var data = {
|
|
||||||
px: px,
|
|
||||||
py: py,
|
|
||||||
value: value,
|
|
||||||
frame: 0
|
|
||||||
};
|
|
||||||
pop.push(data);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user