proof of concept of ui button calling engine code
This commit is contained in:
parent
84e5d33173
commit
4b1e93067f
@ -16,5 +16,5 @@ mainPanel {
|
||||
<button onclick="hook('ROOM_TOOL_TOGGLE')">Show Rooms</button>
|
||||
<button onclick="hook('ROOM_TOOL_TOGGLE')">Select Furniture Spots</button>
|
||||
<button onclick="hook('ROOM_TOOL_TOGGLE')">Show Furniture Spots</button>
|
||||
<button onclick="console.log(Object.keys(engine))">Detect Room</button>
|
||||
<button onclick="engine.playerState.controlState.roomTool.updateState('Detect Room')">Detect Room</button>
|
||||
</div>
|
||||
@ -66,20 +66,9 @@ export const clientHooks: Hook[] = [
|
||||
engine.classes.areaUtils.static.selectAreaRectangular()
|
||||
}
|
||||
},
|
||||
{
|
||||
signal: "ROOM_TOOL_TOGGLE",
|
||||
callback: (engine: Engine) => {
|
||||
// engine.singletons.loggerScripts.WARNING('asdf')
|
||||
// engine.singletons.loggerScripts.WARNING(JSON.stringify(globalThis))
|
||||
}
|
||||
},
|
||||
{
|
||||
signal: "ROOM_TOOL_MENU",
|
||||
callback: (engine: Engine) => {
|
||||
console.log(JSON.stringify({}))
|
||||
console.log(Object.keys(globalThis))
|
||||
// engine.singletons.loggerScripts.WARNING('asdf')
|
||||
// engine.singletons.loggerScripts.WARNING(JSON.stringify(globalThis))
|
||||
engine.classes.menuUtils.static.openDialog('Data/menu/room/roomToolConfig.html')
|
||||
}
|
||||
},
|
||||
|
||||
@ -3,21 +3,30 @@
|
||||
/**
|
||||
* Overall state of the player's controls
|
||||
*/
|
||||
export interface PlayerControlState {
|
||||
export class PlayerControlState {
|
||||
/**
|
||||
* State of the room tool
|
||||
*/
|
||||
roomTool: RoomToolState,
|
||||
roomTool: RoomToolState = new RoomToolState()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* State for the room tool
|
||||
*/
|
||||
export interface RoomToolState {
|
||||
export class RoomToolState {
|
||||
/**
|
||||
* The currently selected functionality of the room tool
|
||||
*/
|
||||
currentState: number,
|
||||
currentState: number = 0
|
||||
|
||||
/**
|
||||
* Updates the state of the room tool
|
||||
* @param value The new value
|
||||
*/
|
||||
updateState(value: string){
|
||||
console.log(value)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,9 +43,5 @@ export interface ClientPlayer {
|
||||
* Actual player control state
|
||||
*/
|
||||
export const defaultPlayerState: ClientPlayer = {
|
||||
controlState: {
|
||||
roomTool: {
|
||||
currentState: 0
|
||||
}
|
||||
}
|
||||
controlState: new PlayerControlState()
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
|
||||
|
||||
/**
|
||||
* Overall state of the player's controls
|
||||
*/
|
||||
interface PlayerControlState {
|
||||
/**
|
||||
* State of the room tool
|
||||
*/
|
||||
roomTool: RoomToolState,
|
||||
}
|
||||
|
||||
/**
|
||||
* State for the room tool
|
||||
*/
|
||||
interface RoomToolState {
|
||||
/**
|
||||
* The currently selected functionality of the room tool
|
||||
*/
|
||||
currentState: number,
|
||||
}
|
||||
|
||||
/**
|
||||
* Actual player control state
|
||||
*/
|
||||
export let playerControlState: PlayerControlState = {
|
||||
roomTool: {
|
||||
currentState: 0
|
||||
}
|
||||
}
|
||||
@ -1845,6 +1845,8 @@ Fix opengl bug
|
||||
Fix typescript out-of-context compilation caching
|
||||
Script recompilation work
|
||||
HTML-defined buttons now directly eval in the js context instead of going through hook manager
|
||||
Fix caching with deleted source files
|
||||
Proof of concept of ui button calling engine code
|
||||
|
||||
|
||||
|
||||
|
||||
@ -339,6 +339,11 @@ public class ScriptContext {
|
||||
long lastModified = 0;
|
||||
try {
|
||||
File correspondingSourceFile = new File(pathRaw.replace(".cache\\tscache\\src\\", "./assets/").replace(".js",".ts"));
|
||||
if(!correspondingSourceFile.exists()){
|
||||
checksumMap.getFileLastModifyMap().remove(cacheKey);
|
||||
//skip non-existant file
|
||||
return;
|
||||
}
|
||||
FileTime time = Files.getLastModifiedTime(correspondingSourceFile.toPath());
|
||||
lastModified = time.toMillis();
|
||||
} catch (IOException e) {
|
||||
|
||||
@ -323,6 +323,9 @@ public class ScriptEngine extends SignalServiceImpl {
|
||||
timeMatch = fileLastModifyMap.get(normalizedPath).contains(lastModified + "");
|
||||
}
|
||||
LoggerInterface.loggerScripts.DEBUG("Skipping Preload: " + normalizedPath + " " + inMap + " " + timeMatch + " " + correspondingSourceFile.exists() + " " + lastModified + " " + correspondingSourceFile.toString());
|
||||
if(!inMap){
|
||||
continue;
|
||||
}
|
||||
rVal = false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user