Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
8e5faaef
Commit
8e5faaef
authored
Sep 24, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjust mat styles
parent
240f092a
Pipeline
#23546
passed with stages
in 41 minutes and 46 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
11 deletions
+26
-11
src/ui/Duel/PlayMat/Card/springs/moveToHand.ts
src/ui/Duel/PlayMat/Card/springs/moveToHand.ts
+2
-1
src/ui/Shared/css.ts
src/ui/Shared/css.ts
+24
-10
No files found.
src/ui/Duel/PlayMat/Card/springs/moveToHand.ts
View file @
8e5faaef
...
@@ -13,6 +13,7 @@ const {
...
@@ -13,6 +13,7 @@ const {
HAND_MARGIN_TOP
,
HAND_MARGIN_TOP
,
HAND_CARD_HEIGHT
,
HAND_CARD_HEIGHT
,
HAND_CIRCLE_CENTER_OFFSET_Y
,
HAND_CIRCLE_CENTER_OFFSET_Y
,
HAND_MAT_OFFSET_Y
,
}
=
matConfig
;
}
=
matConfig
;
const
{
HAND
}
=
ygopro
.
CardZone
;
const
{
HAND
}
=
ygopro
.
CardZone
;
...
@@ -41,7 +42,7 @@ export const moveToHand: MoveFunc = async (props) => {
...
@@ -41,7 +42,7 @@ export const moveToHand: MoveFunc = async (props) => {
const
negativeX
=
Math
.
sin
(
angle
)
*
r
;
const
negativeX
=
Math
.
sin
(
angle
)
*
r
;
const
negativeY
=
Math
.
cos
(
angle
)
*
r
+
HAND_CARD_HEIGHT
/
2
;
const
negativeY
=
Math
.
cos
(
angle
)
*
r
+
HAND_CARD_HEIGHT
/
2
;
const
x
=
hand_circle_center_x
+
negativeX
*
(
isMe
(
controller
)
?
1
:
-
1
);
const
x
=
hand_circle_center_x
+
negativeX
*
(
isMe
(
controller
)
?
1
:
-
1
);
const
y
=
hand_circle_center_y
-
negativeY
+
140
;
// FIXME: 常量 是手动调的 这里肯定有问题 有空来修
const
y
=
hand_circle_center_y
-
negativeY
+
HAND_MAT_OFFSET_Y
;
const
_rz
=
(
angle
*
180
)
/
Math
.
PI
;
const
_rz
=
(
angle
*
180
)
/
Math
.
PI
;
...
...
src/ui/Shared/css.ts
View file @
8e5faaef
// 此文件目的是在js和CSS之间共享一些变量,并且这些变量是0运行时的。
// 此文件目的是在js和CSS之间共享一些变量,并且这些变量是0运行时的。
interface
CSSConfig
{
type
CSSConfig
=
[
string
,
[
number
,
UNIT
]][];
readonly
[
key
:
string
]:
[
number
,
UNIT
];
}
// 以1280长度的viewpoint为基准进行缩放
const
VIEW_POINT_WIDTH_BASE
=
1280
;
/** 转为CSS变量: BOARD_ROTATE_Z -> --board-rotate-z */
/** 转为CSS变量: BOARD_ROTATE_Z -> --board-rotate-z */
const
toCssProperties
=
(
config
:
CSSConfig
)
=>
const
toCssProperties
=
(
config
:
CSSConfig
)
=>
Object
.
entries
(
config
)
config
.
map
(
.
map
(
([
k
,
v
])
=>
([
k
,
v
])
=>
[
[
...
@@ -18,13 +19,21 @@ const toCssProperties = (config: CSSConfig) =>
...
@@ -18,13 +19,21 @@ const toCssProperties = (config: CSSConfig) =>
)
)
.
reduce
((
acc
,
cur
)
=>
[...
acc
,
cur
],
[]
as
[
string
,
string
][]);
.
reduce
((
acc
,
cur
)
=>
[...
acc
,
cur
],
[]
as
[
string
,
string
][]);
const
pxTransform
=
(
value
:
number
,
unit
:
UNIT
)
=>
{
if
(
unit
===
UNIT
.
PX
&&
window
.
innerWidth
<
VIEW_POINT_WIDTH_BASE
)
{
return
[
value
*
0.5
,
unit
];
}
else
{
return
[
value
,
unit
];
}
};
enum
UNIT
{
enum
UNIT
{
PX
=
"
px
"
,
PX
=
"
px
"
,
DEG
=
"
deg
"
,
DEG
=
"
deg
"
,
NONE
=
""
,
NONE
=
""
,
}
}
const
matConfigWithUnit
=
{
const
_matConfigWithUnit
:
Record
<
string
,
[
number
,
UNIT
]
>
=
{
PERSPECTIVE
:
[
1500
,
UNIT
.
PX
],
PERSPECTIVE
:
[
1500
,
UNIT
.
PX
],
PLANE_ROTATE_X
:
[
0
,
UNIT
.
DEG
],
PLANE_ROTATE_X
:
[
0
,
UNIT
.
DEG
],
BLOCK_WIDTH
:
[
120
,
UNIT
.
PX
],
BLOCK_WIDTH
:
[
120
,
UNIT
.
PX
],
...
@@ -36,21 +45,26 @@ const matConfigWithUnit = {
...
@@ -36,21 +45,26 @@ const matConfigWithUnit = {
HAND_MARGIN_TOP
:
[
0
,
UNIT
.
PX
],
HAND_MARGIN_TOP
:
[
0
,
UNIT
.
PX
],
HAND_CIRCLE_CENTER_OFFSET_Y
:
[
2000
,
UNIT
.
PX
],
HAND_CIRCLE_CENTER_OFFSET_Y
:
[
2000
,
UNIT
.
PX
],
HAND_CARD_HEIGHT
:
[
130
,
UNIT
.
PX
],
HAND_CARD_HEIGHT
:
[
130
,
UNIT
.
PX
],
HAND_MAT_OFFSET_Y
:
[
140
,
UNIT
.
PX
],
// 手卡离场地的偏移
DECK_OFFSET_X
:
[
140
,
UNIT
.
PX
],
DECK_OFFSET_X
:
[
140
,
UNIT
.
PX
],
DECK_OFFSET_Y
:
[
80
,
UNIT
.
PX
],
DECK_OFFSET_Y
:
[
80
,
UNIT
.
PX
],
DECK_ROTATE_Z
:
[
30
,
UNIT
.
DEG
],
DECK_ROTATE_Z
:
[
30
,
UNIT
.
DEG
],
DECK_CARD_HEIGHT
:
[
120
,
UNIT
.
PX
],
DECK_CARD_HEIGHT
:
[
120
,
UNIT
.
PX
],
CARD_HEIGHT_O
:
[
100
,
UNIT
.
PX
],
// 场地魔法/墓地/除外的卡片高度
CARD_HEIGHT_O
:
[
100
,
UNIT
.
PX
],
// 场地魔法/墓地/除外的卡片高度
BLOCK_OUTSIDE_OFFSET_X
:
[
15
,
UNIT
.
PX
],
BLOCK_OUTSIDE_OFFSET_X
:
[
15
,
UNIT
.
PX
],
}
satisfies
CSSConfig
;
};
const
matConfigWithUnit
=
Object
.
entries
(
_matConfigWithUnit
).
map
(
([
k
,
[
value
,
unit
]])
=>
[
k
,
pxTransform
(
value
,
unit
)
as
[
number
,
UNIT
]],
)
satisfies
CSSConfig
;
export
const
matConfig
=
Object
.
keys
(
matConfigWithUnit
)
.
reduce
(
export
const
matConfig
=
matConfigWithUnit
.
reduce
(
(
prev
,
key
)
=>
({
(
prev
,
[
key
,
value
]
)
=>
({
...
prev
,
...
prev
,
// @ts-ignore
// @ts-ignore
[
key
]:
matConfigWithUnit
[
key
]
[
0
],
[
key
]:
value
[
0
],
}),
}),
{}
as
Record
<
keyof
typeof
matConfigWithUnit
,
number
>
,
{}
as
Record
<
keyof
typeof
_
matConfigWithUnit
,
number
>
,
);
);
toCssProperties
(
matConfigWithUnit
).
forEach
(([
k
,
v
])
=>
{
toCssProperties
(
matConfigWithUnit
).
forEach
(([
k
,
v
])
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment