Theme

From BotF2-Wiki
Jump to: navigation, search

Intro

We are still finding out how that works.

Atm we have two different ways:

  • new one (created by Hannes): defines a BasePath and a Filename in game's folder "Resources", and in the middle the players race is filled in
       private const string MusicThemeBasePath = "Resources/Themes";
       private const string MusicPackFileName = "MusicPacks.xml";

Advantage: easier to code

Disadvantage: files are separated


  • this new one is already done for \Resources\UI, but there only the *.png are included, no xaml. (Example: shipyard_dock.png for each race)
  • suggestion (by reg): doing all new stuff into \Resources\Themes, separated by played race.
  • an older option is to put all files into one folder and separate it by filename
    • examples: fed_destroyer.png, card_destroyer.png
    • another example: audio files for TaskForceOrders


Screens

In the source code (not in the game's folder) just one theme is done -> the Federation theme.

AND: Mostly it's done by xaml-files defining the design with bindings to a binded .cs-file where the code for each design object is coded.

Example: to select a ship to build...

  • ...the design is in NewShipSelectionView.xaml
  • ...but the code for double click or others is in NewShipSelectionView.xaml.cs

All relevant design objects are binded somehow to somewhere (for example to create the list which ships are buildable, depending by tech level, own race and more)


I assume it's necessary to bring theme data from repositories folder into the folder delivered with the game


Here some xaml out of repositories folder:

\Mainline\SupremacyClient\themes\Default.xaml

  • maybe for StartGame-Screen: \Mainline\SupremacyClient\themes\Default.xaml
   <ResourceDictionary Source="/SupremacyClient;component/themes/Global.xaml"/>
   <ResourceDictionary Source="/SupremacyClient;component/themes/MessageDialog.xaml"/>
   <ResourceDictionary Source="/SupremacyClient;component/themes/MenuScreen.xaml"/>

\Mainline\SupremacyClient\themes\Global.xaml

  • \Mainline\SupremacyClient\themes\Global.xaml
   <ResourceDictionary Source="pack://siteoforigin:,,,/Resources/Geometry/Glyphs.xaml" />
   <ResourceDictionary Source="pack://siteoforigin:,,,/Resources/Images/Resources/Icons.xaml" />

\Mainline\SupremacyClient\ClientApp.xaml

  • \Mainline\SupremacyClient\ClientApp.xaml
   <ResourceDictionary Source="themes/Default.xaml"/>

MusicPack

(done by Hannes)

WEB Links

WPF Drawing

example from glyphs.xaml: F1 M 5.99749,9.99944L 5.99749,13.9994L 14.9987,13.9994L 9.99805,18L 16.999,18L 24,11.9992L 16.999,5.99832L 9.99804,5.99832L 14.9987,9.99888L 5.99749,9.99944 Z

  • Path Markup Syntax https://msdn.microsoft.com/library/ms752293%28v=vs.110%29.aspx
    • F1 - specifies the Nonzero fill rule.
    • M - startPoint
    • L - endPoint
    • H x - Creates a horizontal line between the current point and the specified x-coordinate. H 90 is an example of a valid horizontal line command.
    • V y - Creates a vertical line between the current point and the specified y-coordinate. v 90 is an example of a valid vertical line command. Y is the y-coordinate of the end point of the line.
    • C - controlPoint1 controlPoint2 endPoint Creates a cubic Bezier curve between the current point and the specified end point by using the two specified control points (controlPoint1 and controlPoint2). C 100,200 200,400 300,200 is an example of a valid curve command.
    • Z - Ends the current figure and creates a line that connects the current point to the starting point of the figure. This command creates a line-join (corner) between the last segment and the first segment of the figure.