Commit Graph

47 Commits

Author SHA1 Message Date
RoosterDragon
b7e0ed9b87 Improve lookups of nodes by key in MiniYaml.
When handling the Nodes collection in MiniYaml, individual nodes are located via one of two methods:

// Lookup a single key with linear search.
var node = yaml.Nodes.FirstOrDefault(n => n.Key == "SomeKey");

// Convert to dictionary, expecting many key lookups.
var dict = nodes.ToDictionary();

// Lookup a single key in the dictionary.
var node = dict["SomeKey"];

To simplify lookup of individual keys via linear search, provide helper methods NodeWithKeyOrDefault and NodeWithKey. These helpers do the equivalent of Single{OrDefault} searches. Whilst this requires checking the whole list, it provides a useful correctness check. Two duplicated keys in TS yaml are fixed as a result. We can also optimize the helpers to not use LINQ, avoiding allocation of the delegate to search for a key.

Adjust existing code to use either lnear searches or dictionary lookups based on whether it will be resolving many keys. Resolving few keys can be done with linear searches to avoid building a dictionary. Resolving many keys should be done with a dictionary to avoid quaradtic runtime from repeated linear searches.
2023-09-23 14:31:04 +02:00
Matthias Mailänder
1899eed839 Add localisation support to transient lines. 2023-08-19 20:46:04 +03:00
RoosterDragon
d83e579dfe Fix CA1305 2023-08-07 21:38:09 +02:00
RoosterDragon
8a285f9b19 Fix IDE0090 2023-04-08 16:51:51 +03:00
abcdefg30
5bf7fe852c Remove the copyright year numbers 2023-01-11 11:58:54 +02:00
Matthias Mailänder
acc2c11e69 Fix SupportPowers ClockAnimation being ignored. 2022-10-17 14:20:11 +03:00
abcdefg30
6a31b1f9f3 Update the copyright header year 2022-05-28 00:35:10 -05:00
Ivaylo Draganov
24b9482cc1 Add support for transient text notifications matching speech notifications 2022-04-30 12:39:29 +01:00
Matthias Mailänder
0e7ad43425 Remove unused parameters. 2022-04-01 23:30:26 +02:00
penev92
bf332b6619 Fixed fields missing the readonly modifier 2022-01-22 18:47:06 +00:00
Matthias Mailänder
07815143f1 Fix CA1825 warnings on empty array initialisation. 2021-12-06 13:19:28 +01:00
Paul Chote
8e94e1d5ec Rework WidgetUtil sprite rendering helpers. 2021-07-25 00:32:17 +02:00
Andre Mohren
6810469634 Updated copyright years. 2021-06-29 18:33:21 -05:00
teinarss
10676be377 Replace F extension with string interpolation 2021-05-08 22:20:59 +02:00
teinarss
4a1e4f3e16 Use expression body syntax 2021-03-07 13:00:52 +00:00
Paul Chote
6e7ad9df25 Remove vestigial translation plumbing.
This was never completed to the level required to
be properly used ingame.
2020-12-25 16:18:28 +01:00
reaperrr
36d5ae5421 Cache SupportPowersWidget offsets at initialization
As well as overlay font.
2020-08-27 21:17:37 +02:00
Matthias Mailänder
9d179d9a1a Initialize the font only once and make it configurable. 2020-08-15 16:13:21 +01:00
Matthias Mailänder
d187575a2c Make support power icons configurable and testable. 2020-04-18 13:56:26 -05:00
Paul Chote
1bc6fb0f46 Use antialiasing filter when rendering UI icons and actors. 2020-01-26 20:22:49 +01:00
abcdefg30
23b3c237b7 Update the year numbers in all license headers to 2020 2020-01-05 17:00:34 +00:00
Paul Chote
1fa90c0474 Allow support powers to override the icon overlay/tooltip labels. 2019-11-17 17:06:29 +01:00
Paul Chote
70b020205d Rename *Time to *Ticks and increase internal resolution. 2019-11-17 17:06:29 +01:00
RoosterDragon
31918e8712 Add UnionRectangles extension method. 2019-09-14 22:09:40 +02:00
Ivaylo Draganov
a85b634655 Add SupportPowerPaletteOrder to SupportPowerInfo 2019-06-15 09:55:22 +02:00
teinarss
c89f4b7a76 Added tooltip to support powers in spec ui 2019-05-26 19:08:24 +01:00
Paul Chote
78a70be0d4 Fix and enable SA1133, SA1134 style rules. 2019-05-24 10:47:57 +02:00
Paul Chote
ab4a7e3558 Replace System.Drawing primitives with our own. 2019-03-04 18:26:42 +00:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
Unknown
c97f36793c Implemented horizontal allign support for SupportPowersWidget 2018-08-04 17:39:18 +02:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Paul Chote
2f79173044 Migrate hotkey consumers to HotkeyManager. 2017-12-08 01:29:15 +01:00
Paul Chote
811427adc4 Add HotkeyReference.IsActivatedBy method. 2017-12-08 01:29:15 +01:00
Paul Chote
c4237d6a1a Rename NamedHotkey to HotkeyReference. 2017-12-08 01:29:15 +01:00
Paul Chote
1e4640dc0b Clean up SupportPowerTooltipLogic:
- Avoid creating unnecessary bindings
- Avoid duplicated text size calculations
- Relayout panel when (and only when) needed
- Color timer red when paused
2017-09-10 21:30:55 +02:00
Paul Chote
2a6bb0678e Move hardcoded support power keys into yaml. 2017-09-10 21:30:55 +02:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Paul Chote
9ddfdc45b3 Introduce SoundType enum. 2016-12-23 11:34:23 +00:00
abcdefg30
6de12fb0e9 Add SpeechNotifications for InsufficientPower and Launch on support powers 2016-07-03 16:21:07 +02:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
Paul Chote
ef55d646f7 Unstatic the Sound class. 2015-09-20 14:11:06 +01:00
Paul Chote
1109ec53d1 Update UI timers for variable game speed. 2015-09-06 17:48:42 +01:00
reaperrr
8e9da7f897 unhardcode palettes and sequences 2015-08-22 16:09:07 +02:00
Zimmermann Gyula
d5a5640f52 Adds an IconPalette property to Buildable and SupportPower traits. 2015-06-12 20:33:58 +02:00
sinf
9250c61473 Added Hotkeys for support powers 2015-04-25 13:15:06 +03:00
reaperrr
be9d37f30e Moves SupportPowers and related Widgets to Mods.Common 2015-01-15 13:18:11 +01:00