-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor.html
More file actions
223 lines (211 loc) · 10.2 KB
/
editor.html
File metadata and controls
223 lines (211 loc) · 10.2 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shining Clone — Map Editor</title>
<style>
:root {
--bg: #1a1815;
--bg2: #221f1a;
--bg3: #2c2823;
--line: #3a342c;
--ink: #efe6d2;
--ink-dim: #b3a890;
--ink-faint: #6b624f;
--accent: #d8a52a;
--accent2: #e8b94f;
--danger: #c0432e;
--good: #4eaa6a;
--select: #59c8ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
background: var(--bg);
color: var(--ink);
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
font-size: 13px;
display: grid;
grid-template-rows: auto 1fr;
overflow: hidden;
}
.bar {
display: flex;
align-items: center;
gap: 12px;
padding: 8px 14px;
background: var(--bg2);
border-bottom: 1px solid var(--line);
}
.brand strong { letter-spacing: .04em; }
.brand .sub { margin-left: 8px; color: var(--ink-dim); font-style: italic; }
.actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
button, .btn {
background: var(--bg3);
color: var(--ink);
border: 1px solid var(--line);
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
font: inherit;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent2); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); color: #1a1815; border-color: var(--accent2); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent2); }
button.danger { color: #ffb4a8; border-color: #5a2a22; }
button.danger:hover { background: var(--danger); color: #fff; }
main {
display: grid;
grid-template-columns: 220px 1fr 280px;
height: 100%;
min-height: 0;
}
aside.maps {
background: var(--bg2);
border-right: 1px solid var(--line);
display: flex;
flex-direction: column;
min-height: 0;
}
.filter { padding: 8px; border-bottom: 1px solid var(--line); }
.filter input {
width: 100%;
background: var(--bg);
color: var(--ink);
border: 1px solid var(--line);
padding: 5px 8px;
border-radius: 3px;
font: inherit;
}
#map-list { list-style: none; margin: 0; padding: 4px 0; flex: 1; overflow: auto; }
#map-list li { padding: 6px 10px; cursor: pointer; border-left: 3px solid transparent; }
#map-list li:hover { background: var(--bg3); }
#map-list li.active { background: var(--bg3); border-left-color: var(--accent); color: var(--accent2); }
#map-list li small { display: block; color: var(--ink-faint); font-size: 11px; }
.maps .footer { padding: 8px; border-top: 1px solid var(--line); }
section.canvas-wrap { display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); min-width: 0; }
.canvas-header { padding: 8px 14px; background: var(--bg2); border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 14px; }
.canvas-header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.canvas-header #map-meta { color: var(--ink-faint); font-size: 12px; }
.dirty { color: var(--accent); font-size: 12px; }
.canvas-scroll { overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 14px; min-height: 0; }
canvas#board { background: #0c0e14; cursor: crosshair; border: 1px solid #2a2520; image-rendering: pixelated; }
.canvas-footer { padding: 6px 14px; background: var(--bg2); border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 12px; font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace; }
aside.inspector { background: var(--bg2); border-left: 1px solid var(--line); overflow: auto; padding: 0; min-height: 0; }
.panel { border-bottom: 1px solid var(--line); padding: 12px 14px; }
.panel h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.panel .hint { color: var(--ink-faint); font-size: 11px; }
.panel label { display: block; padding: 2px 0; }
.panel .row { display: flex; gap: 8px; padding: 3px 0; align-items: center; }
.panel .row .lbl { width: 70px; color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.panel input[type="text"], .panel input[type="number"], .panel select { background: var(--bg); color: var(--ink); border: 1px solid var(--line); padding: 4px 6px; border-radius: 3px; font: inherit; width: 100%; }
.palette { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.palette button.tool {
display: flex; align-items: center; gap: 6px;
padding: 6px 8px; border-radius: 3px; cursor: pointer;
background: var(--bg3); border: 1px solid var(--line);
text-align: left; font-size: 11px;
position: relative;
}
.palette button.tool.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.palette button.tool .swatch { width: 16px; height: 16px; border: 1px solid #000; flex: 0 0 auto; }
.units-list { max-height: 200px; overflow: auto; }
.units-list .unit-row { display: flex; justify-content: space-between; padding: 3px 4px; cursor: pointer; border-radius: 2px; font-size: 12px; }
.units-list .unit-row:hover { background: var(--bg3); }
.units-list .unit-row.selected { background: var(--bg3); color: var(--accent2); border-left: 2px solid var(--accent); padding-left: 2px; }
.units-list .unit-row .pos { color: var(--ink-faint); font-family: ui-monospace, "Consolas", monospace; }
kbd { background: var(--bg3); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; font-family: ui-monospace, "Consolas", monospace; font-size: 11px; }
.help { margin: 0; padding-left: 16px; color: var(--ink-dim); }
.help li { padding: 2px 0; font-size: 12px; }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--bg3); border: 1px solid var(--accent); color: var(--ink); padding: 10px 14px; border-radius: 4px; font-size: 12px; box-shadow: 0 4px 12px #000a; opacity: 0; transition: opacity 200ms ease; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.error { border-color: var(--danger); color: #ffb4a8; }
</style>
</head>
<body>
<header class="bar">
<div class="brand">
<strong>Shining Clone</strong>
<span class="sub">map editor</span>
</div>
<div class="actions">
<button id="btn-undo" title="Undo (Ctrl+Z)" disabled>↶ Undo</button>
<button id="btn-redo" title="Redo (Ctrl+Shift+Z)" disabled>↷ Redo</button>
<span style="width:12px"></span>
<a href="/" style="color:var(--ink-dim); text-decoration:none; font-size:12px">← back to game</a>
<button id="btn-reload" title="Reload current map from disk">Reload</button>
<button id="btn-save" class="primary" title="Save (Ctrl+S)" disabled>Save</button>
</div>
</header>
<main>
<aside class="maps">
<div class="filter">
<input id="map-filter" type="search" placeholder="Filter maps…" />
</div>
<ul id="map-list"></ul>
<div class="footer">
<button id="btn-new" style="width:100%">+ New Map</button>
</div>
</aside>
<section class="canvas-wrap">
<div class="canvas-header">
<h2 id="map-title">Pick a map</h2>
<span id="map-meta"></span>
<span id="dirty-flag" class="dirty" hidden>● unsaved</span>
</div>
<div class="canvas-scroll">
<canvas id="board" width="512" height="384"></canvas>
</div>
<div class="canvas-footer" id="status">Ready.</div>
</section>
<aside class="inspector">
<div class="panel">
<h3>Tools</h3>
<div class="palette" id="tool-palette"></div>
</div>
<div class="panel">
<h3>Map</h3>
<div class="row"><span class="lbl">Id</span><input type="text" id="map-id" /></div>
<div class="row"><span class="lbl">Name</span><input type="text" id="map-name" /></div>
<div class="row"><span class="lbl">Cols</span><input type="number" id="map-cols" min="4" max="64" /></div>
<div class="row"><span class="lbl">Rows</span><input type="number" id="map-rows" min="4" max="48" /></div>
<div class="row">
<span class="lbl">Victory</span>
<select id="map-victory">
<option value="rout_enemy">Rout all enemies</option>
<option value="defeat_boss">Defeat boss</option>
<option value="survive_n_turns">Survive N turns</option>
<option value="reach_tile">Reach a tile</option>
</select>
</div>
</div>
<div class="panel">
<h3>Place Unit</h3>
<div class="hint">Choose a unit then click a tile (tool: Place Unit).</div>
<div class="row" style="margin-top:6px">
<select id="place-unit-select"></select>
</div>
</div>
<div class="panel">
<h3>Units on map (<span id="unit-count">0</span>)</h3>
<div class="units-list" id="units-list"></div>
</div>
<div class="panel">
<h3>Help</h3>
<ul class="help">
<li><kbd>1</kbd>–<kbd>6</kbd> — pick terrain</li>
<li><kbd>U</kbd> — place unit · <kbd>S</kbd> — select · <kbd>E</kbd> — erase unit</li>
<li><kbd>Click</kbd> — paint a tile · drag to paint a stroke</li>
<li><kbd>Del</kbd> — delete selected unit</li>
<li><kbd>Ctrl+Z</kbd> / <kbd>Ctrl+Shift+Z</kbd> — undo / redo</li>
<li><kbd>Ctrl+S</kbd> — save</li>
</ul>
</div>
</aside>
</main>
<div id="toast" class="toast"></div>
<script type="module" src="/src/editor/main.ts"></script>
</body>
</html>