This commit is contained in:
ckcz123 2019-03-20 15:35:17 +08:00
parent a89e397a40
commit cb2e9f4abd
4 changed files with 12 additions and 9 deletions

View File

@ -94,7 +94,7 @@ actions.prototype.doRegisteredAction = function (action) {
var actions = this.actions[action]; var actions = this.actions[action];
if (!actions) return false; if (!actions) return false;
for (var i = 0; i < actions.length; ++i) { for (var i = 0; i < actions.length; ++i) {
if (core.doFunc.apply(this, [actions[i].func].concat(Array.prototype.slice.call(arguments, 1)))) if (core.doFunc.apply(core, [actions[i].func, this].concat(Array.prototype.slice.call(arguments, 1))))
return true; return true;
} }
return false; return false;

View File

@ -69,7 +69,7 @@ control.prototype._setRequestAnimationFrame = function () {
if (b.func) { if (b.func) {
try { try {
if (core.isPlaying() || !b.needPlaying) if (core.isPlaying() || !b.needPlaying)
core.doFunc(b.func, timestamp); core.doFunc(b.func, core.control, timestamp);
} }
catch (e) { catch (e) {
main.log(e); main.log(e);
@ -1257,7 +1257,7 @@ control.prototype.unregisterReplayAction = function (name) {
control.prototype._doReplayAction = function (action) { control.prototype._doReplayAction = function (action) {
for (var i in this.replayActions) { for (var i in this.replayActions) {
try { try {
if (core.doFunc(this.replayActions[i].func, action)) return true; if (core.doFunc(this.replayActions[i].func, this, action)) return true;
} catch (e) { } catch (e) {
main.log(e); main.log(e);
main.log("ERROR in replayActions["+this.replayActions[i].name+"]:已自动注销该项。"); main.log("ERROR in replayActions["+this.replayActions[i].name+"]:已自动注销该项。");
@ -2393,7 +2393,7 @@ control.prototype.unregisterResize = function (name) {
control.prototype._doResize = function (obj) { control.prototype._doResize = function (obj) {
for (var i in this.resizes) { for (var i in this.resizes) {
try { try {
if (core.doFunc(this.resizes[i].func, obj)) return true; if (core.doFunc(this.resizes[i].func, this, obj)) return true;
} catch (e) { } catch (e) {
main.log(e); main.log(e);
main.log("ERROR in resizes["+this.resizes[i].name+"]:已自动注销该项。"); main.log("ERROR in resizes["+this.resizes[i].name+"]:已自动注销该项。");

View File

@ -383,9 +383,12 @@ core.prototype._forwardFunc = function (name, funcname) {
eval("core." + funcname + " = function (" + parameters + ") {\n\treturn core." + name + "." + funcname + "(" + parameters + ");\n}"); eval("core." + funcname + " = function (" + parameters + ") {\n\treturn core." + name + "." + funcname + "(" + parameters + ");\n}");
} }
core.prototype.doFunc = function (func) { core.prototype.doFunc = function (func, _this) {
if (typeof func == 'string') func = core.plugin[func]; if (typeof func == 'string') {
return func.apply(this, Array.prototype.slice.call(arguments, 1)); func = core.plugin[func];
_this = core.plugin;
}
return func.apply(_this, Array.prototype.slice.call(arguments, 2));
} }
/** /**

View File

@ -247,7 +247,7 @@ events.prototype.unregisterSystemEvent = function (type) {
events.prototype.doSystemEvent = function (type, data, callback) { events.prototype.doSystemEvent = function (type, data, callback) {
if (this.systemEvents[type]) { if (this.systemEvents[type]) {
try { try {
return core.doFunc(this.systemEvents[type], data, data, callback); return core.doFunc(this.systemEvents[type], this, data, data, callback);
} }
catch (e) { catch (e) {
main.log(e); main.log(e);
@ -722,7 +722,7 @@ events.prototype.doEvent = function (data, x, y, prefix) {
var type = data.type; var type = data.type;
if (this.actions[type]) { if (this.actions[type]) {
try { try {
return core.doFunc(this.actions[type], data, x, y, prefix); return core.doFunc(this.actions[type], this, data, x, y, prefix);
} }
catch (e) { catch (e) {
main.log(e); main.log(e);