refactor: delete pop.ts

This commit is contained in:
unanmed 2024-12-26 21:51:39 +08:00
parent 4102893916
commit fc3a8fb81f
3 changed files with 0 additions and 63 deletions

View File

@ -157,7 +157,6 @@ type InterfaceType = keyof SystemInterfaceMap;
interface PluginInterface {
// 渲染进程定义的插件
pop_r: typeof import('../plugin/pop');
use_r: typeof import('../plugin/use');
fly_r: typeof import('../plugin/ui/fly');
chase_r: typeof import('../plugin/chase');

View File

@ -1,7 +1,6 @@
import * as fly from './ui/fly';
import * as chase from './chase';
import * as completion from './completion';
import * as pop from './pop';
import * as use from './use';
import * as gameCanvas from './fx/gameCanvas';
import * as animateController from './animateController';
@ -13,7 +12,6 @@ import './loopMap';
Mota.Plugin.register('fly_r', fly);
Mota.Plugin.register('chase_r', chase);
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('gameCanvas_r', gameCanvas);
Mota.Plugin.register(

View File

@ -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);
}