Commit ceee5693 authored by unknown's avatar unknown

食物派对数量限制更好

parent a1720fd6
......@@ -23,17 +23,17 @@
"_active": true,
"_components": [
{
"__id__": 94
"__id__": 113
},
{
"__id__": 96
"__id__": 115
},
{
"__id__": 98
"__id__": 117
}
],
"_prefab": {
"__id__": 100
"__id__": 119
},
"_lpos": {
"__type__": "cc.Vec3",
......@@ -94,19 +94,22 @@
},
{
"__id__": 83
},
{
"__id__": 102
}
],
"_active": true,
"_components": [
{
"__id__": 89
"__id__": 108
},
{
"__id__": 91
"__id__": 110
}
],
"_prefab": {
"__id__": 93
"__id__": 112
},
"_lpos": {
"__type__": "cc.Vec3",
......@@ -1072,7 +1075,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -120,
"x": -165,
"y": -131.996,
"z": 0
},
......@@ -1492,7 +1495,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 120,
"x": 0,
"y": -131.996,
"z": 0
},
......@@ -1885,24 +1888,209 @@
},
{
"__type__": "cc.Node",
"_name": "blockInputEventNode",
"_name": "answerBtn_2",
"_objFlags": 0,
"_parent": {
"__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": [],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 84
"__id__": 85
},
{
"__id__": 86
"__id__": 87
}
],
"_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
},
"_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": {
"__type__": "cc.Vec3",
"x": 0,
......@@ -1931,6 +2119,87 @@
},
"_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",
"_name": "",
......@@ -1940,7 +2209,161 @@
},
"_enabled": true,
"__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": {
"__type__": "cc.Size",
......@@ -1963,11 +2386,11 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 83
"__id__": 102
},
"_enabled": true,
"__prefab": {
"__id__": 87
"__id__": 106
},
"_id": ""
},
......@@ -1994,7 +2417,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 90
"__id__": 109
},
"_contentSize": {
"__type__": "cc.Size",
......@@ -2021,7 +2444,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 92
"__id__": 111
},
"_alignFlags": 2,
"_target": null,
......@@ -2066,7 +2489,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 95
"__id__": 114
},
"_contentSize": {
"__type__": "cc.Size",
......@@ -2093,7 +2516,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 97
"__id__": 116
},
"_alignFlags": 45,
"_target": null,
......@@ -2128,7 +2551,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 99
"__id__": 118
},
"titleLab": {
"__id__": 31
......@@ -2142,10 +2565,13 @@
},
{
"__id__": 79
},
{
"__id__": 98
}
],
"bIENode": {
"__id__": 83
"__id__": 102
},
"mainNode": {
"__id__": 2
......
......@@ -162,7 +162,7 @@ export class FFTPPipAnswerView extends Component {
playDisappearAct(endCb?: Function) {
this.mainNode.setPosition(0, this.orgV3.y, this.orgV3.z);
tween(this.mainNode)
.delay(2)
.delay(1)
.to(0.5, { position: v3(-3000, this.orgV3.y, this.orgV3.z) })
.call(() => {
if (typeof endCb == "function") {
......
......@@ -100,8 +100,8 @@ export class FoodForThePartyCtr extends Component {
//@ts-ignore
this.foodVarCount = resData.foodVarCount;
}
//@ts-ignore
if (resData.foodNumCount) {
//@ts-ignore
if (resData.foodNumCount) {
//@ts-ignore
this.foodNumCount = resData.foodNumCount;
}
......@@ -285,6 +285,7 @@ export class FoodForThePartyCtr extends Component {
names = this.randomCopyNameToNameArr(names);
names = this.disorderArr(names);
names = this.excludeMoreFood(names);
names = this.addLessFood(names);
console.log(`${this.pips[i].getPipName()}管道的物品`);
console.log(names);
this.pips[i].setFoodsImgNames(this.imgHead, names);
......@@ -307,8 +308,23 @@ export class FoodForThePartyCtr extends Component {
}
outCount += 1;
}
if(outCount >= 10000){
console.log(`食物数量限制可能发生死循环`);
if (outCount >= 10000) {
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment