@pretty-chitty/core 2.3.5 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/1ea77c9e193d437b9bfa.woff +0 -0
- package/dist/2282b9ff81c2cd7cf5b4.mp3 +0 -0
- package/dist/22a445dd65cce94defdd.woff2 +0 -0
- package/dist/2b94f846c05846d73536.mp3 +0 -0
- package/dist/32d6296b80e676d66bda.woff +0 -0
- package/dist/36e7e033bfef7b32bf3c.mp3 +0 -0
- package/dist/37f3b2ddcbe588b2aaa5.jpg +0 -0
- package/dist/3f0fb9058a03e14ad2fa.jpg +0 -0
- package/dist/412050b824afb24fef88.mp3 +0 -0
- package/dist/468cf705a21091e5f755.mp3 +0 -0
- package/dist/47a823ae095f5f4cfd82.woff +0 -0
- package/dist/5062c95fb3c68af2ee2e.woff2 +0 -0
- package/dist/5aecd40f51b84ffb6efa.woff2 +0 -0
- package/dist/5d184fc5808150d51726.mp3 +0 -0
- package/dist/60b937eec087d648c831.woff2 +0 -0
- package/dist/63da6d06ce0ff84b8b2c.mp3 +0 -0
- package/dist/63f3d4f28784375801ac.woff +0 -0
- package/dist/669804475e1d5e52a4f5.mp3 +0 -0
- package/dist/6a6d042ba2a9290aba9c.woff2 +0 -0
- package/dist/72e60d1c7f7c603f31d6.woff +0 -0
- package/dist/788c3dfe27f9734edff5.mp3 +0 -0
- package/dist/7e339dfbea59fe54f2e3.png +0 -0
- package/dist/7ecd698217d211cad841.mp3 +0 -0
- package/dist/8c8f3dcefaec6a40d787.mp3 +0 -0
- package/dist/8d29c92c7f9ca79d8a5c.mp3 +0 -0
- package/dist/8ea5f16c95238d2ff902.mp3 +0 -0
- package/dist/97e19a7d82ab67080019.mp3 +0 -0
- package/dist/98373f88bbc3b8237b09.mp3 +0 -0
- package/dist/98c71bee993adc81d5be.mp3 +0 -0
- package/dist/a09db3cc936e581f320a.mp3 +0 -0
- package/dist/a51c64560480e6fdae0d.mp3 +0 -0
- package/dist/ad2392bc6cdf9bb1b5fd.mp3 +0 -0
- package/dist/b3708bfbeff0d340bdef.mp3 +0 -0
- package/dist/b81893c113e684d9eec4.woff +0 -0
- package/dist/bc6bc3d7802469910f83.mp3 +0 -0
- package/dist/bde37bf538e175149c3b.mp3 +0 -0
- package/dist/d6b5a560b17d31cd3c7c.mp3 +0 -0
- package/dist/dd3231a4b15c4f8f2b94.mp3 +0 -0
- package/dist/f63358bf5b9e4f8d7f79.mp3 +0 -0
- package/dist/fc02be176de567378fa4.woff2 +0 -0
- package/dist/fe1535c25dc5d879c085.mp3 +0 -0
- package/dist/index.html +12 -0
- package/dist/main.034dfcc6b83fdd218994.hot-update.js +265 -0
- package/dist/main.034dfcc6b83fdd218994.hot-update.js.map +1 -0
- package/dist/main.034dfcc6b83fdd218994.hot-update.json +1 -0
- package/dist/main.0c0a98b3b3e1e004beb2.hot-update.js +265 -0
- package/dist/main.0c0a98b3b3e1e004beb2.hot-update.js.map +1 -0
- package/dist/main.0c0a98b3b3e1e004beb2.hot-update.json +1 -0
- package/dist/main.13daf8cac0f0a3231f6a.hot-update.js +190 -0
- package/dist/main.13daf8cac0f0a3231f6a.hot-update.js.map +1 -0
- package/dist/main.13daf8cac0f0a3231f6a.hot-update.json +1 -0
- package/dist/main.14e055541f09be93a122.hot-update.js +321 -0
- package/dist/main.14e055541f09be93a122.hot-update.js.map +1 -0
- package/dist/main.14e055541f09be93a122.hot-update.json +1 -0
- package/dist/main.26499c88c63113e7a3f8.hot-update.js +190 -0
- package/dist/main.26499c88c63113e7a3f8.hot-update.js.map +1 -0
- package/dist/main.26499c88c63113e7a3f8.hot-update.json +1 -0
- package/dist/main.2c3a3f1928ea25c4b79a.hot-update.js +11 -0
- package/dist/main.2c3a3f1928ea25c4b79a.hot-update.js.map +1 -0
- package/dist/main.2c3a3f1928ea25c4b79a.hot-update.json +1 -0
- package/dist/main.324b63996b3b36daf5af.hot-update.js +603 -0
- package/dist/main.324b63996b3b36daf5af.hot-update.js.map +1 -0
- package/dist/main.324b63996b3b36daf5af.hot-update.json +1 -0
- package/dist/main.4b0f7799388b5de9908d.hot-update.js +265 -0
- package/dist/main.4b0f7799388b5de9908d.hot-update.js.map +1 -0
- package/dist/main.4b0f7799388b5de9908d.hot-update.json +1 -0
- package/dist/main.6424291443afea7eb7ac.hot-update.js +187 -0
- package/dist/main.6424291443afea7eb7ac.hot-update.js.map +1 -0
- package/dist/main.6424291443afea7eb7ac.hot-update.json +1 -0
- package/dist/main.69127e32a0c76b421f15.hot-update.js +392 -0
- package/dist/main.69127e32a0c76b421f15.hot-update.js.map +1 -0
- package/dist/main.69127e32a0c76b421f15.hot-update.json +1 -0
- package/dist/main.755d91e1a6c7e6bd6702.hot-update.js +265 -0
- package/dist/main.755d91e1a6c7e6bd6702.hot-update.js.map +1 -0
- package/dist/main.755d91e1a6c7e6bd6702.hot-update.json +1 -0
- package/dist/main.75a666c9d30baa58c5ec.hot-update.js +265 -0
- package/dist/main.75a666c9d30baa58c5ec.hot-update.js.map +1 -0
- package/dist/main.75a666c9d30baa58c5ec.hot-update.json +1 -0
- package/dist/main.828f4c348446c6c3640d.hot-update.js +11 -0
- package/dist/main.828f4c348446c6c3640d.hot-update.js.map +1 -0
- package/dist/main.828f4c348446c6c3640d.hot-update.json +1 -0
- package/dist/main.8459249b2915a8823bd3.hot-update.js +321 -0
- package/dist/main.8459249b2915a8823bd3.hot-update.js.map +1 -0
- package/dist/main.8459249b2915a8823bd3.hot-update.json +1 -0
- package/dist/main.87f757c2602cac7001cb.hot-update.js +382 -0
- package/dist/main.87f757c2602cac7001cb.hot-update.js.map +1 -0
- package/dist/main.87f757c2602cac7001cb.hot-update.json +1 -0
- package/dist/main.8aa248086ab27072c348.hot-update.js +265 -0
- package/dist/main.8aa248086ab27072c348.hot-update.js.map +1 -0
- package/dist/main.8aa248086ab27072c348.hot-update.json +1 -0
- package/dist/main.8ce461bf769f3943b7ed.hot-update.js +265 -0
- package/dist/main.8ce461bf769f3943b7ed.hot-update.js.map +1 -0
- package/dist/main.8ce461bf769f3943b7ed.hot-update.json +1 -0
- package/dist/main.9fdbde5beb7c70940250.hot-update.js +392 -0
- package/dist/main.9fdbde5beb7c70940250.hot-update.js.map +1 -0
- package/dist/main.9fdbde5beb7c70940250.hot-update.json +1 -0
- package/dist/main.af59faaae348c919e033.hot-update.js +11 -0
- package/dist/main.af59faaae348c919e033.hot-update.js.map +1 -0
- package/dist/main.af59faaae348c919e033.hot-update.json +1 -0
- package/dist/main.b11900976593b0e609ee.hot-update.js +187 -0
- package/dist/main.b11900976593b0e609ee.hot-update.js.map +1 -0
- package/dist/main.b11900976593b0e609ee.hot-update.json +1 -0
- package/dist/main.b57518d376449c846971.hot-update.js +265 -0
- package/dist/main.b57518d376449c846971.hot-update.js.map +1 -0
- package/dist/main.b57518d376449c846971.hot-update.json +1 -0
- package/dist/main.b5fa8b91f66c4a67740b.hot-update.js +265 -0
- package/dist/main.b5fa8b91f66c4a67740b.hot-update.js.map +1 -0
- package/dist/main.b5fa8b91f66c4a67740b.hot-update.json +1 -0
- package/dist/main.bdb9e6ab1d13cf4250e8.hot-update.js +265 -0
- package/dist/main.bdb9e6ab1d13cf4250e8.hot-update.js.map +1 -0
- package/dist/main.bdb9e6ab1d13cf4250e8.hot-update.json +1 -0
- package/dist/main.c9b051fce9f983306d51.hot-update.js +265 -0
- package/dist/main.c9b051fce9f983306d51.hot-update.js.map +1 -0
- package/dist/main.c9b051fce9f983306d51.hot-update.json +1 -0
- package/dist/main.d03d8e0bfcbd86932c58.hot-update.js +638 -0
- package/dist/main.d03d8e0bfcbd86932c58.hot-update.js.map +1 -0
- package/dist/main.d03d8e0bfcbd86932c58.hot-update.json +1 -0
- package/dist/main.d3b74a9a35325f35373d.hot-update.js +265 -0
- package/dist/main.d3b74a9a35325f35373d.hot-update.js.map +1 -0
- package/dist/main.d3b74a9a35325f35373d.hot-update.json +1 -0
- package/dist/main.d61b231278a9c69df2f8.hot-update.js +265 -0
- package/dist/main.d61b231278a9c69df2f8.hot-update.js.map +1 -0
- package/dist/main.d61b231278a9c69df2f8.hot-update.json +1 -0
- package/dist/pretty-chitty.js +243813 -0
- package/dist/pretty-chitty.js.map +1 -0
- package/package.json +1 -1
- package/src/library/components/ActionLogDisplay.tsx +1 -1
- package/src/library/components/ActionLogSidebar.tsx +1 -1
- package/src/library/components/BottomBar.tsx +2 -0
- package/src/library/components/BottomBarButton.tsx +3 -3
- package/src/library/components/MatchViewer.tsx +23 -9
- package/src/library/components/Panel/MultiPanel.tsx +7 -6
- package/src/library/components/Panel/PanelContents.tsx +4 -2
- package/src/library/components/Panel/SinglePanel.tsx +7 -6
- package/src/library/components/SettingsDisplay.tsx +152 -90
- package/src/library/components/TopBar.tsx +2 -0
- package/src/library/components/TopBarPlayers.tsx +4 -2
- package/src/library/game/Chit.ts +3 -2
- package/src/library/game/DisplaySettings.test.ts +80 -0
- package/src/library/game/DisplaySettings.ts +153 -0
- package/src/library/game/GameButton.ts +2 -0
- package/src/library/game/GameTheme.ts +10 -0
- package/src/library/game/Pick.ts +3 -2
- package/src/library/game/PlayerPromptStatusChit.ts +2 -0
- package/src/library/game/SparkChit.ts +2 -0
- package/src/library/game/typeName.test.ts +51 -0
- package/src/library/game/typeName.ts +40 -0
- package/src/library/hooks/useDisplaySettings.tsx +58 -0
- package/src/library/index.ts +1 -0
- package/src/library/utilities/CanvasStack/CanvasStack.ts +40 -3
- package/src/library/hooks/usePanelScale.tsx +0 -23
package/package.json
CHANGED
|
@@ -166,7 +166,7 @@ export function ActionLogDisplay({ toggleSidebarLog }: { toggleSidebarLog: boole
|
|
|
166
166
|
p: 1,
|
|
167
167
|
lineHeight: 1,
|
|
168
168
|
textAlign: "center",
|
|
169
|
-
minHeight: 14 * theme.actionBarLinesToShow * 1.1 + PADDING_SIZE * 2, // 8px for padding?
|
|
169
|
+
minHeight: 14 * theme.fontScalar * theme.actionBarLinesToShow * 1.1 + PADDING_SIZE * 2, // 8px for padding?
|
|
170
170
|
color: theme.actionLogTextColor,
|
|
171
171
|
maxWidth: layoutSize !== "mobile" ? `${theme.actionBarWidth - 40}px` : undefined,
|
|
172
172
|
display: "flex",
|
|
@@ -7,7 +7,7 @@ export function ActionLogSidebar() {
|
|
|
7
7
|
const theme = useGameTheme();
|
|
8
8
|
return (
|
|
9
9
|
<Box
|
|
10
|
-
sx={{ position: "relative", height: `100%`, width:
|
|
10
|
+
sx={{ position: "relative", height: `100%`, width: `${theme.actionLogSidebarWidth}px`, background: theme.actionLogDialogBackgroundColor }}
|
|
11
11
|
>
|
|
12
12
|
<Box sx={{ position: "absolute", top: 0, left: 0, right: 0, bottom: 0 }}>
|
|
13
13
|
<ActionLogHistory visible />
|
|
@@ -14,6 +14,8 @@ function BaseBottomBar({ children }: { children: ReactNode | ReactNode[] }) {
|
|
|
14
14
|
position: "relative",
|
|
15
15
|
background: `${theme.barColor} linear-gradient(${theme.barGradientAngle}deg, rgba(255,255,255,${theme.barGradientPercent}) 0%, rgba(0,0,0,${theme.barGradientPercent}) 100%)`,
|
|
16
16
|
height: theme.bottomBarHeight,
|
|
17
|
+
// A fixed-height bar in the viewer's flex column: never squeezed when the table needs the room
|
|
18
|
+
flexShrink: 0,
|
|
17
19
|
}}
|
|
18
20
|
>
|
|
19
21
|
{children}
|
|
@@ -179,9 +179,9 @@ export default function BottomBarButton({
|
|
|
179
179
|
<Box
|
|
180
180
|
sx={{
|
|
181
181
|
color: iconColor,
|
|
182
|
-
fontSize:
|
|
183
|
-
lineHeight:
|
|
184
|
-
height:
|
|
182
|
+
fontSize: theme.bottomBarIconSize,
|
|
183
|
+
lineHeight: `${theme.bottomBarIconSize}px`,
|
|
184
|
+
height: `${theme.bottomBarIconSize}px`,
|
|
185
185
|
textAlign: "center",
|
|
186
186
|
}}
|
|
187
187
|
>
|
|
@@ -7,7 +7,7 @@ import { GameThemeProvider, useGameTheme } from "../hooks/useGameTheme";
|
|
|
7
7
|
import TopBar from "./TopBar";
|
|
8
8
|
import { useEventChannelState } from "../hooks/useEventChannelState";
|
|
9
9
|
import { MatchEndDisplay } from "./MatchEndDisplay";
|
|
10
|
-
import {
|
|
10
|
+
import { DisplaySectionTheme, DisplaySettingsProvider } from "../hooks/useDisplaySettings";
|
|
11
11
|
import { ModalProvider } from "../hooks/useModalState";
|
|
12
12
|
import { FullScreenGalleryDisplay } from "./FullScreenGalleryDisplay";
|
|
13
13
|
import { ActionLogDisplay } from "./ActionLogDisplay";
|
|
@@ -75,7 +75,9 @@ function InnerMatchViewer({ onBack }: { onBack?: () => void }) {
|
|
|
75
75
|
}}
|
|
76
76
|
>
|
|
77
77
|
<Stack flex={1} sx={{ maxWidth: "100%" }}>
|
|
78
|
-
<
|
|
78
|
+
<DisplaySectionTheme section="topBar">
|
|
79
|
+
<TopBar onBack={onBack} />
|
|
80
|
+
</DisplaySectionTheme>
|
|
79
81
|
<Stack
|
|
80
82
|
direction={"column"}
|
|
81
83
|
flex={1}
|
|
@@ -88,11 +90,15 @@ function InnerMatchViewer({ onBack }: { onBack?: () => void }) {
|
|
|
88
90
|
<MatchEndDisplay />
|
|
89
91
|
<FullScreenGalleryDisplay />
|
|
90
92
|
<SettingsDisplay />
|
|
91
|
-
<
|
|
93
|
+
<DisplaySectionTheme section="actionLog">
|
|
94
|
+
<ActionLogHistoryDisplay />
|
|
95
|
+
</DisplaySectionTheme>
|
|
92
96
|
|
|
93
97
|
<Stack direction={"column"} flex={1}>
|
|
94
98
|
{!errorMessage && rootChit && (
|
|
95
|
-
<
|
|
99
|
+
<DisplaySectionTheme section="panelPadding">
|
|
100
|
+
<PanelContents rootChit={rootChit} scaleWidth={width} scaleHeight={height} />
|
|
101
|
+
</DisplaySectionTheme>
|
|
96
102
|
)}
|
|
97
103
|
|
|
98
104
|
<InlineGalleryDisplay />
|
|
@@ -100,12 +106,20 @@ function InnerMatchViewer({ onBack }: { onBack?: () => void }) {
|
|
|
100
106
|
{errorMessage}
|
|
101
107
|
</Box>
|
|
102
108
|
|
|
103
|
-
<
|
|
109
|
+
<DisplaySectionTheme section="actionLog">
|
|
110
|
+
<ActionLogDisplay toggleSidebarLog={largeEnoughToShowLogSidebar} />
|
|
111
|
+
</DisplaySectionTheme>
|
|
104
112
|
</Stack>
|
|
105
|
-
<
|
|
113
|
+
<DisplaySectionTheme section="bottomBar">
|
|
114
|
+
<BottomBar />
|
|
115
|
+
</DisplaySectionTheme>
|
|
106
116
|
</Stack>
|
|
107
117
|
|
|
108
|
-
{largeEnoughToShowLogSidebar && showLog &&
|
|
118
|
+
{largeEnoughToShowLogSidebar && showLog && (
|
|
119
|
+
<DisplaySectionTheme section="actionLog">
|
|
120
|
+
<ActionLogSidebar />
|
|
121
|
+
</DisplaySectionTheme>
|
|
122
|
+
)}
|
|
109
123
|
|
|
110
124
|
<TutorialOverlay />
|
|
111
125
|
</Stack>
|
|
@@ -122,7 +136,7 @@ export function MatchViewer({ onBack, skipReplay = false }: { onBack?: () => voi
|
|
|
122
136
|
const muiTheme = useMemo(() => createMuiTheme(game.theme), [game.theme]);
|
|
123
137
|
return (
|
|
124
138
|
<TimeControllerProvider skipReplay={skipReplay}>
|
|
125
|
-
<
|
|
139
|
+
<DisplaySettingsProvider>
|
|
126
140
|
<ModalProvider modalState={modalState}>
|
|
127
141
|
<GameThemeProvider theme={game.theme}>
|
|
128
142
|
<ThemeProvider theme={muiTheme}>
|
|
@@ -134,7 +148,7 @@ export function MatchViewer({ onBack, skipReplay = false }: { onBack?: () => voi
|
|
|
134
148
|
</ThemeProvider>
|
|
135
149
|
</GameThemeProvider>
|
|
136
150
|
</ModalProvider>
|
|
137
|
-
</
|
|
151
|
+
</DisplaySettingsProvider>
|
|
138
152
|
</TimeControllerProvider>
|
|
139
153
|
);
|
|
140
154
|
}
|
|
@@ -44,6 +44,7 @@ export function MultiPanel({
|
|
|
44
44
|
setFocusedPanel: (chit: Chit | undefined) => void;
|
|
45
45
|
}) {
|
|
46
46
|
const theme = useGameTheme();
|
|
47
|
+
const panelSpacing = theme.getPanelSpacing();
|
|
47
48
|
const refContainer = useRef(null);
|
|
48
49
|
const timeState = useTimeState();
|
|
49
50
|
const { registerPosition } = usePanelPositioning();
|
|
@@ -207,10 +208,10 @@ export function MultiPanel({
|
|
|
207
208
|
|
|
208
209
|
registerPosition(chitId, {
|
|
209
210
|
chitId,
|
|
210
|
-
x: x +
|
|
211
|
-
y: y +
|
|
212
|
-
w: w -
|
|
213
|
-
h: h - effectiveTabHeight -
|
|
211
|
+
x: x + panelSpacing / 4,
|
|
212
|
+
y: y + panelSpacing / 4,
|
|
213
|
+
w: w - panelSpacing / 2,
|
|
214
|
+
h: h - effectiveTabHeight - panelSpacing / 2,
|
|
214
215
|
paused: isPaused,
|
|
215
216
|
panCallback,
|
|
216
217
|
visible: true,
|
|
@@ -232,7 +233,7 @@ export function MultiPanel({
|
|
|
232
233
|
isSliding,
|
|
233
234
|
focusedPanel,
|
|
234
235
|
registerPosition,
|
|
235
|
-
|
|
236
|
+
panelSpacing,
|
|
236
237
|
refContainer,
|
|
237
238
|
panCallback,
|
|
238
239
|
timeMultiplier,
|
|
@@ -270,7 +271,7 @@ export function MultiPanel({
|
|
|
270
271
|
top: `${y}px`,
|
|
271
272
|
position: "absolute",
|
|
272
273
|
zIndex: enabled ? "auto" : -1,
|
|
273
|
-
p: `${
|
|
274
|
+
p: `${panelSpacing / 4}px`,
|
|
274
275
|
transition: panelTransition(theme, timeMultiplier),
|
|
275
276
|
}}
|
|
276
277
|
>
|
|
@@ -3,7 +3,7 @@ import { Box } from "@mui/material";
|
|
|
3
3
|
import useSize from "@react-hook/size";
|
|
4
4
|
import { useGameTheme } from "../../hooks/useGameTheme";
|
|
5
5
|
import { RootChit } from "../../game/RootChit";
|
|
6
|
-
import { usePanelScale } from "../../hooks/
|
|
6
|
+
import { usePanelScale } from "../../hooks/useDisplaySettings";
|
|
7
7
|
import { usePlayerId } from "../../hooks/usePlayer";
|
|
8
8
|
import { SinglePanel } from "./SinglePanel";
|
|
9
9
|
import { MultiPanel } from "./MultiPanel";
|
|
@@ -353,7 +353,9 @@ export function PanelContents({
|
|
|
353
353
|
sx={{
|
|
354
354
|
position: "relative",
|
|
355
355
|
flex: 1,
|
|
356
|
-
|
|
356
|
+
// Each panel insets itself by panelSpacing / 4 (SinglePanel, MultiPanel), so two neighbours sit
|
|
357
|
+
// panelSpacing / 2 apart; a quarter here gives the screen edge that same gap
|
|
358
|
+
p: `${theme.getPanelSpacing() * 0.25}px`,
|
|
357
359
|
}}
|
|
358
360
|
>
|
|
359
361
|
<Box
|
|
@@ -28,6 +28,7 @@ export function SinglePanel({
|
|
|
28
28
|
setFocusedPanel: (chit: Chit | undefined) => void;
|
|
29
29
|
}) {
|
|
30
30
|
const theme = useGameTheme();
|
|
31
|
+
const panelSpacing = theme.getPanelSpacing();
|
|
31
32
|
const animationSpeedMultiplier = useAnimationSpeedMultiplier();
|
|
32
33
|
const { registerPosition } = usePanelPositioning();
|
|
33
34
|
|
|
@@ -45,16 +46,16 @@ export function SinglePanel({
|
|
|
45
46
|
const chitId = chit.id ?? "";
|
|
46
47
|
registerPosition(chitId, {
|
|
47
48
|
chitId,
|
|
48
|
-
x: x +
|
|
49
|
-
y: y +
|
|
50
|
-
w: w -
|
|
51
|
-
h: h -
|
|
49
|
+
x: x + panelSpacing / 4,
|
|
50
|
+
y: y + panelSpacing / 4,
|
|
51
|
+
w: w - panelSpacing / 2,
|
|
52
|
+
h: h - panelSpacing / 2,
|
|
52
53
|
paused: effectivePaused,
|
|
53
54
|
front: true,
|
|
54
55
|
visible: true,
|
|
55
56
|
transition,
|
|
56
57
|
});
|
|
57
|
-
}, [chit, x, y, w, h, transition, effectivePaused, enabled, focusedPanel, registerPosition,
|
|
58
|
+
}, [chit, x, y, w, h, transition, effectivePaused, enabled, focusedPanel, registerPosition, panelSpacing]);
|
|
58
59
|
|
|
59
60
|
return (
|
|
60
61
|
<Box
|
|
@@ -65,7 +66,7 @@ export function SinglePanel({
|
|
|
65
66
|
left: `${x}px`,
|
|
66
67
|
top: `${y}px`,
|
|
67
68
|
position: "absolute",
|
|
68
|
-
p: `${
|
|
69
|
+
p: `${panelSpacing / 4}px`,
|
|
69
70
|
transition,
|
|
70
71
|
zIndex: enabled ? "auto" : -1,
|
|
71
72
|
}}
|
|
@@ -1,140 +1,202 @@
|
|
|
1
|
-
import React, { useEffect,
|
|
2
|
-
import { Box, Stack, Slider, Typography, Button, Checkbox, FormControlLabel } from "@mui/material";
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Box, Stack, Slider, Typography, Button, Checkbox, FormControlLabel, Divider } from "@mui/material";
|
|
3
3
|
import { GameModalDialog } from "./GameModalDialog";
|
|
4
4
|
import { useModalState } from "../hooks/useModalState";
|
|
5
5
|
import { useEventChannelState } from "../hooks/useEventChannelState";
|
|
6
6
|
import { useGameTheme } from "../hooks/useGameTheme";
|
|
7
7
|
import { useTimeState } from "../hooks/useTimeController";
|
|
8
|
-
import {
|
|
8
|
+
import { useDisplaySettings } from "../hooks/useDisplaySettings";
|
|
9
|
+
import {
|
|
10
|
+
ANIMATION_SPEEDS,
|
|
11
|
+
DISPLAY_SECTIONS,
|
|
12
|
+
DISPLAY_STEP_COUNT,
|
|
13
|
+
DISPLAY_STEP_LABELS,
|
|
14
|
+
NORMAL_STEP,
|
|
15
|
+
allAtStep,
|
|
16
|
+
animationSpeedStep,
|
|
17
|
+
overallStep,
|
|
18
|
+
} from "../game/DisplaySettings";
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
/** How long the dialog stays see-through after a size change, so the player can see the result */
|
|
21
|
+
const PREVIEW_MS = 2000;
|
|
22
|
+
|
|
23
|
+
interface StepSliderProps {
|
|
11
24
|
label: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
valueLabel: string;
|
|
26
|
+
step: number;
|
|
27
|
+
onChange: (step: number) => void;
|
|
28
|
+
lowHint: string;
|
|
29
|
+
highHint: string;
|
|
30
|
+
markLabels?: string[];
|
|
31
|
+
compact?: boolean;
|
|
32
|
+
/** No step is selected (Display Size when the parts are set differently): no handle and no filled track */
|
|
33
|
+
unset?: boolean;
|
|
16
34
|
}
|
|
17
35
|
|
|
18
|
-
function
|
|
36
|
+
function StepSlider({ label, valueLabel, step, onChange, lowHint, highHint, markLabels, compact, unset }: StepSliderProps) {
|
|
19
37
|
const theme = useGameTheme();
|
|
38
|
+
const marks = Array.from({ length: DISPLAY_STEP_COUNT }, (_, i) => ({ value: i, label: markLabels?.[i] }));
|
|
20
39
|
|
|
21
40
|
return (
|
|
22
41
|
<Box>
|
|
23
|
-
<Stack direction="row"
|
|
24
|
-
<Typography sx={{ color: theme.actionLogTextColor, fontWeight: "bold",
|
|
25
|
-
|
|
26
|
-
{value.toFixed(2)}
|
|
42
|
+
<Stack direction="row" justifyContent="space-between" alignItems="baseline">
|
|
43
|
+
<Typography sx={{ color: theme.actionLogTextColor, fontWeight: "bold", fontSize: compact ? 14 : 16 }}>
|
|
44
|
+
{label}
|
|
27
45
|
</Typography>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
46
|
+
<Typography sx={{ color: theme.barHighlightTextColor, fontSize: compact ? 13 : 14 }}>{valueLabel}</Typography>
|
|
47
|
+
</Stack>
|
|
48
|
+
<Box sx={{ px: 1 }}>
|
|
49
|
+
<Slider
|
|
50
|
+
value={step}
|
|
51
|
+
onChange={(_, value) => onChange(value as number)}
|
|
52
|
+
min={0}
|
|
53
|
+
max={DISPLAY_STEP_COUNT - 1}
|
|
54
|
+
step={1}
|
|
55
|
+
marks={marks}
|
|
56
|
+
size={compact ? "small" : "medium"}
|
|
32
57
|
sx={{
|
|
33
|
-
color: theme.
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
58
|
+
color: theme.barHighlightTextColor,
|
|
59
|
+
mb: markLabels ? 1 : 0,
|
|
60
|
+
"& .MuiSlider-rail": { backgroundColor: theme.actionLogTextColor, opacity: 0.3 },
|
|
61
|
+
"& .MuiSlider-mark": { backgroundColor: theme.actionLogTextColor, opacity: 0.5, width: 4, height: 4, borderRadius: 2 },
|
|
62
|
+
"& .MuiSlider-markActive": { backgroundColor: theme.actionLogDialogBackgroundColor, opacity: 0.8 },
|
|
63
|
+
"& .MuiSlider-markLabel": { color: theme.actionLogTextColor, opacity: 0.7, fontSize: 12 },
|
|
64
|
+
...(unset && {
|
|
65
|
+
"& .MuiSlider-thumb, & .MuiSlider-track": { display: "none" },
|
|
66
|
+
"& .MuiSlider-markActive": { backgroundColor: theme.actionLogTextColor, opacity: 0.5 },
|
|
67
|
+
}),
|
|
39
68
|
}}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
max={max}
|
|
49
|
-
step={0.01}
|
|
50
|
-
sx={{
|
|
51
|
-
color: theme.actionLogTextColor,
|
|
52
|
-
"& .MuiSlider-thumb": {
|
|
53
|
-
backgroundColor: theme.actionLogTextColor,
|
|
54
|
-
},
|
|
55
|
-
"& .MuiSlider-track": {
|
|
56
|
-
backgroundColor: theme.actionLogTextColor,
|
|
57
|
-
},
|
|
58
|
-
"& .MuiSlider-rail": {
|
|
59
|
-
backgroundColor: "rgba(255,255,255,0.3)",
|
|
60
|
-
},
|
|
61
|
-
}}
|
|
62
|
-
/>
|
|
69
|
+
/>
|
|
70
|
+
</Box>
|
|
71
|
+
{!markLabels && (
|
|
72
|
+
<Stack direction="row" justifyContent="space-between" sx={{ mt: -0.5 }}>
|
|
73
|
+
<Typography sx={{ color: theme.actionLogTextColor, opacity: 0.5, fontSize: 12 }}>{lowHint}</Typography>
|
|
74
|
+
<Typography sx={{ color: theme.actionLogTextColor, opacity: 0.5, fontSize: 12 }}>{highHint}</Typography>
|
|
75
|
+
</Stack>
|
|
76
|
+
)}
|
|
63
77
|
</Box>
|
|
64
78
|
);
|
|
65
79
|
}
|
|
66
80
|
|
|
81
|
+
function ThemedCheckbox({ label, checked, onChange }: { label: string; checked: boolean; onChange: (c: boolean) => void }) {
|
|
82
|
+
const theme = useGameTheme();
|
|
83
|
+
return (
|
|
84
|
+
<FormControlLabel
|
|
85
|
+
control={
|
|
86
|
+
<Checkbox
|
|
87
|
+
checked={checked}
|
|
88
|
+
onChange={(e) => onChange(e.target.checked)}
|
|
89
|
+
sx={{ color: theme.actionLogTextColor, "&.Mui-checked": { color: theme.barHighlightTextColor } }}
|
|
90
|
+
/>
|
|
91
|
+
}
|
|
92
|
+
label={<Typography sx={{ color: theme.actionLogTextColor }}>{label}</Typography>}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function speedLabel(speed: number) {
|
|
98
|
+
return speed === 0.5 ? "½×" : `${speed}×`;
|
|
99
|
+
}
|
|
100
|
+
|
|
67
101
|
export function SettingsDisplay() {
|
|
68
102
|
const modalState = useModalState();
|
|
69
103
|
const theme = useGameTheme();
|
|
70
104
|
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const [adjustingScale, setAdjustingScale] = useState(false);
|
|
105
|
+
const [display, setDisplay] = useDisplaySettings();
|
|
106
|
+
const overall = overallStep(display);
|
|
75
107
|
|
|
108
|
+
// See-through for a moment after a size change, so the player can see what it did behind the dialog
|
|
109
|
+
const [previewing, setPreviewing] = useState(false);
|
|
110
|
+
const lastDisplay = useRef(display);
|
|
76
111
|
useEffect(() => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
112
|
+
if (lastDisplay.current === display) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
lastDisplay.current = display;
|
|
116
|
+
setPreviewing(true);
|
|
117
|
+
const to = setTimeout(() => setPreviewing(false), PREVIEW_MS);
|
|
81
118
|
return () => clearTimeout(to);
|
|
82
|
-
}, [
|
|
119
|
+
}, [display]);
|
|
83
120
|
|
|
84
121
|
const timeState = useTimeState();
|
|
85
122
|
const [speed, setSpeed] = useEventChannelState(timeState.animationSpeedMultiplier);
|
|
86
123
|
const [skipReplay, setSkipReplay] = useEventChannelState(timeState.skipReplay);
|
|
87
124
|
const [showLog, setShowLog] = useEventChannelState(timeState.showLog);
|
|
125
|
+
const speedStep = animationSpeedStep(speed);
|
|
88
126
|
|
|
89
127
|
const [visible, setVisible] = useEventChannelState(modalState.settingsVisible);
|
|
90
128
|
|
|
129
|
+
const averageStep = Math.round(
|
|
130
|
+
DISPLAY_SECTIONS.reduce((sum, s) => sum + display[s.key], 0) / DISPLAY_SECTIONS.length,
|
|
131
|
+
);
|
|
132
|
+
|
|
91
133
|
return (
|
|
92
134
|
<GameModalDialog
|
|
93
135
|
visible={visible}
|
|
94
|
-
opacity={
|
|
136
|
+
opacity={previewing ? 0.3 : 1}
|
|
95
137
|
onClose={() => setVisible(false)}
|
|
96
138
|
title="Settings"
|
|
97
139
|
>
|
|
98
140
|
<Box sx={{ p: 3, overflowY: "auto" }}>
|
|
99
|
-
<Stack spacing={
|
|
100
|
-
<
|
|
101
|
-
|
|
141
|
+
<Stack spacing={3}>
|
|
142
|
+
<Stack>
|
|
143
|
+
<ThemedCheckbox label="Skip Replay" checked={skipReplay} onChange={setSkipReplay} />
|
|
144
|
+
<ThemedCheckbox label="Show Log (on larger screens)" checked={showLog} onChange={setShowLog} />
|
|
145
|
+
</Stack>
|
|
146
|
+
|
|
147
|
+
<Divider sx={{ borderColor: "rgba(128,128,128,0.3)" }} />
|
|
148
|
+
|
|
149
|
+
<StepSlider
|
|
102
150
|
label="Animation Speed"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
control={
|
|
110
|
-
<Checkbox
|
|
111
|
-
checked={skipReplay}
|
|
112
|
-
onChange={(e) => setSkipReplay(e.target.checked)}
|
|
113
|
-
sx={{
|
|
114
|
-
color: theme.actionLogTextColor,
|
|
115
|
-
"&.Mui-checked": {
|
|
116
|
-
color: theme.actionLogTextColor,
|
|
117
|
-
},
|
|
118
|
-
}}
|
|
119
|
-
/>
|
|
120
|
-
}
|
|
121
|
-
label={<Typography sx={{ color: theme.actionLogTextColor }}>Skip Replay</Typography>}
|
|
151
|
+
valueLabel={speedLabel(ANIMATION_SPEEDS[speedStep])}
|
|
152
|
+
step={speedStep}
|
|
153
|
+
onChange={(step) => setSpeed(1 / ANIMATION_SPEEDS[step])}
|
|
154
|
+
lowHint="Slower"
|
|
155
|
+
highHint="Faster"
|
|
156
|
+
markLabels={ANIMATION_SPEEDS.map(speedLabel)}
|
|
122
157
|
/>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
158
|
+
|
|
159
|
+
<Divider sx={{ borderColor: "rgba(128,128,128,0.3)" }} />
|
|
160
|
+
|
|
161
|
+
<Stack spacing={1}>
|
|
162
|
+
<StepSlider
|
|
163
|
+
label="Display Size"
|
|
164
|
+
valueLabel={overall === undefined ? "Custom" : DISPLAY_STEP_LABELS[overall]}
|
|
165
|
+
step={overall ?? averageStep}
|
|
166
|
+
unset={overall === undefined}
|
|
167
|
+
onChange={(step) => setDisplay(allAtStep(step))}
|
|
168
|
+
lowHint="Fit more on screen"
|
|
169
|
+
highHint="Bigger everything"
|
|
170
|
+
/>
|
|
171
|
+
<Stack direction="row" justifyContent="flex-end">
|
|
172
|
+
<Button
|
|
173
|
+
size="small"
|
|
174
|
+
disabled={overall === NORMAL_STEP}
|
|
175
|
+
onClick={() => setDisplay(allAtStep(NORMAL_STEP))}
|
|
128
176
|
sx={{
|
|
129
177
|
color: theme.actionLogTextColor,
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
},
|
|
178
|
+
textTransform: "none",
|
|
179
|
+
"&.Mui-disabled": { color: theme.actionLogTextColor, opacity: 0.3 },
|
|
133
180
|
}}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
181
|
+
>
|
|
182
|
+
Reset
|
|
183
|
+
</Button>
|
|
184
|
+
</Stack>
|
|
185
|
+
<Stack spacing={2} sx={{ pl: 2, pt: 1, borderLeft: "2px solid rgba(128,128,128,0.4)" }}>
|
|
186
|
+
{DISPLAY_SECTIONS.map((section) => (
|
|
187
|
+
<StepSlider
|
|
188
|
+
compact
|
|
189
|
+
key={section.key}
|
|
190
|
+
label={section.label}
|
|
191
|
+
valueLabel={DISPLAY_STEP_LABELS[display[section.key]]}
|
|
192
|
+
step={display[section.key]}
|
|
193
|
+
onChange={(step) => setDisplay({ ...display, [section.key]: step })}
|
|
194
|
+
lowHint={section.smallerHint}
|
|
195
|
+
highHint={section.biggerHint}
|
|
196
|
+
/>
|
|
197
|
+
))}
|
|
198
|
+
</Stack>
|
|
199
|
+
</Stack>
|
|
138
200
|
</Stack>
|
|
139
201
|
</Box>
|
|
140
202
|
</GameModalDialog>
|
|
@@ -20,6 +20,8 @@ function BaseTopBar({ children }: { children: ReactNode | ReactNode[] }) {
|
|
|
20
20
|
position: "relative",
|
|
21
21
|
background: theme.barColor,
|
|
22
22
|
height: theme.topBarHeight,
|
|
23
|
+
// A fixed-height bar in the viewer's flex column: never squeezed when the table needs the room
|
|
24
|
+
flexShrink: 0,
|
|
23
25
|
}}
|
|
24
26
|
>
|
|
25
27
|
{children}
|
|
@@ -132,7 +132,8 @@ export default function TopBarPlayers() {
|
|
|
132
132
|
return (
|
|
133
133
|
<TopBarDropdown
|
|
134
134
|
label={
|
|
135
|
-
|
|
135
|
+
// padded by the theme's spacing, which the avatar size allows for, so the strip is exactly the bar's height
|
|
136
|
+
<Stack direction={"row"} sx={{ py: `${theme.spacing}px`, maxWidth: "100%" }}>
|
|
136
137
|
{/* The avatar cluster is what a tutorial points at with { ui: "players" }, not the whole strip */}
|
|
137
138
|
<Stack direction={"row"} data-tutorial-target="players" sx={{ pl: 1 }}>
|
|
138
139
|
{playerChits.map((player) => (
|
|
@@ -148,7 +149,8 @@ export default function TopBarPlayers() {
|
|
|
148
149
|
<Typography
|
|
149
150
|
flex={1}
|
|
150
151
|
sx={{
|
|
151
|
-
|
|
152
|
+
px: 1,
|
|
153
|
+
py: `${theme.spacing}px`,
|
|
152
154
|
lineHeight: `${theme.topBarHeight - theme.spacing * 4}px`,
|
|
153
155
|
fontSize: 14 * theme.fontScalar,
|
|
154
156
|
whiteSpace: "nowrap",
|
package/src/library/game/Chit.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { Vector2 } from "three";
|
|
|
8
8
|
import { OrderedOutlet } from "./OrderedOutlet";
|
|
9
9
|
import { SparkChit } from "./SparkChit";
|
|
10
10
|
import StaticChitTypeRegistry from "./StaticChitTypeRegistry";
|
|
11
|
+
import { typeNameOfInstance } from "./typeName";
|
|
11
12
|
import type { Game } from "./Game";
|
|
12
13
|
import { IUpdatingCanvas } from "../utilities/IUpdatingCanvas";
|
|
13
14
|
import { ImageSpec } from "../utilities/CanvasStack/CanvasOperations";
|
|
@@ -183,7 +184,7 @@ export class Chit extends ObjectWithProps {
|
|
|
183
184
|
|
|
184
185
|
/** @internal */
|
|
185
186
|
chitTypeName() {
|
|
186
|
-
const result =
|
|
187
|
+
const result = typeNameOfInstance(this);
|
|
187
188
|
if (this.parentFallback) {
|
|
188
189
|
return `${result}-${this.parentFallback.id}-`;
|
|
189
190
|
}
|
|
@@ -634,7 +635,7 @@ export class Chit extends ObjectWithProps {
|
|
|
634
635
|
return acc;
|
|
635
636
|
},
|
|
636
637
|
{
|
|
637
|
-
__chitType:
|
|
638
|
+
__chitType: typeNameOfInstance(this),
|
|
638
639
|
__hiddenProps: playerIds ? this.hiddenPropertiesForSerialization(playerIds) : undefined,
|
|
639
640
|
} as { [key: string]: any },
|
|
640
641
|
),
|