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
88b0d47d
Commit
88b0d47d
authored
Nov 19, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
内联过程实现
parent
977e31bb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
18 deletions
+51
-18
Process.ts
src/zeroing/behavior-runtime/Process.ts
+31
-8
data-center.ts
src/zeroing/game-warpper/data-center.ts
+2
-10
utils.ts
src/zeroing/utils.ts
+18
-0
No files found.
src/zeroing/behavior-runtime/Process.ts
View file @
88b0d47d
...
...
@@ -4,8 +4,9 @@
* 过程
*/
import
{
VM
}
from
"./VM"
;
import
{
linkedFlag
,
nodeScheme
,
objClone
}
from
"../utils"
;
import
{
getDataByPath
,
linkedFlag
,
nodeScheme
,
objClone
}
from
"../utils"
;
import
{
findNodeByUUID
}
from
"../node-utils"
;
import
{
dataCenter
}
from
"../game-warpper/data-center"
;
const
log
=
true
;
...
...
@@ -92,7 +93,7 @@ export class Process {
if
(
metaConfig
)
{
if
(
metaConfig
.
script
)
{
let
func
=
new
Function
(
'args'
,
'props'
,
'target'
,
'global'
,
warpAsyncScript
(
metaConfig
.
script
));
this
.
updateProps
();
this
.
updateProps
(
payload
);
result
=
await
func
(
payload
,
this
.
_config
.
props
,
this
.
_target
,
this
.
_vm
.
getGlobalContext
());
}
}
else
{
...
...
@@ -138,7 +139,15 @@ export class Process {
* @return {null}
*/
getProcessMeta
(
id
)
{
let
meta
=
this
.
_meta
&&
this
.
_meta
.
metas
?
this
.
_meta
.
metas
[
id
]
:
null
;
let
meta
;
if
(
this
.
_meta
&&
this
.
_meta
.
metas
)
{
//如果有内联过程
for
(
let
temp
of
this
.
_meta
.
metas
)
{
if
(
temp
.
id
===
id
)
{
meta
=
temp
;
break
;
}
}
}
if
(
!
meta
)
{
meta
=
this
.
_parent
?
this
.
_parent
.
getProcessMeta
(
id
)
:
null
;
}
...
...
@@ -161,16 +170,30 @@ export class Process {
/**
* 更新props
*/
updateProps
()
{
updateProps
(
args
)
{
if
(
this
.
_originProps
)
{
let
props
=
this
.
_config
.
props
;
for
(
let
key
in
props
)
{
let
value
=
this
.
_originProps
[
key
];
if
(
typeof
value
==
'object'
)
{
const
valueType
=
typeof
value
;
if
(
valueType
==
'object'
)
{
switch
(
value
.
type
)
{
case
'link'
:
let
linkedValue
=
this
.
resolveLinkedProp
(
value
,
key
);
if
(
linkedValue
!==
undefined
)
{
props
[
key
]
=
linkedValue
;
}
break
;
case
'static'
:
props
[
key
]
=
value
.
value
;
break
;
case
'arguments'
:
props
[
key
]
=
args
?
getDataByPath
(
args
,
value
.
value
)
:
undefined
;
break
;
case
'data-center'
:
props
[
key
]
=
dataCenter
.
getDataByPath
(
value
.
value
);
break
;
}
}
else
if
(
value
&&
value
.
indexOf
&&
value
.
indexOf
(
nodeScheme
)
===
0
)
{
let
uuid
=
value
.
replace
(
nodeScheme
,
''
);
if
(
uuid
)
{
...
...
src/zeroing/game-warpper/data-center.ts
View file @
88b0d47d
...
...
@@ -4,7 +4,7 @@
* 数据中心
*/
import
{
EventDispatcher
}
from
"../../2d/events"
;
import
{
arrayFind
}
from
"../utils"
;
import
{
arrayFind
,
getDataByPath
}
from
"../utils"
;
import
{
DATA_CENTER_EVENT
,
globalEvent
}
from
"../decorators/events"
;
/**
...
...
@@ -49,15 +49,7 @@ export class DataCenter extends EventDispatcher {
* @param throwException
*/
getDataByPath
(
path
,
throwException
?)
{
let
func
=
new
Function
(
'scope'
,
`return scope.
${
path
}
`
);
try
{
return
func
(
this
.
store
);
}
catch
(
e
)
{
//console.warn(e);
if
(
throwException
)
{
throw
e
;
}
}
return
getDataByPath
(
this
.
store
,
path
,
throwException
);
}
/**
...
...
src/zeroing/utils.ts
View file @
88b0d47d
...
...
@@ -35,3 +35,21 @@ export function propertyParse(key, node, properties) {
}
node
[
targetKey
]
=
value
;
}
/**
* 根据路径获取数据
* @param scope
* @param path
* @param throwException
*/
export
function
getDataByPath
(
scope
,
path
,
throwException
?){
let
func
=
new
Function
(
'scope'
,
`return scope.
${
path
}
`
);
try
{
return
func
(
scope
);
}
catch
(
e
)
{
//console.warn(e);
if
(
throwException
)
{
throw
e
;
}
}
}
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