Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yyh
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
wildfirecode13
yyh
Commits
b6598fa8
Commit
b6598fa8
authored
Dec 09, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
01dcb6db
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
178 additions
and
5 deletions
+178
-5
index.html
egret/index.html
+1
-1
SVGA.d.ts
egret/libs/SVGA.d.ts
+86
-0
bg.svga
egret/resource/assets/svgas/bg.svga
+0
-0
standby.svga
egret/resource/assets/svgas/standby.svga
+0
-0
trans.svga
egret/resource/assets/svgas/trans.svga
+0
-0
Main.ts
egret/src/Main.ts
+3
-3
loadSvga.ts
egret/src/loadSvga.ts
+33
-0
TransScene.ts
egret/src/yazuwei/TransScene.ts
+55
-1
No files found.
egret/index.html
View file @
b6598fa8
...
...
@@ -49,7 +49,7 @@
<script
src=
"libs/zepto.min.js"
></script>
<script
src=
"libs/security.js"
></script>
<script
src=
"libs/downloadApp.js"
></script>
<script
src=
"
libs/svga.egret.min
.js"
></script>
<script
src=
"
http://yun.duiba.com.cn/db_games/svga.egret.min.new
.js"
></script>
<script>
...
...
egret/libs/SVGA.d.ts
0 → 100644
View file @
b6598fa8
export
as
namespace
SVGA
;
declare
global
{
const
SVGA
:
{
Parser
:
typeof
Parser
,
EgretMovieClip
:
typeof
EgretMovieClip
,
}
}
export
class
VideoEntity
{
videoSize
:
{
width
:
number
,
height
:
number
}
FPS
:
number
frames
:
number
}
export
class
Parser
{
load
(
url
:
string
,
success
:
(
videoItem
:
VideoEntity
)
=>
void
,
failure
?:
(
err
:
Error
)
=>
void
):
void
}
export
class
EgretMovieClip
extends
egret
.
DisplayObjectContainer
{
/**
* 锁步,只关心每帧间隔时间,不管浏览器帧率
* 默认false
*/
lockStep
:
boolean
;
/**
* 当前帧数
* 1最小
*/
readonly
currentFrame
:
number
;
/**
* 是否播放
*/
readonly
isPlaying
:
boolean
;
/**
* 正序还是反序
*/
readonly
isFront
:
boolean
;
/**
* 所有帧数
*/
totalFrames
:
number
;
/**
*
* @param imagekey 要替换的图片key值
* @param imageUrl 图片路径或_png
*/
setImage
(
imagekey
:
string
,
imageUrl
:
string
):
void
/**
* 停止
*/
stop
():
void
;
/**
* 播放
*/
play
():
void
;
/**
* 进入下一帧
*/
nextFrame
():
void
;
/**
* 进入上一帧
*/
prevFrame
():
void
;
/**
* 停在指定帧
* @param frameIndex
*/
gotoAndStop
(
frameIndex
:
number
):
void
;
/**
* 从某帧开始播放
* @param frameIndex 1开始
* @param isFront 默认true正向播放
*/
gotoAndPlay
(
frameIndex
:
number
,
isFront
:
boolean
):
void
;
readonly
isInTimeFrame
:
boolean
;
/**
* 帧数范围播放
* @param beginFrame 开始播放的帧序号,默认第一帧
* @param endFrame 结束播放的帧序号,默认最后一帧
* @param loops 循环次数, 默认1次,负数为无限次,无限循环callback无效,因为永远不会完成,用正常的complete监听最后一帧或第一帧
* @param callback 所有播放完的回调
*/
startAniRange
(
beginFrame
:
number
,
endFrame
:
number
,
loops
:
number
,
callback
?:
Function
):
void
constructor
(
mv
:
VideoEntity
)
}
egret/resource/assets/svgas/bg.svga
0 → 100644
View file @
b6598fa8
File added
egret/resource/assets/svgas/standby.svga
0 → 100644
View file @
b6598fa8
File added
egret/resource/assets/svgas/trans.svga
0 → 100644
View file @
b6598fa8
File added
egret/src/Main.ts
View file @
b6598fa8
...
...
@@ -162,11 +162,11 @@ class Main extends MainBase {
// 创建游戏场景
protected
createGameScene
()
{
super
.
createGameScene
();
// SceneCtrl.instance.change(ModuleTypes.ShareStarter
Scene);
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
Trans
Scene
);
// PanelCtrl.instance.show(ModuleTypes.SloganPanel);
//
Waiting.instance.hide();
Waiting
.
instance
.
hide
();
//
return;
return
;
//获取UA信息
let
userAgent
=
navigator
.
userAgent
.
toLowerCase
();
console
.
log
(
userAgent
);
...
...
egret/src/loadSvga.ts
0 → 100644
View file @
b6598fa8
const
parser
=
new
SVGA
.
Parser
();
export
const
loadSvga
=
(
url
:
string
,
parent
?:
egret
.
DisplayObjectContainer
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
parser
.
load
(
url
,
(
videoItem
)
=>
{
const
mv
=
new
SVGA
.
EgretMovieClip
(
videoItem
);
if
(
parent
)
{
mv
.
gotoAndPlay
(
1
,
true
)
parent
.
addChild
(
mv
);
}
mv
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
()
=>
{
// console.log("播放完成")
},
this
);
resolve
(
mv
);
},
(
error
)
=>
{
reject
(
error
.
message
);
})
});
}
export
const
loadSvgaRes
=
(
url
:
string
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
parser
.
load
(
url
,
(
videoItem
)
=>
{
resolve
();
},
(
error
)
=>
{
reject
(
error
.
message
);
})
});
}
\ No newline at end of file
egret/src/yazuwei/TransScene.ts
View file @
b6598fa8
import
Scene
from
"../views/Scene"
;
import
{
getResPath
}
from
"../utils"
;
import
{
loadSvgaRes
,
loadSvga
}
from
"../loadSvga"
;
import
{
wait
}
from
"../GameConst"
;
export
default
class
TransScene
extends
Scene
{
_standby
:
SVGA
.
EgretMovieClip
;
_trans
:
SVGA
.
EgretMovieClip
;
_isLeft
=
false
;
protected
get
skinKey
()
{
return
'Trans'
}
constructor
(
data
)
{
...
...
@@ -8,8 +14,56 @@ export default class TransScene extends Scene {
this
.
initUI
(
data
);
}
initUI
(
data
)
{
async
initUI
(
data
)
{
// await Promise.all([
// loadSvgaRes(getResPath() + 'resource/assets/svgas/progress.svga'),
// loadSvgaRes(getResPath() + 'resource/assets/svgas/progress2.svga'),
// ]);
//要区分是分享者,还是被分享者
this
.
_standby
=
await
loadSvga
(
getResPath
()
+
'resource/assets/svgas/standby.svga'
,
this
)
as
SVGA
.
EgretMovieClip
;
this
.
_trans
=
await
loadSvga
(
getResPath
()
+
'resource/assets/svgas/trans.svga'
,
this
)
as
SVGA
.
EgretMovieClip
;
this
.
_standby
.
visible
=
false
;
this
.
_trans
.
visible
=
false
;
this
.
changeToStandBy
();
setTimeout
(()
=>
{
this
.
changeToTrans
();
},
2000
);
if
(
this
.
_isLeft
)
{
}
else
{
this
.
setRightPhone
();
}
}
setRightPhone
()
{
this
.
_standby
.
x
=
-
750
;
this
.
_trans
.
x
=
-
750
;
}
changeToStandBy
()
{
this
.
_standby
.
visible
=
true
;
this
.
_trans
.
visible
=
false
;
this
.
_standby
.
gotoAndPlay
(
1
,
true
);
}
async
changeToTrans
()
{
this
.
_trans
.
gotoAndPlay
(
1
,
true
);
await
wait
(
100
);
this
.
_standby
.
visible
=
false
;
this
.
_trans
.
visible
=
true
;
this
.
_trans
.
once
(
egret
.
Event
.
COMPLETE
,
()
=>
{
console
.
log
(
'COMPLETE'
)
this
.
changeToStandBy
();
if
(
!
this
.
_isLeft
)
{
this
.
_standby
.
x
=
40
;
this
.
_standby
.
y
=
10
;
}
},
this
);
}
onTap_btn
()
{
...
...
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