/*:ja
 * @plugindesc 
 * @author Nupuryu
 *
 * @help 
 */
DataManager.loadDataFile('$Live2dSettingData', 'Live2dSettingData.json');
L2D_LeftPos = -400;     
L2D_RightPos = 400;     
PN_MdlLoadPic = 495;    
PN_L2DView = 124;       
L2DLayerPicCnt = 10;    
L2D_Mode = L2D_PFSMode.Nomal;
let modelSetting = [];
class _L2dDtlSet {
    constructor(_MdlName, _Name, _StartLoad, _ZureX, _ZureY , _VoiceDirName) {
        _StartLoad = typeof _StartLoad !== 'undefined' ? _StartLoad : false;
        _ZureX = typeof _ZureX !== 'undefined' ? _ZureX : 0;
        _ZureY = typeof _ZureY !== 'undefined' ? _ZureY : 0;
        this._MdlName = _MdlName;     
        this._Name = _Name;           
        this._StartLoad = _StartLoad; 
        this._ZureX = _ZureX;         
        this._ZureY = _ZureY;         
        this._VoiceDirName = _VoiceDirName; 
    }
}
let modelSetting_NameGet = function (_MdlName) {
    for (let i = 0; i <= modelSetting.length - 1; i++) {
        if (modelSetting[i]._MdlName == _MdlName) {
            return modelSetting[i]._Name;
        }
    }
}
let Get_Live2DModelSettingData = function (_MdlName) {
    for (let i = 0; i <= modelSetting.length - 1; i++) {
        if (modelSetting[i]._MdlName == _MdlName) {
            return modelSetting[i];
        }
    }
}
var expSetting = [];
class _L2dExpSet {
    constructor(_MdlName, _MtnName, _FaceNo, _LEyeMax, _REyeMax) {
        this._MdlName = _MdlName;
        this._MtnName = _MtnName;
        this._FaceNo = _FaceNo;
        this._LEyeMax = _LEyeMax;
        this._REyeMax = _REyeMax;
    }
}
let seSetting = [];
class _L2dSeSet {
    constructor(_MdlName, _SeName, _VoiceFol) {
        this._MdlName = _MdlName;
        this._SeName = _SeName;
        this._VoiceFol = _VoiceFol
    }
}
let Live2DSetting_NUpdateSc_LoadFlg = false;
let Live2DSetting_NUpdateSc = Game_Interpreter.prototype.NUpdateSc;
Game_Interpreter.prototype.NUpdateSc = function () {
    Live2DSetting_NUpdateSc.call(this);
    if (!Live2DSetting_NUpdateSc_LoadFlg) {
        Live2DSetting_NUpdateSc_LoadFlg = true;
        L2D_MosaicDataArr = [];
        expSetting = [];
        seSetting = [];
        LightMdlSetting = [];
        for (let i = 0; i < $Live2dSettingData.mosaicSetting.length; i++) {
            let mosaicData = $Live2dSettingData.mosaicSetting[i];
            L2D_MosaicMdlAdd(mosaicData.MdlName, mosaicData.ArtMesh, mosaicData.Pix, mosaicData.ZureX, mosaicData.ZureY);
        }
        for (let i = 0; i < $Live2dSettingData.expSetting.length; i++) {
            let expData = $Live2dSettingData.expSetting[i];
            expSetting.push(new _L2dExpSet(expData.MdlFile, expData.MtnFile, expData.FaceNo, expData.LEyeMax, expData.REyeMax));
        }
        for (let i = 0; i < $Live2dSettingData.seSetting.length; i++) {
            let seData = $Live2dSettingData.seSetting[i];
            let MdlData = Get_Live2DModelSettingData(seData.MdlFile);
            let voiceDirName = "";
            if (seData.VoiceFlg) {
                if (MdlData != null){
                    voiceDirName = MdlData._VoiceDirName;
                }
            }
            seSetting.push(new _L2dSeSet(seData.MdlFile, seData.SeFile, voiceDirName));
        }
        // for (let i = 0; i < $Live2dSettingData.lMdlSettings.length; i++) {
        //   LightMdlSetting.push(new _L2dLightMdl(lMdlData.MdlName,lMdlData.MdlName));
        //SettingLightModel();
    }
}
