118 lines
3.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Unity 이벤트 전송 설정</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 10px;
background-color: #2d2d30;
color: #ffffff;
}
.container {
padding: 10px;
}
h2 {
color: #4CAF50;
margin-bottom: 20px;
}
.setting-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input, select {
width: 100%;
padding: 8px;
background-color: #3c3c3c;
border: 1px solid #555;
border-radius: 4px;
color: #ffffff;
box-sizing: border-box;
}
.info {
background-color: #1e1e1e;
padding: 10px;
border-radius: 4px;
margin-top: 15px;
font-size: 12px;
}
</style>
</head>
<body>
<div class="container">
<h2>Unity 이벤트 전송</h2>
<div class="setting-group">
<label for="eventType">이벤트 타입:</label>
<select id="eventType">
<option value="streamdock_button_clicked">버튼 클릭</option>
<option value="custom_event">커스텀 이벤트</option>
<option value="game_action">게임 액션</option>
</select>
</div>
<div class="setting-group">
<label for="buttonText">버튼 텍스트:</label>
<input type="text" id="buttonText" placeholder="Unity 이벤트" value="Unity 이벤트">
</div>
<div class="info">
<strong>사용법:</strong><br>
• Unity에서 StreamDockCommunicator 스크립트를 사용하세요<br>
• WebSocket 연결: ws://localhost:15732<br>
• 이 버튼을 누르면 Unity로 이벤트가 전송됩니다
</div>
</div>
<script>
// StreamDock Property Inspector API
var websocket = null;
var uuid = null;
var actionInfo = {};
function connectSocket(inPort, inUUID, inRegisterEvent, inInfo, inActionInfo) {
uuid = inUUID;
actionInfo = JSON.parse(inActionInfo);
websocket = new WebSocket('ws://localhost:' + inPort);
websocket.onopen = function() {
var json = {
event: inRegisterEvent,
uuid: inUUID
};
websocket.send(JSON.stringify(json));
};
}
// 설정 저장
function saveSettings() {
const settings = {
eventType: document.getElementById('eventType').value,
buttonText: document.getElementById('buttonText').value
};
if (websocket) {
const json = {
event: 'setSettings',
context: uuid,
payload: settings
};
websocket.send(JSON.stringify(json));
}
}
// 이벤트 리스너
document.getElementById('eventType').addEventListener('change', saveSettings);
document.getElementById('buttonText').addEventListener('input', saveSettings);
</script>
</body>
</html>