• R/O
  • SSH
  • HTTPS

simyukkuri: 提交


Commit MetaInfo

修订版257 (tree)
时间2015-09-03 22:36:50
作者mimisuke

Log Message

Bug fix.

更改概述

差异

--- branches/test/FoodMaker.java (revision 256)
+++ branches/test/FoodMaker.java (revision 257)
@@ -87,7 +87,7 @@
8787 int foodAmount = 1;
8888 if (o.objType == Obj.Type.YUKKURI) {
8989 Body b = (Body)o;
90- if (b.isCrashed() == true || b.isBaby() == true) {
90+ if (b.isCrashed() || b.isBaby()) {
9191 if (shitCount != 0) {
9292 foodType = Food.type.BITTER;
9393 shitCount = 0;
@@ -176,7 +176,7 @@
176176 }
177177
178178 for (int i = 0; i < foodAmount; i++) {
179- SimYukkuri.mypane.terrarium.addFood(x + 52, y, foodType);
179+ SimYukkuri.mypane.terrarium.addFood(x + 52 + rnd.nextInt(10), y + rnd.nextInt(10), foodType);
180180 }
181181 Cash.delCash(getCost());
182182 return;
--- branches/test/Terrarium.java (revision 256)
+++ branches/test/Terrarium.java (revision 257)
@@ -731,28 +731,33 @@
731731 return new Body(type, x, y, z, age, p1, p2);
732732 }
733733
734- public void addBody(int x, int y, int z, int type, Body.AgeState age, Body p1, Body p2) {
734+ public void buyBody(int x, int y, int z, int type, Body.AgeState age, Body p1, Body p2) {
735735 Body b = makeBody(x, y, z, type, age, p1, p2);
736736 Cash.delCash(b.getPrice(Obj.Price.BUYING));
737737 bodyList.add(b);
738738 }
739739
740- public void addBody(Body b) {
740+ public void buyBody(Body b) {
741741 Cash.delCash(b.getPrice(Obj.Price.BUYING));
742742 bodyList.add(b);
743743 }
744744
745- public void addFood(int x, int y, Food.type type) {
745+ public void buyFood(int x, int y, Food.type type) {
746746 Food f = new Food(x, y, type);
747747 Cash.delCash(f.getPrice(Obj.Price.BUYING));
748748 foodList.add(f);
749749 }
750+
751+ public void addFood(int x, int y, Food.type type) {
752+ Food f = new Food(x, y, type);
753+ foodList.add(f);
754+ }
750755
751756 public void addShit(int x, int y, int z, Body.AgeState ageState) {
752757 shitList.add(new Shit(x, y, z, ageState));
753758 }
754759
755- public void addToy(int x, int y) {
760+ public void buyToy(int x, int y) {
756761 Toy t = new Toy(x, y);
757762 Cash.delCash(t.getPrice(Obj.Price.BUYING));
758763 toyList.add(t);
@@ -764,7 +769,7 @@
764769 shitList.add(s);
765770 }
766771
767- public void addToilet(int x, int y) {
772+ public void buyToilet(int x, int y) {
768773 Toilet t = new Toilet(x, y);
769774 Cash.delCash(t.getPrice(Obj.Price.BUYING));
770775 toiletList.add(t);
@@ -771,7 +776,7 @@
771776
772777 }
773778
774- public void addObjEX( int addObjEX, int x, int y, ObjEX.Direction dir) {
779+ public void buyObjEx( int addObjEX, int x, int y, ObjEX.Direction dir) {
775780 ObjEX o;
776781 switch(addObjEX){
777782 case SimYukkuri.BELTCONVEYOR:
--- branches/test/SimYukkuri.java (revision 256)
+++ branches/test/SimYukkuri.java (revision 257)
@@ -54,7 +54,7 @@
5454 JPanel rootPane = new JPanel();
5555 JPanel buttonPane = new JPanel();
5656 JComboBox<String> s1, s2, s3;
57- static JLabel l1, l2, l3, l4, l5, l6, l7, l8;
57+ static JLabel l1, l2, l3, l4, l5, l6, l7, l8, l9, l10;
5858
5959 JButton saveButton, loadButton, addYukkuriButton, languageButton, pauseButton, showLogButton, nextPageLogButton, clearLogButton;
6060
@@ -84,6 +84,8 @@
8484 l6 = new JLabel(" ");
8585 l7 = new JLabel(" ");
8686 l8 = new JLabel(" ");
87+ l9 = new JLabel(" ");
88+ l10 = new JLabel(" ");
8789 saveButton = new JButton();
8890 loadButton = new JButton();
8991 addYukkuriButton = new JButton();
@@ -127,6 +129,8 @@
127129 buttonPane.add(l6);
128130 buttonPane.add(l7);
129131 buttonPane.add(l8);
132+ buttonPane.add(l9);
133+ buttonPane.add(l10);
130134
131135 // setup my pane
132136 MyMouseListener mml = new MyMouseListener();
@@ -159,7 +163,8 @@
159163
160164 try {
161165 InitLoader.loadSystemInitFile(loader);
162- } catch (NullPointerException e) {
166+ }
167+ catch (NullPointerException e) {
163168 e.printStackTrace();
164169 JOptionPane.showMessageDialog(SimYukkuri.this, "Init file format for system is invalid", SimYukkuri.TITLE, JOptionPane.ERROR_MESSAGE);
165170 System.exit(1);
@@ -167,31 +172,31 @@
167172
168173 // title and version
169174 title.setText(InitLoader.getTitle() + " " + InitLoader.getVersion() + " ");
170-
175+
171176 // initialize foundage
172177 Cash.initFoundage(InitLoader.getFoundage());
173-
174- //pulldown menu1
178+
179+ // pulldown menu1
175180 int numOfMenu = InitLoader.getNumOfMenu(0);
176181 String[] menu = new String[numOfMenu];
177- for (int i=0; i<numOfMenu; i++) {
182+ for (int i = 0; i < numOfMenu; i++) {
178183 menu[i] = InitLoader.getMenu(0, i);
179184 }
180185 s1.setModel(new DefaultComboBoxModel<String>(menu));
181186 int selectedIndex = s1.getSelectedIndex();
182- if(selectedIndex > -1)
187+ if (selectedIndex > -1)
183188 s1.setSelectedIndex(selectedIndex);
184-
185- //pulldown menu2
189+
190+ // pulldown menu2
186191 numOfMenu = InitLoader.getNumOfMenu(1);
187192 menu = new String[numOfMenu];
188- for (int i=0; i<numOfMenu; i++) {
193+ for (int i = 0; i < numOfMenu; i++) {
189194 menu[i] = InitLoader.getMenu(1, i);
190195 }
191196 s3.setModel(new DefaultComboBoxModel<String>(menu));
192197 s3.setSelectedIndex(selectedGameSpeed);
193-
194- //buttons
198+
199+ // buttons
195200 addYukkuriButton.setText(InitLoader.getButton(0));
196201 saveButton.setText(InitLoader.getButton(1));
197202 loadButton.setText(InitLoader.getButton(2));
@@ -198,16 +203,18 @@
198203 showLogButton.setText(InitLoader.getButton(3));
199204 nextPageLogButton.setText(InitLoader.getButton(4));
200205 clearLogButton.setText(InitLoader.getButton(5));
201-
202- //status
206+
207+ // status
203208 l2.setText(InitLoader.getStatus(0));
204- l3.setText(" "+InitLoader.getStatus(1)+": " + "-" + "%");
205- l4.setText(" "+InitLoader.getStatus(2)+": " + "-" + "%");
206- l5.setText(" "+InitLoader.getStatus(3)+": " + "-" + "%");
207- l6.setText(" "+InitLoader.getStatus(4)+": " + "-" + "%");
208- l7.setText(" "+InitLoader.getStatus(5)+": " + "-");
209- l8.setText(" "+InitLoader.getStatus(6)+": " + "-");
210-
209+ l3.setText(" " + InitLoader.getStatus(1) + ": " + "-" + "%");
210+ l4.setText(" " + InitLoader.getStatus(2) + ": " + "-" + "%");
211+ l5.setText(" " + InitLoader.getStatus(3) + ": " + "-" + "%");
212+ l6.setText(" " + InitLoader.getStatus(4) + ": " + "-" + "%");
213+ l7.setText(" " + InitLoader.getStatus(5) + ": " + "-");
214+ l8.setText(" " + InitLoader.getStatus(6) + ": " + "-");
215+ l9.setText(InitLoader.getStatus(7));
216+ l10.setText(" " + InitLoader.getStatus(8) + Integer.toString(Cash.getCash()));
217+
211218 showSubMenu();
212219 }
213220
@@ -630,7 +637,7 @@
630637 foodType = Food.type.FUNGICIDE;
631638 break;
632639 }
633- mypane.terrarium.addFood(x, y, foodType);
640+ mypane.terrarium.buyFood(x, y, foodType);
634641 }
635642 }
636643 break;
@@ -638,7 +645,7 @@
638645 int x = Translate.invX(e.getX(), e.getY(), Toilet.getSizeS(), w, h);
639646 int y = Translate.invY(e.getX(), e.getY(), Toilet.getSizeS() * 2 / 3, w, h);
640647 if (x >= 0 && x <= Terrarium.MAX_X && y >= 0 && y <= Terrarium.MAX_Y) {
641- mypane.terrarium.addToilet(x, y);
648+ mypane.terrarium.buyToilet(x, y);
642649 }
643650 }
644651 break;
@@ -646,7 +653,7 @@
646653 int x = Translate.invX(e.getX(), e.getY(), Toy.getSizeS(), w, h);
647654 int y = Translate.invY(e.getX(), e.getY(), Toy.getSizeS(), w, h);
648655 if (x >= 0 && x <= Terrarium.MAX_X && y >= 0 && y <= Terrarium.MAX_Y) {
649- mypane.terrarium.addToy(x, y);
656+ mypane.terrarium.buyToy(x, y);
650657 }
651658 }
652659 break;
@@ -671,7 +678,7 @@
671678 dir = ObjEX.Direction.LEFT;
672679 break;
673680 }
674- mypane.terrarium.addObjEX(BELTCONVEYOR,x, y, dir);
681+ mypane.terrarium.buyObjEx(BELTCONVEYOR,x, y, dir);
675682 }
676683 }
677684 break;
@@ -696,7 +703,7 @@
696703 dir = ObjEX.Direction.LEFT;
697704 break;
698705 }
699- mypane.terrarium.addObjEX(BREEDINGPOOL, x, y, dir);
706+ mypane.terrarium.buyObjEx(BREEDINGPOOL, x, y, dir);
700707 }
701708 }
702709 break;
@@ -705,7 +712,7 @@
705712 int x = Translate.invX(e.getX(), e.getY(), GarbageChute.getSizeS(), w, h);
706713 int y = Translate.invY(e.getX(), e.getY(), GarbageChute.getSizeS() / 2, w, h);
707714 if (x >= 0 && x <= Terrarium.MAX_X && y >= 0 && y <= Terrarium.MAX_Y) {
708- mypane.terrarium.addObjEX(GARBAGECHUTE, x, y, ObjEX.Direction.BACK);
715+ mypane.terrarium.buyObjEx(GARBAGECHUTE, x, y, ObjEX.Direction.BACK);
709716 }
710717 }
711718 break;
@@ -714,7 +721,7 @@
714721 int x = Translate.invX(e.getX(), e.getY(), MachinePress.getSizeS(), w, h);
715722 int y = Translate.invY(e.getX(), e.getY(), MachinePress.getSizeS() / 2, w, h);
716723 if (x >= 0 && x <= Terrarium.MAX_X && y >= 0 && y <= Terrarium.MAX_Y) {
717- mypane.terrarium.addObjEX(MACHINEPRESS, x, y, ObjEX.Direction.BACK);
724+ mypane.terrarium.buyObjEx(MACHINEPRESS, x, y, ObjEX.Direction.BACK);
718725 }
719726 }
720727 break;
@@ -723,7 +730,7 @@
723730 int x = Translate.invX(e.getX(), e.getY(), FoodMaker.getSizeS(), w, h);
724731 int y = Translate.invY(e.getX(), e.getY(), FoodMaker.getSizeS() / 2, w, h);
725732 if (x >= 0 && x <= Terrarium.MAX_X && y >= 0 && y <= Terrarium.MAX_Y) {
726- mypane.terrarium.addObjEX(FOODMAKER, x, y, ObjEX.Direction.BACK);
733+ mypane.terrarium.buyObjEx(FOODMAKER, x, y, ObjEX.Direction.BACK);
727734 }
728735 }
729736 break;
@@ -748,7 +755,7 @@
748755 dir = ObjEX.Direction.BACK;
749756 break;
750757 }
751- mypane.terrarium.addObjEX(ORANGEPOOL, x, y, dir);
758+ mypane.terrarium.buyObjEx(ORANGEPOOL, x, y, dir);
752759 }
753760 }
754761 break;
@@ -757,7 +764,7 @@
757764 int x = Translate.invX(e.getX(), e.getY(), ProductChute.getSizeS(), w, h);
758765 int y = Translate.invY(e.getX(), e.getY(), ProductChute.getSizeS() / 2, w, h);
759766 if (x >= 0 && x <= Terrarium.MAX_X && y >= 0 && y <= Terrarium.MAX_Y) {
760- mypane.terrarium.addObjEX(PRODUCTCHUTE, x, y, ObjEX.Direction.BACK);
767+ mypane.terrarium.buyObjEx(PRODUCTCHUTE, x, y, ObjEX.Direction.BACK);
761768 }
762769 }
763770 break;
@@ -1060,6 +1067,7 @@
10601067 speed = gameSpeed[SimYukkuri.selectedGameSpeed];
10611068 }
10621069 SimYukkuri.l3.setText(" " + InitLoader.getStatus(1) + ": " + stress + "%");
1070+ SimYukkuri.l10.setText(" " + InitLoader.getStatus(8) + Integer.toString(Cash.getCash()));
10631071 if (speed != PAUSE) {
10641072 synchronized (SimYukkuri.lock) {
10651073 terrarium.run();
@@ -1150,7 +1158,7 @@
11501158 }
11511159 for (Body b: bodies) {
11521160 synchronized(SimYukkuri.lock) {
1153- terrarium.addBody(b);
1161+ terrarium.buyBody(b);
11541162 }
11551163 }
11561164 }
--- branches/test/Cash.java (revision 256)
+++ branches/test/Cash.java (revision 257)
@@ -30,4 +30,7 @@
3030 cash -= value;
3131 }
3232
33+ public static int getCash() {
34+ return cash;
35+ }
3336 }
\ No newline at end of file
Show on old repository browser