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
e0aba4ed
Commit
e0aba4ed
authored
Dec 05, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决滚动条不跟手的问题
解决舞台适配问题 优化过程执行,如果子过程只有一个就跳过
parent
e3c51ee3
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
166 additions
and
99 deletions
+166
-99
engine.js
debug/engine.js
+116
-79
engine.js.map
debug/engine.js.map
+1
-1
ScrollContainer.ts
src/2d/ui/ScrollContainer.ts
+5
-5
Process.ts
src/zeroing/behavior-runtime/Process.ts
+6
-1
auto-adjust.ts
src/zeroing/decorators/auto-adjust.ts
+9
-1
GameStage.ts
src/zeroing/game-warpper/GameStage.ts
+6
-4
StackContainer.ts
src/zeroing/game-warpper/StackContainer.ts
+2
-2
launcher.ts
src/zeroing/launcher.ts
+7
-6
utils.ts
src/zeroing/utils/utils.ts
+14
-0
No files found.
debug/engine.js
View file @
e0aba4ed
...
...
@@ -1633,9 +1633,11 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
AdjustProxy
.
prototype
.
adjustLayout
=
function
()
{
var
that
=
this
.
_host
;
var
_a
=
that
.
parent
,
pWidth
=
_a
.
width
,
pHeight
=
_a
.
height
;
var
pWidth
,
pHeight
;
pWidth
=
that
.
parent
.
width
;
pHeight
=
that
.
parent
.
height
;
var
width
=
that
.
width
,
height
=
that
.
height
;
var
_
b
=
this
.
data
,
percentWidth
=
_b
.
percentWidth
,
percentHeight
=
_b
.
percentHeight
,
left
=
_b
.
left
,
top
=
_b
.
top
,
right
=
_b
.
right
,
bottom
=
_b
.
bottom
,
horizonCenter
=
_b
.
horizonCenter
,
verticalCenter
=
_b
.
verticalCenter
;
var
_
a
=
this
.
data
,
percentWidth
=
_a
.
percentWidth
,
percentHeight
=
_a
.
percentHeight
,
left
=
_a
.
left
,
top
=
_a
.
top
,
right
=
_a
.
right
,
bottom
=
_a
.
bottom
,
horizonCenter
=
_a
.
horizonCenter
,
verticalCenter
=
_a
.
verticalCenter
;
var
applyPercentWidth
=
function
()
{
if
(
t
(
percentWidth
))
{
that
.
width
=
pWidth
*
percentWidth
/
100
;
...
...
@@ -1857,6 +1859,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return
result
;
}
var
el
;
function
htmlToPureText
(
htmlText
)
{
if
(
!
el
)
{
el
=
document
.
createElement
(
'div'
);
}
el
.
innerHTML
=
htmlText
;
document
.
body
.
append
(
el
);
var
pureText
=
el
.
innerText
;
document
.
body
.
removeChild
(
el
);
return
pureText
;
}
var
rotateLeft
=
function
(
lValue
,
iShiftBits
)
{
return
(
lValue
<<
iShiftBits
)
|
(
lValue
>>>
(
32
-
iShiftBits
));
...
...
@@ -2404,18 +2417,24 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
case
4
:
i
++
;
return
[
3
,
1
];
case
5
:
return
[
3
,
1
0
];
case
5
:
return
[
3
,
1
2
];
case
6
:
return
[
4
,
this
.
_executeMetaScript
(
''
,
args
,
metaConfig
)];
case
7
:
scriptResult
=
_a
.
sent
();
subProcessResult
=
void
0
;
if
(
!
(
this
.
_meta
.
sub
&&
Object
.
keys
(
this
.
_meta
.
sub
).
length
>
1
))
return
[
3
,
9
];
return
[
4
,
this
.
_executeSubProcess
(
scriptResult
.
type
,
scriptResult
.
payload
)];
case
8
:
subProcessResult
=
_a
.
sent
();
return
[
4
,
this
.
_executeNextProcess
(
subProcessResult
.
type
,
subProcessResult
.
payload
)
];
return
[
3
,
10
];
case
9
:
result
=
_a
.
sent
()
;
subProcessResult
=
scriptResult
;
_a
.
label
=
10
;
case
10
:
return
[
2
,
result
];
case
10
:
return
[
4
,
this
.
_executeNextProcess
(
subProcessResult
.
type
,
subProcessResult
.
payload
)];
case
11
:
result
=
_a
.
sent
();
_a
.
label
=
12
;
case
12
:
return
[
2
,
result
];
}
});
});
...
...
@@ -7765,6 +7784,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this
.
y
=
y
;
this
.
width
=
width
;
this
.
height
=
height
;
var
max
=
(
width
<
height
?
width
:
height
)
/
2
;
radius
=
radius
<
0
?
-
radius
:
radius
;
radius
=
radius
>
max
?
max
:
radius
;
this
.
radius
=
radius
;
this
.
type
=
exports
.
SHAPES
.
RREC
;
}
...
...
@@ -10630,7 +10652,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
else
{
var
measureCache
=
{};
if
(
!
textWidth
)
{
var
shouldMeasureTextWidth
=
!
textWidth
;
for
(
var
i
=
0
,
l
=
hardLines
.
length
;
i
<
l
;
i
++
)
{
var
str
=
hardLines
[
i
];
if
(
!
str
)
...
...
@@ -10644,6 +10666,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
lineWidth
+=
charWidth
;
}
if
(
shouldMeasureTextWidth
)
{
textWidth
=
Math
.
max
(
lineWidth
,
textWidth
);
}
}
...
...
@@ -11051,7 +11074,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
isVertical
=
true
;
_this
.
distance
=
0
;
_this
.
minDis
=
2
;
_this
.
minDis
=
0
;
_this
.
maskObj
=
new
Graphics
();
_this
.
viewPort
=
new
Container
();
_this
.
lastValue
=
0
;
...
...
@@ -11075,9 +11098,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
s
.
maskObj
.
alpha
=
0
;
s
.
updateViewRect
(
isVertical
);
s
.
addEventListener
(
Event
.
ADDED_TO_STAGE
,
function
(
e
)
{
s
.
stage
.
addEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
});
s
.
addEventListener
(
Event
.
REMOVED_FROM_STAGE
,
function
(
e
)
{
s
.
stage
.
removeEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
});
s
.
addEventListener
(
MouseEvent
.
MOUSE_DOWN
,
s
.
onMouseEvent
,
s
);
s
.
addEventListener
(
MouseEvent
.
MOUSE_MOVE
,
s
.
onMouseEvent
,
s
);
s
.
addEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
s
.
addEventListener
(
MouseEvent
.
MOUSE_OUT
,
s
.
onMouseEvent
,
s
);
s
.
addEventListener
(
Event
.
ENTER_FRAME
,
function
()
{
var
view
=
s
.
viewPort
;
if
(
s
.
autoScroll
)
...
...
@@ -11181,8 +11209,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
ScrollContainer
.
prototype
.
onMouseEvent
=
function
(
e
)
{
var
s
=
this
;
var
view
=
s
.
viewPort
;
if
(
e
.
type
==
MouseEvent
.
MOUSE_MOVE
)
{
if
(
s
.
isMouseDownState
<
1
)
{
if
(
e
.
type
==
MouseEvent
.
MOUSE_DOWN
)
{
if
(
!
s
.
isStop
)
{
s
.
isStop
=
true
;
}
...
...
@@ -11197,8 +11224,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
s
.
speed
=
0
;
s
.
isMouseDownState
=
1
;
return
;
}
else
if
(
e
.
type
==
MouseEvent
.
MOUSE_MOVE
)
{
if
(
s
.
isMouseDownState
==
0
)
return
;
if
(
s
.
isMouseDownState
==
1
)
{
s
.
dispatchEvent
(
Event
.
ON_SCROLL_START
);
}
...
...
@@ -12074,8 +12103,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
_stack
=
[];
_this
.
_mutex
=
mutex
;
_this
[
'percentWidth'
]
=
100
;
_this
[
'percentHeight'
]
=
100
;
_this
.
percentWidth
=
100
;
_this
.
percentHeight
=
100
;
_this
.
mouseEnabled
=
false
;
return
_this
;
}
...
...
@@ -12379,12 +12408,27 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var
_this
=
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
_this
.
_escapes
=
[];
_this
.
_registeredEvents
=
[];
_this
.
onTextMutated
=
function
(
e
)
{
_super
.
prototype
.
_setText
.
call
(
_this
,
dataCenter
.
formatString
(
_this
.
_originText
,
_this
.
_escapes
));
};
_this
.
onHtmlMutated
=
function
(
e
)
{
var
html
=
dataCenter
.
formatString
(
_this
.
_originText
,
_this
.
_escapes
);
_this
.
text
=
htmlToPureText
(
html
);
};
return
_this
;
}
Label
.
prototype
.
_setText
=
function
(
value
)
{
if
(
value
!==
this
.
_text
)
{
var
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
matchResult
)
{
this
.
dealEscape
(
value
,
matchResult
,
this
.
onTextMutated
);
}
else
{
_super
.
prototype
.
_setText
.
call
(
this
,
value
);
}
}
};
Label
.
prototype
.
dealEscape
=
function
(
value
,
matchResult
,
onMutated
)
{
this
.
unregisterEvents
();
this
.
_originText
=
value
;
this
.
_escapes
.
splice
(
0
);
...
...
@@ -12394,32 +12438,25 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var
args
=
escape
.
split
(
'|'
);
var
eventName
=
args
[
0
];
this
.
_escapes
.
push
(
escape
);
dataCenter
.
addEventListener
(
eventName
,
this
.
onData
Mutated
,
this
);
dataCenter
.
addEventListener
(
eventName
,
on
Mutated
,
this
);
this
.
_registeredEvents
.
push
(
eventName
);
}
this
.
onDataMutated
();
}
else
{
_super
.
prototype
.
_setText
.
call
(
this
,
value
);
}
}
onMutated
();
};
Object
.
defineProperty
(
Label
.
prototype
,
"htmlText"
,
{
get
:
function
()
{
return
this
.
_htmlText
;
},
set
:
function
(
v
)
{
if
(
this
.
_htmlText
!=
v
)
{
this
.
_htmlText
=
v
;
var
el
=
this
.
_el
;
if
(
!
el
)
{
el
=
this
.
_el
=
document
.
createElement
(
'div'
);
set
:
function
(
value
)
{
if
(
this
.
_htmlText
!=
value
)
{
this
.
_htmlText
=
value
;
var
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
matchResult
)
{
this
.
dealEscape
(
value
,
matchResult
,
this
.
onHtmlMutated
);
}
else
{
this
.
text
=
htmlToPureText
(
value
);
}
el
.
innerHTML
=
v
;
document
.
body
.
append
(
el
);
var
pureText
=
el
.
innerText
;
document
.
body
.
removeChild
(
el
);
this
.
text
=
pureText
;
}
},
enumerable
:
true
,
...
...
@@ -12428,13 +12465,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Label
.
prototype
.
unregisterEvents
=
function
()
{
for
(
var
_i
=
0
,
_a
=
this
.
_registeredEvents
;
_i
<
_a
.
length
;
_i
++
)
{
var
item
=
_a
[
_i
];
dataCenter
.
removeEventListener
(
item
,
this
.
on
Data
Mutated
,
this
);
dataCenter
.
removeEventListener
(
item
,
this
.
on
Text
Mutated
,
this
);
}
this
.
_registeredEvents
.
splice
(
0
);
};
Label
.
prototype
.
onDataMutated
=
function
(
e
)
{
_super
.
prototype
.
_setText
.
call
(
this
,
dataCenter
.
formatString
(
this
.
_originText
,
this
.
_escapes
));
};
return
Label
;
}(
TextField
));
...
...
@@ -12631,18 +12665,20 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
_viewCache
=
{};
_this
.
name
=
'game-stage'
;
stage
.
width
=
stage
.
viewRect
.
width
;
stage
.
height
=
stage
.
viewRect
.
height
;
_this
.
_stage
=
stage
;
_this
.
_dataCenter
=
dataCenter
;
_this
[
'percentWidth'
]
=
100
;
_this
[
'percentHeight'
]
=
100
;
_this
.
percentWidth
=
100
;
_this
.
percentHeight
=
100
;
_this
.
mouseEnabled
=
false
;
var
blackLayer
=
_this
.
_blackLayer
=
new
Rect
();
_this
.
addChild
(
_this
.
_sceneContainer
=
new
StackContainer
());
_this
.
addChild
(
blackLayer
);
_this
.
addChild
(
_this
.
_popupContainer
=
new
StackContainer
(
false
));
_this
.
addChild
(
_this
.
_toast
=
new
Toast
(
_this
));
blackLayer
[
'percentWidth'
]
=
100
;
blackLayer
[
'percentHeight'
]
=
100
;
blackLayer
.
percentWidth
=
100
;
blackLayer
.
percentHeight
=
100
;
blackLayer
.
visible
=
false
;
blackLayer
.
fillColor
=
0
;
blackLayer
.
alpha
=
0.7
;
...
...
@@ -12830,12 +12866,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var
_a
=
config
.
options
,
containerID
=
_a
.
containerID
,
designWidth
=
_a
.
designWidth
,
designHeight
=
_a
.
designHeight
,
frameRate
=
_a
.
frameRate
,
scaleMode
=
_a
.
scaleMode
,
rendererType
=
_a
.
rendererType
;
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
();
stage
.
addEventListener
(
Event
.
ON_INIT_STAGE
,
function
()
{
exports
.
gameStage
=
new
GameStage
(
stage
);
setGlobalContext
({
gameStage
:
exports
.
gameStage
});
stage
.
addChild
(
exports
.
gameStage
);
setTimeout
(
function
()
{
exports
.
gameStage
.
launch
(
config
,
onAssetsProgress
,
onAssetsComplete
);
});
resolve
(
exports
.
gameStage
);
...
...
@@ -12903,6 +12939,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports
.
getTexture
=
getTexture
;
exports
.
globalEvent
=
globalEvent
;
exports
.
globalLoader
=
globalLoader
;
exports
.
htmlToPureText
=
htmlToPureText
;
exports
.
httpRequest
=
httpRequest
;
exports
.
importCJSCode
=
importCJSCode
;
exports
.
importUMDCode
=
importUMDCode
;
...
...
debug/engine.js.map
View file @
e0aba4ed
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/2d/ui/ScrollContainer.ts
View file @
e0aba4ed
import
Container
from
"../display/Container"
;
import
Graphics
from
"../graphics/Graphics"
;
import
{
MouseEvent
}
from
"../events/MouseEvent"
;
import
{
Event
}
from
"../events/Event"
;
import
{
MouseEvent
}
from
"../events/MouseEvent"
;
import
{
Event
}
from
"../events/Event"
;
// import Tween from "../../tweenSimple/Tween";
...
...
@@ -62,7 +62,7 @@ export class ScrollContainer extends Container {
* 最小鼠标滑动距离
* @type {number}
*/
private
minDis
:
number
=
2
;
private
minDis
:
number
=
0
;
/**
* 遮罩对象
* @property maskObj
...
...
@@ -309,8 +309,8 @@ export class ScrollContainer extends Container {
}
s
.
speed
=
0
;
s
.
isMouseDownState
=
1
;
}
else
if
(
e
.
type
==
MouseEvent
.
MOUSE_MOVE
)
{
}
else
if
(
e
.
type
==
MouseEvent
.
MOUSE_MOVE
)
{
if
(
s
.
isMouseDownState
==
0
)
return
;
if
(
s
.
isMouseDownState
==
1
)
{
s
.
dispatchEvent
(
Event
.
ON_SCROLL_START
);
}
...
...
src/zeroing/behavior-runtime/Process.ts
View file @
e0aba4ed
...
...
@@ -78,7 +78,12 @@ export class Process {
}
}
else
{
const
scriptResult
=
await
this
.
_executeMetaScript
(
''
,
args
,
metaConfig
);
const
subProcessResult
=
await
this
.
_executeSubProcess
(
scriptResult
.
type
,
scriptResult
.
payload
);
let
subProcessResult
;
if
(
this
.
_meta
.
sub
&&
Object
.
keys
(
this
.
_meta
.
sub
).
length
>
1
)
{
subProcessResult
=
await
this
.
_executeSubProcess
(
scriptResult
.
type
,
scriptResult
.
payload
);
}
else
{
subProcessResult
=
scriptResult
;
}
result
=
await
this
.
_executeNextProcess
(
subProcessResult
.
type
,
subProcessResult
.
payload
);
}
...
...
src/zeroing/decorators/auto-adjust.ts
View file @
e0aba4ed
...
...
@@ -5,6 +5,7 @@
*/
import
{
Event
}
from
"../../2d/events"
;
import
{
Stage
}
from
"../../2d/display"
;
/**
* 应用自适应
...
...
@@ -94,7 +95,14 @@ class AdjustProxy {
adjustLayout
()
{
const
that
=
this
.
_host
;
const
{
width
:
pWidth
,
height
:
pHeight
}
=
that
.
parent
;
let
pWidth
,
pHeight
;
//if(that.parent instanceof Stage){
// pWidth = that.parent.desWidth;
// pHeight = that.parent.desHeight;
//}else{
pWidth
=
that
.
parent
.
width
;
pHeight
=
that
.
parent
.
height
;
//}
const
{
width
,
height
}
=
that
;
const
{
percentWidth
,
percentHeight
,
left
,
top
,
right
,
bottom
,
horizonCenter
,
verticalCenter
}
=
this
.
data
;
...
...
src/zeroing/game-warpper/GameStage.ts
View file @
e0aba4ed
...
...
@@ -35,11 +35,13 @@ export class GameStage extends Container {
this
.
name
=
'game-stage'
;
stage
.
width
=
stage
.
viewRect
.
width
;
stage
.
height
=
stage
.
viewRect
.
height
;
this
.
_stage
=
stage
;
this
.
_dataCenter
=
dataCenter
;
this
[
'percentWidth'
]
=
100
;
this
[
'percentHeight'
]
=
100
;
this
.
percentWidth
=
100
;
this
.
percentHeight
=
100
;
this
.
mouseEnabled
=
false
;
let
blackLayer
=
this
.
_blackLayer
=
new
Rect
();
...
...
@@ -49,8 +51,8 @@ export class GameStage extends Container {
this
.
addChild
(
this
.
_popupContainer
=
new
StackContainer
(
false
));
this
.
addChild
(
this
.
_toast
=
new
Toast
(
this
));
blackLayer
[
'percentWidth'
]
=
100
;
blackLayer
[
'percentHeight'
]
=
100
;
blackLayer
.
percentWidth
=
100
;
blackLayer
.
percentHeight
=
100
;
blackLayer
.
visible
=
false
;
blackLayer
.
fillColor
=
0
;
blackLayer
.
alpha
=
0.7
;
...
...
src/zeroing/game-warpper/StackContainer.ts
View file @
e0aba4ed
...
...
@@ -16,8 +16,8 @@ export class StackContainer extends Container {
this
.
_mutex
=
mutex
;
this
[
'percentWidth'
]
=
100
;
this
[
'percentHeight'
]
=
100
;
this
.
percentWidth
=
100
;
this
.
percentHeight
=
100
;
this
.
mouseEnabled
=
false
;
}
...
...
src/zeroing/launcher.ts
View file @
e0aba4ed
...
...
@@ -7,6 +7,7 @@ import {RENDERER_TYPE, StageScaleMode} from "..";
import
{
GameStage
}
from
"./game-warpper"
;
import
{
setGlobalContext
}
from
"./behavior-runtime"
;
import
{
globalLoader
}
from
"../2d/loader/Loader"
;
import
{
Event
}
from
"../2d/events/Event"
;
export
let
gameStage
;
...
...
@@ -40,13 +41,13 @@ export function launchWithConfig(config, onAssetsProgress, onAssetsComplete) {
);
Stage
.
flushAll
();
stage
.
addEventListener
(
Event
.
ON_INIT_STAGE
,
()
=>
{
gameStage
=
new
GameStage
(
stage
);
setGlobalContext
({
gameStage
});
stage
.
addChild
(
gameStage
);
setTimeout
(()
=>
{
gameStage
.
launch
(
config
,
onAssetsProgress
,
onAssetsComplete
);
});
...
...
src/zeroing/utils/utils.ts
View file @
e0aba4ed
...
...
@@ -204,3 +204,17 @@ export function findVariable(name: string, ...contexts) {
}
return
result
;
}
let
el
;
export
function
htmlToPureText
(
htmlText
)
{
if
(
!
el
)
{
el
=
document
.
createElement
(
'div'
);
}
el
.
innerHTML
=
htmlText
;
document
.
body
.
append
(
el
);
let
pureText
=
el
.
innerText
;
document
.
body
.
removeChild
(
el
);
return
pureText
;
}
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