gaesup-world 0.0.652 → 0.0.661
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/gaesup/tools/gameboy/index.js +1 -1
- package/dist/gaesup/tools/gameboy/style.css.js +1 -0
- package/dist/gaesup/tools/gamepad/GamePadButton.js +1 -1
- package/dist/gaesup/tools/gamepad/index.js +1 -1
- package/dist/gaesup/tools/index.js +4 -5
- package/dist/gaesup/tools/joystick/index.js +1 -1
- package/dist/gaesup/tools/joystick/style.css.js +12 -10
- package/dist/gaesup/tools/keyBoardToolTip/index.js +3 -14
- package/dist/gaesup/tools/minimap/index.js +6 -5
- package/index.ts +7 -0
- package/package.json +19 -26
- package/src/gaesup/tools/gameboy/index.tsx +8 -2
- package/src/gaesup/tools/gameboy/style.css.ts +1 -0
- package/src/gaesup/tools/gamepad/GamePadButton.tsx +1 -1
- package/src/gaesup/tools/gamepad/index.tsx +8 -2
- package/src/gaesup/tools/index.tsx +1 -2
- package/src/gaesup/tools/joystick/index.tsx +4 -201
- package/src/gaesup/tools/joystick/style.css.ts +12 -10
- package/src/gaesup/tools/keyBoardToolTip/index.tsx +15 -12
- package/src/gaesup/tools/minimap/index.tsx +20 -16
- package/vite.config.ts +9 -0
- package/lib/index.ts +0 -10
- package/tsconfig.json +0 -22
|
@@ -15,7 +15,7 @@ export var GameBoyDirections = [
|
|
|
15
15
|
];
|
|
16
16
|
export default function GameBoy() {
|
|
17
17
|
var _a = useContext(GaesupToolsContext).gameboy, gameboyStyle = _a.gameboyStyle, gameboyInnerStyle = _a.gameboyInnerStyle;
|
|
18
|
-
return (_jsx("div", { className: style.gameBoy,
|
|
18
|
+
return (_jsx("div", { className: style.gameBoy, children: _jsx("div", { className: style.gameBoyInner, children: GameBoyDirections.map(function (item, key) {
|
|
19
19
|
return (_jsx(GameBoyButton, { tag: item.tag, value: item.value, icon: item.icon }, key));
|
|
20
20
|
}) }) }));
|
|
21
21
|
}
|
|
@@ -21,5 +21,5 @@ export default function GamePadButton(_a) {
|
|
|
21
21
|
}), onMouseDown: function () { return onMouseDown(); }, onMouseUp: function () { return onMouseLeave(); }, onMouseLeave: function () { return onMouseLeave(); }, onContextMenu: function (e) {
|
|
22
22
|
e.preventDefault();
|
|
23
23
|
onMouseLeave();
|
|
24
|
-
}, onPointerDown: function () { return onMouseDown(); }, onPointerUp: function () { return onMouseLeave(); },
|
|
24
|
+
}, onPointerDown: function () { return onMouseDown(); }, onPointerUp: function () { return onMouseLeave(); }, children: name }));
|
|
25
25
|
}
|
|
@@ -24,7 +24,7 @@ export default function GamePad() {
|
|
|
24
24
|
.filter(function (item) {
|
|
25
25
|
return !(item.tag === "run" && mode.controller === "joystick");
|
|
26
26
|
});
|
|
27
|
-
return (_jsx("div", { className: style.gamePad,
|
|
27
|
+
return (_jsx("div", { className: style.gamePad, children: _jsx("div", { className: style.gamePadGrid, children: GamePadDirections.map(function (item, key) {
|
|
28
28
|
return (_jsx(GamePadButton, { value: item.value, name: item.name }, key));
|
|
29
29
|
}) }) }));
|
|
30
30
|
}
|
|
@@ -8,7 +8,6 @@ import GamePad from "./gamepad";
|
|
|
8
8
|
import { gamepadDefault } from "./gamepad/default";
|
|
9
9
|
import JoyStick from "./joystick";
|
|
10
10
|
import { joyStickDefault } from "./joystick/default";
|
|
11
|
-
import JumpPoint from "./jumpPoint";
|
|
12
11
|
import KeyBoardToolTip from "./keyBoardToolTip";
|
|
13
12
|
import { keyboardToolTipDefault } from "./keyBoardToolTip/default";
|
|
14
13
|
import MiniMap from "./minimap";
|
|
@@ -36,8 +35,8 @@ export function GaeSupTools(_a) {
|
|
|
36
35
|
tools.gameboy,
|
|
37
36
|
tools.gamepad,
|
|
38
37
|
]);
|
|
39
|
-
return (_jsx(GaesupToolsContext.Provider, { value: gaesupTool.value, children:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
return (_jsx(GaesupToolsContext.Provider, { value: gaesupTool.value, children: _jsx(GaesupToolsDispatchContext.Provider, { value: gaesupTool.dispatch, children: _jsxs("div", { className: style.footer, children: [_jsx("div", { className: style.footerUpper, children: (mode.controller === "joystick" ||
|
|
39
|
+
mode.controller === "gameboy") &&
|
|
40
|
+
gaesupTool.value.gamepad.on && _jsx(GamePad, {}) }), _jsxs("div", { className: style.footerLower, children: [mode.controller === "joystick" && gaesupTool.value.joystick.on && (_jsx(JoyStick, {})), mode.controller === "gameboy" && gaesupTool.value.gameboy.on && (_jsx(GameBoy, {})), mode.controller === "keyboard" &&
|
|
41
|
+
gaesupTool.value.keyboardToolTip.on && _jsx(KeyBoardToolTip, {}), gaesupTool.value.minimap.on && _jsx(MiniMap, {})] })] }) }) }));
|
|
43
42
|
}
|
|
@@ -17,7 +17,7 @@ import useJoyStick from "./default";
|
|
|
17
17
|
import * as style from "./style.css";
|
|
18
18
|
export default function JoyStick() {
|
|
19
19
|
var joyStickStyle = useContext(GaesupToolsContext).joystick.joyStickStyle;
|
|
20
|
-
return (_jsx("div", { className: style.joyStick,
|
|
20
|
+
return (_jsx("div", { className: style.joyStick, children: _jsx(JoyBall, {}) }));
|
|
21
21
|
}
|
|
22
22
|
export function JoyBall() {
|
|
23
23
|
var outerRef = useRef(null);
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { style } from "@vanilla-extract/css";
|
|
2
|
-
import { fixed, flex } from "../../../styles/recipe/index.css";
|
|
3
2
|
export var joyStick = style([
|
|
4
|
-
fixed({
|
|
5
|
-
south_east: true,
|
|
6
|
-
}),
|
|
7
|
-
flex({
|
|
8
|
-
column: "7",
|
|
9
|
-
}),
|
|
10
3
|
{
|
|
4
|
+
position: "fixed",
|
|
5
|
+
bottom: "0",
|
|
6
|
+
right: "0",
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "column",
|
|
9
|
+
justifyContent: "flex-end",
|
|
10
|
+
alignItems: "flex-start",
|
|
11
|
+
textAlign: "center",
|
|
11
12
|
width: "100%",
|
|
12
13
|
},
|
|
13
14
|
]);
|
|
14
15
|
export var joyStickInner = style([
|
|
15
|
-
flex({
|
|
16
|
-
row: "center",
|
|
17
|
-
}),
|
|
18
16
|
{
|
|
17
|
+
display: "flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
textAlign: "center",
|
|
19
21
|
margin: "5rem",
|
|
20
22
|
padding: "1rem",
|
|
21
23
|
width: "12rem",
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
14
3
|
import { useContext } from "react";
|
|
@@ -39,7 +28,7 @@ export default function KeyBoardToolTip() {
|
|
|
39
28
|
});
|
|
40
29
|
return maps;
|
|
41
30
|
}, {});
|
|
42
|
-
return (_jsx("div", { className: style.keyBoardToolTip,
|
|
31
|
+
return (_jsx("div", { className: style.keyBoardToolTip, children: _jsx("div", { className: style.keyBoardTooInner, children: keyArray.map(function (item, key) {
|
|
43
32
|
var background = "rgba(0, 0, 0, 0.1)";
|
|
44
33
|
var boxShadow = "0 0 5px rgba(0, 0, 0, 0.2)";
|
|
45
34
|
if (codeToActionObj[item.code]) {
|
|
@@ -57,12 +46,12 @@ export default function KeyBoardToolTip() {
|
|
|
57
46
|
animations.keyControl[codeToActionObj[item.code]]) {
|
|
58
47
|
color = "black";
|
|
59
48
|
}
|
|
60
|
-
return (_jsx("div", { className: style.keyCap, style:
|
|
49
|
+
return (_jsx("div", { className: style.keyCap, style: assignInlineVars({
|
|
61
50
|
background: background,
|
|
62
51
|
boxShadow: boxShadow,
|
|
63
52
|
color: color,
|
|
64
53
|
gridRow: item.gridRow,
|
|
65
54
|
gridColumn: item.gridColumn,
|
|
66
|
-
})
|
|
55
|
+
}), children: item.name }, key));
|
|
67
56
|
}) }) }));
|
|
68
57
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
var __assign = (this && this.__assign) || function () {
|
|
3
2
|
__assign = Object.assign || function(t) {
|
|
4
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -42,16 +41,18 @@ export default function MiniMap() {
|
|
|
42
41
|
else
|
|
43
42
|
setRatio(function (prev) { return prev - 0.1; });
|
|
44
43
|
}, [setRatio, ratio]);
|
|
45
|
-
return (_jsxs("div", { className: style.minimap,
|
|
44
|
+
return (_jsxs("div", { className: style.minimap,
|
|
45
|
+
// style={assignInlineVars(minimap.minimapStyle || {})}
|
|
46
|
+
onWheel: function (e) {
|
|
46
47
|
if (e.deltaY > 0)
|
|
47
48
|
downRatio();
|
|
48
49
|
else
|
|
49
50
|
upRatio();
|
|
50
|
-
}, children: [_jsx("div", { className: style.minimapOuter
|
|
51
|
-
return (_jsx("div", { className: style.minimapObject, style:
|
|
51
|
+
}, children: [_jsx("div", { className: style.minimapOuter }), _jsxs("div", { className: style.minimapInner, children: [Object.values(minimapInner.props).map(function (obj, key) {
|
|
52
|
+
return (_jsx("div", { className: style.minimapObject, style: assignInlineVars({
|
|
52
53
|
width: "".concat(obj.size.x, "rem"),
|
|
53
54
|
height: "".concat(obj.size.z, "rem"),
|
|
54
55
|
transform: "translate(".concat(-obj.center.x + activeState.position.x * ratio, "rem, ").concat(-obj.center.z + activeState.position.z * ratio, "rem)"),
|
|
55
|
-
})
|
|
56
|
+
}), children: _jsx("div", { className: style.text, children: obj.text }) }, key));
|
|
56
57
|
}), _jsx("div", { className: style.avatar, style: minimap.avatarStyle })] })] }));
|
|
57
58
|
}
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,56 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gaesup-world",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"private": false,
|
|
3
|
+
"version": "0.0.661",
|
|
4
|
+
"type": "commonjs",
|
|
6
5
|
"main": "dist/index.js",
|
|
7
6
|
"types": "dist/index.d.ts",
|
|
8
|
-
"author": "jigglypop <donghwanyeom@gmail.com>",
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"type": "commonjs",
|
|
11
7
|
"homepage": "https://jigglypop.github.io/gaesup-world/",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/jigglypop/gaesup-world.git"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"three.js",
|
|
18
|
-
"@react-three/fiber",
|
|
19
|
-
"@react-three/drei"
|
|
20
|
-
],
|
|
21
|
-
"bugs": {
|
|
22
|
-
"url": "https://github.com/jigglypop/gaesup-world/issues"
|
|
23
|
-
},
|
|
24
8
|
"scripts": {
|
|
25
9
|
"dev": "vite",
|
|
26
10
|
"build": "vite build",
|
|
27
11
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
28
|
-
"prepare": "rm -rf dist && mkdir dist && tsc",
|
|
29
12
|
"preview": "vite preview",
|
|
30
13
|
"predeploy": "npm run build",
|
|
14
|
+
"prepare": "rm -rf dist && mkdir dist && tsc -p tsconfig.build.json",
|
|
31
15
|
"deploy": "gh-pages -d dist"
|
|
32
16
|
},
|
|
33
17
|
"dependencies": {
|
|
34
18
|
"@dimforge/rapier3d": "^0.11.2",
|
|
35
|
-
"@mdx-js/loader": "^3.0.0",
|
|
36
|
-
"@mdx-js/react": "^3.0.0",
|
|
37
19
|
"@react-three/drei": "9.88.11",
|
|
38
20
|
"@react-three/fiber": "8.15.9",
|
|
39
21
|
"@react-three/rapier": "^1.1.2",
|
|
40
22
|
"@types/three": "^0.158.1",
|
|
41
|
-
"@types/uuid": "^9.0.6",
|
|
42
23
|
"@vanilla-extract/babel-plugin": "^1.2.0",
|
|
43
24
|
"@vanilla-extract/css": "^1.13.0",
|
|
44
25
|
"@vanilla-extract/css-utils": "^0.1.3",
|
|
45
26
|
"@vanilla-extract/dynamic": "^2.0.3",
|
|
27
|
+
"@vanilla-extract/next-plugin": "^2.3.1",
|
|
46
28
|
"@vanilla-extract/recipes": "^0.5.0",
|
|
47
29
|
"@vanilla-extract/sprinkles": "^1.6.1",
|
|
48
|
-
"css-loader": "^6.8.1",
|
|
49
30
|
"gh-pages": "^6.1.0",
|
|
50
31
|
"leva": "0.9.35",
|
|
51
32
|
"node-fetch": "3.3.2",
|
|
52
|
-
"pluralize": "^8.0.0",
|
|
53
|
-
"r3f-perf": "7.1.2",
|
|
54
33
|
"react": "^18.2.0",
|
|
55
34
|
"react-device-detect": "^2.2.3",
|
|
56
35
|
"react-dom": "^18.2.0",
|
|
@@ -58,7 +37,6 @@
|
|
|
58
37
|
"three": "^0.158.0"
|
|
59
38
|
},
|
|
60
39
|
"devDependencies": {
|
|
61
|
-
"@types/pluralize": "^0.0.33",
|
|
62
40
|
"@types/react": "^18.2.37",
|
|
63
41
|
"@types/react-dom": "^18.2.15",
|
|
64
42
|
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
@@ -72,5 +50,20 @@
|
|
|
72
50
|
"prettier": "^3.1.1",
|
|
73
51
|
"typescript": "^5.2.2",
|
|
74
52
|
"vite": "^5.0.0"
|
|
53
|
+
},
|
|
54
|
+
"description": "Web 3D Character Controller and World Platform Library",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/jigglypop/gaesup-world.git"
|
|
58
|
+
},
|
|
59
|
+
"keywords": [
|
|
60
|
+
"three.js",
|
|
61
|
+
"@react-three/fiber",
|
|
62
|
+
"@react-three/drei"
|
|
63
|
+
],
|
|
64
|
+
"author": "jigglypop",
|
|
65
|
+
"license": "MIT",
|
|
66
|
+
"bugs": {
|
|
67
|
+
"url": "https://github.com/jigglypop/gaesup-world/issues"
|
|
75
68
|
}
|
|
76
69
|
}
|
|
@@ -19,8 +19,14 @@ export default function GameBoy() {
|
|
|
19
19
|
gameboy: { gameboyStyle, gameboyInnerStyle },
|
|
20
20
|
} = useContext(GaesupToolsContext);
|
|
21
21
|
return (
|
|
22
|
-
<div
|
|
23
|
-
|
|
22
|
+
<div
|
|
23
|
+
className={style.gameBoy}
|
|
24
|
+
// style={gameboyStyle}
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
className={style.gameBoyInner}
|
|
28
|
+
// style={gameboyInnerStyle}
|
|
29
|
+
>
|
|
24
30
|
{GameBoyDirections.map((item: gameBoyButtonType, key: number) => {
|
|
25
31
|
return (
|
|
26
32
|
<GameBoyButton
|
|
@@ -40,8 +40,14 @@ export default function GamePad() {
|
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
|
-
<div
|
|
44
|
-
|
|
43
|
+
<div
|
|
44
|
+
className={style.gamePad}
|
|
45
|
+
// style={gamepadStyle}
|
|
46
|
+
>
|
|
47
|
+
<div
|
|
48
|
+
className={style.gamePadGrid}
|
|
49
|
+
// style={gamepadGridStyle}
|
|
50
|
+
>
|
|
45
51
|
{GamePadDirections.map((item: gameBoyDirectionType, key: number) => {
|
|
46
52
|
return (
|
|
47
53
|
<GamePadButton key={key} value={item.value} name={item.name} />
|
|
@@ -7,7 +7,6 @@ import GamePad from "./gamepad";
|
|
|
7
7
|
import { gamepadDefault } from "./gamepad/default";
|
|
8
8
|
import JoyStick from "./joystick";
|
|
9
9
|
import { joyStickDefault } from "./joystick/default";
|
|
10
|
-
import JumpPoint from "./jumpPoint";
|
|
11
10
|
import KeyBoardToolTip from "./keyBoardToolTip";
|
|
12
11
|
import { keyboardToolTipDefault } from "./keyBoardToolTip/default";
|
|
13
12
|
import MiniMap from "./minimap";
|
|
@@ -72,7 +71,7 @@ export function GaeSupTools({
|
|
|
72
71
|
</div>
|
|
73
72
|
</div>
|
|
74
73
|
|
|
75
|
-
<JumpPoint />
|
|
74
|
+
{/* <JumpPoint /> */}
|
|
76
75
|
</GaesupToolsDispatchContext.Provider>
|
|
77
76
|
</GaesupToolsContext.Provider>
|
|
78
77
|
);
|
|
@@ -17,7 +17,10 @@ export default function JoyStick() {
|
|
|
17
17
|
joystick: { joyStickStyle },
|
|
18
18
|
} = useContext(GaesupToolsContext);
|
|
19
19
|
return (
|
|
20
|
-
<div
|
|
20
|
+
<div
|
|
21
|
+
className={style.joyStick}
|
|
22
|
+
// style={joyStickStyle}
|
|
23
|
+
>
|
|
21
24
|
<JoyBall />
|
|
22
25
|
</div>
|
|
23
26
|
);
|
|
@@ -227,203 +230,3 @@ export function JoyBall() {
|
|
|
227
230
|
</div>
|
|
228
231
|
);
|
|
229
232
|
}
|
|
230
|
-
|
|
231
|
-
// import {
|
|
232
|
-
// MouseEvent,
|
|
233
|
-
// MouseEventHandler,
|
|
234
|
-
// TouchEvent,
|
|
235
|
-
// TouchEventHandler,
|
|
236
|
-
// useCallback,
|
|
237
|
-
// useContext,
|
|
238
|
-
// useEffect,
|
|
239
|
-
// useRef,
|
|
240
|
-
// useState,
|
|
241
|
-
// } from "react";
|
|
242
|
-
// import { vars } from "../../../styles/theme.css";
|
|
243
|
-
// import { GaesupToolsContext } from "../context";
|
|
244
|
-
// import useJoyStick from "./default";
|
|
245
|
-
// import * as style from "./style.css";
|
|
246
|
-
//
|
|
247
|
-
// export default function JoyStick() {
|
|
248
|
-
// return <JoyBall />;
|
|
249
|
-
// }
|
|
250
|
-
//
|
|
251
|
-
// export function JoyBall() {
|
|
252
|
-
// const outerRef = useRef<HTMLDivElement>(null);
|
|
253
|
-
// const childRef = useRef<HTMLDivElement>(null);
|
|
254
|
-
// const {
|
|
255
|
-
// joystick: { joyStickBallStyle, joyStickInnerStyle, joyStickStyle },
|
|
256
|
-
// } = useContext(GaesupToolsContext);
|
|
257
|
-
// const { joyStickBall, joyStickOrigin, setBall, setOrigin } = useJoyStick();
|
|
258
|
-
// const [mouseDown, setMouseDown] = useState(false);
|
|
259
|
-
// const [touchDown, setTouchDown] = useState(false);
|
|
260
|
-
// const [background, setBackground] = useState("rgba(0, 0, 0, 0.5)");
|
|
261
|
-
// const [boxShadow, setBoxShadow] = useState("0 0 10px rgba(0, 0, 0, 0.5)");
|
|
262
|
-
//
|
|
263
|
-
// const calcOriginBall = <T extends MouseEvent | TouchEvent>(
|
|
264
|
-
// e: T,
|
|
265
|
-
// X: number,
|
|
266
|
-
// Y: number
|
|
267
|
-
// ) => {
|
|
268
|
-
// const outer = e.target as HTMLDivElement;
|
|
269
|
-
// const parent = outer.parentElement as HTMLDivElement;
|
|
270
|
-
// console.log(parent.getBoundingClientRect());
|
|
271
|
-
// const { top, left, bottom, right, width, height } =
|
|
272
|
-
// parent.getBoundingClientRect();
|
|
273
|
-
//
|
|
274
|
-
// if (top > Y || bottom < Y || left > X || right < X) return;
|
|
275
|
-
// const normX = (joyStickOrigin.x - X) ** 2;
|
|
276
|
-
// const normY = (joyStickOrigin.y - Y) ** 2;
|
|
277
|
-
// const currentRadius = Math.sqrt(normX + normY);
|
|
278
|
-
// const originRadius = Math.sqrt((width / 2) ** 2 + (height / 2) ** 2);
|
|
279
|
-
// setOrigin({
|
|
280
|
-
// x: left,
|
|
281
|
-
// y: bottom,
|
|
282
|
-
// angle: Math.atan2(Y - (bottom - height / 2), X - (left + width / 2)),
|
|
283
|
-
// currentRadius,
|
|
284
|
-
// originRadius,
|
|
285
|
-
// isIn: currentRadius > originRadius / 2,
|
|
286
|
-
// isOn: true,
|
|
287
|
-
// isCenter: currentRadius < originRadius / 4,
|
|
288
|
-
// isUp: top > Y - height / 2,
|
|
289
|
-
// });
|
|
290
|
-
// setBoxShadow("0 0 10px rgba(99,251,215,1)");
|
|
291
|
-
// setBackground(
|
|
292
|
-
// currentRadius > originRadius / 2
|
|
293
|
-
// ? vars.gradient.lightGreen
|
|
294
|
-
// : vars.gradient.green
|
|
295
|
-
// );
|
|
296
|
-
// setBall({
|
|
297
|
-
// top: `${top}px`,
|
|
298
|
-
// left: `${left}px`,
|
|
299
|
-
// });
|
|
300
|
-
// };
|
|
301
|
-
//
|
|
302
|
-
// const initialize = (e) => {
|
|
303
|
-
// const outer = e.target as HTMLDivElement;
|
|
304
|
-
// const parent = outer.parentElement as HTMLDivElement;
|
|
305
|
-
// const { left, bottom, width, height } = parent.getBoundingClientRect();
|
|
306
|
-
// const x = left;
|
|
307
|
-
// const y = bottom;
|
|
308
|
-
//
|
|
309
|
-
// setOrigin({
|
|
310
|
-
// x: x,
|
|
311
|
-
// y: y,
|
|
312
|
-
// angle: Math.PI / 2,
|
|
313
|
-
// currentRadius: 0,
|
|
314
|
-
// originRadius: 0,
|
|
315
|
-
// isIn: true,
|
|
316
|
-
// isOn: false,
|
|
317
|
-
// isCenter: true,
|
|
318
|
-
// isUp: true,
|
|
319
|
-
// });
|
|
320
|
-
// initBall();
|
|
321
|
-
// };
|
|
322
|
-
//
|
|
323
|
-
// const handleMouseOver: MouseEventHandler = useCallback(
|
|
324
|
-
// (e) => {
|
|
325
|
-
// if (!mouseDown) return;
|
|
326
|
-
// console.log(e.clientX, e.clientY);
|
|
327
|
-
// calcOriginBall<MouseEvent<Element>>(e, e.pageX, e.pageY);
|
|
328
|
-
// },
|
|
329
|
-
// [
|
|
330
|
-
// joyStickBall,
|
|
331
|
-
// joyStickOrigin,
|
|
332
|
-
// setBall,
|
|
333
|
-
// setOrigin,
|
|
334
|
-
// mouseDown,
|
|
335
|
-
// boxShadow,
|
|
336
|
-
// background,
|
|
337
|
-
// setBoxShadow,
|
|
338
|
-
// setBackground,
|
|
339
|
-
// ]
|
|
340
|
-
// );
|
|
341
|
-
//
|
|
342
|
-
// const handleTouchMove: TouchEventHandler = useCallback(
|
|
343
|
-
// (e) => {
|
|
344
|
-
// if (!touchDown) return;
|
|
345
|
-
// calcOriginBall<TouchEvent<Element>>(
|
|
346
|
-
// e,
|
|
347
|
-
// e.touches[0].pageX,
|
|
348
|
-
// e.touches[0].pageY
|
|
349
|
-
// );
|
|
350
|
-
// },
|
|
351
|
-
// [touchDown, boxShadow, background, setBoxShadow, setBackground]
|
|
352
|
-
// );
|
|
353
|
-
//
|
|
354
|
-
// const handleTouchEnd: TouchEventHandler = useCallback(
|
|
355
|
-
// (e) => {
|
|
356
|
-
// setTouchDown(false);
|
|
357
|
-
// return initialize(e);
|
|
358
|
-
// },
|
|
359
|
-
// [
|
|
360
|
-
// touchDown,
|
|
361
|
-
// setTouchDown,
|
|
362
|
-
// boxShadow,
|
|
363
|
-
// background,
|
|
364
|
-
// setBoxShadow,
|
|
365
|
-
// setBackground,
|
|
366
|
-
// ]
|
|
367
|
-
// );
|
|
368
|
-
// const handleMouseOut: MouseEventHandler = useCallback(
|
|
369
|
-
// (e) => {
|
|
370
|
-
// setMouseDown(false);
|
|
371
|
-
// return initialize(e);
|
|
372
|
-
// },
|
|
373
|
-
// [
|
|
374
|
-
// setBall,
|
|
375
|
-
// setMouseDown,
|
|
376
|
-
// setOrigin,
|
|
377
|
-
// mouseDown,
|
|
378
|
-
// boxShadow,
|
|
379
|
-
// background,
|
|
380
|
-
// setBoxShadow,
|
|
381
|
-
// setBackground,
|
|
382
|
-
// ]
|
|
383
|
-
// );
|
|
384
|
-
//
|
|
385
|
-
// const initBall = () => {
|
|
386
|
-
// const { top, left, width, height } = outerRef.current.getClientRects()[0];
|
|
387
|
-
// setBoxShadow("0 0 10px rgba(0, 0, 0, 0.5)");
|
|
388
|
-
// setBackground("rgba(0, 0, 0, 0.5)");
|
|
389
|
-
// setBall({
|
|
390
|
-
// top: `${top + height / 2}px`,
|
|
391
|
-
// left: `${left + width / 2}px`,
|
|
392
|
-
// });
|
|
393
|
-
// };
|
|
394
|
-
// // window.addEventListener("resize", () => setScreenSize());
|
|
395
|
-
//
|
|
396
|
-
// useEffect(() => {
|
|
397
|
-
// initBall();
|
|
398
|
-
// }, []);
|
|
399
|
-
//
|
|
400
|
-
// return (
|
|
401
|
-
// <div className={style.joyStick}>
|
|
402
|
-
// <div
|
|
403
|
-
// className={style.joyStickInner}
|
|
404
|
-
// style={joyStickInnerStyle}
|
|
405
|
-
// ref={outerRef}
|
|
406
|
-
// onMouseDown={() => setMouseDown(true)}
|
|
407
|
-
// onMouseUp={() => setMouseDown(false)}
|
|
408
|
-
// onMouseMove={handleMouseOver}
|
|
409
|
-
// onMouseLeave={(e) => handleMouseOut(e)}
|
|
410
|
-
// onTouchStart={() => setTouchDown(true)}
|
|
411
|
-
// onTouchEnd={(e) => handleTouchEnd(e)}
|
|
412
|
-
// onTouchMove={handleTouchMove}
|
|
413
|
-
// onTouchCancel={handleTouchEnd}
|
|
414
|
-
// >
|
|
415
|
-
// <div
|
|
416
|
-
// className={`${style.joystickBall}`}
|
|
417
|
-
// ref={childRef}
|
|
418
|
-
// style={{
|
|
419
|
-
// background: joyStickBallStyle?.background || background,
|
|
420
|
-
// boxShadow: joyStickBallStyle?.boxShadow || boxShadow,
|
|
421
|
-
// top: joyStickBall.top,
|
|
422
|
-
// left: joyStickBall.left,
|
|
423
|
-
// ...joyStickBallStyle,
|
|
424
|
-
// }}
|
|
425
|
-
// />
|
|
426
|
-
// </div>
|
|
427
|
-
// </div>
|
|
428
|
-
// );
|
|
429
|
-
// }
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { style } from "@vanilla-extract/css";
|
|
2
|
-
import { fixed, flex } from "../../../styles/recipe/index.css";
|
|
3
2
|
|
|
4
3
|
export const joyStick = style([
|
|
5
|
-
fixed({
|
|
6
|
-
south_east: true,
|
|
7
|
-
}),
|
|
8
|
-
flex({
|
|
9
|
-
column: "7",
|
|
10
|
-
}),
|
|
11
4
|
{
|
|
5
|
+
position: "fixed",
|
|
6
|
+
bottom: "0",
|
|
7
|
+
right: "0",
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "column",
|
|
10
|
+
justifyContent: "flex-end",
|
|
11
|
+
alignItems: "flex-start",
|
|
12
|
+
textAlign: "center",
|
|
12
13
|
width: "100%",
|
|
13
14
|
},
|
|
14
15
|
]);
|
|
15
16
|
|
|
16
17
|
export const joyStickInner = style([
|
|
17
|
-
flex({
|
|
18
|
-
row: "center",
|
|
19
|
-
}),
|
|
20
18
|
{
|
|
19
|
+
display: "flex",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
textAlign: "center",
|
|
21
23
|
margin: "5rem",
|
|
22
24
|
padding: "1rem",
|
|
23
25
|
width: "12rem",
|
|
@@ -44,8 +44,14 @@ export default function KeyBoardToolTip() {
|
|
|
44
44
|
}, {});
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
|
-
<div
|
|
48
|
-
|
|
47
|
+
<div
|
|
48
|
+
className={style.keyBoardToolTip}
|
|
49
|
+
// style={keyBoardToolTipStyle}
|
|
50
|
+
>
|
|
51
|
+
<div
|
|
52
|
+
className={style.keyBoardTooInner}
|
|
53
|
+
// style={keyBoardToolTipInnerStyle}
|
|
54
|
+
>
|
|
49
55
|
{keyArray.map((item: keyArrayItemType, key: number) => {
|
|
50
56
|
let background = "rgba(0, 0, 0, 0.1)";
|
|
51
57
|
let boxShadow = "0 0 5px rgba(0, 0, 0, 0.2)";
|
|
@@ -70,16 +76,13 @@ export default function KeyBoardToolTip() {
|
|
|
70
76
|
return (
|
|
71
77
|
<div
|
|
72
78
|
className={style.keyCap}
|
|
73
|
-
style={{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}),
|
|
81
|
-
...keyCapStyle,
|
|
82
|
-
}}
|
|
79
|
+
style={assignInlineVars({
|
|
80
|
+
background,
|
|
81
|
+
boxShadow,
|
|
82
|
+
color,
|
|
83
|
+
gridRow: item.gridRow,
|
|
84
|
+
gridColumn: item.gridColumn,
|
|
85
|
+
})}
|
|
83
86
|
key={key}
|
|
84
87
|
>
|
|
85
88
|
{item.name}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
1
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
4
2
|
import { useCallback, useContext, useEffect, useState } from "react";
|
|
5
3
|
|
|
@@ -41,31 +39,37 @@ export default function MiniMap() {
|
|
|
41
39
|
return (
|
|
42
40
|
<div
|
|
43
41
|
className={style.minimap}
|
|
44
|
-
style={minimap.minimapStyle || {}}
|
|
42
|
+
// style={assignInlineVars(minimap.minimapStyle || {})}
|
|
45
43
|
onWheel={(e) => {
|
|
46
44
|
if (e.deltaY > 0) downRatio();
|
|
47
45
|
else upRatio();
|
|
48
46
|
}}
|
|
49
47
|
>
|
|
50
|
-
<div
|
|
51
|
-
|
|
48
|
+
<div
|
|
49
|
+
className={style.minimapOuter}
|
|
50
|
+
// style={minimap.objectStyle || {}}
|
|
51
|
+
/>
|
|
52
|
+
<div
|
|
53
|
+
className={style.minimapInner}
|
|
54
|
+
// style={minimap.innerStyle || {}}
|
|
55
|
+
>
|
|
52
56
|
{Object.values(minimapInner.props).map((obj, key) => {
|
|
53
57
|
return (
|
|
54
58
|
<div
|
|
55
59
|
key={key}
|
|
56
60
|
className={style.minimapObject}
|
|
57
|
-
style={{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}),
|
|
65
|
-
...minimap.objectStyle,
|
|
66
|
-
}}
|
|
61
|
+
style={assignInlineVars({
|
|
62
|
+
width: `${obj.size.x}rem`,
|
|
63
|
+
height: `${obj.size.z}rem`,
|
|
64
|
+
transform: `translate(${
|
|
65
|
+
-obj.center.x + activeState.position.x * ratio
|
|
66
|
+
}rem, ${-obj.center.z + activeState.position.z * ratio}rem)`,
|
|
67
|
+
})}
|
|
67
68
|
>
|
|
68
|
-
<div
|
|
69
|
+
<div
|
|
70
|
+
className={style.text}
|
|
71
|
+
// style={minimap.textStyle}
|
|
72
|
+
>
|
|
69
73
|
{obj.text}
|
|
70
74
|
</div>
|
|
71
75
|
</div>
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
|
|
2
|
+
import react from "@vitejs/plugin-react-swc";
|
|
3
|
+
import { defineConfig } from "vite";
|
|
4
|
+
|
|
5
|
+
// https://vitejs.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
base: "/gaesup-world/",
|
|
8
|
+
plugins: [react(), vanillaExtractPlugin()],
|
|
9
|
+
});
|
package/lib/index.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
-
"allowJs": true,
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
-
"noFallthroughCasesInSwitch": true,
|
|
11
|
-
"module": "esnext",
|
|
12
|
-
"moduleResolution": "node",
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"isolatedModules": true,
|
|
15
|
-
// publish options
|
|
16
|
-
"jsx": "react-jsx",
|
|
17
|
-
"noEmit": false,
|
|
18
|
-
"declaration": true,
|
|
19
|
-
"outDir": "./dist"
|
|
20
|
-
},
|
|
21
|
-
"include": ["./src/**/*.tsx", "./src/**/*.ts"]
|
|
22
|
-
}
|