Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
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-libs
Commits
2e028e08
Commit
2e028e08
authored
May 12, 2020
by
张超
🎱
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of gitlab2.dui88.com:laoqifeng/zeroing-libs into dev
parents
38d1747c
1d743af7
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
263 additions
and
18 deletions
+263
-18
add-custom-module.json
dist/processes/view/add-custom-module.json
+1
-1
pop-dialog.json
dist/processes/view/pop-dialog.json
+1
-1
push-dialog.json
dist/processes/view/push-dialog.json
+11
-1
push-scene.json
dist/processes/view/push-scene.json
+6
-1
show-toast.json
dist/processes/view/show-toast.json
+13
-0
wave.json
dist/scripts/wave.json
+1
-1
index.js
.../zeroing-libs/src/process/view/add-custom-module/index.js
+5
-0
index.js
dist/zeroing-libs/src/script/wave/index.js
+176
-0
index.ts
src/process/view/add-custom-module/index.ts
+3
-1
index.ts
src/process/view/pop-dialog/index.ts
+1
-1
index.ts
src/process/view/push-dialog/index.ts
+3
-1
meta.json
src/process/view/push-dialog/meta.json
+10
-0
index.ts
src/process/view/push-scene/index.ts
+2
-1
meta.json
src/process/view/push-scene/meta.json
+5
-0
meta.json
src/process/view/show-toast/meta.json
+13
-0
index.ts
src/script/wave/index.ts
+12
-9
No files found.
dist/processes/view/add-custom-module.json
View file @
2e028e08
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
"complete"
"complete"
],
],
"id"
:
"add-custom-module"
,
"id"
:
"add-custom-module"
,
"script"
:
"var p = engine.findVariable('props', args, props);
\n
engine.addCustomModule(props.id, props.target
|| target, p);
\n
next('complete');
\n
"
,
"script"
:
"var p = engine.findVariable('props', args, props);
\n
var id = engine.findVariable('id', args, props);
\n
var target2 = engine.findVariable('target', args, props);
\n
engine.addCustomModule(id, target2
|| target, p);
\n
next('complete');
\n
"
,
"group"
:
"view"
,
"group"
:
"view"
,
"type"
:
"builtin"
"type"
:
"builtin"
}
}
dist/processes/view/pop-dialog.json
View file @
2e028e08
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
"complete"
"complete"
],
],
"id"
:
"pop-dialog"
,
"id"
:
"pop-dialog"
,
"script"
:
"var effect = engine.findVariable('effect', args, props);
\n
var effectParams = engine.findVariable('effectParams', args, props);
\n
var options = {
\n
effect: effect,
\n
effectParams: effectParams,
\n
};
\n
if (props.closeAll) {
\n
engine.gameStage.popupContainer.popAll(options);
\n
}
\n
else {
\n
engine.gameStage.popupContainer.pop(options);
\n
}
\n
next('complete');
\n
"
,
"script"
:
"var effect = engine.findVariable('effect', args, props);
\n
var effectParams = engine.findVariable('effectParams', args, props);
\n
var options = {
\n
effect: effect,
\n
effectParams: effectParams,
\n
};
\n
if (props.closeAll) {
\n
engine.gameStage.popupContainer.popAll(
null,
options);
\n
}
\n
else {
\n
engine.gameStage.popupContainer.pop(options);
\n
}
\n
next('complete');
\n
"
,
"group"
:
"view"
,
"group"
:
"view"
,
"type"
:
"builtin"
"type"
:
"builtin"
}
}
dist/processes/view/push-dialog.json
View file @
2e028e08
...
@@ -6,11 +6,21 @@
...
@@ -6,11 +6,21 @@
"alias"
:
"目标视图名"
,
"alias"
:
"目标视图名"
,
"type"
:
"string"
"type"
:
"string"
},
},
"showLoading"
:
{
"alias"
:
"展示加载视图"
,
"type"
:
"boolean"
,
"default"
:
true
},
"center"
:
{
"center"
:
{
"alias"
:
"是否居中展示"
,
"alias"
:
"是否居中展示"
,
"type"
:
"boolean"
,
"type"
:
"boolean"
,
"default"
:
true
"default"
:
true
},
},
"modalAlpha"
:
{
"alias"
:
"模态层透明度"
,
"type"
:
"number"
,
"default"
:
0.7
},
"effect"
:
{
"effect"
:
{
"alias"
:
"动效"
,
"alias"
:
"动效"
,
"type"
:
"enum"
,
"type"
:
"enum"
,
...
@@ -48,7 +58,7 @@
...
@@ -48,7 +58,7 @@
"complete"
"complete"
],
],
"id"
:
"push-dialog"
,
"id"
:
"push-dialog"
,
"script"
:
"var effect = engine.findVariable('effect', args, props);
\n
var effectParams = engine.findVariable('effectParams', args, props);
\n
if (!props.viewName) {
\n
console.log('没有设置视图名');
\n
next('exception', '没有设置视图名');
\n
}
\n
else {
\n
var gameStage_1 = engine.gameStage;
\n
gameStage_1.instantiateView(props.viewName).then(function (view) {
\n
if (view) {
\n
var options = {
\n
effect: effect,
\n
effectParams: effectParams,
\n
center: props.center
,
\n
};
\n
gameStage_1.popupContainer.push(view, options);
\n
}
\n
});
\n
next('complete');
\n
}
\n
"
,
"script"
:
"var effect = engine.findVariable('effect', args, props);
\n
var effectParams = engine.findVariable('effectParams', args, props);
\n
var showLoading = engine.findVariable('showLoading', args, props);
\n
if (!props.viewName) {
\n
console.log('没有设置视图名');
\n
next('exception', '没有设置视图名');
\n
}
\n
else {
\n
var gameStage_1 = engine.gameStage;
\n
gameStage_1.instantiateView(props.viewName, true, showLoading).then(function (view) {
\n
if (view) {
\n
var options = {
\n
effect: effect,
\n
effectParams: effectParams,
\n
center: props.center,
\n
modalAlpha: props.modalAlpha
,
\n
};
\n
gameStage_1.popupContainer.push(view, options);
\n
}
\n
});
\n
next('complete');
\n
}
\n
"
,
"group"
:
"view"
,
"group"
:
"view"
,
"type"
:
"builtin"
"type"
:
"builtin"
}
}
dist/processes/view/push-scene.json
View file @
2e028e08
...
@@ -6,6 +6,11 @@
...
@@ -6,6 +6,11 @@
"alias"
:
"目标视图名"
,
"alias"
:
"目标视图名"
,
"type"
:
"string"
"type"
:
"string"
},
},
"showLoading"
:
{
"alias"
:
"展示加载视图"
,
"type"
:
"boolean"
,
"default"
:
true
},
"replace"
:
{
"replace"
:
{
"alias"
:
"是否替换场景"
,
"alias"
:
"是否替换场景"
,
"type"
:
"boolean"
,
"type"
:
"boolean"
,
...
@@ -36,7 +41,7 @@
...
@@ -36,7 +41,7 @@
"complete"
"complete"
],
],
"id"
:
"push-scene"
,
"id"
:
"push-scene"
,
"script"
:
"var replace = engine.findVariable('replace', args, props);
\n
var effect = engine.findVariable('effect', args, props);
\n
var effectParams = engine.findVariable('effectParams', args, props);
\n
if (!props.viewName) {
\n
console.log('没有设置视图名');
\n
next('exception', '没有设置视图名');
\n
}
\n
else {
\n
var gameStage_1 = engine.gameStage;
\n
gameStage_1.instantiateView(props.viewName
).then(function (view) {
\n
if (view) {
\n
var options = {
\n
effect: effect,
\n
effectParams: effectParams,
\n
};
\n
if (replace) {
\n
gameStage_1.sceneContainer.replace(view, options);
\n
}
\n
else {
\n
gameStage_1.sceneContainer.push(view, options);
\n
}
\n
}
\n
});
\n
next('complete');
\n
}
\n
"
,
"script"
:
"var replace = engine.findVariable('replace', args, props);
\n
var effect = engine.findVariable('effect', args, props);
\n
var effectParams = engine.findVariable('effectParams', args, props);
\n
var showLoading = engine.findVariable('showLoading', args, props);
\n
if (!props.viewName) {
\n
console.log('没有设置视图名');
\n
next('exception', '没有设置视图名');
\n
}
\n
else {
\n
var gameStage_1 = engine.gameStage;
\n
gameStage_1.instantiateView(props.viewName, true, showLoading
).then(function (view) {
\n
if (view) {
\n
var options = {
\n
effect: effect,
\n
effectParams: effectParams,
\n
};
\n
if (replace) {
\n
gameStage_1.sceneContainer.replace(view, options);
\n
}
\n
else {
\n
gameStage_1.sceneContainer.push(view, options);
\n
}
\n
}
\n
});
\n
next('complete');
\n
}
\n
"
,
"group"
:
"view"
,
"group"
:
"view"
,
"type"
:
"builtin"
"type"
:
"builtin"
}
}
dist/processes/view/show-toast.json
View file @
2e028e08
...
@@ -13,6 +13,19 @@
...
@@ -13,6 +13,19 @@
"default"
:
10
,
"default"
:
10
,
"alias"
:
"边距"
"alias"
:
"边距"
},
},
"paddingH"
:
{
"type"
:
"number"
,
"alias"
:
"横向边距"
},
"paddingV"
:
{
"type"
:
"number"
,
"alias"
:
"纵向边距"
},
"borderRadius"
:
{
"type"
:
"number"
,
"default"
:
10
,
"alias"
:
"圆角半径"
},
"duration"
:
{
"duration"
:
{
"type"
:
"number"
,
"type"
:
"number"
,
"default"
:
1000
,
"default"
:
1000
,
...
...
dist/scripts/wave.json
View file @
2e028e08
...
@@ -46,5 +46,5 @@
...
@@ -46,5 +46,5 @@
}
}
},
},
"id"
:
"wave"
,
"id"
:
"wave"
,
"code"
:
"
\"
use strict
\"
;
\n
Object.defineProperty(exports,
\"
__esModule
\"
, { value: true });
\n
var Wave = (function (_super) {
\n
__extends(Wave, _super);
\n
function Wave() {
\n
var _this = _super !== null && _super.apply(this, arguments) || this;
\n
_this.duration = 1000;
\n
_this.waveMethod = 'rotate';
\n
_this.loop = -1;
\n
_this.autoPlay = true;
\n
_this.revert = false;
\n
_this._oldProps = {};
\n
return _this;
\n
}
\n
Wave.prototype.mounted = function () {
\n
this._startTime = 0;
\n
engine.copyProp(this._oldProps, this.host, oldPropFields);
\n
if (this.autoPlay) {
\n
this.play();
\n
}
\n
};
\n
Wave.prototype.sleep = function () {
\n
if (this.revert) {
\n
this.revertProps();
\n
}
\n
};
\n
Wave.prototype.update = function (t) {
\n
if (this._playing) {
\n
if (!this._startTime) {
\n
this._startTime = t;
\n
}
\n
var _a = this, duration = _a.duration, waveParams = _a.waveParams, _waveAlgorithm = _a._waveAlgorithm, host = _a.host, _oldProps = _a._oldProps;
\n
var pass = (t - this._startTime) % duration;
\n
var r = pass / duration * PI2;
\n
var loopCounting = Math.floor((t - this._startTime) / duration);
\n
if (loopCounting != this._loopCounting) {
\n
this._loopCounting = loopCounting;
\n
if (this.onLoopEnd()) {
\n
r = PI2;
\n
}
\n
}
\n
var t2 = void 0;
\n
if (this.ratio) {
\n
var ratio = this.ratio.split(',').map(function (item) { return parseFloat(item); });
\n
if (ratio.length === 2) {
\n
var begin = ratio[0], end = ratio[1];
\n
if (end >= begin) {
\n
var tr = r / PI2;
\n
if (tr >= begin && tr < end) {
\n
t2 = r / (end - begin);
\n
}
\n
else {
\n
t2 = 0;
\n
}
\n
}
\n
else {
\n
t2 = 0;
\n
}
\n
}
\n
else {
\n
t2 = 0;
\n
}
\n
}
\n
else {
\n
t2 = r;
\n
}
\n
var params = waveParams ? (waveParams.split(',').map(function (item) { return parseFloat(item); })) : [];
\n
var props = _waveAlgorithm.apply(void 0, __spreadArrays(params, [t2]));
\n
if (props.hasOwnProperty('x')) {
\n
host.x = (props.x || 0) + _oldProps.x;
\n
}
\n
if (props.hasOwnProperty('y')) {
\n
host.y = (props.y || 0) + _oldProps.y;
\n
}
\n
if (props.hasOwnProperty('sx')) {
\n
host.scaleX = props.sx;
\n
}
\n
if (props.hasOwnProperty('sy')) {
\n
host.scaleY = props.sy;
\n
}
\n
if (props.hasOwnProperty('r')) {
\n
host.rotation = props.r;
\n
}
\n
}
\n
};
\n
Wave.prototype.onLoopEnd = function () {
\n
if (this.loop < 0) {
\n
}
\n
else if (this._loopCounting < this.loop) {
\n
}
\n
else {
\n
this._playing = false;
\n
return true;
\n
}
\n
};
\n
Wave.prototype.play = function () {
\n
this._loopCounting = 0;
\n
this._playing = true;
\n
this._startTime = 0;
\n
};
\n
Wave.prototype.stop = function (revert) {
\n
if (revert === void 0) { revert = false; }
\n
this._playing = false;
\n
if (revert) {
\n
this.revertProps();
\n
}
\n
};
\n
Wave.prototype.revertProps = function () {
\n
for (var key in this._oldProps) {
\n
var prop = this._oldProps[key];
\n
if (typeof prop === 'object') {
\n
engine.injectProp(this.host[key], prop);
\n
}
\n
else {
\n
this.host[key] = prop;
\n
}
\n
}
\n
};
\n
Wave.prototype.onModify = function (value, key, oldValue) {
\n
switch (key) {
\n
case 'waveMethod':
\n
this._waveAlgorithm = waveLibs[this.waveMethod];
\n
break;
\n
}
\n
};
\n
Wave.id = 'wave';
\n
__decorate([
\n
engine.dirtyFieldTrigger
\n
], Wave.prototype,
\"
waveMethod
\"
, void 0);
\n
return Wave;
\n
}(engine.ScriptBase));
\n
exports.default = Wave;
\n
var PI2 = Math.PI * 2;
\n
var oldPropFields = {
\n
x: 'x',
\n
y: 'y',
\n
scaleX: 'scaleX',
\n
scaleY: 'scaleY',
\n
alpha: 'alpha',
\n
rotation: 'rotation',
\n
};
\n
var cos = Math.cos, sin = Math.sin, PI = Math.PI;
\n
var waveLibs = {
\n
round: function (radius, t) {
\n
return { x: cos(t) * radius, y: sin(t) * radius };
\n
},
\n
cosWave: function (h, t) {
\n
return { x: cos(t) * h, y: 0 };
\n
},
\n
sinWave: function (h, t) {
\n
h = h || 1;
\n
return { x: 0, y: sin(t) * h };
\n
},
\n
rotate: function (t) {
\n
return { r: 360 * t / PI / 2 };
\n
},
\n
shake: function (angle, count, t) {
\n
return { r: sin(t * count) * angle };
\n
},
\n
breath: function (scale, t) {
\n
if (scale === void 0) { scale = 0.1; }
\n
return { sx: sin(t) * scale + 1, sy: -sin(t + PI / 4) * scale + 1 };
\n
},
\n
zoom: function (scale, t) {
\n
if (scale === void 0) { scale = 0.1; }
\n
return { sx: sin(t) * scale + 1, sy: sin(t) * scale + 1 };
\n
},
\n
fade: function (base, t) {
\n
if (base === void 0) { base = 1; }
\n
return { alpha: (sin(t) + 1) * 0.5
+ base };
\n
},
\n
};
\n
"
"code"
:
"
\"
use strict
\"
;
\n
Object.defineProperty(exports,
\"
__esModule
\"
, { value: true });
\n
var Wave = (function (_super) {
\n
__extends(Wave, _super);
\n
function Wave() {
\n
var _this = _super !== null && _super.apply(this, arguments) || this;
\n
_this.duration = 1000;
\n
_this.waveMethod = 'rotate';
\n
_this.loop = -1;
\n
_this.autoPlay = true;
\n
_this.revert = false;
\n
_this._oldProps = {};
\n
return _this;
\n
}
\n
Wave.prototype.mounted = function () {
\n
this._startTime = 0;
\n
engine.copyProp(this._oldProps, this.host, oldPropFields);
\n
if (this.autoPlay) {
\n
this.play();
\n
}
\n
};
\n
Wave.prototype.sleep = function () {
\n
if (this.revert) {
\n
this.revertProps();
\n
}
\n
};
\n
Wave.prototype.update = function (t) {
\n
if (this._playing) {
\n
if (!this._startTime) {
\n
this._startTime = t;
\n
}
\n
var _a = this, duration = _a.duration, waveParams = _a.waveParams, _waveAlgorithm = _a._waveAlgorithm, host = _a.host, _oldProps = _a._oldProps;
\n
var pass = (t - this._startTime) % duration;
\n
var r = pass / duration * PI2;
\n
var loopCounting = Math.floor((t - this._startTime) / duration);
\n
if (loopCounting != this._loopCounting) {
\n
this._loopCounting = loopCounting;
\n
if (this.onLoopEnd()) {
\n
r = PI2;
\n
}
\n
}
\n
var t2 = void 0;
\n
if (this.ratio) {
\n
var ratio = this.ratio.split(',').map(function (item) { return parseFloat(item); });
\n
if (ratio.length === 2) {
\n
var begin = ratio[0], end = ratio[1];
\n
if (end >= begin) {
\n
var tr = r / PI2;
\n
if (tr >= begin && tr < end) {
\n
t2 = r / (end - begin);
\n
}
\n
else {
\n
t2 = 0;
\n
}
\n
}
\n
else {
\n
t2 = 0;
\n
}
\n
}
\n
else {
\n
t2 = 0;
\n
}
\n
}
\n
else {
\n
t2 = r;
\n
}
\n
var params = waveParams ? (waveParams.split(',').map(function (item) { return parseFloat(item); })) : [];
\n
var props = _waveAlgorithm.apply(void 0, __spreadArrays(params, [t2]));
\n
if (props.hasOwnProperty('x')) {
\n
host.x = (props.x || 0) + _oldProps.x;
\n
}
\n
if (props.hasOwnProperty('y')) {
\n
host.y = (props.y || 0) + _oldProps.y;
\n
}
\n
if (props.hasOwnProperty('sx')) {
\n
host.scaleX = props.sx;
\n
}
\n
if (props.hasOwnProperty('sy')) {
\n
host.scaleY = props.sy;
\n
}
\n
if (props.hasOwnProperty('r')) {
\n
host.rotation = props.r;
\n
}
\n
if (props.hasOwnProperty('alpha')) {
\n
host.alpha = props.alpha;
\n
}
\n
}
\n
};
\n
Wave.prototype.onLoopEnd = function () {
\n
if (this.loop < 0) {
\n
}
\n
else if (this._loopCounting < this.loop) {
\n
}
\n
else {
\n
this._playing = false;
\n
return true;
\n
}
\n
};
\n
Wave.prototype.play = function () {
\n
this._loopCounting = 0;
\n
this._playing = true;
\n
this._startTime = 0;
\n
};
\n
Wave.prototype.stop = function (revert) {
\n
if (revert === void 0) { revert = false; }
\n
this._playing = false;
\n
if (revert) {
\n
this.revertProps();
\n
}
\n
};
\n
Wave.prototype.revertProps = function () {
\n
for (var key in this._oldProps) {
\n
var prop = this._oldProps[key];
\n
if (typeof prop === 'object') {
\n
engine.injectProp(this.host[key], prop);
\n
}
\n
else {
\n
this.host[key] = prop;
\n
}
\n
}
\n
};
\n
Wave.prototype.onModify = function (value, key, oldValue) {
\n
switch (key) {
\n
case 'waveMethod':
\n
this._waveAlgorithm = waveLibs[this.waveMethod];
\n
break;
\n
}
\n
};
\n
Wave.id = 'wave';
\n
__decorate([
\n
engine.dirtyFieldTrigger
\n
], Wave.prototype,
\"
waveMethod
\"
, void 0);
\n
return Wave;
\n
}(engine.ScriptBase));
\n
exports.default = Wave;
\n
var PI2 = Math.PI * 2;
\n
var oldPropFields = {
\n
x: 'x',
\n
y: 'y',
\n
scaleX: 'scaleX',
\n
scaleY: 'scaleY',
\n
alpha: 'alpha',
\n
rotation: 'rotation',
\n
};
\n
var cos = Math.cos, sin = Math.sin, PI = Math.PI;
\n
var waveLibs = {
\n
round: function (radius, t) {
\n
return { x: cos(t) * radius, y: sin(t) * radius };
\n
},
\n
cosWave: function (h, t) {
\n
return { x: cos(t) * h, y: 0 };
\n
},
\n
sinWave: function (h, t) {
\n
h = h || 1;
\n
return { x: 0, y: sin(t) * h };
\n
},
\n
rotate: function (t) {
\n
return { r: 360 * t / PI / 2 };
\n
},
\n
shake: function (angle, count, t) {
\n
return { r: sin(t * count) * angle };
\n
},
\n
breath: function (scale, t) {
\n
if (scale === void 0) { scale = 0.1; }
\n
return { sx: sin(t) * scale + 1, sy: -sin(t + PI / 4) * scale + 1 };
\n
},
\n
zoom: function (scale, t) {
\n
if (scale === void 0) { scale = 0.1; }
\n
return { sx: sin(t) * scale + 1, sy: sin(t) * scale + 1 };
\n
},
\n
fade: function (base, scale, t) {
\n
if (base === void 0) { base = 0; }
\n
if (scale === void 0) { scale = 1; }
\n
return { alpha: (sin(t) + 1) * 0.5 * scale
+ base };
\n
},
\n
};
\n
"
}
}
dist/zeroing-libs/src/process/view/add-custom-module/index.js
0 → 100644
View file @
2e028e08
var
p
=
engine
.
findVariable
(
'props'
,
args
,
props
);
var
id
=
engine
.
findVariable
(
'id'
,
args
,
props
);
var
target2
=
engine
.
findVariable
(
'target'
,
args
,
props
);
engine
.
addCustomModule
(
id
,
target2
||
target
,
p
);
next
(
'complete'
);
dist/zeroing-libs/src/script/wave/index.js
0 → 100644
View file @
2e028e08
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
Wave
=
(
function
(
_super
)
{
__extends
(
Wave
,
_super
);
function
Wave
()
{
var
_this
=
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
_this
.
duration
=
1000
;
_this
.
waveMethod
=
'rotate'
;
_this
.
loop
=
-
1
;
_this
.
autoPlay
=
true
;
_this
.
revert
=
false
;
_this
.
_oldProps
=
{};
return
_this
;
}
Wave
.
prototype
.
mounted
=
function
()
{
this
.
_startTime
=
0
;
engine
.
copyProp
(
this
.
_oldProps
,
this
.
host
,
oldPropFields
);
if
(
this
.
autoPlay
)
{
this
.
play
();
}
};
Wave
.
prototype
.
sleep
=
function
()
{
if
(
this
.
revert
)
{
this
.
revertProps
();
}
};
Wave
.
prototype
.
update
=
function
(
t
)
{
if
(
this
.
_playing
)
{
if
(
!
this
.
_startTime
)
{
this
.
_startTime
=
t
;
}
var
_a
=
this
,
duration_1
=
_a
.
duration
,
waveParams
=
_a
.
waveParams
,
_waveAlgorithm
=
_a
.
_waveAlgorithm
,
host
=
_a
.
host
,
_oldProps
=
_a
.
_oldProps
;
var
pass
=
(
t
-
this
.
_startTime
)
%
duration_1
;
var
r
=
pass
/
duration_1
*
PI2
;
var
loopCounting
=
Math
.
floor
((
t
-
this
.
_startTime
)
/
duration_1
);
if
(
loopCounting
!=
this
.
_loopCounting
)
{
this
.
_loopCounting
=
loopCounting
;
if
(
this
.
onLoopEnd
())
{
r
=
PI2
;
}
}
var
t2
=
void
0
;
if
(
this
.
ratio
)
{
var
ratio
=
this
.
ratio
.
split
(
','
).
map
(
function
(
item
)
{
return
parseFloat
(
item
);
});
if
(
ratio
.
length
===
2
)
{
var
begin
=
ratio
[
0
],
end
=
ratio
[
1
];
if
(
end
>=
begin
)
{
var
tr
=
r
/
PI2
;
if
(
tr
>=
begin
&&
tr
<
end
)
{
t2
=
r
/
(
end
-
begin
);
}
else
{
t2
=
0
;
}
}
else
{
t2
=
0
;
}
}
else
{
t2
=
0
;
}
}
else
{
t2
=
r
;
}
var
params_1
=
waveParams
?
(
waveParams
.
split
(
','
).
map
(
function
(
item
)
{
return
parseFloat
(
item
);
}))
:
[];
var
props_1
=
_waveAlgorithm
.
apply
(
void
0
,
params_1
.
concat
([
t2
]));
if
(
props_1
.
hasOwnProperty
(
'x'
))
{
host
.
x
=
(
props_1
.
x
||
0
)
+
_oldProps
.
x
;
}
if
(
props_1
.
hasOwnProperty
(
'y'
))
{
host
.
y
=
(
props_1
.
y
||
0
)
+
_oldProps
.
y
;
}
if
(
props_1
.
hasOwnProperty
(
'sx'
))
{
host
.
scaleX
=
props_1
.
sx
;
}
if
(
props_1
.
hasOwnProperty
(
'sy'
))
{
host
.
scaleY
=
props_1
.
sy
;
}
if
(
props_1
.
hasOwnProperty
(
'r'
))
{
host
.
rotation
=
props_1
.
r
;
}
if
(
props_1
.
hasOwnProperty
(
'alpha'
))
{
host
.
alpha
=
props_1
.
alpha
;
}
}
};
Wave
.
prototype
.
onLoopEnd
=
function
()
{
if
(
this
.
loop
<
0
)
{
}
else
if
(
this
.
_loopCounting
<
this
.
loop
)
{
}
else
{
this
.
_playing
=
false
;
return
true
;
}
};
Wave
.
prototype
.
play
=
function
()
{
this
.
_loopCounting
=
0
;
this
.
_playing
=
true
;
this
.
_startTime
=
0
;
};
Wave
.
prototype
.
stop
=
function
(
revert
)
{
if
(
revert
===
void
0
)
{
revert
=
false
;
}
this
.
_playing
=
false
;
if
(
revert
)
{
this
.
revertProps
();
}
};
Wave
.
prototype
.
revertProps
=
function
()
{
for
(
var
key_1
in
this
.
_oldProps
)
{
var
prop
=
this
.
_oldProps
[
key_1
];
if
(
typeof
prop
===
'object'
)
{
engine
.
injectProp
(
this
.
host
[
key_1
],
prop
);
}
else
{
this
.
host
[
key_1
]
=
prop
;
}
}
};
Wave
.
prototype
.
onModify
=
function
(
value
,
key
,
oldValue
)
{
switch
(
key
)
{
case
'waveMethod'
:
this
.
_waveAlgorithm
=
waveLibs
[
this
.
waveMethod
];
break
;
}
};
Wave
.
id
=
'wave'
;
__decorate
([
engine
.
dirtyFieldTrigger
],
Wave
.
prototype
,
"waveMethod"
,
void
0
);
return
Wave
;
}(
engine
.
ScriptBase
));
exports
.
default
=
Wave
;
var
PI2
=
Math
.
PI
*
2
;
var
oldPropFields
=
{
x
:
'x'
,
y
:
'y'
,
scaleX
:
'scaleX'
,
scaleY
:
'scaleY'
,
alpha
:
'alpha'
,
rotation
:
'rotation'
,
};
var
cos
=
Math
.
cos
,
sin
=
Math
.
sin
,
PI
=
Math
.
PI
;
var
waveLibs
=
{
round
:
function
(
radius
,
t
)
{
return
{
x
:
cos
(
t
)
*
radius
,
y
:
sin
(
t
)
*
radius
};
},
cosWave
:
function
(
h
,
t
)
{
return
{
x
:
cos
(
t
)
*
h
,
y
:
0
};
},
sinWave
:
function
(
h
,
t
)
{
h
=
h
||
1
;
return
{
x
:
0
,
y
:
sin
(
t
)
*
h
};
},
rotate
:
function
(
t
)
{
return
{
r
:
360
*
t
/
PI
/
2
};
},
shake
:
function
(
angle
,
count
,
t
)
{
return
{
r
:
sin
(
t
*
count
)
*
angle
};
},
breath
:
function
(
scale
,
t
)
{
if
(
scale
===
void
0
)
{
scale
=
0.1
;
}
return
{
sx
:
sin
(
t
)
*
scale
+
1
,
sy
:
-
sin
(
t
+
PI
/
4
)
*
scale
+
1
};
},
zoom
:
function
(
scale
,
t
)
{
if
(
scale
===
void
0
)
{
scale
=
0.1
;
}
return
{
sx
:
sin
(
t
)
*
scale
+
1
,
sy
:
sin
(
t
)
*
scale
+
1
};
},
fade
:
function
(
base
,
scale
,
t
)
{
if
(
base
===
void
0
)
{
base
=
0
;
}
if
(
scale
===
void
0
)
{
scale
=
1
;
}
return
{
alpha
:
(
sin
(
t
)
+
1
)
*
0.5
*
scale
+
base
};
},
};
src/process/view/add-custom-module/index.ts
View file @
2e028e08
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
*/
*/
let
p
=
engine
.
findVariable
(
'props'
,
args
,
props
);
let
p
=
engine
.
findVariable
(
'props'
,
args
,
props
);
let
id
=
engine
.
findVariable
(
'id'
,
args
,
props
);
let
target2
=
engine
.
findVariable
(
'target'
,
args
,
props
);
engine
.
addCustomModule
(
props
.
id
,
props
.
target
||
target
,
p
);
engine
.
addCustomModule
(
id
,
target2
||
target
,
p
);
next
(
'complete'
);
next
(
'complete'
);
src/process/view/pop-dialog/index.ts
View file @
2e028e08
...
@@ -10,7 +10,7 @@ let options = {
...
@@ -10,7 +10,7 @@ let options = {
effectParams
,
effectParams
,
};
};
if
(
props
.
closeAll
){
if
(
props
.
closeAll
){
engine
.
gameStage
.
popupContainer
.
popAll
(
options
);
engine
.
gameStage
.
popupContainer
.
popAll
(
null
,
options
);
}
else
{
}
else
{
engine
.
gameStage
.
popupContainer
.
pop
(
options
);
engine
.
gameStage
.
popupContainer
.
pop
(
options
);
}
}
...
...
src/process/view/push-dialog/index.ts
View file @
2e028e08
...
@@ -4,19 +4,21 @@
...
@@ -4,19 +4,21 @@
let
effect
=
engine
.
findVariable
(
'effect'
,
args
,
props
);
let
effect
=
engine
.
findVariable
(
'effect'
,
args
,
props
);
let
effectParams
=
engine
.
findVariable
(
'effectParams'
,
args
,
props
);
let
effectParams
=
engine
.
findVariable
(
'effectParams'
,
args
,
props
);
let
showLoading
=
engine
.
findVariable
(
'showLoading'
,
args
,
props
);
if
(
!
props
.
viewName
)
{
if
(
!
props
.
viewName
)
{
console
.
log
(
'没有设置视图名'
);
console
.
log
(
'没有设置视图名'
);
next
(
'exception'
,
'没有设置视图名'
);
next
(
'exception'
,
'没有设置视图名'
);
}
else
{
}
else
{
let
gameStage
=
engine
.
gameStage
;
let
gameStage
=
engine
.
gameStage
;
gameStage
.
instantiateView
(
props
.
viewName
).
then
(
gameStage
.
instantiateView
(
props
.
viewName
,
true
,
showLoading
).
then
(
view
=>
{
view
=>
{
if
(
view
)
{
if
(
view
)
{
let
options
=
{
let
options
=
{
effect
,
effect
,
effectParams
,
effectParams
,
center
:
props
.
center
,
center
:
props
.
center
,
modalAlpha
:
props
.
modalAlpha
,
};
};
gameStage
.
popupContainer
.
push
(
view
,
options
);
gameStage
.
popupContainer
.
push
(
view
,
options
);
}
}
...
...
src/process/view/push-dialog/meta.json
View file @
2e028e08
...
@@ -6,11 +6,21 @@
...
@@ -6,11 +6,21 @@
"alias"
:
"目标视图名"
,
"alias"
:
"目标视图名"
,
"type"
:
"string"
"type"
:
"string"
},
},
"showLoading"
:
{
"alias"
:
"展示加载视图"
,
"type"
:
"boolean"
,
"default"
:
true
},
"center"
:
{
"center"
:
{
"alias"
:
"是否居中展示"
,
"alias"
:
"是否居中展示"
,
"type"
:
"boolean"
,
"type"
:
"boolean"
,
"default"
:
true
"default"
:
true
},
},
"modalAlpha"
:
{
"alias"
:
"模态层透明度"
,
"type"
:
"number"
,
"default"
:
0.7
},
"effect"
:
{
"effect"
:
{
"alias"
:
"动效"
,
"alias"
:
"动效"
,
"type"
:
"enum"
,
"type"
:
"enum"
,
...
...
src/process/view/push-scene/index.ts
View file @
2e028e08
...
@@ -5,13 +5,14 @@
...
@@ -5,13 +5,14 @@
let
replace
=
engine
.
findVariable
(
'replace'
,
args
,
props
);
let
replace
=
engine
.
findVariable
(
'replace'
,
args
,
props
);
let
effect
=
engine
.
findVariable
(
'effect'
,
args
,
props
);
let
effect
=
engine
.
findVariable
(
'effect'
,
args
,
props
);
let
effectParams
=
engine
.
findVariable
(
'effectParams'
,
args
,
props
);
let
effectParams
=
engine
.
findVariable
(
'effectParams'
,
args
,
props
);
let
showLoading
=
engine
.
findVariable
(
'showLoading'
,
args
,
props
);
if
(
!
props
.
viewName
)
{
if
(
!
props
.
viewName
)
{
console
.
log
(
'没有设置视图名'
);
console
.
log
(
'没有设置视图名'
);
next
(
'exception'
,
'没有设置视图名'
);
next
(
'exception'
,
'没有设置视图名'
);
}
else
{
}
else
{
let
gameStage
=
engine
.
gameStage
;
let
gameStage
=
engine
.
gameStage
;
gameStage
.
instantiateView
(
props
.
viewName
).
then
(
gameStage
.
instantiateView
(
props
.
viewName
,
true
,
showLoading
).
then
(
view
=>
{
view
=>
{
if
(
view
)
{
if
(
view
)
{
let
options
=
{
let
options
=
{
...
...
src/process/view/push-scene/meta.json
View file @
2e028e08
...
@@ -6,6 +6,11 @@
...
@@ -6,6 +6,11 @@
"alias"
:
"目标视图名"
,
"alias"
:
"目标视图名"
,
"type"
:
"string"
"type"
:
"string"
},
},
"showLoading"
:
{
"alias"
:
"展示加载视图"
,
"type"
:
"boolean"
,
"default"
:
true
},
"replace"
:
{
"replace"
:
{
"alias"
:
"是否替换场景"
,
"alias"
:
"是否替换场景"
,
"type"
:
"boolean"
,
"type"
:
"boolean"
,
...
...
src/process/view/show-toast/meta.json
View file @
2e028e08
...
@@ -13,6 +13,19 @@
...
@@ -13,6 +13,19 @@
"default"
:
10
,
"default"
:
10
,
"alias"
:
"边距"
"alias"
:
"边距"
},
},
"paddingH"
:
{
"type"
:
"number"
,
"alias"
:
"横向边距"
},
"paddingV"
:
{
"type"
:
"number"
,
"alias"
:
"纵向边距"
},
"borderRadius"
:
{
"type"
:
"number"
,
"default"
:
10
,
"alias"
:
"圆角半径"
},
"duration"
:
{
"duration"
:
{
"type"
:
"number"
,
"type"
:
"number"
,
"default"
:
1000
,
"default"
:
1000
,
...
...
src/script/wave/index.ts
View file @
2e028e08
...
@@ -31,7 +31,7 @@ export default class Wave extends engine.ScriptBase {
...
@@ -31,7 +31,7 @@ export default class Wave extends engine.ScriptBase {
}
}
sleep
():
void
{
sleep
():
void
{
if
(
this
.
revert
)
{
if
(
this
.
revert
)
{
this
.
revertProps
();
this
.
revertProps
();
}
}
}
}
...
@@ -60,17 +60,17 @@ export default class Wave extends engine.ScriptBase {
...
@@ -60,17 +60,17 @@ export default class Wave extends engine.ScriptBase {
let
ratio
=
this
.
ratio
.
split
(
','
).
map
(
item
=>
parseFloat
(
item
));
let
ratio
=
this
.
ratio
.
split
(
','
).
map
(
item
=>
parseFloat
(
item
));
if
(
ratio
.
length
===
2
)
{
if
(
ratio
.
length
===
2
)
{
const
[
begin
,
end
]
=
ratio
;
const
[
begin
,
end
]
=
ratio
;
if
(
end
>=
begin
)
{
if
(
end
>=
begin
)
{
let
tr
=
r
/
PI2
;
let
tr
=
r
/
PI2
;
if
(
tr
>=
begin
&&
tr
<
end
)
{
if
(
tr
>=
begin
&&
tr
<
end
)
{
t2
=
r
/
(
end
-
begin
);
t2
=
r
/
(
end
-
begin
);
}
else
{
}
else
{
t2
=
0
;
t2
=
0
;
}
}
}
else
{
}
else
{
t2
=
0
;
t2
=
0
;
}
}
}
else
{
}
else
{
t2
=
0
;
t2
=
0
;
}
}
}
else
{
}
else
{
...
@@ -94,6 +94,9 @@ export default class Wave extends engine.ScriptBase {
...
@@ -94,6 +94,9 @@ export default class Wave extends engine.ScriptBase {
if
(
props
.
hasOwnProperty
(
'r'
))
{
if
(
props
.
hasOwnProperty
(
'r'
))
{
host
.
rotation
=
props
.
r
;
host
.
rotation
=
props
.
r
;
}
}
if
(
props
.
hasOwnProperty
(
'alpha'
))
{
host
.
alpha
=
props
.
alpha
;
}
}
}
}
}
...
@@ -126,7 +129,7 @@ export default class Wave extends engine.ScriptBase {
...
@@ -126,7 +129,7 @@ export default class Wave extends engine.ScriptBase {
}
}
}
}
revertProps
(){
revertProps
()
{
for
(
let
key
in
this
.
_oldProps
)
{
for
(
let
key
in
this
.
_oldProps
)
{
let
prop
=
this
.
_oldProps
[
key
];
let
prop
=
this
.
_oldProps
[
key
];
if
(
typeof
prop
===
'object'
)
{
if
(
typeof
prop
===
'object'
)
{
...
@@ -189,7 +192,7 @@ const waveLibs = {
...
@@ -189,7 +192,7 @@ const waveLibs = {
return
{
sx
:
sin
(
t
)
*
scale
+
1
,
sy
:
sin
(
t
)
*
scale
+
1
};
return
{
sx
:
sin
(
t
)
*
scale
+
1
,
sy
:
sin
(
t
)
*
scale
+
1
};
},
},
fade
:
function
(
base
=
1
,
t
:
number
):
any
{
fade
:
function
(
base
=
0
,
scale
=
1
,
t
:
number
):
any
{
return
{
alpha
:
(
sin
(
t
)
+
1
)
*
0.5
+
base
};
return
{
alpha
:
(
sin
(
t
)
+
1
)
*
0.5
*
scale
+
base
};
},
},
};
};
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