Commit 758ca3fe authored by Friends233's avatar Friends233

新手引导

parent 0e112860
......@@ -112,18 +112,21 @@
},
{
"__id__": 47
},
{
"__id__": 52
}
],
"_active": true,
"_components": [
{
"__id__": 84
"__id__": 89
},
{
"__id__": 85
"__id__": 90
},
{
"__id__": 86
"__id__": 91
}
],
"_prefab": null,
......@@ -2046,7 +2049,7 @@
},
{
"__type__": "cc.Node",
"_name": "test",
"_name": "guideWrp",
"_objFlags": 0,
"_parent": {
"__id__": 2
......@@ -2056,22 +2059,275 @@
"__id__": 48
},
{
"__id__": 55
"__id__": 50
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "32F1hvCIBDHpzYvLpPRNvp"
},
{
"__type__": "cc.Node",
"_name": "guide1",
"_objFlags": 0,
"_parent": {
"__id__": 47
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 49
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 399,
"height": 174
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "19lMpx3qlN74dWJIyC++Pj"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "da3817c5-ef81-408b-8944-f7d3330d9c80"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "b8OuVjk5BL+6B1hSvou+f8"
},
{
"__type__": "cc.Node",
"_name": "guide2",
"_objFlags": 0,
"_parent": {
"__id__": 47
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 51
}
],
"_prefab": null,
"_opacity": 0,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 399,
"height": 152
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "54pLASnKZDD7ZQ5V9AMwUL"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 50
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "3cab4ab5-2140-4590-aa64-c00f7914e3ff"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "2cgjRaGptDQ5ToijOdMtIQ"
},
{
"__type__": "cc.Node",
"_name": "test",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 53
},
{
"__id__": 62
"__id__": 60
},
{
"__id__": 69
"__id__": 67
},
{
"__id__": 76
"__id__": 74
},
{
"__id__": 81
}
],
"_active": true,
"_components": [
{
"__id__": 83
"__id__": 88
}
],
"_prefab": null,
......@@ -2127,17 +2383,17 @@
"_name": "refreshProp",
"_objFlags": 0,
"_parent": {
"__id__": 47
"__id__": 52
},
"_children": [
{
"__id__": 49
"__id__": 54
}
],
"_active": true,
"_components": [
{
"__id__": 54
"__id__": 59
}
],
"_prefab": null,
......@@ -2193,20 +2449,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 48
"__id__": 53
},
"_children": [
{
"__id__": 50
"__id__": 55
}
],
"_active": true,
"_components": [
{
"__id__": 52
"__id__": 57
},
{
"__id__": 53
"__id__": 58
}
],
"_prefab": null,
......@@ -2262,13 +2518,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 49
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 51
"__id__": 56
}
],
"_prefab": null,
......@@ -2324,7 +2580,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 50
"__id__": 55
},
"_enabled": true,
"_materials": [
......@@ -2357,7 +2613,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 49
"__id__": 54
},
"_enabled": true,
"_materials": [
......@@ -2389,7 +2645,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 49
"__id__": 54
},
"_enabled": true,
"alignMode": 0,
......@@ -2416,7 +2672,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
"__id__": 53
},
"_enabled": true,
"_normalMaterial": null,
......@@ -2489,7 +2745,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 49
"__id__": 54
},
"_id": "06Xai9BG1CKLT3kEY+FESD"
},
......@@ -2498,17 +2754,17 @@
"_name": "init",
"_objFlags": 0,
"_parent": {
"__id__": 47
"__id__": 52
},
"_children": [
{
"__id__": 56
"__id__": 61
}
],
"_active": true,
"_components": [
{
"__id__": 61
"__id__": 66
}
],
"_prefab": null,
......@@ -2564,20 +2820,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 55
"__id__": 60
},
"_children": [
{
"__id__": 57
"__id__": 62
}
],
"_active": true,
"_components": [
{
"__id__": 59
"__id__": 64
},
{
"__id__": 60
"__id__": 65
}
],
"_prefab": null,
......@@ -2633,13 +2889,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 56
"__id__": 61
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 58
"__id__": 63
}
],
"_prefab": null,
......@@ -2695,7 +2951,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 57
"__id__": 62
},
"_enabled": true,
"_materials": [
......@@ -2728,7 +2984,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 56
"__id__": 61
},
"_enabled": true,
"_materials": [
......@@ -2760,7 +3016,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 56
"__id__": 61
},
"_enabled": true,
"alignMode": 0,
......@@ -2787,7 +3043,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 55
"__id__": 60
},
"_enabled": true,
"_normalMaterial": null,
......@@ -2860,7 +3116,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 56
"__id__": 61
},
"_id": "57bHTVH8ZOjZpjTzCUb0mD"
},
......@@ -2869,17 +3125,17 @@
"_name": "start",
"_objFlags": 0,
"_parent": {
"__id__": 47
"__id__": 52
},
"_children": [
{
"__id__": 63
"__id__": 68
}
],
"_active": true,
"_components": [
{
"__id__": 68
"__id__": 73
}
],
"_prefab": null,
......@@ -2935,20 +3191,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 62
"__id__": 67
},
"_children": [
{
"__id__": 64
"__id__": 69
}
],
"_active": true,
"_components": [
{
"__id__": 66
"__id__": 71
},
{
"__id__": 67
"__id__": 72
}
],
"_prefab": null,
......@@ -3004,13 +3260,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 63
"__id__": 68
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 65
"__id__": 70
}
],
"_prefab": null,
......@@ -3066,7 +3322,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 64
"__id__": 69
},
"_enabled": true,
"_materials": [
......@@ -3076,8 +3332,8 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "开始游戏",
"_N$string": "开始游戏",
"_string": "开始引导",
"_N$string": "开始引导",
"_fontSize": 20,
"_lineHeight": 40,
"_enableWrapText": false,
......@@ -3099,7 +3355,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 63
"__id__": 68
},
"_enabled": true,
"_materials": [
......@@ -3131,7 +3387,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 63
"__id__": 68
},
"_enabled": true,
"alignMode": 0,
......@@ -3158,7 +3414,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 62
"__id__": 67
},
"_enabled": true,
"_normalMaterial": null,
......@@ -3231,7 +3487,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 63
"__id__": 68
},
"_id": "6cOXQVh5BCV4WKrcZc4zUt"
},
......@@ -3240,17 +3496,17 @@
"_name": "clear",
"_objFlags": 0,
"_parent": {
"__id__": 47
"__id__": 52
},
"_children": [
{
"__id__": 70
"__id__": 75
}
],
"_active": true,
"_components": [
{
"__id__": 75
"__id__": 80
}
],
"_prefab": null,
......@@ -3306,20 +3562,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 69
"__id__": 74
},
"_children": [
{
"__id__": 71
"__id__": 76
}
],
"_active": true,
"_components": [
{
"__id__": 73
"__id__": 78
},
{
"__id__": 74
"__id__": 79
}
],
"_prefab": null,
......@@ -3375,13 +3631,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 70
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 72
"__id__": 77
}
],
"_prefab": null,
......@@ -3437,7 +3693,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 71
"__id__": 76
},
"_enabled": true,
"_materials": [
......@@ -3470,7 +3726,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 70
"__id__": 75
},
"_enabled": true,
"_materials": [
......@@ -3502,7 +3758,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 70
"__id__": 75
},
"_enabled": true,
"alignMode": 0,
......@@ -3529,7 +3785,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 69
"__id__": 74
},
"_enabled": true,
"_normalMaterial": null,
......@@ -3602,7 +3858,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 70
"__id__": 75
},
"_id": "5f4nSZrxRDD7xBbtkqLlxC"
},
......@@ -3611,17 +3867,17 @@
"_name": "radom",
"_objFlags": 0,
"_parent": {
"__id__": 47
"__id__": 52
},
"_children": [
{
"__id__": 77
"__id__": 82
}
],
"_active": true,
"_components": [
{
"__id__": 82
"__id__": 87
}
],
"_prefab": null,
......@@ -3677,20 +3933,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 76
"__id__": 81
},
"_children": [
{
"__id__": 78
"__id__": 83
}
],
"_active": true,
"_components": [
{
"__id__": 80
"__id__": 85
},
{
"__id__": 81
"__id__": 86
}
],
"_prefab": null,
......@@ -3746,13 +4002,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 77
"__id__": 82
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 79
"__id__": 84
}
],
"_prefab": null,
......@@ -3808,7 +4064,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 78
"__id__": 83
},
"_enabled": true,
"_materials": [
......@@ -3841,7 +4097,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 77
"__id__": 82
},
"_enabled": true,
"_materials": [
......@@ -3873,7 +4129,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 77
"__id__": 82
},
"_enabled": true,
"alignMode": 0,
......@@ -3900,7 +4156,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 76
"__id__": 81
},
"_enabled": true,
"_normalMaterial": null,
......@@ -3973,7 +4229,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 77
"__id__": 82
},
"_id": "b7pxluBStIWKL2+u9pi2P+"
},
......@@ -3982,7 +4238,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 47
"__id__": 52
},
"_enabled": true,
"_layoutSize": {
......
......@@ -12,11 +12,14 @@ export const CUSTOM_EVENT = {
/** 销毁游戏场景 */
GAME_DESTROY: 'GAME_DESTROY',
/** 加分 */
ADD_SCORE:'ADD_SCORE',
ADD_SCORE: 'ADD_SCORE',
/** 放置方块 */
SET_BLOCK:'SET_BLOCK',
SET_BLOCK: 'SET_BLOCK',
/** 检查方块能否放入 */
CHECK_IS_SET:'CHECK_IS_SET',
CHECK_IS_SET: 'CHECK_IS_SET',
/** 开始新手引导 */
START_GUIDE: 'START_GUIDE',
}
export const Config = {
......@@ -27,7 +30,7 @@ export const Config = {
/** 填入方块颜色,小方块颜色 */
miniBlockColor: '#58D9B3',
/** 小方块被禁用的颜色 */
miniBlockDisabledColor:'#A0CDC0',
miniBlockDisabledColor: '#A0CDC0',
/** 默认方块颜色,空白方块颜色 */
defaultColor: '#8FBABA',
/** 每一个方块动画播放延时 ms*/
......@@ -37,9 +40,9 @@ export const Config = {
/** 下方小方块间隔 */
miniBlockOffset: 2,
/** 小方块大小 */
miniBlockW:33.5,
miniBlockW: 33.5,
/** 小方块生成矩阵 5*5 */
miniBlockMatrix:[
miniBlockMatrix: [
[
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
......@@ -230,7 +233,16 @@ export const Config = {
[0, 0, 1, 0, 0],
]
],
/** 新手引导的方块矩阵 */
guideBlockMatrix: [
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[1, 1, 1, 1, 1],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
]
}
/** 方块状态 */
......
......@@ -24,6 +24,12 @@ export default class GameScene extends cc.Component {
/** 已放置方块集数量 */
setBlockNum = 0
/** 是否为新手引导 */
isGuide = false
/** 所有能拖动的块管理器 */
allBlcokManagerNode: cc.Node[] = []
protected onLoad(): void {
/** 开启碰撞检测 */
......@@ -35,10 +41,14 @@ export default class GameScene extends cc.Component {
start() {
this.blockMatrix = cc.find('blockMatrix', this.node)
const { maxRow, maxCol } = this.gameConfig
this.allBlcokManagerNode = ['miniBlockWrpLeft', 'miniBlockWrpMid', 'miniBlockWrpRight'].map((key) => {
return cc.find(key, this.node)
})
const testBlock = []
// for (let i = 0; i < maxCol - 2; i++) {
// testBlock.push(...Array(6).fill('').map((_, j) => j + 1 + (i + 1) * maxRow))
// }
cc.find('guideWrp', this.node).active = false
this.setDefaultBlock(testBlock)
this.addNodeEvent()
}
......@@ -62,6 +72,16 @@ export default class GameScene extends cc.Component {
}
}
/** 开始新手引导 */
startGuide() {
this.isGuide = true
cc.find('guideWrp', this.node).active = true
const blocks = [0, 10, 20, 30, 40, 50, 60, 70, 80, 95, 96, 97, 98, 99]
this.setDefaultBlock(blocks)
const blockManager = this.allBlcokManagerNode[0].getComponent('blockManager')
blockManager.refreshMiniBlock(false, Config.guideBlockMatrix)
}
/** 添加节点的事件 */
addNodeEvent() {
// cc.game.on(cc.game.EVENT_HIDE, () => {
......@@ -76,7 +96,7 @@ export default class GameScene extends cc.Component {
this.node.on(CUSTOM_EVENT.SET_BLOCK, this.setBlockEventCb, this)
this.node.on(CUSTOM_EVENT.CHECK_IS_SET, this.checkIsSetBlock, this)
exportEvent.on(CUSTOM_EVENT.NEXT_LEVEL, this.nextLevel, this)
exportEvent.on(CUSTOM_EVENT.GAME_START, this.startGame, this)
exportEvent.on(CUSTOM_EVENT.START_GUIDE, this.startGuide, this)
exportEvent.on(CUSTOM_EVENT.GAME_INIT, ({ detail = {} }) => {
this.resetConfig(detail)
}, this)
......@@ -91,7 +111,7 @@ export default class GameScene extends cc.Component {
if (isTest && (href?.includes('duibadev') || href?.includes('duibatest')) || href.includes('localhost')) {
const testEventMap = {
refreshProp: 'refreshStageProps',
start: 'testStartGame',
start: 'startGuide',
init: 'testInit',
clear: 'setDefaultBlock',
radom: 'testRadom'
......@@ -104,7 +124,7 @@ export default class GameScene extends cc.Component {
}
testRadom() {
const {maxCol,maxRow} = this.gameConfig
const { maxCol, maxRow } = this.gameConfig
const testBlock = []
for (let i = 0; i < maxCol - 2; i++) {
testBlock.push(...Array(6).fill('').map((_, j) => j + 1 + (i + 1) * maxRow))
......@@ -134,6 +154,7 @@ export default class GameScene extends cc.Component {
* @param config config
*/
startGame({ detail = {} }) {
this.startGuide()
}
/**
......@@ -159,7 +180,7 @@ export default class GameScene extends cc.Component {
this.isGameOver = true
console.log('gameOver')
exportEvent.fire(CUSTOM_EVENT.GAME_OVER, {
score:this.score
score: this.score
})
}
......@@ -183,25 +204,30 @@ export default class GameScene extends cc.Component {
this.refreshStageProps()
}
this.isCheckGameOver()
if (this.isGuide) {
this.setBlockNum--
this.isGuide = false
cc.find('guideWrp/guide1',this.node).active = false
const blockManager = this.allBlcokManagerNode[0].getComponent('blockManager')
blockManager.refreshMiniBlock(true)
}
}
/** 检查游戏是否结束 */
isCheckGameOver(){
const allBlcokManagerKey = ['miniBlockWrpLeft', 'miniBlockWrpMid', 'miniBlockWrpRight']
const blockStates = allBlcokManagerKey.filter((key) => {
const blockManager = cc.find(key, this.node).getComponent('blockManager')
isCheckGameOver() {
const blockStates = this.allBlcokManagerNode.filter((node) => {
const blockManager = node.getComponent('blockManager')
return !(blockManager.isDisabled || blockManager.miniBlockKey.length === 0)
})
if(blockStates.length === 0){
if (blockStates.length === 0) {
this.gameOver()
}
}
/** 检查矩阵能否放入 */
checkIsSetBlock() {
const allBlcokManagerKey = ['miniBlockWrpLeft', 'miniBlockWrpMid', 'miniBlockWrpRight']
allBlcokManagerKey.forEach((key) => {
const blockManager = cc.find(key, this.node).getComponent('blockManager')
const blockStates = this.allBlcokManagerNode.filter((node) => {
const blockManager = node.getComponent('blockManager')
blockManager.checkIsSetBlock()
})
}
......@@ -209,9 +235,8 @@ export default class GameScene extends cc.Component {
/** 刷新舞台道具 */
refreshStageProps() {
this.setBlockNum = 0
const allBlcokManagerKey = ['miniBlockWrpLeft', 'miniBlockWrpMid', 'miniBlockWrpRight']
allBlcokManagerKey.forEach((key) => {
const blockManager = cc.find(key, this.node).getComponent('blockManager')
const blockStates = this.allBlcokManagerNode.filter((node) => {
const blockManager = node.getComponent('blockManager')
blockManager.refreshMiniBlock(true)
})
}
......
......@@ -62,9 +62,15 @@ export default class BlockManager extends cc.Component {
/**
* 刷新小方块的生成
* @param isPlayAni 是否需要播放刷新动画
* @param blocks 预设
*/
refreshMiniBlock(isPlayAni) {
const miniBlockMatrix = getRandomArrayElements(Config.miniBlockMatrix, 1)[0]
refreshMiniBlock(isPlayAni, blocks) {
let miniBlockMatrix = []
if (blocks) {
miniBlockMatrix = [...blocks]
} else {
miniBlockMatrix = getRandomArrayElements(Config.miniBlockMatrix, 1)[0]
}
this.miniBlockKey = JSON.parse(JSON.stringify(miniBlockMatrix))
this.node.removeAllChildren()
const { miniBlockOffset, miniBlockW } = Config
......@@ -301,6 +307,14 @@ export default class BlockManager extends cc.Component {
const allTargetNodeId = filterBlock.map(({ targetNode }) => targetNode.getSiblingIndex())
// 索引是否重复
const isRepeat = allTargetNodeId.find((_, i) => allTargetNodeId.includes(_, i + 1))
const GameScene = cc.find('Canvas').getComponent('GameScene')
// 新手引导情况下,只能放入对应位置
if(GameScene.isGuide && !isRepeat && isEmpty){
const {targetNode} = filterBlock?.[0]
if(allTargetNodeId[0] !== 90){
return false
}
}
return !isRepeat && isEmpty
}
......
{
"ver": "2.3.7",
"uuid": "133d01d5-943f-47a8-bfe5-8bebd66fc6d3",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 399,
"height": 174,
"platformSettings": {},
"subMetas": {
"guide1": {
"ver": "1.0.6",
"uuid": "da3817c5-ef81-408b-8944-f7d3330d9c80",
"importer": "sprite-frame",
"rawTextureUuid": "133d01d5-943f-47a8-bfe5-8bebd66fc6d3",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 399,
"height": 174,
"rawWidth": 399,
"rawHeight": 174,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.7",
"uuid": "6d7944b8-3afe-4ceb-847b-9d934242a99f",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 399,
"height": 152,
"platformSettings": {},
"subMetas": {
"guide2": {
"ver": "1.0.6",
"uuid": "3cab4ab5-2140-4590-aa64-c00f7914e3ff",
"importer": "sprite-frame",
"rawTextureUuid": "6d7944b8-3afe-4ceb-847b-9d934242a99f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 399,
"height": 152,
"rawWidth": 399,
"rawHeight": 152,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.0.3",
"uuid": "680385c3-63e4-49be-9715-8885780175f7",
"importer": "asset",
"subMetas": {}
}
\ No newline at end of file
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