Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
boardgame_yyh
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
boardgame_yyh
Commits
fd9d8cc4
Commit
fd9d8cc4
authored
Jul 29, 2022
by
杨一航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
340d6997
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
29 deletions
+25
-29
boardCardItem.ts
assets/boardgame_yyh/scene/boardCardItem.ts
+2
-2
boardgame_yyh.fire
assets/boardgame_yyh/scene/boardgame_yyh.fire
+5
-5
boardgame_yyh.ts
assets/boardgame_yyh/scene/boardgame_yyh.ts
+13
-10
Server.ts
assets/boardgame_yyh/script/Server.ts
+5
-12
No files found.
assets/boardgame_yyh/scene/boardCardItem.ts
View file @
fd9d8cc4
...
@@ -16,7 +16,7 @@ export default class BoardCardItem extends cc.Component {
...
@@ -16,7 +16,7 @@ export default class BoardCardItem extends cc.Component {
_word
:
string
;
_word
:
string
;
letter
:
string
=
''
;
letter
:
string
=
''
;
set
cardData
(
data
:
{
id
:
number
,
rJumpId
:
number
,
wJumpId
?:
number
,
url
:
string
,
word
:
"
string
"
})
{
set
cardData
(
data
:
{
id
:
number
,
rJumpId
:
number
,
wJumpId
?:
number
,
url
:
string
,
word
:
string
})
{
this
.
_cardId
=
data
.
id
;
this
.
_cardId
=
data
.
id
;
this
.
_rjumpId
=
data
.
rJumpId
;
this
.
_rjumpId
=
data
.
rJumpId
;
...
@@ -32,6 +32,6 @@ export default class BoardCardItem extends cc.Component {
...
@@ -32,6 +32,6 @@ export default class BoardCardItem extends cc.Component {
return
this
.
_rjumpId
;
return
this
.
_rjumpId
;
}
}
get
wjumpId
()
{
get
wjumpId
()
{
return
this
.
_
r
jumpId
;
return
this
.
_
w
jumpId
;
}
}
}
}
assets/boardgame_yyh/scene/boardgame_yyh.fire
View file @
fd9d8cc4
...
@@ -579,8 +579,8 @@
...
@@ -579,8 +579,8 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
421.974
,
-512.696
,
-2
84.56
,
-2
94.691
,
0,
0,
0,
0,
0,
0,
...
@@ -1265,8 +1265,8 @@
...
@@ -1265,8 +1265,8 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
-508.895
,
423.242
,
-2
96.542
,
-2
86.41
,
0,
0,
0,
0,
0,
0,
...
@@ -6010,7 +6010,7 @@
...
@@ -6010,7 +6010,7 @@
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
1035.5,
1035.5,
258.128
,
180
,
0,
0,
0,
0,
0,
0,
...
...
assets/boardgame_yyh/scene/boardgame_yyh.ts
View file @
fd9d8cc4
...
@@ -151,7 +151,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -151,7 +151,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
id
:
6
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
can
"
,
url
:
""
,
id
:
6
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
can
"
,
url
:
""
,
},
},
{
{
id
:
7
,
rJumpId
:
12
,
wJumpId
:
null
,
word
:
"
cam
"
,
url
:
""
,
id
:
7
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
cam
"
,
url
:
""
,
},
},
{
{
id
:
8
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
mat
"
,
url
:
""
,
id
:
8
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
mat
"
,
url
:
""
,
...
@@ -163,10 +163,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -163,10 +163,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
id
:
10
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
fan
"
,
url
:
""
,
id
:
10
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
fan
"
,
url
:
""
,
},
},
{
{
id
:
11
,
rJumpId
:
20
,
wJumpId
:
null
,
word
:
"
tap
"
,
url
:
""
,
id
:
11
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
tap
"
,
url
:
""
,
},
},
{
{
id
:
12
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
cap
"
,
url
:
""
,
id
:
12
,
rJumpId
:
null
,
wJumpId
:
7
,
word
:
"
cap
"
,
url
:
""
,
},
},
{
{
id
:
13
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
bag
"
,
url
:
""
,
id
:
13
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
bag
"
,
url
:
""
,
...
@@ -187,10 +187,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -187,10 +187,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
id
:
18
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
pan
"
,
url
:
""
,
id
:
18
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
pan
"
,
url
:
""
,
},
},
{
{
id
:
19
,
rJumpId
:
23
,
wJumpId
:
null
,
word
:
"
dad
"
,
url
:
""
,
id
:
19
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
dad
"
,
url
:
""
,
},
},
{
{
id
:
20
,
rJumpId
:
22
,
wJumpId
:
null
,
word
:
"
jam
"
,
url
:
""
,
id
:
20
,
rJumpId
:
22
,
wJumpId
:
11
,
word
:
"
jam
"
,
url
:
""
,
},
},
{
{
id
:
21
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
ax
"
,
url
:
""
,
id
:
21
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
ax
"
,
url
:
""
,
...
@@ -199,12 +199,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -199,12 +199,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
id
:
22
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
hat
"
,
url
:
""
,
id
:
22
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
hat
"
,
url
:
""
,
},
},
{
{
id
:
23
,
rJumpId
:
null
,
wJumpId
:
null
,
word
:
"
map
"
,
url
:
""
,
id
:
23
,
rJumpId
:
null
,
wJumpId
:
19
,
word
:
"
map
"
,
url
:
""
,
},
},
]
]
this
.
_cardList
=
cc
.
find
(
"
Canvas/road/root/wordCards
"
).
children
;
this
.
_cardList
=
cc
.
find
(
"
Canvas/road/root/wordCards
"
).
children
;
let
list
=
this
.
data
.
cardDatas
||
cardDatas
;
let
list
=
cardDatas
;
for
(
let
i
=
0
;
i
<
this
.
_cardList
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
this
.
_cardList
.
length
;
++
i
)
{
let
data
=
list
[
i
];
let
data
=
list
[
i
];
let
com
=
this
.
_cardList
[
i
].
addComponent
(
BoardCardItem
);
let
com
=
this
.
_cardList
[
i
].
addComponent
(
BoardCardItem
);
...
@@ -222,12 +222,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -222,12 +222,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
jumpList
=
[];
const
jumpList
=
[];
this
.
_cardList
.
forEach
(
node
=>
{
this
.
_cardList
.
forEach
(
node
=>
{
const
itemData
=
node
.
getComponent
(
BoardCardItem
);
const
itemData
=
node
.
getComponent
(
BoardCardItem
);
if
(
itemData
.
rjumpId
)
{
if
(
itemData
.
rjumpId
||
itemData
.
wjumpId
)
{
const
from
=
itemData
.
Id
;
const
from
=
itemData
.
Id
;
const
to
=
itemData
.
rjumpId
;
const
rto
=
itemData
.
rjumpId
;
jumpList
.
push
({
from
,
to
});
const
wto
=
itemData
.
wjumpId
;
jumpList
.
push
({
from
,
rto
,
wto
});
}
}
});
});
this
.
log
(
jumpList
);
return
jumpList
;
return
jumpList
;
}
}
...
...
assets/boardgame_yyh/script/Server.ts
View file @
fd9d8cc4
...
@@ -30,14 +30,7 @@ export class GameServer {
...
@@ -30,14 +30,7 @@ export class GameServer {
];
];
jumpList
=
[
jumpList
=
[
// { from: 2, to: 11 },
// { from: 2, rto: 11 ,wto:1},
// { from: 3, to: 7 },
// { from: 8, to: 18 },
// { from: 9, to: 2 },
// { from: 12, to: 15 },
// { from: 13, to: 1 },
// { from: 21, to: 5 },
// { from: 24, to: 16 },
];
];
private
_totalStep
:
any
;
private
_totalStep
:
any
;
...
@@ -162,8 +155,8 @@ export class GameServer {
...
@@ -162,8 +155,8 @@ export class GameServer {
// } else {
// } else {
// step = 1;
// step = 1;
// }
// }
step
=
Math
.
min
(
step
,
this
.
_totalStep
-
1
-
nowStep
);
step
=
Math
.
min
(
step
,
this
.
_totalStep
-
1
-
nowStep
);
console
.
log
(
"
random step ===
"
+
step
);
console
.
log
(
"
random step ===
"
+
step
);
this
.
gameStatus
.
step
=
step
;
this
.
gameStatus
.
step
=
step
;
this
.
gameStatus
.
state
=
1
;
this
.
gameStatus
.
state
=
1
;
...
@@ -180,7 +173,7 @@ export class GameServer {
...
@@ -180,7 +173,7 @@ export class GameServer {
let
nowStep
:
number
=
this
.
gameStatus
[
this
.
gameStatus
.
current
];
let
nowStep
:
number
=
this
.
gameStatus
[
this
.
gameStatus
.
current
];
console
.
log
(
"
nowStep ===
"
+
nowStep
);
console
.
log
(
"
nowStep ===
"
+
nowStep
);
const
jump
=
this
.
jumpList
.
find
(
jump
=>
parseInt
(
jump
.
from
)
==
nowStep
+
this
.
gameStatus
.
step
);
const
jump
=
this
.
jumpList
.
find
(
jump
=>
parseInt
(
jump
.
from
)
==
nowStep
+
this
.
gameStatus
.
step
);
this
.
gameStatus
[
this
.
gameStatus
.
current
]
=
jump
?
parseInt
(
jump
.
to
)
:
nowStep
+
this
.
gameStatus
.
step
;
this
.
gameStatus
[
this
.
gameStatus
.
current
]
=
jump
?
parseInt
(
jump
.
r
to
)
:
nowStep
+
this
.
gameStatus
.
step
;
if
(
jump
)
{
if
(
jump
)
{
console
.
log
(
"
jump=============
"
+
jump
);
console
.
log
(
"
jump=============
"
+
jump
);
...
@@ -209,8 +202,8 @@ export class GameServer {
...
@@ -209,8 +202,8 @@ export class GameServer {
console
.
log
(
"
data =
"
+
JSON
.
stringify
(
data
));
console
.
log
(
"
data =
"
+
JSON
.
stringify
(
data
));
let
nowStep
:
number
=
this
.
gameStatus
[
this
.
gameStatus
.
current
];
let
nowStep
:
number
=
this
.
gameStatus
[
this
.
gameStatus
.
current
];
console
.
log
(
"
nowStep ===
"
+
nowStep
);
console
.
log
(
"
nowStep ===
"
+
nowStep
);
const
jump
=
this
.
jumpList
.
find
(
jump
=>
parseInt
(
jump
.
to
)
==
nowStep
+
this
.
gameStatus
.
step
);
const
jump
=
this
.
jumpList
.
find
(
jump
=>
parseInt
(
jump
.
from
)
==
nowStep
+
this
.
gameStatus
.
step
);
this
.
gameStatus
[
this
.
gameStatus
.
current
]
=
jump
?
parseInt
(
jump
.
from
)
:
nowStep
;
this
.
gameStatus
[
this
.
gameStatus
.
current
]
=
jump
?
parseInt
(
jump
.
wto
)
:
nowStep
;
this
.
gameStatus
.
step
=
null
;
this
.
gameStatus
.
step
=
null
;
this
.
gameStatus
.
state
=
2
;
this
.
gameStatus
.
state
=
2
;
...
...
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