無人機動兵器ダンジョン探索ゲーム JAVAベース
ステータステキストの表示内容が40文字未満なら空白を補充して体裁を整えるようにした
@@ -162,22 +162,44 @@ | ||
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | + * 文字列の長さを調整 | |
166 | + * | |
167 | + * @param s 入力文字列 | |
168 | + * @return 整形後文字列 | |
169 | + */ | |
170 | + String align_string(String s) { | |
171 | + int nlen = s.length(); | |
172 | + while (nlen < 40) { | |
173 | + s += ' '; | |
174 | + nlen++; | |
175 | + } | |
176 | + return s; | |
177 | + } | |
178 | + | |
179 | + /** | |
165 | 180 | * 表示更新 |
166 | 181 | */ |
167 | 182 | public void update() { |
168 | 183 | String status_str; |
169 | - position.setText("X:" + oke.get_x() + " Y:" + oke.get_y() | |
184 | + status_str = "X:" + oke.get_x() + " Y:" + oke.get_y() | |
170 | 185 | + " Direction:" + oke.get_degree() + " B" + (oke.get_floor() |
171 | - + 1) + "F"); | |
172 | - hp.setText("IFF:" + make_oke_iff() | |
173 | - + " HP:" + oke.get_hp() + "/" + oke.get_max_hp()); | |
174 | - fuel.setText("FUEL:" + oke.get_fuel() + "/" + oke.get_hardware(). | |
175 | - get_fueltank().get_fuel()); | |
176 | - heat.setText("HEAT:" + oke.get_tempture()); | |
177 | - main_bullette.setText("MAIN:" + oke.get_bullette(0)); | |
178 | - sub_bullette.setText("SUB:" + oke.get_bullette(1)); | |
179 | - software.setText("SOFTWARE:" + oke.get_current_software() | |
180 | - + " CHIP X:" + oke.get_chipx() + " Y:" + oke.get_chipy()); | |
186 | + + 1) + "F"; | |
187 | + position.setText(align_string(status_str)); | |
188 | + status_str = "IFF:" + make_oke_iff() | |
189 | + + " HP:" + oke.get_hp() + "/" + oke.get_max_hp(); | |
190 | + hp.setText(align_string(status_str)); | |
191 | + status_str = "FUEL:" + oke.get_fuel() + "/" + oke.get_hardware(). | |
192 | + get_fueltank().get_fuel(); | |
193 | + fuel.setText(align_string(status_str)); | |
194 | + status_str = "HEAT:" + oke.get_tempture(); | |
195 | + heat.setText(align_string(status_str)); | |
196 | + status_str = "MAIN:" + oke.get_bullette(0); | |
197 | + main_bullette.setText(align_string(status_str)); | |
198 | + status_str = "SUB:" + oke.get_bullette(1); | |
199 | + sub_bullette.setText(align_string(status_str)); | |
200 | + status_str = "SOFTWARE:" + oke.get_current_software() | |
201 | + + " CHIP X:" + oke.get_chipx() + " Y:" + oke.get_chipy(); | |
202 | + software.setText(align_string(status_str)); | |
181 | 203 | switch (oke.get_status()) { |
182 | 204 | case Oke.STATUS_NORMAL: |
183 | 205 | status_str = "NORMAL"; |
@@ -243,17 +265,25 @@ | ||
243 | 265 | status_str = "??"; |
244 | 266 | break; |
245 | 267 | } |
246 | - status.setText("STATUS:" + status_str); | |
247 | - option.setText("OPTION:" + ((oke.get_option_status() == Oke.OPTION_USE) | |
248 | - ? "USE" : "NO USE")); | |
249 | - backpack.setText("MOBILITY:" + oke.get_speed() + " BACKPACK:" + oke. | |
250 | - get_backpack_count()); | |
251 | - counterA.setText("A = " + oke.get_counter("A")); | |
252 | - counterB.setText("B = " + oke.get_counter("B")); | |
253 | - counterC.setText("C = " + oke.get_counter("C")); | |
254 | - counterD.setText("D = " + oke.get_counter("D")); | |
255 | - counterE.setText("E = " + oke.get_counter("E")); | |
256 | - counterF.setText("F = " + oke.get_counter("F")); | |
268 | + status.setText(align_string("STATUS:" + status_str)); | |
269 | + status_str = "OPTION:" + ((oke.get_option_status() == Oke.OPTION_USE) | |
270 | + ? "USE" : "NO USE"); | |
271 | + option.setText(align_string(status_str)); | |
272 | + status_str = "MOBILITY:" + oke.get_speed() + " BACKPACK:" + oke. | |
273 | + get_backpack_count(); | |
274 | + backpack.setText(align_string(status_str)); | |
275 | + status_str = "A = " + oke.get_counter("A"); | |
276 | + counterA.setText(align_string(status_str)); | |
277 | + status_str = "B = " + oke.get_counter("B"); | |
278 | + counterB.setText(align_string(status_str)); | |
279 | + status_str = "C = " + oke.get_counter("C"); | |
280 | + counterC.setText(align_string(status_str)); | |
281 | + status_str = "D = " + oke.get_counter("D"); | |
282 | + counterD.setText(align_string(status_str)); | |
283 | + status_str = "E = " + oke.get_counter("E"); | |
284 | + counterE.setText(align_string(status_str)); | |
285 | + status_str = "F = " + oke.get_counter("F"); | |
286 | + counterF.setText(align_string(status_str)); | |
257 | 287 | tracepanel.set_trace(oke); |
258 | 288 | } |
259 | 289 |