Skip to content

Commit

Permalink
style: format
Browse files Browse the repository at this point in the history
  • Loading branch information
Icexbb committed Dec 14, 2024
1 parent b8e234e commit ca06606
Show file tree
Hide file tree
Showing 38 changed files with 165 additions and 205 deletions.
68 changes: 34 additions & 34 deletions SekaiDataFetch/Data/EventStory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ public class EpisodeReward : ICloneable
public string StoryType { get; set; } = "";
public int ResourceBoxId { get; set; }

public static EpisodeReward FromJson(JObject json)
public object Clone()
{
return new EpisodeReward
{
StoryType = json.Get("storyType", ""),
ResourceBoxId = json.Get("resourceBoxId", 0)
StoryType = StoryType,
ResourceBoxId = ResourceBoxId
};
}

public object Clone()
public static EpisodeReward FromJson(JObject json)
{
return new EpisodeReward
{
StoryType = StoryType,
ResourceBoxId = ResourceBoxId
StoryType = json.Get("storyType", ""),
ResourceBoxId = json.Get("resourceBoxId", 0)
};
}
}
Expand All @@ -37,21 +37,6 @@ public class EventEpisode : ICloneable
public int ReleaseConditionId { get; set; }
public EpisodeReward[] EpisodeRewards { get; set; } = [];

public static EventEpisode FromJson(JObject json)
{
return new EventEpisode
{
Id = json.Get("id", 0),
EventStoryId = json.Get("eventStoryId", 0),
EpisodeNo = json.Get("episodeNo", 0),
Title = json.Get("title", ""),
AssetbundleName = json.Get("assetbundleName", ""),
ScenarioId = json.Get("scenarioId", ""),
ReleaseConditionId = json.Get("releaseConditionId", 0),
EpisodeRewards = json.Get("episodeRewards", Array.Empty<JObject>()).Select(EpisodeReward.FromJson).ToArray()
};
}

public object Clone()
{
return new EventEpisode
Expand All @@ -66,6 +51,21 @@ public object Clone()
EpisodeRewards = EpisodeRewards.Select(x => (EpisodeReward)x.Clone()).ToArray()
};
}

public static EventEpisode FromJson(JObject json)
{
return new EventEpisode
{
Id = json.Get("id", 0),
EventStoryId = json.Get("eventStoryId", 0),
EpisodeNo = json.Get("episodeNo", 0),
Title = json.Get("title", ""),
AssetbundleName = json.Get("assetbundleName", ""),
ScenarioId = json.Get("scenarioId", ""),
ReleaseConditionId = json.Get("releaseConditionId", 0),
EpisodeRewards = json.Get("episodeRewards", Array.Empty<JObject>()).Select(EpisodeReward.FromJson).ToArray()
};
}
}

public class EventStory : ICloneable
Expand All @@ -77,6 +77,19 @@ public class EventStory : ICloneable
public string AssetbundleName { get; set; } = "";
public EventEpisode[] EventStoryEpisodes { get; set; } = [];

public object Clone()
{
return new EventStory
{
Id = Id,
EventId = EventId,
Outline = Outline,
BannerGameCharacterUnitId = BannerGameCharacterUnitId,
AssetbundleName = AssetbundleName,
EventStoryEpisodes = EventStoryEpisodes.Select(x => (EventEpisode)x.Clone()).ToArray()
};
}

public static EventStory FromJson(JObject json)
{
return new EventStory
Expand All @@ -90,17 +103,4 @@ public static EventStory FromJson(JObject json)
.ToArray()
};
}

public object Clone()
{
return new EventStory
{
Id = Id,
EventId = EventId,
Outline = Outline,
BannerGameCharacterUnitId = BannerGameCharacterUnitId,
AssetbundleName = AssetbundleName,
EventStoryEpisodes = EventStoryEpisodes.Select(x => (EventEpisode)x.Clone()).ToArray()
};
}
}
46 changes: 23 additions & 23 deletions SekaiDataFetch/Data/GameEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace SekaiDataFetch.Data;

public class GameEvent :ICloneable
public class GameEvent : ICloneable
{
public int Id { get; set; }
public string EventType { get; set; } = "";
Expand All @@ -20,28 +20,6 @@ public class GameEvent :ICloneable
public int VirtualLiveId { get; set; }
public string Unit { get; set; } = "";

public static GameEvent FromJson(JObject json)
{
return new GameEvent
{
Id = json.Get("id", 0),
EventType = json.Get("eventType", ""),
Name = json.Get("name", ""),
AssetBundleName = json.Get("assetBundleName", ""),
BgmAssetBundleName = json.Get("bgmAssetBundleName", ""),
EventOnlyComponentDisplayStartAt = json.Get("eventOnlyComponentDisplayStartAt", 0L),
StartAt = json.Get("startAt", 0L),
AggregateAt = json.Get("aggregateAt", 0L),
RankingAnnounceAt = json.Get("rankingAnnounceAt", 0L),
DistributionStartAt = json.Get("distributionStartAt", 0L),
EventOnlyComponentDisplayEndAt = json.Get("eventOnlyComponentDisplayEndAt", 0L),
ClosedAt = json.Get("closedAt", 0L),
DistributionEndAt = json.Get("distributionEndAt", 0L),
VirtualLiveId = json.Get("virtualLiveId", 0),
Unit = json.Get("unit", "")
};
}

public object Clone()
{
return new GameEvent
Expand All @@ -63,4 +41,26 @@ public object Clone()
Unit = Unit
};
}

