2019-12-22 02:40:42 +08:00
|
|
|
import { QuestEditorView } from "./gui/QuestEditorView";
|
|
|
|
import { GuiStore } from "../core/stores/GuiStore";
|
|
|
|
import { QuestEditorStore } from "./stores/QuestEditorStore";
|
|
|
|
import { AsmEditorStore } from "./stores/AsmEditorStore";
|
2019-12-22 05:49:41 +08:00
|
|
|
import { AreaStore } from "./stores/AreaStore";
|
|
|
|
import { AreaAssetLoader } from "./loading/AreaAssetLoader";
|
|
|
|
import { HttpClient } from "../core/HttpClient";
|
|
|
|
import { EntityImageRenderer } from "./rendering/EntityImageRenderer";
|
|
|
|
import { EntityAssetLoader } from "./loading/EntityAssetLoader";
|
2020-01-20 00:16:28 +08:00
|
|
|
import { DisposableThreeRenderer } from "../core/rendering/ThreeRenderer";
|
2019-12-22 22:30:16 +08:00
|
|
|
import { QuestEditorUiPersister } from "./persistence/QuestEditorUiPersister";
|
2020-01-15 04:19:07 +08:00
|
|
|
import { QuestEditorToolBarView } from "./gui/QuestEditorToolBarView";
|
2019-12-24 10:04:18 +08:00
|
|
|
import { QuestEditorToolBarController } from "./controllers/QuestEditorToolBarController";
|
|
|
|
import { QuestInfoView } from "./gui/QuestInfoView";
|
|
|
|
import { NpcCountsView } from "./gui/NpcCountsView";
|
|
|
|
import { QuestEditorRendererView } from "./gui/QuestEditorRendererView";
|
|
|
|
import { AsmEditorView } from "./gui/AsmEditorView";
|
|
|
|
import { EntityInfoView } from "./gui/EntityInfoView";
|
|
|
|
import { NpcListView } from "./gui/NpcListView";
|
|
|
|
import { ObjectListView } from "./gui/ObjectListView";
|
|
|
|
import { EventsView } from "./gui/EventsView";
|
|
|
|
import { QuestRunnerRendererView } from "./gui/QuestRunnerRendererView";
|
|
|
|
import { RegistersView } from "./gui/RegistersView";
|
|
|
|
import { QuestInfoController } from "./controllers/QuestInfoController";
|
2019-12-25 07:17:02 +08:00
|
|
|
import { Disposer } from "../core/observable/Disposer";
|
|
|
|
import { Disposable } from "../core/observable/Disposable";
|
2019-12-26 07:44:30 +08:00
|
|
|
import { EntityInfoController } from "./controllers/EntityInfoController";
|
2019-12-27 01:46:28 +08:00
|
|
|
import { NpcCountsController } from "./controllers/NpcCountsController";
|
2019-12-27 07:55:32 +08:00
|
|
|
import { EventsController } from "./controllers/EventsController";
|
2020-05-01 00:27:19 +08:00
|
|
|
import { DebugView } from "./gui/DebugView";
|
|
|
|
import { DebugController } from "./controllers/DebugController";
|
|
|
|
import { LogStore } from "./stores/LogStore";
|
2019-12-22 02:40:42 +08:00
|
|
|
|
2019-12-22 05:49:41 +08:00
|
|
|
export function initialize_quest_editor(
|
|
|
|
http_client: HttpClient,
|
|
|
|
gui_store: GuiStore,
|
2019-12-22 07:43:27 +08:00
|
|
|
create_three_renderer: () => DisposableThreeRenderer,
|
2019-12-25 07:17:02 +08:00
|
|
|
): { view: QuestEditorView } & Disposable {
|
|
|
|
const disposer = new Disposer();
|
|
|
|
|
2019-12-22 05:49:41 +08:00
|
|
|
// Asset Loaders
|
2019-12-25 07:17:02 +08:00
|
|
|
const area_asset_loader = disposer.add(new AreaAssetLoader(http_client));
|
|
|
|
const entity_asset_loader = disposer.add(new EntityAssetLoader(http_client));
|
2019-12-22 05:49:41 +08:00
|
|
|
|
|
|
|
// Stores
|
2019-12-25 07:17:02 +08:00
|
|
|
const area_store = disposer.add(new AreaStore(area_asset_loader));
|
2020-05-01 00:27:19 +08:00
|
|
|
const log_store = disposer.add(new LogStore());
|
|
|
|
const quest_editor_store = disposer.add(new QuestEditorStore(gui_store, area_store, log_store));
|
2019-12-25 07:17:02 +08:00
|
|
|
const asm_editor_store = disposer.add(new AsmEditorStore(quest_editor_store));
|
2019-12-22 02:40:42 +08:00
|
|
|
|
2019-12-22 22:30:16 +08:00
|
|
|
// Persisters
|
|
|
|
const quest_editor_ui_persister = new QuestEditorUiPersister();
|
|
|
|
|
2019-12-22 05:49:41 +08:00
|
|
|
// Entity Image Renderer
|
2019-12-25 07:17:02 +08:00
|
|
|
const entity_image_renderer = disposer.add(
|
|
|
|
new EntityImageRenderer(entity_asset_loader, create_three_renderer),
|
|
|
|
);
|
2019-12-22 05:49:41 +08:00
|
|
|
|
|
|
|
// View
|
2019-12-25 07:17:02 +08:00
|
|
|
const view = disposer.add(
|
|
|
|
new QuestEditorView(
|
|
|
|
gui_store,
|
|
|
|
quest_editor_store,
|
|
|
|
quest_editor_ui_persister,
|
|
|
|
disposer.add(
|
2020-01-15 04:19:07 +08:00
|
|
|
new QuestEditorToolBarView(
|
2019-12-27 01:46:28 +08:00
|
|
|
disposer.add(
|
|
|
|
new QuestEditorToolBarController(gui_store, area_store, quest_editor_store),
|
|
|
|
),
|
2019-12-25 07:17:02 +08:00
|
|
|
),
|
2019-12-24 10:04:18 +08:00
|
|
|
),
|
2019-12-27 01:46:28 +08:00
|
|
|
() => new QuestInfoView(disposer.add(new QuestInfoController(quest_editor_store))),
|
|
|
|
() => new NpcCountsView(disposer.add(new NpcCountsController(quest_editor_store))),
|
2019-12-25 07:17:02 +08:00
|
|
|
() =>
|
|
|
|
new QuestEditorRendererView(
|
|
|
|
quest_editor_store,
|
|
|
|
area_asset_loader,
|
|
|
|
entity_asset_loader,
|
|
|
|
create_three_renderer(),
|
|
|
|
),
|
|
|
|
() => new AsmEditorView(gui_store, quest_editor_store.quest_runner, asm_editor_store),
|
2019-12-27 01:46:28 +08:00
|
|
|
() => new EntityInfoView(disposer.add(new EntityInfoController(quest_editor_store))),
|
2019-12-25 07:17:02 +08:00
|
|
|
() => new NpcListView(quest_editor_store, entity_image_renderer),
|
|
|
|
() => new ObjectListView(quest_editor_store, entity_image_renderer),
|
2019-12-27 07:55:32 +08:00
|
|
|
() => new EventsView(disposer.add(new EventsController(quest_editor_store))),
|
2019-12-25 07:17:02 +08:00
|
|
|
() =>
|
|
|
|
new QuestRunnerRendererView(
|
|
|
|
quest_editor_store,
|
|
|
|
area_asset_loader,
|
|
|
|
entity_asset_loader,
|
|
|
|
create_three_renderer(),
|
|
|
|
),
|
2020-05-01 00:27:19 +08:00
|
|
|
() =>
|
|
|
|
new DebugView(
|
|
|
|
disposer.add(new DebugController(gui_store, quest_editor_store, log_store)),
|
|
|
|
),
|
2019-12-25 07:17:02 +08:00
|
|
|
() => new RegistersView(quest_editor_store.quest_runner),
|
|
|
|
),
|
2019-12-22 05:49:41 +08:00
|
|
|
);
|
2019-12-25 07:17:02 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
view,
|
|
|
|
dispose() {
|
|
|
|
disposer.dispose();
|
|
|
|
},
|
|
|
|
};
|
2019-12-22 02:40:42 +08:00
|
|
|
}
|