Xenon UI OXP
By Nick Rogers

About this OXP
==============
This OXP replaces all background UI screens with a new look and feel, based on the assumption that the Oolite UI screens are accessed through some form of computer terminal. 

The method used to add the backgrounds will mean that the background images of most other OXP's, if they set a background, will be overridden with the Xenon UI images. This is by design. 

If an OXP uses background images to convey important information to the player, and the "mission.runScreen" command in the OXP has a "screenID" parameter attached, it is possible to add exceptions to the override by adding the following code to a worldScript:

	var w = worldScripts.XenonUI;
	if (w) w.$addMissionScreenException("mymissionscreenid");

Installation
============
The OXP is made up of two parts: the main XenonUI.oxz, which holds all the config, code and the music file, and the resources pack which holds all the images. This will allow fast updates to the code section, which is small, without having to download the large resources file regularly.

This OXP requires one of the Xenon UI Resource packs to be installed. There are packs for screen ratios of 16:9 or 16:10, and using different fonts for the text. For narrower screens, see the XenonReduxUI.OXZ.

                    Screen Ratio:
                    16:9      16:10
Font:               -------   -------
OCR A Extended      Pack A    Pack B
Xolonium            Pack C    Pack D
Dangerous Square    Pack E    Pack F
Default (Helvetica) Pack G    Pack H
Dosis               Pack I    Pack J
Discognate          Pack K    Pack L
NovaSquare          Pack M    Pack N

F6 Overlay integration
======================
A facility has been provided for other OXP's to supply the overlays on the F6 screen which describe the economy, government, techlevel and sun colors. To use it, add the following code to your startUpComplete world script:

    var xui = worldScripts.XenonUI;
    // "economy":   this defines which section the callback applies to, either economy, government, techlevel or suncolor
    // this.name:   this defines the name of your world script where the function can be found
    // "$returnF6EconomyOverlay":   this defines the name of the function that will be called when the F6 overlay is required.
    xui.$setF6OverlayLookup("economy", this.name, "$returnF6EconomyOverlay");

Then create the function that will be called when the various F6 overlays are requested. 
The parameters "ratio" and "font" will be passed to your function.
"ratio" will be either "16_9" or "16_10", referring to screen ratio of the Xenon UI images currently active.
"font" will be the font name of the font type associated with the Xenon UI resources currently active. Will be either "default", "dangeroussquare", "discognate", "dosis", "novasquare", "ocraextended" or "xolonium".

    this.$returnF6EconomyOverlay = function(ratio, font) {
        return "my_f6-overlay-economy_" + ratio + "_" + font + ".png";
    }

BGS 1.10 Compatibility
======================
Xenon UI is compatible with BGS v1.10, but depending on where each one is installed, one OXP may end up taking priority over the other when backgrounds are selected and displayed. When BGS has priority, its images will be displayed ahead of the Xenon UI images. This will be particular apparent on screens like the title page or the load/save page.

If both OXP's (Xenon UI and BGS) are installed in the Addons folder, Xenon UI will normally take priority over BGS.

If both OXP's are installed via the download manager, again, Xenon UI will normally take priority over BGS.

If BGS is installed via the download manager, and Xenon UI is installed in the AddOns folder, Xenon UI will take priority over BGS.

If Xenon UI is installed via the download manager, and BGS is installed in the AddOns folder, BGS will take priority over Xenon UI.

To ensure the Xenon UI backgrounds appear, the best approach is to make sure they are both installed in the same location.

If you encounter issues where the BGS backgrounds are being displayed rather than the Xenon UI ones, you will need to open the BGS OXP folder, then open the Config folder. Inside Config you will find a 'screenbackgrounds.plist' file. Either remove this or re-name it - perhaps re-name it to 'screenbackgrounds.Xplist' - and the Xenon UI backgrounds will be used without affecting any other aspect of BGS. By re-naming 'screenbackgrounds.plist' rather than removing it you have the option of switching back easily if required.

BGS 2.0 Compatibility
=====================
Xenon UI will hook into Library GUI to register itself as a GUI set. Therefore, you can go to the Library GUI settings and change between BGS 2.0 and Xenon UI anytime you like. 

Because of the way the images are created, Xenon UI is still utilising settings in "screenbackgrounds.plist", which may lead to some inconsistencies. For instance, if Xenon UI and BGS 2.0 are installed, when you start Oolite and select the option to open a saved commander, the background will likely be Xenon UI. Once you have loaded a game where BGS 2.0 is the specified GUI, if you then press F2 to load a new game, you will see the BGS background.

Licence
=======
This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

Briefcase image form http://simpleicon.com/briefcase-3.html
Rocket image form http://simpleicon.com/rocket.html
ID Card from http://simpleicon.com/id_card-2.html
Power icon from http://simpleicon.com/switch_button_1.html
Report icon from http://simpleicon.com/note-11.html
Gears icon from http://simpleicon.com/gear-6.html
Load icon from http://simpleicon.com/upload_2.html
Save icon from http://simpleicon.com/download_2.html
Interface icon from http://simpleicon.com/retweet.html
Settings icon from http://simpleicon.com/setting.html
Keyboard icon from https://commons.wikimedia.org/wiki/File:High-contrast-input-keyboard.svg
Trolley icon from http://simpleicon.com/shopping_trolley_1.html
Clipboard icon from http://simpleicon.com/admite_form_1.html
Tag image from http://simpleicon.com/tag-2.html
Gamepad image from http://simpleicon.com/gaming_remote.html
Question mark image from http://simpleicon.com/question_mark_1.html
Warning image from http://simpleicon.com/warning.html

