1 | <!-- $Id$ --> |
---|
2 | |
---|
3 | <!DOCTYPE html> |
---|
4 | <html lang="ja"> |
---|
5 | <head> |
---|
6 | <meta charset="UTF-8"></meta> |
---|
7 | <title>PyCodeShooter β</title> |
---|
8 | <link rel="stylesheet" href="/tdiary.css" type="text/css" media="all" /> |
---|
9 | <script type="text/javascript" charset="UTF-8" src="shooter/bullet.js"></script> |
---|
10 | <script type="text/javascript" charset="UTF-8" src="shooter/barrage.js"></script> |
---|
11 | <script type="text/javascript" charset="UTF-8" src="shooter/action.js"></script> |
---|
12 | <script type="text/javascript" charset="UTF-8" src="shooter/trooper.js"></script> |
---|
13 | <script type="text/javascript" charset="UTF-8" src="shooter/system.js"></script> |
---|
14 | <script type="text/javascript"> |
---|
15 | var titleIntervalId = 0; |
---|
16 | |
---|
17 | function start(id, list) { |
---|
18 | var player = { |
---|
19 | "name": document.getElementById("name").value, |
---|
20 | "size": parseInt(document.getElementById("size").value), |
---|
21 | "speed": parseInt(document.getElementById("speed").value), |
---|
22 | "hitpoint": parseInt(document.getElementById("hitpoint").value), |
---|
23 | "shotsize": parseInt(document.getElementById("shotsize").value), |
---|
24 | "shotinterval": parseInt(document.getElementById("shotinterval").value), |
---|
25 | "shotspeed": parseInt(document.getElementById("shotspeed").value), |
---|
26 | "shotlevel": parseInt(document.getElementById("shotlevel").value) |
---|
27 | }; |
---|
28 | |
---|
29 | for (var n in player) { |
---|
30 | if (n == "name") |
---|
31 | continue; |
---|
32 | if (!player[n] || player[n] < 0) { |
---|
33 | debugMsgSet("Invalid Input Data"); |
---|
34 | return; |
---|
35 | } |
---|
36 | } |
---|
37 | |
---|
38 | document.onkeydown = function (ev) { setKeyDown(ev.keyCode); }; |
---|
39 | document.onkeyup = function (ev) { setKeyUp(ev.keyCode); }; |
---|
40 | document.onkeypress = function (ev) { setKeyPress(ev.charCode); }; |
---|
41 | |
---|
42 | initGame(document.getElementById("screen"), id, list[id], player); |
---|
43 | } |
---|
44 | |
---|
45 | function initControlPanel(list) { |
---|
46 | var cp = document.getElementById("controlpanel"); |
---|
47 | var sel = "<select id=\"bossSelection\">"; |
---|
48 | |
---|
49 | for (var id in list) { |
---|
50 | sel += "<option value=\"" + id + "\"" + ">" + list[id].name + "</option>"; |
---|
51 | } |
---|
52 | |
---|
53 | cp.innerHTML = sel + "</select>"; |
---|
54 | |
---|
55 | document.getElementById("bossSelection").onchange = function (ev) { |
---|
56 | if (titleIntervalId) { |
---|
57 | clearInterval(titleIntervalId); |
---|
58 | titleIntervalId = 0; |
---|
59 | } |
---|
60 | start(this[this.selectedIndex].value, list); |
---|
61 | }; |
---|
62 | } |
---|
63 | |
---|
64 | function debugMsgSet(msg) { |
---|
65 | document.getElementById("message").innerHTML = msg; |
---|
66 | } |
---|
67 | |
---|
68 | function debugMsgAdd(msg) { |
---|
69 | document.getElementById("message").innerHTML += msg; |
---|
70 | } |
---|
71 | |
---|
72 | window.onload = function () { |
---|
73 | var screen = document.getElementById("screen"); |
---|
74 | var ctx = screen.getContext("2d"); |
---|
75 | var logoimg = document.getElementById("logoimg"); |
---|
76 | |
---|
77 | var x = (screen.width - logoimg.width) / 2; |
---|
78 | var y = 0; |
---|
79 | var titlePos = screen.height / 2 - logoimg.height / 2; |
---|
80 | titleIntervalId = setInterval(function() { |
---|
81 | drawScreen(ctx, "source-over", "rgba(8,8,8,0.5)", screen.width, screen.height); |
---|
82 | updateBackground(ctx, screen.width, screen.height, 1, "#AAF", 10); |
---|
83 | ctx.drawImage(logoimg, x, y); |
---|
84 | |
---|
85 | if (++y > titlePos) |
---|
86 | y = titlePos; |
---|
87 | }, 20); |
---|
88 | |
---|
89 | var req = new XMLHttpRequest(); |
---|
90 | req.open("GET", document.getElementById("api").value, false); |
---|
91 | req.send(null); |
---|
92 | |
---|
93 | initControlPanel(JSON.parse(req.responseText).result); |
---|
94 | }; |
---|
95 | </script> |
---|
96 | </head> |
---|
97 | |
---|
98 | <body> |
---|
99 | <h1 class="title">PyCodeShooter β</h1> |
---|
100 | |
---|
101 | <div class="main"> |
---|
102 | <div style="margin-left: 5em; margin-right: 5em; font-style: italic;"> |
---|
103 | <p>Pythonista éã®ææŠã«ïŒ</p> |
---|
104 | <p style="text-align: right;">åã¯ïŒèããããã...</p> |
---|
105 | </div> |
---|
106 | |
---|
107 | <div class="day"> |
---|
108 | <h2><span class="title">PyCodeShooter β</span></h2> |
---|
109 | <div class="body"> |
---|
110 | <div class="section"> |
---|
111 | <form> |
---|
112 | <h3><span class="sanchor">â </span> ææŠãã!</h3> |
---|
113 | <p id="controlpanel">Now loading...</p> |
---|
114 | <p> |
---|
115 | åå: <input type="text" value="Player" size="8" id="name" /> |
---|
116 | èä¹
æ§: <input type="text" value="15" size="3" id="hitpoint" /> |
---|
117 | <br /> |
---|
118 | <canvas id="screen" width="320" height="480"></canvas> |
---|
119 | <input type="hidden" value="5" id="size" /> |
---|
120 | <input type="hidden" value="5" id="speed" /> |
---|
121 | <input type="hidden" value="7" id="shotsize" /> |
---|
122 | <input type="hidden" value="5" id="shotspeed" /> |
---|
123 | <input type="hidden" value="10" id="shotinterval" /> |
---|
124 | <input type="hidden" value="3" id="shotlevel" /> |
---|
125 | <input type="hidden" value="/etc/pycodebattler/?mode=json" id="api" /> |
---|
126 | <img src="logo.png" style="visibility: hidden;" id="logoimg" /> |
---|
127 | </p> |
---|
128 | </form> |
---|
129 | </div> |
---|
130 | </div> |
---|
131 | </div> |
---|
132 | </div> |
---|
133 | |
---|
134 | <div class="sidebar"> |
---|
135 | <div style="margin: 1em;"> |
---|
136 | <p>ããã¯äœ?</p> |
---|
137 | <ul style="font-size: small;"> |
---|
138 | <li><a href="/etc/pycodebattler/">PyCodeBattler</a> ã«ç»é²ããã Python ã³ãŒããšæŠããŸã</li> |
---|
139 | </ul> |
---|
140 | |
---|
141 | <p>æäœ</p> |
---|
142 | <dl style="font-size: small;"> |
---|
143 | <dt>â ã·ã§ãã:</dt> |
---|
144 | <dd>z</dd> |
---|
145 | <dt>â 移åé床é
延:</dt> |
---|
146 | <dd>x</dd> |
---|
147 | <dt>â 匟åæ¿:</dt> |
---|
148 | <dd>c</dd> |
---|
149 | <dt>â 巊移å:</dt> |
---|
150 | <dd>â or h</dd> |
---|
151 | <dt>â äžç§»å:</dt> |
---|
152 | <dd>â or j</dd> |
---|
153 | <dt>â äžç§»å:</dt> |
---|
154 | <dd>â or k</dd> |
---|
155 | <dt>â å³ç§»å:</dt> |
---|
156 | <dd>â or l</dd> |
---|
157 | </dl> |
---|
158 | |
---|
159 | <p>ã·ã¹ãã ã¡ãã»ãŒãž</p> |
---|
160 | <span id="message" style="font-size: small;"><br /></span> |
---|
161 | |
---|
162 | <p>泚æ</p> |
---|
163 | <ul style="font-size: small;"> |
---|
164 | <li>ãã©ã¡ãŒã¿ç調æŽäžã«ã€ãïŒãã£ã©ã®åŒ·ãã匟å¹çãå€ãã£ããããå¯èœæ§ããããŸã</li> |
---|
165 | <li>Chrome æšå¥šã§ãïŒFirefox ã ãšéãïŒIE ã ãšå€ååããŸãã</li> |
---|
166 | </ul> |
---|
167 | |
---|
168 | <p>TODO</p> |
---|
169 | <ul style="font-size: small;"> |
---|
170 | <li>åäœãã¿ãŒã³ãå¢ãã</li> |
---|
171 | <li>匟å¹ãã¿ãŒã³ãå¢ãã</li> |
---|
172 | <li>ãã </li> |
---|
173 | <li>ã¹ã³ã¢ãªã³ã°</li> |
---|
174 | <li>ãã¯ãŒã¢ããã¢ã€ãã </li> |
---|
175 | <li>æµ/èªæ©ã«ç»åãšã</li> |
---|
176 | <li>ã¡ãã¥ãŒãäœãšããã</li> |
---|
177 | <li>æç Ž/ãã¡ãŒãž/æ»äº¡æåäœãåã</li> |
---|
178 | </ul> |
---|
179 | |
---|
180 | <p>ãœãŒã¹ã³ãŒã</p> |
---|
181 | <ul style="font-size: small;"> |
---|
182 | <li><a href="http://trac.atzm.org/index.cgi/browser/pycodeshooter">pycodeshooter</a></li> |
---|
183 | </ul> |
---|
184 | </div> |
---|
185 | </div> |
---|
186 | </body> |
---|
187 | </html> |
---|