Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
053c4cc
First additions: Zooming, hide labels, transparent fixed islands
Ixam97 May 27, 2025
60632f4
Update workflow
Ixam97 May 27, 2025
6a5c13d
Implemented Zoom with Scroll Wheel and Map Dragging with Right Click
Ixam97 May 28, 2025
7355ab6
Tweaked Hide Label feature
Ixam97 May 29, 2025
fd2483b
Added default labels for third party islands, fixed island type color…
Ixam97 May 29, 2025
ddde5d0
Using island images with transparency, added Arctic Old Nate to third…
Ixam97 May 29, 2025
79f5499
Simplified map zoom and pan.
Ixam97 May 29, 2025
e4c621f
Playing around with custom window frame
Ixam97 May 30, 2025
61f56ac
Check valid Map View transform when resizing Window, some visual tweaks.
Ixam97 May 31, 2025
f93082d
Show Slots on Map View when configured, moved label position
Ixam97 May 31, 2025
bc677a0
Implemented groundwork for Toolbar, moved some functions to Toolbar.
Ixam97 May 31, 2025
5ba1bc9
The currently selected Island always is on top.
Ixam97 Jun 1, 2025
7f44076
Redesigned start window, added BoolToStyle converter.
Ixam97 Jun 1, 2025
7d6c1e8
Windows get placed in screen center
Ixam97 Jun 1, 2025
768c0af
Simplyfied Start Window, tweaked asset loading to keep UI responsve, …
Ixam97 Jun 2, 2025
fa336a5
Further optimized ui responsiveness during asset loading
Ixam97 Jun 2, 2025
7c4c965
Restyled ComboBox, added new colors, adjusted overlays
Ixam97 Jun 2, 2025
61cc14a
Bump Windows Version
Ixam97 Jun 2, 2025
4ff3dcd
Added Quickstart setting
Ixam97 Jun 2, 2025
2a44a37
Added ContextMenu and ToolTip styling
Ixam97 Jun 3, 2025
b65bfd8
First undo experiments
Ixam97 Jun 4, 2025
dd4b1ca
Implemented proper UndoRedoStack
Ixam97 Jun 5, 2025
4bc7f7f
Added undo/redo for map creation and deletion
Ixam97 Jun 5, 2025
11456d4
Added keybinds for undo/redo, added action history, styled scrollbars
Ixam97 Jun 6, 2025
eb560b0
Adjusting namespace
Ixam97 Jun 6, 2025
86f4a8e
Added Undo/Redo For rotation and basic island properties
Ixam97 Jun 6, 2025
2298612
Added unified island properties
Ixam97 Jun 7, 2025
aabfcc3
Some more UI design adjustments
Ixam97 Jun 7, 2025
fb137ad
Integrated fertility selector into island properties.
Ixam97 Jun 9, 2025
3435057
Tweak sorting of fertility selectors
Ixam97 Jun 9, 2025
44fe6d2
Refactoring UnifiedIslandProperties
Ixam97 Jun 10, 2025
b62d865
Added undo/redo fo island label
Ixam97 Jun 11, 2025
9e438f3
Remove islands command added
Ixam97 Jun 11, 2025
b4f0584
Added undo/redo for session region
Ixam97 Jun 13, 2025
c7fa7f9
Some more optimizations for island properties to reduce unnecessary p…
Ixam97 Jun 13, 2025
d0b4bc3
Created a custom control for Toolbar
Ixam97 Jun 13, 2025
1b261b5
Simplified map template properties, some styling tweaks
Ixam97 Jun 15, 2025
acc6195
Update Readme to reflect changes since 0.5.
Ixam97 Nov 19, 2025
323ff49
include new gif.
Ixam97 Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
# run: tar --exclude='*.pdb' -caf AnnoMapEditor.zip -C ./Build/ *

- name: Upload
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: AnnoMapEditor
path: Build/AnnoMapEditor.exe
Expand Down
2 changes: 1 addition & 1 deletion AnnoMapEditor.Tests/AnnoMapEditor.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand Down
15 changes: 3 additions & 12 deletions AnnoMapEditor/AnnoMapEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows7.0</TargetFramework>
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<StartupObject>AnnoMapEditor.App</StartupObject>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>9</LangVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<!-- <GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute> -->
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>true</GenerateAssemblyInformationalVersionAttribute>
Expand All @@ -31,7 +31,7 @@
<None Remove="Assets\maptype.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\app.ico" />
<Resource Include="Assets\app.ico" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Mods\Serialization\a7tinfo.xml">
Expand Down Expand Up @@ -89,20 +89,11 @@
</ItemGroup>

