var GAME_SCREEN_SIZE = { x: 1024, y: 768 }; var MODE_RELEASE = "release"; var MODE_DEBUG = "debug"; var runMode = MODE_RELEASE; function isDebugMode() { // console.log("debug mode ? " + runMode); return runMode == MODE_DEBUG ? true : false; } var BG_IMAGE_FILENAMES = [ "windows_wallpaper", "wait_wallpaper", ]; var POPUP_IMGE_FILENAMES = [ "program_control_center_after_transfer", "program_control_center", "pen", "itq_testsheet", "itq_testsheet_id", "itq_testsheet_small", "personal_id", "popup_check_info", "popup_select_version", "popup_register", "popup_check_saved_file", "popup_check_success_transfer", "popup_save_filename", "popup_save_folder", ]; var BUTTON_WIDTH = 80; var BUTTON_HEIGHT = 140; var Simulator = { create: function() { // game.stage.backgroundColor = "#4d4d4d"; this.bgImage = game.add.sprite(game.world.centerX, game.world.centerY, 'windows_wallpaper'); this.bgImage.anchor.set(0.5); this.initVariables(); this.loadPopupImages(); // keyboard shortcut this.keyboardShortcut = new KeyboardShortcut(); this.keyboardShortcut.addCallback( Phaser.KeyCode.LEFT, // keyCode null, // keyDownHandler (function() { this.prev(); }).bind(this), // keyUpHandler "keyboard_test" // callerClassName ); this.keyboardShortcut.addCallback( Phaser.KeyCode.RIGHT, // keyCode null, // keyDownHandler (function() { this.next(); }).bind(this), // keyUpHandler "keyboard_test" // callerClassName ); // this.fullscreenButton = new FullscreenButton(); // buttons var buttonSetting = new RoundRectButtonSetting(50, game.world.centerY, BUTTON_WIDTH, BUTTON_HEIGHT, 20); this.prevButton = new RoundRectButton(buttonSetting, null, "<", (function() { this.prev(); }).bind(this)); this.prevButton.addShortcutText("←"); buttonSetting.x = game.world.width - BUTTON_WIDTH + 30; this.nextButton = new RoundRectButton(buttonSetting, null, ">", (function() { this.next(); }).bind(this)); this.nextButton.addShortcutText("→"); // tip var textStyle = { font: "bold 34px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" }; this.tipText = game.add.text(game.world.centerX, game.world.height - 170, "Tip text", textStyle); this.tipText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); this.tipText.stroke = "#333"; this.tipText.strokeThickness = 5; this.tipText.anchor.set(0.5); this.printContents(); }, initVariables: function() { this.stageIndex = 0; this.stageData = [ { tip: "준비물 : 신분증, 수험표, 일반 볼펜\n" + "\n" + "* 초등학생 : 가족관계증명서, 주민등록등초본, 여권 중 하나\n" + "* 볼펜 : 컴퓨터용 싸인펜 (x), 일반 볼펜 (o)", textColor: "yellow", images: [ { name: "personal_id", x: 240, y: 50 }, { name: "itq_testsheet_small", x: 550, y: 50 }, { name: "pen", x: 830, y: 50 }, ], rectangles: [ ] }, { tip: "1. 작업할 프로그램(파워포인트, 아래한글, 엑셀)을 실행\n" + "2. 키보드 입력과 마우스가 잘 되는지 확인하고 프로그램 종료\n" + "\n" + "* 다른 프로그램은 절대로 실행하지 마세요. (특히 인터넷)", textColor: "orangered", images: [ ], rectangles: [ ] }, { tip: "[KOAS 수험자용] 프로그램 실행", images: [ ], rectangles: [ { x: 81, y: 617, width: 70, height: 70 }, ] }, { tip: "1. 수험표의 수험번호를 정확히 입력\n" + "2. [확인] 버튼 클릭", images: [ { name: "itq_testsheet_id", x: 550, y: 80 }, { name: "popup_register", x: 550, y: 250 }, ], rectangles: [ { x: 494, y: 383, width: 203, height: 30 }, { x: 537, y: 460, width: 82, height: 40 }, ] }, { tip: "1. 아래한글 또는 MS 오피스 버전 선택\n" + "2. [확인] 버튼 클릭", images: [ { name: "popup_select_version", x: 550, y: 220 }, ], rectangles: [ { x: 474, y: 388, width: 150, height: 20 }, { x: 554, y: 473, width: 86, height: 40 }, ] }, { tip: "1. 내 수험 정보가 정확하게 입력이 되었는지 자세히 확인\n" + "2. [확인] 버튼 클릭", images: [ { name: "popup_check_info", x: 550, y: 190 }, ], rectangles: [ { x: 402, y: 314, width: 290, height: 116 }, { x: 530, y: 462, width: 82, height: 42 }, ] }, { tip: "대기 화면으로 바뀜\n" + "\n" + "* 기다리는 동안 감독관 선생님의 설명을 듣습니다.", textColor: "lightblue", bg: "wait_wallpaper", images: [ ], rectangles: [ ] }, { tip: "시험지를 받으면 가장 먼저 볼펜으로\n" + "자신의 [수험번호]와 [이름]을 적기", textColor: "orangered", bg: "wait_wallpaper", images: [ { name: "itq_testsheet_id", x: 520, y: 60 }, { name: "itq_testsheet", x: 510, y: 240 }, ], rectangles: [ { x: 595, y: 355, width: 125, height: 30 }, { x: 740, y: 355, width: 100, height: 30 }, ] }, { tip: "시험 시간이 되면 대기 화면에서 바탕 화면으로 바뀜\n" + "\n" + "* 화면 오른쪽 위에 시험 관리 프로그램이 실행되고 있습니다.", textColor: "lightblue", images: [ { name: "program_control_center", x: 890, y: 10 }, ], rectangles: [ { x: 760, y: 3, width: 256, height: 305 }, ] }, { tip: "문서 작업할 프로그램을 실행한 후, 가장 먼저 → 파일 저장 ←\n" + "\n" + "[폴더] : 라이브러리 > 문서 > ITQ ∥ 내 문서 > ITQ\n" + "[파일 이름] : 수험번호-이름 (예 : 70150012-홍길동)", textColor: "orangered", images: [ { name: "program_control_center", x: 890, y: 10 }, { name: "popup_save_filename", x: 520, y: 200 }, ], rectangles: [ ] }, { tip: "파일 저장 후, 바탕 화면에서 실행되고 있는\n" + "시험 관리 프로그램에서 [답안 전송] 버튼 클릭", images: [ { name: "program_control_center", x: 890, y: 10 }, ], rectangles: [ { x: 776, y: 125, width: 223, height: 40 }, ] }, { tip: "저장한 답안 파일이 목록에 잘 보이는지 확인\n" + "\n" + "* 만약에 목록에 안 보일 경우, 폴더와 파일을 확인하세요.\n" + "* 원인을 알 수 없으면 감독관 선생님께 도움을 요청하세요.", textColor: "lightblue", images: [ { name: "program_control_center", x: 890, y: 10 }, { name: "popup_check_saved_file", x: 520, y: 110 }, ], rectangles: [ { x: 382, y: 251, width: 262, height: 30 }, ] }, { tip: "1. 답안 파일 선택\n" + "2. [답안전송] 버튼 클릭", images: [ { name: "program_control_center", x: 890, y: 10 }, { name: "popup_check_saved_file", x: 520, y: 110 }, ], rectangles: [ { x: 382, y: 251, width: 187, height: 30 }, { x: 493, y: 410, width: 136, height: 40 }, ] }, { tip: "1. 답안 전송 상태 확인\n" + "* 전송 실패시 감독관 선생님께 도움을 요청하세요.\n" + "\n" + "2. [닫기] 버튼 클릭", images: [ { name: "program_control_center", x: 890, y: 10 }, { name: "popup_check_success_transfer", x: 520, y: 110 }, ], rectangles: [ { x: 632, y: 251, width: 86, height: 30 }, { x: 631, y: 410, width: 83, height: 40 }, ] }, { tip: "본격적으로 문서 작업 시작\n" + "\n" + "* 페이지 작업 완료시 / 시험 끝나기 5분전 / 시험 끝날 때마다\n" + "* 문서 파일을 저장하고, 항상 답안 전송도 함께 해주세요.", textColor: "lightblue", images: [ { name: "program_control_center_after_transfer", x: 890, y: 10 }, ], rectangles: [ { x: 776, y: 90, width: 225, height: 26 }, ] }, { tip: "시험 종료시\n" + "1. 시험지에 수험번호와 이름을 잘 적었는지 확인\n" + "2. 시험지는 반드시 책상에 두고 시험장에서 나오기\n" + "* 시험지를 가지고 나오면 부정행위로 → 실격 처리 ← 됩니다.", textColor: "orangered", images: [ { name: "program_control_center", x: 890, y: 10 }, { name: "itq_testsheet", x: 510, y: 200 }, ], rectangles: [ { x: 595, y: 315, width: 125, height: 30 }, { x: 740, y: 315, width: 100, height: 30 }, ] }, ]; // this.stageIndex = 12; this.popupImages = []; this.shownImages = []; this.rectangles = []; }, loadPopupImages: function() { this.popupImages = {}; var count = POPUP_IMGE_FILENAMES.length; for(var i = 0; i < count; i++) { if(POPUP_IMGE_FILENAMES[i].length > 0) this.popupImages[POPUP_IMGE_FILENAMES[i]] = this.makePopupImage(POPUP_IMGE_FILENAMES[i]); } }, makePopupImage: function(filename) { var popupImage = game.add.sprite(0, 0, filename); popupImage.anchor.x = 0.5; popupImage.alpha = 0; return popupImage; }, prev: function() { this.stageIndex--; if(this.stageIndex < 0) this.stageIndex = 0; this.printContents(); }, next: function() { if(this.stageIndex < this.stageData.length - 1) this.stageIndex++; this.printContents(); }, printContents: function() { // console.log(this.stageIndex); var data = this.stageData[this.stageIndex]; this.tipText.text = data.tip; if(data.textColor === undefined) this.tipText.addColor("white", 0); else this.tipText.addColor(data.textColor, 0); if(data.bg === undefined) this.bgImage.loadTexture("windows_wallpaper"); else this.bgImage.loadTexture(data.bg); this.hideAllShownImages(); var imageCount = data.images.length; for(var i = 0; i < imageCount; i++) { var imageData = data.images[i]; this.showImage(imageData.name, imageData.x, imageData.y); } this.removeRectangles(); if(this.stageIndex == 0) { this.prevButton.setInputEnabled(false); this.nextButton.setInputEnabled(true); } else if(this.stageIndex == this.stageData.length - 1) { this.prevButton.setInputEnabled(true); this.nextButton.setInputEnabled(false); } else { this.prevButton.setInputEnabled(true); this.nextButton.setInputEnabled(true); } var rectangleCount = data.rectangles.length; for(var i = 0; i < rectangleCount; i++) { var rectangle = data.rectangles[i]; this.drawRectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height); } }, showImage: function(imageName, x, y) { var image = this.popupImages[imageName]; image.x = x; image.y = y; image.alpha = 1; this.shownImages.push(image); }, hideAllShownImages: function() { var count = this.shownImages.length; for(var i = 0; i < count; i++) { var image = this.shownImages.pop(); image.alpha = 0; } }, removeRectangles: function() { var count = this.rectangles.length; for(var i = 0; i < count; i++) this.rectangles.pop().destroy(); }, drawRectangle: function(x, y, width, height) { var index = this.rectangles.length; var graphics = game.add.graphics(0, 0); graphics.lineStyle(4, 0xff0000); graphics.drawRect(0, 0, width, height); var rectSprite = game.add.sprite(x, y, graphics.generateTexture()); graphics.destroy(); this.rectangles.push(rectSprite); } }