-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addresses #30
- Loading branch information
Showing
6 changed files
with
151 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
EU3_Scenario_Editor/src/editor/mapmode/CK3DevelopmentMapMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
package editor.mapmode; | ||
|
||
import editor.MapPanel; | ||
import editor.ProvinceData; | ||
import java.awt.Color; | ||
|
||
/** | ||
* | ||
* @author Michael | ||
*/ | ||
public class CK3DevelopmentMapMode extends TitleMode { | ||
|
||
private final Color[] colors = Utilities.createSteppedColors(0, 101, 1, Color.WHITE, Color.GREEN.darker(), Color.GREEN.darker().darker().darker()); | ||
|
||
public CK3DevelopmentMapMode(MapPanel panel) { | ||
super(panel, TitleMode.TitleType.COUNTY); | ||
} | ||
|
||
@Override | ||
protected Color getTitleColor(String title) { | ||
String devStr = getLiegeHistString(title, "change_development_level"); | ||
if (devStr == null || devStr.isEmpty()) | ||
return getColorFromDevLevel(0); | ||
|
||
try { | ||
int devLevel = Integer.parseInt(devStr); | ||
return getColorFromDevLevel(devLevel); | ||
} catch (NumberFormatException ex) { | ||
} | ||
return Utilities.COLOR_NO_CTRY_DEF; | ||
} | ||
|
||
private Color getColorFromDevLevel(int devLevel) { | ||
if (devLevel >= 0 && devLevel < colors.length) | ||
return colors[devLevel]; | ||
return Utilities.COLOR_LAND_DEFAULT; | ||
} | ||
|
||
@Override | ||
public String getTooltipExtraText(ProvinceData.Province current) { | ||
if (!mapPanel.getMap().isLand(current.getId()) || mapPanel.getMap().isWasteland(current.getId())) | ||
return ""; | ||
|
||
return "Development level: " + getLiegeHistString(getLowestHistTitleHolder(current.getId()), "change_development_level"); | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
EU3_Scenario_Editor/src/editor/mapmode/DevelopmentMapMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
package editor.mapmode; | ||
|
||
import editor.MapPanel; | ||
import editor.ProvinceData; | ||
|
||
/** | ||
* | ||
* @author Michael | ||
*/ | ||
public class DevelopmentMapMode extends DiscreteScalingMapMode { | ||
|
||
public DevelopmentMapMode(MapPanel panel, int min, int max, int step) { | ||
super(panel, "", min, max, step); | ||
setName("development"); | ||
} | ||
|
||
|
||
@Override | ||
protected double getProvinceValue(int provId) { | ||
String manpower = mapPanel.getModel().getHistString(provId, "base_manpower"); | ||
String baseTax = mapPanel.getModel().getHistString(provId, "base_tax"); | ||
String production = mapPanel.getModel().getHistString(provId, "base_production"); | ||
|
||
return toInt(manpower) + toInt(baseTax) + toInt(production); | ||
} | ||
|
||
private int toInt(String strInt) { | ||
if (strInt == null || strInt.isEmpty()) | ||
return 0; | ||
try { | ||
return Integer.parseInt(strInt); | ||
} catch (NumberFormatException ex) { | ||
return 0; | ||
} | ||
} | ||
|
||
@Override | ||
public String getTooltipExtraText(ProvinceData.Province current) { | ||
final int id = current.getId(); | ||
if (!getMap().isLand(id)) | ||
return ""; | ||
if (getMap().isWasteland(id)) | ||
return ""; | ||
|
||
String manpower = mapPanel.getModel().getHistString(id, "base_manpower"); | ||
String baseTax = mapPanel.getModel().getHistString(id, "base_tax"); | ||
String production = mapPanel.getModel().getHistString(id, "base_production"); | ||
|
||
return "Base tax: " + baseTax | ||
+ "<br>Production: " + production | ||
+ "<br>Manpower: " + manpower | ||
+ "<br><b>Total development: " + (int)getProvinceValue(id) + "</b>"; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters