-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDlcTextConverter.cs
75 lines (68 loc) · 2.56 KB
/
DlcTextConverter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using Imya.Enums;
using Imya.Models;
using Imya.Texts;
using Imya.Utils;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Windows.Data;
using System.Windows.Markup;
namespace Imya.UI.ValueConverters
{
/// <summary>
/// A converter that maps DLC IDs to LocalizedTexts
/// </summary>
[ValueConversion(typeof(DlcId), typeof(LocalizedText))]
public class DlcTextConverter : IValueConverter
{
private ITextManager TextManager;
public DlcTextConverter(ITextManager textManager)
{
TextManager = textManager;
}
private Dictionary<DlcId, String> DlcTextMapping = new Dictionary<DlcId, String>
{
{ DlcId.SunkenTreasures, "DLC_SUNKENTREASURES"},
{ DlcId.Botanica, "DLC_BOTANICA" },
{ DlcId.ThePassage,"DLC_PASSAGE" },
{ DlcId.SeatOfPower, "DLC_SEATOFPOWER" },
{ DlcId.BrightHarvest, "DLC_BRIGHTHARVEST" },
{ DlcId.LandOfLions, "DLC_LANDOFLIONS" },
{ DlcId.Docklands, "DLC_DOCKLANDS" },
{ DlcId.Tourism, "DLC_TOURISTSEASON" },
{ DlcId.Highlife, "DLC_HIGHLIFE" },
{ DlcId.Christmas, "DLC_CHRISTMAS" },
{ DlcId.AmusementPark, "DLC_AMUSEMENTPARK" },
{ DlcId.CityLife, "DLC_CITYLIFE" },
{ DlcId.VehicleSkins, "DLC_VEHICLESKINS" },
{ DlcId.PedestrianZone, "DLC_PEDESTRIANZONE" },
{ DlcId.VibrantCity, "DLC_VIBRANTCITY" },
{ DlcId.Anarchist, "DLC_ANARCHIST" },
{ DlcId.SeedsOfChange, "DLC_SEEDSOFUSELESS" },
{ DlcId.EmpireOfTheSkies, "DLC_AIRSHIPS" },
{ DlcId.NewWorldRising, "DLC_NEWWORLDRISING" },
{ DlcId.SeasonalDecorations, "DLC_SEASONALDECORATIONS" },
{ DlcId.IndustryOrnaments, "DLC_INDUSTRYORNAMENTS" },
{ DlcId.OldTown, "DLC_OLDTOWN" }
};
public object Convert(object value, Type TargetType, object parameter, CultureInfo Culture)
{
var dlc = (DlcId)value;
return TextManager[GetDlcText(dlc)];
}
private String GetDlcText(DlcId id)
{
if (DlcTextMapping.TryGetValue(id, out String? Filepath))
{
return Filepath;
}
else return "NO_TEXT";
}
public object ConvertBack(object value, Type TargetType, object parameter, CultureInfo Culture)
{
throw new NotImplementedException();
}
}
}