<ItemGroup>
<Page Update="UI\Controls\IslandProperties\FixedIslandProperties.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="UI\Controls\MapTemplateProperties.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="UI\Controls\IslandProperties\RandomIslandProperties.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="UI\Controls\MapView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<Generator>MSBuild:Compile</Generator>
Expand Down
3 changes: 3 additions & 0 deletions AnnoMapEditor/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<setting name="Xpath" serializeAs="String">
<value />
</setting>
<setting name="Quickstart" serializeAs="String">
<value>False</value>
</setting>
</AnnoMapEditor.UserSettings>
</userSettings>
</configuration>
20 changes: 19 additions & 1 deletion AnnoMapEditor/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@
xmlns:local="clr-namespace:AnnoMapEditor"
StartupUri="UI/Windows/Start/StartWindow.xaml">
<Application.Resources>
<ResourceDictionary Source="UI/Resources/Styles/Colors.xaml" />
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="UI/Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/FontFamilies.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/Button.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/ToggleButton.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/TextBox.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/HintTextBox.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/Label.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/ComboBox.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/DropDownButton.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/FancyToggle.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/WindowControlButton.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/ToolbarButton.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/ContextMenu.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/ToolTip.xaml" />
<ResourceDictionary Source="UI/Resources/Styles/Scrollbar.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
9 changes: 9 additions & 0 deletions AnnoMapEditor/DataArchives/Assets/Models/SessionAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ public static SessionAsset DetectFromPath(string filePath)
return OldWorld;
}

public static SessionAsset DetectFromGuid(long guid)
{
if (guid == SESSION_SUNKENTREASURES_GUID) return CapeTrelawney;
if (guid == SESSION_ARCTIC_GUID) return Arctic;
if (guid == SESSION_NEWWORLD_GUID) return NewWorld;
if (guid == SESSION_ENBESA_GUID) return Enbesa;
else return OldWorld;
}


public override string ToString() => DisplayName;
}
Expand Down
17 changes: 10 additions & 7 deletions AnnoMapEditor/DataArchives/Assets/Repositories/AssetRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public override async Task InitializeAsync()
{
try
{
assetsXmlStream = File.OpenRead(CachedAssetsXml);
assetsXmlStream = await Task.Run(() => File.OpenRead(CachedAssetsXml));
}
catch (Exception e)
{
Expand All @@ -135,7 +135,7 @@ public override async Task InitializeAsync()
}
}

var Xml = XDocument.Load(assetsXmlStream);
var Xml = await Task.Run(() => XDocument.Load(assetsXmlStream));
var assets = Xml.XPathSelectElements(xpath);

if (!validCache)
Expand All @@ -144,7 +144,7 @@ public override async Task InitializeAsync()
UserSettings.Default.Xpath = xpath;
UserSettings.Default.Save();
assetsXmlStream.Dispose();
RenewCache(assets);
await Task.Run(() => RenewCache(assets));
}

var convertAssetTasks = assets.Select(assetElement =>
Expand All @@ -155,13 +155,16 @@ public override async Task InitializeAsync()
});
var assetList = await Task.WhenAll(convertAssetTasks);

foreach (var asset in assetList)
await Task.Run(() =>
{
if (asset is not null)
foreach (var asset in assetList)
{
_assets.Add(asset.GUID, asset);
if (asset is not null)
{
_assets.Add(asset.GUID, asset);
}
}
}
});

