/*:
* RS_ExitDialog.js
* @plugindesc RS_ExitDialog.js
* @author biud436
*
* @param Dialog Name
* @desc Information Dialog
* @default Information Dialog
*
* @param Show Custom Dialog Name
* @desc Show Custom Dialog Name
* @default false
*
* @param Exit Message
* @desc Exit Message
* @default Do you want to exit the game?
*
* @param OK Button
* @desc OK Button's Name
* @default OK
*
* @param Cancel Button
* @desc Cancel Button's Name
* @default Cancel
*
* @help
*
* =============================================================================
* Plugin Commands
* =============================================================================
* This plugin does not provide plugin commands
*
* =============================================================================
* Setup
* =============================================================================
* 1. Add the Notification plugin(cordova-plugin-dialogs) on Intel XDK.
* 2. Edit an index.html file in your Game Directory using Text Editor such as Notepad++
* You have to contain Cordova Script into <body> statement, It looks like this.
* ...
* <body style="background-color: black">
* <script type="text/javascript" src="cordova.js"></script>
* <script type="text/javascript" src="js/libs/pixi.js"></script>
* ...
* </body>
* =============================================================================
* Change Log
* =============================================================================
* 2016.05.29 - The incorrect character fixed.
*/
(function() {
var parameters = PluginManager.parameters('RS_ExitDialog');
var message = String(parameters['Exit Message'] || "Do you want to exit the game?" );
var okBtn = String(parameters['OK Button'] || "OK" );
var cancelBtn = String(parameters['Cancel Button'] || "Cancel" );
var dialogName = String(parameters['Dialog Name'] || "Information Dialog" );
var isCustomDialog = Boolean(parameters['Show Custom Dialog Name'] === 'true')
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", SceneManager.detectScene, false);
}
function onBackKeyDown() {
if(!Utils.isMobileDevice) return false;
if(!isCustomDialog) dialogName = $dataSystem.gameTitle || "Information Dialog";
navigator.notification.confirm(message, function(index) {
if(index === 1) {
SceneManager.exit();
}
}, dialogName, [okBtn, cancelBtn]);
}
SceneManager.detectScene = function() {
if(SceneManager._scene instanceof Scene_Map) {
SceneManager.goto(Scene_Title);
} else if(SceneManager._scene instanceof Scene_Title) {
onBackKeyDown();
} else {
SceneManager._scene.popScene();
}
}
})();
현재 이 플러그인을 사용하고있는데 모바일 디바이스에서 취소키를 누르면 반드시 타이틀 화면을 거쳐서
어플을 종료할거냐고 묻는데, 이 과정에서 타이틀 화면을 안 거치고 어디서든 취소키를 입력해서
어플을 종료할거냐 물어보도록 수정하는 방법이 궁금합니다.