140 lines
5.9 KiB
HTML
140 lines
5.9 KiB
HTML
<html>
|
|
<head>
|
|
<link rel="stylesheet" type="text/css" href="walkStyle.css">
|
|
<script>
|
|
|
|
var walkToolsOn = false;
|
|
var animationSets = [];
|
|
var currentAnimationSet = "Male";
|
|
|
|
function updateAnimationSets() {
|
|
for (set in animationSets) {
|
|
var opt = animationSets[set];
|
|
var el = document.createElement("option");
|
|
el.textContent = opt;
|
|
el.value = opt;
|
|
elAnimationCharacterSelect.appendChild(el);
|
|
}
|
|
elAnimationCharacterSelect.value = currentAnimationSet;
|
|
}
|
|
|
|
function loaded() {
|
|
elArmsFree = document.getElementById("arms-free");
|
|
elFootstepSounds = document.getElementById("footstep-sounds");
|
|
elAnimationCharacterSelect = document.getElementById("animation-character-select");
|
|
elCalibrateButton = document.getElementById("calibrate-button");
|
|
elPathToAssets = document.getElementById("path-to-assets");
|
|
|
|
// messages from walkSettings.js come in here
|
|
if (window.EventBridge !== undefined) {
|
|
EventBridge.scriptEventReceived.connect(function(data) {
|
|
data = JSON.parse(data);
|
|
|
|
if (data.type === "walkSettings") {
|
|
|
|
if (data.action === "initialParameters") {
|
|
if (data.armsNotAnimated !== undefined) {
|
|
elArmsFree.checked = data.armsNotAnimated;
|
|
}
|
|
if (data.makesFootStepSounds !== undefined) {
|
|
elFootstepSounds.checked = data.makesFootStepSounds;
|
|
}
|
|
if (data.animationSets !== undefined) {
|
|
animationSets = [];
|
|
for (set in data.animationSets) {
|
|
animationSets.push(data.animationSets[set]);
|
|
}
|
|
}
|
|
if (data.currentAnimationSet !== undefined) {
|
|
currentAnimationSet = data.currentAnimationSet;
|
|
updateAnimationSets();
|
|
}
|
|
if (data.pathToAssets !== undefined) {
|
|
elPathToAssets.value = data.pathToAssets;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
// event listeners
|
|
elArmsFree.addEventListener("change", function() {
|
|
EventBridge.emitWebEvent(JSON.stringify({
|
|
type: "walkSettings",
|
|
action: "armsNotAnimated",
|
|
armsNotAnimated: elArmsFree.checked
|
|
}));
|
|
});
|
|
elFootstepSounds.addEventListener("change", function() {
|
|
EventBridge.emitWebEvent(JSON.stringify({
|
|
type: "walkSettings",
|
|
action: "makesFootStepSounds",
|
|
makesFootStepSounds: elFootstepSounds.checked
|
|
}));
|
|
});
|
|
elAnimationCharacterSelect.addEventListener("change", function() {
|
|
EventBridge.emitWebEvent(JSON.stringify({
|
|
type: "walkSettings",
|
|
action: "currentAnimationSet",
|
|
animationSet: elAnimationCharacterSelect.value
|
|
}));
|
|
});
|
|
elCalibrateButton.addEventListener("click", function() {
|
|
walkToolsOn = !walkToolsOn;
|
|
EventBridge.emitWebEvent(JSON.stringify({
|
|
type: "walkSettings",
|
|
action: "calibrate"
|
|
}));
|
|
});
|
|
elPathToAssets.addEventListener("change", function() {
|
|
EventBridge.emitWebEvent(JSON.stringify({
|
|
type: "walkSettings",
|
|
action: "pathToAssets",
|
|
pathToAssets: elPathToAssets.value
|
|
}));
|
|
});
|
|
|
|
// request initial values
|
|
EventBridge.emitWebEvent(JSON.stringify({ type: "walkSettings", action: "initialise" }));
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload='loaded();'>
|
|
<div>
|
|
|
|
<div id="walk-settings-header">
|
|
</div>
|
|
|
|
<div class="settings-section">
|
|
<label>Character</label>
|
|
<select class="editor-select-input" id="animation-character-select"></select>
|
|
</div>
|
|
|
|
<div class="settings-section">
|
|
<label>Path to assets</label>
|
|
<input type="text" id="path-to-assets" value="Loading...">
|
|
</div>
|
|
|
|
<div class="settings-section">
|
|
<label>Don't animate arms</label>
|
|
<span>
|
|
<input type='checkbox' id="arms-free">
|
|
</span>
|
|
</div>
|
|
|
|
<div class="settings-section">
|
|
<label>Play footstep sounds</label>
|
|
<span>
|
|
<input type='checkbox' id="footstep-sounds">
|
|
</span>
|
|
</div>
|
|
|
|
<div class="settings-section">
|
|
<div class="button-group">
|
|
<input type="button" class="settings-button" id="calibrate-button" value="Calibrate"></button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|