Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Sbx_pageturn
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
Sbx_pageturn
Commits
e3444d18
Commit
e3444d18
authored
Dec 24, 2020
by
asdf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后面page隐藏
parent
65bfed2a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
2 deletions
+130
-2
ItemPage.prefab
play/assets/tmpGame/prefabs/ItemPage.prefab
+3
-0
EventMgr.ts
play/assets/tmpGame/script/EventMgr.ts
+99
-0
EventMgr.ts.meta
play/assets/tmpGame/script/EventMgr.ts.meta
+9
-0
ItemPage.js
play/assets/tmpGame/script/ItemPage.js
+12
-1
Scene.js
play/assets/tmpGame/script/Scene.js
+7
-1
No files found.
play/assets/tmpGame/prefabs/ItemPage.prefab
View file @
e3444d18
...
...
@@ -860,6 +860,9 @@
"nodMask": {
"__id__": 20
},
"nodGroup": {
"__id__": 2
},
"layoutText": {
"__id__": 14
},
...
...
play/assets/tmpGame/script/EventMgr.ts
0 → 100644
View file @
e3444d18
/**
* 事件模块
* onfire.js
*
*/
interface
Listener
{
cb
:
Function
;
once
:
boolean
;
target
:
object
;
}
interface
EventsType
{
[
eventName
:
string
]:
Listener
[];
}
class
EventMgr
{
// 所有事件的监听器
es
:
EventsType
=
{};
on
(
eventName
:
string
,
cb
:
Function
,
target
:
object
)
{
if
(
!
this
.
es
[
eventName
])
{
this
.
es
[
eventName
]
=
[];
}
this
.
es
[
eventName
].
push
({
cb
,
once
:
false
,
target
,
});
}
once
(
eventName
:
string
,
cb
:
Function
,
target
:
object
)
{
if
(
!
this
.
es
[
eventName
])
{
this
.
es
[
eventName
]
=
[];
}
this
.
es
[
eventName
].
push
({
cb
,
once
:
true
,
target
,
});
}
emit
(
eventName
:
string
,
params
?:
any
)
{
const
listeners
=
this
.
es
[
eventName
]
||
[];
let
l
=
listeners
.
length
;
for
(
let
i
=
0
;
i
<
l
;
i
++
)
{
const
{
cb
,
once
,
target
}
=
listeners
[
i
];
let
args
=
[
eventName
,
params
];
cb
.
apply
(
target
,
args
);
if
(
once
)
{
listeners
.
splice
(
i
,
1
);
i
--
;
l
--
;
}
}
}
off
(
eventName
?:
string
,
cb
?:
Function
,
target
?:
object
)
{
// clean all
if
(
eventName
===
undefined
)
{
this
.
es
=
{};
}
else
{
if
(
cb
===
undefined
)
{
// clean the eventName's listeners
delete
this
.
es
[
eventName
];
}
else
if
(
cb
===
null
)
{
if
(
!
target
)
{
return
;
}
const
listeners
=
this
.
es
[
eventName
]
||
[];
// clean the event and listener
let
l
=
listeners
.
length
;
for
(
let
i
=
0
;
i
<
l
;
i
++
)
{
if
(
listeners
[
i
].
target
===
target
)
{
listeners
.
splice
(
i
,
1
);
i
--
;
l
--
;
}
}
}
else
{
const
listeners
=
this
.
es
[
eventName
]
||
[];
// clean the event and listener
let
l
=
listeners
.
length
;
for
(
let
i
=
0
;
i
<
l
;
i
++
)
{
if
(
listeners
[
i
].
cb
===
cb
&&
listeners
[
i
].
target
===
target
)
{
listeners
.
splice
(
i
,
1
);
i
--
;
l
--
;
}
}
}
}
}
}
export
default
new
EventMgr
();
\ No newline at end of file
play/assets/tmpGame/script/EventMgr.ts.meta
0 → 100644
View file @
e3444d18
{
"ver": "1.0.8",
"uuid": "abecd9d7-e7a7-41a8-9ee7-54079d07c873",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/script/ItemPage.js
View file @
e3444d18
const
Color_texts
=
[
'
#BE1AC1
'
,
'
#24C11A
'
,
'
#1A1DC1
'
,
'
#9F5307
'
];
import
EventMgr
from
'
./EventMgr
'
;
cc
.
Class
({
extends
:
cc
.
Component
,
...
...
@@ -13,10 +14,20 @@ cc.Class({
onEnable
()
{
this
.
node
.
on
(
'
touchend
'
,
this
.
onTouchEnd
,
this
);
EventMgr
.
on
(
'
refreshMask
'
,
this
.
onRefreshMask
,
this
)
},
onDisable
()
{
this
.
node
.
off
(
'
touchend
'
,
this
.
onTouchEnd
,
this
);
EventMgr
.
off
(
'
refreshMask
'
,
this
.
onRefreshMask
,
this
)
},
onRefreshMask
()
{
if
(
GameData
.
_currPageIndex
+
1
>=
this
.
index
)
{
this
.
node
.
opacity
=
255
;
}
else
{
this
.
node
.
opacity
=
0
;
}
},
onTouchEnd
(
event
)
{
...
...
@@ -223,7 +234,7 @@ cc.Class({
this
.
dragonBone
.
dragonAtlasAsset
=
null
;
this
.
dragonBone
.
dragonAsset
=
null
;
this
.
dragonBone
.
armatureName
=
''
;
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
this
.
loadSpine
();
})
},
...
...
play/assets/tmpGame/script/Scene.js
View file @
e3444d18
const
{
exchangeNodePos2
}
=
require
(
"
./utils
"
);
import
EventMgr
from
'
./EventMgr
'
;
const
saveKey
=
"
DataKey_Cocos_Test
"
;
cc
.
Class
({
...
...
@@ -279,6 +279,7 @@ cc.Class({
}
this
.
_indicatorList
.
push
(
comp
);
}
},
/**
...
...
@@ -298,6 +299,9 @@ cc.Class({
comp
.
showMask
();
}
}
this
.
scheduleOnce
(()
=>
{
EventMgr
.
emit
(
'
refreshMask
'
)
})
},
// 下一页
...
...
@@ -382,11 +386,13 @@ cc.Class({
onPageDownDone
()
{
GameData
.
_isPageTurning
=
false
;
this
.
refreshIndicator
(
true
);
EventMgr
.
emit
(
'
refreshMask
'
)
},
onPageUpDone
()
{
GameData
.
_isPageTurning
=
false
;
this
.
refreshIndicator
();
EventMgr
.
emit
(
'
refreshMask
'
)
},
refreshIndicator
(
isPageDown
)
{
...
...
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