Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hw_elimination_letter
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
hw_elimination_letter
Commits
fe60e12a
Commit
fe60e12a
authored
Jun 19, 2023
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
1908d8af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
45 deletions
+105
-45
hw_elimination_letter.js
assets/hw_elimination_letter/scene/hw_elimination_letter.js
+105
-45
No files found.
assets/hw_elimination_letter/scene/hw_elimination_letter.js
View file @
fe60e12a
...
...
@@ -979,6 +979,7 @@ cc.Class({
initData
()
{
console
.
log
(
'
in initData
'
);
this
.
poolData
=
{}
this
.
canTouch
=
true
;
const
rows
=
[];
...
...
@@ -1462,33 +1463,45 @@ cc.Class({
getOneLetterItem
(
isAnim
=
false
)
{
// const id = this.getRandomDataFromArray([1,2,3,4,5,6,7,8,9,10]);
const
id
=
this
.
getRandomDataFromArray
(
this
.
colorIdArr
);
const
id
=
this
.
getRandomDataFromArray
(
this
.
colorIdArr
);
const
letter
=
this
.
itemLetterObj
[
id
];
const
resName
=
'
item_
'
+
id
;
const
item
=
getSprNode
(
resName
);
this
.
itemBg
.
addChild
(
item
);
const
rtNode
=
this
.
getRichText
(
letter
,
100
,
"
#ffffff
"
,
0
,
"
#000000
"
,
false
)
rtNode
.
y
=
15
;
let
item
=
this
.
getPoolItem
(
id
);
if
(
!
item
)
{
const
resName
=
'
item_
'
+
id
;
item
=
getSprNode
(
resName
);
this
.
itemBg
.
addChild
(
item
);
const
rtNode
=
this
.
getRichText
(
letter
,
100
,
"
#ffffff
"
,
0
,
"
#000000
"
,
false
)
rtNode
.
y
=
15
;
const
rtNodeShadow
=
this
.
getRichText
(
letter
,
100
,
"
#ffffff
"
,
4
,
"
#000000
"
,
false
)
rtNodeShadow
.
y
=
rtNode
.
y
rtNodeShadow
.
opacity
=
70
;
rtNodeShadow
.
baseOpacity
=
70
;
const
rtNodeShadow
=
this
.
getRichText
(
letter
,
100
,
"
#ffffff
"
,
4
,
"
#000000
"
,
false
)
rtNodeShadow
.
y
=
rtNode
.
y
rtNodeShadow
.
opacity
=
70
;
rtNodeShadow
.
baseOpacity
=
70
;
item
.
addChild
(
rtNodeShadow
);
item
.
addChild
(
rtNode
);
item
.
addChild
(
rtNodeShadow
);
item
.
addChild
(
rtNode
);
item
.
rtNode
=
rtNode
;
item
.
rtNodeShadow
=
rtNodeShadow
;
item
.
rtNode
=
rtNode
;
item
.
rtNodeShadow
=
rtNodeShadow
;
item
.
colorId
=
id
;
item
.
on
(
'
touchstart
'
,
()
=>
{
this
.
itemClick
(
item
);
})
}
else
{
item
.
opacity
=
255
;
this
.
resetOneLetterItem
(
item
,
false
)
}
item
.
letter
=
letter
;
item
.
colorId
=
id
;
item
.
on
(
'
touchstart
'
,
()
=>
{
this
.
itemClick
(
item
);
})
if
(
isAnim
)
{
...
...
@@ -1527,6 +1540,11 @@ cc.Class({
if
(
!
this
.
canTouch
)
{
return
;
}
if
(
item
.
opacity
<
1
)
{
return
}
console
.
log
(
'
item.letter:
'
,
item
.
letter
);
this
.
canTouch
=
false
;
...
...
@@ -1627,36 +1645,56 @@ cc.Class({
}
},
resetOneLetterItem
(
item
)
{
// const id = this.getRandomDataFromArray([1,2,3,4,5,6,7,8,9,10]);
const
id
=
item
.
colorId
;
const
letter
=
this
.
itemLetterObj
[
id
];
// const resName = 'item_' + id;
// const item = getSprNode(resName);
// this.itemBg.addChild(item);
resetOneLetterItem
(
item
,
isAnim
=
true
)
{
// const id = this.getRandomDataFromArray([1,2,3,4,5,6,7,8,9,10]);
const
id
=
item
.
colorId
;
const
letter
=
this
.
itemLetterObj
[
id
];
this
.
delayCall
(
1
+
Math
.
random
()
*
0.5
,
()
=>
{
const
{
rtNode
,
rtNodeShadow
}
=
item
;
// const resName = 'item_' + id;
// const item = getSprNode(resName);
// this.itemBg.addChild(item);
cc
.
tween
(
rtNode
)
.
to
(
0.5
,
{
opacity
:
0
},
{
easing
:
"
cubicIn
"
})
.
call
(()
=>
{
this
.
refreshRichText
(
rtNode
,
letter
);
})
.
to
(
0.5
,
{
opacity
:
255
},
{
easing
:
"
cubicOut
"
})
.
start
();
const
{
rtNode
,
rtNodeShadow
}
=
item
;
item
.
letter
=
letter
;
cc
.
tween
(
rtNodeShadow
)
.
to
(
0.5
,
{
opacity
:
0
},
{
easing
:
"
cubicIn
"
})
.
call
(()
=>
{
this
.
refreshRichText
(
rtNodeShadow
,
letter
);
})
.
to
(
0.5
,
{
opacity
:
rtNodeShadow
.
baseOpacity
},
{
easing
:
"
cubicOut
"
})
.
start
();
})
if
(
!
isAnim
)
{
this
.
refreshRichText
(
rtNode
,
letter
);
this
.
refreshRichText
(
rtNodeShadow
,
letter
);
return
;
}
this
.
refreshRichText
(
rtNode
,
letter
);
this
.
refreshRichText
(
rtNodeShadow
,
letter
);
rtNodeShadow
.
opacity
=
0
;
cc
.
tween
(
rtNodeShadow
)
.
to
(
1
,
{
opacity
:
rtNodeShadow
.
baseOpacity
},
{
easing
:
"
cubicOut
"
})
.
start
();
// this.delayCall(1 + Math.random() * 0, () => {
// cc.tween(rtNode)
// .to(0.5, {opacity: 0}, {easing:"cubicIn"})
// .call(() => {
// this.refreshRichText(rtNode, letter);
// })
// .to(0.5, {opacity: 255}, {easing:"cubicOut"})
// .start();
// cc.tween(rtNodeShadow)
// .to(0.5, {opacity: 0}, {easing:"cubicIn"})
// .call(() => {
// this.refreshRichText(rtNodeShadow, letter);
// })
// .to(0.5, {opacity: rtNodeShadow.baseOpacity}, {easing:"cubicOut"})
// .start();
// })
item
.
letter
=
letter
;
},
...
...
@@ -1852,8 +1890,30 @@ cc.Class({
this
.
addScore
(
item
,
score
);
this
.
playSpineEffect
(
item
,
"
light
"
);
item
.
removeFromParent
();
this
.
removeOneItem
(
item
);
},
removeOneItem
(
item
)
{
item
.
opacity
=
0
;
item
.
x
=
-
this
.
canvas
.
width
;
this
.
addPoolItem
(
item
,
item
.
colorId
);
},
addPoolItem
(
item
,
id
)
{
if
(
!
this
.
poolData
[
id
])
{
this
.
poolData
[
id
]
=
[];
}
this
.
poolData
[
id
].
push
(
item
);
},
getPoolItem
(
id
)
{
if
(
this
.
poolData
[
id
]
&&
this
.
poolData
[
id
].
length
>
0
)
{
return
this
.
poolData
[
id
].
pop
();
}
},
addScore
(
item
,
score
)
{
...
...
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