OSDN Git Service

ネットワーク関連修正。モニターの機能を強化
[h58pcdgame/GameScriptCoreLibrary.git] / www / index_local_debug.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="X-UA-Compatible" content="IE=9">
5 <meta charset="UTF-8">
6 <title>HTML5Test</title>
7 <style type="text/css">
8         h1, h2, h3 {
9                 margin:0px;
10         }
11         body, textarea {
12                 font-family: Consolas, 'Courier New', Courier, Monaco, monospace;
13                 font-size: 11px;
14                 line-height: 1.2;
15         }
16 </style>
17 <script type="text/javascript" src="./corelib/header.js" charset="UTF-8"></script>
18 <script type="text/javascript">
19
20 var mainManager = null;
21 var dbg = null;
22 onload = function()
23 {
24         var val = localStorage.getItem("savedat");
25         if(val)
26         {
27                 document.getElementById("stageCode").value = val;
28         }
29         
30         //ゲームマネージャー初期化
31         //mainManager = new GameManager();
32         mainManager = document.getElementById('MainArea').InitGameManager();
33         dbg = mainManager.debugText;
34         //最初はグローバルデバッグモードはオフ
35         mainManager.debugText = null;
36         
37         //コールバック指定
38         mainManager.stageStartedEvent = function(stage)
39         {
40                 document.getElementById('MainArea').style.visibility = 'visible';
41         };
42         mainManager.stageStoppedEvent = function(stage)
43         {
44                 document.getElementById('MainArea').style.visibility = 'hidden';
45         };
46         
47         var prev;
48         if(prev = localStorage.getItem("previewStage"))
49         {
50                 localStorage.removeItem("previewStage");
51                 document.getElementById('stageCode').value = (prev);
52                 run();
53         }else
54         {
55                 location.href="editor/index.html";
56         }
57         
58 };
59
60 var run = function(){
61
62         var stage = document.getElementById("stageCode").value;
63         mainManager.loadStageFromLocal(stage);
64 };
65
66 function stop(){
67         mainManager.stopStage();
68 }
69
70 function switchDebug()
71 {
72         if(mainManager.debugText == null)
73         {
74                 mainManager.debugText = dbg;
75                 mainManager.runningStage.debugMode = true;
76                 mainManager.debugOut("Debug enabled.\n");
77         } else{
78                 mainManager.debugOut("Debug disabled.\n");
79                 mainManager.debugText = null;
80                 mainManager.runningStage.debugMode = false
81         }
82 }
83
84 function reload()
85 {
86         localStorage.setItem("previewStage", document.getElementById('stageCode').value);
87         location.reload();
88 }
89
90 </script>
91 </head>
92 <body>
93         <div id="MainArea" style="width: 640px; height: 480px; visibility: hidden"></div>
94         <div id="Resources"></div>
95         <div style="z-index: 1;">
96                 <form><textarea id="DebugText" rows="8" cols="64"></textarea></form>
97                 <input type="button" onclick="run(); return false;" value="ステージの実行/再実行"><input type="button" onclick="stop(); return false;" value="ステージの停止"><input type="button" onclick="switchDebug(); return false;" value="デバッグの有効/無効"><input type="button" onclick="reload(); return false;" value="ページの再読み込み">
98         </div>
99         <div style="display: none;"><form><textarea id="stageCode"></textarea></form></div>
100 </body>
101 </html>