Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
L4R4
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
L4R4
Commits
145fbcf9
Commit
145fbcf9
authored
Nov 10, 2022
by
杨一航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v1.0
parent
174d6104
Changes
13
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
3711 additions
and
1291 deletions
+3711
-1291
coin_overturn_ske.json
assets/L4R4/animation/coin_overturn_ske.json
+1
-0
coin_overturn_ske.json.meta
assets/L4R4/animation/coin_overturn_ske.json.meta
+5
-0
coin_overturn_tex.json
assets/L4R4/animation/coin_overturn_tex.json
+1
-0
coin_overturn_tex.json.meta
assets/L4R4/animation/coin_overturn_tex.json.meta
+5
-0
coin_overturn_tex.png
assets/L4R4/animation/coin_overturn_tex.png
+0
-0
coin_overturn_tex.png.meta
assets/L4R4/animation/coin_overturn_tex.png.meta
+36
-0
L4R4.fire
assets/L4R4/scene/L4R4.fire
+3318
-1092
L4R4.ts
assets/L4R4/scene/L4R4.ts
+169
-140
Server.ts
assets/L4R4/script/Server.ts
+102
-59
红色方标记.png
assets/L4R4/texture/红色方标记.png
+0
-0
红色方标记.png.meta
assets/L4R4/texture/红色方标记.png.meta
+37
-0
蓝色方标记.png
assets/L4R4/texture/蓝色方标记.png
+0
-0
蓝色方标记.png.meta
assets/L4R4/texture/蓝色方标记.png.meta
+37
-0
No files found.
assets/L4R4/animation/coin_overturn_ske.json
0 → 100755
View file @
145fbcf9
{
"frameRate"
:
24
,
"name"
:
"coin_overturn"
,
"version"
:
"5.5"
,
"compatibleVersion"
:
"5.5"
,
"armature"
:[{
"type"
:
"Armature"
,
"frameRate"
:
24
,
"name"
:
"Armature"
,
"aabb"
:{
"x"
:
-119
,
"y"
:
-85.5
,
"width"
:
233
,
"height"
:
178
},
"bone"
:[{
"name"
:
"root"
},{
"length"
:
43
,
"name"
:
"1"
,
"parent"
:
"root"
,
"transform"
:{
"x"
:
-1.25
,
"y"
:
-4.45
,
"skX"
:
-86.688
,
"skY"
:
-86.688
}}],
"slot"
:[{
"name"
:
"1"
,
"parent"
:
"1"
}],
"skin"
:[{
"slot"
:[{
"name"
:
"1"
,
"display"
:[{
"name"
:
"coin_overturn/1"
,
"transform"
:{
"x"
:
-8.01
,
"y"
:
-0.79
,
"skX"
:
86.69
,
"skY"
:
86.69
}},{
"name"
:
"coin_overturn/2"
,
"transform"
:{
"x"
:
-8.01
,
"y"
:
-0.79
,
"skX"
:
86.69
,
"skY"
:
86.69
}},{
"name"
:
"coin_overturn/3"
,
"transform"
:{
"x"
:
-5.4
,
"y"
:
1.06
,
"skX"
:
86.69
,
"skY"
:
86.69
}},{
"name"
:
"coin_overturn/4"
,
"transform"
:{
"x"
:
-4.96
,
"y"
:
0.04
,
"skX"
:
86.69
,
"skY"
:
86.69
}},{
"name"
:
"coin_overturn/5"
,
"transform"
:{
"x"
:
-6.01
,
"y"
:
-0.9
,
"skX"
:
86.69
,
"skY"
:
86.69
}},{
"name"
:
"coin_overturn/6"
,
"transform"
:{
"x"
:
-8.01
,
"y"
:
-0.79
,
"skX"
:
86.69
,
"skY"
:
86.69
}},{
"name"
:
"coin_overturn/7"
,
"transform"
:{
"x"
:
-5.01
,
"y"
:
-0.96
,
"skX"
:
86.69
,
"skY"
:
86.69
}}]}]}],
"animation"
:[{
"duration"
:
14
,
"playTimes"
:
0
,
"name"
:
"normal"
,
"slot"
:[{
"name"
:
"1"
,
"displayFrame"
:[{},{
"value"
:
1
},{
"value"
:
2
},{
"value"
:
3
},{
"value"
:
4
},{
"value"
:
5
},{
"value"
:
6
},{},{
"value"
:
1
},{
"value"
:
2
},{
"value"
:
3
},{
"value"
:
4
},{
"value"
:
5
},{
"value"
:
6
},{
"duration"
:
0
}]}]}],
"defaultActions"
:[{
"gotoAndPlay"
:
"normal"
}]}]}
\ No newline at end of file
assets/L4R4/animation/coin_overturn_ske.json.meta
0 → 100644
View file @
145fbcf9
{
"ver": "1.0.1",
"uuid": "2b6b7708-44d5-4679-9880-777f48407ec1",
"subMetas": {}
}
\ No newline at end of file
assets/L4R4/animation/coin_overturn_tex.json
0 → 100755
View file @
145fbcf9
{
"width"
:
512
,
"SubTexture"
:[{
"width"
:
233
,
"y"
:
1
,
"height"
:
178
,
"name"
:
"coin_overturn/7"
,
"x"
:
1
},{
"width"
:
253
,
"y"
:
181
,
"height"
:
98
,
"name"
:
"coin_overturn/2"
,
"x"
:
1
},{
"width"
:
257
,
"y"
:
365
,
"height"
:
59
,
"name"
:
"coin_overturn/3"
,
"x"
:
1
},{
"width"
:
253
,
"y"
:
181
,
"height"
:
98
,
"name"
:
"coin_overturn/6"
,
"x"
:
256
},{
"width"
:
253
,
"y"
:
281
,
"height"
:
82
,
"name"
:
"coin_overturn/5"
,
"x"
:
1
},{
"width"
:
233
,
"y"
:
1
,
"height"
:
178
,
"name"
:
"coin_overturn/1"
,
"x"
:
236
},{
"width"
:
255
,
"y"
:
281
,
"height"
:
58
,
"name"
:
"coin_overturn/4"
,
"x"
:
256
}],
"height"
:
512
,
"name"
:
"coin_overturn"
,
"imagePath"
:
"coin_overturn_tex.png"
}
\ No newline at end of file
assets/L4R4/animation/coin_overturn_tex.json.meta
0 → 100644
View file @
145fbcf9
{
"ver": "1.0.1",
"uuid": "d2e64191-0d23-44ba-bd59-24a0b80c6525",
"subMetas": {}
}
\ No newline at end of file
assets/L4R4/animation/coin_overturn_tex.png
0 → 100755
View file @
145fbcf9
318 KB
assets/L4R4/animation/coin_overturn_tex.png.meta
0 → 100644
View file @
145fbcf9
{
"ver": "2.3.5",
"uuid": "f48beade-3501-49c9-87c5-0657f20ff2f4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 512,
"height": 512,
"platformSettings": {},
"subMetas": {
"coin_overturn_tex": {
"ver": "1.0.4",
"uuid": "907db0c0-a56c-4168-aa9f-6c5630628187",
"rawTextureUuid": "f48beade-3501-49c9-87c5-0657f20ff2f4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 43.5,
"trimX": 1,
"trimY": 1,
"width": 510,
"height": 423,
"rawWidth": 512,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/L4R4/scene/L4R4.fire
View file @
145fbcf9
This diff is collapsed.
Click to expand it.
assets/L4R4/scene/L4R4.ts
View file @
145fbcf9
This diff is collapsed.
Click to expand it.
assets/L4R4/script/Server.ts
View file @
145fbcf9
...
...
@@ -29,14 +29,11 @@ export class GameServer {
"
http://staging-teach.cdn.ireadabc.com/f40ce4a8630039c4cf48a63fc1399c52.png
"
,
];
jumpList
=
[
// { from: 2, rto: 11 ,wto:1},
];
forceWrongIndexList
=
[];
private
_totalStep
:
any
;
randomList
=
[];
private
_useAI
:
boolean
;
private
_timer
:
number
;
private
_totalTime
:
number
=
150
;
constructor
(
playerMaxNumber
,
networkHelper
)
{
this
.
playerMaxNumber
=
playerMaxNumber
;
...
...
@@ -80,14 +77,20 @@ export class GameServer {
gameStatus
=
{
state
:
0
,
// -1:未开始 0 准备阶段 1 roll 2 判定
Red
:
-
1
,
Blue
:
-
1
,
Red
:
0
,
Blue
:
0
,
RedTime
:
0
,
BlueTime
:
0
,
step
:
0
,
current
:
"
Red
"
,
jump
:
false
,
back
:
false
,
time
:
"
0
"
};
startGame
()
{
this
.
openTimerCounter
();
console
.
log
(
"
startGame set time ------
"
);
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_updateStatus
"
,
status
:
this
.
gameStatus
,
...
...
@@ -154,57 +157,46 @@ export class GameServer {
}
if
(
sender
.
color
==
this
.
gameStatus
.
current
)
{
let
nowStep
=
this
.
gameStatus
[
this
.
gameStatus
.
current
];
let
index
=
Math
.
floor
(
Math
.
random
()
*
this
.
randomList
.
length
)
let
step
=
this
.
randomList
[
index
];
// if (nowStep < 5) {
// step = 3;
// } else {
// step = 1;
// }
// step = 3
step
=
Math
.
min
(
step
,
this
.
_totalStep
-
1
-
nowStep
);
console
.
log
(
"
random step ===
"
+
step
);
this
.
gameStatus
.
step
=
step
;
let
i
=
Math
.
floor
(
Math
.
random
()
*
this
.
randomList
.
length
)
let
index
=
this
.
randomList
[
i
];
console
.
log
(
"
random index ===
"
+
index
);
this
.
gameStatus
.
step
=
index
;
this
.
gameStatus
.
state
=
1
;
let
endStep
=
nowStep
+
step
;
this
.
gameStatus
.
back
=
false
;
if
(
this
.
forceWrongIndexList
.
indexOf
(
endStep
)
>
-
1
)
{
this
.
gameStatus
.
back
=
true
;
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_playerRoll
"
,
status
:
this
.
gameStatus
,
});
this
.
gameStatus
.
state
=
2
;
this
.
gameStatus
.
step
=
null
;
this
.
changeSide
();
}
else
{
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_playerRoll
"
,
status
:
this
.
gameStatus
,
});
}
}
else
{
console
.
warn
(
"
data uuid not match
"
);
}
}
else
if
(
data
.
type
==
"
right
"
)
{
let
nowStep
:
number
=
this
.
gameStatus
[
this
.
gameStatus
.
current
];
console
.
log
(
"
nowStep ===
"
+
nowStep
);
const
jump
=
this
.
jumpList
.
find
(
jump
=>
parseInt
(
jump
.
from
)
==
nowStep
+
this
.
gameStatus
.
step
);
this
.
gameStatus
[
this
.
gameStatus
.
current
]
=
jump
?.
rto
?
parseInt
(
jump
.
rto
)
:
nowStep
+
this
.
gameStatus
.
step
;
if
(
jump
)
{
console
.
log
(
"
jump=============
"
);
console
.
log
(
jump
);
let
posIndex
=
this
.
gameStatus
.
step
this
.
gameStatus
[
this
.
gameStatus
.
current
]
++
;
let
lastTime
=
+
this
.
gameStatus
.
time
;
console
.
log
(
"
lasttime =
"
+
lastTime
);
let
costTime
=
(
Math
.
floor
(
Date
.
now
()
/
1000
)
-
lastTime
).
toFixed
(
1
)
console
.
log
(
"
=right===cost time =
"
+
costTime
);
if
(
this
.
gameStatus
.
current
==
"
Red
"
)
{
this
.
gameStatus
.
RedTime
+=
+
costTime
}
else
{
this
.
gameStatus
.
BlueTime
+=
+
costTime
}
if
(
this
.
gameStatus
[
this
.
gameStatus
.
current
]
<
this
.
_totalStep
-
1
)
{
let
i
=
this
.
randomList
.
indexOf
(
posIndex
);
this
.
randomList
[
i
]
=
this
.
randomList
[
this
.
randomList
.
length
-
1
];
this
.
randomList
.
length
--
;
if
(
this
.
gameStatus
[
this
.
gameStatus
.
current
]
<
10
)
{
this
.
gameStatus
.
step
=
null
;
this
.
gameStatus
.
state
=
2
;
this
.
gameStatus
.
jump
=
!!
jump
?.
rto
;
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_playerRight
"
,
status
:
this
.
gameStatus
,
...
...
@@ -213,7 +205,6 @@ export class GameServer {
}
else
{
this
.
gameStatus
.
state
=
2
;
this
.
gameStatus
.
step
=
null
;
this
.
gameStatus
.
jump
=
!!
jump
;
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_playerWin
"
,
status
:
this
.
gameStatus
,
...
...
@@ -222,15 +213,19 @@ export class GameServer {
}
}
else
if
(
data
.
type
==
"
wrong
"
)
{
console
.
log
(
"
data =
"
+
JSON
.
stringify
(
data
));
let
nowStep
:
number
=
this
.
gameStatus
[
this
.
gameStatus
.
current
];
console
.
log
(
"
nowStep ===
"
+
nowStep
);
const
jump
=
this
.
jumpList
.
find
(
jump
=>
parseInt
(
jump
.
from
)
==
nowStep
+
this
.
gameStatus
.
step
);
this
.
gameStatus
[
this
.
gameStatus
.
current
]
=
jump
?.
wto
?
parseInt
(
jump
.
wto
)
:
nowStep
;
let
lastTime
=
+
this
.
gameStatus
.
time
;
let
costTime
=
(
Math
.
floor
(
Date
.
now
()
/
1000
)
-
lastTime
).
toFixed
(
1
)
console
.
log
(
"
=wrong and ===cost time =
"
+
costTime
);
if
(
this
.
gameStatus
.
current
==
"
Red
"
)
{
this
.
gameStatus
.
RedTime
+=
+
costTime
}
else
{
this
.
gameStatus
.
BlueTime
+=
+
costTime
}
this
.
gameStatus
.
step
=
null
;
this
.
gameStatus
.
state
=
2
;
this
.
gameStatus
.
jump
=
!!
jump
?.
wto
;
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_playerWrong
"
,
status
:
this
.
gameStatus
,
...
...
@@ -241,15 +236,19 @@ export class GameServer {
if
(
this
.
_useAI
||
sender
.
color
==
this
.
gameStatus
.
current
)
{
if
(
this
.
gameStatus
.
state
==
2
||
this
.
gameStatus
.
back
)
{
if
(
this
.
gameStatus
.
state
==
2
)
{
this
.
gameStatus
.
state
=
0
;
}
if
(
this
.
gameStatus
.
state
==
0
)
{
this
.
openTimerCounter
();
}
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_updateStatus
"
,
status
:
this
.
gameStatus
,
});
this
.
gameStatus
.
jump
=
null
;
this
.
gameStatus
.
back
=
null
;
}
}
...
...
@@ -264,6 +263,50 @@ export class GameServer {
this
.
_totalStep
=
step
;
}
openTimerCounter
()
{
let
prepareTime
=
4
;
// AI 无准备时间
if
(
this
.
_useAI
&&
this
.
gameStatus
.
current
==
"
Blue
"
)
{
prepareTime
=
0
}
this
.
gameStatus
.
time
=
""
+
(
Math
.
floor
(
Date
.
now
()
/
1000
)
+
prepareTime
);
console
.
log
(
"
openTimerCounter set time ------
"
);
clearTimeout
(
this
.
_timer
)
let
leftTime
=
this
.
gameStatus
.
BlueTime
if
(
this
.
gameStatus
.
current
==
"
Red
"
)
{
leftTime
=
this
.
gameStatus
.
RedTime
;
}
leftTime
=
this
.
_totalTime
-
leftTime
+
prepareTime
;
console
.
log
(
`
${
this
.
gameStatus
.
current
}
left time
${
leftTime
}
, now time
${
Date
.
now
()
/
1000
}
`
)
this
.
_timer
=
setTimeout
(
this
.
timeOver
.
bind
(
this
),
leftTime
*
1000
);
}
timeOver
()
{
let
lastTime
=
+
this
.
gameStatus
.
time
;
let
costTime
=
(
Math
.
floor
(
Date
.
now
()
/
1000
)
-
lastTime
).
toFixed
(
1
)
console
.
log
(
`time over and time now
${
Date
.
now
()
/
1000
}
`
);
console
.
log
(
"
=wrong and ===cost time =
"
+
costTime
);
if
(
this
.
gameStatus
.
current
==
"
Red
"
)
{
this
.
gameStatus
.
RedTime
+=
+
costTime
}
else
{
this
.
gameStatus
.
BlueTime
+=
+
costTime
}
if
(
this
.
gameStatus
.
current
==
"
Red
"
)
{
this
.
gameStatus
.
current
=
"
Blue
"
}
this
.
gameStatus
.
state
=
2
;
this
.
gameStatus
.
step
=
null
;
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_playerWin
"
,
status
:
this
.
gameStatus
,
});
this
.
gameStatus
[
'
gameOver
'
]
=
true
;
}
changeSide
()
{
...
...
assets/L4R4/texture/红色方标记.png
0 → 100644
View file @
145fbcf9
6.98 KB
assets/L4R4/texture/红色方标记.png.meta
0 → 100644
View file @
145fbcf9
{
"ver": "2.3.5",
"uuid": "a2aaf5ad-5e41-4c6b-8e88-20d13def81e2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 65,
"height": 65,
"platformSettings": {},
"subMetas": {
"红色方标记": {
"ver": "1.0.4",
"uuid": "0d662d0a-e52c-465c-b2e3-3ded3c5c5cf3",
"rawTextureUuid": "a2aaf5ad-5e41-4c6b-8e88-20d13def81e2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 1,
"trimX": 2,
"trimY": 0,
"width": 61,
"height": 63,
"rawWidth": 65,
"rawHeight": 65,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/L4R4/texture/蓝色方标记.png
0 → 100644
View file @
145fbcf9
7.21 KB
assets/L4R4/texture/蓝色方标记.png.meta
0 → 100644
View file @
145fbcf9
{
"ver": "2.3.5",
"uuid": "4a17542f-6342-48aa-ac6a-6c41cca3c59a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 65,
"height": 65,
"platformSettings": {},
"subMetas": {
"蓝色方标记": {
"ver": "1.0.4",
"uuid": "5ccb965e-4c30-4b3a-914c-20367db3d00f",
"rawTextureUuid": "4a17542f-6342-48aa-ac6a-6c41cca3c59a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 1,
"trimX": 2,
"trimY": 0,
"width": 61,
"height": 63,
"rawWidth": 65,
"rawHeight": 65,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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