├── .gitignore
├── Assembly-CSharp-Editor.csproj
├── Assembly-CSharp.csproj
├── Assets
├── Editor
│ ├── DataExporter
│ │ ├── Data
│ │ │ ├── Excel.cs
│ │ │ ├── ExcelData.cs
│ │ │ └── ExcelGameData.cs
│ │ ├── DataExporterWindow.cs
│ │ ├── ExcelEditorWindow.cs
│ │ ├── ExcelLoader
│ │ │ └── NPOILoader.cs
│ │ ├── ExcelWriter
│ │ │ ├── EppWriter.cs
│ │ │ └── NPOIWriter.cs
│ │ ├── Generater
│ │ │ ├── ExcelBinaryClassGenerater.cs
│ │ │ ├── ExcelBinaryDataGenerater.cs
│ │ │ ├── ExcelJsonClassGenerater.cs
│ │ │ ├── ExcelJsonDataGenerater.cs
│ │ │ ├── ExcelScriptableObjectClassGenerater.cs
│ │ │ ├── ExcelScriptableObjectDataGenerater.cs
│ │ │ ├── ExcelTextClassGenerater.cs
│ │ │ └── ExcelTextDataGenerater.cs
│ │ ├── Type
│ │ │ ├── DesType.cs
│ │ │ ├── DictionaryIntIntType.cs
│ │ │ ├── DictionaryIntStringType.cs
│ │ │ ├── FloatType.cs
│ │ │ ├── IType.cs
│ │ │ ├── IntType.cs
│ │ │ ├── ListFloatType.cs
│ │ │ ├── ListIntType.cs
│ │ │ ├── ListListStringType.cs
│ │ │ ├── ListStringType.cs
│ │ │ ├── StringType.cs
│ │ │ ├── Vector2Type.cs
│ │ │ └── Vector3Type.cs
│ │ ├── Util
│ │ │ ├── EditorWindowUtil.cs
│ │ │ ├── ExcelExporterUtil.cs
│ │ │ ├── Factorys.cs
│ │ │ └── SupportTypeUtil.cs
│ │ └── interface
│ │ │ ├── IExcelClassGenerater.cs
│ │ │ ├── IExcelDataGenerater.cs
│ │ │ ├── IExcelLoader.cs
│ │ │ └── IExcelWriter.cs
│ └── Lib
│ │ ├── EPP
│ │ ├── EPPlus.XML
│ │ └── EPPlus.dll
│ │ ├── EPPlus 4.1.chm
│ │ └── NPOI
│ │ ├── EPPlus.XML
│ │ ├── EPPlus.dll
│ │ ├── ICSharpCode.SharpZipLib.dll
│ │ ├── NPOI.OOXML.dll
│ │ ├── NPOI.OpenXml4Net.dll
│ │ ├── NPOI.OpenXmlFormats.dll
│ │ ├── NPOI.XML
│ │ └── NPOI.dll
├── JsonNet-Lite.9.0.1.unitypackage
├── JsonNet.9.0.1.unitypackage
├── Resources
│ └── Test.bytes
├── Script
│ ├── Data
│ │ ├── Base
│ │ │ ├── CfgScriptableObjectContainer.cs
│ │ │ ├── ConfigBinaryBase.cs
│ │ │ ├── ConfigBinaryContainer.cs
│ │ │ ├── ConfigBinaryManager.cs
│ │ │ ├── ConfigFactory.cs
│ │ │ ├── ConfigJsonBase.cs
│ │ │ ├── ConfigJsonContainer.cs
│ │ │ ├── ConfigJsonManager.cs
│ │ │ ├── ConfigSOManager.cs
│ │ │ ├── ConfigSoBase.cs
│ │ │ ├── ConfigTextBase.cs
│ │ │ ├── ConfigTextManager.cs
│ │ │ ├── IConfigBase.cs
│ │ │ ├── IConfigManager.cs
│ │ │ └── SingleTon.cs
│ │ ├── CfgEffect.cs
│ │ ├── CfgSkill.cs
│ │ ├── CfgSubSkill.cs
│ │ └── CfgTest.cs
│ ├── Main.cs
│ └── Util
│ │ ├── JsonConverter
│ │ └── Vector3Converter.cs
│ │ └── StringUtil.cs
├── Test.xlsx
├── Test1.xls
└── UnityPackages
│ ├── JsonNet.unitypackage.json
│ ├── JsonNet
│ ├── Newtonsoft.Json.dll
│ └── Newtonsoft.Json.dll.mdb
│ └── JsonNetSample
│ ├── JsonNetSample.cs
│ └── JsonNetSample.unity
├── ExcelExporter.Editor.csproj
├── ExcelExporter.csproj
├── ExcelExporter.sln
├── Image
├── excel.png
├── window1.png
└── window2.png
├── ProjectSettings
├── AudioManager.asset
├── ClusterInputManager.asset
├── DynamicsManager.asset
├── EditorBuildSettings.asset
├── EditorSettings.asset
├── GraphicsSettings.asset
├── InputManager.asset
├── NavMeshAreas.asset
├── NetworkManager.asset
├── Physics2DSettings.asset
├── ProjectSettings.asset
├── ProjectVersion.txt
├── QualitySettings.asset
├── TagManager.asset
├── TimeManager.asset
└── UnityConnectSettings.asset
├── README.md
└── XMind
└── ExcelExporter类型整理.xmind
/.gitignore:
--------------------------------------------------------------------------------
1 | /[Ll]ibrary/
2 | /[Tt]emp/
3 | /[Oo]bj/
4 | /[Bb]uild/
5 | /[Bb]uilds/
6 |
7 | /.vs/
8 |
9 | *.pidb.meta
10 | *.tmp
11 | *.meta
--------------------------------------------------------------------------------
/Assembly-CSharp-Editor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 |
9 | {505DA4D7-AA3A-305A-9300-7BEFDFEFD70E}
10 | Library
11 | Properties
12 | Assembly-CSharp-Editor
13 | v3.5
14 | 512
15 | Assets
16 |
17 |
18 | true
19 | full
20 | false
21 | Temp\bin\Debug\
22 | DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_5_6_0;UNITY_5_6;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;ENABLE_VIDEO;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0_SUBSET;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE
23 | prompt
24 | 4
25 | 0169
26 |
27 |
28 | pdbonly
29 | true
30 | Temp\bin\Release\
31 | prompt
32 | 4
33 | 0169
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | D:/Program Files/Unity/Unity5.6/Editor/Data/Managed/UnityEngine.dll
43 |
44 |
45 | D:/Program Files/Unity/Unity5.6/Editor/Data/Managed/UnityEditor.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll
62 |
63 |
64 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll
65 |
66 |
67 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/GUISystem/Editor/UnityEditor.UI.dll
68 |
69 |
70 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll
71 |
72 |
73 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/Networking/Editor/UnityEditor.Networking.dll
74 |
75 |
76 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/TestRunner/Editor/UnityEditor.TestRunner.dll
77 |
78 |
79 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/TestRunner/UnityEngine.TestRunner.dll
80 |
81 |
82 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/TestRunner/nunit.framework.dll
83 |
84 |
85 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/TreeEditor/Editor/UnityEditor.TreeEditor.dll
86 |
87 |
88 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll
89 |
90 |
91 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityAnalytics/Editor/UnityEditor.Analytics.dll
92 |
93 |
94 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityHoloLens/Editor/UnityEditor.HoloLens.dll
95 |
96 |
97 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityHoloLens/RuntimeEditor/UnityEngine.HoloLens.dll
98 |
99 |
100 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityPurchasing/Editor/UnityEditor.Purchasing.dll
101 |
102 |
103 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityVR/Editor/UnityEditor.VR.dll
104 |
105 |
106 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityVR/RuntimeEditor/UnityEngine.VR.dll
107 |
108 |
109 | D:/Program Files/Unity/Unity5.6/Editor/Data/Managed/UnityEditor.Graphs.dll
110 |
111 |
112 | D:/Program Files/Unity/Unity5.6/Editor/Data/PlaybackEngines/AndroidPlayer/UnityEditor.Android.Extensions.dll
113 |
114 |
115 | D:/Program Files/Unity/Unity5.6/Editor/Data/PlaybackEngines/MetroSupport/UnityEditor.WSA.Extensions.dll
116 |
117 |
118 | D:/Program Files/Unity/Unity5.6/Editor/Data/PlaybackEngines/windowsstandalonesupport/UnityEditor.WindowsStandalone.Extensions.dll
119 |
120 |
121 | E:/UnityProject/git/ExcelExporter/Assets/Editor/Lib/EPP/EPPlus.dll
122 |
123 |
124 | E:/UnityProject/git/ExcelExporter/Assets/Editor/Lib/NPOI/EPPlus.dll
125 |
126 |
127 | E:/UnityProject/git/ExcelExporter/Assets/Editor/Lib/NPOI/ICSharpCode.SharpZipLib.dll
128 |
129 |
130 | E:/UnityProject/git/ExcelExporter/Assets/Editor/Lib/NPOI/NPOI.dll
131 |
132 |
133 | E:/UnityProject/git/ExcelExporter/Assets/Editor/Lib/NPOI/NPOI.OOXML.dll
134 |
135 |
136 | E:/UnityProject/git/ExcelExporter/Assets/Editor/Lib/NPOI/NPOI.OpenXml4Net.dll
137 |
138 |
139 | E:/UnityProject/git/ExcelExporter/Assets/Editor/Lib/NPOI/NPOI.OpenXmlFormats.dll
140 |
141 |
142 | D:/Program Files/Unity/Unity5.6/Editor/Data/Managed/Mono.Cecil.dll
143 |
144 |
145 |
146 |
147 | {55BE7937-C70B-08AD-DC5B-BB6040EB0E11} Assembly-CSharp
148 |
149 |
150 |
157 |
158 |
159 |
--------------------------------------------------------------------------------
/Assembly-CSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 |
9 | {55BE7937-C70B-08AD-DC5B-BB6040EB0E11}
10 | Library
11 | Properties
12 | Assembly-CSharp
13 | v3.5
14 | 512
15 | Assets
16 |
17 |
18 | true
19 | full
20 | false
21 | Temp\bin\Debug\
22 | DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_5_6_0;UNITY_5_6;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;ENABLE_VIDEO;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0_SUBSET;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE
23 | prompt
24 | 4
25 | 0169
26 |
27 |
28 | pdbonly
29 | true
30 | Temp\bin\Release\
31 | prompt
32 | 4
33 | 0169
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | D:/Program Files/Unity/Unity5.6/Editor/Data/Managed/UnityEngine.dll
43 |
44 |
45 | D:/Program Files/Unity/Unity5.6/Editor/Data/Managed/UnityEditor.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll
57 |
58 |
59 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll
60 |
61 |
62 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/TestRunner/UnityEngine.TestRunner.dll
63 |
64 |
65 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/TestRunner/nunit.framework.dll
66 |
67 |
68 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll
69 |
70 |
71 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityHoloLens/RuntimeEditor/UnityEngine.HoloLens.dll
72 |
73 |
74 | D:/Program Files/Unity/Unity5.6/Editor/Data/UnityExtensions/Unity/UnityVR/RuntimeEditor/UnityEngine.VR.dll
75 |
76 |
77 | D:/Program Files/Unity/Unity5.6/Editor/Data/Managed/Mono.Cecil.dll
78 |
79 |
80 |
81 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Data/Excel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using System.IO;
4 |
5 | public class Excel
6 | {
7 | string _fileName;
8 | string _fullPath;
9 | string _extension;
10 | ExcelData _excelData;
11 |
12 | public HashSet clientFieldIndexList = new HashSet();
13 | public HashSet serverFieldIndexList = new HashSet();
14 |
15 | public ExcelGameData serverData;
16 | public ExcelGameData clientData;
17 |
18 | public string fileName
19 | {
20 | get
21 | {
22 | return _fileName;
23 | }
24 |
25 | set
26 | {
27 | _fileName = value ;
28 | }
29 | }
30 |
31 | public ExcelData excelData
32 | {
33 | get
34 | {
35 | return _excelData;
36 | }
37 |
38 | set
39 | {
40 | _excelData = value ;
41 | }
42 | }
43 |
44 | public string FullPath
45 | {
46 | get
47 | {
48 | return _fullPath;
49 | }
50 |
51 | set
52 | {
53 | _fullPath = value ;
54 | }
55 | }
56 |
57 | public Excel(string fullPath)
58 | {
59 | fileName = Path.GetFileNameWithoutExtension(fullPath);
60 | FullPath = fullPath;
61 | _extension = Path.GetExtension(fullPath);
62 | }
63 |
64 | public void Load()
65 | {
66 | var loader = GetLoader();
67 | excelData = loader.Load();
68 | InitGameData();
69 | }
70 |
71 | public void Write(string outputPath)
72 | {
73 | var writer = GetWriter();
74 | writer.Write(outputPath, excelData);
75 | }
76 |
77 | public void Write()
78 | {
79 | Write(FullPath);
80 | }
81 |
82 | public void GenerateClientScript()
83 | {
84 | var generater = ClassFactory.GetFactory(GeneraterFactoryType.Client).Create();
85 | generater.GenerateClass(ExcelExporterUtil.GetClientClassOutputPath(), ExcelExporterUtil.GetClientClassFileName(fileName), clientData);
86 | }
87 |
88 | public void GenerateClientData()
89 | {
90 | var generater = DataFactory.GetFactory(GeneraterFactoryType.Client).Create();
91 | generater.GenerateData(ExcelExporterUtil.GetClientDataOutputPath(), ExcelExporterUtil.GetDataFileFullName(fileName), clientData, ExcelExporterUtil.GetClientClassFileName(fileName));
92 | }
93 |
94 |
95 | void InitGameData()
96 | {
97 | clientData = new ExcelGameData();
98 | serverData = new ExcelGameData();
99 | int row = PassIgnoreRow();
100 | //名称行和类型行
101 | if (row + 1 >= excelData.count)
102 | return;
103 | row = ProcessFieldNames(row);
104 | row = ProcessFieldTypes(row);
105 | ProcessExcelContent(row);
106 | }
107 |
108 | public void ProcessExcelContent(int row)
109 | {
110 | int lineNum = 0;
111 | for(int rowNum = row; rowNum < excelData.count; rowNum++)
112 | {
113 | var rowData = excelData.GetRow(rowNum);
114 | rowData.rowType = ExcelRowType.Content;
115 | //空行跳过
116 | if (rowData.IsEmpty)
117 | continue;
118 | int val;
119 | //id字段
120 | if(!int.TryParse(rowData.GetCell(0).stringValue, out val))
121 | {
122 | continue;
123 | }
124 | //结束颜色判断
125 | if (rowData.GetCell(0).rule == ExcelRule.Finish)
126 | break;
127 | for(int column = 0; column < rowData.count; column++)
128 | {
129 | var cell = rowData.GetCell(column);
130 | //cell允许empty
131 | if(clientFieldIndexList.Contains(column))
132 | {
133 | if(!clientData.AddCell(lineNum, cell))
134 | {
135 | Debug.LogErrorFormat("{0} 第{1}行 第 {2} 列 解析客户端字段异常 : {3} type : ", fileName, lineNum, column, cell.stringValue);
136 | }
137 | }
138 |
139 | if(serverFieldIndexList.Contains(column))
140 | {
141 | if (!serverData.AddCell(lineNum, cell))
142 | {
143 | Debug.LogErrorFormat("{0} 第{1}行 第 {2} 列 解析服务端字段异常 : {3}", fileName, lineNum, column, cell.stringValue);
144 | }
145 | }
146 | }
147 | lineNum++;
148 | }
149 | }
150 |
151 | public int ProcessFieldTypes(int row)
152 | {
153 | var rowData = excelData.GetRow(row);
154 | rowData.rowType = ExcelRowType.Type;
155 | for(int i = 0; i < rowData.count; i++)
156 | {
157 | var cell = rowData.GetCell(i);
158 | string type = "string";
159 |
160 | if(clientFieldIndexList.Contains(i) || serverFieldIndexList.Contains(i))
161 | if (!SupportTypeUtil.TryGetTypeName(cell.stringValue, out type))
162 | Debug.LogError(string.Format("{0} 不支持类型 {1} 替换为string ", fileName, cell.stringValue));
163 |
164 | //单次循环处理完
165 | if (clientFieldIndexList.Contains(i))
166 | {
167 | clientData.AddFieldType(type);
168 | }
169 |
170 | if (serverFieldIndexList.Contains(i))
171 | {
172 | serverData.AddFieldType(type);
173 | }
174 | }
175 | return ++row;
176 | }
177 |
178 | public int ProcessFieldNames(int row)
179 | {
180 | var rowData = excelData.GetRow(row);
181 | rowData.rowType = ExcelRowType.Name;
182 | HashSet fieldNameSet = new HashSet();
183 | for(int i = 0; i < rowData.count; i++)
184 | {
185 | var cell = rowData.GetCell(i);
186 | if (cell.IsEmpty || string.IsNullOrEmpty(cell.stringValue))
187 | continue;
188 | if (fieldNameSet.Contains(cell.stringValue))
189 | {
190 | Debug.LogError(string.Format("表{0} {1}字段名重复", fileName, cell.stringValue));
191 | continue;
192 | }
193 | fieldNameSet.Add(cell.stringValue);
194 |
195 | if(IsClientType(cell.rule))
196 | {
197 | clientData.AddFieldName(cell.stringValue);
198 | clientFieldIndexList.Add(i);
199 | }
200 |
201 | if (IsServerType(cell.rule))
202 | {
203 | serverData.AddFieldName(cell.stringValue);
204 | serverFieldIndexList.Add(i);
205 | }
206 | }
207 |
208 | return ++row;
209 | }
210 |
211 | //空行,第一个cell是ignore或者包含// 都表示注释行
212 | int PassIgnoreRow()
213 | {
214 | for (int i = 0; i < excelData.count; i++)
215 | {
216 | var row = excelData.GetRow(i);
217 | if (row.IsEmpty || row.GetCell(0).stringValue.StartsWith("//") || row.GetCell(0).rule == ExcelRule.Ignore)
218 | {
219 | row.rowType = ExcelRowType.Comment;
220 | continue;
221 | }
222 | return i;
223 | }
224 | return excelData.count;
225 | }
226 |
227 |
228 |
229 | bool IsClientType(ExcelRule rule)
230 | {
231 | return rule == ExcelRule.Client || rule == ExcelRule.Common;
232 | }
233 |
234 | bool IsServerType(ExcelRule rule)
235 | {
236 | return rule == ExcelRule.Server || rule == ExcelRule.Common;
237 | }
238 |
239 | IExcelLoader GetLoader()
240 | {
241 | return new NPOILoader(FullPath);
242 | }
243 |
244 | //NPOI不支持2007版写入
245 | //EPPlus不支持2003写入
246 | IExcelWriter GetWriter()
247 | {
248 | if (_extension == ".xls")
249 | return new NPOIWriter();
250 | else
251 | return new EppWriter();
252 | }
253 | }
254 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Data/ExcelData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | //excel内的全部数据 不做过滤
6 | public enum ExcelRule
7 | {
8 | Error = 0,
9 | Common, //客户端服务器通用
10 | Client, //客户端使用
11 | Server, //服务器使用
12 | Finish, //结束标识(行)
13 | Ignore, //忽略(行 列)
14 | Content //内容
15 | }
16 |
17 | public enum ExcelRowType
18 | {
19 | Comment,
20 | Name,
21 | Type,
22 | Content,
23 | }
24 |
25 | public enum GameDataType
26 | {
27 | Client,
28 | Server,
29 | }
30 |
31 | public class ExcelRuleUtil
32 | {
33 |
34 | static Dictionary _colorRuleMap = new Dictionary()
35 | {
36 | { Rgb2Int(0,128,0), ExcelRule.Common},
37 | { Rgb2Int(255,204,0), ExcelRule.Server},
38 | { Rgb2Int(0,204,255), ExcelRule.Client},
39 | { Rgb2Int(128,128,128), ExcelRule.Ignore},
40 | { Rgb2Int(0,51,102), ExcelRule.Finish},
41 | { Rgb2Int(0,0,0), ExcelRule.Content},
42 | };
43 |
44 | static int Rgb2Int(byte r, byte g, byte b)
45 | {
46 | return r << 16 | g << 8 | b;
47 | }
48 |
49 | public static ExcelRule GetExcelRule(byte r, byte g, byte b)
50 | {
51 | int color = Rgb2Int(r, g, b);
52 | if (_colorRuleMap.ContainsKey(color))
53 | return _colorRuleMap[color];
54 | return ExcelRule.Error;
55 | }
56 | }
57 |
58 |
59 | //不想再对数据重新赋值,不使用继承的方式
60 | public class ExcelContentCell
61 | {
62 | public string fieldName;
63 | string _fieldTypeName;
64 | string _stringValue;
65 | IType _type;
66 |
67 | public string fieldTypeName
68 | {
69 | get { return _fieldTypeName; }
70 | set
71 | {
72 | var type = SupportTypeUtil.GetIType(value);
73 | if (type != null)
74 | {
75 | _fieldTypeName = type.realName;
76 | fieldType = type.type;
77 | _type = type;
78 | }
79 | else
80 | {
81 | Debug.LogError("找不到类型" + value);
82 | }
83 | }
84 | }
85 | public Type fieldType;
86 | public ExcelCell originCell;
87 |
88 | public object value
89 | {
90 | get
91 | {
92 | if (_type != null)
93 | {
94 | return _type.GetValue(_stringValue);
95 | }
96 | else
97 | return _stringValue;
98 | }
99 | }
100 | public string stringValue
101 | {
102 | get
103 | {
104 | return _stringValue;
105 | }
106 | }
107 |
108 | public ExcelContentCell(ExcelCell cell)
109 | {
110 | originCell = cell;
111 | }
112 |
113 | public void FormatCell()
114 | {
115 | string res = originCell.stringValue;
116 | //文本可能为空
117 | if (string.IsNullOrEmpty(res))
118 | {
119 | _stringValue = string.Empty;
120 | return;
121 | }
122 | if (fieldType != typeof(string))
123 | res = ExcelExporterUtil.RemoveWhiteSpaceOutTheWordFull(res);
124 | res = ExcelExporterUtil.RemoveWordFirstQuotation(res);
125 | _stringValue = res;
126 |
127 | }
128 |
129 | public bool CheckValid()
130 | {
131 | return _type == null ? false : _type.CheckValue(_stringValue);
132 | }
133 | }
134 | public class ExcelCell
135 | {
136 | public object value;
137 | public string stringValue;
138 | public int index;
139 | public ExcelRule rule;
140 |
141 | byte[] _rgb;
142 | public byte[] rgb
143 | {
144 | set
145 | {
146 | _rgb = value;
147 | rule = ExcelRuleUtil.GetExcelRule(_rgb[0], _rgb[1], _rgb[2]);
148 | }
149 | get { return _rgb; }
150 | }
151 |
152 | public Color ruleColor
153 | {
154 | get
155 | {
156 | return new Color(_rgb[0] / 255f, _rgb[1] / 255f, _rgb[2] / 255f);
157 | }
158 | }
159 |
160 |
161 |
162 | public bool IsEmpty
163 | {
164 | get
165 | {
166 | return value == null || string.IsNullOrEmpty(stringValue);
167 | }
168 | }
169 | }
170 |
171 | public class ExcelRow
172 | {
173 | public int row;
174 | public List cellList = new List();
175 | public Dictionary cellMap = new Dictionary();
176 | public bool isDirty = false;
177 | //excelEditor使用
178 | public ExcelRowType rowType;
179 |
180 | public bool IsEmpty
181 | {
182 | get { return cellList == null || cellList.Count == 0; }
183 | }
184 |
185 | public int count { get { return cellList == null ? 0 : cellList.Count; } }
186 |
187 | public void AddCell(ExcelCell cell)
188 | {
189 | cellList.Add(cell);
190 | cellMap.Add(cell.index, cell);
191 | }
192 |
193 | public ExcelCell GetCell(int index)
194 | {
195 | if (cellMap.ContainsKey(index))
196 | return cellMap[index];
197 | return null;
198 | }
199 |
200 | //写数据时,不关心excelrule
201 | public void SetCellData(int column, object obj, Type type)
202 | {
203 | if (!cellMap.ContainsKey(column))
204 | {
205 | ExcelCell cell = new ExcelCell();
206 | cell.index = column;
207 | AddCell(cell);
208 | }
209 |
210 | cellMap[column].value = obj;
211 | cellMap[column].stringValue = obj.ToString();
212 | isDirty = true;
213 | }
214 | }
215 |
216 | public class ExcelData
217 | {
218 | public string fileName;
219 | public List excelRows;
220 |
221 | public int count { get { return excelRows == null ? 0 : excelRows.Count; } }
222 | public ExcelRow GetRow(int index)
223 | {
224 | if (index >= excelRows.Count)
225 | return null;
226 | return excelRows[index];
227 | }
228 |
229 | public void SetCellValue(int row, int column, object value, Type type)
230 | {
231 | if (row > count)
232 | {
233 | Debug.LogError("不能跨行插入 行 = " + count);
234 | return;
235 | }
236 | if (row == count)
237 | {
238 | var excelRow = new ExcelRow();
239 | excelRow.row = row;
240 | excelRow.cellList = new List();
241 | excelRows.Add(excelRow);
242 | }
243 | var changeRow = excelRows[row];
244 | changeRow.SetCellData(column, value, type);
245 | }
246 |
247 | //用于拷贝数据时
248 | public void SetAllDirty()
249 | {
250 | for (int i = 0; i < excelRows.Count; i++)
251 | {
252 | excelRows[i].isDirty = true;
253 | }
254 | }
255 | }
256 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Data/ExcelGameData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using System;
5 | using System.Reflection;
6 | using Object = UnityEngine.Object;
7 |
8 | public class ExcelGameData
9 | {
10 | public List fieldNameList = new List();
11 | public List fieldTypeList = new List();
12 | //保留excelcell 导出二进制 或者 scirptobject会用到
13 | public List> cellList = new List>();
14 |
15 | public Object GetSOObject(int index, Type type)
16 | {
17 | var valueList = cellList[index];
18 | var instance = ScriptableObject.CreateInstance(type);//Activator.CreateInstance(type);
19 | //var instance = Activator.CreateInstance(type);
20 | for (int i = 0; i < valueList.Count; i++)
21 | {
22 | var field = type.GetField(fieldNameList[i], BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetField);
23 |
24 | field.SetValue(instance, valueList[i].value == null ? null : Convert.ChangeType(valueList[i].value, valueList[i].fieldType));
25 | }
26 | return instance;
27 | }
28 |
29 | public object GetObject(int index, Type type)
30 | {
31 | var valueList = cellList[index];
32 | var instance = Activator.CreateInstance(type);
33 | for (int i = 0; i < valueList.Count; i++)
34 | {
35 | var field = type.GetField(fieldNameList[i], BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetField);
36 |
37 | field.SetValue(instance, valueList[i].value == null ? null : Convert.ChangeType(valueList[i].value, valueList[i].fieldType));
38 | }
39 | return instance;
40 | }
41 |
42 |
43 | public bool AddFieldName(string field)
44 | {
45 | if (fieldNameList.Contains(field))
46 | return false;
47 | if (fieldNameList.Count == 0)
48 | field = "ID";
49 | fieldNameList.Add(field);
50 | return true;
51 | }
52 |
53 | public void AddFieldType(string type)
54 | {
55 | fieldTypeList.Add(type);
56 | }
57 |
58 | public bool AddCell(int row, ExcelCell cell)
59 | {
60 | if (row >= cellList.Count)
61 | cellList.Add(new List());
62 | var contentCell = new ExcelContentCell(cell);
63 | contentCell.fieldName = fieldNameList[cellList[row].Count];
64 | contentCell.fieldTypeName = fieldTypeList[cellList[row].Count];
65 | contentCell.FormatCell();
66 | cellList[row].Add(contentCell);
67 | return contentCell.CheckValid();
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/DataExporterWindow.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 | using System.Text;
6 | using UnityEditor.Callbacks;
7 | using System.IO;
8 |
9 | public class DataExporterWindow : EditorWindow
10 | {
11 | [MenuItem("Excel/ExcelExportWindow")]
12 | static void Open()
13 | {
14 | _window = GetWindow();//WithRect(new Rect(0, 0, 400, 600));
15 | _window.ReadConfig();
16 | }
17 |
18 | #region 本地配置文件
19 | void WriteConfig()
20 | {
21 | WriteStringField("_assetPath");
22 | WriteStringField("_excelPath");
23 | WriteStringField("_clientDataOutputPath");
24 | WriteStringField("_clientScriptOutputPath");
25 | PlayerPrefs.SetInt("_exportType", (int)_exportType);
26 | }
27 |
28 | void ReadConfig()
29 | {
30 | ReadStringConfig("_assetPath");
31 | ReadStringConfig("_excelPath");
32 | ReadStringConfig("_clientDataOutputPath");
33 | ReadStringConfig("_clientScriptOutputPath");
34 | if (PlayerPrefs.HasKey("_exportType"))
35 | {
36 | _exportType = (ExcelDataExportType)PlayerPrefs.GetInt("_exportType");
37 | ExcelExporterUtil.exportType = _exportType;
38 | }
39 | }
40 |
41 | void ReadStringConfig(string fieldName)
42 | {
43 | if (PlayerPrefs.HasKey(fieldName))
44 | this.GetType()
45 | .GetField(fieldName, System.Reflection.BindingFlags.SetField | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
46 | .SetValue(this, PlayerPrefs.GetString(fieldName));
47 | }
48 |
49 | void WriteStringField(string fieldName)
50 | {
51 | var fieldInfo = this.GetType().GetField(fieldName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.Instance);
52 | string value = fieldInfo.GetValue(this).ToString();
53 | if (!string.IsNullOrEmpty(value))
54 | PlayerPrefs.SetString(fieldName, value);
55 | }
56 |
57 | //静态变量不能使用SerializeField序列化
58 | void RewritePathsToExcelUtil()
59 | {
60 | ExcelExporterUtil.ExcelPath = _excelPath;
61 | ExcelExporterUtil.AssetPath = _assetPath;
62 | ExcelExporterUtil.ClientDataOutputPath = _clientDataOutputPath;
63 | ExcelExporterUtil.ClientScriptOutputPath = _clientScriptOutputPath;
64 | }
65 | #endregion
66 | [DidReloadScripts]
67 | static void OnDllRebuild()
68 | {
69 | }
70 |
71 | private void OnEnable()
72 | {
73 | }
74 |
75 | private void OnDestroy()
76 | {
77 | }
78 |
79 | static DataExporterWindow _window;
80 |
81 | [SerializeField]
82 | private string _excelPath;
83 | [SerializeField]
84 | string _assetPath;
85 | [SerializeField]
86 | string _clientScriptOutputPath;
87 | [SerializeField]
88 | string _clientDataOutputPath;
89 | [SerializeField]
90 | ExcelDataExportType _exportType = ExcelDataExportType.Text;
91 | [SerializeField]
92 | List _selectFiles = new List();
93 | [SerializeField]
94 | string _selectFilesText = "";
95 |
96 | void CheckPaths()
97 | {
98 | if (_excelPath != "" && _excelPath != ExcelExporterUtil.ExcelPath)
99 | RewritePathsToExcelUtil();
100 | }
101 |
102 | private void OnGUI()
103 | {
104 | CheckPaths();
105 |
106 | #region GUI
107 | bool selectExcelPath = EditorWindowUtil.DrawSelectPathView("excel路径:", _excelPath);
108 | bool selectAssetPath = EditorWindowUtil.DrawSelectPathView("Asset路径:", _assetPath);
109 | bool selectClientScriptPath = EditorWindowUtil.DrawSelectPathView("客户端类输出路径:", _clientScriptOutputPath);
110 | bool selectClientDataPath = EditorWindowUtil.DrawSelectPathView("客户端数据输出路径:", _clientDataOutputPath);
111 |
112 | var type = (ExcelDataExportType)EditorGUILayout.EnumPopup("文件导出类型", _exportType);
113 | if(type != ExcelExporterUtil.exportType)
114 | {
115 | _exportType = type;
116 | ExcelExporterUtil.exportType = type;
117 | PlayerPrefs.SetInt("_exportType", (int)_exportType);
118 | }
119 |
120 |
121 | Rect rect = EditorGUILayout.GetControlRect(true, GUILayout.Height(100));
122 | GUI.Box(rect, "选择Excel文件");
123 |
124 | bool genData = GUILayout.Button("生成配置配置文件");
125 | bool genClass = GUILayout.Button("生成客户端类文件");
126 | bool cleanClient = GUILayout.Button("清理客户端类和数据");
127 |
128 | if (_selectFiles.Count > 0)
129 | {
130 | EditorGUILayout.LabelField("选中文件:");
131 | EditorGUILayout.TextArea(_selectFilesText);
132 | }
133 | #endregion
134 |
135 | DealDrag(rect);
136 |
137 | if (genClass)
138 | {
139 | GenerateSelectedScript();
140 | }
141 | if (genData)
142 | {
143 | if(EditorApplication.isCompiling)
144 | {
145 | ShowNotification(new GUIContent("正在编译,请等待编译完成"));
146 | return;
147 | }
148 | GenerateSelectedData();
149 | }
150 |
151 | if(cleanClient)
152 | {
153 | CleanClient();
154 | }
155 |
156 | #region RefreshPaths
157 | if (selectExcelPath)
158 | {
159 | _excelPath = EditorWindowUtil.SelectFolder(_excelPath, "选择excel路径", "");
160 | ExcelExporterUtil.ExcelPath = _excelPath;
161 | WriteStringField("_excelPath");
162 | }
163 |
164 | if (selectAssetPath)
165 | {
166 | _assetPath = EditorWindowUtil.SelectFolder(_assetPath, "选择工程Assets路径", "");
167 | ExcelExporterUtil.AssetPath = _assetPath;
168 | WriteStringField("_assetPath");
169 | }
170 |
171 | if (selectClientDataPath)
172 | {
173 | _clientDataOutputPath = EditorWindowUtil.SelectFolder(_clientDataOutputPath, "选择客户端数据输出路径", "");
174 | ExcelExporterUtil.ClientDataOutputPath = _clientDataOutputPath;
175 | WriteStringField("_clientDataOutputPath");
176 | }
177 |
178 | if (selectClientScriptPath)
179 | {
180 | _clientScriptOutputPath = EditorWindowUtil.SelectFolder(_clientScriptOutputPath, "选择客户端类输出路径", "");
181 | ExcelExporterUtil.ClientScriptOutputPath = _clientScriptOutputPath;
182 | WriteStringField("_clientScriptOutputPath");
183 | }
184 | #endregion
185 | }
186 |
187 | void CleanClient()
188 | {
189 | var files = Directory.GetFiles(ExcelExporterUtil.GetClientClassOutputPath());
190 | for(int i = 0; i < files.Length; i++)
191 | {
192 | var fileName = Path.GetFileName(files[i]);
193 | if(fileName.StartsWith("Cfg") && fileName.EndsWith(".cs"))
194 | File.Delete(files[i]);
195 | }
196 |
197 | files = Directory.GetFiles(ExcelExporterUtil.GetClientDataOutputPath());
198 | for (int i = 0; i < files.Length; i++)
199 | {
200 | var fileName = Path.GetFileName(files[i]);
201 | if(fileName.EndsWith(".bytes"))
202 | File.Delete(files[i]);
203 | }
204 | ExcelTextClassGenerater.GenerateClientClassFactory(ExcelExporterUtil.GetClientDataOutputPath(), ExcelExporterUtil.GetClientClassOutputPath() + "Base/", true);
205 |
206 | AssetDatabase.Refresh();
207 | }
208 |
209 | void GenerateSelectedScript()
210 | {
211 | if(_selectFiles.Count == 0)
212 | {
213 | Debug.LogError("没有选中excel");
214 | return;
215 | }
216 | for(int i = 0; i < _selectFiles.Count; i++)
217 | {
218 | GenSingleClientScript(_selectFiles[i]);
219 | }
220 | AssetDatabase.Refresh();
221 | }
222 |
223 | void GenerateSelectedData()
224 | {
225 | if (_selectFiles.Count == 0)
226 | {
227 | Debug.LogError("没有选中excel");
228 | return;
229 | }
230 | for (int i = 0; i < _selectFiles.Count; i++)
231 | {
232 | GenSingleClientData(_selectFiles[i]);
233 | }
234 |
235 | if(ExcelExporterUtil.exportType == ExcelDataExportType.Text)
236 | {
237 | //必须有这个文件
238 | ExcelTextClassGenerater.GenerateClientClassFactory(ExcelExporterUtil.GetClientDataOutputPath() , ExcelExporterUtil.GetClientClassOutputPath() + "Base/", false);
239 | }
240 | AssetDatabase.Refresh();
241 | }
242 |
243 | void GenSingleClientScript(string path)
244 | {
245 | Excel excel = new Excel(path);
246 | excel.Load();
247 | excel.GenerateClientScript();
248 | }
249 |
250 | void GenSingleClientData(string path)
251 | {
252 | Excel excel = new Excel(path);
253 | excel.Load();
254 | excel.GenerateClientData();
255 | }
256 |
257 | private void DealDrag(Rect rect)
258 | {
259 | if (( Event.current.type == EventType.DragUpdated
260 | || Event.current.type == EventType.DragExited )
261 | && rect.Contains(Event.current.mousePosition))
262 | {
263 | DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
264 | if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
265 | {
266 | _selectFiles = new List(DragAndDrop.paths);
267 | RefreshSelectFileText();
268 | }
269 | }
270 | }
271 |
272 | void RefreshSelectFileText()
273 | {
274 | for (int i = _selectFiles.Count - 1; i >= 0; i--)
275 | {
276 | if (!_selectFiles[i].EndsWith(".xls") && !_selectFiles[i].EndsWith(".xlsx"))
277 | _selectFiles.RemoveAt(i);
278 | }
279 |
280 | StringBuilder sb = new StringBuilder();
281 | for(int i = 0; i < _selectFiles.Count; i++)
282 | {
283 | sb.AppendLine(_selectFiles[i]);
284 | }
285 | _selectFilesText = sb.ToString();
286 | }
287 | }
288 |
289 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/ExcelEditorWindow.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 | using System;
6 |
7 | public class ExcelEditorWindow : EditorWindow
8 | {
9 | [MenuItem("Excel/ExcelEditor")]
10 | public static void Open()
11 | {
12 | GetWindowWithRect(new Rect(0, 0, 600 , 400), false, "ExcelEditor");
13 | }
14 |
15 | public static void Open(Excel excel)
16 | {
17 | ExcelEditorWindow window = GetWindowWithRect(new Rect(0, 0, 600, 400), false, "ExcelEditor");
18 | window._excelPath = excel.FullPath;
19 | window._excel = excel;
20 | }
21 |
22 | public static void Open(string excelFullpath)
23 | {
24 | ExcelEditorWindow window = GetWindowWithRect(new Rect(0, 0, 600, 400), false, "ExcelEditor");
25 | window._excelPath = excelFullpath;
26 | window.LoadFile();
27 | }
28 |
29 |
30 | string _excelPath;
31 | Excel _excel;
32 | Vector2 _position;
33 | ExcelRow _tmpRow;
34 |
35 | Color _defaultBgColor;
36 |
37 | void OnGUI()
38 | {
39 | EditorGUILayout.BeginHorizontal();
40 | EditorGUILayout.LabelField("Excel路径 : ", GUILayout.Width(80));
41 | _excelPath = EditorGUILayout.TextField(_excelPath, GUILayout.Width(400));
42 | bool selectPath = GUILayout.Button("选择");
43 | if (selectPath)
44 | _excelPath = EditorWindowUtil.SelectFileWithFilters("选择Excel路径", _excelPath, new string[] { "xls,xlsx", "xls,xlsx" });
45 | EditorGUILayout.EndHorizontal();
46 |
47 | EditorGUILayout.BeginHorizontal();
48 | bool load = GUILayout.Button("Load");
49 | bool save = GUILayout.Button("Save");
50 | EditorGUILayout.EndHorizontal();
51 |
52 | if (load)
53 | LoadFile();
54 | if (save)
55 | SaveFile();
56 |
57 | if (_excel == null || _excel.excelData == null)
58 | return;
59 |
60 | _position = EditorGUILayout.BeginScrollView(_position);
61 | for(int i = 0; i < _excel.excelData.count; i++)
62 | {
63 | EditorGUILayout.BeginHorizontal();
64 | _tmpRow = _excel.excelData.GetRow(i);
65 | if (_tmpRow.rowType == ExcelRowType.Content || _tmpRow.rowType == ExcelRowType.Comment)
66 | {
67 | DrawRow(_tmpRow, DrawCell);
68 | }
69 | else if(_tmpRow.rowType == ExcelRowType.Type)
70 | {
71 | DrawRow(_tmpRow, DrawTypeCell);
72 | }
73 | else if(_tmpRow.rowType == ExcelRowType.Name)
74 | {
75 | DrawRow(_tmpRow, DrawNameCell);
76 | }
77 | EditorGUILayout.EndHorizontal();
78 | }
79 |
80 | EditorGUILayout.EndScrollView();
81 | }
82 |
83 |
84 | void DrawRow(ExcelRow row, Predicate drawCellFunc)
85 | {
86 | bool dirty;
87 | for(int i = 0; i < row.count; i++)
88 | {
89 | dirty = drawCellFunc(row.GetCell(i));
90 | if (!dirty && row.isDirty == false)
91 | row.isDirty = true;
92 | }
93 | }
94 |
95 | bool DrawCell(ExcelCell cell)
96 | {
97 | string s = EditorGUILayout.TextField(cell.stringValue);
98 | if(s != cell.stringValue)
99 | {
100 | cell.stringValue = s;
101 | return true;
102 | }
103 | return false;
104 | }
105 |
106 |
107 |
108 | bool DrawNameCell(ExcelCell cell)
109 | {
110 | _defaultBgColor = GUI.backgroundColor;
111 | GUI.backgroundColor = cell.ruleColor;
112 | bool dirty = DrawCell(cell);
113 | GUI.backgroundColor = _defaultBgColor;
114 | return dirty;
115 | }
116 | bool DrawTypeCell(ExcelCell cell)
117 | {
118 | var list = SupportTypeUtil.GetSupportTypeList();
119 | var type = SupportTypeUtil.GetIType(cell.stringValue);
120 | int index = 0;
121 | if (type != null)
122 | index = list.IndexOf(type.realName);
123 | int selectIndex = EditorGUILayout.Popup(index, list.ToArray());
124 | if(selectIndex != index || type == null)
125 | {
126 | cell.stringValue = list[selectIndex];
127 | return true;
128 | }
129 | return false;
130 | }
131 |
132 | void LoadFile()
133 | {
134 | if (string.IsNullOrEmpty(_excelPath))
135 | {
136 | _excelPath = EditorWindowUtil.SelectFileWithFilters("选择Excel路径", _excelPath, new string[] { "xls,xlsx", "xls,xlsx" });
137 | }
138 | if (string.IsNullOrEmpty(_excelPath) || (!_excelPath.EndsWith(".xls") && !_excelPath.EndsWith(".xlsx") ))
139 | {
140 | Debug.LogError("请选择正确的excel文件");
141 | return;
142 | }
143 | _excel = new Excel(_excelPath);
144 | _excel.Load();
145 | }
146 |
147 | void SaveFile()
148 | {
149 | if (_excel == null || string.IsNullOrEmpty(_excelPath))
150 | return;
151 | //_excel.excelData.SetAllDirty();
152 | _excel.Write();
153 | Debug.LogError("保存成功");
154 | }
155 |
156 |
157 | //string SelectFile()
158 | //{
159 | // string path = EditorUtility.OpenFilePanelWithFilters("选择Excel路径", _excelPath, new string[] { "xls,xlsx", "xls,xlsx"});
160 | // return path;
161 | //}
162 |
163 | }
164 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/ExcelLoader/NPOILoader.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using UnityEngine;
4 | using System.Text.RegularExpressions;
5 | using NPOI.SS.UserModel;
6 |
7 | public class NPOILoader : IExcelLoader
8 | {
9 | string _fullPath;
10 |
11 | public NPOILoader(string fullPath)
12 | {
13 | _fullPath = fullPath;
14 | }
15 |
16 |
17 |
18 | public ExcelData Load()
19 | {
20 | IWorkbook workBook = LoadWorkBookInternal();
21 | ISheet sheet;
22 | sheet = workBook.GetSheetAt(0);
23 | string fileName = Path.GetFileNameWithoutExtension(_fullPath);
24 | var excel = LoadExcelDataFromSheet(sheet, fileName);
25 | workBook.Close();
26 | return excel;
27 | }
28 |
29 | public List LoadBySheets()
30 | {
31 | List excelList = new List();
32 | IWorkbook workBook = LoadWorkBookInternal();
33 | int sheetCount = workBook.NumberOfSheets;
34 | if (sheetCount == 0)
35 | return excelList;
36 |
37 | ISheet sheet;
38 | for (int i = 0; i < sheetCount; i++)
39 | {
40 | sheet = workBook.GetSheetAt(i);
41 | string fileName;
42 | if(sheet != null && TryGetFileNameFromSheetName(sheet.SheetName, out fileName))
43 | excelList.Add(LoadExcelDataFromSheet(workBook.GetSheetAt(i), ""));
44 | }
45 | //兼容之前
46 | if(excelList.Count == 0)
47 | {
48 | string fileName = Path.GetFileNameWithoutExtension(_fullPath);
49 | LoadExcelDataFromSheet(workBook.GetSheetAt(0), fileName);
50 | }
51 | workBook.Close();
52 | return excelList;
53 | }
54 |
55 | //字母数字 下划线 开头只能为字母
56 | //fileName.OP.XXXX
57 | bool TryGetFileNameFromSheetName(string sheetName, out string fileName)
58 | {
59 | fileName = "";
60 | var subs = sheetName.Split('.');
61 | if (subs.Length <= 1)
62 | return false;
63 | if (!subs[1].Equals("OP"))
64 | return false;
65 | if (!Regex.IsMatch(subs[0], @"^[a-zA-Z]\w*$"))
66 | return false;
67 | fileName = subs[0];
68 | return true;
69 | }
70 |
71 | ExcelData LoadExcelDataFromSheet(ISheet sheet, string fileName)
72 | {
73 | ExcelData excel = new ExcelData();
74 | //string fileName = Path.GetFileNameWithoutExtension(_fullPath);
75 | excel.fileName = fileName;
76 | excel.excelRows = new List();
77 | for (int i = sheet.FirstRowNum; i <= sheet.LastRowNum; i++)
78 | {
79 | excel.excelRows.Add(GetExcelRow(sheet.GetRow(i), i));
80 | }
81 | return excel;
82 | }
83 |
84 | IWorkbook LoadWorkBookInternal()
85 | {
86 | IWorkbook workBook;
87 | using (FileStream fs = File.Open(_fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
88 | {
89 | if (fs == null)
90 | {
91 | Debug.LogError("找不到文件 " + _fullPath);
92 | return null;
93 | }
94 | workBook = WorkbookFactory.Create(fs);
95 | }
96 | return workBook;
97 | }
98 |
99 |
100 | //需要记录行数
101 | ExcelRow GetExcelRow(IRow row, int rowNum)
102 | {
103 | ExcelRow excelRow = new ExcelRow();
104 | excelRow.row = rowNum;
105 | if (row == null)
106 | return excelRow;
107 |
108 | excelRow.row = row.RowNum;
109 | excelRow.cellList = new List();
110 | for (int i = row.FirstCellNum; i < row.LastCellNum; i++)
111 | {
112 | excelRow.AddCell(GetExcelCell(row.GetCell(i), i));
113 | }
114 | return excelRow;
115 | }
116 |
117 | ExcelCell GetExcelCell(ICell cell, int index)
118 | {
119 | ExcelCell excelCell = new ExcelCell();
120 | excelCell.index = index;
121 | if (cell == null)
122 | return excelCell;
123 | CellType type;
124 | var obj = GetValueType(cell, out type);
125 | excelCell.value = obj;
126 | excelCell.stringValue = obj == null ? "" : obj.ToString();
127 | if (cell.CellStyle.FillForegroundColorColor != null)
128 | excelCell.rgb = cell.CellStyle.FillForegroundColorColor.RGB;
129 | else
130 | excelCell.rgb = new byte[] { 255, 255, 255 };
131 | excelCell.index = cell.ColumnIndex;
132 | return excelCell;
133 | }
134 |
135 | object GetValueType(ICell cell, out CellType type)
136 | {
137 | type = CellType.Error;
138 | if (cell == null)
139 | return null;
140 | type = cell.CellType;
141 | switch (type)
142 | {
143 | case CellType.Boolean:
144 | if (cell.BooleanCellValue == true)
145 | return "true";
146 | else
147 | return "false";
148 | case CellType.Numeric:
149 | return cell.NumericCellValue;
150 | case CellType.String:
151 | string str = cell.StringCellValue;
152 | if (string.IsNullOrEmpty(str))
153 | return null;
154 | return str.ToString();
155 | case CellType.Error:
156 | return cell.ErrorCellValue;
157 | case CellType.Formula:
158 | {
159 | type = cell.CachedFormulaResultType;
160 | switch (type)
161 | {
162 | case CellType.Boolean:
163 | if (cell.BooleanCellValue == true)
164 | return "true";
165 | else
166 | return "false";
167 | case CellType.Numeric:
168 | return cell.NumericCellValue;
169 | case CellType.String:
170 | string str1 = cell.StringCellValue;
171 | if (string.IsNullOrEmpty(str1))
172 | return null;
173 | return str1.ToString();
174 | case CellType.Error:
175 | return cell.ErrorCellValue;
176 | case CellType.Unknown:
177 | case CellType.Blank:
178 | default:
179 | return null;
180 | }
181 | }
182 | case CellType.Unknown:
183 | case CellType.Blank:
184 | default:
185 | return null;
186 | }
187 | }
188 |
189 | }
190 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/ExcelWriter/EppWriter.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using System.IO;
5 | using OfficeOpenXml;
6 |
7 | public class EppWriter : IExcelWriter
8 | {
9 | string _path;
10 | public void Write(string fullPath, ExcelData data)
11 | {
12 | InitPath(fullPath);
13 |
14 | var fileInfo = new FileInfo(fullPath);
15 | ExcelPackage package = new ExcelPackage(fileInfo);
16 | var workBook = package.Workbook;
17 | var sheet = workBook.Worksheets[1];
18 | WriteDataToSheet(sheet, data);
19 | SaveToFile(package);
20 | }
21 |
22 | void WriteDataToSheet(ExcelWorksheet sheet, ExcelData data)
23 | {
24 | for (int i = 0; i < data.excelRows.Count; i++)
25 | {
26 | var excelRowData = data.excelRows[i];
27 | if (!excelRowData.isDirty)
28 | continue;
29 | excelRowData.isDirty = false;
30 | for(int j = 0; j < excelRowData.count; j++)
31 | {
32 | sheet.Cells[i + 1, j + 1].Value = excelRowData.GetCell(j).stringValue;
33 | }
34 | }
35 | }
36 |
37 | void SaveToFile(ExcelPackage package)
38 | {
39 | package.Save();
40 | }
41 | void InitPath(string fullPath)
42 | {
43 | _path = Path.GetDirectoryName(fullPath);
44 | if (!Directory.Exists(_path))
45 | Directory.CreateDirectory(_path);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/ExcelWriter/NPOIWriter.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using System.IO;
5 | using NPOI.SS.UserModel;
6 | using NPOI.XSSF.UserModel;
7 | using NPOI.HSSF.UserModel;
8 |
9 | public class NPOIWriter : IExcelWriter
10 | {
11 | string _fullPath;
12 | string _path;
13 | string _ext;
14 | public NPOIWriter()
15 | {
16 | }
17 |
18 | void InitPath(string fullPath)
19 | {
20 | _fullPath = fullPath;
21 | _path = Path.GetDirectoryName(fullPath);
22 | _ext = Path.GetExtension(fullPath);
23 | if (!Directory.Exists(_path))
24 | Directory.CreateDirectory(_path);
25 | }
26 |
27 | public void Write(string fullPath, ExcelData data)
28 | {
29 | InitPath(fullPath);
30 |
31 | IWorkbook book = GetWorkBook();
32 | ISheet sheet = book.GetSheetAt(0);
33 | WriteDataToSheet(sheet, data);
34 | SaveToFile(book);
35 | }
36 |
37 | void SaveToFile(IWorkbook workBook)
38 | {
39 | using (FileStream fs = File.Open(_fullPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
40 | {
41 | workBook.Write(fs);
42 | workBook.Close();
43 | fs.Close();
44 | }
45 | }
46 |
47 | void WriteDataToSheet(ISheet sheet, ExcelData data)
48 | {
49 | for(int i = 0; i < data.excelRows.Count; i ++)
50 | {
51 | var excelRowData = data.excelRows[i];
52 | if (!excelRowData.isDirty)
53 | continue;
54 | excelRowData.isDirty = false;
55 | var row = sheet.GetRow(excelRowData.row);
56 | if (row == null)
57 | row = sheet.CreateRow(excelRowData.row);
58 | WriteDataToRow(row, excelRowData);
59 | }
60 | }
61 |
62 | void WriteDataToRow(IRow row, ExcelRow rowData)
63 | {
64 | for(int i = 0; i < rowData.count; i++)
65 | {
66 | var cellData = rowData.cellList[i];
67 | var cell = row.GetCell(cellData.index);
68 | if (cell == null)
69 | cell = row.CreateCell(cellData.index);
70 | WriteDataToCell(cell, cellData);
71 | }
72 | }
73 |
74 | //暂时都以string的形式写入
75 | //@todo 根据类型写入
76 | void WriteDataToCell(ICell cell, ExcelCell cellData)
77 | {
78 | cell.SetCellValue(cellData.stringValue);
79 | }
80 |
81 | IWorkbook GetWorkBook()
82 | {
83 | IWorkbook workBook;
84 | if (!File.Exists(_fullPath))
85 | {
86 | workBook = CreateWorkBook();
87 | workBook.CreateSheet();
88 | return workBook;
89 | }
90 |
91 | using (FileStream fs = File.Open(_fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
92 | {
93 | if (fs == null)
94 | {
95 | Debug.LogError("找不到文件 " + _fullPath);
96 | return null;
97 | }
98 | workBook = WorkbookFactory.Create(fs);
99 | }
100 | return workBook;
101 | }
102 |
103 | IWorkbook CreateWorkBook()
104 | {
105 | switch (_ext)
106 | {
107 | case ExcelExporterUtil.XLSEXT:
108 | return new HSSFWorkbook();
109 | //暂时不支持xlsx
110 | case ExcelExporterUtil.XLSXEXT:
111 | return new XSSFWorkbook();
112 | }
113 | return null;
114 | }
115 |
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Generater/ExcelBinaryClassGenerater.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using UnityEngine;
5 |
6 | public class ExcelBinaryClassGenerater : IExcelClassGenerater
7 | {
8 | public void GenerateClass(string savePath, string className, ExcelGameData data)
9 | {
10 | if (!Directory.Exists(savePath))
11 | Directory.CreateDirectory(savePath);
12 |
13 | string fileName = className + ExcelExporterUtil.ClientClassExt;
14 | var content = ExcelExporterUtil.GenerateCommonClassStr("Config.BinaryConfig", className, "ConfigBinaryBase", data);
15 | File.WriteAllText(savePath + fileName, content);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Generater/ExcelBinaryDataGenerater.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Runtime.Serialization.Formatters.Binary;
3 |
4 | public class ExcelBinaryDataGenerater : IExcelDataGenerater
5 | {
6 |
7 | public void GenerateData(string savePath, string fileName, ExcelGameData data, string className)
8 | {
9 | if (!Directory.Exists(savePath))
10 | Directory.CreateDirectory(savePath);
11 |
12 | var type = ExcelExporterUtil.GetDataType("Config.BinaryConfig.", className);
13 | if (type == null)
14 | return;
15 | var objContainer = new ConfigBinaryContainer();
16 | objContainer.typeName = type.Name;
17 | for (int i = 0; i < data.cellList.Count; i++)
18 | {
19 | var cfg = data.GetObject(i, type) as ConfigBinaryBase;
20 | objContainer.dataMap.Add(cfg.ID, cfg);
21 | }
22 | BinaryFormatter formater = new BinaryFormatter();
23 | var fileStream = new FileStream(Path.Combine(savePath, fileName), FileMode.OpenOrCreate);
24 | formater.Serialize(fileStream, objContainer);
25 | fileStream.Close();
26 | //File.WriteAllText(Path.Combine(savePath, fileName), content);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Generater/ExcelJsonClassGenerater.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 | using System.Text.RegularExpressions;
6 | using UnityEngine;
7 |
8 | public class ExcelJsonClassGenerater : IExcelClassGenerater
9 | {
10 | public void GenerateClass(string savePath, string className, ExcelGameData data)
11 | {
12 | if (!Directory.Exists(savePath))
13 | Directory.CreateDirectory(savePath);
14 | string fileName = className + ExcelExporterUtil.ClientClassExt;
15 | //var content = ExcelExporterUtil.GenerateCommonClassStr("Config.JsonConfig", className, "ConfigJsonBase", data);
16 | List types = data.fieldTypeList;
17 | List fields = data.fieldNameList;
18 |
19 | StringBuilder sb = new StringBuilder();
20 |
21 | ExcelExporterUtil.AddCommonSpaceToSb(sb);
22 |
23 | sb.AppendLine("using Newtonsoft.Json;");
24 | sb.AppendLine();
25 |
26 | //sb.AppendLine("namespace " + "Config.JsonConfig");
27 | //sb.AppendLine("{");
28 |
29 | //sb.AppendLine("\tpublic class " + className + ": ConfigJsonBase");
30 | //sb.AppendLine("\t{");
31 |
32 | //ExcelExporterUtil.AddFieldsToSb(sb, types, fields);
33 |
34 | //sb.AppendLine("\t}");
35 | //sb.AppendLine("}");
36 | ExcelExporterUtil.AddContentToSb(sb, "Config.JsonConfig", className, "ConfigJsonBase", types, fields, false);
37 |
38 |
39 | File.WriteAllText(savePath + fileName, sb.ToString());
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Generater/ExcelJsonDataGenerater.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using UnityEngine;
4 | using Newtonsoft.Json;
5 |
6 | public class ExcelJsonDataGenerater : IExcelDataGenerater
7 | {
8 | public void GenerateData(string savePath, string fileName, ExcelGameData data, string className)
9 | {
10 | if (!Directory.Exists(savePath))
11 | Directory.CreateDirectory(savePath);
12 |
13 | var type = ExcelExporterUtil.GetDataType("Config.JsonConfig.", className);
14 | if (type == null)
15 | return;
16 | var objContainer = new ConfigJsonContainer();;
17 | objContainer.typeName = type.Name;
18 |
19 | for(int i = 0; i < data.cellList.Count; i++)
20 | {
21 | var cfg = data.GetObject(i, type) as ConfigJsonBase;
22 | objContainer.dataMap.Add(cfg.ID, cfg);
23 | }
24 |
25 | JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Objects };
26 | var content = JsonConvert.SerializeObject(objContainer, settings);
27 | File.WriteAllText(Path.Combine(savePath, fileName), content);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Generater/ExcelScriptableObjectClassGenerater.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | public class ExcelScriptableObjectClassGenerater : IExcelClassGenerater
4 | {
5 | public void GenerateClass(string savePath, string className, ExcelGameData data)
6 | {
7 | if (!Directory.Exists(savePath))
8 | Directory.CreateDirectory(savePath);
9 |
10 | string fileName = className + ExcelExporterUtil.ClientClassExt;
11 | var content = ExcelExporterUtil.GenerateCommonClassStr("Config.ScriptableConfig", className, "ConfigSoBase", data);
12 |
13 | File.WriteAllText(savePath + fileName, content);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Generater/ExcelScriptableObjectDataGenerater.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEditor;
3 | using System.IO;
4 |
5 | public class ExcelScriptableObjectDataGenerater : IExcelDataGenerater
6 | {
7 | public void GenerateData(string savePath, string fileName, ExcelGameData data, string className)
8 | {
9 | if (!Directory.Exists(savePath))
10 | Directory.CreateDirectory(savePath);
11 |
12 | var type = ExcelExporterUtil.GetDataType("Config.ScriptableConfig.", className);
13 | if (type == null)
14 | return;
15 | var objContainer = ScriptableObject.CreateInstance();
16 | objContainer.typeName = type.Name;
17 | string relativePath = ExcelExporterUtil.GetRelativePath(savePath);
18 | AssetDatabase.CreateAsset(objContainer, Path.Combine(relativePath, fileName));
19 | for (int i = 0; i < data.cellList.Count; i++)
20 | {
21 | var dataInstance = data.GetSOObject(i, type) as ConfigSoBase;
22 | dataInstance.hideFlags = HideFlags.HideInInspector;
23 | objContainer.dataList.Add(dataInstance);
24 | AssetDatabase.AddObjectToAsset(dataInstance, objContainer);
25 | }
26 | AssetDatabase.SaveAssets();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Generater/ExcelTextClassGenerater.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using System.Text;
5 | using System.IO;
6 | using System.Text.RegularExpressions;
7 |
8 | //不写成静态类
9 | //@todo 添加模板方式
10 | public class ExcelTextClassGenerater : IExcelClassGenerater
11 | {
12 | public void GenerateClass(string savePath, string className, ExcelGameData data)
13 | {
14 | if (!Directory.Exists(savePath))
15 | Directory.CreateDirectory(savePath);
16 | string fileName = className + ExcelExporterUtil.ClientClassExt;
17 |
18 | List types = data.fieldTypeList;
19 | List fields = data.fieldNameList;
20 | StringBuilder sb = new StringBuilder();
21 | ExcelExporterUtil.AddCommonSpaceToSb(sb);
22 |
23 | sb.AppendLine("namespace Config.TextConfig");
24 | sb.AppendLine("{");
25 | sb.AppendLine("\tpublic class " + className + " : ConfigTextBase");
26 | sb.AppendLine("\t{");
27 |
28 | //跳过ID 字段
29 | for (int i = 1; i < types.Count; i++)
30 | {
31 | var type = SupportTypeUtil.GetIType(types[i]);
32 | if(type != null)
33 | sb.AppendLine(string.Format("\t\tpublic {0} {1};", type.realName, fields[i]));
34 | }
35 |
36 | sb.AppendLine();
37 | sb.AppendLine();
38 |
39 | sb.AppendLine("\t\tpublic override void Write(int i, string value)");
40 | sb.AppendLine("\t\t{");
41 | sb.AppendLine("\t\t\tswitch (i)");
42 | sb.AppendLine("\t\t\t{");
43 |
44 | for (int i = 0; i < types.Count; i++)
45 | {
46 | sb.AppendLine("\t\t\t\tcase " + i + ":");
47 | //默认第一个字段名称为ID 先临时处理
48 | sb.AppendLine("\t\t\t\t\t" + (i == 0 ? "ID" : fields[i]) + " = " + SupportTypeUtil.GetTypeParseFuncName(types[i]) + "(value);");
49 | sb.AppendLine("\t\t\t\t\tbreak;");
50 | }
51 |
52 | sb.AppendLine("\t\t\t\tdefault:");
53 | sb.AppendLine("\t\t\t\t\tUnityEngine.Debug.LogError(GetType().Name + \"src i:\" + i);");
54 | sb.AppendLine("\t\t\t\t\tbreak;");
55 | sb.AppendLine("\t\t\t}");
56 | sb.AppendLine("\t\t}");
57 | sb.AppendLine("\t}");
58 | sb.AppendLine("}");
59 |
60 | File.WriteAllText(savePath + fileName, sb.ToString());
61 | }
62 |
63 | public static void GenerateClientClassFactory(string dataPath, string savePath, bool empty)
64 | {
65 | var files = Directory.GetFiles(dataPath, "*.bytes");
66 | List classNameList = new List();
67 | for(int i = 0; i < files.Length; i++)
68 | {
69 | //@todo +宏
70 | string fileName = Path.GetFileNameWithoutExtension(files[i]);
71 | classNameList.Add(fileName);
72 | }
73 | StringBuilder sb = new StringBuilder();
74 | sb.AppendLine("namespace Config.TextConfig");
75 | sb.AppendLine("{");
76 | sb.AppendLine("\tpublic class " + ExcelExporterUtil.ConfigFactoryName);
77 | sb.AppendLine("\t{");
78 | sb.AppendLine("\t\tpublic static ConfigTextBase Get(string configName)");
79 | sb.AppendLine("\t\t{");
80 | if(!empty)
81 | {
82 | sb.AppendLine("\t\t\tswitch(configName)");
83 | sb.AppendLine("\t\t\t{");
84 |
85 | for (int i = 0; i < classNameList.Count; i++)
86 | {
87 | sb.AppendLine("\t\t\t\tcase \"" + classNameList[i] + "\":");
88 | sb.AppendLine("\t\t\t\t\treturn new " + ExcelExporterUtil.ClientClassPre + classNameList[i] + "();");
89 | }
90 |
91 | sb.AppendLine("\t\t\t}");
92 | }
93 |
94 | sb.AppendLine("\t\t\treturn null;");
95 | sb.AppendLine("\t\t}");
96 | sb.AppendLine("\t}");
97 | sb.AppendLine("}");
98 | File.WriteAllText(Path.Combine(savePath, ExcelExporterUtil.ConfigFactoryName) + ExcelExporterUtil.ClientClassExt, sb.ToString());
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Generater/ExcelTextDataGenerater.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using System.Text;
5 | using System.IO;
6 |
7 | public class ExcelTextDataGenerater : IExcelDataGenerater
8 | {
9 | //fileName 带后缀名
10 | public void GenerateData(string savePath, string fileName, ExcelGameData data, string className)
11 | {
12 | if (!Directory.Exists(savePath))
13 | Directory.CreateDirectory(savePath);
14 | StringBuilder sb = new StringBuilder();
15 | for(int row = 0; row < data.cellList.Count; row++)
16 | {
17 | for(int column = 0; column < data.cellList[row].Count; column++)
18 | {
19 | sb.Append(data.cellList[row][column].stringValue);
20 | if (column != data.cellList[row].Count - 1)
21 | sb.Append("\t");
22 | }
23 | sb.Append("\n");
24 | }
25 |
26 | File.WriteAllText(Path.Combine(savePath, fileName), sb.ToString());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/DesType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | public class DesType : IType
4 | {
5 | public string lowerName { get { return "des"; } }
6 | public string realName { get { return "string"; } }
7 | public Type type { get { return typeof(string); } }
8 |
9 | public string parseFuncName { get { return "ParseDes"; } }
10 |
11 | public bool isUnityType { get { return false; } }
12 |
13 | public string jsonAttributeStr { get { return ""; } }
14 |
15 | public object GetValue(string content)
16 | {
17 | string des;
18 | StringUtil.TryParseDes(content, out des);
19 | return des;
20 | }
21 |
22 | public bool CheckValue(string content)
23 | {
24 | return true;
25 | }
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/DictionaryIntIntType.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System;
3 |
4 | public class DictionaryIntIntType : IType
5 | {
6 | public string lowerName { get { return "dictionary"; } }
7 | public string realName { get { return "Dictionary"; } }
8 | public Type type { get { return typeof(Dictionary); } }
9 |
10 | public string parseFuncName { get { return "ParseDicIntInt"; } }
11 |
12 | public bool isUnityType { get { return false; } }
13 |
14 | public string jsonAttributeStr { get { return ""; } }
15 |
16 | public object GetValue(string content)
17 | {
18 | Dictionary res;
19 | StringUtil.TryParseDicIntInt(content, out res);
20 | return res;
21 | }
22 |
23 | public bool CheckValue(string content)
24 | {
25 | Dictionary res;
26 | return StringUtil.TryParseDicIntInt(content, out res);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/DictionaryIntStringType.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System;
3 |
4 | public class DictionaryIntStringType : IType
5 | {
6 | public string lowerName { get { return "dictionary"; } }
7 | public string realName { get { return "Dictionary"; } }
8 | public Type type { get { return typeof(Dictionary); } }
9 |
10 | public string parseFuncName { get { return "ParseDicIntString"; } }
11 |
12 | public bool isUnityType { get { return false; } }
13 |
14 | public string jsonAttributeStr { get { return ""; } }
15 |
16 | public object GetValue(string content)
17 | {
18 | Dictionary res;
19 | StringUtil.TryParseDicIntString(content, out res);
20 | return res;
21 | }
22 |
23 | public bool CheckValue(string content)
24 | {
25 | Dictionary res;
26 | return StringUtil.TryParseDicIntString(content, out res);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/FloatType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | public class FloatType : IType
4 | {
5 | public string lowerName { get { return "float"; } }
6 | public string realName { get { return "float"; } }
7 | public Type type { get { return typeof(float); } }
8 |
9 | public string parseFuncName { get { return "ParseFloat"; } }
10 |
11 | public bool isUnityType { get { return false; } }
12 |
13 | public string jsonAttributeStr { get { return ""; } }
14 |
15 | public object GetValue(string content)
16 | {
17 | float value;
18 | StringUtil.TryParseFloat(content, out value);
19 | return value;
20 | }
21 |
22 | public bool CheckValue(string content)
23 | {
24 | float value;
25 | return StringUtil.TryParseFloat(content, out value);
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/IType.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using System;
5 |
6 | //每个类型对应一个类便于特殊类型检测
7 | //使用统一Info的方式也可以,各类特殊检测会比较麻烦
8 | public interface IType
9 | {
10 | string lowerName { get; }
11 | string realName { get; }
12 | Type type { get; }
13 | string parseFuncName { get; }
14 | bool isUnityType { get; }
15 | string jsonAttributeStr { get; }
16 |
17 | object GetValue(string content);
18 |
19 | bool CheckValue(string content);
20 | }
21 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/IntType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | public class IntType : IType
4 | {
5 | public string lowerName { get { return "int"; } }
6 | public string realName { get { return "int"; } }
7 | public Type type {get {return typeof(int);}}
8 |
9 | public string parseFuncName { get { return "ParseInt"; } }
10 |
11 | public bool isUnityType { get { return false; } }
12 |
13 | public string jsonAttributeStr { get { return ""; } }
14 |
15 | public object GetValue(string content)
16 | {
17 | int value;
18 | StringUtil.TryParseInt(content, out value);
19 | return value;
20 | }
21 |
22 | public bool CheckValue(string content)
23 | {
24 | int value;
25 | return StringUtil.TryParseInt(content, out value);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/ListFloatType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | public class ListFloatType : IType
5 | {
6 | public string lowerName { get { return "list"; } }
7 | public string realName { get { return "List"; } }
8 | public Type type { get { return typeof(List); } }
9 |
10 | public string parseFuncName { get { return "ParseListFloat"; } }
11 |
12 | public bool isUnityType { get { return false; } }
13 |
14 | public string jsonAttributeStr { get { return ""; } }
15 |
16 | public object GetValue(string content)
17 | {
18 | List res;
19 | StringUtil.TryParseListFloat(content, out res);
20 | return res;
21 | }
22 |
23 | public bool CheckValue(string content)
24 | {
25 | List res;
26 | return StringUtil.TryParseListFloat(content, out res);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/ListIntType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | public class ListIntType : IType
5 | {
6 | public string lowerName { get { return "list"; } }
7 | public string realName { get { return "List"; } }
8 | public Type type { get { return typeof(List); } }
9 |
10 | public string parseFuncName { get { return "ParseListInt"; } }
11 |
12 | public bool isUnityType { get { return false; } }
13 |
14 | public string jsonAttributeStr { get { return ""; } }
15 |
16 | public object GetValue(string content)
17 | {
18 | List res;
19 | StringUtil.TryParseListInt(content, out res);
20 | return res;
21 | }
22 |
23 | public bool CheckValue(string content)
24 | {
25 | List res;
26 | return StringUtil.TryParseListInt(content, out res);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/ListListStringType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | public class ListListStringType : IType
5 | {
6 | public string lowerName { get { return "list>"; } }
7 | public string realName { get { return "List>"; } }
8 | public Type type { get { return typeof(List>); } }
9 |
10 | public string parseFuncName { get { return "ParseListListString"; } }
11 |
12 | public bool isUnityType { get { return false; } }
13 |
14 | public string jsonAttributeStr { get { return ""; } }
15 |
16 | public object GetValue(string content)
17 | {
18 | List> res;
19 | StringUtil.TryParseListListString(content, out res);
20 | return res;
21 | }
22 |
23 | public bool CheckValue(string content)
24 | {
25 | List> res;
26 | return StringUtil.TryParseListListString(content, out res);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/ListStringType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | public class ListStringType : IType
5 | {
6 | public string lowerName { get { return "list"; } }
7 | public string realName { get { return "List"; } }
8 | public Type type { get { return typeof(List); } }
9 |
10 | public string parseFuncName { get { return "ParseListString"; } }
11 |
12 | public bool isUnityType { get { return false; } }
13 |
14 | public string jsonAttributeStr { get { return ""; } }
15 |
16 | public object GetValue(string content)
17 | {
18 | List res;
19 | StringUtil.TryParseListString(content, out res);
20 | return res;
21 | }
22 |
23 | public bool CheckValue(string content)
24 | {
25 | List res;
26 | return StringUtil.TryParseListString(content, out res);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/StringType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | public class StringType : IType
4 | {
5 | public string lowerName { get { return "string"; } }
6 | public string realName { get { return "string"; } }
7 | public Type type { get { return typeof(string); } }
8 |
9 | public string parseFuncName { get { return "ParseString"; } }
10 |
11 | public bool isUnityType { get { return false; } }
12 |
13 | public string jsonAttributeStr { get { return ""; } }
14 |
15 | public object GetValue(string content)
16 | {
17 | return content;
18 | }
19 |
20 | public bool CheckValue(string content)
21 | {
22 | return true;
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/Vector2Type.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | public class Vector2Type : IType
5 | {
6 | public string lowerName { get { return "vector2"; } }
7 | public string realName { get { return "Vector2"; } }
8 | public Type type { get { return typeof(int); } }
9 |
10 | public string parseFuncName { get { return "ParseVector2"; } }
11 |
12 | public bool isUnityType { get { return true; } }
13 |
14 | public string jsonAttributeStr { get { return "[JsonConverter(typeof(Vector2Converter))]"; } }
15 |
16 | public object GetValue(string content)
17 | {
18 | Vector2 value;
19 | StringUtil.TryParseVector2(content, out value);
20 | return value;
21 | }
22 |
23 | public bool CheckValue(string content)
24 | {
25 | Vector2 value;
26 | return StringUtil.TryParseVector2(content, out value);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Type/Vector3Type.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | public class Vector3Type : IType
5 | {
6 | public string lowerName { get { return "vector3"; } }
7 | public string realName { get { return "Vector3"; } }
8 | public Type type { get { return typeof(int); } }
9 |
10 | public string parseFuncName { get { return "ParseVector3"; } }
11 |
12 | public bool isUnityType { get { return true; } }
13 |
14 | public string jsonAttributeStr { get { return "[JsonConverter(typeof(Vector3Converter))]"; } }
15 |
16 | public object GetValue(string content)
17 | {
18 | Vector3 value;
19 | StringUtil.TryParseVector3(content, out value);
20 | return value;
21 | }
22 |
23 | public bool CheckValue(string content)
24 | {
25 | Vector3 value;
26 | return StringUtil.TryParseVector3(content, out value);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Util/EditorWindowUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | public class EditorWindowUtil
6 | {
7 | public static string SelectFileWithFilters(string title, string defaultPath, string[] filers = null)
8 | {
9 | string filePath = EditorUtility.OpenFilePanelWithFilters(title, defaultPath, filers);
10 | return filePath;
11 | }
12 |
13 | public static string SelectFile(string title, string defaultPath, string ext)
14 | {
15 | return EditorUtility.OpenFolderPanel(title, defaultPath, ext);
16 | }
17 |
18 | public static string SelectFolder(string title, string defaultFolder, string defaultName = "")
19 | {
20 | return EditorUtility.OpenFolderPanel(title, defaultFolder, defaultName);
21 | }
22 |
23 | public static bool DrawSelectPathView(string title, string value, string buttonName = "选择")
24 | {
25 | EditorGUILayout.LabelField(title);
26 | EditorGUILayout.BeginHorizontal();
27 | EditorGUILayout.TextField(value);
28 | bool select = GUILayout.Button("选择");
29 | GUILayout.EndHorizontal();
30 | return select;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Util/ExcelExporterUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Text.RegularExpressions;
5 | using UnityEngine;
6 |
7 | public enum ExcelDataExportType
8 | {
9 | Text,
10 | Bytes,
11 | Json,
12 | ScriptObject,
13 | }
14 |
15 | [Serializable]
16 | public class ExcelExporterUtil
17 | {
18 | //可以指定不同工程
19 | [SerializeField]
20 | public static string AssetPath = Application.dataPath;
21 | [SerializeField]
22 | public static string ExcelPath = "";
23 |
24 | public static ExcelDataExportType exportType = ExcelDataExportType.ScriptObject;
25 |
26 | public static string ClientDataOutputPath = AssetPath + "/Resources/Data/";
27 |
28 | public static string ClientScriptOutputPath = AssetPath + "/Script/Data/";
29 |
30 | public static string ClientClassExt = ".cs";
31 |
32 | public static string ScriptableObjectExt = ".asset";
33 |
34 | public static string ClientClassPre = "Cfg";
35 |
36 | public static string ConfigFactoryName = "ConfigFactory";
37 |
38 |
39 |
40 | public const string XLSEXT = ".xls";
41 | public const string XLSXEXT = ".xlsx";
42 |
43 |
44 | public static string SeverDataOutputPath = "";
45 | public static string SeverClassOutputPath = "";
46 |
47 |
48 | public static string GetClientClassOutputPath()
49 | {
50 | //string subPath = "";
51 | //switch(exportType)
52 | //{
53 | // case ExcelDataExportType.Text:
54 | // subPath = "/ConfigT/";
55 | // break;
56 | // case ExcelDataExportType.Json:
57 | // subPath = "/ConfigJ/";
58 | // break;
59 | // case ExcelDataExportType.Bytes:
60 | // subPath = "/ConfigB/";
61 | // break;
62 | // case ExcelDataExportType.ScriptObject:
63 | // subPath = "/ConfigS/";
64 | // break;
65 | //}
66 | return ClientScriptOutputPath + "/";
67 | }
68 |
69 | public static string GetClientDataOutputPath()
70 | {
71 | //string subPath = "";
72 | //switch (exportType)
73 | //{
74 | // case ExcelDataExportType.Text:
75 | // subPath = "/DataT/";
76 | // break;
77 | // case ExcelDataExportType.Json:
78 | // subPath = "/DataJ/";
79 | // break;
80 | // case ExcelDataExportType.Bytes:
81 | // subPath = "/DataB/";
82 | // break;
83 | // case ExcelDataExportType.ScriptObject:
84 | // subPath = "/DataS/";
85 | // break;
86 | //}
87 | return ClientDataOutputPath + "/";
88 | }
89 |
90 |
91 | public static string GetRelativePath(string fullPath)
92 | {
93 | return fullPath.Replace(Application.dataPath, "Assets");
94 | }
95 |
96 |
97 | public static string GetConfigFactoryFullPath()
98 | {
99 | return ClientScriptOutputPath + ConfigFactoryName + ClientClassExt;
100 | }
101 |
102 | public static string GetClientClassFileName(string fileName)
103 | {
104 | fileName = fileName.Substring(0, 1).ToUpper() + fileName.Substring(1);
105 | return ClientClassPre + fileName;
106 | }
107 |
108 | public static string GetDataFileFullName(string excelName)
109 | {
110 | switch (exportType)
111 | {
112 | case ExcelDataExportType.ScriptObject:
113 | return excelName + ".asset";
114 | case ExcelDataExportType.Text:
115 | return excelName + ".bytes";
116 | }
117 | return excelName + ".bytes";
118 | }
119 |
120 | public static void AddCommonSpaceToSb(StringBuilder sb)
121 | {
122 | sb.AppendLine("using System;");
123 | sb.AppendLine("using System.Collections.Generic;");
124 | sb.AppendLine("using UnityEngine;");
125 | sb.AppendLine();
126 | }
127 |
128 | public static string GenerateCommonClassStr(string nameSpace, string className, string configBase, ExcelGameData data, bool needSerializable = true)
129 | {
130 | List types = data.fieldTypeList;
131 | List fields = data.fieldNameList;
132 |
133 | StringBuilder sb = new StringBuilder();
134 | AddCommonSpaceToSb(sb);
135 | AddContentToSb(sb, nameSpace, className, configBase, types, fields, needSerializable);
136 |
137 | return sb.ToString();
138 | }
139 |
140 | public static void AddContentToSb(StringBuilder sb, string nameSpace, string className, string configBase, List types, List fields, bool needSerializable)
141 | {
142 | sb.AppendLine("namespace " + nameSpace);
143 | sb.AppendLine("{");
144 | if (needSerializable)
145 | sb.AppendLine("\t[Serializable]");
146 | sb.AppendLine("\tpublic class " + className + ": " + configBase);
147 | sb.AppendLine("\t{");
148 |
149 | AddFieldsToSb(sb, types, fields);
150 |
151 | sb.AppendLine("\t}");
152 | sb.AppendLine("}");
153 | }
154 |
155 |
156 | public static void AddFieldsToSb(StringBuilder sb, List types, List fields)
157 | {
158 | for (int i = 1; i < types.Count; i++)
159 | {
160 | var type = SupportTypeUtil.GetIType(types[i]);
161 | if (type != null)
162 | {
163 | if(exportType == ExcelDataExportType.Json && type.isUnityType)
164 | {
165 | sb.AppendLine("\t\t" + type.jsonAttributeStr);
166 | }
167 | sb.AppendLine(string.Format("\t\tpublic {0} {1};", type.realName, fields[i]));
168 | }
169 | }
170 | }
171 |
172 | public static Type GetDataType(string nameSpace, string className)
173 | {
174 | var type = Type.GetType(nameSpace + className + ", Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
175 | if (type == null)
176 | {
177 | Debug.LogError("找不到类型" + nameSpace + className);
178 | return null;
179 | }
180 | return type;
181 | }
182 |
183 | public static string RemoveWhiteSpaceOutTheWordFull(string content)
184 | {
185 | content = RemoveWhiteSpaceOutTheWord(content, ',');
186 | content = RemoveWhiteSpaceOutTheWord(content, '(');
187 | content = RemoveWhiteSpaceOutTheWord(content, ')');
188 | return content;
189 | }
190 |
191 | static string RemoveWhiteSpaceOutTheWord(string content, char sep)
192 | {
193 | string[] subs = content.Split(new char[] { sep });
194 | for (int i = 0; i < subs.Length; i++)
195 | {
196 | subs[i] = subs[i].TrimStart(' ', '\t');
197 | subs[i] = subs[i].TrimEnd(' ', '\t');
198 | }
199 | content = string.Join(new string(sep, 1), subs);
200 | return content;
201 | }
202 |
203 | //需要先移除空白符
204 | //@todo 正则
205 | public static string RemoveWordFirstQuotation(string content)
206 | {
207 | StringBuilder sb = new StringBuilder();
208 | for (int i = 0; i < content.Length; i++)
209 | {
210 | bool needJump = false;
211 | if (content[i] == '"')
212 | {
213 | //首字符需要去掉
214 | if (i == 0)
215 | needJump = true;
216 | else if (content[i - 1] == '(' || content[i - 1] == ',')
217 | needJump = true;
218 | if (i == content.Length - 1)
219 | needJump = true;
220 | else if (content[i + 1] == ')' || content[i + 1] == ',')
221 | needJump = true;
222 | }
223 | if (!needJump)
224 | sb.Append(content[i]);
225 | }
226 | return sb.ToString();
227 | }
228 | }
229 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Util/Factorys.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public enum GeneraterFactoryType
6 | {
7 | Client,
8 | Server,
9 | }
10 |
11 | public interface IClassFactory
12 | {
13 | IExcelClassGenerater Create();
14 | }
15 |
16 | public interface IDataFactory
17 | {
18 | IExcelDataGenerater Create();
19 | }
20 |
21 | public class ClassFactory
22 | {
23 | public static IClassFactory GetFactory(GeneraterFactoryType type)
24 | {
25 | switch(type)
26 | {
27 | case GeneraterFactoryType.Client:
28 | return new ExcelClientClassGeneraterFactory();
29 | case GeneraterFactoryType.Server:
30 | return new ExcelServerClassGeneraterFactory();
31 | }
32 | return new ExcelClientClassGeneraterFactory();
33 | }
34 | }
35 |
36 | public class DataFactory
37 | {
38 | public static IDataFactory GetFactory(GeneraterFactoryType type)
39 | {
40 | switch(type)
41 | {
42 | case GeneraterFactoryType.Client:
43 | return new ExcelClientDataGeneraterFactory();
44 | case GeneraterFactoryType.Server:
45 | return new ExcelServerDataGeneraterFactory();
46 | }
47 | return new ExcelClientDataGeneraterFactory();
48 | }
49 | }
50 |
51 | public class ExcelServerClassGeneraterFactory : IClassFactory
52 | {
53 | public IExcelClassGenerater Create()
54 | {
55 | switch (ExcelExporterUtil.exportType)
56 | {
57 | case ExcelDataExportType.Text:
58 | return new ExcelTextClassGenerater();
59 | }
60 |
61 | return null;
62 | }
63 | }
64 |
65 | public class ExcelClientClassGeneraterFactory : IClassFactory
66 | {
67 | public IExcelClassGenerater Create()
68 | {
69 | switch (ExcelExporterUtil.exportType)
70 | {
71 | case ExcelDataExportType.Text:
72 | return new ExcelTextClassGenerater();
73 | case ExcelDataExportType.ScriptObject:
74 | return new ExcelScriptableObjectClassGenerater();
75 | case ExcelDataExportType.Json:
76 | return new ExcelJsonClassGenerater();
77 | case ExcelDataExportType.Bytes:
78 | return new ExcelBinaryClassGenerater();
79 | }
80 |
81 | return null;
82 | }
83 | }
84 |
85 | public class ExcelServerDataGeneraterFactory : IDataFactory
86 | {
87 | public IExcelDataGenerater Create()
88 | {
89 | switch (ExcelExporterUtil.exportType)
90 | {
91 | case ExcelDataExportType.Text:
92 | return new ExcelTextDataGenerater();
93 | }
94 | return null;
95 | }
96 | }
97 |
98 | public class ExcelClientDataGeneraterFactory : IDataFactory
99 | {
100 | public IExcelDataGenerater Create()
101 | {
102 | switch (ExcelExporterUtil.exportType)
103 | {
104 | case ExcelDataExportType.Text:
105 | return new ExcelTextDataGenerater();
106 | case ExcelDataExportType.ScriptObject:
107 | return new ExcelScriptableObjectDataGenerater();
108 | case ExcelDataExportType.Json:
109 | return new ExcelJsonDataGenerater();
110 | case ExcelDataExportType.Bytes:
111 | return new ExcelBinaryDataGenerater();
112 | }
113 | return null;
114 | }
115 | }
116 |
117 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/Util/SupportTypeUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using UnityEngine;
5 |
6 |
7 | public class SupportTypeUtil
8 | {
9 | static Dictionary _supportTypeMap = new Dictionary();
10 | static List _suportTypeList = new List();
11 | static SupportTypeUtil()
12 | {
13 | IType type = new IntType();
14 | _supportTypeMap.Add(type.lowerName, type);
15 | _suportTypeList.Add(type.realName);
16 | type = new FloatType();
17 | _supportTypeMap.Add(type.lowerName, type);
18 | _suportTypeList.Add(type.realName);
19 | type = new StringType();
20 | _supportTypeMap.Add(type.lowerName, type);
21 | _suportTypeList.Add(type.realName);
22 | type = new ListIntType();
23 | _supportTypeMap.Add(type.lowerName, type);
24 | _suportTypeList.Add(type.realName);
25 | type = new ListStringType();
26 | _supportTypeMap.Add(type.lowerName, type);
27 | _suportTypeList.Add(type.realName);
28 | type = new ListFloatType();
29 | _supportTypeMap.Add(type.lowerName, type);
30 | _suportTypeList.Add(type.realName);
31 | type = new Vector2Type();
32 | _supportTypeMap.Add(type.lowerName, type);
33 | _suportTypeList.Add(type.realName);
34 | type = new Vector3Type();
35 | _supportTypeMap.Add(type.lowerName, type);
36 | _suportTypeList.Add(type.realName);
37 | type = new DesType();
38 | _supportTypeMap.Add(type.lowerName, type);
39 | _suportTypeList.Add(type.realName);
40 | type = new DictionaryIntIntType();
41 | _supportTypeMap.Add(type.lowerName, type);
42 | _suportTypeList.Add(type.realName);
43 | type = new DictionaryIntStringType();
44 | _supportTypeMap.Add(type.lowerName, type);
45 | _suportTypeList.Add(type.realName);
46 | type = new ListListStringType();
47 | _supportTypeMap.Add(type.lowerName, type);
48 | _suportTypeList.Add(type.realName);
49 | }
50 |
51 | public static List GetSupportTypeList()
52 | {
53 | return _suportTypeList;
54 | }
55 |
56 | public static IType GetIType(string typeName)
57 | {
58 | string lowerType = typeName.ToLower().Replace(" ", "");
59 | if (_supportTypeMap.ContainsKey(lowerType))
60 | return _supportTypeMap[lowerType];
61 | return null;
62 | }
63 |
64 | static public bool TryGetTypeName(string origin, out string formatType)
65 | {
66 | formatType = "string";
67 | origin = origin.ToLower();
68 | origin = origin.Replace(" ", "");
69 |
70 | if(_supportTypeMap.ContainsKey(origin))
71 | {
72 | formatType = _supportTypeMap[origin].lowerName;
73 | return true;
74 | }
75 | return false;
76 | }
77 |
78 |
79 | static public string GetTypeParseFuncName(string key)
80 | {
81 | key = key.ToLower();
82 | key = key.Replace(" ", "");
83 | if (_supportTypeMap.ContainsKey(key))
84 | {
85 | return _supportTypeMap[key].parseFuncName;
86 | }
87 | return "ParseString";
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/interface/IExcelClassGenerater.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public interface IExcelClassGenerater
6 | {
7 | void GenerateClass(string savePath, string className, ExcelGameData data);
8 | }
9 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/interface/IExcelDataGenerater.cs:
--------------------------------------------------------------------------------
1 | public interface IExcelDataGenerater
2 | {
3 | void GenerateData(string savePath, string fileName, ExcelGameData data, string className);
4 | }
5 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/interface/IExcelLoader.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public interface IExcelLoader
6 | {
7 | ExcelData Load();
8 | }
9 |
--------------------------------------------------------------------------------
/Assets/Editor/DataExporter/interface/IExcelWriter.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public interface IExcelWriter
6 | {
7 | void Write(string fullPath, ExcelData data);
8 | }
9 |
--------------------------------------------------------------------------------
/Assets/Editor/Lib/EPP/EPPlus.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Editor/Lib/EPP/EPPlus.dll
--------------------------------------------------------------------------------
/Assets/Editor/Lib/EPPlus 4.1.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Editor/Lib/EPPlus 4.1.chm
--------------------------------------------------------------------------------
/Assets/Editor/Lib/NPOI/EPPlus.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Editor/Lib/NPOI/EPPlus.dll
--------------------------------------------------------------------------------
/Assets/Editor/Lib/NPOI/ICSharpCode.SharpZipLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Editor/Lib/NPOI/ICSharpCode.SharpZipLib.dll
--------------------------------------------------------------------------------
/Assets/Editor/Lib/NPOI/NPOI.OOXML.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Editor/Lib/NPOI/NPOI.OOXML.dll
--------------------------------------------------------------------------------
/Assets/Editor/Lib/NPOI/NPOI.OpenXml4Net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Editor/Lib/NPOI/NPOI.OpenXml4Net.dll
--------------------------------------------------------------------------------
/Assets/Editor/Lib/NPOI/NPOI.OpenXmlFormats.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Editor/Lib/NPOI/NPOI.OpenXmlFormats.dll
--------------------------------------------------------------------------------
/Assets/Editor/Lib/NPOI/NPOI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Editor/Lib/NPOI/NPOI.dll
--------------------------------------------------------------------------------
/Assets/JsonNet-Lite.9.0.1.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/JsonNet-Lite.9.0.1.unitypackage
--------------------------------------------------------------------------------
/Assets/JsonNet.9.0.1.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/JsonNet.9.0.1.unitypackage
--------------------------------------------------------------------------------
/Assets/Resources/Test.bytes:
--------------------------------------------------------------------------------
1 | 1 12341 {1,2,3} 123,"ba"sd",dfs 7
2 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/CfgScriptableObjectContainer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | namespace Config.ScriptableConfig
6 | {
7 | public class CfgScriptableObjectContainer : ScriptableObject, ISerializationCallbackReceiver
8 | {
9 | public List dataList = new List();
10 | public Dictionary dataMap = new Dictionary();
11 | public string typeName;
12 |
13 | public void OnBeforeSerialize()
14 | {
15 |
16 | }
17 |
18 | public void OnAfterDeserialize()
19 | {
20 | CopyListToDic();
21 | }
22 |
23 | void CopyListToDic()
24 | {
25 | //编译完成后会调用该方法
26 | if (dataList.Count == 0 || dataList[0].ID == 0)
27 | return;
28 | for(int i = 0; i < dataList.Count; i++)
29 | {
30 | if(dataMap.ContainsKey(dataList[i].ID))
31 | {
32 | Debug.LogError("重复Id : " + dataList[i].ID + " 类型:" + typeName);
33 | }
34 | else
35 | {
36 | dataMap.Add(dataList[i].ID, dataList[i]);
37 | }
38 | }
39 | }
40 |
41 | public T Get(int id) where T : ConfigSoBase
42 | {
43 | ConfigSoBase value = null;
44 | dataMap.TryGetValue(id, out value);
45 | return (T)value;
46 | }
47 |
48 | }
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigBinaryBase.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | [System.Serializable]
6 | public class ConfigBinaryBase
7 | {
8 | public int ID;
9 | }
10 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigBinaryContainer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | [System.Serializable]
6 | public class ConfigBinaryContainer
7 | {
8 | public Dictionary dataMap = new Dictionary();
9 | public string typeName;
10 | }
11 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigBinaryManager.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.Runtime.Serialization.Formatters.Binary;
4 | using UnityEngine;
5 | using System.IO;
6 |
7 | public class ConfigBinaryManager
8 | {
9 | static ConfigBinaryManager _instance;
10 | public static ConfigBinaryManager Instance
11 | {
12 | get
13 | {
14 | if (_instance == null)
15 | _instance = new ConfigBinaryManager();
16 | return _instance;
17 | }
18 | }
19 | Dictionary> _map = new Dictionary>();
20 |
21 | public void Init()
22 | {
23 | _map.Clear();
24 | BinaryFormatter formatter = new BinaryFormatter();
25 | var files = Directory.GetFiles(Application.dataPath + "/Resources/DataB/", "*.bytes");
26 | for(int i = 0; i < files.Length; i++)
27 | {
28 | FileStream fs = new FileStream(files[i], FileMode.Open, FileAccess.Read, FileShare.Read);
29 | var container = formatter.Deserialize(fs) as ConfigBinaryContainer;
30 | _map.Add(container.typeName, container.dataMap);
31 | fs.Close();
32 | }
33 | }
34 |
35 |
36 | public T GetConfig(string configName, int id) where T : ConfigBinaryBase
37 | {
38 | if (!_map.ContainsKey(configName))
39 | return null;
40 | if (!_map[configName].ContainsKey(id))
41 | return null;
42 | return (T)_map[configName][id];
43 | }
44 |
45 | public T GetConfig(int id) where T : ConfigBinaryBase
46 | {
47 | string configName = typeof(T).Name;
48 | return GetConfig(configName, id);
49 | }
50 |
51 | public Dictionary GetConfigs(string configName)
52 | {
53 | if (_map.ContainsKey(configName))
54 | return _map[configName];
55 |
56 | return null;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigFactory.cs:
--------------------------------------------------------------------------------
1 | namespace Config.TextConfig
2 | {
3 | public class ConfigFactory
4 | {
5 | public static ConfigTextBase Get(string configName)
6 | {
7 | switch(configName)
8 | {
9 | case "Test":
10 | return new CfgTest();
11 | }
12 | return null;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigJsonBase.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | [System.Serializable]
6 | public class ConfigJsonBase
7 | {
8 | public int ID;
9 | }
10 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigJsonContainer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using System;
5 | using Newtonsoft.Json;
6 |
7 | [Serializable]
8 | public class ConfigJsonContainer
9 | {
10 | public List dataList = new List();
11 | public Dictionary dataMap = new Dictionary();
12 | public string typeName;
13 | [JsonConverter(typeof(Vector3Converter))]
14 | public Vector3 test = Vector3.zero;
15 |
16 | public void CopyListToDic()
17 | {
18 | for (int i = 0; i < dataList.Count; i++)
19 | {
20 | if (dataMap.ContainsKey(dataList[i].ID))
21 | {
22 | Debug.LogError("重复Id : " + dataList[i].ID + " 类型:" + typeName);
23 | }
24 | else
25 | {
26 | dataMap.Add(dataList[i].ID, dataList[i]);
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigJsonManager.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using Newtonsoft.Json;
4 | using UnityEngine;
5 |
6 | public class ConfigJsonManager
7 | {
8 | static ConfigJsonManager _instance;
9 | public static ConfigJsonManager Instance
10 | {
11 | get
12 | {
13 | if (_instance == null)
14 | _instance = new ConfigJsonManager();
15 | return _instance;
16 | }
17 | }
18 | Dictionary> _map = new Dictionary>();
19 |
20 | public void Init()
21 | {
22 | _map.Clear();
23 | JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Objects };
24 | var datas = Resources.LoadAll("DataJ");
25 | for (int i = 0; i < datas.Length; i++)
26 | {
27 | var data = JsonConvert.DeserializeObject(datas[i].text, settings);
28 | _map.Add(data.typeName, data.dataMap);
29 | }
30 | }
31 |
32 |
33 | public T GetConfig(string configName, int id) where T : ConfigJsonBase
34 | {
35 | if (!_map.ContainsKey(configName))
36 | return null;
37 | if (!_map[configName].ContainsKey(id))
38 | return null;
39 | return (T)_map[configName][id];
40 | }
41 |
42 | public T GetConfig(int id) where T : ConfigJsonBase
43 | {
44 | string configName = typeof(T).Name;
45 | return GetConfig(configName, id);
46 | }
47 |
48 | public Dictionary GetConfigs(string configName)
49 | {
50 | if (_map.ContainsKey(configName))
51 | return _map[configName];
52 |
53 | return null;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigSOManager.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using Config.ScriptableConfig;
4 | using UnityEngine;
5 |
6 | public class ConfigSOManager
7 | {
8 | static ConfigSOManager _instance;
9 | public static ConfigSOManager Instance
10 | {
11 | get
12 | {
13 | if (_instance == null)
14 | _instance = new ConfigSOManager();
15 | return _instance;
16 | }
17 | }
18 | Dictionary> _map = new Dictionary>();
19 | public void Init()
20 | {
21 | _map.Clear();
22 | var datas = Resources.LoadAll("DataS");
23 | for(int i = 0; i < datas.Length; i++)
24 | {
25 | //datas[i].CopyListToDic();
26 | _map.Add(datas[i].typeName, datas[i].dataMap);
27 | Resources.UnloadAsset(datas[i]);
28 | }
29 | }
30 |
31 |
32 | public T GetConfig(string configName, int id) where T : ConfigSoBase
33 | {
34 | if (!_map.ContainsKey(configName))
35 | return null;
36 | if (!_map[configName].ContainsKey(id))
37 | return null;
38 | return (T)_map[configName][id];
39 | }
40 |
41 | public T GetConfig(int id) where T : ConfigSoBase
42 | {
43 | string configName = typeof(T).Name;
44 | return GetConfig(configName, id);
45 | }
46 |
47 | public Dictionary GetConfigs(string configName)
48 | {
49 | if (_map.ContainsKey(configName))
50 | return _map[configName];
51 |
52 | return null;
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigSoBase.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class ConfigSoBase : ScriptableObject
6 | {
7 | public int ID;
8 | }
9 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigTextBase.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | [System.Serializable]
6 | public class ConfigTextBase : IConfigBase
7 | {
8 | public int ID;
9 |
10 |
11 | protected int ParseInt(string value)
12 | {
13 | int res;
14 | if(!StringUtil.TryParseInt(value, out res))
15 | {
16 | Debug.LogError(string.Format("{0} 解析int 出错 value = {1}", this.GetType(), value));
17 | }
18 | return res;
19 | }
20 | protected float ParseFloat(string value)
21 | {
22 | float res;
23 | if (!StringUtil.TryParseFloat(value, out res))
24 | {
25 | Debug.LogError(string.Format("{0} 解析float 出错 value = {1}", this.GetType(), value));
26 | }
27 | return res;
28 | }
29 |
30 | protected string ParseDes(string value)
31 | {
32 | string des;
33 | StringUtil.TryParseDes(value, out des);
34 | return des;
35 | }
36 |
37 | protected List ParseListInt(string value)
38 | {
39 | List res;
40 | if(!StringUtil.TryParseListInt(value, out res))
41 | {
42 | Debug.LogError(string.Format("{0} 解析List 出错 value = {1}", this.GetType(), value));
43 | }
44 | return res;
45 | }
46 |
47 | protected List ParseListFloat(string value)
48 | {
49 | List res;
50 | if (!StringUtil.TryParseListFloat(value, out res))
51 | {
52 | Debug.LogError(string.Format("{0} 解析List 出错 value = {1}", this.GetType(), value));
53 | }
54 | return res;
55 | }
56 |
57 | protected List ParseListString(string value)
58 | {
59 | List res;
60 | if (!StringUtil.TryParseListString(value, out res))
61 | {
62 | Debug.LogError(string.Format("{0} 解析List 出错 value = {1}", this.GetType(), value));
63 | }
64 | return res;
65 | }
66 |
67 | protected Dictionary ParseDicIntInt(string value)
68 | {
69 | Dictionary res;
70 | if (!StringUtil.TryParseDicIntInt(value, out res))
71 | {
72 | Debug.LogError(string.Format("{0} 解析DicIntInt 出错 value = {1}", this.GetType(), value));
73 | }
74 | return res;
75 | }
76 |
77 | protected Dictionary ParseDicIntString(string value)
78 | {
79 | Dictionary res;
80 | if (!StringUtil.TryParseDicIntString(value, out res))
81 | {
82 | Debug.LogError(string.Format("{0} 解析DicIntString 出错 value = {1}", this.GetType(), value));
83 | }
84 | return res;
85 | }
86 |
87 | protected Vector3 ParseVector3(string value)
88 | {
89 | Vector3 res;
90 | if(!StringUtil.TryParseVector3(value, out res))
91 | {
92 | Debug.LogError(string.Format("{0} 解析Vector3 出错 value = {1}", this.GetType(), value));
93 | }
94 | return res;
95 | }
96 |
97 | protected Vector2 ParseVector2(string value)
98 | {
99 | Vector2 res;
100 | if (!StringUtil.TryParseVector2(value, out res))
101 | {
102 | Debug.LogError(string.Format("{0} 解析Vector2 出错 value = {1}", this.GetType(), value));
103 | }
104 | return res;
105 | }
106 |
107 |
108 | protected string ParseString(string value)
109 | {
110 | return value;
111 | }
112 |
113 | protected List> ParseListListString(string value)
114 | {
115 | List> res;
116 | StringUtil.TryParseListListString(value, out res);
117 | return res;
118 | }
119 |
120 | public virtual void Write(int i, string value)
121 | {
122 | Debug.LogError(GetType().Name + "未找到第 + " + i + "个字段");
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/ConfigTextManager.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using System;
4 | using Config.TextConfig;
5 |
6 | public class ConfigTextManager
7 | {
8 | protected static ConfigTextManager _instance;
9 | public static ConfigTextManager Instance
10 | {
11 | get
12 | {
13 | if (_instance == null)
14 | _instance = new ConfigTextManager();
15 | return _instance;
16 | }
17 | }
18 | protected Dictionary> _map = new Dictionary>();
19 |
20 | public T GetConfig(string configName, int id) where T : ConfigTextBase
21 | {
22 | if (!_map.ContainsKey(configName))
23 | return null;
24 | if (!_map[configName].ContainsKey(id))
25 | return null;
26 | return (T)_map[configName][id];
27 | }
28 |
29 | public T GetConfig(int id) where T : ConfigTextBase
30 | {
31 | string configName = typeof(T).Name;
32 | return GetConfig(configName, id);
33 | }
34 |
35 | public Dictionary GetConfigs(string configName)
36 | {
37 | if (_map.ContainsKey(configName))
38 | return _map[configName];
39 |
40 | return null;
41 | }
42 |
43 |
44 | public void Init()
45 | {
46 | _map.Clear();
47 | var datas = Resources.LoadAll("DataT");
48 | for(int i = 0; i < datas.Length; i++)
49 | {
50 | string configName = datas[i].name;
51 | string content = ( datas[i] as UnityEngine.TextAsset ).text;
52 | DecodeConfigFile(configName, content);
53 | }
54 | }
55 |
56 | void DecodeConfigFile(string configName, string content)
57 | {
58 | var config = ConfigFactory.Get(configName);
59 | if (config == null)
60 | return;
61 | string className = config.GetType().Name;
62 | Dictionary configMap = new Dictionary();
63 | string[] lines = content.Replace("\r", "").Split('\n');
64 | for (int i = 0; i < lines.Length; i++)
65 | {
66 | var strs = lines[i].Split('\t');
67 | if (strs.Length == 0 || strs[0] == string.Empty)
68 | continue;
69 | config = ConfigFactory.Get(configName);
70 | //字符串末尾多加一个\t导致数组长度多了1
71 | for (int j = 0; j < strs.Length; j++)
72 | {
73 | config.Write(j, strs[j]);
74 | }
75 | if (!configMap.ContainsKey(config.ID))
76 | configMap.Add(config.ID, config);
77 | else
78 | {
79 | Debug.LogError("ID 重复 " + className);
80 | }
81 | }
82 | _map.Add(className, configMap);
83 | }
84 |
85 | }
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/IConfigBase.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public interface IConfigBase
6 | {
7 | //int GetID();
8 | }
9 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/IConfigManager.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public interface IConfigManager
6 | {
7 | T GetConfig(string configName, int id) where T : IConfigBase;
8 | T GetConfig(int id) where T : IConfigBase;
9 | Dictionary GetConfigs(string configName);
10 | void Init();
11 | }
12 |
--------------------------------------------------------------------------------
/Assets/Script/Data/Base/SingleTon.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | public class SingleTon where T : new()
4 | {
5 | private static T _instance = (default(T) == null)? Activator.CreateInstance():default(T);
6 | public static T Instance { get {return _instance;}}
7 |
8 | protected SingleTon()
9 | {}
10 | }
--------------------------------------------------------------------------------
/Assets/Script/Data/CfgEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | namespace Config.TextConfig
6 | {
7 | public class CfgEffect : ConfigTextBase
8 | {
9 | public string url;
10 | public Vector3 posOffset;
11 | public Vector3 eulerOffset;
12 | public string bonePath;
13 |
14 |
15 | public override void Write(int i, string value)
16 | {
17 | switch (i)
18 | {
19 | case 0:
20 | ID = ParseInt(value);
21 | break;
22 | case 1:
23 | url = ParseString(value);
24 | break;
25 | case 2:
26 | posOffset = ParseVector3(value);
27 | break;
28 | case 3:
29 | eulerOffset = ParseVector3(value);
30 | break;
31 | case 4:
32 | bonePath = ParseString(value);
33 | break;
34 | default:
35 | UnityEngine.Debug.LogError(GetType().Name + "src i:" + i);
36 | break;
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Assets/Script/Data/CfgSkill.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | namespace Config.TextConfig
6 | {
7 | public class CfgSkill : ConfigTextBase
8 | {
9 | public string skillName;
10 | public string iconUrl;
11 | public float skillCd;
12 | public float lifeTime;
13 | public int faceTarget;
14 | public List> subSkillList;
15 |
16 |
17 | public override void Write(int i, string value)
18 | {
19 | switch (i)
20 | {
21 | case 0:
22 | ID = ParseInt(value);
23 | break;
24 | case 1:
25 | skillName = ParseString(value);
26 | break;
27 | case 2:
28 | iconUrl = ParseString(value);
29 | break;
30 | case 3:
31 | skillCd = ParseFloat(value);
32 | break;
33 | case 4:
34 | lifeTime = ParseFloat(value);
35 | break;
36 | case 5:
37 | faceTarget = ParseInt(value);
38 | break;
39 | case 6:
40 | subSkillList = ParseListListString(value);
41 | break;
42 | default:
43 | UnityEngine.Debug.LogError(GetType().Name + "src i:" + i);
44 | break;
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Assets/Script/Data/CfgSubSkill.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | namespace Config.TextConfig
6 | {
7 | public class CfgSubSkill : ConfigTextBase
8 | {
9 | public List> skillActionList;
10 |
11 |
12 | public override void Write(int i, string value)
13 | {
14 | switch (i)
15 | {
16 | case 0:
17 | ID = ParseInt(value);
18 | break;
19 | case 1:
20 | skillActionList = ParseListListString(value);
21 | break;
22 | default:
23 | UnityEngine.Debug.LogError(GetType().Name + "src i:" + i);
24 | break;
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Assets/Script/Data/CfgTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | namespace Config.TextConfig
6 | {
7 | public class CfgTest : ConfigTextBase
8 | {
9 | public string B;
10 | public List C;
11 | public List E;
12 | public float e;
13 |
14 |
15 | public override void Write(int i, string value)
16 | {
17 | switch (i)
18 | {
19 | case 0:
20 | ID = ParseInt(value);
21 | break;
22 | case 1:
23 | B = ParseString(value);
24 | break;
25 | case 2:
26 | C = ParseListInt(value);
27 | break;
28 | case 3:
29 | E = ParseListString(value);
30 | break;
31 | case 4:
32 | e = ParseFloat(value);
33 | break;
34 | default:
35 | UnityEngine.Debug.LogError(GetType().Name + "src i:" + i);
36 | break;
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Assets/Script/Main.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 | using UnityEngine.Profiling;
6 | using System;
7 | using Newtonsoft.Json;
8 |
9 | public class Main : MonoBehaviour
10 | {
11 | // Use this for initialization
12 | void Start()
13 | {
14 | //ConfigBinaryManager.Instance.Init();
15 | ////var obj = JsonConvert.DeserializeObject(text, settings);
16 | ////var obj2 = obj.dataList[0] as CfgTest;
17 | ////Debug.LogError(obj.dataList.Count);
18 | //var time = Time.realtimeSinceStartup;
19 | //for (int i = 0; i < 1000; i++)
20 | //{
21 | // ConfigSOManager.Instance.Init();
22 | //}
23 | //Debug.LogError(Time.realtimeSinceStartup - time);
24 | //time = Time.realtimeSinceStartup;
25 | //for (int i = 0; i < 1000; i++)
26 | //{
27 | // ConfigTextManager.Instance.Init();
28 | //}
29 | //Debug.LogError(Time.realtimeSinceStartup - time);
30 | //time = Time.realtimeSinceStartup;
31 | //for (int i = 0; i < 1000; i++)
32 | //{
33 | // ConfigBinaryManager.Instance.Init();
34 | //}
35 | //Debug.LogError(Time.realtimeSinceStartup - time);
36 | //time = Time.realtimeSinceStartup;
37 | //for (int i = 0; i < 1000; i++)
38 | //{
39 | // ConfigJsonManager.Instance.Init();
40 | //}
41 | //Debug.LogError(Time.realtimeSinceStartup - time);
42 | }
43 |
44 | // Update is called once per frame
45 | void Update () {
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Assets/Script/Util/JsonConverter/Vector3Converter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Linq;
6 | using UnityEngine;
7 |
8 | public class Vector3Converter : JsonConverter
9 | {
10 | public override bool CanConvert(Type objectType)
11 | {
12 | return objectType == typeof(Vector3);
13 | }
14 |
15 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
16 | {
17 | var obj = JToken.Load(reader);
18 | if(obj.Type == JTokenType.Array)
19 | {
20 | var arr = (JArray)obj;
21 | if (arr.Count == 4 && arr[0].Type == JTokenType.Float && arr[1].Type == JTokenType.Float
22 | && arr[2].Type == JTokenType.Float )
23 | {
24 | return new Vector3(arr[0].Value(), arr[1].Value(), arr[2].Value());
25 | }
26 | }
27 |
28 | return null;
29 | }
30 |
31 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
32 | {
33 | var vector = (Vector3)value;
34 | writer.WriteStartArray();
35 | writer.WriteValue(vector.x);
36 | writer.WriteValue(vector.y);
37 | writer.WriteValue(vector.z);
38 | writer.WriteEndArray();
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/Assets/Script/Util/StringUtil.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using System;
5 | using System.Text;
6 |
7 | public class StringUtil
8 | {
9 | const char VectorStart = '(';
10 | const char VectorEnd = ')';
11 | const char CollectionsStart = '{';
12 | const char CollectionsEnd = '}';
13 |
14 | static string RemoveCollectionsChars(string str)
15 | {
16 | //暂时不关心开头和结尾大括号的个数
17 | str = str.TrimStart(CollectionsStart);
18 | str = str.TrimEnd(CollectionsEnd);
19 | return str;
20 | }
21 |
22 | static string RemoveVectorChars(string str)
23 | {
24 | str = str.TrimStart(VectorStart);
25 | str = str.TrimEnd(VectorEnd);
26 | return str;
27 | }
28 |
29 | static List SplitString(string str)
30 | {
31 | List list = new List();
32 | Stack stack = new Stack();
33 | StringBuilder sb = new StringBuilder();
34 | for(int i = 0; i < str.Length; i++)
35 | {
36 | if(str[i] == VectorStart)
37 | {
38 | stack.Push(str[i]);
39 | sb.Append(str[i]);
40 | }
41 | else if (str[i] == VectorEnd)
42 | {
43 | stack.Pop();
44 | sb.Append(str[i]);
45 | }
46 | else if(stack.Count == 0 && str[i] == ',' )
47 | {
48 | list.Add(sb.ToString());
49 | ClearStringBuilder(sb);
50 | }
51 | else
52 | {
53 | sb.Append(str[i]);
54 | }
55 | }
56 | if(sb.Length > 0)
57 | {
58 | list.Add(sb.ToString());
59 | }
60 | return list;
61 | }
62 |
63 | static void ClearStringBuilder(StringBuilder sb)
64 | {
65 | sb.Length = 0;
66 | sb.Capacity = 0;
67 | }
68 |
69 | public static bool TryParseInt(string str, out int value)
70 | {
71 | value = 0;
72 | if (string.IsNullOrEmpty(str))
73 | return true;
74 | if (int.TryParse(str, out value))
75 | return true;
76 | return false;
77 | }
78 |
79 | public static bool TryParseFloat(string str, out float value)
80 | {
81 | value = 0;
82 | if (string.IsNullOrEmpty(str))
83 | return true;
84 | if (float.TryParse(str, out value))
85 | return true;
86 | return false;
87 | }
88 |
89 | public static bool TryParseDes(string str, out string value)
90 | {
91 | value = str.Replace("|", "\n");
92 | return true;
93 | }
94 |
95 | //{1,2,3,4}
96 | public static bool TryParseListInt(string str, out List valueList)
97 | {
98 | valueList = new List();
99 | if (string.IsNullOrEmpty(str))
100 | return true;
101 | str = RemoveCollectionsChars(str);
102 | List values = SplitString(str);
103 | //string[] values = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
104 | bool success = true;
105 | for (int i = 0; i < values.Count; i++)
106 | {
107 | int value;
108 | if (!TryParseInt(values[i], out value))
109 | success = false;
110 | valueList.Add(value);
111 | }
112 | return success;
113 | }
114 |
115 | public static bool TryParseListFloat(string str, out List valueList)
116 | {
117 | valueList = new List();
118 | if (string.IsNullOrEmpty(str))
119 | return true;
120 | str = RemoveCollectionsChars(str);
121 | //string[] values = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
122 | List values = SplitString(str);
123 | bool success = true;
124 | for (int i = 0; i < values.Count; i++)
125 | {
126 | float value;
127 | if (!TryParseFloat(values[i], out value))
128 | success = false;
129 | valueList.Add(value);
130 | }
131 | return success;
132 | }
133 |
134 | public static bool TryParseListString(string str, out List valueList)
135 | {
136 | valueList = new List();
137 | if (string.IsNullOrEmpty(str))
138 | return true;
139 | str = RemoveCollectionsChars(str);
140 | //string[] values = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
141 | List values = SplitString(str);
142 | bool success = true;
143 | for (int i = 0; i < values.Count; i++)
144 | {
145 | valueList.Add(values[i]);
146 | }
147 | return success;
148 | }
149 | //{1,2}, {2,3}
150 | public static bool TryParseDicIntInt(string str, out Dictionary valueDic)
151 | {
152 | valueDic = new Dictionary();
153 | if (string.IsNullOrEmpty(str))
154 | return true;
155 | str = RemoveCollectionsChars(str);
156 |
157 | string[] values = str.Split(new string[] { "},{" }, StringSplitOptions.RemoveEmptyEntries);
158 |
159 | bool success = true;
160 | for(int i = 0; i < values.Length; i++)
161 | {
162 | List nums = SplitString(values[i]);
163 | if (nums.Count != 2)
164 | {
165 | success = false;
166 | continue;
167 | }
168 | int key, value;
169 | if (!TryParseInt(nums[0], out key) )
170 | {
171 | success = false;
172 | }
173 | if(!TryParseInt(nums[1], out value))
174 | {
175 | success = false;
176 | }
177 | valueDic.Add(key, value);
178 | }
179 | return success;
180 | }
181 |
182 | //(key, value),(key, value)
183 | public static bool TryParseDicIntString(string str, out Dictionary valueDic)
184 | {
185 | valueDic = new Dictionary();
186 | if (string.IsNullOrEmpty(str))
187 | return true;
188 | str = RemoveCollectionsChars(str);
189 |
190 | string[] values = str.Split(new string[] { "},{" }, StringSplitOptions.RemoveEmptyEntries);
191 |
192 | bool success = true;
193 | for (int i = 0; i < values.Length; i++)
194 | {
195 | List nums = SplitString(values[i]);
196 | if (nums.Count != 2)
197 | {
198 | success = false;
199 | continue;
200 | }
201 | int key;
202 | if (!TryParseInt(nums[0], out key))
203 | {
204 | success = false;
205 | }
206 | valueDic.Add(key, nums[1]);
207 | }
208 | return success;
209 | }
210 |
211 | public static bool TryParseVector3(string str, out Vector3 vec)
212 | {
213 | vec = Vector3.zero;
214 | if (string.IsNullOrEmpty(str))
215 | return true;
216 | str = RemoveVectorChars(str);
217 | string[] values = str.Split(',');
218 | bool success = true;
219 | if (values.Length != 3)
220 | return false;
221 |
222 | float x, y, z;
223 | if (!TryParseFloat(values[0], out x))
224 | success = false;
225 | if (!TryParseFloat(values[1], out y))
226 | success = false;
227 | if (!TryParseFloat(values[2], out z))
228 | success = false;
229 | vec = new Vector3(x, y, z);
230 | return success;
231 | }
232 |
233 | public static bool TryParseVector2(string str, out Vector2 vec)
234 | {
235 | vec = Vector2.zero;
236 | if (string.IsNullOrEmpty(str))
237 | return true;
238 | str = RemoveVectorChars(str);
239 | string[] values = str.Split(',');
240 | bool success = true;
241 | if (values.Length != 2)
242 | return false;
243 |
244 | float x, y;
245 | if (!TryParseFloat(values[0], out x))
246 | success = false;
247 | if (!TryParseFloat(values[1], out y))
248 | success = false;
249 | vec = new Vector3(x, y);
250 | return success;
251 | }
252 |
253 | //(1,2,3,4),(1,2,3,4)
254 | public static bool TryParseListListString(string str, out List> value)
255 | {
256 | value = new List>();
257 | if (string.IsNullOrEmpty(str))
258 | return true;
259 | str = RemoveCollectionsChars(str);
260 | string[] listStr = str.Split(new string[] { "},{" }, StringSplitOptions.RemoveEmptyEntries);
261 | for (int i = 0; i < listStr.Length; i++)
262 | {
263 | List values = SplitString(listStr[i]);
264 | value.Add(values);
265 | }
266 | return true;
267 | }
268 |
269 | }
270 |
--------------------------------------------------------------------------------
/Assets/Test.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Test.xlsx
--------------------------------------------------------------------------------
/Assets/Test1.xls:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/Test1.xls
--------------------------------------------------------------------------------
/Assets/UnityPackages/JsonNet.unitypackage.json:
--------------------------------------------------------------------------------
1 | {
2 | "Id": "JsonNet",
3 | "Version": "9.0.1",
4 | "Authors": [
5 | "James Newton-King"
6 | ],
7 | "Owners": [
8 | "Esun Kim"
9 | ],
10 | "Description": "Unity3D port of Json.NET which is a popular high-performance JSON framework for .NET",
11 | "Files": [
12 | "Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll",
13 | "Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.mdb",
14 | {
15 | "Target": "Assets/UnityPackages/JsonNetSample/JsonNetSample.cs",
16 | "Extra": true
17 | },
18 | {
19 | "Target": "Assets/UnityPackages/JsonNetSample/JsonNetSample.unity",
20 | "Extra": true
21 | }
22 | ]
23 | }
--------------------------------------------------------------------------------
/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.mdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll.mdb
--------------------------------------------------------------------------------
/Assets/UnityPackages/JsonNetSample/JsonNetSample.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using UnityEngine.UI;
4 | using System.Collections.Generic;
5 | using Newtonsoft.Json;
6 | using Newtonsoft.Json.Linq;
7 |
8 | public class JsonNetSample : MonoBehaviour
9 | {
10 | public Text Output;
11 |
12 | void Start()
13 | {
14 | Output.text = "Start!\n\n";
15 |
16 | TestJson();
17 | SerailizeJson();
18 | DeserializeJson();
19 | LinqToJson();
20 | JsonPath();
21 |
22 | WriteLine("\nDone!");
23 | }
24 |
25 | void WriteLine(string msg)
26 | {
27 | Output.text = Output.text + msg + "\n";
28 | }
29 |
30 | public class Product
31 | {
32 | public string Name;
33 | public DateTime ExpiryDate = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
34 | public decimal Price;
35 | public string[] Sizes;
36 |
37 | public override bool Equals(object obj)
38 | {
39 | if (obj is Product)
40 | {
41 | Product p = (Product)obj;
42 |
43 | return (p.Name == Name && p.ExpiryDate == ExpiryDate && p.Price == Price);
44 | }
45 |
46 | return base.Equals(obj);
47 | }
48 |
49 | public override int GetHashCode()
50 | {
51 | return (Name ?? string.Empty).GetHashCode();
52 | }
53 | }
54 |
55 | [System.Serializable]
56 | public class CharacterListItem
57 | {
58 | public int Id { get; set; }
59 | public string Name { get; set; }
60 | public int Level { get; set; }
61 | public string Class { get; set; }
62 | public string Sex { get; set; }
63 | }
64 |
65 | void TestJson()
66 | {
67 | WriteLine("* TestJson");
68 | var json = "{\"Id\":51, \"Name\":\"padre\", \"Level\":0, \"Class\":\"Vampire\", \"Sex\":\"F\"}";
69 | var c = JsonConvert.DeserializeObject(json);
70 | WriteLine(c.Id + " " + c.Name);
71 | }
72 |
73 | void SerailizeJson()
74 | {
75 | WriteLine("* SerailizeJson");
76 |
77 | Product product = new Product();
78 | product.Name = "Apple";
79 | product.ExpiryDate = new DateTime(2008, 12, 28);
80 | product.Sizes = new string[] { "Small" };
81 |
82 | string json = JsonConvert.SerializeObject(product);
83 | WriteLine(json);
84 | }
85 |
86 | public class Movie
87 | {
88 | public string Name { get; set; }
89 | public string Description { get; set; }
90 | public string Classification { get; set; }
91 | public string Studio { get; set; }
92 | public DateTime? ReleaseDate { get; set; }
93 | public List ReleaseCountries { get; set; }
94 | }
95 |
96 | void DeserializeJson()
97 | {
98 | WriteLine("* DeserializeJson");
99 |
100 | string json = @"{
101 | 'Name': 'Bad Boys',
102 | 'ReleaseDate': '1995-4-7T00:00:00',
103 | 'Genres': [
104 | 'Action',
105 | 'Comedy'
106 | ]
107 | }";
108 |
109 | Movie m = JsonConvert.DeserializeObject(json);
110 |
111 | string name = m.Name;
112 | WriteLine(name);
113 | }
114 |
115 | void LinqToJson()
116 | {
117 | WriteLine("* LinqToJson");
118 |
119 | JArray array = new JArray();
120 | array.Add("Manual text");
121 | array.Add(new DateTime(2000, 5, 23));
122 |
123 | JObject o = new JObject();
124 | o["MyArray"] = array;
125 |
126 | string json = o.ToString();
127 | WriteLine(json);
128 | }
129 |
130 | private void JsonPath()
131 | {
132 | WriteLine("* JsonPath");
133 |
134 | var o = JObject.Parse(@"{
135 | 'Stores': [
136 | 'Lambton Quay',
137 | 'Willis Street'
138 | ],
139 | 'Manufacturers': [
140 | {
141 | 'Name': 'Acme Co',
142 | 'Products': [
143 | {
144 | 'Name': 'Anvil',
145 | 'Price': 50
146 | }
147 | ]
148 | },
149 | {
150 | 'Name': 'Contoso',
151 | 'Products': [
152 | {
153 | 'Name': 'Elbow Grease',
154 | 'Price': 99.95
155 | },
156 | {
157 | 'Name': 'Headlight Fluid',
158 | 'Price': 4
159 | }
160 | ]
161 | }
162 | ]
163 | }");
164 |
165 | JToken acme = o.SelectToken("$.Manufacturers[?(@.Name == 'Acme Co')]");
166 | WriteLine(acme.ToString());
167 |
168 | IEnumerable pricyProducts = o.SelectTokens("$..Products[?(@.Price >= 50)].Name");
169 | foreach (var item in pricyProducts)
170 | {
171 | WriteLine(item.ToString());
172 | }
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/Assets/UnityPackages/JsonNetSample/JsonNetSample.unity:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!29 &1
4 | SceneSettings:
5 | m_ObjectHideFlags: 0
6 | m_PVSData:
7 | m_PVSObjectsArray: []
8 | m_PVSPortalsArray: []
9 | m_OcclusionBakeSettings:
10 | smallestOccluder: 5
11 | smallestHole: 0.25
12 | backfaceThreshold: 100
13 | --- !u!104 &2
14 | RenderSettings:
15 | m_ObjectHideFlags: 0
16 | serializedVersion: 6
17 | m_Fog: 0
18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19 | m_FogMode: 3
20 | m_FogDensity: 0.01
21 | m_LinearFogStart: 0
22 | m_LinearFogEnd: 300
23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26 | m_AmbientIntensity: 1
27 | m_AmbientMode: 3
28 | m_SkyboxMaterial: {fileID: 0}
29 | m_HaloStrength: 0.5
30 | m_FlareStrength: 1
31 | m_FlareFadeSpeed: 3
32 | m_HaloTexture: {fileID: 0}
33 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
34 | m_DefaultReflectionMode: 0
35 | m_DefaultReflectionResolution: 128
36 | m_ReflectionBounces: 1
37 | m_ReflectionIntensity: 1
38 | m_CustomReflection: {fileID: 0}
39 | m_Sun: {fileID: 0}
40 | --- !u!157 &3
41 | LightmapSettings:
42 | m_ObjectHideFlags: 0
43 | serializedVersion: 6
44 | m_GIWorkflowMode: 1
45 | m_LightmapsMode: 1
46 | m_GISettings:
47 | serializedVersion: 2
48 | m_BounceScale: 1
49 | m_IndirectOutputScale: 1
50 | m_AlbedoBoost: 1
51 | m_TemporalCoherenceThreshold: 1
52 | m_EnvironmentLightingMode: 0
53 | m_EnableBakedLightmaps: 0
54 | m_EnableRealtimeLightmaps: 0
55 | m_LightmapEditorSettings:
56 | serializedVersion: 3
57 | m_Resolution: 2
58 | m_BakeResolution: 40
59 | m_TextureWidth: 1024
60 | m_TextureHeight: 1024
61 | m_AOMaxDistance: 1
62 | m_Padding: 2
63 | m_CompAOExponent: 0
64 | m_LightmapParameters: {fileID: 0}
65 | m_TextureCompression: 1
66 | m_FinalGather: 0
67 | m_FinalGatherRayCount: 1024
68 | m_ReflectionCompression: 2
69 | m_LightingDataAsset: {fileID: 0}
70 | m_RuntimeCPUUsage: 25
71 | --- !u!196 &4
72 | NavMeshSettings:
73 | serializedVersion: 2
74 | m_ObjectHideFlags: 0
75 | m_BuildSettings:
76 | serializedVersion: 2
77 | agentRadius: 0.5
78 | agentHeight: 2
79 | agentSlope: 45
80 | agentClimb: 0.4
81 | ledgeDropHeight: 0
82 | maxJumpAcrossDistance: 0
83 | accuratePlacement: 0
84 | minRegionArea: 2
85 | cellSize: 0.16666667
86 | manualCellSize: 0
87 | m_NavMeshData: {fileID: 0}
88 | --- !u!1 &17972762
89 | GameObject:
90 | m_ObjectHideFlags: 0
91 | m_PrefabParentObject: {fileID: 0}
92 | m_PrefabInternal: {fileID: 0}
93 | serializedVersion: 4
94 | m_Component:
95 | - 4: {fileID: 17972763}
96 | - 114: {fileID: 17972764}
97 | m_Layer: 0
98 | m_Name: _SceneObject
99 | m_TagString: Untagged
100 | m_Icon: {fileID: 0}
101 | m_NavMeshLayer: 0
102 | m_StaticEditorFlags: 0
103 | m_IsActive: 1
104 | --- !u!4 &17972763
105 | Transform:
106 | m_ObjectHideFlags: 0
107 | m_PrefabParentObject: {fileID: 0}
108 | m_PrefabInternal: {fileID: 0}
109 | m_GameObject: {fileID: 17972762}
110 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
111 | m_LocalPosition: {x: 0, y: 0, z: 0}
112 | m_LocalScale: {x: 1, y: 1, z: 1}
113 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
114 | m_Children: []
115 | m_Father: {fileID: 0}
116 | m_RootOrder: 0
117 | --- !u!114 &17972764
118 | MonoBehaviour:
119 | m_ObjectHideFlags: 0
120 | m_PrefabParentObject: {fileID: 0}
121 | m_PrefabInternal: {fileID: 0}
122 | m_GameObject: {fileID: 17972762}
123 | m_Enabled: 1
124 | m_EditorHideFlags: 0
125 | m_Script: {fileID: 11500000, guid: 5f30dac2bcee81e4c8d946311b78cad6, type: 3}
126 | m_Name:
127 | m_EditorClassIdentifier:
128 | Output: {fileID: 383421098}
129 | --- !u!1 &383421096
130 | GameObject:
131 | m_ObjectHideFlags: 0
132 | m_PrefabParentObject: {fileID: 0}
133 | m_PrefabInternal: {fileID: 0}
134 | serializedVersion: 4
135 | m_Component:
136 | - 224: {fileID: 383421097}
137 | - 222: {fileID: 383421099}
138 | - 114: {fileID: 383421098}
139 | - 114: {fileID: 383421100}
140 | m_Layer: 5
141 | m_Name: Output
142 | m_TagString: Untagged
143 | m_Icon: {fileID: 0}
144 | m_NavMeshLayer: 0
145 | m_StaticEditorFlags: 0
146 | m_IsActive: 1
147 | --- !u!224 &383421097
148 | RectTransform:
149 | m_ObjectHideFlags: 0
150 | m_PrefabParentObject: {fileID: 0}
151 | m_PrefabInternal: {fileID: 0}
152 | m_GameObject: {fileID: 383421096}
153 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
154 | m_LocalPosition: {x: 0, y: 0, z: 0}
155 | m_LocalScale: {x: 1, y: 1, z: 1}
156 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
157 | m_Children: []
158 | m_Father: {fileID: 2126236432}
159 | m_RootOrder: 0
160 | m_AnchorMin: {x: 0, y: 0}
161 | m_AnchorMax: {x: 1, y: 1}
162 | m_AnchoredPosition: {x: 0, y: 0}
163 | m_SizeDelta: {x: 0, y: 0}
164 | m_Pivot: {x: 0.5, y: 0.5}
165 | --- !u!114 &383421098
166 | MonoBehaviour:
167 | m_ObjectHideFlags: 0
168 | m_PrefabParentObject: {fileID: 0}
169 | m_PrefabInternal: {fileID: 0}
170 | m_GameObject: {fileID: 383421096}
171 | m_Enabled: 1
172 | m_EditorHideFlags: 0
173 | m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
174 | m_Name:
175 | m_EditorClassIdentifier:
176 | m_Material: {fileID: 0}
177 | m_Color: {r: 1, g: 1, b: 1, a: 1}
178 | m_RaycastTarget: 1
179 | m_OnCullStateChanged:
180 | m_PersistentCalls:
181 | m_Calls: []
182 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
183 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
184 | m_FontData:
185 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
186 | m_FontSize: 12
187 | m_FontStyle: 0
188 | m_BestFit: 0
189 | m_MinSize: 10
190 | m_MaxSize: 40
191 | m_Alignment: 0
192 | m_AlignByGeometry: 0
193 | m_RichText: 1
194 | m_HorizontalOverflow: 0
195 | m_VerticalOverflow: 0
196 | m_LineSpacing: 1
197 | m_Text: Output
198 | --- !u!222 &383421099
199 | CanvasRenderer:
200 | m_ObjectHideFlags: 0
201 | m_PrefabParentObject: {fileID: 0}
202 | m_PrefabInternal: {fileID: 0}
203 | m_GameObject: {fileID: 383421096}
204 | --- !u!114 &383421100
205 | MonoBehaviour:
206 | m_ObjectHideFlags: 0
207 | m_PrefabParentObject: {fileID: 0}
208 | m_PrefabInternal: {fileID: 0}
209 | m_GameObject: {fileID: 383421096}
210 | m_Enabled: 1
211 | m_EditorHideFlags: 0
212 | m_Script: {fileID: 11500000, guid: dcb53c957d1aa0e4e90719924cc27bdc, type: 3}
213 | m_Name:
214 | m_EditorClassIdentifier:
215 | --- !u!1 &613318430
216 | GameObject:
217 | m_ObjectHideFlags: 0
218 | m_PrefabParentObject: {fileID: 0}
219 | m_PrefabInternal: {fileID: 0}
220 | serializedVersion: 4
221 | m_Component:
222 | - 4: {fileID: 613318435}
223 | - 20: {fileID: 613318434}
224 | - 92: {fileID: 613318433}
225 | - 124: {fileID: 613318432}
226 | - 81: {fileID: 613318431}
227 | m_Layer: 0
228 | m_Name: Main Camera
229 | m_TagString: MainCamera
230 | m_Icon: {fileID: 0}
231 | m_NavMeshLayer: 0
232 | m_StaticEditorFlags: 0
233 | m_IsActive: 1
234 | --- !u!81 &613318431
235 | AudioListener:
236 | m_ObjectHideFlags: 0
237 | m_PrefabParentObject: {fileID: 0}
238 | m_PrefabInternal: {fileID: 0}
239 | m_GameObject: {fileID: 613318430}
240 | m_Enabled: 1
241 | --- !u!124 &613318432
242 | Behaviour:
243 | m_ObjectHideFlags: 0
244 | m_PrefabParentObject: {fileID: 0}
245 | m_PrefabInternal: {fileID: 0}
246 | m_GameObject: {fileID: 613318430}
247 | m_Enabled: 1
248 | --- !u!92 &613318433
249 | Behaviour:
250 | m_ObjectHideFlags: 0
251 | m_PrefabParentObject: {fileID: 0}
252 | m_PrefabInternal: {fileID: 0}
253 | m_GameObject: {fileID: 613318430}
254 | m_Enabled: 1
255 | --- !u!20 &613318434
256 | Camera:
257 | m_ObjectHideFlags: 0
258 | m_PrefabParentObject: {fileID: 0}
259 | m_PrefabInternal: {fileID: 0}
260 | m_GameObject: {fileID: 613318430}
261 | m_Enabled: 1
262 | serializedVersion: 2
263 | m_ClearFlags: 1
264 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
265 | m_NormalizedViewPortRect:
266 | serializedVersion: 2
267 | x: 0
268 | y: 0
269 | width: 1
270 | height: 1
271 | near clip plane: 0.3
272 | far clip plane: 1000
273 | field of view: 60
274 | orthographic: 1
275 | orthographic size: 5
276 | m_Depth: -1
277 | m_CullingMask:
278 | serializedVersion: 2
279 | m_Bits: 4294967295
280 | m_RenderingPath: -1
281 | m_TargetTexture: {fileID: 0}
282 | m_TargetDisplay: 0
283 | m_TargetEye: 3
284 | m_HDR: 0
285 | m_OcclusionCulling: 1
286 | m_StereoConvergence: 10
287 | m_StereoSeparation: 0.022
288 | m_StereoMirrorMode: 0
289 | --- !u!4 &613318435
290 | Transform:
291 | m_ObjectHideFlags: 0
292 | m_PrefabParentObject: {fileID: 0}
293 | m_PrefabInternal: {fileID: 0}
294 | m_GameObject: {fileID: 613318430}
295 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
296 | m_LocalPosition: {x: 0, y: 0, z: -10}
297 | m_LocalScale: {x: 1, y: 1, z: 1}
298 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
299 | m_Children: []
300 | m_Father: {fileID: 0}
301 | m_RootOrder: 1
302 | --- !u!1 &1098611478
303 | GameObject:
304 | m_ObjectHideFlags: 0
305 | m_PrefabParentObject: {fileID: 0}
306 | m_PrefabInternal: {fileID: 0}
307 | serializedVersion: 4
308 | m_Component:
309 | - 4: {fileID: 1098611482}
310 | - 114: {fileID: 1098611481}
311 | - 114: {fileID: 1098611480}
312 | - 114: {fileID: 1098611479}
313 | m_Layer: 0
314 | m_Name: EventSystem
315 | m_TagString: Untagged
316 | m_Icon: {fileID: 0}
317 | m_NavMeshLayer: 0
318 | m_StaticEditorFlags: 0
319 | m_IsActive: 1
320 | --- !u!114 &1098611479
321 | MonoBehaviour:
322 | m_ObjectHideFlags: 0
323 | m_PrefabParentObject: {fileID: 0}
324 | m_PrefabInternal: {fileID: 0}
325 | m_GameObject: {fileID: 1098611478}
326 | m_Enabled: 1
327 | m_EditorHideFlags: 0
328 | m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
329 | m_Name:
330 | m_EditorClassIdentifier:
331 | m_ForceModuleActive: 0
332 | --- !u!114 &1098611480
333 | MonoBehaviour:
334 | m_ObjectHideFlags: 0
335 | m_PrefabParentObject: {fileID: 0}
336 | m_PrefabInternal: {fileID: 0}
337 | m_GameObject: {fileID: 1098611478}
338 | m_Enabled: 1
339 | m_EditorHideFlags: 0
340 | m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
341 | m_Name:
342 | m_EditorClassIdentifier:
343 | m_HorizontalAxis: Horizontal
344 | m_VerticalAxis: Vertical
345 | m_SubmitButton: Submit
346 | m_CancelButton: Cancel
347 | m_InputActionsPerSecond: 10
348 | m_RepeatDelay: 0.5
349 | m_ForceModuleActive: 0
350 | --- !u!114 &1098611481
351 | MonoBehaviour:
352 | m_ObjectHideFlags: 0
353 | m_PrefabParentObject: {fileID: 0}
354 | m_PrefabInternal: {fileID: 0}
355 | m_GameObject: {fileID: 1098611478}
356 | m_Enabled: 1
357 | m_EditorHideFlags: 0
358 | m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
359 | m_Name:
360 | m_EditorClassIdentifier:
361 | m_FirstSelected: {fileID: 0}
362 | m_sendNavigationEvents: 1
363 | m_DragThreshold: 5
364 | --- !u!4 &1098611482
365 | Transform:
366 | m_ObjectHideFlags: 0
367 | m_PrefabParentObject: {fileID: 0}
368 | m_PrefabInternal: {fileID: 0}
369 | m_GameObject: {fileID: 1098611478}
370 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
371 | m_LocalPosition: {x: 0, y: 0, z: 0}
372 | m_LocalScale: {x: 1, y: 1, z: 1}
373 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
374 | m_Children: []
375 | m_Father: {fileID: 0}
376 | m_RootOrder: 2
377 | --- !u!1 &2126236428
378 | GameObject:
379 | m_ObjectHideFlags: 0
380 | m_PrefabParentObject: {fileID: 0}
381 | m_PrefabInternal: {fileID: 0}
382 | serializedVersion: 4
383 | m_Component:
384 | - 224: {fileID: 2126236432}
385 | - 223: {fileID: 2126236431}
386 | - 114: {fileID: 2126236430}
387 | - 114: {fileID: 2126236429}
388 | m_Layer: 5
389 | m_Name: Canvas
390 | m_TagString: Untagged
391 | m_Icon: {fileID: 0}
392 | m_NavMeshLayer: 0
393 | m_StaticEditorFlags: 0
394 | m_IsActive: 1
395 | --- !u!114 &2126236429
396 | MonoBehaviour:
397 | m_ObjectHideFlags: 0
398 | m_PrefabParentObject: {fileID: 0}
399 | m_PrefabInternal: {fileID: 0}
400 | m_GameObject: {fileID: 2126236428}
401 | m_Enabled: 1
402 | m_EditorHideFlags: 0
403 | m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
404 | m_Name:
405 | m_EditorClassIdentifier:
406 | m_IgnoreReversedGraphics: 1
407 | m_BlockingObjects: 0
408 | m_BlockingMask:
409 | serializedVersion: 2
410 | m_Bits: 4294967295
411 | --- !u!114 &2126236430
412 | MonoBehaviour:
413 | m_ObjectHideFlags: 0
414 | m_PrefabParentObject: {fileID: 0}
415 | m_PrefabInternal: {fileID: 0}
416 | m_GameObject: {fileID: 2126236428}
417 | m_Enabled: 1
418 | m_EditorHideFlags: 0
419 | m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
420 | m_Name:
421 | m_EditorClassIdentifier:
422 | m_UiScaleMode: 0
423 | m_ReferencePixelsPerUnit: 100
424 | m_ScaleFactor: 1
425 | m_ReferenceResolution: {x: 800, y: 600}
426 | m_ScreenMatchMode: 0
427 | m_MatchWidthOrHeight: 0
428 | m_PhysicalUnit: 3
429 | m_FallbackScreenDPI: 96
430 | m_DefaultSpriteDPI: 96
431 | m_DynamicPixelsPerUnit: 1
432 | --- !u!223 &2126236431
433 | Canvas:
434 | m_ObjectHideFlags: 0
435 | m_PrefabParentObject: {fileID: 0}
436 | m_PrefabInternal: {fileID: 0}
437 | m_GameObject: {fileID: 2126236428}
438 | m_Enabled: 1
439 | serializedVersion: 2
440 | m_RenderMode: 0
441 | m_Camera: {fileID: 0}
442 | m_PlaneDistance: 100
443 | m_PixelPerfect: 0
444 | m_ReceivesEvents: 1
445 | m_OverrideSorting: 0
446 | m_OverridePixelPerfect: 0
447 | m_SortingBucketNormalizedSize: 0
448 | m_SortingLayerID: 0
449 | m_SortingOrder: 0
450 | m_TargetDisplay: 0
451 | --- !u!224 &2126236432
452 | RectTransform:
453 | m_ObjectHideFlags: 0
454 | m_PrefabParentObject: {fileID: 0}
455 | m_PrefabInternal: {fileID: 0}
456 | m_GameObject: {fileID: 2126236428}
457 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
458 | m_LocalPosition: {x: 0, y: 0, z: 0}
459 | m_LocalScale: {x: 0, y: 0, z: 0}
460 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
461 | m_Children:
462 | - {fileID: 383421097}
463 | m_Father: {fileID: 0}
464 | m_RootOrder: 3
465 | m_AnchorMin: {x: 0, y: 0}
466 | m_AnchorMax: {x: 0, y: 0}
467 | m_AnchoredPosition: {x: 0, y: 0}
468 | m_SizeDelta: {x: 0, y: 0}
469 | m_Pivot: {x: 0, y: 0}
470 |
--------------------------------------------------------------------------------
/ExcelExporter.Editor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {E15FF692-ED8B-5B2B-73F4-642E2DC33B59}
9 | Library
10 | Assembly-CSharp-Editor
11 | 512
12 | {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
13 | .NETFramework
14 | v3.5
15 | Unity Full v3.5
16 |
17 | Editor:5
18 | StandaloneWindows:5
19 | 5.6.0f3
20 |
21 | 4
22 |
23 |
24 | pdbonly
25 | false
26 | Temp\UnityVS_bin\Debug\
27 | Temp\UnityVS_obj\Debug\
28 | prompt
29 | 4
30 | DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_5_6_0;UNITY_5_6;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;ENABLE_VIDEO;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU;UNITY_PRO_LICENSE
31 | false
32 |
33 |
34 | pdbonly
35 | false
36 | Temp\UnityVS_bin\Release\
37 | Temp\UnityVS_obj\Release\
38 | prompt
39 | 4
40 | TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_5_6_0;UNITY_5_6;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;ENABLE_VIDEO;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU;UNITY_PRO_LICENSE
41 | false
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | Library\UnityAssemblies\UnityEngine.dll
54 |
55 |
56 | Library\UnityAssemblies\UnityEditor.dll
57 |
58 |
59 | Library\UnityAssemblies\UnityEditor.Advertisements.dll
60 |
61 |
62 | Library\UnityAssemblies\UnityEngine.UI.dll
63 |
64 |
65 | Library\UnityAssemblies\UnityEditor.UI.dll
66 |
67 |
68 | Library\UnityAssemblies\UnityEngine.Networking.dll
69 |
70 |
71 | Library\UnityAssemblies\UnityEditor.Networking.dll
72 |
73 |
74 | Library\UnityAssemblies\UnityEditor.TestRunner.dll
75 |
76 |
77 | Library\UnityAssemblies\UnityEngine.TestRunner.dll
78 |
79 |
80 | Library\UnityAssemblies\nunit.framework.dll
81 |
82 |
83 | Library\UnityAssemblies\UnityEditor.TreeEditor.dll
84 |
85 |
86 | Library\UnityAssemblies\UnityEngine.Analytics.dll
87 |
88 |
89 | Library\UnityAssemblies\UnityEditor.Analytics.dll
90 |
91 |
92 | Library\UnityAssemblies\UnityEditor.HoloLens.dll
93 |
94 |
95 | Library\UnityAssemblies\UnityEngine.HoloLens.dll
96 |
97 |
98 | Library\UnityAssemblies\UnityEditor.Purchasing.dll
99 |
100 |
101 | Library\UnityAssemblies\UnityEditor.VR.dll
102 |
103 |
104 | Library\UnityAssemblies\UnityEngine.VR.dll
105 |
106 |
107 | Library\UnityAssemblies\UnityEditor.Graphs.dll
108 |
109 |
110 | Library\UnityAssemblies\UnityEditor.Android.Extensions.dll
111 |
112 |
113 | Library\UnityAssemblies\UnityEditor.WindowsStandalone.Extensions.dll
114 |
115 |
116 | Library\UnityAssemblies\SyntaxTree.VisualStudio.Unity.Bridge.dll
117 |
118 |
119 | Assets\Editor\Lib\EPP\EPPlus.dll
120 |
121 |
122 | Assets\Editor\Lib\NPOI\EPPlus.dll
123 |
124 |
125 | Assets\Editor\Lib\NPOI\ICSharpCode.SharpZipLib.dll
126 |
127 |
128 | Assets\Editor\Lib\NPOI\NPOI.dll
129 |
130 |
131 | Assets\Editor\Lib\NPOI\NPOI.OOXML.dll
132 |
133 |
134 | Assets\Editor\Lib\NPOI\NPOI.OpenXml4Net.dll
135 |
136 |
137 | Assets\Editor\Lib\NPOI\NPOI.OpenXmlFormats.dll
138 |
139 |
140 | Assets\UnityPackages\JsonNet\Newtonsoft.Json.dll
141 |
142 |
143 |
144 |
145 | {28560C95-D97D-70BA-BA49-6D6777DB91F7}
146 | excelExporter
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
--------------------------------------------------------------------------------
/ExcelExporter.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {28560C95-D97D-70BA-BA49-6D6777DB91F7}
9 | Library
10 | Assembly-CSharp
11 | 512
12 | {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
13 | .NETFramework
14 | v3.5
15 | Unity Full v3.5
16 |
17 | Game:1
18 | StandaloneWindows:5
19 | 5.6.0f3
20 |
21 | 4
22 |
23 |
24 | pdbonly
25 | false
26 | Temp\UnityVS_bin\Debug\
27 | Temp\UnityVS_obj\Debug\
28 | prompt
29 | 4
30 | DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_5_6_0;UNITY_5_6;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;ENABLE_VIDEO;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU;UNITY_PRO_LICENSE
31 | false
32 |
33 |
34 | pdbonly
35 | false
36 | Temp\UnityVS_bin\Release\
37 | Temp\UnityVS_obj\Release\
38 | prompt
39 | 4
40 | TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_5_6_0;UNITY_5_6;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;ENABLE_VIDEO;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU;UNITY_PRO_LICENSE
41 | false
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | Library\UnityAssemblies\UnityEngine.dll
54 |
55 |
56 | Library\UnityAssemblies\UnityEngine.UI.dll
57 |
58 |
59 | Library\UnityAssemblies\UnityEngine.Networking.dll
60 |
61 |
62 | Library\UnityAssemblies\UnityEngine.TestRunner.dll
63 |
64 |
65 | Library\UnityAssemblies\nunit.framework.dll
66 |
67 |
68 | Library\UnityAssemblies\UnityEngine.Analytics.dll
69 |
70 |
71 | Library\UnityAssemblies\UnityEngine.HoloLens.dll
72 |
73 |
74 | Library\UnityAssemblies\UnityEngine.VR.dll
75 |
76 |
77 | Library\UnityAssemblies\UnityEditor.dll
78 |
79 |
80 | Assets\UnityPackages\JsonNet\Newtonsoft.Json.dll
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/ExcelExporter.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2015
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "excelExporter", "excelExporter.csproj", "{28560C95-D97D-70BA-BA49-6D6777DB91F7}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "excelExporter.Editor", "excelExporter.Editor.csproj", "{E15FF692-ED8B-5B2B-73F4-642E2DC33B59}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {28560C95-D97D-70BA-BA49-6D6777DB91F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {28560C95-D97D-70BA-BA49-6D6777DB91F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {28560C95-D97D-70BA-BA49-6D6777DB91F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {28560C95-D97D-70BA-BA49-6D6777DB91F7}.Release|Any CPU.Build.0 = Release|Any CPU
18 | {E15FF692-ED8B-5B2B-73F4-642E2DC33B59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {E15FF692-ED8B-5B2B-73F4-642E2DC33B59}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {E15FF692-ED8B-5B2B-73F4-642E2DC33B59}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {E15FF692-ED8B-5B2B-73F4-642E2DC33B59}.Release|Any CPU.Build.0 = Release|Any CPU
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/Image/excel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Image/excel.png
--------------------------------------------------------------------------------
/Image/window1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Image/window1.png
--------------------------------------------------------------------------------
/Image/window2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/Image/window2.png
--------------------------------------------------------------------------------
/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/AudioManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/ClusterInputManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/DynamicsManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/EditorBuildSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/EditorSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/GraphicsSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/InputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/InputManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/NavMeshAreas.asset
--------------------------------------------------------------------------------
/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/NetworkManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/Physics2DSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/ProjectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/ProjectSettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 5.6.0f3
2 |
--------------------------------------------------------------------------------
/ProjectSettings/QualitySettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/QualitySettings.asset
--------------------------------------------------------------------------------
/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/TagManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/TimeManager.asset
--------------------------------------------------------------------------------
/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/ProjectSettings/UnityConnectSettings.asset
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UnityExcelExportTool
2 | * Unity Excel导表工具
3 | * 支持excel2003和2007格式
4 | * 支持根据excel生成类
5 | * 支持导出Text,Json,ScriptableObject和C#二进制数据
6 | * 通过颜色区分客户端,服务器,注释等
7 | * 支持List<>,Dictionary<> 等部分简单类型
8 | * 除C#二进制方式外,支持Vector3,Vector2类型
9 | * 内置简易的Excel编辑器
10 |
11 | 
12 | 
13 | 
14 |
--------------------------------------------------------------------------------
/XMind/ExcelExporter类型整理.xmind:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chiguozi/UnityExcelExportTool/cdec14f8fa06ecd4188e773886e2afc624fc74ef/XMind/ExcelExporter类型整理.xmind
--------------------------------------------------------------------------------