/*:
 * @plugindesc 
 * @author ぬぷ竜
 */
const TutoPath = "pictures/Tutorial/";
Game_Interpreter.prototype.ImageチュートリアルView = function (_title , _image) {
    this.SetPictFIn( PN_TutorialBlack , TutoPath + _image , 0 , 0 , 0 , 0 , 30);
    this.SetPicStr( PN_TutorialCheck , "◆ " + _title , 40 , 20 , 20 , 0);
    this.MovePict(PN_TutorialCheck , true, true , 30);
    Msg_WinX = 300;
    Msg_WinY = 20;
}
Game_Interpreter.prototype.ImageチュートリアルEnd = function () {
    this.MovePict(PN_TutorialBlack , true , true ,30 , 0);
    this.MovePict(PN_TutorialCheck , true , true ,30 , 0);
    Msg_WinPos_Reset();
}
let Tutorial_Flg = false;
let Tutorial_WaitFlame = 0; 
let Tutorial_SetuNo = 0;    
let Tutorial_Mode = 0;      
let Tutorial_flame = 0;     
Game_Interpreter.prototype.Tutorial_Start = function () {
    TalkBtlFlg = true;
    $gameSystem._fastForward = false;
    isFastOff = true;
    MenuStopFlg = false;
    Tutorial_Flg = true;
    IsTutorial = true;
}
Game_Interpreter.prototype.Tutorial_End = function () {
    Tutorial_ClickPN = -1;  
    TalkBtlFlg = false;     
    $gameSystem._fastForward = true;    
    isFastOff = false;      
    Tutorial_Flg = false;   
    IsTutorial = false;
}
const CN_Tutorial_デッキ編集説明 = 1283;
let IsTutorial = false;
Game_Interpreter.prototype.Tutorial_デッキ編集_Start = function () {
    this.Tutorial_Start();
    IsTutorial = true;
    Tutorial_flame = 0;
    Tutorial_SetuNo = 0;
    MenuFlgSwich = true;
    _Albm_Off = true;
    this.NupuMenuStart();
}
Game_Interpreter.prototype.Tutorial_デッキ編集_Update = function () {
    if(Tutorial_WaitFlame > 0) {
        Tutorial_ClickPN = 0;
        this.MenuBaseUpdate(); 
        Tutorial_WaitFlame--;
        return true;
    }
    if(Tutorial_SetuNo == 0) Tutorial_ClickPN = 0;
    if(Tutorial_flame == 60) { 
        this.Tutorial_PicSet("PN_Tuto_Deck_1");
    }
    if(Tutorial_flame == 80) {
        Tutorial_SetuNo = 0;
        this.SetCmnEvent(CN_Tutorial_デッキ編集説明);
    }
    if(Tutorial_SetuNo == 1){
        Tutorial_ClickPN = PNo_MBtn + 1;
        if(overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered()) {
            this.MoveSprite(PN_TutorialBlack , true , true , 10 , 0);
            Tutorial_SetuNo = 2;
            this.SetCmnEvent(CN_Tutorial_デッキ編集説明);
        }
    }
    if(Tutorial_SetuNo == 2){ } 
    if(Tutorial_SetuNo == 3){
        Tutorial_ClickPN = PNo_ItemBtn + 1
        if(overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered()) {
            this.MoveSprite(PN_TutorialBlack , true , true , 10 , 0);
            Tutorial_SetuNo = 2;
            Tutorial_SetuNo = 4;
            this.SetCmnEvent(CN_Tutorial_デッキ編集説明);
        }
    }
    if(Tutorial_SetuNo == 4){ } 
    if(Tutorial_SetuNo == 5){
        Tutorial_ClickPN = PNo_ItemTxt + 0;
        if(overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered()) {
            this.MoveSprite(PN_TutorialBlack , true , true , 10 , 0);
            Tutorial_SetuNo = 6;
            Tutorial_WaitFlame = 20;
        }
    }
    if(Tutorial_SetuNo == 6){
        if(Tutorial_WaitFlame <= 0) Tutorial_SetuNo = 7;
    }
    if(Tutorial_SetuNo == 7) { 
        Tutorial_ClickPN =　PN_IUseBtn;
        if(overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered()) {
            this.MoveSprite(PN_TutorialBlack , true , true , 10 , 0);
            Tutorial_SetuNo = 8;
            return true; 
        }
    }
    if(Tutorial_SetuNo == 8){
        Tutorial_ClickPN = PN_ICancelBtn;
        if(overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered()) {
            if (Menu_ItemMode == 10) return true;
            Tutorial_SetuNo = 3;
            Tutorial_SetuNo = 9;
            this.SetCmnEvent(CN_Tutorial_デッキ編集説明);
        }
    } 
    if(Tutorial_SetuNo == 9) { }
    if(Tutorial_SetuNo == 10) {
        Tutorial_ClickPN = PNo_MTBtn + 1;
        if((overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered())) {
            if (Input.isTriggered('menu') || TouchInput.isCancelled()) {
                return;
            }
            Tutorial_SetuNo = 11;
            this.SetCmnEvent(CN_Tutorial_デッキ編集説明);
            this.MoveSprite(PN_TutorialBlack , true , true , 60 , 0);
            Tutorial_WaitFlame = 20;
            IsTutorial = false;
        }
    }
    if(Tutorial_SetuNo == 11) { }
    if(Tutorial_SetuNo == 12) {
        Menu_EditLayer = 2;
        Tutorial_ClickPN = -1;
        if(overPointerSpCk(PN_deBtn + 3) && TouchInput.isTriggered()) {
            this.Dc_CloseBtn();
            MenuFlame = 0;
            Tutorial_ClickPN = 500;
            Tutorial_SetuNo = 5;
            Tutorial_SetuNo = 13;
            this.SetCmnEvent(CN_Tutorial_デッキ編集説明);
            Tutorial_WaitFlame = 20;
        }
    }
    if (Tutorial_SetuNo == 13) { }
    if (Tutorial_SetuNo == 14) {
        Tutorial_ClickPN = -1;
        MenuFlgSwich = false;
        this.MenuEnd(); 
        this.Tutorial_End(); 
        _Albm_Off = false;
        return false; 
    }
    Tutorial_flame++;
    return true;
}
Game_Interpreter.prototype.Tutorial_PicSet = function (_PicName , _time) {
    _time = typeof _time !== 'undefined' ? _time : 15;
    this.SetSpriteFIn( PN_TutorialBlack , TutoPath + _PicName , 0 , 0 , 0 , 0 , _time);
    Tutorial_WaitFlame = _time;
}
const CN_Tutorial_メール開封説明 = 1285;
Game_Interpreter.prototype.Tutorial_メール開封_Start = function () {
    this.Tutorial_Start();
    IsTutorial = true;
    Tutorial_flame = 0;
    Tutorial_SetuNo = 0;
    MenuFlgSwich = true;
    _Albm_Off = true;
    this.NupuMenuStart();
}
Game_Interpreter.prototype.Tutorial_メール開封_Update = function () {
    if (Tutorial_WaitFlame > 0) {
        Tutorial_ClickPN = 0;
        this.MenuBaseUpdate(); 
        Tutorial_WaitFlame--;
        return true;
    }
    if (Tutorial_Mode == 0) Tutorial_ClickPN = 0;
    if (Tutorial_flame == 60) { 
        this.Tutorial_PicSet("PN_Tuto_Mail_1");
    }
    if (Tutorial_flame == 80) {
        TalkBtlFlg = true;
        Tutorial_SetuNo = 0;
        this.SetCmnEvent(CN_Tutorial_メール開封説明);
    }
    if (Tutorial_SetuNo == 1) {
        Tutorial_ClickPN = PNo_MBtn + 4;
        if(overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered()) {
            this.MoveSprite(PN_TutorialBlack , true , true , 10 , 0);
            Tutorial_SetuNo = 2;
            this.SetCmnEvent(CN_Tutorial_メール開封説明);
            return true;
        }
    }
    if (Tutorial_SetuNo == 2) { } 
    if (Tutorial_SetuNo == 3) {
        Tutorial_ClickPN = PNo_MailBase + 0;
        if(overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered()) {
            this.MoveSprite(PN_TutorialBlack , true , true , 10 , 0);
            Tutorial_SetuNo = 4;
            this.SetCmnEvent(CN_Tutorial_メール開封説明);
            return true;
        }
    }
    if (Tutorial_SetuNo == 4) { } 
    if (Tutorial_SetuNo == 5) { 
        Tutorial_ClickPN = PNo_MailTmp;
        if(overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered()) {
            this.MoveSprite(PN_TutorialBlack , true , true , 10 , 0);
            Tutorial_SetuNo = 6;
            return true;
        }
    }
    if (Tutorial_SetuNo == 6) { 
        Tutorial_ClickPN = PN_MOpenBtn;
        if(overPointerSpCk(Tutorial_ClickPN) && TouchInput.isTriggered()) {
            Tutorial_SetuNo = 7;
            return true;
        }
    }
    if (Tutorial_SetuNo == 7) { 
        Tutorial_ClickPN = -1;
        if(Addres_Opnflame > 10 && TouchInput.isTriggered()) {
            Tutorial_SetuNo = 8;
            this.SetCmnEvent(CN_Tutorial_メール開封説明);
            return true;
        }
    }
    if (Tutorial_SetuNo == 8) {
        MenuStopFlg = true; 
    } 
    if (Tutorial_SetuNo == 9) {
        ViewMailList[MailSelectNo].TmpOpenFlg = true; 
        ViewMailList[MailSelectNo].TmpItemArr = []; 
        Tutorial_ClickPN = -1;
        MenuStopFlg = false;
        MenuFlgSwich = false;
        this.MenuEnd(); 
        this.Tutorial_End(); 
        return false; 
    } 
    Tutorial_flame++;
    return true;
}
let TutorialDgn管理No = 0;
let CN_RDチュートリアル用 = 914;
Game_Interpreter.prototype.Tutorial_ダンジョン_Start = function () {
    if (TutorialDgn管理No == 0) {
        this.Tutorial_PicSet("PN_Tuto_Dgn_1");
    }
    if (TutorialDgn管理No == 1) {
        this.Tutorial_PicSet("PN_Tuto_Dgn_2");
    }
    if (TutorialDgn管理No == 2) {
        this.Tutorial_PicSet("PN_Tuto_Dgn_3");
    }
    if (TutorialDgn管理No == 3) {
        this.Tutorial_PicSet("PN_Tuto_Dgn_4");
    }
    if (TutorialDgn管理No == 4) {
        this.Tutorial_PicSet("PN_Tuto_Dgn_5");
    }
    TutorialDgn管理No++;
}
Game_Interpreter.prototype.Tutorial_ダンジョン_Close = function () {
    this.MoveSprite(PN_TutorialBlack , true , true , 10 , 0);
}
let Tutorial_ClickPN = -1;
Game_Screen.prototype.isPointerInnerSprite = function(_No) {
    if(Tutorial_ClickPN != -1) {
        if(Tutorial_ClickPN != _No) return false;
    }
    for (let i = 0; i <= N_Sprite_L.children.length - 1; i++) {
        if(N_Sprite_L.children[i].No == _No && N_Sprite_L.children[i].dLayer == N_Sprite_DLayer) {
            return N_Sprite_L.children[i].isIncludePointer();
        }
    }
    for (let i = 0; i <= N_Sprite_M.children.length - 1; i++) {
        if(N_Sprite_M.children[i].No == _No && N_Sprite_M.children[i].dLayer == N_Sprite_DLayer) {
            return N_Sprite_M.children[i].isIncludePointer();
        }
    }
    for (let i = 0; i <= N_Sprite_T.children.length - 1; i++) {
        if(N_Sprite_T.children[i].No == _No && N_Sprite_T.children[i].dLayer == N_Sprite_DLayer) {
            return N_Sprite_T.children[i].isIncludePointer();
        }
    }
    return false;
};
Game_Screen.prototype.isPointerInnerSpriteTm = function(_No) {
    if(Tutorial_ClickPN != -1) {
        if(Tutorial_ClickPN != _No) return false;
    }
    for (let i = 0; i <= N_Sprite_L.children.length - 1; i++) {
        if(N_Sprite_L.children[i].No == _No && N_Sprite_L.children[i].dLayer == N_Sprite_DLayer){
            return N_Sprite_L.children[i].isIncludePointerTm();
        }
    }
    for (let i = 0; i <= N_Sprite_M.children.length - 1; i++) {
        if(N_Sprite_M.children[i].No == _No && N_Sprite_M.children[i].dLayer == N_Sprite_DLayer){
            return N_Sprite_M.children[i].isIncludePointerTm();
        }
    }
    for (let i = 0; i <= N_Sprite_T.children.length - 1; i++) {
        if(N_Sprite_T.children[i].No == _No && N_Sprite_T.children[i].dLayer == N_Sprite_DLayer){
            return N_Sprite_T.children[i].isIncludePointerTm();
        }
    }
    return false;
};
