Making some progress but not all the way there yet.
We have a custom toolbar button that toggles on and off a Night shader, using the F9 hotkey.
There is a custom code class that works with the button:
public class ASLNightMapShader extends MapShader{
private final GlobalProperty globalNightLevel = new GlobalProperty();
public ASLNightMapShader() {
super();
shadingVisible = false;
globalNightLevel.setPropertyName(“night”);
globalNightLevel.setAttribute(“initialValue”, String.valueOf(shadingVisible));
GameModule gm = GameModule.getGameModule();
gm.addMutableProperty(“night”, globalNightLevel);
}
@Override
protected void toggleShading() {
this.boardClip=null;
super.toggleShading();
GameModule.getGameModule().getChatter().send("Night is " + (shadingVisible ? “” : "not ") + “in effect.” );
globalNightLevel.setAttribute(“initialValue”, String.valueOf(shadingVisible));
}
}
So the value of NightShader is stored as a global property.
I want to turn this into a scenario property.
I can create the Scenario Properties Options Tabs under Global Properties and I can then add a Checkbox Scenario Property to the Tabs. I set the Send Hotkey on Change to “F9”.
Now for the first time when I save this and open a game (still within VASSAL.Editor, the Scenario Options menu item is not greyed out and I can open the Scenario Properties Options Tab window and see the Night tab and can toggle the property on/off. However, the shader does not appear/hide in response to the toggle.
If I click on the Night button or press F9 the Night Shader toggles accordingly.
I need to link the Scenario Property with the Global Property, or have it replace the Global Property. Any thoughts about how to do this?
I just noticed under the Main Map Window in VASSAL.Editor there is a Night[Map Shader] item that defines the specifics of the shader colour and opacity, etc. How do I link this to my Scenario Property?
Thanks.