Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Sbox_FT_08
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
Sbox_FT_08
Commits
96c2aee5
Commit
96c2aee5
authored
Nov 25, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
6a5753de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
24 deletions
+55
-24
Scene.fire
play/assets/tmpGame/scene/Scene.fire
+1
-1
GameLogic.js
play/assets/tmpGame/script/GameLogic.js
+54
-23
No files found.
play/assets/tmpGame/scene/Scene.fire
View file @
96c2aee5
...
...
@@ -216,7 +216,7 @@
"array": [
0,
0,
5
38.9790290334059
,
5
27.4094709047232
,
0,
0,
0,
...
...
play/assets/tmpGame/script/GameLogic.js
View file @
96c2aee5
...
...
@@ -60,7 +60,8 @@ export default class GameLogic {
initNodes
()
{
this
.
g_cartoon
.
initCartoonElement
(
"
title_text
"
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/title/text`
))
for
(
let
index
=
0
;
index
<
10
;
index
++
)
{
this
.
g_cartoon
.
initCartoonElement
(
`card_
${
index
+
1
}
`
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/card_
${
index
+
1
}
`
))
const
card
=
this
.
g_cartoon
.
initCartoonElement
(
`card_
${
index
+
1
}
`
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/card_
${
index
+
1
}
`
))
card
.
node
.
zIndex
=
1
this
.
g_cartoon
.
initCartoonElement
(
`card_
${
index
+
1
}
_normal`
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/card_
${
index
+
1
}
/normal`
));
this
.
g_cartoon
.
initCartoonElement
(
`card_
${
index
+
1
}
_selected`
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/card_
${
index
+
1
}
/selected`
));
this
.
g_cartoon
.
initCartoonElement
(
`card_
${
index
+
1
}
_bell`
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/card_
${
index
+
1
}
/bell`
))
...
...
@@ -100,11 +101,14 @@ export default class GameLogic {
for
(
let
index
=
0
;
index
<
10
;
index
++
)
{
let
dataItem
=
this
.
g_formData
.
dataArray
[
newIndex
[
index
]];
let
card
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
index
+
1
}
`
)
card
.
open
=
false
;
let
cardNormal
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
index
+
1
}
_normal`
)
let
cardSelected
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
index
+
1
}
_selected`
)
let
imageContainer
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
index
+
1
}
_image_container`
)
imageContainer
.
cardIndex
=
index
;
imageContainer
.
correctIndex
=
newIndex
[
index
];
let
bellOutline
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
index
+
1
}
_bell_outline`
)
let
bellText
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
index
+
1
}
_bell_text`
)
bellText
.
node
.
getComponent
(
cc
.
Label
).
font
=
this
.
g_cartoon
.
getFontFamily
(
"
Comic Sans MS
"
)
...
...
@@ -128,18 +132,27 @@ export default class GameLogic {
bellOutline
.
node
.
setScale
(
0
);
this
.
g_cartoon
.
subscribeTouchEvent
(
`card_
${
index
+
1
}
_image_container`
,
()
=>
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
if
(
i
!=
index
&&
i
!=
this
.
m_currentQuestion
)
{
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
i
+
1
}
_normal`
).
node
.
opacity
=
255
;
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
i
+
1
}
_selected`
).
node
.
opacity
=
0
;
}
else
{
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
i
+
1
}
_normal`
).
node
.
opacity
=
0
;
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
i
+
1
}
_selected`
).
node
.
opacity
=
255
;
}
}
if
(
card
.
open
)
{
return
;
}
// for(let i=0; i<10; i++) {
// if(i!=index && i != this.m_currentQuestion) {
// this.g_cartoon.getCartoonElement(`card_${i+1}_normal`).node.opacity = 255;
// this.g_cartoon.getCartoonElement(`card_${i+1}_selected`).node.opacity = 0;
// } else {
// this.g_cartoon.getCartoonElement(`card_${i+1}_normal`).node.opacity = 0;
// this.g_cartoon.getCartoonElement(`card_${i+1}_selected`).node.opacity = 255;
// }
// }
if
(
this
.
m_currentQuestion
==
imageContainer
.
correctIndex
)
{
this
.
switchCard
(
this
.
m_currentQuestion
,
imageContainer
.
cardIndex
)
this
.
loadQuestion
()
card
.
open
=
true
;
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
imageContainer
.
cardIndex
+
1
}
_normal`
).
node
.
opacity
=
0
;
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
imageContainer
.
cardIndex
+
1
}
_selected`
).
node
.
opacity
=
255
;
this
.
switchCard
(
this
.
m_currentQuestion
,
imageContainer
.
cardIndex
,
()
=>
{
this
.
loadQuestion
()
})
}
})
...
...
@@ -171,23 +184,41 @@ export default class GameLogic {
}
}
switchCard
(
fromIndex
,
toIndex
)
{
switchCard
(
fromIndex
,
toIndex
,
callback
)
{
let
i1
=
this
.
m_currentQuestionArray
[
fromIndex
]
+
1
;
let
i2
=
this
.
m_currentQuestionArray
[
toIndex
]
let
card_1
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
i1
}
`
)
let
card_2
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
toIndex
+
1
}
`
)
console
.
log
(
"
交换
"
,
`card_
${
i1
}
`
,
`card_
${
toIndex
+
1
}
`
)
let
x
=
card_1
.
node
.
x
let
y
=
card_1
.
node
.
y
card_1
.
node
.
x
=
card_2
.
node
.
x
card_1
.
node
.
y
=
card_2
.
node
.
y
card_2
.
node
.
x
=
x
;
card_2
.
node
.
y
=
y
;
// console.log("交换",`card_${i1}`,`card_${toIndex+1}`)
let
x_1
=
card_1
.
node
.
x
let
y_1
=
card_1
.
node
.
y
let
x_2
=
card_2
.
node
.
x
let
y_2
=
card_2
.
node
.
y
toIndex
=
this
.
getCurrentIndex
(
toIndex
)
let
bellText1
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
i1
}
_bell_text`
)
card_1
.
node
.
setSiblingIndex
(
100
);
card_2
.
node
.
setSiblingIndex
(
100
);
let
bell1
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
i1
}
_bell`
)
let
bell2
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
toIndex
+
1
}
_bell`
)
this
.
g_cartoon
.
tweenChange
(
bell1
.
node
,
{
scaleX
:
0
,
scaleY
:
0
},
0.2
,
()
=>
{
this
.
g_cartoon
.
tweenChange
(
card_1
.
node
,
{
x
:
x_2
,
y
:
y_2
},
1
,
()
=>
{
this
.
g_cartoon
.
tweenChange
(
bell1
.
node
,
{
scaleX
:
1
,
scaleY
:
1
},
0.2
);
});
});
this
.
g_cartoon
.
tweenChange
(
bell2
.
node
,
{
scaleX
:
0
,
scaleY
:
0
},
0.2
,
()
=>
{
this
.
g_cartoon
.
tweenChange
(
card_2
.
node
,
{
x
:
x_1
,
y
:
y_1
},
1
,
()
=>
{
this
.
g_cartoon
.
tweenChange
(
bell2
.
node
,
{
scaleX
:
1
,
scaleY
:
1
},
0.2
,
()
=>
{
if
(
callback
)
{
callback
();
}
});
});
});
let
bellText1
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
i1
}
_bell_text`
)
let
bellText2
=
this
.
g_cartoon
.
getCartoonElement
(
`card_
${
toIndex
+
1
}
_bell_text`
)
toIndex
=
this
.
getCurrentIndex
(
toIndex
)
bellText1
.
node
.
getComponent
(
cc
.
Label
).
string
=
""
+
(
toIndex
+
1
)
bellText2
.
node
.
getComponent
(
cc
.
Label
).
string
=
""
+
(
fromIndex
+
1
)
...
...
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