public static GameEvent FromJson(JObject json)
{
return new GameEvent
{
Id = json.Get("id", 0),
EventType = json.Get("eventType", ""),
Name = json.Get("name", ""),
AssetBundleName = json.Get("assetBundleName", ""),
BgmAssetBundleName = json.Get("bgmAssetBundleName", ""),
EventOnlyComponentDisplayStartAt = json.Get("eventOnlyComponentDisplayStartAt", 0L),
StartAt = json.Get("startAt", 0L),
AggregateAt = json.Get("aggregateAt", 0L),
RankingAnnounceAt = json.Get("rankingAnnounceAt", 0L),
DistributionStartAt = json.Get("distributionStartAt", 0L),
EventOnlyComponentDisplayEndAt = json.Get("eventOnlyComponentDisplayEndAt", 0L),
ClosedAt = json.Get("closedAt", 0L),
DistributionEndAt = json.Get("distributionEndAt", 0L),
VirtualLiveId = json.Get("virtualLiveId", 0),
Unit = json.Get("unit", "")
};
}
}
10 changes: 5 additions & 5 deletions SekaiDataFetch/List/ListEventStory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public class EventStoryImpl(EventStory es, GameEvent ge) : ICloneable
public readonly EventStory EventStory = es;
public readonly GameEvent GameEvent = ge;

public object Clone()
{
return new EventStoryImpl((EventStory)EventStory.Clone(), (GameEvent)GameEvent.Clone());
}

public string Url(int episode, SourceList.SourceType sourceType)
{
if (episode < 0 || episode >= EventStory.EventStoryEpisodes.Length)
Expand All @@ -93,9 +98,4 @@ public string Url(int episode, SourceList.SourceType sourceType)
_ => throw new ArgumentOutOfRangeException(nameof(sourceType), sourceType, null)
};
}

