Skip to content

Commit

Permalink
Add DisplayAttribute to th16.5 enums
Browse files Browse the repository at this point in the history
  • Loading branch information
y-iihoshi committed Dec 31, 2024
1 parent 434e7fa commit a29e791
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
33 changes: 5 additions & 28 deletions TemplateGenerator/Models/Th165/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,14 @@ public static class Definitions
{
public static string Title { get; } = StringResources.TH165;

public static IReadOnlyDictionary<string, (string Id, string Name)> DayNames { get; } = new[]
{
(Day.Sunday, "日曜日"),
(Day.Monday, "月曜日"),
(Day.Tuesday, "火曜日"),
(Day.Wednesday, "水曜日"),
(Day.Thursday, "木曜日"),
(Day.Friday, "金曜日"),
(Day.Saturday, "土曜日"),
(Day.WrongSunday, "裏・日曜日"),
(Day.WrongMonday, "裏・月曜日"),
(Day.WrongTuesday, "裏・火曜日"),
(Day.WrongWednesday, "裏・水曜日"),
(Day.WrongThursday, "裏・木曜日"),
(Day.WrongFriday, "裏・金曜日"),
(Day.WrongSaturday, "裏・土曜日"),
(Day.NightmareSunday, "悪夢日曜"),
(Day.NightmareMonday, "悪夢月曜"),
(Day.NightmareTuesday, "悪夢火曜"),
(Day.NightmareWednesday, "悪夢水曜"),
(Day.NightmareThursday, "悪夢木曜"),
(Day.NightmareFriday, "悪夢金曜"),
(Day.NightmareSaturday, "悪夢土曜"),
(Day.NightmareDiary, "ナイトメアダイアリー"),
}.ToDictionary(
static pair => pair.Item1.ToPattern(),
static pair => (pair.Item1.ToString(), pair.Item2));
public static IReadOnlyDictionary<string, (string Id, string Name)> DayNames { get; } =
EnumHelper<Day>.Enumerable.ToDictionary(
EnumExtensions.ToPattern,
static day => (day.ToString(), day.ToDisplayName()));

public static IReadOnlyDictionary<string, int> NumDreamsPerDay { get; } =
EnumHelper<Day>.Enumerable.ToDictionary(
static day => day.ToPattern(),
EnumExtensions.ToPattern,
static day => SpellCards.Count(pair => pair.Key.Day == day));

public static int NumNicknames { get; } = Nicknames.Count;
Expand Down
24 changes: 24 additions & 0 deletions ThScoreFileConverter.Core/Models/Th165/Day.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// </copyright>
//-----------------------------------------------------------------------

using System.ComponentModel.DataAnnotations;

namespace ThScoreFileConverter.Core.Models.Th165;

/// <summary>
Expand All @@ -15,132 +17,154 @@ public enum Day
/// <summary>
/// Sunday of week 1.
/// </summary>
[Display(Name = "日曜日")]
[Pattern("01")]
Sunday,

/// <summary>
/// Monday of week 1.
/// </summary>
[Display(Name = "月曜日")]
[Pattern("02")]
Monday,

/// <summary>
/// Tuesday of week 1.
/// </summary>
[Display(Name = "火曜日")]
[Pattern("03")]
Tuesday,

/// <summary>
/// Wednesday of week 1.
/// </summary>
[Display(Name = "水曜日")]
[Pattern("04")]
Wednesday,

/// <summary>
/// Thursday of week 1.
/// </summary>
[Display(Name = "木曜日")]
[Pattern("05")]
Thursday,

/// <summary>
/// Friday of week 1.
/// </summary>
[Display(Name = "金曜日")]
[Pattern("06")]
Friday,

/// <summary>
/// Saturday of week 1.
/// </summary>
[Display(Name = "土曜日")]
[Pattern("07")]
Saturday,

/// <summary>
/// Wrong Sunday of week 2.
/// </summary>
[Display(Name = "裏・日曜日")]
[Pattern("W1")]
WrongSunday,

/// <summary>
/// Wrong Monday of week 2.
/// </summary>
[Display(Name = "裏・月曜日")]
[Pattern("W2")]
WrongMonday,

/// <summary>
/// Wrong Tuesday of week 2.
/// </summary>
[Display(Name = "裏・火曜日")]
[Pattern("W3")]
WrongTuesday,

/// <summary>
/// Wrong Wednesday of week 2.
/// </summary>
[Display(Name = "裏・水曜日")]
[Pattern("W4")]
WrongWednesday,

/// <summary>
/// Wrong Thursday of week 2.
/// </summary>
[Display(Name = "裏・木曜日")]
[Pattern("W5")]
WrongThursday,

/// <summary>
/// Wrong Friday of week 2.
/// </summary>
[Display(Name = "裏・金曜日")]
[Pattern("W6")]
WrongFriday,

/// <summary>
/// Wrong Saturday of week 2.
/// </summary>
[Display(Name = "裏・土曜日")]
[Pattern("W7")]
WrongSaturday,

/// <summary>
/// Nightmare Sunday of week 3.
/// </summary>
[Display(Name = "悪夢日曜")]
[Pattern("N1")]
NightmareSunday,

/// <summary>
/// Nightmare Monday of week 3.
/// </summary>
[Display(Name = "悪夢月曜")]
[Pattern("N2")]
NightmareMonday,

/// <summary>
/// Nightmare Tuesday of week 3.
/// </summary>
[Display(Name = "悪夢火曜")]
[Pattern("N3")]
NightmareTuesday,

/// <summary>
/// Nightmare Wednesday of week 3.
/// </summary>
[Display(Name = "悪夢水曜")]
[Pattern("N4")]
NightmareWednesday,

/// <summary>
/// Nightmare Thursday of week 3.
/// </summary>
[Display(Name = "悪夢木曜")]
[Pattern("N5")]
NightmareThursday,

/// <summary>
/// Nightmare Friday of week 3.
/// </summary>
[Display(Name = "悪夢金曜")]
[Pattern("N6")]
NightmareFriday,

/// <summary>
/// Nightmare Saturday of week 3.
/// </summary>
[Display(Name = "悪夢土曜")]
[Pattern("N7")]
NightmareSaturday,

/// <summary>
/// Nightmare Diary.
/// </summary>
[Display(Name = "ナイトメアダイアリー")]
[Pattern("ND")]
NightmareDiary,
}

0 comments on commit a29e791

Please sign in to comment.