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
f9cb43f2
Commit
f9cb43f2
authored
May 07, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toast增加更多参数
parent
6a30b259
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
34 deletions
+39
-34
engine.js
debug/engine.js
+21
-19
engine.js.map
debug/engine.js.map
+1
-1
manifest.json
manifest.json
+1
-1
Toast.ts
src/zeroing/game-warpper/Toast.ts
+16
-13
No files found.
debug/engine.js
View file @
f9cb43f2
...
...
@@ -17298,6 +17298,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return
StackContainer
;
}(
Node$1
));
//# sourceMappingURL=StackContainer.js.map
var
colorName
=
{
"aliceblue"
:
[
240
,
248
,
255
],
...
...
@@ -20185,14 +20186,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Toast
.
prototype
.
show
=
function
(
props
)
{
if
(
props
===
void
0
)
{
props
=
{};
}
return
tslib_1
.
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
contentView
,
lab
,
text
,
_a
,
padding
,
_b
,
duration
,
_c
,
showDuration
,
_d
,
hideDuration
;
var
contentView
,
lab
,
text
,
_a
,
padding
,
paddingH
,
paddingV
,
_b
,
duration
,
_c
,
showDuration
,
_d
,
hideDuration
;
return
tslib_1
.
__generator
(
this
,
function
(
_e
)
{
switch
(
_e
.
label
)
{
case
0
:
if
(
!
props
.
text
)
{
return
[
2
];
}
return
[
4
,
this
.
getContent
(
props
.
viewName
)];
return
[
4
,
this
.
getContent
(
props
.
viewName
,
props
)];
case
1
:
contentView
=
_e
.
sent
();
lab
=
contentView
.
getChildByName
(
'lab'
);
...
...
@@ -20200,11 +20201,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
console
.
warn
(
'[lab] child no exists on toast view'
);
return
[
2
];
}
text
=
props
.
text
,
_a
=
props
.
padding
,
padding
=
_a
===
void
0
?
10
:
_a
,
_b
=
props
.
duration
,
duration
=
_b
===
void
0
?
1000
:
_b
,
_c
=
props
.
showDuration
,
showDuration
=
_c
===
void
0
?
300
:
_c
,
_d
=
props
.
hideDuration
,
hideDuration
=
_d
===
void
0
?
200
:
_d
;
text
=
props
.
text
,
_a
=
props
.
padding
,
padding
=
_a
===
void
0
?
10
:
_a
,
paddingH
=
props
.
paddingH
,
paddingV
=
props
.
paddingV
,
_b
=
props
.
duration
,
duration
=
_b
===
void
0
?
1000
:
_b
,
_c
=
props
.
showDuration
,
showDuration
=
_c
===
void
0
?
300
:
_c
,
_d
=
props
.
hideDuration
,
hideDuration
=
_d
===
void
0
?
200
:
_d
;
lab
.
text
=
text
;
lab
.
x
=
lab
.
y
=
padding
;
this
.
width
=
contentView
.
width
=
lab
.
width
+
padding
*
2
;
this
.
height
=
contentView
.
height
=
lab
.
height
+
padding
*
2
;
lab
.
x
=
paddingH
||
padding
;
lab
.
y
=
paddingV
||
padding
;
this
.
width
=
contentView
.
width
=
lab
.
width
+
(
paddingH
||
padding
)
*
2
;
this
.
height
=
contentView
.
height
=
lab
.
height
+
(
paddingV
||
padding
)
*
2
;
if
(
!
contentView
.
visible
)
{
contentView
.
visible
=
true
;
contentView
.
alpha
=
0
;
...
...
@@ -20240,33 +20242,34 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this
.
removeChild
(
this
.
_content
);
this
.
_content
=
null
;
};
Toast
.
prototype
.
getContent
=
function
(
viewName
)
{
Toast
.
prototype
.
getContent
=
function
(
viewName
,
props
)
{
return
tslib_1
.
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
view
,
bg
,
lab
;
return
tslib_1
.
__generator
(
this
,
function
(
_
a
)
{
switch
(
_
a
.
label
)
{
var
view
,
_a
,
borderRadius
,
_b
,
labColor
,
_c
,
labSize
,
_d
,
bgColor
,
_e
,
bgAlpha
,
bg
,
lab
;
return
tslib_1
.
__generator
(
this
,
function
(
_
f
)
{
switch
(
_
f
.
label
)
{
case
0
:
if
(
!
(
this
.
children
.
length
==
0
))
return
[
3
,
3
];
if
(
!
viewName
)
return
[
3
,
2
];
return
[
4
,
this
.
_gameStage
.
instantiateView
(
viewName
)];
case
1
:
view
=
_
a
.
sent
();
_
a
.
label
=
2
;
view
=
_
f
.
sent
();
_
f
.
label
=
2
;
case
2
:
if
(
!
view
)
{
if
(
!
this
.
_contentSample
)
{
_a
=
props
.
borderRadius
,
borderRadius
=
_a
===
void
0
?
10
:
_a
,
_b
=
props
.
labColor
,
labColor
=
_b
===
void
0
?
'white'
:
_b
,
_c
=
props
.
labSize
,
labSize
=
_c
===
void
0
?
30
:
_c
,
_d
=
props
.
bgColor
,
bgColor
=
_d
===
void
0
?
'black'
:
_d
,
_e
=
props
.
bgAlpha
,
bgAlpha
=
_e
===
void
0
?
0.7
:
_e
;
this
.
_contentSample
=
new
Node$1
();
bg
=
new
Rect
();
bg
.
borderRadius
=
10
;
bg
.
borderRadius
=
borderRadius
;
bg
.
percentWidth
=
100
;
bg
.
percentHeight
=
100
;
bg
.
fillColor
=
'black'
;
bg
.
alpha
=
0.7
;
bg
.
fillColor
=
bgColor
;
bg
.
alpha
=
bgAlpha
;
this
.
_contentSample
.
addChild
(
bg
);
lab
=
new
Label
();
lab
.
name
=
'lab'
;
lab
.
fillColor
=
'white'
;
lab
.
size
=
30
;
lab
.
fillColor
=
labColor
;
lab
.
size
=
labSize
;
this
.
_contentSample
.
addChild
(
lab
);
}
view
=
this
.
_contentSample
;
...
...
@@ -20276,7 +20279,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return
[
3
,
4
];
case
3
:
view
=
this
.
getChildAt
(
0
);
_
a
.
label
=
4
;
_
f
.
label
=
4
;
case
4
:
return
[
2
,
view
];
}
});
...
...
@@ -20284,7 +20287,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
return
Toast
;
}(
Node$1
));
//# sourceMappingURL=Toast.js.map
function
createEvalFunc
(
exp
)
{
var
func
;
...
...
debug/engine.js.map
View file @
f9cb43f2
This diff is collapsed.
Click to expand it.
manifest.json
View file @
f9cb43f2
{
"id"
:
"engine"
,
"url"
:
"engine.50f2306185a286c24568fc87ef21dd4070b56456.js"
}
\ No newline at end of file
{
"id"
:
"engine"
,
"url"
:
"engine.68ebcc028b764acc0a822ad13fce52e3f9744bcb.js"
}
\ No newline at end of file
src/zeroing/game-warpper/Toast.ts
View file @
f9cb43f2
...
...
@@ -28,18 +28,19 @@ export class Toast extends Node {
return
;
}
let
contentView
=
await
this
.
getContent
(
props
.
viewName
);
let
contentView
=
await
this
.
getContent
(
props
.
viewName
,
props
);
let
lab
=
contentView
.
getChildByName
(
'lab'
);
if
(
!
lab
)
{
console
.
warn
(
'[lab] child no exists on toast view'
);
return
;
}
const
{
text
,
padding
=
10
,
duration
=
1000
,
showDuration
=
300
,
hideDuration
=
200
}
=
props
;
const
{
text
,
padding
=
10
,
paddingH
,
paddingV
,
duration
=
1000
,
showDuration
=
300
,
hideDuration
=
200
}
=
props
;
lab
.
text
=
text
;
lab
.
x
=
lab
.
y
=
padding
;
this
.
width
=
contentView
.
width
=
lab
.
width
+
padding
*
2
;
this
.
height
=
contentView
.
height
=
lab
.
height
+
padding
*
2
;
lab
.
x
=
paddingH
||
padding
;
lab
.
y
=
paddingV
||
padding
;
this
.
width
=
contentView
.
width
=
lab
.
width
+
(
paddingH
||
padding
)
*
2
;
this
.
height
=
contentView
.
height
=
lab
.
height
+
(
paddingV
||
padding
)
*
2
;
if
(
!
contentView
.
visible
)
{
contentView
.
visible
=
true
;
...
...
@@ -55,11 +56,11 @@ export class Toast extends Node {
hide
(
animation
=
true
,
hideDuration
=
200
)
{
if
(
this
.
_content
)
{
const
contentView
=
this
.
_content
;
if
(
animation
)
{
if
(
animation
)
{
Tween
.
get
(
contentView
,
null
,
null
,
true
)
.
to
({
alpha
:
0
},
hideDuration
)
.
call
(
this
.
removeContentView
,
this
)
}
else
{
}
else
{
Tween
.
removeTweens
(
contentView
);
this
.
removeContentView
();
}
...
...
@@ -72,7 +73,7 @@ export class Toast extends Node {
this
.
_content
=
null
;
}
private
async
getContent
(
viewName
)
{
private
async
getContent
(
viewName
,
props
)
{
let
view
;
if
(
this
.
children
.
length
==
0
)
{
...
...
@@ -81,18 +82,20 @@ export class Toast extends Node {
}
if
(
!
view
)
{
if
(
!
this
.
_contentSample
)
{
const
{
borderRadius
=
10
,
labColor
=
'white'
,
labSize
=
30
,
bgColor
=
'black'
,
bgAlpha
=
0.7
}
=
props
;
this
.
_contentSample
=
new
Node
();
let
bg
=
new
Rect
();
bg
.
borderRadius
=
10
;
bg
.
borderRadius
=
borderRadius
;
bg
.
percentWidth
=
100
;
bg
.
percentHeight
=
100
;
bg
.
fillColor
=
'black'
;
bg
.
alpha
=
0.7
;
bg
.
fillColor
=
bgColor
;
bg
.
alpha
=
bgAlpha
;
this
.
_contentSample
.
addChild
(
bg
);
let
lab
=
new
Label
();
lab
.
name
=
'lab'
;
lab
.
fillColor
=
'white'
;
lab
.
size
=
30
;
lab
.
fillColor
=
labColor
;
lab
.
size
=
labSize
;
this
.
_contentSample
.
addChild
(
lab
);
}
view
=
this
.
_contentSample
;
...
...
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