Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
renderingEngine
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
王剑峰
renderingEngine
Commits
38573477
Commit
38573477
authored
Nov 12, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理结构
parent
96ca6c5a
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
77 additions
and
78 deletions
+77
-78
index.js
dist/index.js
+24
-21
index.js.map
dist/index.js.map
+1
-1
game-stage.js
examples/game-stage.js
+0
-22
VM.ts
src/zeroing/behavior-runtime/VM.ts
+10
-4
index.ts
src/zeroing/behavior-runtime/index.ts
+14
-5
events.ts
src/zeroing/decorators/events.ts
+1
-1
GameStage.ts
src/zeroing/game-warpper/GameStage.ts
+3
-3
StackContainer.ts
src/zeroing/game-warpper/StackContainer.ts
+1
-1
assets-manager.ts
src/zeroing/game-warpper/assets-manager.ts
+1
-1
data-center.ts
src/zeroing/game-warpper/data-center.ts
+2
-2
index.ts
src/zeroing/game-warpper/index.ts
+5
-0
Image.ts
src/zeroing/game-warpper/nodes/Image.ts
+3
-3
Label.ts
src/zeroing/game-warpper/nodes/Label.ts
+2
-2
index.ts
src/zeroing/game-warpper/nodes/index.ts
+0
-0
shapes.ts
src/zeroing/game-warpper/nodes/shapes.ts
+3
-3
view-interpreter.ts
src/zeroing/game-warpper/view-interpreter.ts
+1
-1
index.ts
src/zeroing/index.ts
+0
-7
launcher.ts
src/zeroing/launcher.ts
+6
-1
No files found.
dist/index.js
View file @
38573477
...
...
@@ -2172,8 +2172,9 @@
function
VM
()
{
}
VM
.
prototype
.
setup
=
function
(
context
)
{
var
processMetaContexts
=
context
.
processMetaContexts
;
this
.
_processMetaContexts
=
processMetaContexts
;
var
processMetaLibs
=
context
.
processMetaLibs
,
globalContext
=
context
.
globalContext
;
this
.
_processMetaLibs
=
processMetaLibs
;
this
.
_globalContext
=
globalContext
;
};
VM
.
prototype
.
executeProcess
=
function
(
sequence
,
id
,
parentProcess
,
args
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
...
...
@@ -2195,7 +2196,7 @@
});
};
VM
.
prototype
.
getMeta
=
function
(
id
)
{
for
(
var
_i
=
0
,
_a
=
this
.
_processMeta
Context
s
;
_i
<
_a
.
length
;
_i
++
)
{
for
(
var
_i
=
0
,
_a
=
this
.
_processMeta
Lib
s
;
_i
<
_a
.
length
;
_i
++
)
{
var
context
=
_a
[
_i
];
var
meta
=
arrayFind
(
context
,
function
(
item
)
{
return
item
.
id
===
id
;
});
if
(
meta
)
{
...
...
@@ -2203,25 +2204,36 @@
}
}
};
VM
.
prototype
.
getGlobal
=
function
()
{
return
this
.
_globalContext
;
};
return
VM
;
}());
var
processMetaContexts
=
[];
function
setProcessMetaContexts
()
{
var
processMetaLibs
=
[];
var
globalContext
=
{};
function
setProcessMetaLibs
()
{
var
metaContexts
=
[];
for
(
var
_i
=
0
;
_i
<
arguments
.
length
;
_i
++
)
{
metaContexts
[
_i
]
=
arguments
[
_i
];
}
for
(
var
_a
=
0
,
metaContexts_1
=
metaContexts
;
_a
<
metaContexts_1
.
length
;
_a
++
)
{
var
context
=
metaContexts_1
[
_a
];
processMetaContexts
.
push
(
context
);
processMetaLibs
.
push
(
context
);
}
}
function
setGlobalContext
(
context
)
{
globalContext
=
context
;
for
(
var
key
in
context
)
{
globalContext
[
key
]
=
context
[
key
];
}
}
function
executeBehavior
(
sequence
,
subEntry
,
args
)
{
if
(
subEntry
===
void
0
)
{
subEntry
=
'main'
;
}
var
vm
=
new
VM
();
vm
.
setup
({
processMetaContexts
:
processMetaContexts
,
processMetaLibs
:
processMetaLibs
,
globalContext
:
globalContext
,
});
vm
.
executeProcess
(
sequence
,
subEntry
,
null
,
args
)
.
then
(
function
(
result
)
{
...
...
@@ -2259,7 +2271,7 @@
if
(
eventConfig
)
{
executeBehavior
({
main
:
eventConfig
.
behaviors
[
0
],
},
'main'
,
'aaa'
);
},
'main'
);
}
}
};
...
...
@@ -11471,7 +11483,7 @@
GameStage
.
prototype
.
start
=
function
()
{
var
_a
=
this
.
_config
,
launchOptions
=
_a
.
launchOptions
,
dataMapping
=
_a
.
dataMapping
,
processes
=
_a
.
processes
,
globalProcesses
=
_a
.
globalProcesses
;
this
.
dataCenter
.
registerDataMapping
(
dataMapping
);
setProcessMeta
Context
s
(
processes
,
globalProcesses
);
setProcessMeta
Lib
s
(
processes
,
globalProcesses
);
var
entryViewName
=
launchOptions
.
entrySceneView
;
var
entryViewConfig
=
this
.
getViewConfigByName
(
entryViewName
);
if
(
entryViewConfig
)
{
...
...
@@ -11493,6 +11505,9 @@
var
stage
=
window
[
'stage'
]
=
new
Stage
(
containerID
||
"game-container"
,
designWidth
||
750
,
designHeight
||
1334
,
frameRate
||
60
,
scaleMode
||
StageScaleMode
.
FIXED_WIDTH
,
rendererType
||
exports
.
RENDERER_TYPE
.
WEBGL
);
Stage
.
flushAll
();
var
gameStage
=
new
GameStage
(
stage
);
setGlobalContext
({
gameStage
:
gameStage
});
stage
.
addChild
(
gameStage
);
setTimeout
(
function
()
{
gameStage
.
launch
(
config
,
onAssetsProgress
,
onAssetsComplete
);
...
...
@@ -11502,7 +11517,6 @@
exports
.
BaseTexture
=
BaseTexture
;
exports
.
Button
=
Button
;
exports
.
Circle
=
Circle$1
;
exports
.
Component
=
Component
;
exports
.
Container
=
Container
;
exports
.
DATA_URI
=
DATA_URI
;
...
...
@@ -11513,24 +11527,19 @@
exports
.
EventDispatcher
=
EventDispatcher
;
exports
.
FloatDisplay
=
FloatDisplay
;
exports
.
GDispatcher
=
GDispatcher
;
exports
.
GameStage
=
GameStage
;
exports
.
Graphics
=
Graphics
;
exports
.
Image
=
Image$1
;
exports
.
InputText
=
InputText
;
exports
.
Label
=
Label
;
exports
.
Loader
=
Loader
;
exports
.
Matrix
=
Matrix
;
exports
.
MouseEvent
=
MouseEvent
;
exports
.
PI_2
=
PI_2
;
exports
.
Point
=
Point
;
exports
.
RAD_TO_DEG
=
RAD_TO_DEG
;
exports
.
Rect
=
Rect
;
exports
.
Rectangle
=
Rectangle
;
exports
.
ScrollList
=
ScrollList
;
exports
.
ScrollPage
=
ScrollPage
;
exports
.
Shape
=
Shape
;
exports
.
Sprite
=
Sprite
;
exports
.
StackContainer
=
StackContainer
;
exports
.
Stage
=
Stage
;
exports
.
StageScaleMode
=
StageScaleMode
;
exports
.
TextField
=
TextField
;
...
...
@@ -11538,18 +11547,12 @@
exports
.
TextureSheet
=
TextureSheet
;
exports
.
URL_FILE_EXTENSION
=
URL_FILE_EXTENSION
;
exports
.
VERSION
=
VERSION
;
exports
.
applyAutoAdjust
=
applyAutoAdjust
;
exports
.
applyEvents
=
applyEvents
;
exports
.
applyScript
=
applyScript
;
exports
.
cos
=
cos
;
exports
.
devicePixelRatio
=
devicePixelRatio
;
exports
.
getAssetByName
=
getAssetByName
;
exports
.
getAssetByUUID
=
getAssetByUUID
;
exports
.
getTexture
=
getTexture
;
exports
.
inputFeildIosEnable
=
inputFeildIosEnable
;
exports
.
instantiate
=
instantiate
;
exports
.
launch
=
launch
;
exports
.
loadAssets
=
loadAssets
;
exports
.
osType
=
osType
;
exports
.
registerScriptDef
=
registerScriptDef
;
exports
.
sin
=
sin
;
...
...
dist/index.js.map
View file @
38573477
This diff is collapsed.
Click to expand it.
examples/game-stage.js
View file @
38573477
...
...
@@ -5,25 +5,3 @@
engine
.
registerScriptDef
(
ScriptDemo
);
const
gameStage
=
engine
.
launch
(
data
);
/*const dataCenter = gameStage.dataCenter;
dataCenter.registerGroup('test', {
hello: {
aaa: {
name: 'tom',
id: 1001,
age: 29,
avatar: 'face',
}
}
});
/!*console.log(dataCenter.getDataByPath('test.hello.aaa.name'));*!/
let i = 0;
setInterval(()=>{
let asset = data.assets[i % data.assets.length];
dataCenter.mutate('test', asset.name, 'hello.aaa.name');
dataCenter.mutate('test', asset.name, 'hello.aaa.avatar');
i++;
}, 1000);*/
src/zeroing/behavior-runtime/VM.ts
View file @
38573477
...
...
@@ -6,12 +6,14 @@ import {Process} from "./Process";
import
{
arrayFind
}
from
"../utils"
;
export
class
VM
{
_processMetaContexts
;
_processMetaLibs
;
_globalContext
;
setup
(
context
)
{
const
{
processMeta
Contexts
}
=
context
;
const
{
processMeta
Libs
,
globalContext
}
=
context
;
this
.
_processMetaContexts
=
processMetaContexts
;
this
.
_processMetaLibs
=
processMetaLibs
;
this
.
_globalContext
=
globalContext
;
}
async
executeProcess
(
sequence
,
id
,
parentProcess
,
args
)
{
...
...
@@ -27,11 +29,15 @@ export class VM {
}
getMeta
(
id
)
{
for
(
let
context
of
this
.
_processMeta
Context
s
)
{
for
(
let
context
of
this
.
_processMeta
Lib
s
)
{
let
meta
=
arrayFind
(
context
,
item
=>
item
.
id
===
id
);
if
(
meta
)
{
return
meta
;
}
}
}
getGlobal
(){
return
this
.
_globalContext
;
}
}
src/zeroing/behavior-runtime/index.ts
View file @
38573477
...
...
@@ -4,18 +4,27 @@
import
{
VM
}
from
"./VM"
;
let
processMetaContexts
=
[];
let
processMetaLibs
=
[];
let
globalContext
=
{};
export
function
setProcessMetaContexts
(...
metaContexts
)
{
for
(
let
context
of
metaContexts
){
processMetaContexts
.
push
(
context
);
export
function
setProcessMetaLibs
(...
metaContexts
)
{
for
(
let
context
of
metaContexts
)
{
processMetaLibs
.
push
(
context
);
}
}
export
function
setGlobalContext
(
context
)
{
globalContext
=
context
;
for
(
let
key
in
context
)
{
globalContext
[
key
]
=
context
[
key
];
}
}
export
function
executeBehavior
(
sequence
,
subEntry
=
'main'
,
args
?)
{
const
vm
=
new
VM
();
vm
.
setup
({
processMetaContexts
,
processMetaLibs
,
globalContext
,
});
vm
.
executeProcess
(
sequence
,
subEntry
,
null
,
args
)
.
then
(
result
=>
{
...
...
src/zeroing/decorators/events.ts
View file @
38573477
...
...
@@ -42,7 +42,7 @@ class EventsProxy extends HashObject {
if
(
eventConfig
)
{
executeBehavior
({
main
:
eventConfig
.
behaviors
[
0
],
},
'main'
,
'aaa'
)
},
'main'
)
}
}
}
...
...
src/zeroing/GameStage.ts
→
src/zeroing/
game-warpper/
GameStage.ts
View file @
38573477
...
...
@@ -2,12 +2,12 @@
* Created by rockyl on 2019-11-05.
*/
import
{
Container
,
Stage
}
from
"../2d/display"
;
import
{
Container
,
Stage
}
from
"../
../
2d/display"
;
import
{
StackContainer
}
from
"./StackContainer"
;
import
{
loadAssets
}
from
"./assets-manager"
;
import
{
instantiate
}
from
"./view-interpreter"
;
import
{
dataCenter
,
DataCenter
}
from
"./data-center"
;
import
{
setProcessMeta
Contexts
}
from
"
./behavior-runtime"
;
import
{
setProcessMeta
Libs
}
from
".
./behavior-runtime"
;
/**
* 游戏舞台
...
...
@@ -83,7 +83,7 @@ export class GameStage extends Container {
start
()
{
const
{
launchOptions
,
dataMapping
,
processes
,
globalProcesses
}
=
this
.
_config
;
this
.
dataCenter
.
registerDataMapping
(
dataMapping
);
setProcessMeta
Context
s
(
processes
,
globalProcesses
);
setProcessMeta
Lib
s
(
processes
,
globalProcesses
);
const
entryViewName
=
launchOptions
.
entrySceneView
;
let
entryViewConfig
=
this
.
getViewConfigByName
(
entryViewName
);
if
(
entryViewConfig
)
{
...
...
src/zeroing/StackContainer.ts
→
src/zeroing/
game-warpper/
StackContainer.ts
View file @
38573477
...
...
@@ -2,7 +2,7 @@
* Created by rockyl on 2019-11-05.
*/
import
{
Container
,
DisplayObject
}
from
"../2d/display"
;
import
{
Container
,
DisplayObject
}
from
"../
../
2d/display"
;
/**
* 栈式视图容器
...
...
src/zeroing/assets-manager.ts
→
src/zeroing/
game-warpper/
assets-manager.ts
View file @
38573477
/**
* Created by rockyl on 2019-11-07.
*/
import
{
Loader
}
from
".."
;
import
{
Loader
}
from
"..
/..
"
;
let
assetsConfig
;
...
...
src/zeroing/data-center.ts
→
src/zeroing/
game-warpper/
data-center.ts
View file @
38573477
...
...
@@ -3,8 +3,8 @@
*
* 数据中心
*/
import
{
EventDispatcher
}
from
"../2d/events"
;
import
{
arrayFind
}
from
"./utils"
;
import
{
EventDispatcher
}
from
"../
../
2d/events"
;
import
{
arrayFind
}
from
".
.
/utils"
;
/**
* 数据中心
...
...
src/zeroing/game-warpper/index.ts
0 → 100644
View file @
38573477
/**
* Created by rockyl on 2019-11-12.
*/
export
*
from
'./GameStage'
src/zeroing/nodes/Image.ts
→
src/zeroing/
game-warpper/
nodes/Image.ts
View file @
38573477
/**
* Created by rockyl on 2019-11-07.
*/
import
{
Sprite
}
from
"../../2d/display"
;
import
Texture
from
"../../2d/texture/Texture"
;
import
{
Sprite
}
from
"../../
../
2d/display"
;
import
Texture
from
"../../
../
2d/texture/Texture"
;
import
{
getAssetByName
,
getAssetByUUID
}
from
"../assets-manager"
;
import
{
dataCenter
}
from
"../data-center"
;
import
{
ESCAPE_REG_EXP
}
from
"../utils"
;
import
{
ESCAPE_REG_EXP
}
from
"../
../
utils"
;
const
assetScheme
=
'asset://'
;
...
...
src/zeroing/nodes/Label.ts
→
src/zeroing/
game-warpper/
nodes/Label.ts
View file @
38573477
/**
* Created by rockyl on 2019-11-08.
*/
import
{
TextField
}
from
"../../2d/text"
;
import
{
TextField
}
from
"../../
../
2d/text"
;
import
{
dataCenter
}
from
"../data-center"
;
import
{
ESCAPE_REG_EXP
}
from
"../utils"
;
import
{
ESCAPE_REG_EXP
}
from
"../
../
utils"
;
/**
* 文本
...
...
src/zeroing/nodes/index.ts
→
src/zeroing/
game-warpper/
nodes/index.ts
View file @
38573477
File moved
src/zeroing/nodes/shapes.ts
→
src/zeroing/
game-warpper/
nodes/shapes.ts
View file @
38573477
/**
* Created by rockyl on 2019-11-06.
*/
import
{
Shape
}
from
"../../"
;
import
{
Event
}
from
"../../2d/events"
;
import
{
dirtyFieldDetector
}
from
"../decorators"
;
import
{
Shape
}
from
"../../
../
"
;
import
{
Event
}
from
"../../
../
2d/events"
;
import
{
dirtyFieldDetector
}
from
"../
../
decorators"
;
/**
* 图形基类
...
...
src/zeroing/view-interpreter.ts
→
src/zeroing/
game-warpper/
view-interpreter.ts
View file @
38573477
...
...
@@ -2,7 +2,7 @@
* Created by rockyl on 2019-11-08.
*/
import
{
Container
}
from
"../2d/display"
;
import
{
Container
}
from
"../
../
2d/display"
;
import
{
Rect
,
Image
,
Label
}
from
"./nodes"
;
const
nodeTypeMapping
=
{
...
...
src/zeroing/index.ts
View file @
38573477
...
...
@@ -2,12 +2,5 @@
* Created by rockyl on 2019-11-06.
*/
export
*
from
'./GameStage'
export
*
from
'./StackContainer'
export
*
from
'./nodes'
export
*
from
'./assets-manager'
export
*
from
'./view-interpreter'
export
*
from
'./launcher'
export
*
from
'./decorators/auto-adjust'
export
*
from
'./decorators/scripts'
export
*
from
'./decorators/events'
src/zeroing/launcher.ts
View file @
38573477
...
...
@@ -3,7 +3,9 @@
*/
import
{
Stage
}
from
"../2d/display"
;
import
{
GameStage
,
Rect
,
RENDERER_TYPE
,
StageScaleMode
}
from
".."
;
import
{
RENDERER_TYPE
,
StageScaleMode
}
from
".."
;
import
{
GameStage
}
from
"./game-warpper"
;
import
{
setGlobalContext
}
from
"./behavior-runtime"
;
export
function
launch
(
config
,
onAssetsProgress
,
onAssetsComplete
)
{
const
{
containerID
,
designWidth
,
designHeight
,
frameRate
,
scaleMode
,
rendererType
,}
=
config
.
launchOptions
;
...
...
@@ -18,6 +20,9 @@ export function launch(config, onAssetsProgress, onAssetsComplete) {
Stage
.
flushAll
();
let
gameStage
=
new
GameStage
(
stage
);
setGlobalContext
({
gameStage
});
stage
.
addChild
(
gameStage
);
setTimeout
(()
=>
{
...
...
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