Skip to content

Commit

Permalink
버그수정
Browse files Browse the repository at this point in the history
  • Loading branch information
murbong committed Mar 13, 2024
1 parent fe999a5 commit d1451ed
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 15 deletions.
36 changes: 26 additions & 10 deletions Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -103,11 +104,11 @@ public static void ShowToast(string appId, string title, string message, string
public static Dictionary<string, string> WeaponImageDic = new Dictionary<string, string>();


public static string AvatarJsonPath = @"../../Resources/Database/AvatarConfigDataTable.json";
public static string AvatarFrameJsonPath = @"../../Resources/Database/AvatarFrameConfigDataTable.json";
public static string StaticWeaponJsonPath = @"../../Resources/Database/StaticWeaponDataTable.json";
public static string TitleJsonPath = @"../../Resources/Database/DT_Title.json";
public static string LocalJsonPath = @"../../Resources/Database/Game.json";
public static string AvatarJsonPath = @"Resources.Database.AvatarConfigDataTable.json";
public static string AvatarFrameJsonPath = @"Resources.Database.AvatarFrameConfigDataTable.json";
public static string StaticWeaponJsonPath = @"Resources.Database.StaticWeaponDataTable.json";
public static string TitleJsonPath = @"Resources.Database.DT_Title.json";
public static string LocalJsonPath = @"Resources.Database.Game.json";

public static Regex regex = new Regex("^\\/(.+\\/)*(.+)\\.(.+)$");

Expand Down Expand Up @@ -150,6 +151,21 @@ private static void SetiniValue(string section, string key, string value)
WritePrivateProfileString(section, key, value, AppDomain.CurrentDomain.BaseDirectory + UserSettingsFileName);
}

private static string GetEmbeddedResource(string fileName)
{
var assembly = Assembly.GetExecutingAssembly();
var resourceName = "KekboomKawaii." + fileName;

using (Stream stream = assembly.GetManifestResourceStream(resourceName))
{
using (StreamReader reader = new StreamReader(stream, encoding: Encoding.UTF8))
{
string result = reader.ReadToEnd();
return result;
}
}
}


static Global()
{
Expand All @@ -165,29 +181,29 @@ static Global()

public static void Initlaize()
{
dynamic avatar = JsonConvert.DeserializeObject(File.ReadAllText(AvatarJsonPath, Encoding.UTF8));
dynamic avatar = JsonConvert.DeserializeObject(GetEmbeddedResource(AvatarJsonPath));
foreach (dynamic item in avatar[0].Rows)
{
AvatarDic.Add(item.Name.ToLower(), regex.Match(item.Value.BigImage.AssetPathName.ToString()).Groups[3].Value);
}
dynamic avatarFrame = JsonConvert.DeserializeObject(File.ReadAllText(AvatarFrameJsonPath, Encoding.UTF8));
dynamic avatarFrame = JsonConvert.DeserializeObject(GetEmbeddedResource(AvatarFrameJsonPath));

foreach (dynamic item in avatarFrame[0].Rows)
{
AvatarFrameDic.Add(item.Name.ToLower(), regex.Match(item.Value.BigImage.AssetPathName.ToString()).Groups[3].Value);
}

dynamic staticWeapon = JsonConvert.DeserializeObject(File.ReadAllText(StaticWeaponJsonPath, Encoding.UTF8));
dynamic staticWeapon = JsonConvert.DeserializeObject(GetEmbeddedResource(StaticWeaponJsonPath));

foreach (dynamic item in staticWeapon[0].Rows)
{

WeaponImageDic.Add(item.Name.ToLower(), regex.Match(item.Value.WeaponIconForMatrix.AssetPathName.ToString()).Groups[3].Value);
}

dynamic title = JsonConvert.DeserializeObject(File.ReadAllText(TitleJsonPath, Encoding.UTF8));
dynamic title = JsonConvert.DeserializeObject(GetEmbeddedResource(TitleJsonPath));

dynamic titleLoc = JsonConvert.DeserializeObject(File.ReadAllText(LocalJsonPath, Encoding.UTF8));
dynamic titleLoc = JsonConvert.DeserializeObject(GetEmbeddedResource(LocalJsonPath));


foreach (dynamic item in title[0].Rows)
Expand Down
10 changes: 5 additions & 5 deletions KekboomKawaii.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Resources\Database\StaticWeaponDataTable.json" />
<Resource Include="Resources\Database\AvatarConfigDataTable.json" />
<Resource Include="Resources\Database\AvatarFrameConfigDataTable.json" />
<Resource Include="Resources\Database\DT_Title.json" />
<Resource Include="Resources\Database\Game.json" />
<EmbeddedResource Include="Resources\Database\StaticWeaponDataTable.json" />
<EmbeddedResource Include="Resources\Database\AvatarConfigDataTable.json" />
<EmbeddedResource Include="Resources\Database\AvatarFrameConfigDataTable.json" />
<EmbeddedResource Include="Resources\Database\DT_Title.json" />
<EmbeddedResource Include="Resources\Database\Game.json" />
<Resource Include="Resources\Fonts\ONE Mobile POP.ttf" />
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit d1451ed

Please sign in to comment.