Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-engine
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
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
劳工
zeroing-engine
Commits
6a30b259
Commit
6a30b259
authored
May 07, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复批量弹窗问题
parent
c26351a8
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
273 additions
and
179 deletions
+273
-179
engine.js
debug/engine.js
+121
-75
engine.js.map
debug/engine.js.map
+1
-1
manifest.json
manifest.json
+1
-1
StackContainer.ts
src/zeroing/game-warpper/StackContainer.ts
+143
-98
view-effects.ts
src/zeroing/game-warpper/view-effects.ts
+7
-4
No files found.
debug/engine.js
View file @
6a30b259
This diff is collapsed.
Click to expand it.
debug/engine.js.map
View file @
6a30b259
This diff is collapsed.
Click to expand it.
manifest.json
View file @
6a30b259
{
"id"
:
"engine"
,
"url"
:
"engine.064186f5e8dcc18d3c38e8e0526e183be57587f2.js"
}
\ No newline at end of file
{
"id"
:
"engine"
,
"url"
:
"engine.50f2306185a286c24568fc87ef21dd4070b56456.js"
}
\ No newline at end of file
src/zeroing/game-warpper/StackContainer.ts
View file @
6a30b259
...
...
@@ -15,6 +15,9 @@ export class StackContainer extends Node {
private
_stack
=
[];
private
_inserted
=
0
;
private
_playing
=
false
;
private
_actionQueue
=
[];
constructor
(
mutex
=
true
,
inserted
=
0
)
{
super
();
...
...
@@ -43,66 +46,20 @@ export class StackContainer extends Node {
* @param view
* @param options
* @param playEffect
* @param callback
*/
push
(
view
:
DisplayObject
,
options
?,
playEffect
=
true
,
callback
?)
{
const
action
=
'push'
;
let
lastView
;
if
(
this
.
_mutex
&&
this
.
childNum
>
0
)
{
lastView
=
this
.
getChildAt
(
0
);
this
.
_stack
.
push
(
lastView
);
}
view
.
visible
=
false
;
this
.
addChild
(
view
);
let
data
=
{
action
,
view
,
lastView
,
options
,
hasView
:
true
};
this
.
dispatchEvent
(
Event
.
START
,
data
);
playViewEffect
(
playEffect
?
options
?
options
.
effect
:
null
:
null
,
options
?
options
.
effectParams
:
{},
this
.
_mutex
,
lastView
,
view
,
this
,
()
=>
{
this
.
dispatchEvent
(
Event
.
COMPLETE
,
data
);
callback
&&
callback
();
}
)
push
(
view
:
DisplayObject
,
options
?,
playEffect
=
true
)
{
this
.
_actionQueue
.
push
({
action
:
'push'
,
args
:
arguments
});
this
.
_playNextAction
();
}
/**
* 撤出视图
* @param options
* @param playEffect
* @param callback
*/
pop
(
options
?,
playEffect
=
true
,
callback
?)
{
const
action
=
'pop'
;
let
len
=
this
.
childNum
;
if
(
len
<=
0
)
{
return
false
;
}
let
lastView
=
this
.
getChildAt
(
this
.
children
.
length
-
1
);
let
view
;
if
(
this
.
_mutex
)
{
view
=
this
.
_stack
.
pop
();
view
.
visible
=
false
;
this
.
addChild
(
view
);
}
let
data
=
{
action
,
view
,
lastView
,
options
,
hasView
:
len
>
1
};
this
.
dispatchEvent
(
Event
.
START
,
data
);
playViewEffect
(
playEffect
?
options
?
options
.
effect
:
null
:
null
,
options
?
options
.
effectParams
:
{},
this
.
_mutex
,
lastView
,
view
,
this
,
()
=>
{
this
.
dispatchEvent
(
Event
.
COMPLETE
,
data
);
callback
&&
callback
();
}
);
return
true
;
pop
(
options
?,
playEffect
=
true
)
{
this
.
_actionQueue
.
push
({
action
:
'pop'
,
args
:
arguments
});
this
.
_playNextAction
();
}
/**
...
...
@@ -110,31 +67,10 @@ export class StackContainer extends Node {
* @param view
* @param options
* @param playEffect
* @param callback
*/
replace
(
view
:
DisplayObject
,
options
?,
playEffect
=
true
,
callback
?)
{
const
action
=
'replace'
;
let
len
=
this
.
childNum
;
if
(
len
<=
0
)
{
return
false
;
}
let
lastView
=
this
.
getChildAt
(
len
-
1
);
view
.
visible
=
false
;
this
.
addChild
(
view
);
let
data
=
{
action
,
view
,
lastView
,
options
,
hasView
:
len
>
1
};
this
.
dispatchEvent
(
Event
.
START
,
data
);
playViewEffect
(
playEffect
?
options
?
options
.
effect
:
null
:
null
,
options
?
options
.
effectParams
:
{},
this
.
_mutex
,
lastView
,
view
,
this
,
()
=>
{
this
.
dispatchEvent
(
Event
.
COMPLETE
,
data
);
callback
&&
callback
();
}
)
replace
(
view
:
DisplayObject
,
options
?,
playEffect
=
true
)
{
this
.
_actionQueue
.
push
({
action
:
'replace'
,
args
:
arguments
});
this
.
_playNextAction
();
}
/**
...
...
@@ -142,35 +78,144 @@ export class StackContainer extends Node {
* @param view
* @param options
* @param playEffect
* @param callback
*/
popAll
(
view
?:
DisplayObject
,
options
?,
playEffect
=
true
,
callback
?)
{
const
action
=
'popAll'
;
popAll
(
view
?:
DisplayObject
,
options
?,
playEffect
=
true
)
{
this
.
_actionQueue
.
push
({
action
:
'popAll'
,
args
:
arguments
});
this
.
_playNextAction
();
}
let
lastView
=
this
.
getChildAt
(
0
);
let
len
=
this
.
childNum
;
while
(
this
.
children
.
length
>
1
)
{
this
.
removeChildAt
(
1
);
private
_playNextAction
=
()
=>
{
if
(
this
.
_playing
||
this
.
_actionQueue
.
length
===
0
)
{
return
;
}
if
(
this
.
_mutex
)
{
this
.
_stack
.
splice
(
0
);
let
actionItem
=
this
.
_actionQueue
.
shift
();
let
args
=
[];
for
(
let
i
=
0
,
li
=
actionItem
.
args
.
length
;
i
<
li
;
i
++
)
{
const
argument
=
actionItem
.
args
[
i
];
args
.
push
(
argument
);
}
this
.
_playing
=
true
;
this
[
'_'
+
actionItem
.
action
].
apply
(
this
,
args
)
.
then
(()
=>
{
this
.
_playing
=
false
;
setTimeout
(
this
.
_playNextAction
,
1
);
});
};
private
_push
(
view
:
DisplayObject
,
options
?,
playEffect
=
true
)
{
return
new
Promise
(
resolve
=>
{
const
action
=
'push'
;
let
lastView
;
if
(
this
.
_mutex
&&
this
.
childNum
>
0
)
{
lastView
=
this
.
getChildAt
(
0
);
this
.
_stack
.
push
(
lastView
);
}
view
.
visible
=
false
;
this
.
addChild
(
view
);
let
data
=
{
action
,
view
,
lastView
,
options
,
hasView
:
true
};
this
.
dispatchEvent
(
Event
.
START
,
data
);
playViewEffect
(
playEffect
?
options
?
options
.
effect
:
null
:
null
,
options
?
options
.
effectParams
:
{},
this
.
_mutex
,
lastView
,
view
,
this
,
()
=>
{
this
.
dispatchEvent
(
Event
.
COMPLETE
,
data
);
resolve
();
}
)
})
}
private
_pop
(
options
?,
playEffect
=
true
)
{
return
new
Promise
(
resolve
=>
{
const
action
=
'pop'
;
let
len
=
this
.
childNum
;
if
(
len
<=
0
)
{
return
false
;
}
let
lastView
=
this
.
getChildAt
(
this
.
children
.
length
-
1
);
let
view
;
if
(
this
.
_mutex
)
{
view
=
this
.
_stack
.
pop
();
view
.
visible
=
false
;
this
.
addChild
(
view
);
}
let
data
=
{
action
,
view
,
lastView
,
options
,
hasView
:
len
>
1
};
this
.
dispatchEvent
(
Event
.
START
,
data
);
playViewEffect
(
playEffect
?
options
?
options
.
effect
:
null
:
null
,
options
?
options
.
effectParams
:
{},
this
.
_mutex
,
lastView
,
view
,
this
,
()
=>
{
this
.
dispatchEvent
(
Event
.
COMPLETE
,
data
);
resolve
();
}
)
})
}
private
_replace
(
view
:
DisplayObject
,
options
?,
playEffect
=
true
)
{
return
new
Promise
(
resolve
=>
{
const
action
=
'replace'
;
let
len
=
this
.
childNum
;
if
(
len
<=
0
)
{
return
false
;
}
let
lastView
=
this
.
getChildAt
(
len
-
1
);
if
(
view
){
view
.
visible
=
false
;
this
.
addChild
(
view
);
}
let
data
=
{
action
,
view
,
lastView
,
options
,
hasView
:
len
>
1
};
this
.
dispatchEvent
(
Event
.
START
,
data
);
playViewEffect
(
playEffect
?
options
?
options
.
effect
:
null
:
null
,
options
?
options
.
effectParams
:
{},
this
.
_mutex
,
lastView
,
view
,
this
,
()
=>
{
this
.
dispatchEvent
(
Event
.
COMPLETE
,
data
);
callback
&&
callback
();
let
data
=
{
action
,
view
,
lastView
,
options
,
hasView
:
len
>
1
};
this
.
dispatchEvent
(
Event
.
START
,
data
);
playViewEffect
(
playEffect
?
options
?
options
.
effect
:
null
:
null
,
options
?
options
.
effectParams
:
{},
this
.
_mutex
,
lastView
,
view
,
this
,
()
=>
{
this
.
dispatchEvent
(
Event
.
COMPLETE
,
data
);
resolve
();
}
)
})
}
private
_popAll
(
view
?:
DisplayObject
,
options
?,
playEffect
=
true
)
{
return
new
Promise
(
resolve
=>
{
const
action
=
'popAll'
;
let
lastView
=
this
.
getChildAt
(
0
);
let
len
=
this
.
childNum
;
while
(
this
.
children
.
length
>
1
)
{
this
.
removeChildAt
(
1
);
}
if
(
this
.
_mutex
)
{
this
.
_stack
.
splice
(
0
);
}
)
if
(
view
)
{
view
.
visible
=
false
;
this
.
addChild
(
view
);
}
let
data
=
{
action
,
view
,
lastView
,
options
,
hasView
:
len
>
1
};
this
.
dispatchEvent
(
Event
.
START
,
data
);
playViewEffect
(
playEffect
?
options
?
options
.
effect
:
null
:
null
,
options
?
options
.
effectParams
:
{},
this
.
_mutex
,
lastView
,
view
,
this
,
()
=>
{
this
.
dispatchEvent
(
Event
.
COMPLETE
,
data
);
resolve
();
}
)
})
}
}
}
\ No newline at end of file
src/zeroing/game-warpper/view-effects.ts
View file @
6a30b259
...
...
@@ -169,7 +169,7 @@ const effects = {
.
to
(
outPos
,
duration
,
Ease
[
outEase
])
.
call
(()
=>
{
container
.
removeChild
(
lastView
);
injectProp
(
lastView
,
outPos
);
injectProp
(
lastView
,
{
scaleX
:
1
,
scaleY
:
1
}
);
callback
();
});
...
...
@@ -185,8 +185,6 @@ const effects = {
y
:
view
.
y
,
scaleX
:
1
,
scaleY
:
1
};
view
.
anchorX
=
view
.
width
/
2
;
view
.
anchorY
=
view
.
height
/
2
;
outPos
.
x
-=
view
.
width
/
2
;
outPos
.
y
-=
view
.
height
/
2
;
...
...
@@ -195,6 +193,9 @@ const effects = {
Tween
.
get
(
view
,
null
,
null
,
true
)
.
to
(
inPos
,
duration
,
Ease
[
inEase
])
.
call
(()
=>
{
view
.
anchorX
=
0
;
view
.
anchorY
=
0
;
callback
();
});
}
else
{
...
...
@@ -226,7 +227,7 @@ const effects = {
.
to
({
scaleX
:
0
,
scaleY
:
0
},
duration
,
Ease
[
outEase
])
.
call
(()
=>
{
container
.
removeChild
(
lastView
);
injectProp
(
view
,
{
scaleX
:
0
,
scaleY
:
0
});
injectProp
(
view
,
{
scaleX
:
1
,
scaleY
:
1
});
callback
();
});
...
...
@@ -244,6 +245,8 @@ const effects = {
Tween
.
get
(
view
,
null
,
null
,
true
)
.
to
({
scaleX
:
1
,
scaleY
:
1
},
duration
,
Ease
[
inEase
])
.
call
(()
=>
{
view
.
anchorX
=
0
;
view
.
anchorY
=
0
;
callback
();
});
}
else
{
...
...
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