Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Cocos-1010
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
等吃饭
Cocos-1010
Commits
66c90dc3
Commit
66c90dc3
authored
May 31, 2023
by
Friends233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix兼容问题
parent
b1a07f53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
7 deletions
+35
-7
blockManager.ts
assets/Script/blockManager.ts
+35
-7
No files found.
assets/Script/blockManager.ts
View file @
66c90dc3
...
...
@@ -127,7 +127,6 @@ export default class BlockManager extends cc.Component {
this
.
clearAllChildren
()
this
.
checkBlockMatrix
()
cc
.
find
(
'Canvas'
).
dispatchEvent
(
this
.
setBlockEvent
)
// this.refreshMiniBlock()
return
}
...
...
@@ -310,15 +309,20 @@ export default class BlockManager extends cc.Component {
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
)
{
if
(
GameScene
.
isGuide
&&
!
isRepeat
&&
isEmpty
)
{
const
{
targetNode
}
=
filterBlock
?.[
0
]
if
(
allTargetNodeId
[
0
]
!==
90
)
{
return
false
}
}
return
!
isRepeat
&&
isEmpty
}
nodeReset
(){
this
.
node
.
setPosition
(
this
.
defaultPos
)
this
.
node
.
scale
=
1
}
addNodeEvent
()
{
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
()
=>
{
if
(
this
.
isDisabled
==
1
)
return
...
...
@@ -327,15 +331,39 @@ export default class BlockManager extends cc.Component {
},
this
)
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
this
.
setBlockMatrixAll
()
if
(
this
.
isMove
){
this
.
setBlockMatrixAll
()
}
},
this
)
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
(
e
:
cc
.
Event
.
EventTouch
)
=>
{
cc
.
find
(
'Canvas'
).
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,()
=>
{
if
(
this
.
isMove
){
this
.
setBlockMatrixAll
()
}
})
cc
.
find
(
'Canvas'
).
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,()
=>
{
if
(
this
.
isMove
){
this
.
setBlockMatrixAll
()
}
})
cc
.
find
(
'Canvas'
).
on
(
cc
.
Node
.
EventType
.
MOUSE_LEAVE
,()
=>
{
if
(
this
.
isMove
){
this
.
setBlockMatrixAll
()
}
})
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
(
e
:
cc
.
Event
.
EventTouch
)
=>
{
if
(
this
.
isMove
)
{
const
pos
:
cc
.
Vec2
=
e
.
getPreviousLocation
()
const
viewW
=
this
.
viewWidth
,
viewH
=
this
.
viewHeight
this
.
node
.
setPosition
(
pos
.
x
-
(
viewW
/
2
),
pos
.
y
-
(
812
-
(
1624
-
viewH
)
/
2
)
+
Config
.
blockManagerDragOffsetY
)
if
(
pos
.
x
<
0
||
pos
.
x
>
viewW
||
pos
.
y
>
(
viewH
-
200
)
||
pos
.
y
<
0
)
{
this
.
isMove
=
false
this
.
nodeReset
()
return
}
this
.
node
.
setPosition
(
pos
.
x
-
(
viewW
/
2
),
pos
.
y
-
(
812
-
(
1624
-
viewH
)
/
2
)
+
Config
.
blockManagerDragOffsetY
)
}
},
this
)
}
...
...
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