public object Clone()
{
return new EventStoryImpl((EventStory)EventStory.Clone(), (GameEvent)GameEvent.Clone());
}
}
4 changes: 3 additions & 1 deletion SekaiToolsCore/DialogMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ private MatchStatus DialogMatchContent(Mat img, DialogFrameSet dialog, Point poi

bool matchRes;

var matchingThreshold = dialog.Data.Shake ? config.MatchingThreshold.DialogSpecial : config.MatchingThreshold.DialogNormal;
var matchingThreshold = dialog.Data.Shake
? config.MatchingThreshold.DialogSpecial
: config.MatchingThreshold.DialogNormal;

switch (lastStatus)
{
Expand Down
8 changes: 3 additions & 5 deletions SekaiToolsCore/Process/TemplateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace SekaiToolsCore.Process;

public partial class TemplateManager
{
private const string MenuSignBase = "menu-107px.png";
private const string DbFontBase = "FOT-RodinNTLGPro-DB.otf";
private const string EbFontBase = "FOT-RodinNTLGPro-EB.otf";
private readonly Dictionary<string, Mat> _dbTemplate = new();
private readonly string[] _dbTexts;
private readonly Dictionary<string, Mat> _ebTemplate = new();
Expand All @@ -17,11 +20,6 @@ public partial class TemplateManager
private readonly Size _videoResolution;
private Mat? _menuSign;


private const string MenuSignBase = "menu-107px.png";
private const string DbFontBase = "FOT-RodinNTLGPro-DB.otf";
private const string EbFontBase = "FOT-RodinNTLGPro-EB.otf";

public TemplateManager(Size videoResolution, IEnumerable<string> dbTexts, IEnumerable<string> ebTexts,
bool noScale = false)
{
Expand Down
3 changes: 2 additions & 1 deletion SekaiToolsCore/SekaiToolsCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<PackageReference Include="Emgu.CV" Version="4.9.0.5494"/>
<PackageReference Include="Emgu.CV.Bitmap" Version="4.9.0.5494"/>
<PackageReference Include="Emgu.CV.runtime.windows" Version="4.9.0.5494"/>
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0"/>
<PackageReference Include="System.Text.Json" Version="9.0.0"/>
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions SekaiToolsCore/Story/Game/GameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ namespace SekaiToolsCore.Story.Game;

public class GameData()
{
public Snippet[] Snippets { get; set; } = [];
public SpecialEffect[] SpecialEffectData { get; set; } = [];
public Talk[] TalkData { get; set; } = [];

public GameData(string jsonFilePath) : this()
{
if (!File.Exists(jsonFilePath)) throw new Exception("File not found");

var jsonString = File.ReadAllText(jsonFilePath);
var data = JsonSerializer.Deserialize<GameData>(jsonString, new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true,
PropertyNameCaseInsensitive = true
}) ?? throw new Exception("Json parse error");

TalkData = data.TalkData;
Expand Down Expand Up @@ -77,6 +73,10 @@ public GameData(string jsonFilePath) : this()
.Where(seData => seData.EffectType is 8 or 18).ToArray();
}

public Snippet[] Snippets { get; set; } = [];
public SpecialEffect[] SpecialEffectData { get; set; } = [];
public Talk[] TalkData { get; set; } = [];

public bool Empty()
{
return TalkData.Length + SpecialEffectData.Length == 0;
Expand Down
10 changes: 5 additions & 5 deletions SekaiToolsCore/Story/Game/SpecialEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public SpecialEffect(int effectType, string stringVal, string stringValSub, doub
IntVal = intVal;
}

public int EffectType { get; set; }
public string StringVal { get; set; }
public double Duration { get; set; }
public string StringValSub { get; set; }
public double IntVal { get; set; }
public int EffectType { get; set; } = 0;
public string StringVal { get; set; } = "";
public double Duration { get; set; } = 0.0d;
public string StringValSub { get; set; } = "";
public double IntVal { get; set; } = 0.0d;
}
10 changes: 5 additions & 5 deletions SekaiToolsCore/Story/Game/Talk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public Talk(string WindowDisplayName,
this.Voices = Voices ?? [];
}

public string Body { get; set; }
public string WindowDisplayName { get; set; }
public int WhenFinishCloseWindow { get; set; }
public TalkCharacter[] TalkCharacters { get; set; }
public Voice[] Voices { get; set; }
public string Body { get; set; } = "";
public string WindowDisplayName { get; set; } = "";
public int WhenFinishCloseWindow { get; set; } = 0;
public TalkCharacter[] TalkCharacters { get; set; } = [];
public Voice[] Voices { get; set; } = [];
public bool Shake { get; set; } = false;

public readonly int GetCharacterId()
Expand Down
2 changes: 0 additions & 2 deletions SekaiToolsCore/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ namespace SekaiToolsCore;

public static partial class Utils
{


public static int LineCount(this string str)
{
return str.Split('\n').Select(value => value.Length > 0 ? 1 : 0).Sum();
Expand Down
1 change: 0 additions & 1 deletion SekaiToolsGUI/App.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Application x:Class="SekaiToolsGUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SekaiToolsGUI"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
Expand Down
1 change: 0 additions & 1 deletion SekaiToolsGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SekaiToolsGUI"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:viewModel="clr-namespace:SekaiToolsGUI.ViewModel"
x:Class="SekaiToolsGUI.MainWindow"
Expand Down
1 change: 0 additions & 1 deletion SekaiToolsGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Windows;
using System.Windows.Media.Imaging;
using SekaiToolsGUI.View.Suppress;
using SekaiToolsGUI.ViewModel;
using Wpf.Ui;
Expand Down
15 changes: 8 additions & 7 deletions SekaiToolsGUI/SekaiToolsGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
<ItemGroup>
<PackageReference Include="CalcBinding" Version="2.5.2"/>
<PackageReference Include="Emgu.CV.Wpf" Version="4.9.0.5494"/>
<PackageReference Include="TextCopy" Version="6.2.1" />
<PackageReference Include="WPF-UI" Version="4.0.0-rc.3" />
<PackageReference Include="System.Text.Json" Version="9.0.0"/>
<PackageReference Include="TextCopy" Version="6.2.1"/>
<PackageReference Include="WPF-UI" Version="4.0.0-rc.3"/>
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -190,14 +191,14 @@
<SubType>Designer</SubType>
</Page>
<Page Update="View\Download\Components\SpecialStoryTab.xaml">
<Generator>MSBuild:Compile</Generator>
<XamlRuntime>Wpf</XamlRuntime>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<XamlRuntime>Wpf</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>

<ItemGroup>
<Folder Include="View\Suppress\Components\" />
<Folder Include="View\Utils\Componets\" />
<Folder Include="View\Suppress\Components\"/>
<Folder Include="View\Utils\Componets\"/>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions SekaiToolsGUI/View/Download/Components/DownloadItem.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ private void ButtonBase_OnClick(object sender, RoutedEventArgs e)

public partial class DownloadItem
{
private static List<DownloadItem> RecycleContainer { get; } = [];

public void Initialize(string url, string key)
{
Url = url;
Key = key;
KeyText.Text = Key;
}

private static List<DownloadItem> RecycleContainer { get; } = [];

public static void RecycleItem(DownloadItem item)
{
item.Visibility = Visibility.Collapsed;
Expand Down
Loading

0 comments on commit ca06606

Please sign in to comment.