@Override public void saveProperties(PropertyWriter writer) throws IOException { super.saveProperties(writer); writer.writeProperty(f1_2011Font, ""); writer.writeProperty(WhiteFontColor, ""); writer.writeProperty(fontyoffset, ""); writer.writeProperty(ShowAmbiant, ""); }
@Override public void onCockpitEntered(LiveGameData gameData, boolean isEditorMode) { super.onCockpitEntered(gameData, isEditorMode); String cpid = "Y29weXJpZ2h0QFBydW5uMjAxMQ"; if (!isEditorMode) log(cpid); drawnCars.reset(); visibleEnd = 0; }
@Override public void loadProperty(PropertyLoader loader) { super.loadProperty(loader); if (loader.loadProperty(f1_2011Font)) ; else if (loader.loadProperty(WhiteFontColor)) ; else if (loader.loadProperty(fontyoffset)) ; else if (loader.loadProperty(ShowAmbiant)) ; }
@Override protected void addFontPropertiesToContainer(PropertiesContainer propsCont, boolean forceAll) { propsCont.addGroup("Colors and Fonts"); super.addFontPropertiesToContainer(propsCont, forceAll); propsCont.addProperty(posFontTH); propsCont.addProperty(fontColor2); propsCont.addProperty(fontColor3); }
@Override public void getProperties(PropertiesContainer propsCont, boolean forceAll) { super.getProperties(propsCont, forceAll); propsCont.addGroup("Colors"); propsCont.addProperty(f1_2011Font); propsCont.addProperty(WhiteFontColor); propsCont.addProperty(fontyoffset); propsCont.addProperty(ShowAmbiant); }
@Override public void loadProperty(PropertyLoader loader) { super.loadProperty(loader); if (loader.loadProperty(GP2Font)) ; else if (loader.loadProperty(fontColor1)) ; else if (loader.loadProperty(fontColor2)) ; else if (loader.loadProperty(visibleTime)) ; else if (loader.loadProperty(knockout)) ; else if (loader.loadProperty(fontyoffset)) ; else if (loader.loadProperty(MaxTeamLengh)) ; }
@Override public void saveProperties(PropertyWriter writer) throws IOException { super.saveProperties(writer); writer.writeProperty(GP2Font, ""); writer.writeProperty(fontColor1, ""); writer.writeProperty(fontColor2, ""); writer.writeProperty(visibleTime, ""); writer.writeProperty(knockout, ""); writer.writeProperty(fontyoffset, ""); writer.writeProperty(MaxTeamLengh, ""); }
@SuppressWarnings("unchecked") public static final <W extends Widget> W getWidgetByClass( Class<W> clazz, boolean includeSubclasses, WidgetsConfiguration widgetsConfig) { int n = widgetsConfig.getNumWidgets(); if (includeSubclasses) { for (int i = 0; i < n; i++) { Widget w = widgetsConfig.getWidget(i); if (clazz.isAssignableFrom(w.getClass())) return ((W) w); } } else { for (int i = 0; i < n; i++) { Widget w = widgetsConfig.getWidget(i); if (clazz == w.getClass()) return ((W) w); } } return (null); }
@Override public void getProperties(PropertiesContainer propsCont, boolean forceAll) { super.getProperties(propsCont, forceAll); propsCont.addGroup("Colors"); propsCont.addProperty(GP2Font); propsCont.addProperty(fontColor1); propsCont.addProperty(fontColor2); propsCont.addProperty(visibleTime); propsCont.addProperty(knockout); propsCont.addProperty(fontyoffset); propsCont.addProperty(MaxTeamLengh); }
@Override protected Boolean updateVisibility(LiveGameData gameData, boolean isEditorMode) { super.updateVisibility(gameData, isEditorMode); ScoringInfo scoringInfo = gameData.getScoringInfo(); if (!startedPositionsInitialized) initStartedFromPositions(scoringInfo); if (RaceInfosWidget.visible()) return false; currentLap.update(scoringInfo.getLeadersVehicleScoringInfo().getLapsCompleted()); if (currentLap.hasChanged() && currentLap.getValue() > 0 && (short) (Math.random() * randMulti.getValue()) == 0 || isEditorMode) { // fetch what data is shown others-gaps 1-places gained/lost if (scoringInfo.getLeadersVehicleScoringInfo().getFinishStatus().isFinished() || isEditorMode) shownData = 1; else shownData = (short) (Math.random() * 2); if (scoringInfo.getGamePhase() == GamePhase.SESSION_OVER) visibleEnd = scoringInfo.getSessionNanos() + visibleTime.getDelayNanos() * 3; else visibleEnd = scoringInfo.getSessionNanos() + visibleTime.getDelayNanos(); clearArrayValues(scoringInfo.getNumVehicles()); FillArrayValues(1, scoringInfo, isEditorMode, gameData); if (!isEditorMode) forceCompleteRedraw(true); return true; } if (scoringInfo.getSessionNanos() < visibleEnd || isEditorMode) { // how many on the same lap? int onlap = 0; for (int j = 0; j < scoringInfo.getNumVehicles(); j++) { if (scoringInfo.getVehicleScoringInfo(j).getLapsCompleted() == scoringInfo.getLeadersVehicleScoringInfo().getLapsCompleted()) onlap++; } carsOnLeadLap.update(onlap); if (carsOnLeadLap.hasChanged() && !isEditorMode) { FillArrayValues(onlap, scoringInfo, false, gameData); forceCompleteRedraw(true); } return true; } return false; }
@Override public void getProperties(PropertiesContainer propsCont, boolean forceAll) { super.getProperties(propsCont, forceAll); propsCont.addGroup("Specific"); propsCont.addProperty(numVeh); propsCont.addProperty(visibleTime); propsCont.addProperty(randMulti); propsCont.addGroup("Font Displacement"); propsCont.addProperty(fontyoffset); propsCont.addProperty(fontxposoffset); propsCont.addProperty(fontxnameoffset); propsCont.addProperty(fontxtimeoffset); }
@Override public void loadProperty(PropertyLoader loader) { super.loadProperty(loader); if (loader.loadProperty(fontColor2)) ; else if (loader.loadProperty(fontColor3)) ; else if (loader.loadProperty(posFontTH)) ; else if (loader.loadProperty(numVeh)) ; else if (loader.loadProperty(visibleTime)) ; else if (loader.loadProperty(randMulti)) ; else if (loader.loadProperty(fontyoffset)) ; else if (loader.loadProperty(fontxposoffset)) ; else if (loader.loadProperty(fontxnameoffset)) ; else if (loader.loadProperty(fontxtimeoffset)) ; }
@Override public void saveProperties(PropertyWriter writer) throws IOException { super.saveProperties(writer); writer.writeProperty(fontColor2, ""); writer.writeProperty(fontColor3, ""); writer.writeProperty(posFontTH, ""); writer.writeProperty(numVeh, ""); writer.writeProperty(visibleTime, "visibleTime"); writer.writeProperty(randMulti, "ShowMultiplier"); writer.writeProperty(fontyoffset, ""); writer.writeProperty(fontxposoffset, ""); writer.writeProperty(fontxnameoffset, ""); writer.writeProperty(fontxtimeoffset, ""); }
@Override protected Boolean updateVisibility(LiveGameData gameData, boolean isEditorMode) { super.updateVisibility(gameData, isEditorMode); ScoringInfo scoringInfo = gameData.getScoringInfo(); cveh.update(scoringInfo.getViewedVehicleScoringInfo().getDriverId()); cpit.update(scoringInfo.getViewedVehicleScoringInfo().isInPits()); if (QualTimeWidget.visible()) return false; if ((cveh.hasChanged() || cpit.hasChanged()) && !isEditorMode) { forceCompleteRedraw(true); visibleEnd = scoringInfo.getSessionNanos() + visibleTime.getDelayNanos(); return true; } if (scoringInfo.getSessionNanos() < visibleEnd || cpit.getValue()) return true; return false; }
/** {@inheritDoc} */ @Override public void prepareForMenuItem() { super.prepareForMenuItem(); // getFontProperty().setFont( PrunnWidgetSetf1_2011.F1_2011_FONT_NAME ); getFontProperty().setFont("Dialog", Font.PLAIN, 6, false, true); }
/** {@inheritDoc} */ @Override public void prepareForMenuItem() { super.prepareForMenuItem(); getFontProperty().setFont("Dialog", Font.PLAIN, 6, false, true); }
@Override protected void drawBackground( LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, int offsetX, int offsetY, int width, int height, boolean isRoot) { super.drawBackground(gameData, isEditorMode, texture, offsetX, offsetY, width, height, isRoot); VehicleScoringInfo currentcarinfos = gameData.getScoringInfo().getViewedVehicleScoringInfo(); int rowHeight = height / 2; if (currentcarinfos.getPlace(false) == 1) texture.clear(imgNameFirst.getTexture(), offsetX, offsetY, false, null); else texture.clear(imgName.getTexture(), offsetX, offsetY, false, null); texture.clear(imgName.getTexture(), offsetX, offsetY + rowHeight, false, null); // player if (currentcarinfos.isPlayer()) { if (new File( gameData.getFileSystem().getImagesFolder() + "/prunn/PorscheSupercup/Nations/" + gameData.getProfileInfo().getNationality() + ".png") .exists()) imgCountry.setValue( "prunn/PorscheSupercup/Nations/" + gameData.getProfileInfo().getNationality() + ".png"); else imgCountry.setValue("prunn/PorscheSupercup/Nations/Alien.png"); texCountry = imgCountry .getImage() .getScaledTextureImage( width * 14 / 100, rowHeight * 61 / 100, texCountry, isEditorMode); texture.drawImage( texCountry, offsetX + width * 78 / 100, offsetY + rowHeight * 20 / 100, true, null); } // team if (currentcarinfos.getVehicleInfo() != null) { String headquarters = currentcarinfos.getVehicleInfo().getTeamHeadquarters().toUpperCase(); for (int j = 0; j < NumOfPNG; j++) { if (headquarters.length() >= listPNG[j].length() && headquarters.contains(listPNG[j].toUpperCase())) { imgCountry.setValue("prunn/PorscheSupercup/Countries/" + listPNG[j] + ".png"); texCountry = imgCountry .getImage() .getScaledTextureImage( width * 14 / 100, rowHeight * 61 / 100, texCountry, isEditorMode); texture.drawImage( texCountry, offsetX + width * 78 / 100, offsetY + rowHeight + rowHeight * 20 / 100, true, null); break; } } } }
@Override protected void drawBackground( LiveGameData gameData, boolean isEditorMode, TextureImage2D texture, int offsetX, int offsetY, int width, int height, boolean isRoot) { super.drawBackground(gameData, isEditorMode, texture, offsetX, offsetY, width, height, isRoot); // logCS("test"); ScoringInfo scoringInfo = gameData.getScoringInfo(); int maxNumItems = numVeh.getValue(); int rowHeight = height / maxNumItems; int drawncars = Math.min(scoringInfo.getNumVehicles(), maxNumItems); short posOffset; for (int i = 0; i < drawncars; i++) { if (carsOnLeadLap.getValue() > numVeh.getValue() && i != 0) posOffset = (short) (carsOnLeadLap.getValue() - numVeh.getValue()); else posOffset = 0; if (positions[i + posOffset] != -1 || isEditorMode) { if (scoringInfo .getVehicleScoringInfo(positions[i + posOffset] - 1) .getVehicleInfo() .getManufacturer() .toUpperCase() .equals("FORD") || (isEditorMode && (short) (Math.random() * 2) == 0)) texture.clear(imgFord.getTexture(), offsetX, offsetY + rowHeight * i, false, null); else texture.clear(imgHolden.getTexture(), offsetX, offsetY + rowHeight * i, false, null); if (shownData == 1) { if (gainedPlaces[i + posOffset] > 0) texGainedPlaces = imgPositive .getImage() .getScaledTextureImage( width * 9 / 100, rowHeight, texGainedPlaces, isEditorMode); else if (gainedPlaces[i + posOffset] < 0) texGainedPlaces = imgNegative .getImage() .getScaledTextureImage( width * 9 / 100, rowHeight, texGainedPlaces, isEditorMode); else texGainedPlaces = imgNeutral .getImage() .getScaledTextureImage( width * 9 / 100, rowHeight, texGainedPlaces, isEditorMode); texture.drawImage( texGainedPlaces, offsetX + width * 171 / 200, offsetY + rowHeight * i, true, null); } } } }