Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hello_canvas
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
hello_canvas
Commits
879d39e0
Commit
879d39e0
authored
Sep 01, 2020
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
9862d383
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
0 deletions
+50
-0
resCanvasList.js
project/src/canvas/game/resCanvasList.js
+6
-0
Main.ts
project/src/canvas/game/src/Main.ts
+2
-0
DropItem.ts
project/src/canvas/game/src/scenes/DropItem.ts
+24
-0
Root.ts
project/src/canvas/game/src/scenes/Root.ts
+12
-0
stage.ts
project/src/canvas/game/src/scenes/stage.ts
+6
-0
No files found.
project/src/canvas/game/resCanvasList.js
View file @
879d39e0
...
...
@@ -10,6 +10,12 @@ const resCanvasList = {
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/bg.c4359b9ea9e843cd8d929567b2fb52ed5518e105.png'
,
uuid
:
'cb54f3b5-0469-46d1-99ea-734153b92078'
},
'593e9d74-4944-496a-b6c1-8316756f8bf7'
:
{
name
:
'宝箱2'
,
ext
:
'.png'
,
uuid
:
'593e9d74-4944-496a-b6c1-8316756f8bf7'
,
url
:
'//yun.duiba.com.cn/spark/assets/022e25a3984ff122fbf960bd0cb87bff48f8c3bf.png'
}
};
export
default
resCanvasList
;
project/src/canvas/game/src/Main.ts
View file @
879d39e0
...
...
@@ -8,6 +8,7 @@ import { destroyNetData } from "./TaoBaoNet";
import
resCanvasList
from
'../resCanvasList'
;
import
{
setStage
}
from
"./scenes/stage"
;
/**
...
...
@@ -40,6 +41,7 @@ export class Main {
FYGE
.
RENDERER_TYPE
.
CANVAS
);
this
.
stage
=
stage
;
setStage
(
stage
);
//开始循环
// FYGE.Stage.flushAll();
//stage初始化
...
...
project/src/canvas/game/src/scenes/DropItem.ts
0 → 100644
View file @
879d39e0
import
resCanvasList
from
"../../resCanvasList"
;
import
{
RES
}
from
"../../module/RES"
;
import
{
getStage
}
from
"./stage"
;
export
default
class
DropItem
extends
FYGE
.
Sprite
{
constructor
()
{
super
();
this
.
texture
=
RES
.
getRes
(
resCanvasList
[
"593e9d74-4944-496a-b6c1-8316756f8bf7"
].
url
);
getStage
().
addEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
this
.
y
=
0
;
}
onEnterFrame
()
{
this
.
y
+=
10
;
}
}
project/src/canvas/game/src/scenes/Root.ts
View file @
879d39e0
import
{
RES
}
from
"../../module/RES"
;
import
resCanvasList
from
"../../resCanvasList"
;
import
DropItem
from
"./DropItem"
;
export
default
class
Root
extends
FYGE
.
Container
{
constructor
()
{
super
();
...
...
@@ -12,6 +13,17 @@ export default class Root extends FYGE.Container {
resCanvasList
[
"cb54f3b5-0469-46d1-99ea-734153b92078"
].
url
);
this
.
addChild
(
bg
);
this
.
addChild
(
new
DropItem
())
// SvgaParser.loadSvga(
// "//yun.duiba.com.cn/spark/assets/open_effect.b997f18f52ca96abb0913ca32fdce6f22ad9bcf7.svga",
// (v:any) => {
// console.log(v)
// this.addChild(v)
// },
// () => {}
// );
}
onAddToStage
()
{
...
...
project/src/canvas/game/src/scenes/stage.ts
0 → 100644
View file @
879d39e0
let
_stage
;
export
const
getStage
=
():
FYGE
.
Stage
=>
_stage
;
export
const
setStage
=
(
stage
)
=>
{
_stage
=
stage
;
};
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