Commit Graph

87 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
RoosterDragon
93a97d5d6f Fix CA1851, assume_method_enumerates_parameters = true 2023-08-20 20:41:27 +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
michaeldgg2
e64c0a35c5 ProductionPaletteWidget: offset and align for queued count is now customizable 2023-03-12 15:10:26 +01:00
IceReaper
fceab4f388 Allow mods to override production widgets text colors. 2023-03-10 20:31:15 +01:00
abcdefg30
5bf7fe852c Remove the copyright year numbers 2023-01-11 11:58:54 +02:00
EoralMilk
949ef1662d Add mouse scroll to ProductionPaletteWidget 2022-10-28 19:33:57 +02:00
Gustas
e743e6dd61 Simplify boolean expressions in ProductionPaletteWidget 2022-10-20 19:20:45 +02:00
Gustas
af3d6792b8 Fix ProductionPalette ClockAnimation and NotBuildableAnimation being ignored. 2022-10-20 19:20:45 +02:00
Gustas
858d782af1 Simplify 'default' expression (IDE0034) 2022-10-11 17:40:05 +02:00
Mustafa Alperen Seki
1b1868fca6 Render every available ProductionIconOverlay. 2022-08-16 15:08:51 +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
235fb19aa8 Cache overlay traits in ProductionPaletteWidget
Instead of looking this up every Draw tick,
cache and update it only when a non-null new
CurrentQueue is set (as the overlays can only change
at that time).
2020-08-21 18:06:18 +02:00
reaperrr
c0f54fa4fc Cache offsets in ProductionPaletteWidget
At least those that never change.
2020-08-21 18:06:18 +02:00
teinarss
27f1a7ab27 Use out var syntax 2020-08-19 18:11:07 +01:00
Matthias Mailänder
15010f9567 Fix production palette ignoring yaml font overrides. 2020-08-15 16:13:21 +01:00
Matthias Mailänder
c546cb552e Make the fonts configurable. 2020-08-09 13:14:32 +02:00
Matthias Mailänder
10f8836d7b Fix a null reference exception. 2020-08-09 13:14:32 +02:00
Matthias Mailänder
9050a2447b Add remappable support to production icons. 2020-03-04 22:02:30 +01:00
abc013
c0ece00c4b Prevent production cycling when producing actor does not occupy space 2020-02-26 23:25:41 +01:00
Ivaylo Draganov
1bcad55c1f Add a hotkey to select the current production facility 2020-02-22 20:06:21 +00: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
RoosterDragon
31918e8712 Add UnionRectangles extension method. 2019-09-14 22:09:40 +02:00
Paul Chote
78a70be0d4 Fix and enable SA1133, SA1134 style rules. 2019-05-24 10:47:57 +02:00
Paul Chote
72dbb871ac Add faction specific tooltip backgrounds. 2019-05-15 21:05:49 +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
Paul Chote
64c853a4e0 Only play queued notification if queue is empty.
This matches the behaviour of the RA2 sidebar.
2019-01-26 21:36:45 +00:00
Paul Chote
8d276ff9de Replace broken (Disabled)TabClick and with (Disabled)ClickSound. 2019-01-26 21:36:45 +00:00
Andre Mohren
0fca984463 Implemented InfiniteBuildAfter. 2018-11-17 17:39:18 +00:00
Ivaylo Draganov
a7279415dc Allow player to add a "priority unit" to production queue
* If production is ordered by `Ctrl + Left Click` the item is added to the top of the stack after the currently produced item
* Works with `Shift` for priority queueing of 5 items
* This modifier is not taken into account for `ParallelProductionQueue` as it doesn't make sense in that context
2018-11-03 17:54:50 +01:00
Andre Mohren
3bfcecd539 Refactored ProductionQueue to support different production styles. 2018-09-30 16:58:49 +02:00
Paul Chote
f2cf51d1a4 Play appropriate audio notifications when build/production limit is reached. 2018-04-22 18:01:57 +02:00
Mustafa Alperen Seki
356f24b78c Add logic to disallowing On Hold on a queue. 2018-03-18 15:58:57 +01: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