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
Hide 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?) {
return
result
;
},
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 {
* @param config
* @param onAssetsProgress
* @param onAssetsComplete
* @param onStart
*/
async
launch
(
config
,
onAssetsProgress
?,
onAssetsComplete
?,
onStart
?)
{
this
.
_config
=
config
;
...
...
src/zeroing/launcher.ts
View file @
6fd2ea06
...
...
@@ -2,7 +2,7 @@
* 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
{
GameStage
}
from
"./game-warpper/index"
;
import
{
setGlobalContext
}
from
"./behavior-runtime"
;
...
...
@@ -11,8 +11,12 @@ import {Event} from "../2d/events/Event";
import
builtinLoadingView
from
"./game-warpper/LoadingView"
;
import
{
queryParams
}
from
"./web"
;
import
{
initAutoLayout
}
from
"./game-warpper/auto-layout"
;
import
{
EditorStage
}
from
"./game-warpper/EditorStage"
;
export
let
gameStage
:
GameStage
;
export
let
editorStage
:
EditorStage
;
export
let
editorMode
=
false
;
export
function
launch
(
url
,
loadingDelegate
?,
onStart
?)
{
if
(
queryParams
.
__proxy_mode__
)
{
...
...
@@ -51,7 +55,9 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
setTimeout
(
resolve
,
300
);
});
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
(
containerId
||
"game-container"
,
designWidth
||
750
,
...
...
@@ -64,21 +70,27 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
Stage
.
flushAll
();
stage
.
addEventListener
(
Event
.
ON_INIT_STAGE
,
()
=>
{
gameStage
=
new
GameStage
(
stage
);
setGlobalContext
({
gameStage
});
stage
.
addChild
(
gameStage
);
let
delegate
=
loadingDelegate
||
builtinLoadingView
;
gameStage
.
launch
(
config
,
function
(
done
,
total
)
{
delegate
.
onProgress
&&
delegate
.
onProgress
(
done
,
total
)
},
function
()
{
delegate
.
onComplete
&&
delegate
.
onComplete
();
},
onStart
);
if
(
editorMode
)
{
editorStage
=
new
EditorStage
(
stage
);
stage
.
addChild
(
editorStage
);
editorStage
.
launch
(
onStart
)
}
else
{
gameStage
=
new
GameStage
(
stage
);
setGlobalContext
({
gameStage
});
stage
.
addChild
(
gameStage
);
let
delegate
=
loadingDelegate
||
builtinLoadingView
;
gameStage
.
launch
(
config
,
function
(
done
,
total
)
{
delegate
.
onProgress
&&
delegate
.
onProgress
(
done
,
total
)
},
function
()
{
delegate
.
onComplete
&&
delegate
.
onComplete
();
},
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