-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathlockview.js
More file actions
105 lines (93 loc) · 3.39 KB
/
lockview.js
File metadata and controls
105 lines (93 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { initializeControlButtons } from "./src/controlButtons.js";
import { migrationHandler } from "./src/migrationHandler.js";
import { Locks } from "./src/locks.js";
import { SceneHandler } from "./src/sceneHandler.js";
import { registerSettings } from "./src/settings.js";
import { Helpers } from "./src/helpers.js";
import { Socket } from "./src/socket.js";
import { UserConfig } from "./src/apps/userConfig.js";
import { Viewbox } from "./src/viewbox.js";
import { registerLibWrapperFunctions } from "./src/libWrapper/overrides.js";
import { InitialViewConfig } from "./src/apps/initialViewConfig.js";
import { SceneConfigurator } from "./src/apps/sceneConfigurator.js";
import { StylesHandler } from "./src/stylesHandler.js";
import { SetViewDialog } from "./src/apps/setViewDialog.js";
import { CloneView } from "./src/apps/cloneView.js";
import { ControlButtonsConfig } from "./src/apps/controlButtonsConfig.js";
export const moduleName = "LockView";
export const documentationUrl = "https://materialfoundry.github.io/LockView/";
//CONFIG.debug.hooks = true;
class LockView {
constructor() {
this.controlButtonVisible = Helpers.getUserSetting('control') && game.settings.get(moduleName, "controlButtons")?.enable;
this.locks = new Locks(Helpers.getUserSetting('enable'));
this.migrationHandler = new migrationHandler();
this.sceneHandler = new SceneHandler();
this.Helpers = Helpers;
this.socket = new Socket();
this.apps = {
userConfig: new UserConfig(),
initialViewConfig: new InitialViewConfig(),
sceneConfigurator: new SceneConfigurator(),
setView: new SetViewDialog(),
cloneView: new CloneView(),
controlButtonsConfig: new ControlButtonsConfig()
}
this.viewbox = new Viewbox();
this.styles = new StylesHandler();
}
refresh(fromSocket=false) {
this.controlButtonVisible = Helpers.getUserSetting('control') && game.settings.get(moduleName, "controlButtons")?.enable;
ui.controls.render();
const locks = canvas.scene.getFlag(moduleName, 'locks');
this.locks.applyLocks = Helpers.getUserSetting('enable');
this.locks.update(locks);
this.viewbox.removeAll();
this.sceneHandler.onSceneLoad(canvas.scene, 'canvasReady')
if (!fromSocket) this.socket.refresh();
setTimeout(()=> {
if (Helpers.getUserSetting('control')) this.socket.requestViewbox();
}, 100);
}
}
Hooks.once('init', () => {
registerLibWrapperFunctions();
registerSettings();
initializeControlButtons();
});
Hooks.once('setup', () => {
globalThis.lockView = new LockView();
});
Hooks.once('ready', async()=>{
if (Helpers.getUserSetting('control'))
lockView.socket.requestViewbox();
lockView.viewbox.emit();
/**
* Debug only
*/
/*
if (game.user.isGM) {
setTimeout(()=>{
//lockView.apps.userConfig.render(true);
//lockView.apps.initialViewConfig.setScene(canvas.scene).render(true);
//lockView.apps.sceneConfigurator.render(true);
//lockView.apps.setView.render(true);
//lockView.apps.controlButtonsConfig.render(true);
},1000)
}
*/
});
/*
Hooks.once('MaterialDeck_Ready', () => {
const moduleData = game.modules.get(moduleName);
game.materialDeck.registerSystem({
moduleId: moduleName,
moduleName: moduleData.title,
version: moduleData.version,
manifest: moduleData.manifest,
documentation: documentationUrl,
actions: [
]
});
});
*/