-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
213 changed files
with
4,642 additions
and
1,026 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows; | ||
using System.Windows.Data; | ||
using System.Windows.Markup; | ||
|
||
namespace Sakuno.KanColle.Amatsukaze | ||
{ | ||
public class ExtraStringResourceExtension : MarkupExtension | ||
{ | ||
ExtraStringResourceType r_Type; | ||
string r_IDPath; | ||
string r_OriginalTextPath; | ||
|
||
public string StringFormat { get; set; } | ||
|
||
public ExtraStringResourceExtension(ExtraStringResourceType rpType, string rpIDPath, string rpOriginalTextPath) | ||
{ | ||
r_Type = rpType; | ||
r_IDPath = rpIDPath; | ||
r_OriginalTextPath = rpOriginalTextPath; | ||
} | ||
|
||
public override object ProvideValue(IServiceProvider rpServiceProvider) | ||
{ | ||
var rResult = new MultiBinding() { Mode = BindingMode.OneWay, Converter = Converter.Instance, ConverterParameter = r_Type, StringFormat = StringFormat }; | ||
rResult.Bindings.Add(new Binding(r_IDPath)); | ||
rResult.Bindings.Add(new Binding(r_OriginalTextPath)); | ||
rResult.Bindings.Add(new Binding(nameof(StringResources.Instance.Extra)) { Source = StringResources.Instance }); | ||
|
||
return rResult.ProvideValue(rpServiceProvider); | ||
} | ||
|
||
class Converter : IMultiValueConverter | ||
{ | ||
public static Converter Instance { get; } = new Converter(); | ||
|
||
public object Convert(object[] rpValues, Type rpTargetType, object rpParameter, CultureInfo rpCulture) | ||
{ | ||
if (rpValues[0] == DependencyProperty.UnsetValue || rpValues[1] == DependencyProperty.UnsetValue) | ||
return string.Empty; | ||
|
||
var rType = (ExtraStringResourceType)rpParameter; | ||
var rID = (int)rpValues[0]; | ||
var rOriginalText = rpValues[1]; | ||
var rESR = (ExtraStringResources)rpValues[2]; | ||
|
||
if (rESR == null) | ||
return rOriginalText; | ||
|
||
var rTranslations = rESR.GetTranslations(rType); | ||
if (rTranslations == null) | ||
return rOriginalText; | ||
|
||
string rTranslatedText; | ||
if (!rTranslations.TryGetValue(rID, out rTranslatedText)) | ||
return rOriginalText; | ||
|
||
return rTranslatedText; | ||
} | ||
|
||
public object[] ConvertBack(object rpValue, Type[] rpTargetTypes, object rpParameter, CultureInfo rpCulture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ public enum ExtraStringResourceType | |
{ | ||
Ship, | ||
ShipType, | ||
AbyssalShip, | ||
Equipment, | ||
Item, | ||
Expedition, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Sakuno.KanColle.Amatsukaze.Models.Preferences | ||
{ | ||
public class GamePreference | ||
{ | ||
[JsonProperty("main_los_formula")] | ||
public int MainFleetLoSFormula { get; set; } = 3; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
HeavenlyWind.Base/Models/Preferences/NotificationPreference.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Sakuno.KanColle.Amatsukaze.Models.Preferences | ||
{ | ||
public class NotificationPreference | ||
{ | ||
[JsonProperty("expedition")] | ||
public bool Expedition { get; set; } = true; | ||
|
||
[JsonProperty("repair")] | ||
public bool Repair { get; set; } = true; | ||
|
||
[JsonProperty("construction")] | ||
public bool Construction { get; set; } = true; | ||
|
||
[JsonProperty("heavily_damaged")] | ||
public bool HeavilyDamagedWarning { get; set; } = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Sakuno.KanColle.Amatsukaze.Models.Preferences | ||
{ | ||
public class UpdatePreference | ||
{ | ||
[JsonProperty("notification")] | ||
public UpdateNotificationMode NotificationMode { get; set; } = UpdateNotificationMode.AlwaysShow; | ||
|
||
[JsonProperty("channel")] | ||
public UpdateChannel UpdateChannel { get; set; } = UpdateChannel.Release; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.