mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-05-08 19:37:07 +08:00
27 lines
610 B
TypeScript
27 lines
610 B
TypeScript
import { Director, director, js } from 'cc';
|
|
|
|
/** 全局游戏时间缩放 */
|
|
//@ts-ignore
|
|
if (!Director.prototype['__$cc-director-speed-extension$__']) {
|
|
//@ts-ignore
|
|
Director.prototype['__$cc-director-speed-extension$__'] = true;
|
|
|
|
const oldTick = director.tick.bind(director);
|
|
director.tick = function (dt) {
|
|
dt *= director.globalGameTimeScale;
|
|
oldTick(dt);
|
|
};
|
|
|
|
js.mixin(Director.prototype, {
|
|
globalGameTimeScale: 1,
|
|
});
|
|
}
|
|
|
|
declare module 'cc' {
|
|
interface Director {
|
|
globalGameTimeScale: number;
|
|
}
|
|
}
|
|
|
|
// director.globalGameTimeScale = 0.5;
|