Add archive event

This commit is contained in:
MrKBear 2022-04-23 20:32:04 +08:00
parent 430d8a7254
commit b498f0e0a4
3 changed files with 18 additions and 3 deletions

View File

@ -31,6 +31,7 @@ function randomColor(unNormal: boolean = false) {
interface IStatusEvent {
fileSave: void;
fileLoad: void;
renderLoop: number;
physicsLoop: number;
mouseModChange: void;
@ -146,6 +147,18 @@ class Status extends Emitter<IStatusEvent> {
// 映射文件状态改变事件
this.archive.on("fileSave", () => this.emit("fileSave"));
// 处理存档加载事件
this.archive.on("fileLoad", () => {
// 触发对象修改
this.emit("objectChange");
this.emit("labelChange");
this.emit("behaviorChange");
// 映射
this.emit("fileLoad");
})
}
public bindRenderer(renderer: AbstractRenderer) {

View File

@ -55,8 +55,10 @@ class SimulatorDesktop extends Component {
})
};
(window as any).setting = this.setting;
(window as any).status = this.status;
(window as any).LT = {
status: this.status,
setting: this.setting
};
this.electron = {} as ISimulatorAPI;
if ((window as any).API) {

View File

@ -76,7 +76,7 @@ class SimulatorWeb extends Component {
}
// 鱼群模型测试
if (true) {
if (false) {
let fish1 = this.status.newGroup();
let fish2 = this.status.newGroup();
let shark = this.status.newGroup();