ExcelToJson 기능추가

- dll에 해당 기능 추가 및 class 스크립트 생성기능 추가
This commit is contained in:
villaingames 2023-10-09 19:30:53 +09:00
parent 1cfacdadb5
commit 4df1f6522f
20 changed files with 255 additions and 2 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@
/[Bb]uilds/ /[Bb]uilds/
/[Ll]ogs/ /[Ll]ogs/
/[Uu]ser[Ss]ettings/ /[Uu]ser[Ss]ettings/
/TableData/
# MemoryCaptures can get excessive in size. # MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data # They also could contain extremely sensitive data

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ea9a1164bcc6a84994193f2ccd487e9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8ea9a1164bcc6a84994193f2ccd487e9 guid: 0b0ea77eb9eb2d744beabf5cc6b43a4a
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: a597812ee2145744f8a30f98047c44a8
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: d0348492a1cc2224aa979c9b92b9ee65
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 10fcc1f254bccda448b5107530e34db0 guid: 781f7b14bda3aac42928c2922349f57a
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

Binary file not shown.

View File

@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: ec8d173e794a1ca4da93514d355acb51
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a05c41fb53c48884dbc7ac0c18c99f1a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FirstVillain.Entities
{
public class JPropInfoData
{
public int Id;
public float Mass;
public string PrefabName;
public int Point;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b5a775e606fe23a4e94eb74d39ddc144
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ee8c2675ff3ba2045a2a66c8de1b6d4f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 052f7e13c2aca714baa4c60f7c0f978c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
using FirstVillain.Converter;
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;
using System.Reflection;
using UnityEditor;
using UnityEngine;
public static class MenuCommands
{
[MenuItem("Tools/Convert/ExcelToJson", priority = 999)]
public static void ConvertExcelToJson()
{
var tablePath = Application.dataPath.Replace("Assets", "TableData");
var jsonPath = Path.Combine(Application.dataPath, "AddressableResources", "Tables");
var entityPath = Path.Combine(Application.dataPath, "Scripts", "Entities");
JsonConverter.ExcelToJsonAndClass(tablePath, jsonPath, entityPath);
AssetDatabase.Refresh();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 10139298af073df49ab28ebb7ef4986c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
using FirstVillain.Entities;
using FirstVillain.Singleton;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//규칙 : 테이블을 필요할 때마다 로드해서 사용한다.
public class TableManager : UnitySingleton<TableManager>
{
private void LoadTable<T>(E_TABLE table, Action<Wrapper<T>> result)
{
AddressableManager.Instance.LoadAssetAsync<TextAsset>(table.ToString(), asset => {
result(JsonConvert.DeserializeObject<Wrapper<T>>(asset.text));
});
}
//테이블별로 테이블 가져오는 함수를 계속 추가해 줘야하는 단점...
#region Prop
public void GetPropInfoById(E_TABLE table, int id, Action<JPropInfoData> result)
{
LoadTable<JPropInfoData>(table, loaded =>
{
var list = loaded.list;
result(list.Find(arg => arg.Id == id));
});
}
public void GetPropInfoList(E_TABLE table, Action<List<JPropInfoData>> result)
{
LoadTable<JPropInfoData>(table, loaded =>
{
result(loaded.list);
});
}
#endregion Prop
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5bc6fbba331398242bb897fd80bf8c47
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: