Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hy04_pinci
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
hy04_pinci
Commits
bb69f138
Commit
bb69f138
authored
Jul 14, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加缩放
parent
f7592cc1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
22 deletions
+24
-22
hy04_pinci.ts
assets/hy04_pinci/scene/hy04_pinci.ts
+22
-20
defaultData_hy04_pinci.ts
assets/hy04_pinci/script/defaultData_hy04_pinci.ts
+2
-2
No files found.
assets/hy04_pinci/scene/hy04_pinci.ts
View file @
bb69f138
...
@@ -239,13 +239,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -239,13 +239,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
count
=
-
1
;
let
count
=
-
1
;
// 长度大于一需要做拆分
// 长度大于一需要做拆分
let
scale
=
1
;
let
scale
=
1
;
// let allWord = "";
// ansArr.forEach(ar => {
// allWord += ar.text
// })
// if (allWord.length > 1) {
// scale = 1 - (allWord.length - 1) * 0.1;
// }
ansArr
.
forEach
((
ansObj
,
i
)
=>
{
ansArr
.
forEach
((
ansObj
,
i
)
=>
{
let
ans
=
ansObj
.
text
;
let
ans
=
ansObj
.
text
;
let
group
=
ansObj
.
group
;
let
group
=
ansObj
.
group
;
...
@@ -265,6 +258,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -265,6 +258,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
})
});
});
}
}
getScale
()
{
let
ansArr
=
this
.
CurrentWord
.
answerRand
;
let
scale
=
1
;
let
allWord
=
""
;
ansArr
.
forEach
(
ar
=>
{
allWord
+=
ar
.
text
})
if
(
allWord
.
length
>
8
)
{
scale
=
1
-
(
allWord
.
length
-
8
)
*
0.1
;
}
return
scale
;
}
initWord
()
{
initWord
()
{
let
ansArr
=
this
.
CurrentWord
.
answerRand
;
let
ansArr
=
this
.
CurrentWord
.
answerRand
;
ansArr
=
ansArr
.
filter
(
ans
=>
!!
ans
.
text
.
trim
());
ansArr
=
ansArr
.
filter
(
ans
=>
!!
ans
.
text
.
trim
());
...
@@ -272,14 +277,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -272,14 +277,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
count
=
-
1
;
let
count
=
-
1
;
// 长度大于一需要做拆分
// 长度大于一需要做拆分
let
scale
=
1
;
this
.
word_area
.
scale
=
this
.
getScale
();
// let allWord = "";
// ansArr.forEach(ar => {
// allWord += ar.text
// })
// if (allWord.length > 5) {
// scale = 1 - (allWord.length - 5) * 0.1;
// }
ansArr
.
forEach
((
ansObj
)
=>
{
ansArr
.
forEach
((
ansObj
)
=>
{
let
ans
=
ansObj
.
text
;
let
ans
=
ansObj
.
text
;
...
@@ -302,7 +300,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -302,7 +300,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
arr
=
[];
let
arr
=
[];
ansStrArr
.
forEach
((
str
,
m
)
=>
{
ansStrArr
.
forEach
((
str
,
m
)
=>
{
count
++
;
count
++
;
let
child
=
this
.
getWordNodeByStr
(
str
,
scale
);
let
child
=
this
.
getWordNodeByStr
(
str
,
1
);
child
.
data
=
{
group
:
group
,
index
:
m
,
count
:
count
,
value
:
str
};
child
.
data
=
{
group
:
group
,
index
:
m
,
count
:
count
,
value
:
str
};
let
pos
=
this
.
getWordPosByAns
(
ansArr
.
map
(
ans
=>
ans
.
text
),
[
str
],
child
.
data
);
let
pos
=
this
.
getWordPosByAns
(
ansArr
.
map
(
ans
=>
ans
.
text
),
[
str
],
child
.
data
);
child
.
x
=
pos
.
x
;
child
.
x
=
pos
.
x
;
...
@@ -493,11 +491,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -493,11 +491,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
node
=
event
.
target
;
let
node
=
event
.
target
;
node
.
opacity
=
255
;
node
.
opacity
=
255
;
let
delta
=
event
.
touch
.
getDelta
();
let
delta
=
event
.
touch
.
getDelta
();
node
.
x
+=
delta
.
x
;
let
pos
=
cc
.
v2
(
delta
);
node
.
y
+=
delta
.
y
;
let
scale
=
this
.
getScale
();
pos
.
x
/=
scale
;
pos
.
y
/=
scale
;
node
.
x
+=
pos
.
x
;
node
.
y
+=
pos
.
y
;
node
.
data
.
forEach
(
nd
=>
{
node
.
data
.
forEach
(
nd
=>
{
nd
.
x
+=
delta
.
x
;
nd
.
x
+=
pos
.
x
;
nd
.
y
+=
delta
.
y
;
nd
.
y
+=
pos
.
y
;
})
})
}
}
private
successGroupIds
;
private
successGroupIds
;
...
...
assets/hy04_pinci/script/defaultData_hy04_pinci.ts
View file @
bb69f138
...
@@ -16,13 +16,13 @@ export const defaultData =
...
@@ -16,13 +16,13 @@ export const defaultData =
"
right
"
:
false
,
"
right
"
:
false
,
"
letterList
"
:
[
"
letterList
"
:
[
{
{
"
text
"
:
"
g
"
"
text
"
:
"
g
a
"
},
},
{
{
"
text
"
:
"
et
"
"
text
"
:
"
et
"
},
},
{
{
"
text
"
:
"
"
"
text
"
:
"
m
"
},
},
{
{
"
text
"
:
"
s
"
"
text
"
:
"
s
"
...
...
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