| 274 | |
| 275 | |
| 276 | public void sendNewValue() { |
| 277 | int index = varIndex; |
| 278 | try { |
| 279 | if ("int".equals(type)) { |
| 280 | tweakClient.sendInt(index, newValue.intValue()); |
| 281 | } else if ("hex".equals(type)) { |
| 282 | tweakClient.sendInt(index, newValue.intValue()); |
| 283 | } else if ("webcolor".equals(type)) { |
| 284 | // If full opaque color, don't spend the cycles on string processing |
| 285 | // which does appear to matter at high frame rates. Otherwise take the |
| 286 | // hit and parse back from string value with transparency. |
| 287 | if (strNewValue.length() == 7) { |
| 288 | tweakClient.sendInt(index, newValue.intValue()); |
| 289 | } else { |
| 290 | long target = Long.parseLong( |
| 291 | strNewValue.substring(1, strNewValue.length()), |
| 292 | 16 |
| 293 | ); |
| 294 | tweakClient.sendInt(index, (int) target); |
| 295 | } |
| 296 | |
| 297 | } else if ("float".equals(type)) { |
| 298 | tweakClient.sendFloat(index, newValue.floatValue()); |
| 299 | } |
| 300 | } catch (Exception e) { |
| 301 | System.out.println("error sending new value!"); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | |
| 306 | public String toString() { |