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
6fd2ea06
Commit
6fd2ea06
authored
May 08, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交一波
parent
5753aeeb
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
565 additions
and
138 deletions
+565
-138
engine.js
debug/engine.js
+483
-118
engine.js.map
debug/engine.js.map
+1
-1
index.ts
src/zeroing/behavior-runtime/index.ts
+1
-3
EditorStage.ts
src/zeroing/game-warpper/EditorStage.ts
+51
-0
GameStage.ts
src/zeroing/game-warpper/GameStage.ts
+1
-0
launcher.ts
src/zeroing/launcher.ts
+28
-16
No files found.
debug/engine.js
View file @
6fd2ea06
This diff is collapsed.
Click to expand it.
debug/engine.js.map
View file @
6fd2ea06
This diff is collapsed.
Click to expand it.
src/zeroing/behavior-runtime/index.ts
View file @
6fd2ea06
...
@@ -61,9 +61,7 @@ export function executeBehavior(sequence, subEntry = 'main', target, args?) {
...
@@ -61,9 +61,7 @@ export function executeBehavior(sequence, subEntry = 'main', target, args?) {
return
result
;
return
result
;
},
},
e
=>
{
e
=>
{
if
(
log
){
console
.
log
(
`[
${
vm
.
id
}
] terminate:`
,
e
);
console
.
log
(
`[
${
vm
.
id
}
] terminate:`
,
e
);
}
}
}
);
);
}
}
src/zeroing/game-warpper/EditorStage.ts
0 → 100644
View file @
6fd2ea06
/**
* Created by rockyl on 2019-11-05.
*/
import
{
Stage
}
from
"../../2d/display/index"
;
import
{
Node
}
from
"./nodes/Node"
;
import
{
instantiate
}
from
"./view-interpreter"
;
import
{
injectProperties
}
from
"../utils/utils"
;
/**
* 编辑器舞台
*/
export
class
EditorStage
extends
Node
{
private
_view
:
Node
;
constructor
(
stage
:
Stage
)
{
super
();
this
.
name
=
'editor-stage'
;
this
.
addEventListener
(
'modify-props'
,
this
.
onModifyProps
,
this
);
}
launch
(
onStart
)
{
onStart
();
}
showView
(
viewConfig
)
{
if
(
this
.
_view
)
{
this
.
removeChild
(
this
.
_view
);
}
let
view
=
this
.
_view
=
instantiate
(
viewConfig
);
this
.
addChild
(
view
);
}
getNodeProps
(
nodePath
)
{
return
this
.
_view
.
getChildByIndexPath
(
nodePath
);
}
private
onModifyProps
(
e
)
{
console
.
log
(
e
.
data
);
const
{
nodePath
,
props
}
=
e
.
data
;
let
node
=
this
.
_view
.
getChildByIndexPath
(
nodePath
);
if
(
node
)
{
injectProperties
(
node
,
props
);
}
else
{
console
.
warn
(
'node not found:'
,
nodePath
);
}
}
}
src/zeroing/game-warpper/GameStage.ts
View file @
6fd2ea06
...
@@ -100,6 +100,7 @@ export class GameStage extends Node {
...
@@ -100,6 +100,7 @@ export class GameStage extends Node {
* @param config
* @param config
* @param onAssetsProgress
* @param onAssetsProgress
* @param onAssetsComplete
* @param onAssetsComplete
* @param onStart
*/
*/
async
launch
(
config
,
onAssetsProgress
?,
onAssetsComplete
?,
onStart
?)
{
async
launch
(
config
,
onAssetsProgress
?,
onAssetsComplete
?,
onStart
?)
{
this
.
_config
=
config
;
this
.
_config
=
config
;
...
...
src/zeroing/launcher.ts
View file @
6fd2ea06
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* Created by rockyl on 2019-11-08.
* Created by rockyl on 2019-11-08.
*/
*/
import
{
Stage
}
from
"../2d/display"
;
import
{
Stage
}
from
"../2d/display
/index
"
;
import
{
registerCustomModuleFromConfig
,
registerScripts
,
RENDERER_TYPE
,
setProcessMetaLibs
,
StageScaleMode
}
from
".."
;
import
{
registerCustomModuleFromConfig
,
registerScripts
,
RENDERER_TYPE
,
setProcessMetaLibs
,
StageScaleMode
}
from
".."
;
import
{
GameStage
}
from
"./game-warpper/index"
;
import
{
GameStage
}
from
"./game-warpper/index"
;
import
{
setGlobalContext
}
from
"./behavior-runtime"
;
import
{
setGlobalContext
}
from
"./behavior-runtime"
;
...
@@ -11,8 +11,12 @@ import {Event} from "../2d/events/Event";
...
@@ -11,8 +11,12 @@ import {Event} from "../2d/events/Event";
import
builtinLoadingView
from
"./game-warpper/LoadingView"
;
import
builtinLoadingView
from
"./game-warpper/LoadingView"
;
import
{
queryParams
}
from
"./web"
;
import
{
queryParams
}
from
"./web"
;
import
{
initAutoLayout
}
from
"./game-warpper/auto-layout"
;
import
{
initAutoLayout
}
from
"./game-warpper/auto-layout"
;
import
{
EditorStage
}
from
"./game-warpper/EditorStage"
;
export
let
gameStage
:
GameStage
;
export
let
gameStage
:
GameStage
;
export
let
editorStage
:
EditorStage
;
export
let
editorMode
=
false
;
export
function
launch
(
url
,
loadingDelegate
?,
onStart
?)
{
export
function
launch
(
url
,
loadingDelegate
?,
onStart
?)
{
if
(
queryParams
.
__proxy_mode__
)
{
if
(
queryParams
.
__proxy_mode__
)
{
...
@@ -51,7 +55,9 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
...
@@ -51,7 +55,9 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
setTimeout
(
resolve
,
300
);
setTimeout
(
resolve
,
300
);
});
});
return
await
new
Promise
(
resolve
=>
{
return
await
new
Promise
(
resolve
=>
{
const
{
containerId
,
designWidth
,
designHeight
,
frameRate
,
scaleMode
,
rendererType
,}
=
config
.
options
;
const
{
containerId
,
designWidth
,
designHeight
,
frameRate
,
scaleMode
,
rendererType
,
editorMode
:
_editorMode
,}
=
config
.
options
;
editorMode
=
_editorMode
;
let
stage
=
window
[
'stage'
]
=
new
Stage
(
let
stage
=
window
[
'stage'
]
=
new
Stage
(
containerId
||
"game-container"
,
containerId
||
"game-container"
,
designWidth
||
750
,
designWidth
||
750
,
...
@@ -64,6 +70,11 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
...
@@ -64,6 +70,11 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
Stage
.
flushAll
();
Stage
.
flushAll
();
stage
.
addEventListener
(
Event
.
ON_INIT_STAGE
,
()
=>
{
stage
.
addEventListener
(
Event
.
ON_INIT_STAGE
,
()
=>
{
if
(
editorMode
)
{
editorStage
=
new
EditorStage
(
stage
);
stage
.
addChild
(
editorStage
);
editorStage
.
launch
(
onStart
)
}
else
{
gameStage
=
new
GameStage
(
stage
);
gameStage
=
new
GameStage
(
stage
);
setGlobalContext
({
setGlobalContext
({
gameStage
gameStage
...
@@ -77,8 +88,9 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
...
@@ -77,8 +88,9 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
},
function
()
{
},
function
()
{
delegate
.
onComplete
&&
delegate
.
onComplete
();
delegate
.
onComplete
&&
delegate
.
onComplete
();
},
onStart
);
},
onStart
);
}
});
});
resolve
(
gameStage
);
resolve
();
})
})
}
}
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