• R/O
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscaphegui翻訳comegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

無人機動兵器ダンジョン探索ゲーム JAVAベース


Commit MetaInfo

修订版30 (tree)
时间2015-06-26 02:17:32
作者manjihq

Log Message

ステータステキストの表示内容が40文字未満なら空白を補充して体裁を整えるようにした

更改概述

差异

--- CarnageHack2/trunk/src/CarnageHack/OkeStatusWindow.java (revision 29)
+++ CarnageHack2/trunk/src/CarnageHack/OkeStatusWindow.java (revision 30)
@@ -162,22 +162,44 @@
162162 }
163163
164164 /**
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+ /**
165180 * 表示更新
166181 */
167182 public void update() {
168183 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()
170185 + " 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));
181203 switch (oke.get_status()) {
182204 case Oke.STATUS_NORMAL:
183205 status_str = "NORMAL";
@@ -243,17 +265,25 @@
243265 status_str = "??";
244266 break;
245267 }
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));
257287 tracepanel.set_trace(oke);
258288 }
259289