Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
interactiveGames_Level
Project
Project
Details
Activity
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
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
xuxing@jiuaoedu.com
interactiveGames_Level
Commits
ceee5693
Commit
ceee5693
authored
Oct 09, 2021
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
食物派对数量限制更好
parent
a1720fd6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
467 additions
and
25 deletions
+467
-25
FFTPPipAnswerView.prefab
...dle/games/foodForTheParty/prefab/FFTPPipAnswerView.prefab
+448
-22
FFTPPipAnswerView.ts
...eBundle/games/foodForTheParty/script/FFTPPipAnswerView.ts
+1
-1
FoodForThePartyCtr.ts
...Bundle/games/foodForTheParty/script/FoodForThePartyCtr.ts
+18
-2
No files found.
assets/sceneBundle/games/foodForTheParty/prefab/FFTPPipAnswerView.prefab
View file @
ceee5693
...
@@ -23,17 +23,17 @@
...
@@ -23,17 +23,17 @@
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__":
94
"__id__":
113
},
},
{
{
"__id__":
96
"__id__":
115
},
},
{
{
"__id__":
98
"__id__":
117
}
}
],
],
"_prefab": {
"_prefab": {
"__id__": 1
00
"__id__": 1
19
},
},
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
...
@@ -94,19 +94,22 @@
...
@@ -94,19 +94,22 @@
},
},
{
{
"__id__": 83
"__id__": 83
},
{
"__id__": 102
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__":
89
"__id__":
108
},
},
{
{
"__id__":
91
"__id__":
110
}
}
],
],
"_prefab": {
"_prefab": {
"__id__":
93
"__id__":
112
},
},
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
...
@@ -1072,7 +1075,7 @@
...
@@ -1072,7 +1075,7 @@
},
},
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": -1
20
,
"x": -1
65
,
"y": -131.996,
"y": -131.996,
"z": 0
"z": 0
},
},
...
@@ -1492,7 +1495,7 @@
...
@@ -1492,7 +1495,7 @@
},
},
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x":
12
0,
"x": 0,
"y": -131.996,
"y": -131.996,
"z": 0
"z": 0
},
},
...
@@ -1885,24 +1888,209 @@
...
@@ -1885,24 +1888,209 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "
blockInputEventNode
",
"_name": "
answerBtn_2
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 2
"__id__": 2
},
},
"_children": [
{
"__id__": 84
},
{
"__id__": 90
}
],
"_active": true,
"_components": [
{
"__id__": 96
},
{
"__id__": 98
}
],
"_prefab": {
"__id__": 101
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 165,
"y": -131.996,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "bgSpr",
"_objFlags": 0,
"_parent": {
"__id__": 83
},
"_children": [],
"_children": [],
"_active":
fals
e,
"_active":
tru
e,
"_components": [
"_components": [
{
{
"__id__": 8
4
"__id__": 8
5
},
},
{
{
"__id__": 8
6
"__id__": 8
7
}
}
],
],
"_prefab": {
"_prefab": {
"__id__": 89
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 84
},
"_enabled": true,
"__prefab": {
"__id__": 86
},
"_contentSize": {
"__type__": "cc.Size",
"width": 140,
"height": 60
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "35uxX8aNxM1ZSmmsFI/uYF"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 84
},
"_enabled": true,
"__prefab": {
"__id__": 88
"__id__": 88
},
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 60
},
"_spriteFrame": {
"__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d8fNJvPw9FBJVjvlyHZrl8"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "77IuKp4IpC5alVgY8N6vyq"
},
{
"__type__": "cc.Node",
"_name": "answerLab",
"_objFlags": 0,
"_parent": {
"__id__": 83
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 91
},
{
"__id__": 93
}
],
"_prefab": {
"__id__": 95
},
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x": 0,
...
@@ -1931,6 +2119,87 @@
...
@@ -1931,6 +2119,87 @@
},
},
"_id": ""
"_id": ""
},
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 90
},
"_enabled": true,
"__prefab": {
"__id__": 92
},
"_contentSize": {
"__type__": "cc.Size",
"width": 16.68,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a0lO1tLolDiJRxY6GUyMW7"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 90
},
"_enabled": true,
"__prefab": {
"__id__": 94
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "3",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 30,
"_fontSize": 30,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "9fHaguFpVCm4lP2UBsK2t/"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "c4ubC7+5ZKuaeyvRjxzGjN"
},
{
{
"__type__": "cc.UITransform",
"__type__": "cc.UITransform",
"_name": "",
"_name": "",
...
@@ -1940,7 +2209,161 @@
...
@@ -1940,7 +2209,161 @@
},
},
"_enabled": true,
"_enabled": true,
"__prefab": {
"__prefab": {
"__id__": 85
"__id__": 97
},
"_contentSize": {
"__type__": "cc.Size",
"width": 140,
"height": 60
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "9c6IWS3jRIIYUin4oVpshD"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 83
},
"_enabled": true,
"__prefab": {
"__id__": 99
},
"clickEvents": [
{
"__id__": 100
}
],
"_interactable": true,
"_transition": 0,
"_normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_hoverColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_pressedColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_normalSprite": null,
"_hoverSprite": null,
"_pressedSprite": null,
"_disabledSprite": null,
"_duration": 0.1,
"_zoomScale": 1.2,
"_target": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a9vx7nZ11I44LeZp17p4sT"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "de055yfLxRGm5TMzZa2Y+zM",
"handler": "onAnswerBtn",
"customEventData": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "06r2ocrZRDvYn+NEeL5nVJ"
},
{
"__type__": "cc.Node",
"_name": "blockInputEventNode",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 103
},
{
"__id__": 105
}
],
"_prefab": {
"__id__": 107
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 102
},
"_enabled": true,
"__prefab": {
"__id__": 104
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
...
@@ -1963,11 +2386,11 @@
...
@@ -1963,11 +2386,11 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__":
83
"__id__":
102
},
},
"_enabled": true,
"_enabled": true,
"__prefab": {
"__prefab": {
"__id__":
87
"__id__":
106
},
},
"_id": ""
"_id": ""
},
},
...
@@ -1994,7 +2417,7 @@
...
@@ -1994,7 +2417,7 @@
},
},
"_enabled": true,
"_enabled": true,
"__prefab": {
"__prefab": {
"__id__":
90
"__id__":
109
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
...
@@ -2021,7 +2444,7 @@
...
@@ -2021,7 +2444,7 @@
},
},
"_enabled": true,
"_enabled": true,
"__prefab": {
"__prefab": {
"__id__":
92
"__id__":
111
},
},
"_alignFlags": 2,
"_alignFlags": 2,
"_target": null,
"_target": null,
...
@@ -2066,7 +2489,7 @@
...
@@ -2066,7 +2489,7 @@
},
},
"_enabled": true,
"_enabled": true,
"__prefab": {
"__prefab": {
"__id__":
95
"__id__":
114
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
...
@@ -2093,7 +2516,7 @@
...
@@ -2093,7 +2516,7 @@
},
},
"_enabled": true,
"_enabled": true,
"__prefab": {
"__prefab": {
"__id__":
97
"__id__":
116
},
},
"_alignFlags": 45,
"_alignFlags": 45,
"_target": null,
"_target": null,
...
@@ -2128,7 +2551,7 @@
...
@@ -2128,7 +2551,7 @@
},
},
"_enabled": true,
"_enabled": true,
"__prefab": {
"__prefab": {
"__id__":
99
"__id__":
118
},
},
"titleLab": {
"titleLab": {
"__id__": 31
"__id__": 31
...
@@ -2142,10 +2565,13 @@
...
@@ -2142,10 +2565,13 @@
},
},
{
{
"__id__": 79
"__id__": 79
},
{
"__id__": 98
}
}
],
],
"bIENode": {
"bIENode": {
"__id__":
83
"__id__":
102
},
},
"mainNode": {
"mainNode": {
"__id__": 2
"__id__": 2
...
...
assets/sceneBundle/games/foodForTheParty/script/FFTPPipAnswerView.ts
View file @
ceee5693
...
@@ -162,7 +162,7 @@ export class FFTPPipAnswerView extends Component {
...
@@ -162,7 +162,7 @@ export class FFTPPipAnswerView extends Component {
playDisappearAct
(
endCb
?:
Function
)
{
playDisappearAct
(
endCb
?:
Function
)
{
this
.
mainNode
.
setPosition
(
0
,
this
.
orgV3
.
y
,
this
.
orgV3
.
z
);
this
.
mainNode
.
setPosition
(
0
,
this
.
orgV3
.
y
,
this
.
orgV3
.
z
);
tween
(
this
.
mainNode
)
tween
(
this
.
mainNode
)
.
delay
(
2
)
.
delay
(
1
)
.
to
(
0.5
,
{
position
:
v3
(
-
3000
,
this
.
orgV3
.
y
,
this
.
orgV3
.
z
)
})
.
to
(
0.5
,
{
position
:
v3
(
-
3000
,
this
.
orgV3
.
y
,
this
.
orgV3
.
z
)
})
.
call
(()
=>
{
.
call
(()
=>
{
if
(
typeof
endCb
==
"function"
)
{
if
(
typeof
endCb
==
"function"
)
{
...
...
assets/sceneBundle/games/foodForTheParty/script/FoodForThePartyCtr.ts
View file @
ceee5693
...
@@ -285,6 +285,7 @@ export class FoodForThePartyCtr extends Component {
...
@@ -285,6 +285,7 @@ export class FoodForThePartyCtr extends Component {
names
=
this
.
randomCopyNameToNameArr
(
names
);
names
=
this
.
randomCopyNameToNameArr
(
names
);
names
=
this
.
disorderArr
(
names
);
names
=
this
.
disorderArr
(
names
);
names
=
this
.
excludeMoreFood
(
names
);
names
=
this
.
excludeMoreFood
(
names
);
names
=
this
.
addLessFood
(
names
);
console
.
log
(
`
${
this
.
pips
[
i
].
getPipName
()}
管道的物品`
);
console
.
log
(
`
${
this
.
pips
[
i
].
getPipName
()}
管道的物品`
);
console
.
log
(
names
);
console
.
log
(
names
);
this
.
pips
[
i
].
setFoodsImgNames
(
this
.
imgHead
,
names
);
this
.
pips
[
i
].
setFoodsImgNames
(
this
.
imgHead
,
names
);
...
@@ -307,8 +308,23 @@ export class FoodForThePartyCtr extends Component {
...
@@ -307,8 +308,23 @@ export class FoodForThePartyCtr extends Component {
}
}
outCount
+=
1
;
outCount
+=
1
;
}
}
if
(
outCount
>=
10000
){
if
(
outCount
>=
10000
)
{
console
.
log
(
`食物数量限制可能发生死循环`
);
console
.
log
(
`食物数量减少限制可能发生死循环`
);
}
return
names
;
}
addLessFood
(
names
:
string
[]):
string
[]
{
if
(
this
.
foodVarCount
>=
this
.
foodNumCount
)
{
throw
new
Error
(
"食物种类大于食物数量限制"
);
}
let
outCount
=
0
;
while
(
names
.
length
<
this
.
foodNumCount
&&
outCount
<
10000
)
{
names
.
push
(
names
[
Math
.
floor
(
Math
.
random
()
*
names
.
length
)]);
outCount
+=
1
;
}
if
(
outCount
>=
10000
)
{
console
.
log
(
`食物数量增加限制可能发生死循环`
);
}
}
return
names
;
return
names
;
}
}
...
...
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