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
5753aeeb
Commit
5753aeeb
authored
Apr 29, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改过程执行为每次都拷贝一份入参
parent
ed52c049
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
25 deletions
+24
-25
index.ts
src/2d/utils/index.ts
+1
-1
Process.ts
src/zeroing/behavior-runtime/Process.ts
+4
-2
GameStage.ts
src/zeroing/game-warpper/GameStage.ts
+6
-7
StackContainer.ts
src/zeroing/game-warpper/StackContainer.ts
+1
-1
assets-manager.ts
src/zeroing/game-warpper/assets-manager.ts
+3
-3
launcher.ts
src/zeroing/launcher.ts
+4
-5
utils.ts
src/zeroing/utils/utils.ts
+5
-5
web.ts
src/zeroing/web.ts
+0
-1
No files found.
src/2d/utils/index.ts
View file @
5753aeeb
...
...
@@ -322,7 +322,7 @@ export const GlobalPro = {
* @return {boolean} is webgl supported
*/
export
function
isWebGLSupported
():
boolean
{
const
contextOptions
=
{
stencil
:
true
,
failIfMajorPerformanceCaveat
:
true
};
const
contextOptions
=
{
stencil
:
true
};
//, failIfMajorPerformanceCaveat: true
try
{
if
(
!
window
[
"WebGLRenderingContext"
])
{
return
false
;
...
...
src/zeroing/behavior-runtime/Process.ts
View file @
5753aeeb
...
...
@@ -73,6 +73,8 @@ export class Process {
}
async
execute
(
args
)
{
let
payload
=
objClone
(
args
);
let
metaConfig
=
this
.
_config
.
meta
;
let
meta
,
result
;
if
(
metaConfig
)
{
...
...
@@ -87,7 +89,7 @@ export class Process {
let
p
;
for
(
let
i
=
0
,
li
=
meta
.
output
.
length
;
i
<
li
;
i
++
)
{
const
key
=
meta
.
output
[
i
];
p
=
this
.
_executeNextProcess
(
key
,
args
);
p
=
this
.
_executeNextProcess
(
key
,
payload
);
if
(
i
===
li
-
1
)
{
result
=
await
p
;
}
else
{
...
...
@@ -97,7 +99,7 @@ export class Process {
}
}
}
else
{
const
scriptResult
=
await
this
.
_executeMetaScript
(
''
,
args
,
metaConfig
);
const
scriptResult
=
await
this
.
_executeMetaScript
(
''
,
payload
,
metaConfig
);
let
subProcessResult
;
if
(
this
.
_meta
.
sub
&&
Object
.
keys
(
this
.
_meta
.
sub
).
length
>
1
)
{
subProcessResult
=
await
this
.
_executeSubProcess
(
scriptResult
.
type
,
scriptResult
.
payload
);
...
...
src/zeroing/game-warpper/GameStage.ts
View file @
5753aeeb
...
...
@@ -4,7 +4,7 @@
import
{
Stage
}
from
"../../2d/display/index"
;
import
{
StackContainer
}
from
"./StackContainer"
;
import
{
loadAsset
Group
}
from
"./assets-manager"
;
import
{
loadAsset
s
}
from
"./assets-manager"
;
import
{
instantiate
}
from
"./view-interpreter"
;
import
{
dataCenter
,
DataCenter
}
from
"./data-center"
;
import
{
setProcessMetaLibs
}
from
"../behavior-runtime/index"
;
...
...
@@ -98,11 +98,10 @@ export class GameStage extends Node {
/**
* 启动游戏
* @param config
* @param onPreloadAssetsProgress 预加载素材进度
* @param onPreloadAssetsComplete 预加载素材完成
* @param onStart
* @param onAssetsProgress
* @param onAssetsComplete
*/
async
launch
(
config
,
on
PreloadAssetsProgress
?,
onPreload
AssetsComplete
?,
onStart
?)
{
async
launch
(
config
,
on
AssetsProgress
?,
on
AssetsComplete
?,
onStart
?)
{
this
.
_config
=
config
;
const
{
assets
,
customs
}
=
config
;
let
loaded
=
0
;
...
...
@@ -115,13 +114,13 @@ export class GameStage extends Node {
}
}
await
loadAsset
Group
(
assets
,
p
).
catch
(
e
=>
{
await
loadAsset
s
(
assets
,
p
).
catch
(
e
=>
{
console
.
log
(
e
);
});
if
(
customs
)
{
for
(
let
custom
of
customs
)
{
if
(
custom
.
assets
)
{
await
loadAsset
Group
(
custom
.
assets
,
p
).
catch
(
e
=>
{
await
loadAsset
s
(
custom
.
assets
,
p
).
catch
(
e
=>
{
console
.
log
(
e
);
});
}
...
...
src/zeroing/game-warpper/StackContainer.ts
View file @
5753aeeb
...
...
@@ -56,7 +56,7 @@ export class StackContainer extends Node {
*/
pop
(
dispatch
=
true
)
{
let
len
=
this
.
children
.
length
;
if
(
len
<=
1
)
{
if
(
len
<=
0
)
{
return
false
;
}
this
.
removeChildAt
(
len
-
1
);
...
...
src/zeroing/game-warpper/assets-manager.ts
View file @
5753aeeb
...
...
@@ -3,7 +3,7 @@
*/
import
{
globalLoader
}
from
"../../2d/loader/Loader"
;
import
{
arrayFind
,
linkScheme
}
from
"../utils
/index
"
;
import
{
arrayFind
,
linkScheme
}
from
"../utils"
;
import
{
parse
}
from
"./bmp-text-manager"
;
let
assetsConfig
=
[];
...
...
@@ -23,9 +23,9 @@ const loaderMapping = {
};
/**
* 加载素材
组
* 加载素材
*/
export
function
loadAsset
Group
(
config
,
onProgress
?,
onComplete
?)
{
export
function
loadAsset
s
(
config
,
onProgress
?,
onComplete
?)
{
let
total
=
config
.
length
;
let
loaded
=
0
;
let
failedList
=
[];
...
...
src/zeroing/launcher.ts
View file @
5753aeeb
...
...
@@ -2,16 +2,15 @@
* Created by rockyl on 2019-11-08.
*/
import
{
Stage
}
from
"../2d/display/index"
;
import
{
GameStage
,
registerCustomModuleFromConfig
}
from
"./game-warpper/index"
;
import
{
setGlobalContext
,
setProcessMetaLibs
}
from
"./behavior-runtime/index"
;
import
{
Stage
}
from
"../2d/display"
;
import
{
registerCustomModuleFromConfig
,
registerScripts
,
RENDERER_TYPE
,
setProcessMetaLibs
,
StageScaleMode
}
from
".."
;
import
{
GameStage
}
from
"./game-warpper/index"
;
import
{
setGlobalContext
}
from
"./behavior-runtime"
;
import
{
globalLoader
}
from
"../2d/loader/Loader"
;
import
{
Event
}
from
"../2d/events/Event"
;
import
builtinLoadingView
from
"./game-warpper/LoadingView"
;
import
{
queryParams
}
from
"./web"
;
import
{
initAutoLayout
}
from
"./game-warpper/auto-layout"
;
import
{
registerScripts
}
from
"./decorators/scripts"
;
import
{
RENDERER_TYPE
,
StageScaleMode
}
from
"../2d/const"
;
export
let
gameStage
:
GameStage
;
...
...
src/zeroing/utils/utils.ts
View file @
5753aeeb
...
...
@@ -31,7 +31,7 @@ export function arrayFind(arr, predicate) {
* @param obj
*/
export
function
objClone
(
obj
)
{
return
JSON
.
parse
(
JSON
.
stringify
(
obj
))
;
return
obj
?
JSON
.
parse
(
JSON
.
stringify
(
obj
))
:
obj
;
}
const
percentKeys
=
[
'width'
,
'height'
];
...
...
@@ -73,11 +73,11 @@ export function getDataByPath(scope, path, throwException?) {
* @param code
* @param throwException
*/
export
function
safeEval
(
code
,
throwException
=
false
){
export
function
safeEval
(
code
,
throwException
=
false
)
{
let
func
=
new
Function
(
code
);
try
{
return
func
();
}
catch
(
e
)
{
}
catch
(
e
)
{
if
(
throwException
)
{
throw
e
;
}
...
...
@@ -329,7 +329,7 @@ export const cmdOldPrefix = '//z-';
*/
export
function
injectProperties
(
target
,
source
)
{
for
(
let
key
in
source
)
{
if
(
key
.
indexOf
(
'//'
)
!==
0
&&
!
source
.
hasOwnProperty
(
cmdPrefix
+
key
))
{
if
(
key
.
indexOf
(
'//'
)
!==
0
&&
!
source
.
hasOwnProperty
(
cmdPrefix
+
key
))
{
propertyParse
(
key
,
target
,
source
);
}
}
...
...
@@ -344,7 +344,7 @@ export function injectProperties(target, source) {
* @param includeSelf
*/
export
function
traverseViewNode
(
node
:
Container
,
callback
:
Function
,
includeSelf
=
false
)
{
if
(
includeSelf
)
{
if
(
includeSelf
)
{
callback
(
node
);
}
for
(
let
child
of
node
.
children
)
{
...
...
src/zeroing/web.ts
View file @
5753aeeb
/**
* Created by rockyl on 2019-12-10.
*/
import
{
env
}
from
"./game-warpper/enviroment"
;
export
let
queryParams
:
any
=
{};
...
...
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