var $d4mj_MobileInput = {};
$d4mj_MobileInput.Parameters = PluginManager.parameters('d4mj_MobileInput');
var $MIBTS = [];
(function () {
var MIBTST = JSON.parse($d4mj_MobileInput.Parameters["MIBTS"]);
for (var i = 0; i < MIBTST.length; i++) {
var MIBTSTi1 = JSON.parse(MIBTST[i]);
var MIBTSTi2 = {};
MIBTSTi2.keyval = MIBTSTi1.keyval;
MIBTSTi2.imgup = 'img/system/' + MIBTSTi1.imgup + '.png';
MIBTSTi2.imgdown = 'img/system/' + MIBTSTi1.imgdown + '.png';
MIBTSTi2.x = MIBTSTi1.x * 1;
MIBTSTi2.y = MIBTSTi1.y * 1;
MIBTSTi2.width = MIBTSTi1.width * 1;
MIBTSTi2.height = MIBTSTi1.height * 1;
$MIBTS.push(MIBTSTi2);
}
Graphics._createMIDIVB = function() {
this._MIDIVB = document.createElement('div');
this._MIDIVB.id = 'MIDIVB';
this._MIDIVB.style.background = 'url('+'img/system/' + $d4mj_MobileInput.Parameters['MIDIVBBackground'] +'.png) top left / contain no-repeat';
this._createMIBTS();
this._updateMIDIVB();
document.body.appendChild(this._MIDIVB);
};
Graphics._createMIBTS = function() {
this.MIBTS = [];
for (var i = 0; i < $MIBTS.length; i++) {
this.MIBTS.push(document.createElement('div'));
this.MIBTS[i].id = 'MIBT' + i;
this.MIBTS[i].keyval = $MIBTS[i].keyval;
this.MIBTS[i].imgup = $MIBTS[i].imgup;
this.MIBTS[i].imgdown = $MIBTS[i].imgdown;
this.MIBTS[i].style.background = 'url(' + $MIBTS[i].imgup +') top left / contain no-repeat';
this.MIBTS[i].addEventListener('touchstart', function(e) {
Input._currentState[e.target.keyval] = true;//alert(e.target.id);
e.target.style.background = 'url(' + e.target.imgdown +') top left / contain no-repeat';
}, false);
this.MIBTS[i].addEventListener('touchend', function(e) {
Input._currentState[e.target.keyval] = false;//alert(e.target.id);
e.target.style.background = 'url(' + e.target.imgup +') top left / contain no-repeat';
}, false);
this._MIDIVB.appendChild(this.MIBTS[i]);
}
};
Graphics._updateMIDIVB = function() {
this._MIDIVB.width = $d4mj_MobileInput.Parameters['MIDIVBWidth'] * 1;
this._MIDIVB.height = $d4mj_MobileInput.Parameters['MIDIVBHeight'] * 1;
this._MIDIVB.style.zIndex = 8;
this._centerElement(this._MIDIVB);
this._updateMIBTS();
};
Graphics._updateMIBTS = function() {
for (var i = 0; i < $MIBTS.length; i++) {
this.MIBTS[i].width = $MIBTS[i].width * this._realScale;
this.MIBTS[i].height = $MIBTS[i].height * this._realScale;
this.MIBTS[i].style.zIndex = 9;
this.MIBTS[i].style.position = 'absolute';
this.MIBTS[i].style.margin = 'auto';
this.MIBTS[i].style.top = $MIBTS[i].y * this._realScale + 'px';
this.MIBTS[i].style.left = $MIBTS[i].x * this._realScale + 'px';
this.MIBTS[i].style.right = ($d4mj_MobileInput.Parameters['MIDIVBWidth'] * 1 - ($MIBTS[i].x + $MIBTS[i].width)) * this._realScale + 'px';
this.MIBTS[i].style.bottom = ($d4mj_MobileInput.Parameters['MIDIVBHeight'] * 1 - ($MIBTS[i].y + $MIBTS[i].height)) * this._realScale + 'px';
this.MIBTS[i].style.width = this.MIBTS[i].width + 'px';
this.MIBTS[i].style.height = this.MIBTS[i].height + 'px';
}
};
var Graphics_d4mj_MobileInput_createAllElements = Graphics._createAllElements;
Graphics._createAllElements = function() {
Graphics_d4mj_MobileInput_createAllElements.call(this);
this._createMIDIVB();
};
var Graphics_d4mj_MobileInput_updateAllElements = Graphics._updateAllElements;
Graphics._updateAllElements = function() {
Graphics_d4mj_MobileInput_updateAllElements.call(this);
this._updateMIDIVB();
};
Graphics._updateRealScale = function() {
if (this._stretchEnabled) {
var h = window.innerWidth / $d4mj_MobileInput.Parameters['MIDIVBWidth'] * 1;
var v = window.innerHeight / $d4mj_MobileInput.Parameters['MIDIVBHeight'] * 1;
this._realScale = Math.min(h, v);
} else {
this._realScale = this._scale;
}
};
Scene_Map.prototype.isMenuCalled = function() {
return Input.isTriggered('menu');// || TouchInput.isCancelled();
};
})();//alert($MIBTS[0].imgup);
//下载地址:
//链接:https://pan.baidu.com/s/1kQlCNLbA6_IWfEnDfm_1Nw
//提取码:nieb
//注:只有里面的d4mj_MobileInput.js插件可商用,图片不可商用