const VN_DbgNo = 41; 
class DCClass {
    constructor(_title, _UpPic, _DEditArr) {
        this._title = _title; 
        this._UpPic = _UpPic; 
        this._DEditArr = _DEditArr; 
    }
}
class _DEdit {
    constructor(_pName, _VarNo, _ParaArr) {
        this._pName = _pName; 
        this._VarNo = _VarNo; 
        this._ParaArr = _ParaArr; 
    }
}
let DPara1 = new _DEdit("髪型", 113, [0, 1, 2, 3, 4, 5, 6, 7]);
let DPara2 = new _DEdit("顔", 114, [0, 1, 2, 3, 4, 5, 6, 7]);
let DPara3 = new _DEdit("バスト", 117, [0, 1]);
let DPara4 = new _DEdit("メガネ", 116, [0, 1]);
let Chara_Uketuke = new DCClass("受付嬢カスタマイザー", "ReceptionWoman_talk", [DPara1, DPara2, DPara3, DPara4]);
const DbgPicPath = "pictures/Debug/";
const PN_DBase = 145;   
const PN_DTitle = PN_DBase + 1; 
const PN_DCus = PN_DTitle + 1; 
let DbgCFlame = 0
let dePos = new Pos2D(904, 123);
let EditDCClass = Chara_Uketuke; 
Game_Interpreter.prototype.DbgCustumStart = function () {
    this.SetPictFIn(PN_DBase, DbgPicPath + "EditorBack", 0, 0, 30, 0, 15);
    this.SetPicStr(PN_DTitle, EditDCClass._title, 30, 904, 19, 255);
    for (let i = 0; i <= EditDCClass._DEditArr.length - 1; i++) {
        this.SetPicStr(PN_DCus + (10 * i), EditDCClass._DEditArr[i]._pName, 30, dePos._x, dePos._y + (120 * i), 255);
        let _ckvar = $gameVariables.value(EditDCClass._DEditArr[i]._VarNo);
        for (let j = 0; j <= EditDCClass._DEditArr[i]._ParaArr.length - 1; j++) {
            this.SetPict(PN_DCus + (10 * i) + (j + 2), DbgPicPath + "Btn" + (j + 1),
                dePos._x + (j * 60), dePos._y + (120 * i) + 50);
            if (_ckvar == EditDCClass._DEditArr[i]._ParaArr[j]) {
                this.SetPict(PN_DCus + (10 * i) + 1, DbgPicPath + "Selecter",
                    dePos._x + (j * 60), dePos._y + (120 * i) + 50);
            }
        }
    }
    L2dTalkTop(EditDCClass._UpPic);
    L2dFadeMdl(EditDCClass._UpPic, "leftin", 15, "", 1); 
    DbgCFlame = 0;
}
Game_Interpreter.prototype.DbgCustum = function () {
    for (let i = 0; i <= EditDCClass._DEditArr.length - 1; i++) {
        let _OverArr = [];
        for (let j = 0; j <= EditDCClass._DEditArr[i]._ParaArr.length - 1; j++) {
            _OverArr.push(PN_DCus + (10 * i) + (j + 2));
        }
        let _OverPNo = overPointerCkArr(_OverArr);
        if (_OverPNo != -1) {
            let _cno = _OverPNo - (PN_DCus + (10 * i)) - 2;
            if (TouchInput.isTriggered() || TouchInput.isRepeated()) {
                $gameVariables.setValue(EditDCClass._DEditArr[i]._VarNo,
                    EditDCClass._DEditArr[i]._ParaArr[_cno]);
                this.SetPict(PN_DCus + (10 * i) + 1, DbgPicPath + "Selecter",
                    dePos._x + (_cno * 60), dePos._y + (120 * i) + 50);
                L2dFadeMdl(EditDCClass._UpPic, "leftin", 15, "", 1); 
            }
        }
    }
    if (Input.isTriggered('menu') || TouchInput.isCancelled()) {
        this.DbgDelPic();
        L2dAutoFadeOut(EditDCClass._UpPic, 15);
        return false; 
    }
    DbgCFlame++;
    return true; 
}
Game_Interpreter.prototype.DbgDelPic = function () {
    for (let i = PN_DBase; i <= PN_DBase + 100; i++) {
        this.DelPict(i);
    }
}
let Dbg_デッキ変更_OFF = false;
Game_Interpreter.prototype.Dbg_デッキカード追加 = function (_SetCArr) {
    if (!Dbg_デッキ変更_OFF) {
        $gameSystem.DeckArr[$gameSystem.SelDeck] = [];
        for (let i = 0; i <= $gameSystem.DeckArr.length - 1; i++) {
            $gameSystem.DeckArr[i] = [];
        }
        for (let i = 0; i <= 10 - 1; i++) {
            for (let j = 0; j <= _SetCArr.length - 1; j++) {
                $gameSystem.DeckArr[$gameSystem.SelDeck].push(_SetCArr[j]);
            }
        }
    }
    Dbg_デッキ変更_OFF = false;
}
let _ゆどんげカード渡し = function () {
    let _SetCardId = [];
    for (let i = 501; i <= 676; i++) {
        if (MetaChecker($dataWeapons[i] , "ftest" , false) == false) {
            _SetCardId.push(i);
        } else {
            console.log("取得スキップ:" + i);
        }
    }
    console.log(_SetCardId);
    for (let i = 0; i <= _SetCardId.length - 1; i++) {
        $gameParty.gainItem($dataWeapons[_SetCardId[i]], 3, true)
    }
}
let _ゆどんげカード渡し_エロ = function () {
    let _SetCardId = [301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316,
        317, 318, 319, 320, 321, 322, 323];
    for (let i = 0; i <= _SetCardId.length - 1; i++) {
        $gameParty.gainItem($dataWeapons[_SetCardId[i]], 3, true)
    }
}
let _ItemKeepSave = Game_System.prototype.initialize;
Game_System.prototype.initialize = function () { 
    _ItemKeepSave.call(this);
    this.ItemKeepArr = []; 
    this.DeckKeepArr = []; 
    this.WeaponKeepArr = []; 
};
let GameDataKeep = function () {
}
let _チャレンジ序盤カード渡し = function () {
    $gameParty.gainGold(-99999);
    for (let i = 1; i <= $dataItems.length - 1; i++) {
        $gameParty.gainItem($dataItems[i], -999)
    }
    for (let i = 1; i <= $dataWeapons.length - 1; i++) {
        $gameParty.gainItem($dataWeapons[i], -999)
    }
    Deck_初期化();
}
class DbgH {
    constructor(_picName, _setu, _picArr) {
        this._picName = _picName;
        this._setu = _setu;
        this._picArr = _picArr;
    }
}
const DbgHArr = [
    new DbgH("capsule1", "ローマシャ検診", ["capsule1"]),
    new DbgH("peeping1", "着替え盗撮", ["peeping1"]),
    new DbgH("peeping2", "シャワー盗撮", ["peeping2", "romasha_lecture2"]),
    new DbgH("cajua_shower1", "カジュアシャワー", ["cajua_shower1", "cajua_shower2", "cajua_shower3", "cajua_shower4", "cajua_shower5"]),
    new DbgH("vanila_shower1", "バニラシャワー", ["vanila_shower1", "vanila_shower2", "vanila_shower3"]),
    new DbgH("cajua_toilet1", "カジュアトイレ", ["cajua_toilet1"]),
    new DbgH("vanila_toilet1", "バニラトイレ", ["vanila_toilet1"]),
    new DbgH("romasha_pool1", "ロマーシャプール", ["romasha_pool1", "romasha_pool2"]),
    new DbgH("romasha_supina001", "ロマーシャ：スピナ",
        ["romasha_supina001", "romasha_supina002", "romasha_supina003", "romasha_supina004",
            "romasha_supina005", "romasha_supina006", "romasha_supina007", "romasha_supina008",
            "romasha_supina009", "romasha_supina010", "romasha_supina011"]
    ),
    new DbgH("romasha_onsen1", "ロマーシャ：風呂", ["romasha_onsen1"]),
    new DbgH("romasha_tv1", "ロマーシャテレビ", ["romasha_tv1", "romasha_tv2"]),
    new DbgH("romasha_tvBARA1", "テレビ企画", ["romasha_tvBARA1"]),
    new DbgH("romasha_test04", "ロマーシャ手コキ_test", ["romasha_test04"]),
    new DbgH("romasha_test05", "ロマーシャパイズリ_test", ["romasha_test05"]),
    new DbgH("romasha_test06", "ロマーシャフェラ_test", ["romasha_test06"]),
    new DbgH("romasha_test07", "ロマーシャオナニー_test", ["romasha_test07"]),
    new DbgH("romasha_test08", "ロマーシャ・スピナ２", ["romasha_test08"]),
    new DbgH("romasha_ICE", "ロマーシャアイス", ["romasha_ICE"]),
    new DbgH("romasha_test09", "ジジ：風呂", ["romasha_test09"]),
    new DbgH("zizi_birh", "ジジ：出産", ["zizi_birh", "zizi_birh2", "zizi_birh3", "zizi_birh4"]),
    new DbgH("romasha_test12", "ジジ：ゴブリン", ["romasha_test12"])
]
let dhPos = new Pos2D(800, 163);
let _dhviewFlg = false; 
let _dhSelNo = -1; 
let _dhviewNo = 0; 
Game_Interpreter.prototype.DbgHSStart = function () {
    this.SetPictFIn(PN_DBase, DbgPicPath + "EditorBack", 0, 0, 30, 0, 15);
    this.SetPicStr(PN_DTitle, "１枚絵ビューワー", 30, 904, 19, 255);
    this.SetPicStr(PN_DCus + 0, "■ここに説明が出ます", 18, 924, 110, 255);
    for (let i = 0; i <= DbgHArr.length - 1; i++) {
        let _xpox = i % 4;
        let _ypos = Math.floor(i / 4);
        this.SetPict(PN_DCus + i + 1, DbgHArr[i]._picName,
            dhPos._x + (_xpox * 153), dhPos._y + (91 * _ypos), 255, 10, 10);
    }
}
let _dhvFlame = 0;
Game_Interpreter.prototype.DbgHSView = function () {
    if (_dhvFlame < 10) { 
        _dhvFlame++
        return true;
    }
    if (_dhviewFlg) {
        this.DbgHSViewMode();
        return true; 
    }
    let _OverArr = [];
    for (let i = 0; i <= DbgHArr.length - 1; i++) {
        _OverArr.push(PN_DCus + i + 1);
    }
    this.PicCngColorArr(_OverArr, [0, 0, 0, 0], 0);
    let _OverPNo = overPointerCkArr(_OverArr);
    if (_OverPNo != -1) {
        this.PicCngColor(_OverPNo, [100, 100, 100, 0], 0);
        let ckNo = _OverPNo - (PN_DCus + 1);
        this.SetPicStr(PN_DCus + 0, DbgHArr[ckNo]._setu, 18, 924, 110, 255);
        if (TouchInput.isTriggered()) {
            _dhSelNo = ckNo;
            _dhviewFlg = true;
            _dhviewNo = 0;
            _dhvFlame = 0;
        }
    }
    if (Input.isTriggered('menu') || TouchInput.isCancelled()) {
        this.DbgDelPic();
        return false; 
    }
    return true; 
}
Game_Interpreter.prototype.DbgHSViewMode = function () {
    if (_dhvFlame > 3) {
        this.SetPict(PN_DCus + 80, DbgHArr[_dhSelNo]._picArr[_dhviewNo], 0, 0);
        if (TouchInput.isTriggered()) {
            _dhviewNo++;
            if (DbgHArr[_dhSelNo]._picArr.length <= _dhviewNo) {
                _dhvFlame = 0;
                _dhviewFlg = false;
                this.MovePict(PN_DCus + 80, 0, 0, 10, 0);
            }
            _dhvFlame = 0;
        }
    }
    _dhvFlame++;
}