Version History
===============
3.12
- Improved compatibility with Market Ads and Library GUI.

3.11
- Darkened overlay images for better compatibility with Oolite 1.92.

3.10
- Fixed issue where mission chart screens had the wrong background if Library is installed.
- Fixed some small graphic artefacts in some of the overlay images.
- Moved text into descriptions.plist for easier localisation.

3.9
- Added fix for issue where the wrong F6 screen overlay could be shown when the screen is first displayed.
- Added new start menu background.

3.8
- Added fix for issue where the HUD being turned on/off could result in the wrong size UI screen being shown.

3.7
- Added custom background for the OXZ Manager screen, with helper text.

3.6.1
- Fixed for issue where the game is saved while Overlays are disabled and HDBG OXP is installed, and the game is then reloaded.

3.6 
- Added facility to allow for 3rd party OXP's to provide the F6 overlay images.

3.5
- Bug fixes.

3.4
- Bug fixes.

3.3
- Fixes for Ships Library, Sothis TC, New Cargoes and Iron Raven to restore background images.

3.2
- Improvements in BGS compatibility.

3.1
- Small tweak for potential performance improvements.
- Updated compatibility with Library 1.7.

3.0
- Added "Amber" background option (selectable via Library Config).
- Code refactoring.

2.2.1
- Improvements in Library GUI integration.

2.2.0 
- Added functions to enable different chart legend overlays to be displayed, based on what the player has selected. (Oolite 1.87/88 required)

2.1.4
- Improved coverage of different mission screen sequencing scenarios. (Oolite 1.85/86 required)
- Improved integration with XenonReduxUI via Library GUI.
- Applied new screenbackgrounds added in v1.87 ("custom_chart_mission").

2.1.3
- Fixed incorrect key lookup with mission screen overlays.
- Fixed issue with turning off overlay images with Library GUI.
- Disabling background images on a mission screen will now also disable any overlays as well.

2.1.2
- Bug fixes.

2.1.1
- Rejigged connection to Library GUI for nicer handovers when GUI's change.

2.1.0
- Updated for simpler integration with Library GUI.
- Code refactoring.

2.0.4
- Adjusted the Random Hits screen ID exception.

2.0.2
- Updated title screen image.
- F5 Cmdr Profile and F5F5 Manifest were swapped around when using Library GUI.

2.0.1
- Fixed compatibility issue with HDBG when using Library GUI.

2.0.0
- Made compatible with Library GUI.
- Added some configuration settings to Library Config.
- Added additional overlays to various data screens.
- Code cleanup.

1.4.3
- Added "oxz-manager" to screenbackgrounds.plist.
- Changed "==" comparisons to "===" for performance improvements.

1.4.2
- Corrected error in Nova Mission runScreen command parameters that was causing the Yes/No option to not display.

1.4.1
- Updated check for "Allow Big GUI".

1.4.0
- Changed new game background to the 'no hud' variant.
- New title screen image.
- Added mission screen overlays. Can be disabled by setting "this._disableOverlays = true;" in "xenonui.js".
- Fixed issue with BGS where the F6 overlay image was being removed.
- Fixed issue where exiting the Ship Library screen would sometimes show the wrong background.
- Added mission screen exception for Random Hits.

1.3.3
- Added screenID exceptions for UPS Courier.
- Added screedID exceptions for Escort Contracts (v1.6.3).
- Added routine to use 1.83/4 code to check for big GUI HUD's.

1.3.2
- Fixed Javascript bug.

1.3.1
- Added screenID exceptions for Blackmonks.
- Fixed issue where all components were not being disabled correctly when no resource packs are installed.

1.3.0
- Checks for the "allow_big_gui" option on HUD's. Uses the "nohud" background variations when found.
- Fixed issue where the wrong background was being selected going to or from the F8 Market screen if Market Observer is installed.
- Added screenID exceptions for Rescue Stations.

1.2.0
- Updated all images to be 2048x1024 to stop Oolite from rescaling them. Results in a much cleaner image.
- Fixed issue with mission screens that exit to the short or long range chart, where the wrong background was being displayed.
- Added screenID's to nova mission screens.
- Moved the music file back into the main OXP so it doesn't have to be in all the resource packs.
- Added a paused overlay.
- Added a legend overlay to the Galactic chart screens to aid in understanding the various highlight modes.
- Added a routine to check for the presence of resource pack, and output an error to the log if no pack is found.
- Added a "requires_oxp" section to all resource packs to require the main OXP.

1.1.4
- Adjusted the main title colour to match with the background.
- Adjusted graphical elements to line up better between screens, as noted by Tichy.
- Fixed issue with Trumbles and Nova missions not showing proper background image.
- Changed license of code section to CC-BY-NC-SA 3.0 due to inclusion of trumbles and nova mission code.

1.1.3
- Updated manifest to remove required OXP, as there are now two different resource packs available.

1.1.2
- Changed manifest identifier to try and position the OXP at the bottom of the install list

1.1.1
- Fixed bug where "." is missing before "indexOf".

1.1.0
- Split OXZ into two, one for resources (music and images), one for the code and config.
- Fixed file name issue for one of the files.
- Code improvements as suggested by Wildeblood.
- Added exception for Norby's forthcoming OXP (HDBG)
- Added some BGS override exceptions

1.0
- Initial release.
