17
17
import the_dark_jumper .cannontracer .Main ;
18
18
import the_dark_jumper .cannontracer .gui .guielements .BasicTextFrame ;
19
19
import the_dark_jumper .cannontracer .gui .guielements .ButtonFrame ;
20
+ import the_dark_jumper .cannontracer .gui .guielements .CompactToggleValueFrame ;
20
21
import the_dark_jumper .cannontracer .gui .guielements .ScrollableTable ;
21
22
import the_dark_jumper .cannontracer .gui .guielements .ValueFrame ;
22
23
import the_dark_jumper .cannontracer .gui .guielements .interfaces .IClickableFrame ;
@@ -82,6 +83,13 @@ public void closeButtonPressed(boolean isPressed) {
82
83
}
83
84
}
84
85
86
+ private void cancelButtonPressed (boolean isPressed ){
87
+ if (isPressed ){
88
+ cancelCannonData = true ;
89
+ shouldClose = true ;
90
+ }
91
+ }
92
+
85
93
public void addChargeButtonPressed (boolean isPressed ) {
86
94
if (isPressed ) {
87
95
testCannon .getCharges ().add (new TestCannonCharge ());
@@ -118,7 +126,7 @@ public void generateScreenComponents() {
118
126
config .init (6 , 10 , 60 , 14 , 8 );
119
127
guiComponents .add (new BasicTextFrame (this , "Cannon Tester" , config .duplicate (), colors ));
120
128
config .init (80 , 10 , 89 , 14 , 8 );
121
- guiComponents .add (new ButtonFrame (this , "cancel" , config .duplicate (), colors , this ::closeWithoutSend ));
129
+ guiComponents .add (new ButtonFrame (this , "cancel" , config .duplicate (), colors , this ::cancelButtonPressed ));
122
130
config .init (90 , 10 , 94 , 14 , 8 );
123
131
guiComponents .add (new ButtonFrame (this , "X" , config .duplicate (), colors , this ::closeButtonPressed ));
124
132
@@ -153,17 +161,19 @@ public void generateScreenComponents() {
153
161
guiComponents .add (new BasicTextFrame (this , "Charges" , config .duplicate (), headerColors ));
154
162
config .init (23 , 40 , 25 , 44 , 8 );
155
163
guiComponents .add (new ButtonFrame (this , "+" , config .duplicate (), colors , this ::addChargeButtonPressed ));
156
- config .init (10 , 45 , 63 , 94 , 8 );
164
+ config .init (10 , 45 , 63 , 94 , 4 );
157
165
chargesTable = new ScrollableTable (this , config .duplicate (), colors );
158
166
chargesTable .setUniformColFormat (false , 9 , 1 ); // fallback value, shouldn't be needed
159
- chargesTable .setColFormat (false ,
160
- new FormatData (2 , 1 ), // delete button
161
- new FormatData (9 , 0 ), // amount text field
162
- new FormatData (2 , 0 ), // increment button
163
- new FormatData (2 , 1 ), // decrement button
164
- new FormatData (9 , 0 ), // delay text field
165
- new FormatData (2 , 0 ), // increment button
166
- new FormatData (2 , 1 ));// decrement button
167
+ chargesTable .setColFormat (true ,
168
+ new FormatData (4 , 1 ), // delete button
169
+ new FormatData (10 , 1 ), // enabled/disabled
170
+ new FormatData (15 , 0 ), // amount text field
171
+ new FormatData (4 , 0 ), // increment button
172
+ new FormatData (4 , 1 ), // decrement button
173
+ new FormatData (15 , 0 ), // delay text field
174
+ new FormatData (4 , 0 ), // increment button
175
+ new FormatData (4 , 1 ), // decrement button
176
+ new FormatData (35 , 1 ));// notes text field
167
177
chargesTable .setUniformRowFormat (false , 4 , 1 );
168
178
chargesTable .generateScrollbars (false , 0 , true , chargesTable .matchHeightToWidth (1 ));
169
179
generateChargesTable ();
@@ -184,12 +194,14 @@ private void generateChargesTable() {
184
194
185
195
chargesTable .addRow (
186
196
new ButtonFrame (this , "X" , null , colors , new DeleteChargeCallback (i , this ::removeCharge )::onPressed ),
197
+ new CompactToggleValueFrame (this , null , colors , "enabled" , "disabled" , charge .getEnabledGNS ()),
187
198
amountValueFrame ,
188
199
new ButtonFrame (this , "+" , null , colors , amountIncrementer ::onIncrement ),
189
200
new ButtonFrame (this , "-" , null , colors , amountIncrementer ::onDecrement ),
190
201
delayValueFrame ,
191
202
new ButtonFrame (this , "+" , null , colors , delayIncrementer ::onIncrement ),
192
- new ButtonFrame (this , "-" , null , colors , delayIncrementer ::onDecrement )
203
+ new ButtonFrame (this , "-" , null , colors , delayIncrementer ::onDecrement ),
204
+ new ValueFrame <>(this , null , colors , "note" , charge .getNoteGNS (), String .class , true )
193
205
);
194
206
}
195
207
@@ -266,6 +278,7 @@ public void render(int mouseX, int mouseY, float partialTicks) {
266
278
if (shouldClose ) {
267
279
onClose ();
268
280
shouldClose = false ;
281
+ cancelCannonData = false ;
269
282
}
270
283
}
271
284
@@ -315,14 +328,6 @@ public void drawCenteredString(FontRenderer fontRenderer, String text, int xPos,
315
328
GL11 .glPopMatrix ();
316
329
}
317
330
318
- private void closeWithoutSend (boolean isPressed ){
319
- if (isPressed ){
320
- cancelCannonData = true ;
321
- onClose ();
322
- cancelCannonData = false ;
323
- }
324
- }
325
-
326
331
@ Override
327
332
public void onClose () {
328
333
guiManager .main .moduleManager .focusReleaseAllFrames ();
0 commit comments