Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
LuzhouLaojiaoSnake_250428
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
LuzhouLaojiaoSnake_250428
Commits
3f3ff842
Commit
3f3ff842
authored
May 06, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
蛇移动
parent
f1a44af0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
1 deletion
+97
-1
cdBg.png
src/assets/GamePage/cdBg.png
+0
-0
ZongZi.ts
src/pages/GamePage/Components/Element/ZongZi.ts
+31
-0
GamePage.less
src/pages/GamePage/GamePage.less
+43
-0
GamePage.tsx
src/pages/GamePage/GamePage.tsx
+8
-1
Config.ts
src/pages/GamePage/config/Config.ts
+7
-0
gameStore.ts
src/store/gameStore.ts
+8
-0
No files found.
src/assets/GamePage/cdBg.png
0 → 100644
View file @
3f3ff842
4.89 KB
src/pages/GamePage/Components/Element/ZongZi.ts
0 → 100644
View file @
3f3ff842
import
{
Element
}
from
"@/pages/GamePage/Components/Element/Element.ts"
;
import
{
Ele
}
from
"@/pages/GamePage/config/Config.ts"
;
import
{
collisionSys
}
from
"@/pages/GamePage/GamePage.tsx"
;
import
{
DEG_TO_RAD
}
from
"pixi.js"
;
/**
* 粽子
*/
export
class
ZongZi
extends
Element
{
id
:
Ele
=
Ele
.
ZongZi
;
initUI
():
void
{
}
initPhy
():
void
{
this
.
body
=
collisionSys
.
createCircle
(
this
.
getGlobalPosition
(),
this
.
sp
.
height
/
2
/
2.2
,
{
userData
:
{
ele
:
this
}
}
);
this
.
body
.
setAngle
(
this
.
angle
*
DEG_TO_RAD
);
}
updatePhy
():
void
{
}
}
src/pages/GamePage/GamePage.less
View file @
3f3ff842
...
...
@@ -56,6 +56,49 @@
width: 277px;
height: 79px;
.webpBg("GamePage/我的分数.png");
.scoreNum {
position: absolute;
left: 125px;
top: -2px;
width: 120px;
height: 100%;
font-size: 50px;
line-height: 50px;
font-weight: bold;
color: white;
display: flex;
align-items: center;
justify-content: center;
}
}
.cd {
position: absolute;
right: 0;
top: 211px;
width: 179px;
height: 79px;
.webpBg("GamePage/cdBg.png");
display: flex;
align-items: center;
justify-content: center;
.cdNum {
position: absolute;
top: -2px;
height: 100%;
font-size: 50px;
line-height: 50px;
font-weight: bold;
color: white;
display: flex;
align-items: center;
justify-content: center;
}
}
.backBtn {
...
...
src/pages/GamePage/GamePage.tsx
View file @
3f3ff842
...
...
@@ -15,6 +15,7 @@ import { winSize } from "@/pages/GamePage/config/Config.ts";
import
{
Stats
}
from
'pixi-stats'
;
import
{
System
}
from
'detect-collisions'
;
import
gameStore
from
"@/store/gameStore.ts"
;
export
const
collisionSys
:
System
=
new
System
();
const
DEBUG
=
true
;
...
...
@@ -121,6 +122,9 @@ class GamePage extends React.Component {
}
render
()
{
const
{
score
}
=
gameStore
.
gameInfo
;
return
<
div
className=
"GamePage"
>
<
div
className=
"gameBg"
/>
<
canvas
...
...
@@ -134,7 +138,10 @@ class GamePage extends React.Component {
/>
}
<
div
className=
"scoreArea"
>
<
div
className=
"scoreNum"
>
{
score
}
</
div
>
</
div
>
<
div
className=
"cd"
>
<
div
className=
"cdNum"
>
1:20
</
div
>
</
div
>
<
MusicBtn
className=
"musicBtn"
/>
<
Button
className=
"backBtn"
onClick=
{
this
.
clickBack
}
/>
...
...
src/pages/GamePage/config/Config.ts
View file @
3f3ff842
...
...
@@ -4,6 +4,7 @@ import { Filiform } from "@/pages/GamePage/Components/Element/Filiform.ts";
import
{
Molecule
}
from
"@/pages/GamePage/Components/Element/Molecule.ts"
;
import
{
Mugwort
}
from
"@/pages/GamePage/Components/Element/Mugwort.ts"
;
import
{
Realgar
}
from
"@/pages/GamePage/Components/Element/Realgar.ts"
;
import
{
ZongZi
}
from
"@/pages/GamePage/Components/Element/ZongZi.ts"
;
export
enum
Ele
{
Yeast
=
"Yeast"
,
// 酵母菌
...
...
@@ -11,6 +12,7 @@ export enum Ele {
Molecule
=
"Molecule"
,
// 黄色分子
Mugwort
=
"Mugwort"
,
// 艾草
Realgar
=
"Realgar"
,
// 雄黄
ZongZi
=
"ZongZi"
,
// 雄黄
}
export
interface
EleData
{
...
...
@@ -47,6 +49,11 @@ export const EleConfig: { [key in Ele]: EleData } = {
texture
:
"元素/雄黄.png"
,
weight
:
1
,
neg
:
true
,
},
[
Ele
.
ZongZi
]:
{
cls
:
ZongZi
,
texture
:
"元素/粽子.png"
,
weight
:
100
,
}
}
...
...
src/store/gameStore.ts
View file @
3f3ff842
...
...
@@ -36,6 +36,14 @@ class GameStore {
return
success
;
}
gameInfo
:
{
score
:
number
,
remainTimes
:
number
,
}
=
{
score
:
0
,
remainTimes
:
0
,
}
async
submit
(
win
:
boolean
,
soc
:
number
)
{
const
startId
=
this
.
startInfo
.
userRecordId
;
...
...
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