_logger.LogInformation($"Finished Deserialising at {watch.Elapsed.TotalMilliseconds} ms.");
_logger.LogInformation($"Resolving asset references...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public override async Task InitializeAsync()

var mapFilePaths = _dataArchive.Find("*.a7m");

var tasks = mapFilePaths.Select(mapFilePath =>
var tasks = mapFilePaths.Select(mapFilePath =>
{
return Task.Run(() => LoadIslandAsset(mapFilePath));
return LoadIslandAssetAsync(mapFilePath);
});

var islandAssets = await Task.WhenAll(tasks);
Expand All @@ -58,15 +58,17 @@ public override async Task InitializeAsync()
_logger.LogInformation($"Finished loading fixed islands. Loaded {_islands.Count} islands in {watch.Elapsed.TotalMilliseconds} ms.");
}

public FixedIslandAsset LoadIslandAsset(String mapFilePath)
public async Task<FixedIslandAsset> LoadIslandAssetAsync(String mapFilePath)
{
// thumbnail
string thumbnailPath = Path.Combine(
Path.GetDirectoryName(mapFilePath)!,
"_gamedata",
Path.GetFileNameWithoutExtension(mapFilePath),
"mapimage.png");
BitmapImage thumbnail = _dataArchive.TryLoadPng(thumbnailPath)
Path.GetDirectoryName(mapFilePath)!,
"_gamedata",
Path.GetFileNameWithoutExtension(mapFilePath),
"activemapimage.png"
);

BitmapImage thumbnail = await Task.Run(() => _dataArchive.TryLoadPng(thumbnailPath))
?? throw new Exception($"Could not load island thumbnail '{thumbnailPath}'.");

// open a7minfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

public bool TryGetByFilePath(string mapFilePath, [NotNullWhen(false)] out IslandAsset islandAsset)
#pragma warning disable CS8762 // Parameter must have a non-null value when exiting in some condition.
=> _byFilePath.TryGetValue(mapFilePath, out islandAsset);

Check warning on line 65 in AnnoMapEditor/DataArchives/Assets/Repositories/IslandRepository.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.

Check warning on line 65 in AnnoMapEditor/DataArchives/Assets/Repositories/IslandRepository.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.
#pragma warning restore CS8762 // Parameter must have a non-null value when exiting in some condition.

public override Task InitializeAsync()
Expand Down Expand Up @@ -111,11 +111,8 @@

public static IslandType DetectIslandTypeFromPath(string filePath)
{
if (filePath.Contains("_d_"))
return IslandType.Decoration;

else
return IslandType.Normal;
string fileName = Path.GetFileNameWithoutExtension(filePath);
return IslandType.FromIslandFileName(fileName);
}

public static IslandSize DetectDefaultIslandSizeFromPath(string filePath)
Expand Down
6 changes: 6 additions & 0 deletions AnnoMapEditor/DataArchives/DataArchiveFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using AnnoRDA;
using AnnoRDA.Builder;
using System;
using System.Threading.Tasks;

namespace AnnoMapEditor.DataArchives
{
Expand All @@ -12,6 +13,11 @@ public class DataArchiveFactory : IDataArchiveFactory
private static readonly string[] EXTENSION_WHITELIST = new[] { "*.a7tinfo", "*.png", "*.a7minfo", "*.a7t", "*.a7te", "assets.xml", "*.a7m", "*.dds" };


public async Task<IDataArchive> CreateDataArchiveAsync(string dataPath)
{
return await Task.Run(() => CreateDataArchive(dataPath));
}

public IDataArchive CreateDataArchive(string dataPath)
{
// RdaDataArchive
Expand Down
28 changes: 19 additions & 9 deletions AnnoMapEditor/DataArchives/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,32 @@ private DataManager()

public async Task TryInitializeAsync(string dataPath)
{
if (dataPath.Length == 0)
{
UpdateStatus(false, false, "Empty Data String");
return;
}

UpdateStatus(isInitializing: true, isInitialized: false);
_logger.LogInformation($"Initializing DataManager at '{dataPath}'.");

try
{

DataArchiveFactory dataArchiveFactory = new();
_dataArchive = dataArchiveFactory.CreateDataArchive(dataPath);
_dataArchive = await dataArchiveFactory.CreateDataArchiveAsync(dataPath);

_assetRepository = new AssetRepository(_dataArchive);
_assetRepository.Register<RegionAsset>();
_assetRepository.Register<FertilityAsset>();
_assetRepository.Register<RandomIslandAsset>();
_assetRepository.Register<SlotAsset>();
_assetRepository.Register<MinimapSceneAsset>();
_assetRepository.Register<SessionAsset>();
_assetRepository.Register<MapTemplateAsset>();
await Task.Run(() =>
{
_assetRepository.Register<RegionAsset>();
_assetRepository.Register<FertilityAsset>();
_assetRepository.Register<RandomIslandAsset>();
_assetRepository.Register<SlotAsset>();
_assetRepository.Register<MinimapSceneAsset>();
_assetRepository.Register<SessionAsset>();
_assetRepository.Register<MapTemplateAsset>();
});
await _assetRepository.InitializeAsync();

_fixedIslandRepository = new FixedIslandRepository(_dataArchive);
Expand All @@ -89,7 +99,7 @@ public async Task TryInitializeAsync(string dataPath)
await _islandRepository.InitializeAsync();

_mapGroupRepository = new MapGroupRepository(_dataArchive);
_mapGroupRepository.InitializeAsync();
await _mapGroupRepository.InitializeAsync();
}
catch (Exception ex)
{
Expand Down
38 changes: 37 additions & 1 deletion AnnoMapEditor/MapTemplates/Enums/IslandType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class IslandType

public static readonly IEnumerable<IslandType> All = new[] { Normal, Starter, Decoration, ThirdParty, PirateIsland, Cliff };


public readonly string Name;

public readonly short? ElementValue;
Expand Down Expand Up @@ -59,6 +58,43 @@ public static IslandType FromElementValue(short? elementValue)

return type;
}
public static IslandType FromIslandFileName(string fileName)
{
switch (fileName)
{
case "moderate_3rdparty02_01":
case "colony01_3rdparty05_01":
case "moderate_3rdparty06_01":
case "moderate_3rdparty07_01":
case "moderate_3rdparty08_01":
case "colony03_3rdparty09_01":
case "colony03_d_18":
return ThirdParty;
case "moderate_3rdparty03_01":
case "colony01_3rdparty04_01":
return PirateIsland;
default:
if (fileName.Contains("_d_") || fileName.Contains("_dst_") || fileName.Contains("_battlesite_")|| fileName.Contains("_encounter_")) return Decoration;
return Normal;
}
}

public static string? DefaultIslandLabelFromFileName(string fileName)
{
return fileName switch
{
"moderate_3rdparty02_01" => "Sir Archibald Blake",
"colony01_3rdparty05_01" => "Isabel Sarmento",
"moderate_3rdparty06_01" => "Old Nate",
"colony03_d_18" => "Old Nate (Arctic)",
"moderate_3rdparty07_01" => "Eli Bleakworth",
"moderate_3rdparty08_01" => "Madame Kahina",
"colony03_3rdparty09_01" => "Qumaq",
"moderate_3rdparty03_01" => "Anne Harlow",
"colony01_3rdparty04_01" => "Jean La Fortune",
_ => null,
};
}


public override string ToString() => Name;
Expand Down
12 changes: 12 additions & 0 deletions AnnoMapEditor/MapTemplates/Enums/MapElementType.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using AnnoMapEditor.Utilities;
using System.Linq;
using AnnoMapEditor.MapTemplates.Models;

namespace AnnoMapEditor.MapTemplates.Enums
{
Expand Down Expand Up @@ -35,5 +36,16 @@ public static MapElementType FromElementValue(int? elementValue)

return mapElementType;
}

public static MapElementType FromElement(MapElement mapElement)
{
return mapElement switch
{
FixedIslandElement => FixedIsland,
RandomIslandElement => PoolIsland,
StartingSpotElement => StartingSpot,
_ => FixedIsland
};
}
}
}
6 changes: 2 additions & 4 deletions AnnoMapEditor/MapTemplates/Models/FixedIslandElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ public bool RandomizeRotation
get => _randomizeRotation;
set {
SetProperty(ref _randomizeRotation, value);

if (!value && Rotation == null)
Rotation = 0;
if (!value && Rotation == null) Rotation = 0;
}
}
private bool _randomizeRotation = true;
Expand Down Expand Up @@ -70,7 +68,7 @@ public bool RandomizeFertilities
public bool RandomizeSlots
{
get => _randomizeSlots;
set => SetProperty(ref _randomizeSlots, value);
set => SetProperty( ref _randomizeSlots, value);
}
private bool _randomizeSlots = true;

Expand Down
4 changes: 1 addition & 3 deletions AnnoMapEditor/MapTemplates/Models/IslandElement.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Anno.FileDBModels.Anno1800.MapTemplate;
using AnnoMapEditor.MapTemplates.Enums;
using AnnoMapEditor.Utilities;
using IslandType = AnnoMapEditor.MapTemplates.Enums.IslandType;

namespace AnnoMapEditor.MapTemplates.Models
Expand Down Expand Up @@ -45,8 +44,7 @@ public IslandElement(IslandType islandType)
{
_islandType = islandType;
}



// ---- Serialization ----

public IslandElement(Element sourceTemplate)
Expand Down
Loading
Loading