Skip to content

Commit

Permalink
Revert "Revert "It is no longer possible to add a description to cust…
Browse files Browse the repository at this point in the history
…om hardware""

This reverts commit 7e095b0.
  • Loading branch information
LMH01 committed May 29, 2022
1 parent 7e095b0 commit 8c9a74f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
- Custom hardware icons can now be added
- Hardware icons that have been set by editing the game files are now recognized. This means that they will be included when importing and exporting the hardware.

### Removed features
- It is no longer possible to add a description to custom hardware
- This is because the game no longer supports descriptions for custom hardware

### Other
- Updated some spinner values:
- Global:
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/github/lmh01/mgt2mt/content/Hardware.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

public class Hardware extends AbstractAdvancedContent implements DependentContent, RequiresPictures {

String description;
String date;
public HardwareType hardwareType;
int researchPoints;
Expand All @@ -32,7 +31,6 @@ public class Hardware extends AbstractAdvancedContent implements DependentConten
public Hardware(String name,
Integer id,
TranslationManager translationManager,
String description,
String date,
HardwareType hardwareType,
int researchPoints,
Expand All @@ -48,7 +46,6 @@ public Hardware(String name,
if (onlyHandheld && onlyStationary) {
throw new ModProcessingException("Unable to construct hardware: Invalid arguments");
}
this.description = description;
this.date = date;
this.hardwareType = hardwareType;
this.researchPoints = researchPoints;
Expand All @@ -66,7 +63,6 @@ public Map<String, String> getMap() {
Map<String, String> map = new HashMap<>();
insertIdInMap(map);
map.put("NAME EN", name);
map.put("DESC EN", description);
map.put("TYP", Integer.toString(hardwareType.getId()));
map.put("DATE", date);
map.put("RES POINTS", Integer.toString(researchPoints));
Expand Down Expand Up @@ -108,7 +104,6 @@ public String getOptionPaneMessage() {
return "<html>" +
I18n.INSTANCE.get("mod.hardware.addMod.optionPaneMessage.firstPart") + "<br><br>" +
I18n.INSTANCE.get("commonText.name") + ": " + name + "<br>" +
I18n.INSTANCE.get("commonText.description") + ": " + description + "<br>" +
I18n.INSTANCE.get("commonText.unlockDate") + ": " + date + "<br>" +
I18n.INSTANCE.get("commonText.researchPointCost") + ": " + researchPoints + "<br>" +
I18n.INSTANCE.get("commonText.price") + ": " + price + "<br>" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public AbstractBaseContent constructContentFromMap(Map<String, String> map) thro
map.get("NAME EN"),
getIdFromMap(map),
new TranslationManager(map),
map.get("DESC EN"),
map.get("DATE"),
HardwareType.getFromId(Integer.parseInt(map.get("TYP"))),
Integer.parseInt(map.get("RES POINTS")),
Expand Down Expand Up @@ -212,7 +211,6 @@ public AbstractBaseContent constructContentFromImportMap(Map<String, Object> map
(String) map.get("NAME EN"),
getIdFromMap(map),
new TranslationManager(map),
(String) map.get("DESC EN"),
(String) map.get("DATE"),
HardwareType.getFromId(Integer.parseInt((String) map.get("TYP"))),
Integer.parseInt((String) map.get("RES POINTS")),
Expand All @@ -233,10 +231,6 @@ public void openAddModGui() throws ModProcessingException {
final Map<String, String>[] mapNameTranslations = new Map[]{new HashMap<>()};
AtomicBoolean nameTranslationsAdded = new AtomicBoolean(false);
JButton buttonAddNameTranslations = WindowHelper.getAddTranslationsButton(mapNameTranslations, nameTranslationsAdded, 0);
JTextField textFieldDescription = new JTextField(I18n.INSTANCE.get("mod.hardware.addMod.components.textFieldDescription.initialValue"));
final Map<String, String>[] mapDescriptionTranslation = new Map[]{new HashMap<>()};
AtomicBoolean descriptionTranslationsAdded = new AtomicBoolean(false);
JButton buttonAddDescriptionTranslations = WindowHelper.getAddTranslationsButton(mapDescriptionTranslation, descriptionTranslationsAdded, 1);
JComboBox<String> comboBoxUnlockMonth = WindowHelper.getUnlockMonthComboBox();
JSpinner spinnerUnlockYear = WindowHelper.getUnlockYearSpinner();
JComboBox<String> comboBoxType = WindowHelper.getComboBox(HardwareType.class, "mod.hardware.addMod.components.comboBox.type.toolTip", HardwareType.CPU.getTypeName());
Expand Down Expand Up @@ -280,10 +274,10 @@ public void openAddModGui() throws ModProcessingException {
}
});

Object[] params = {WindowHelper.getNamePanel(textFieldName), buttonAddNameTranslations, WindowHelper.getDescriptionPanel(textFieldDescription), buttonAddDescriptionTranslations, WindowHelper.getUnlockDatePanel(comboBoxUnlockMonth, spinnerUnlockYear), WindowHelper.getTypePanel(comboBoxType), WindowHelper.getSpinnerPanel(spinnerResearchPoints, SpinnerType.RESEARCH_POINT_COST), WindowHelper.getSpinnerPanel(spinnerCost, SpinnerType.PRICE), WindowHelper.getSpinnerPanel(spinnerDevelopmentCost, SpinnerType.DEVELOPMENT_COST), WindowHelper.getSpinnerPanel(spinnerTechLevel, SpinnerType.TECH_LEVEL), checkBoxEnableExclusivity, comboBoxExclusivity, componentRatingDescription, buttonCustomIcon};
Object[] params = {WindowHelper.getNamePanel(textFieldName), buttonAddNameTranslations, WindowHelper.getUnlockDatePanel(comboBoxUnlockMonth, spinnerUnlockYear), WindowHelper.getTypePanel(comboBoxType), WindowHelper.getSpinnerPanel(spinnerResearchPoints, SpinnerType.RESEARCH_POINT_COST), WindowHelper.getSpinnerPanel(spinnerCost, SpinnerType.PRICE), WindowHelper.getSpinnerPanel(spinnerDevelopmentCost, SpinnerType.DEVELOPMENT_COST), WindowHelper.getSpinnerPanel(spinnerTechLevel, SpinnerType.TECH_LEVEL), checkBoxEnableExclusivity, comboBoxExclusivity, componentRatingDescription, buttonCustomIcon};
while (true) {
if (JOptionPane.showConfirmDialog(null, params, I18n.INSTANCE.get("commonText.add.upperCase") + ": " + getType(), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
if (!textFieldName.getText().equals(I18n.INSTANCE.get("mod.hardware.addMod.components.textFieldName.initialValue")) && !textFieldDescription.getText().equals(I18n.INSTANCE.get("mod.hardware.addMod.components.textFieldDescription.initialValue"))) {
if (!textFieldName.getText().equals(I18n.INSTANCE.get("mod.hardware.addMod.components.textFieldName.initialValue"))) {
boolean modAlreadyExists = false;
for (String string : getContentByAlphabet()) {
if (textFieldName.getText().equals(string)) {
Expand Down Expand Up @@ -327,8 +321,7 @@ public void openAddModGui() throws ModProcessingException {
AbstractBaseContent hardware = new Hardware(
textFieldName.getText(),
null,
new TranslationManager(mapNameTranslations[0], mapDescriptionTranslation[0]),
textFieldDescription.getText(),
new TranslationManager(mapNameTranslations[0]),
Months.getDataNameByTypeName(Objects.requireNonNull(comboBoxUnlockMonth.getSelectedItem()).toString()) + " " + spinnerUnlockYear.getValue().toString(),
hT,
Integer.parseInt(spinnerResearchPoints.getValue().toString()),
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/locale/de.txt
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,6 @@ mod.hardwareFeature.addMod.components.checkBoxOnlyStationary.toolTip|Aktiviere d
mod.hardwareFeature.addMod.components.textFieldDescription.initialValue|GIB EINE BESCHREIBUNG FÜR DIE HARDWARE EIN
mod.hardware.addMod.optionPaneMessage.firstPart|Diese Hardware hinzufügen?
mod.hardware.addMod.components.textFieldName.initialValue|GIB EINEN NAMEN FÜR DIE HARDWARE EIN
mod.hardware.addMod.components.textFieldDescription.initialValue|GIB EINEN BESCHREIBUNG FÜR DIE HARDWARE EIN
mod.hardware.addMod.components.comboBox.type.toolTip|Wähle aus, von welchem Typ die Hardware sein soll
mod.hardware.addMod.components.checkBox.exclusiveConsole|Exlusivität für eine Konsolenart aktivieren
mod.hardware.addMod.components.checkBox.exclusiveConsole.toolTip|<html>Aktiviere dieses Kästchen, damit die Hardware nur für eine bestimmte Konsolenart benutzt werden können soll<br>Die erlaubte Konsolenart kann unten ausgewählt werden
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/locale/en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@ mod.hardwareFeature.addMod.components.checkBoxOnlyStationary.toolTip|Aktiviere d
mod.hardwareFeature.addMod.components.textFieldDescription.initialValue|ENTER HARDWARE FEATURE DESCRIPTION
mod.hardware.addMod.optionPaneMessage.firstPart|Add this hardware?
mod.hardware.addMod.components.textFieldName.initialValue|ENTER HARDWARE NAME
mod.hardware.addMod.components.textFieldDescription.initialValue|ENTER HARDWARE DESCRIPTION
mod.hardware.addMod.components.comboBox.type.toolTip|Select what type the hardware should be
mod.hardware.addMod.components.checkBox.exclusiveConsole|Enable console exclusivity
mod.hardware.addMod.components.checkBox.exclusiveConsole.toolTip|<html>Check this box to make the hardware exclusive for a specific hardware type.<br>You can select the allowed console type below
Expand Down

0 comments on commit 8c9a74f

Please sign in to comment.