├── .gitignore ├── Example ├── Assets │ ├── Examples.meta │ ├── Examples │ │ ├── CodeOutput.meta │ │ ├── CodeOutput │ │ │ ├── ParentFAQConfig.cs │ │ │ ├── ParentFAQConfig.cs.meta │ │ │ ├── WordSleepConfig.cs │ │ │ ├── WordSleepConfig.cs.meta │ │ │ ├── WordSleepConfigPartial.cs │ │ │ └── WordSleepConfigPartial.cs.meta │ │ ├── DataOutput.meta │ │ ├── DataOutput │ │ │ ├── ParentFAQ.bytes │ │ │ ├── ParentFAQ.bytes.meta │ │ │ ├── ParentFAQConfig.bytes │ │ │ ├── ParentFAQConfig.bytes.meta │ │ │ ├── ParentFAQ_en.bytes │ │ │ ├── ParentFAQ_en.bytes.meta │ │ │ ├── WordSleepConfig.bytes │ │ │ ├── WordSleepConfig.bytes.meta │ │ │ ├── WordSleepConfig_json.json │ │ │ ├── WordSleepConfig_json.json.meta │ │ │ ├── WordSleepConfig_lua.lua │ │ │ └── WordSleepConfig_lua.lua.meta │ │ ├── ParentFAQ.xlsx │ │ ├── ParentFAQ.xlsx.meta │ │ ├── ParentFAQ_en.xlsx │ │ ├── ParentFAQ_en.xlsx.meta │ │ ├── WordSleep.xlsx │ │ └── WordSleep.xlsx.meta │ ├── Plugins.meta │ ├── Plugins │ │ └── Editor.meta │ ├── UExcelReader.meta │ └── UExcelReader │ │ ├── ConfigCollection.cs │ │ ├── ConfigCollection.cs.meta │ │ ├── ConfigManager.cs │ │ ├── ConfigManager.cs.meta │ │ ├── DataReader.cs │ │ ├── DataReader.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── ExcelReaderEditorWindow.cs │ │ ├── ExcelReaderEditorWindow.cs.meta │ │ ├── SaveInfo.json │ │ ├── SaveInfo.json.meta │ │ ├── generate_configs_bin_mac.sh │ │ ├── generate_configs_bin_mac.sh.meta │ │ ├── tabtoy.meta │ │ └── tabtoy │ │ │ ├── macosx_x64.meta │ │ │ ├── macosx_x64 │ │ │ ├── tabtoy │ │ │ └── tabtoy.meta │ │ │ ├── windows_x64.meta │ │ │ ├── windows_x64 │ │ │ ├── tabtoy.exe │ │ │ └── tabtoy.exe.meta │ │ │ ├── windows_x86.meta │ │ │ └── windows_x86 │ │ │ ├── tabtoy.exe │ │ │ └── tabtoy.exe.meta │ │ ├── Logger.cs │ │ └── Logger.cs.meta └── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── Physics2DSettings.asset │ ├── ProjectSettings.asset │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ └── UnityConnectSettings.asset ├── LICENSE ├── README.md ├── README └── editor_window.png └── UnityPackage.unitypackage /.gitignore: -------------------------------------------------------------------------------- 1 | **/Temp/ 2 | **/Library/ 3 | **/obj/ 4 | **.csproj 5 | **.idea/ 6 | **.sln 7 | 8 | **/ProjectVersion.txt 9 | 10 | **/PersistentPath/ 11 | **/PersistentPath.meta 12 | **/BlockGenPrefabs/ 13 | **/BlockGenPrefabs.meta 14 | **/Xcode/ 15 | **.DS_Store 16 | **.userprefs 17 | **/JetBrains/ 18 | **/JetBrains.meta 19 | 20 | -------------------------------------------------------------------------------- /Example/Assets/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7ffe2b8646d54bd18fef2dfde017166 3 | folderAsset: yes 4 | timeCreated: 1510737224 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/Examples/CodeOutput.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e156dc6efe3cb4ff89af0b305106c78f 3 | folderAsset: yes 4 | timeCreated: 1495709664 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/Examples/CodeOutput/ParentFAQConfig.cs: -------------------------------------------------------------------------------- 1 | // Generated by github.com/davyxu/tabtoy 2 | // Version: 2.8.4 3 | // DO NOT EDIT!! 4 | using System.Collections.Generic; 5 | 6 | namespace UExcelReader 7 | { 8 | 9 | 10 | 11 | // Defined in table: ParentFAQConfig 12 | 13 | public partial class ParentFAQConfig 14 | { 15 | 16 | public tabtoy.Logger TableLogger = new tabtoy.Logger(); 17 | 18 | 19 | /// 20 | /// ParentFAQ 21 | /// 22 | public List ParentFAQ = new List(); 23 | 24 | 25 | #region Index code 26 | Dictionary _ParentFAQByKey = new Dictionary(); 27 | public ParentFAQDefine GetParentFAQByKey(string Key, ParentFAQDefine def = default(ParentFAQDefine)) 28 | { 29 | ParentFAQDefine ret; 30 | if ( _ParentFAQByKey.TryGetValue( Key, out ret ) ) 31 | { 32 | return ret; 33 | } 34 | 35 | if ( def == default(ParentFAQDefine) ) 36 | { 37 | TableLogger.ErrorLine("GetParentFAQByKey failed, Key: {0}", Key); 38 | } 39 | 40 | return def; 41 | } 42 | 43 | 44 | #endregion 45 | #region Deserialize code 46 | 47 | static tabtoy.DeserializeHandler ParentFAQConfigDeserializeHandler = new tabtoy.DeserializeHandler(Deserialize); 48 | public static void Deserialize( ParentFAQConfig ins, tabtoy.DataReader reader ) 49 | { 50 | int tag = -1; 51 | while ( -1 != (tag = reader.ReadTag())) 52 | { 53 | switch (tag) 54 | { 55 | case 0xa0000: 56 | { 57 | ins.ParentFAQ.Add( reader.ReadStruct(ParentFAQDefineDeserializeHandler) ); 58 | } 59 | break; 60 | } 61 | } 62 | 63 | 64 | // Build ParentFAQ Index 65 | for( int i = 0;i< ins.ParentFAQ.Count;i++) 66 | { 67 | var element = ins.ParentFAQ[i]; 68 | 69 | ins._ParentFAQByKey.Add(element.Key, element); 70 | 71 | } 72 | 73 | } 74 | static tabtoy.DeserializeHandler ParentFAQDefineDeserializeHandler = new tabtoy.DeserializeHandler(Deserialize); 75 | public static void Deserialize( ParentFAQDefine ins, tabtoy.DataReader reader ) 76 | { 77 | int tag = -1; 78 | while ( -1 != (tag = reader.ReadTag())) 79 | { 80 | switch (tag) 81 | { 82 | case 0x60000: 83 | { 84 | ins.Key = reader.ReadString(); 85 | } 86 | break; 87 | case 0x60001: 88 | { 89 | ins.Title = reader.ReadString(); 90 | } 91 | break; 92 | case 0x60002: 93 | { 94 | ins.Content = reader.ReadString(); 95 | } 96 | break; 97 | } 98 | } 99 | 100 | 101 | } 102 | #endregion 103 | 104 | 105 | } 106 | 107 | // Defined in table: ParentFAQ 108 | 109 | public partial class ParentFAQDefine 110 | { 111 | 112 | 113 | /// 114 | /// 问题索引 115 | /// 116 | public string Key = ""; 117 | 118 | /// 119 | /// 标题 120 | /// 121 | public string Title = ""; 122 | 123 | /// 124 | /// 内容 125 | /// 126 | public string Content = ""; 127 | 128 | 129 | 130 | } 131 | 132 | } 133 | -------------------------------------------------------------------------------- /Example/Assets/Examples/CodeOutput/ParentFAQConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8eb4cf17dc254447ebb2a352336c008d 3 | timeCreated: 1510736610 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Example/Assets/Examples/CodeOutput/WordSleepConfig.cs: -------------------------------------------------------------------------------- 1 | // Generated by github.com/davyxu/tabtoy 2 | // Version: 2.8.4 3 | // DO NOT EDIT!! 4 | using System.Collections.Generic; 5 | 6 | namespace UExcelReader 7 | { 8 | 9 | 10 | 11 | // Defined in table: WordSleepConfig 12 | 13 | public partial class WordSleepConfig 14 | { 15 | 16 | public tabtoy.Logger TableLogger = new tabtoy.Logger(); 17 | 18 | 19 | /// 20 | /// WordSleep 21 | /// 22 | public List WordSleep = new List(); 23 | 24 | 25 | #region Index code 26 | Dictionary _WordSleepByKey = new Dictionary(); 27 | public WordSleepDefine GetWordSleepByKey(int Key, WordSleepDefine def = default(WordSleepDefine)) 28 | { 29 | WordSleepDefine ret; 30 | if ( _WordSleepByKey.TryGetValue( Key, out ret ) ) 31 | { 32 | return ret; 33 | } 34 | 35 | if ( def == default(WordSleepDefine) ) 36 | { 37 | TableLogger.ErrorLine("GetWordSleepByKey failed, Key: {0}", Key); 38 | } 39 | 40 | return def; 41 | } 42 | 43 | 44 | #endregion 45 | #region Deserialize code 46 | 47 | static tabtoy.DeserializeHandler WordSleepConfigDeserializeHandler = new tabtoy.DeserializeHandler(Deserialize); 48 | public static void Deserialize( WordSleepConfig ins, tabtoy.DataReader reader ) 49 | { 50 | int tag = -1; 51 | while ( -1 != (tag = reader.ReadTag())) 52 | { 53 | switch (tag) 54 | { 55 | case 0xa0000: 56 | { 57 | ins.WordSleep.Add( reader.ReadStruct(WordSleepDefineDeserializeHandler) ); 58 | } 59 | break; 60 | } 61 | } 62 | 63 | 64 | // Build WordSleep Index 65 | for( int i = 0;i< ins.WordSleep.Count;i++) 66 | { 67 | var element = ins.WordSleep[i]; 68 | 69 | ins._WordSleepByKey.Add(element.Key, element); 70 | 71 | } 72 | 73 | } 74 | static tabtoy.DeserializeHandler TimeStructDeserializeHandler = new tabtoy.DeserializeHandler(Deserialize); 75 | public static void Deserialize( TimeStruct ins, tabtoy.DataReader reader ) 76 | { 77 | int tag = -1; 78 | while ( -1 != (tag = reader.ReadTag())) 79 | { 80 | switch (tag) 81 | { 82 | case 0x10000: 83 | { 84 | ins.Day = reader.ReadInt32(); 85 | } 86 | break; 87 | case 0x10001: 88 | { 89 | ins.Hour = reader.ReadInt32(); 90 | } 91 | break; 92 | case 0x10002: 93 | { 94 | ins.Minute = reader.ReadInt32(); 95 | } 96 | break; 97 | case 0x10003: 98 | { 99 | ins.Second = reader.ReadInt32(); 100 | } 101 | break; 102 | } 103 | } 104 | 105 | 106 | } 107 | static tabtoy.DeserializeHandler WordSleepDefineDeserializeHandler = new tabtoy.DeserializeHandler(Deserialize); 108 | public static void Deserialize( WordSleepDefine ins, tabtoy.DataReader reader ) 109 | { 110 | int tag = -1; 111 | while ( -1 != (tag = reader.ReadTag())) 112 | { 113 | switch (tag) 114 | { 115 | case 0x10000: 116 | { 117 | ins.Key = reader.ReadInt32(); 118 | } 119 | break; 120 | case 0x90001: 121 | { 122 | ins.SleepInterval = reader.ReadStruct(TimeStructDeserializeHandler); 123 | } 124 | break; 125 | } 126 | } 127 | 128 | 129 | } 130 | #endregion 131 | 132 | 133 | } 134 | 135 | // Defined in table: WordSleep 136 | 137 | public partial class TimeStruct 138 | { 139 | 140 | 141 | 142 | public int Day = 0; // 天 143 | 144 | 145 | public int Hour = 0; // 时 146 | 147 | 148 | public int Minute = 0; // 分 149 | 150 | 151 | public int Second = 0; // 秒 152 | 153 | 154 | 155 | } 156 | 157 | // Defined in table: WordSleep 158 | 159 | public partial class WordSleepDefine 160 | { 161 | 162 | 163 | /// 164 | /// 任务成功累计 165 | /// 166 | public int Key = 0; 167 | 168 | /// 169 | /// 睡眠间隔(Day:0 Hour:0 Minute:0 Second:0) 170 | /// 171 | public TimeStruct SleepInterval = new TimeStruct(); 172 | 173 | 174 | 175 | } 176 | 177 | } 178 | -------------------------------------------------------------------------------- /Example/Assets/Examples/CodeOutput/WordSleepConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd978716f162041359daeed68e25266c 3 | timeCreated: 1495703830 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Example/Assets/Examples/CodeOutput/WordSleepConfigPartial.cs: -------------------------------------------------------------------------------- 1 | // Generated by UExcelReader only once 2 | // Free to edit 3 | 4 | namespace UExcelReader 5 | { 6 | public partial class WordSleepConfig 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /Example/Assets/Examples/CodeOutput/WordSleepConfigPartial.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83459fc329da842cdacdc20813c22e63 3 | timeCreated: 1495709554 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b651a6678af1c464580e9dd4211c452b 3 | folderAsset: yes 4 | timeCreated: 1495709655 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/ParentFAQ.bytes: -------------------------------------------------------------------------------- 1 | TABTOY 2 | I0问:你吃饭了吗?答:没有呢呢呢! 3 | O1问:你吃饭了吗??答:没有呢呢呢!! 4 | X2!问:你吃饭了吗????答:没有呢呢呢!!! 5 | a3$问:你吃饭了吗?????$答:没有呢呢呢!!!!! -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/ParentFAQ.bytes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5931e1f6976134a5ebd8aa8db2a23c55 3 | timeCreated: 1510736952 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/ParentFAQConfig.bytes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/Assets/Examples/DataOutput/ParentFAQConfig.bytes -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/ParentFAQConfig.bytes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba1f639eb688547718828e06ada36131 3 | timeCreated: 1510736610 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/ParentFAQ_en.bytes: -------------------------------------------------------------------------------- 1 | TABTOY 2 | -0 3 | Q: abcdefg 4 | A: hijklmn 5 | 21 Q: abcdefg??? A: hijklmn!! 6 | 52Q: abcdefg????A: hijklmn!!!! 7 | 93Q: abcdefg?????A: hijklmn!!!!!!! -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/ParentFAQ_en.bytes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 310933fbd9a9b45caadbfeec46163d77 3 | timeCreated: 1510736952 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/WordSleepConfig.bytes: -------------------------------------------------------------------------------- 1 | TABTOY 2 | 0  3 | 0  4 | 0  5 | 0  6 | 0  7 | 0  -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/WordSleepConfig.bytes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c31a68d205d5437e8f909cca197bf44 3 | timeCreated: 1495709790 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/WordSleepConfig_json.json: -------------------------------------------------------------------------------- 1 | { 2 | "Tool": "github.com/davyxu/tabtoy", 3 | "Version": "2.8.4", 4 | "WordSleep":[ 5 | { "Key": 0, "SleepInterval": { "Day": 1, "Hour": 0, "Minute": 0, "Second": 0 } }, 6 | { "Key": 1, "SleepInterval": { "Day": 2, "Hour": 0, "Minute": 0, "Second": 0 } }, 7 | { "Key": 2, "SleepInterval": { "Day": 5, "Hour": 0, "Minute": 0, "Second": 0 } }, 8 | { "Key": 3, "SleepInterval": { "Day": 8, "Hour": 0, "Minute": 0, "Second": 0 } }, 9 | { "Key": 4, "SleepInterval": { "Day": 14, "Hour": 0, "Minute": 0, "Second": 0 } }, 10 | { "Key": 5, "SleepInterval": { "Day": 31, "Hour": 0, "Minute": 0, "Second": 0 } } 11 | ]} -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/WordSleepConfig_json.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6400e43f3da24114a03047bc55d10bf 3 | timeCreated: 1495709790 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/WordSleepConfig_lua.lua: -------------------------------------------------------------------------------- 1 | -- Generated by github.com/davyxu/tabtoy 2 | -- Version: 2.8.4 3 | 4 | local tab = { 5 | WordSleep = { 6 | { Key = 0, SleepInterval = { Day= 1, Hour= 0, Minute= 0, Second= 0 } }, 7 | { Key = 1, SleepInterval = { Day= 2, Hour= 0, Minute= 0, Second= 0 } }, 8 | { Key = 2, SleepInterval = { Day= 5, Hour= 0, Minute= 0, Second= 0 } }, 9 | { Key = 3, SleepInterval = { Day= 8, Hour= 0, Minute= 0, Second= 0 } }, 10 | { Key = 4, SleepInterval = { Day= 14, Hour= 0, Minute= 0, Second= 0 } }, 11 | { Key = 5, SleepInterval = { Day= 31, Hour= 0, Minute= 0, Second= 0 } } 12 | } 13 | 14 | } 15 | 16 | 17 | -- Key 18 | tab.WordSleepByKey = {} 19 | for _, rec in pairs(tab.WordSleep) do 20 | tab.WordSleepByKey[rec.Key] = rec 21 | end 22 | 23 | tab.Enum = { 24 | } 25 | 26 | return tab -------------------------------------------------------------------------------- /Example/Assets/Examples/DataOutput/WordSleepConfig_lua.lua.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b041b4ac4e8e24259aacbe5553619613 3 | timeCreated: 1495709790 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/Examples/ParentFAQ.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/Assets/Examples/ParentFAQ.xlsx -------------------------------------------------------------------------------- /Example/Assets/Examples/ParentFAQ.xlsx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4fd4e9f9fae3a4e53b9a63a451a3843a 3 | timeCreated: 1510732784 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/Examples/ParentFAQ_en.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/Assets/Examples/ParentFAQ_en.xlsx -------------------------------------------------------------------------------- /Example/Assets/Examples/ParentFAQ_en.xlsx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ff834bdf4b674d7fb12c0c741afe434 3 | timeCreated: 1510732784 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/Examples/WordSleep.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/Assets/Examples/WordSleep.xlsx -------------------------------------------------------------------------------- /Example/Assets/Examples/WordSleep.xlsx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d2916910c1eaa45089776fd1000dc9d4 3 | timeCreated: 1495702886 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df870fbf4da6743a5a5887a94013df8d 3 | folderAsset: yes 4 | timeCreated: 1510729601 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/Plugins/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f00df39eb13f4e1181724bf6055a4c3 3 | folderAsset: yes 4 | timeCreated: 1510729601 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec61ba66146ef4496982b81fe0c85d14 3 | folderAsset: yes 4 | timeCreated: 1510728057 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/ConfigCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | namespace UExcelReader 6 | { 7 | public class ConfigCollection 8 | { 9 | public static string ConfigBundleName = "ConfigData"; 10 | 11 | public static Type[] ConfigClassType = 12 | { 13 | //start 14 | typeof(WordSleepConfig), 15 | typeof(ParentFAQConfig), 16 | //end 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/ConfigCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55ed51b8441c64791a4518fd5f8982aa 3 | timeCreated: 1493805644 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/ConfigManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | using System.Reflection; 6 | 7 | namespace UExcelReader 8 | { 9 | public class ConfigManager 10 | { 11 | private ConfigManager() {} 12 | 13 | private List configList = new List(); 14 | 15 | public T GetConfig() where T : class 16 | { 17 | return configList.Find(c => c.GetType() == typeof(T)) as T; 18 | } 19 | 20 | public void Load() 21 | { 22 | //todo: 自定义加载二进制数据方法,下面注释掉的代码都是要自定义的 23 | //ResLoader resLoader = ResLoader.Allocate (); 24 | 25 | foreach (Type byteClassType in ConfigCollection.ConfigClassType) 26 | { 27 | string fileName = byteClassType.Name; 28 | TextAsset t = null; /*resLoader.LoadSync(fileName) as TextAsset;*/ 29 | 30 | using (MemoryStream stream = new MemoryStream(t.bytes)) 31 | { 32 | stream.Position = 0; 33 | var reader = new tabtoy.DataReader(stream, stream.Length); 34 | if (!reader.ReadHeader()) 35 | { 36 | Debug.LogErrorFormat(">>>>tabtoy: {0}, combine file crack!", fileName); 37 | continue; 38 | } 39 | 40 | var data = Activator.CreateInstance(byteClassType); 41 | 42 | var mInfos = byteClassType.GetMethods(); 43 | foreach (System.Reflection.MethodInfo info in mInfos) 44 | { 45 | if (info.Name == "Deserialize") 46 | { 47 | bool found = false; 48 | ParameterInfo[] pars = info.GetParameters(); 49 | for (int i = 0; i < pars.Length; i++) 50 | { 51 | if (pars[i].ParameterType == byteClassType) 52 | { 53 | info.Invoke(data, new object[] {data, reader}); 54 | found = true; 55 | break; 56 | } 57 | } 58 | if (found) 59 | break; 60 | } 61 | } 62 | 63 | Debug.LogFormat(">>>>tabtoy: parse {0} successfully!", fileName); 64 | configList.Add(data); 65 | } 66 | } 67 | /*resLoader.ReleaseAllRes (); 68 | resLoader.Recycle2Cache (); 69 | resLoader = null;*/ 70 | } 71 | 72 | /// 73 | /// 使用示例 74 | /// 75 | void Example() 76 | { 77 | //1. 游戏开始时,在下载完assetbundle后,加载 78 | //ConfigManager.Instance.Load(); 79 | 80 | //2. 应用层获取配置数据 81 | /*I18nConfig cfg = ConfigManager.Instance.GetConfig(); 82 | Debug.Log(">>>>>> config: " + cfg.I18n.Count);*/ 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/ConfigManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1614a019e54e414588771772ec4271a 3 | timeCreated: 1493808385 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/DataReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | using System.Collections.Generic; 5 | 6 | namespace tabtoy 7 | { 8 | enum FieldType 9 | { 10 | None = 0, 11 | Int32 = 1, 12 | Int64 = 2, 13 | UInt32 = 3, 14 | UInt64 = 4, 15 | Float = 5, 16 | String = 6, 17 | Bool = 7, 18 | Enum = 8, 19 | Struct = 9, 20 | } 21 | 22 | public delegate void DeserializeHandler(T ins, DataReader reader); 23 | 24 | public class DataReader 25 | { 26 | BinaryReader _reader; 27 | long _boundPos = -1; 28 | 29 | public DataReader(Stream stream, long boundpos) 30 | { 31 | _reader = new BinaryReader(stream ); 32 | _boundPos = boundpos; 33 | } 34 | 35 | public DataReader(DataReader reader, long boundpos ) 36 | { 37 | _reader = reader._reader; 38 | _boundPos = boundpos; 39 | } 40 | 41 | void ConsumeData(int size) 42 | { 43 | if ( !IsDataEnough( size ) ) 44 | { 45 | throw new Exception("Out of struct bound"); 46 | } 47 | } 48 | 49 | bool IsDataEnough(int size) 50 | { 51 | return _reader.BaseStream.Position + size <= _boundPos; 52 | } 53 | 54 | const int CombineFileVersion = 2; 55 | 56 | public bool ReadHeader( ) 57 | { 58 | var tag = ReadString(); 59 | if (tag != "TABTOY") 60 | { 61 | return false; 62 | } 63 | 64 | var ver = ReadInt32(); 65 | if (ver != CombineFileVersion) 66 | { 67 | return false; 68 | } 69 | 70 | return true; 71 | } 72 | 73 | static readonly UTF8Encoding encoding = new UTF8Encoding(); 74 | 75 | public int ReadTag() 76 | { 77 | if ( IsDataEnough(sizeof(Int32) ) ) 78 | { 79 | return ReadInt32( ); 80 | } 81 | 82 | return -1; 83 | } 84 | 85 | public int ReadInt32( ) 86 | { 87 | ConsumeData(sizeof(Int32)); 88 | 89 | return _reader.ReadInt32(); 90 | } 91 | 92 | public long ReadInt64( ) 93 | { 94 | ConsumeData(sizeof(Int64)); 95 | 96 | return _reader.ReadInt64(); 97 | } 98 | 99 | public uint ReadUInt32( ) 100 | { 101 | ConsumeData(sizeof(UInt32)); 102 | 103 | return _reader.ReadUInt32(); 104 | } 105 | 106 | public ulong ReadUInt64( ) 107 | { 108 | ConsumeData(sizeof(UInt64)); 109 | 110 | return _reader.ReadUInt64(); 111 | } 112 | 113 | public float ReadFloat( ) 114 | { 115 | ConsumeData(sizeof(float)); 116 | 117 | return _reader.ReadSingle(); 118 | } 119 | 120 | public bool ReadBool( ) 121 | { 122 | ConsumeData(sizeof(bool)); 123 | 124 | return _reader.ReadBoolean(); 125 | } 126 | 127 | public string ReadString() 128 | { 129 | var len = ReadInt32(); 130 | 131 | ConsumeData(sizeof(Byte) * len); 132 | 133 | return encoding.GetString(_reader.ReadBytes(len)); 134 | } 135 | 136 | public T ReadEnum( ) 137 | { 138 | return (T)Enum.ToObject(typeof(T), ReadInt32()); 139 | } 140 | 141 | public T ReadStruct(DeserializeHandler handler) where T : class 142 | { 143 | var bound = _reader.ReadInt32(); 144 | 145 | var element = Activator.CreateInstance(); 146 | 147 | handler(element, new DataReader(this, _reader.BaseStream.Position + bound)); 148 | 149 | return element; 150 | } 151 | 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/DataReader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a230bd2f967c04edc8a969c6ac1d38da 3 | timeCreated: 1495681696 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4bbcb94158971484285f89d4b210f75b 3 | folderAsset: yes 4 | timeCreated: 1493802393 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/ExcelReaderEditorWindow.cs: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (c) 2017 sophieml1989@gmail.com 3 | ****************************************************************************/ 4 | 5 | using System.Collections.Generic; 6 | using UnityEngine; 7 | using UnityEditor; 8 | using System; 9 | using System.IO; 10 | using System.Text; 11 | using System.Text.RegularExpressions; 12 | 13 | namespace UExcelReader 14 | { 15 | public class ExcelReaderEditorWindow : EditorWindow 16 | { 17 | private const string VERSION = "1.0.0"; 18 | 19 | [Serializable] 20 | public class ExcelReaderPrefs 21 | { 22 | public string prefsName; 23 | public string combineClassName;//组合类名 24 | public List InputPaths = new List(); 25 | public string CodeOutputPath; 26 | public string DataOutputPath; 27 | 28 | public bool ExportJson; 29 | public bool ExportLua; 30 | 31 | public bool ExportPartialClass = true; 32 | 33 | public bool ShareClass = false; 34 | 35 | public string PartialCodeOutputPath 36 | { 37 | get { return CodeOutputPath.Replace(combineClassName, combineClassName + "Partial"); } 38 | } 39 | 40 | public bool DataPerfect 41 | { 42 | get { return InputPaths.Count > 0 && !string.IsNullOrEmpty(CodeOutputPath) && !string.IsNullOrEmpty(DataOutputPath); } 43 | } 44 | 45 | public List ShareClassDataOutputPaths() 46 | { 47 | List paths = new List(); 48 | foreach (var inputPath in InputPaths) 49 | { 50 | string fileName = Path.GetFileNameWithoutExtension(inputPath); 51 | paths.Add(Path.Combine(DataOutputPath, fileName + ".bytes")); 52 | } 53 | return paths; 54 | } 55 | 56 | public static string OptionalDataOutputPath(string oriOutputPath, string suffix) 57 | { 58 | return oriOutputPath.Replace(".bytes", string.Format("_{0}.{1}", suffix, suffix)); 59 | } 60 | } 61 | 62 | [Serializable] 63 | public class ExcelReaderPrefsFile 64 | { 65 | public List PrefsList = new List(); 66 | public string CacheInputDirectory; 67 | public string CacheCodeOutputDirectory; 68 | public string CacheDataOutputDirectory; 69 | 70 | public string Version; 71 | } 72 | 73 | private string EXCELREADER_PATH; 74 | private string SAVE_PATH; 75 | private string SHELL_PATH; 76 | 77 | private string DEFAULT_ROOT_PATH 78 | { 79 | get { return Application.dataPath; } 80 | } 81 | 82 | private string InputDirectory 83 | { 84 | get 85 | { 86 | return !string.IsNullOrEmpty(mPrefsFile.CacheInputDirectory) 87 | ? Path.GetFullPath(mPrefsFile.CacheInputDirectory) 88 | : DEFAULT_ROOT_PATH; 89 | } 90 | set { mPrefsFile.CacheInputDirectory = value; } 91 | } 92 | 93 | private string CodeOutputDirectory 94 | { 95 | get 96 | { 97 | return !string.IsNullOrEmpty(mPrefsFile.CacheCodeOutputDirectory) 98 | ? Path.GetFullPath(mPrefsFile.CacheCodeOutputDirectory) 99 | : DEFAULT_ROOT_PATH; 100 | } 101 | set { mPrefsFile.CacheCodeOutputDirectory = value; } 102 | } 103 | 104 | private string DataOutputDirectory 105 | { 106 | get 107 | { 108 | return !string.IsNullOrEmpty(mPrefsFile.CacheDataOutputDirectory) 109 | ? Path.GetFullPath(mPrefsFile.CacheDataOutputDirectory) 110 | : DEFAULT_ROOT_PATH; 111 | } 112 | set { mPrefsFile.CacheDataOutputDirectory = value; } 113 | } 114 | 115 | private ExcelReaderPrefsFile mPrefsFile; 116 | private List mPrefsDatas { get { return mPrefsFile.PrefsList; } } 117 | private List mPrefsNames; 118 | private ExcelReaderPrefs mSelectedPrefs; 119 | private int mSelectedPrefsIndex = -1; 120 | private bool mIsDirty = false; 121 | 122 | 123 | private Vector2 mScrollViewPos; 124 | 125 | private string outputStr = null; 126 | 127 | [MenuItem("UExcelReader/Open Edit Window")] 128 | static void ShowExcelReaderWindow() 129 | { 130 | ExcelReaderEditorWindow window = (ExcelReaderEditorWindow) EditorWindow.GetWindow(typeof(ExcelReaderEditorWindow), true); 131 | window.Show(); 132 | } 133 | 134 | void OnEnable() 135 | { 136 | string path = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this)); 137 | path = Path.GetDirectoryName(path); 138 | EXCELREADER_PATH = Path.GetDirectoryName(path); 139 | SHELL_PATH = Path.Combine(path, "generate_configs_bin_mac.sh"); 140 | SAVE_PATH = Path.Combine(path, "SaveInfo.json"); 141 | 142 | mPrefsNames = new List(); 143 | mSelectedPrefs = null; 144 | mSelectedPrefsIndex = -1; 145 | 146 | if (File.Exists(SAVE_PATH)) 147 | { 148 | mPrefsFile = (ExcelReaderPrefsFile) JsonUtility.FromJson(System.IO.File.ReadAllText(SAVE_PATH), typeof(ExcelReaderPrefsFile)); 149 | foreach (ExcelReaderPrefs prefs in mPrefsFile.PrefsList) 150 | { 151 | if (string.IsNullOrEmpty(prefs.prefsName)) 152 | prefs.prefsName = prefs.combineClassName; 153 | mPrefsNames.Add(prefs.prefsName); 154 | } 155 | } 156 | else 157 | { 158 | mPrefsFile = new ExcelReaderPrefsFile(); 159 | } 160 | 161 | mPrefsFile.Version = VERSION; 162 | } 163 | 164 | void SavePrefs() 165 | { 166 | System.IO.File.WriteAllText(SAVE_PATH, JsonUtility.ToJson(mPrefsFile, true)); 167 | } 168 | 169 | void OnGUI() 170 | { 171 | mIsDirty = false; 172 | 173 | mScrollViewPos = GUILayout.BeginScrollView(mScrollViewPos); 174 | 175 | GUILayout.Label("Excel Reader", EditorStyles.boldLabel); 176 | 177 | GUILayout.Space(5); 178 | 179 | GUILayout.BeginHorizontal(); 180 | GUILayout.Label("根路径", GUILayout.Width(120)); 181 | GUILayout.Box(Path.GetFullPath(DEFAULT_ROOT_PATH + "/../")); 182 | GUILayout.EndHorizontal(); 183 | GUILayout.Label("*建议xlsx放在此路径下的文件夹内"); 184 | 185 | GUILayout.Space(5); 186 | 187 | GUILayout.BeginHorizontal(); 188 | mSelectedPrefsIndex = EditorGUILayout.Popup("选择一组配置表", mSelectedPrefsIndex, mPrefsNames.ToArray(), GUILayout.Width(300)); 189 | if (mSelectedPrefsIndex >= 0 && mPrefsDatas.Count > mSelectedPrefsIndex) 190 | { 191 | mSelectedPrefs = mPrefsDatas[mSelectedPrefsIndex]; 192 | } 193 | 194 | if (GUILayout.Button("+", GUILayout.Width(40))) 195 | { 196 | mSelectedPrefs = new ExcelReaderPrefs(); 197 | mSelectedPrefs.combineClassName = "NewConfig" + mPrefsDatas.Count; 198 | mSelectedPrefs.prefsName = mSelectedPrefs.combineClassName; 199 | mPrefsDatas.Add(mSelectedPrefs); 200 | mPrefsNames.Add(mSelectedPrefs.prefsName); 201 | mIsDirty = true; 202 | mSelectedPrefsIndex = mPrefsNames.Count - 1; 203 | } 204 | 205 | if (GUILayout.Button("-", GUILayout.Width(40))) 206 | { 207 | if (mSelectedPrefs != null) 208 | { 209 | mPrefsDatas.RemoveAt(mSelectedPrefsIndex); 210 | mPrefsNames.RemoveAt(mSelectedPrefsIndex); 211 | mSelectedPrefs = null; 212 | mIsDirty = true; 213 | } 214 | } 215 | 216 | GUILayout.EndHorizontal(); 217 | 218 | if (mSelectedPrefs != null) 219 | { 220 | EditSelectPrefs(); 221 | } 222 | 223 | //全部导出 224 | if (GUILayout.Button("全部导出~.~", GUILayout.Width(100))) 225 | { 226 | ExportAll(); 227 | } 228 | 229 | if (!string.IsNullOrEmpty(outputStr)) 230 | { 231 | GUILayout.Label("输出:"); 232 | EditorGUILayout.HelpBox(outputStr, MessageType.Info); 233 | } 234 | 235 | GUILayout.EndScrollView(); 236 | 237 | if (mIsDirty) 238 | { 239 | SavePrefs(); 240 | } 241 | } 242 | 243 | string AdaptPrefsName(int index, string prefsName) 244 | { 245 | Regex rgx = new Regex(@"^" + prefsName + @"-\d*$"); 246 | int i = -1; 247 | 248 | for (int j = 0; j < mPrefsNames.Count; j++) 249 | { 250 | if (j == index) continue; 251 | string s = mPrefsNames[j]; 252 | if (s.Equals(prefsName)) 253 | { 254 | if (i == -1) 255 | i = 0; 256 | } 257 | else if (rgx.IsMatch(s)) 258 | { 259 | int suffixid = int.Parse(s.Substring(prefsName.Length + 1)); 260 | if (suffixid > i) i = suffixid; 261 | } 262 | } 263 | if (i >= 0) 264 | { 265 | ++i; 266 | return prefsName + "-" + i; 267 | } 268 | return prefsName; 269 | } 270 | 271 | void EditSelectPrefs() 272 | { 273 | GUILayout.BeginVertical(); 274 | 275 | GUILayout.BeginHorizontal(); 276 | 277 | string classname = EditorGUILayout.TextField("组合类名: ", mSelectedPrefs.combineClassName, GUILayout.Width(300)); 278 | if (!string.IsNullOrEmpty(classname) && !classname.Equals(mSelectedPrefs.combineClassName)) 279 | { 280 | mSelectedPrefs.combineClassName = classname; 281 | mSelectedPrefs.prefsName = AdaptPrefsName(mSelectedPrefsIndex, classname); 282 | mPrefsNames[mSelectedPrefsIndex] = mSelectedPrefs.prefsName; 283 | mIsDirty = true; 284 | } 285 | 286 | bool shareClass = GUILayout.Toggle(mSelectedPrefs.ShareClass, "是:所有配置表共用该类;否:所有配置表生成的类被该类包裹。", GUILayout.Width(400)); 287 | if (shareClass != mSelectedPrefs.ShareClass) 288 | { 289 | mSelectedPrefs.ShareClass = shareClass; 290 | mSelectedPrefs.DataOutputPath = null; 291 | } 292 | GUILayout.EndHorizontal(); 293 | 294 | GUILayout.BeginHorizontal(); 295 | GUILayout.Label("选择配置表", GUILayout.Width(120)); 296 | if (GUILayout.Button("...", GUILayout.Width(40))) 297 | { 298 | string filePath = EditorUtility.OpenFilePanel("Select Excel File", InputDirectory, "xlsx"); 299 | if (!string.IsNullOrEmpty(filePath)) 300 | { 301 | filePath = MakeRelativePath(filePath, DEFAULT_ROOT_PATH); 302 | mSelectedPrefs.InputPaths.Add(filePath); 303 | InputDirectory = Path.GetDirectoryName(filePath); 304 | mIsDirty = true; 305 | } 306 | } 307 | 308 | if (mSelectedPrefs.InputPaths.Count > 0) 309 | { 310 | GUILayout.BeginVertical(); 311 | for (int i = 0; i < mSelectedPrefs.InputPaths.Count; i++) 312 | { 313 | GUILayout.BeginHorizontal(); 314 | GUILayout.Box(mSelectedPrefs.InputPaths[i]); 315 | if (GUILayout.Button("Delete", GUILayout.Width(50))) 316 | { 317 | mSelectedPrefs.InputPaths.RemoveAt(i); 318 | mIsDirty = true; 319 | break; 320 | } 321 | GUILayout.EndHorizontal(); 322 | } 323 | GUILayout.EndVertical(); 324 | } 325 | GUILayout.EndHorizontal(); 326 | 327 | GUILayout.BeginHorizontal(); 328 | GUILayout.Label("选择代码输出路径", GUILayout.Width(120)); 329 | if (GUILayout.Button("...", GUILayout.Width(40))) 330 | { 331 | string filePath = EditorUtility.SaveFilePanel("Select Code Output", CodeOutputDirectory, mSelectedPrefs.combineClassName, "cs"); 332 | if (!string.IsNullOrEmpty(filePath)) 333 | { 334 | mSelectedPrefs.CodeOutputPath = MakeRelativePath(filePath, DEFAULT_ROOT_PATH); 335 | CodeOutputDirectory = Path.GetDirectoryName(mSelectedPrefs.CodeOutputPath); 336 | mIsDirty = true; 337 | } 338 | } 339 | if (!string.IsNullOrEmpty(mSelectedPrefs.CodeOutputPath)) 340 | { 341 | //make sure file name equals to combine name 342 | string fileName = Path.GetFileName(mSelectedPrefs.CodeOutputPath); 343 | string rightFileName = mSelectedPrefs.combineClassName + ".cs"; 344 | if (!fileName.Equals(rightFileName)) 345 | { 346 | mSelectedPrefs.CodeOutputPath = mSelectedPrefs.CodeOutputPath.Replace(fileName, rightFileName); 347 | } 348 | GUILayout.Box(mSelectedPrefs.CodeOutputPath); 349 | } 350 | GUILayout.EndHorizontal(); 351 | 352 | GUILayout.BeginHorizontal(); 353 | GUILayout.Label("选择.bytes输出路径", GUILayout.Width(120)); 354 | if (GUILayout.Button("...", GUILayout.Width(40))) 355 | { 356 | if (!mSelectedPrefs.ShareClass) 357 | { 358 | string filePath = EditorUtility.SaveFilePanel("Select Data Output", DataOutputDirectory, mSelectedPrefs.combineClassName, "bytes"); 359 | if (!string.IsNullOrEmpty(filePath)) 360 | { 361 | mSelectedPrefs.DataOutputPath = MakeRelativePath(filePath, DEFAULT_ROOT_PATH); 362 | DataOutputDirectory = Path.GetDirectoryName(mSelectedPrefs.DataOutputPath); 363 | mIsDirty = true; 364 | } 365 | } 366 | else 367 | { 368 | string folderPath = EditorUtility.SaveFolderPanel("Select Data Output Folder", DataOutputDirectory, ""); 369 | if (!string.IsNullOrEmpty(folderPath)) 370 | { 371 | mSelectedPrefs.DataOutputPath = MakeRelativePath(folderPath, DEFAULT_ROOT_PATH); 372 | DataOutputDirectory = Path.GetDirectoryName(mSelectedPrefs.DataOutputPath); 373 | mIsDirty = true; 374 | } 375 | } 376 | } 377 | if (!string.IsNullOrEmpty(mSelectedPrefs.DataOutputPath)) 378 | { 379 | GUILayout.Box(mSelectedPrefs.DataOutputPath); 380 | } 381 | GUILayout.EndHorizontal(); 382 | 383 | GUILayout.BeginHorizontal(); 384 | GUILayout.Label("另外导出选项:", GUILayout.Width(120)); 385 | bool exportPartial = GUILayout.Toggle(mSelectedPrefs.ExportPartialClass, "partial c# class", GUILayout.Width(120)); 386 | if (exportPartial != mSelectedPrefs.ExportPartialClass) 387 | { 388 | mSelectedPrefs.ExportPartialClass = exportPartial; 389 | mIsDirty = true; 390 | } 391 | bool exportJson = GUILayout.Toggle(mSelectedPrefs.ExportJson, "json", GUILayout.Width(60)); 392 | if (exportJson != mSelectedPrefs.ExportJson) 393 | { 394 | mSelectedPrefs.ExportJson = exportJson; 395 | mIsDirty = true; 396 | } 397 | bool exportLua = GUILayout.Toggle(mSelectedPrefs.ExportLua, "lua", GUILayout.Width(60)); 398 | if (exportLua != mSelectedPrefs.ExportLua) 399 | { 400 | mSelectedPrefs.ExportLua = exportLua; 401 | mIsDirty = true; 402 | } 403 | GUILayout.EndHorizontal(); 404 | 405 | if (GUILayout.Button("导出*.*", GUILayout.Width(100))) 406 | { 407 | if (mSelectedPrefs.DataPerfect) 408 | { 409 | outputStr = ""; 410 | Export(mSelectedPrefs); 411 | WriteConfigCollectionClass(); 412 | AssetDatabase.Refresh(); 413 | } 414 | else 415 | { 416 | EditorUtility.DisplayDialog("", "请完善数据!", "OK"); 417 | } 418 | } 419 | 420 | GUILayout.EndVertical(); 421 | } 422 | 423 | void Export(ExcelReaderPrefs xlsxPrefs) 424 | { 425 | Func buildArgs = (dataOutput, input) => 426 | { 427 | StringBuilder sbArgs = new StringBuilder(); 428 | 429 | //0. shell 430 | sbArgs.Append(SHELL_PATH); 431 | //1. combine name 432 | sbArgs.AppendFormat(" \"{0}\"", xlsxPrefs.combineClassName); 433 | //2. code output 434 | sbArgs.AppendFormat(" \"{0}\"", Path.GetFullPath(xlsxPrefs.CodeOutputPath)); 435 | //3. data output 436 | sbArgs.AppendFormat(" \"{0}\"", dataOutput); 437 | //4. json output 438 | sbArgs.AppendFormat(" \"{0}\"", xlsxPrefs.ExportJson ? Path.GetFullPath(ExcelReaderPrefs.OptionalDataOutputPath(dataOutput, "json")) : "null"); 439 | //5. lua output 440 | sbArgs.AppendFormat(" \"{0}\"", xlsxPrefs.ExportLua ? Path.GetFullPath(ExcelReaderPrefs.OptionalDataOutputPath(dataOutput, "lua")) : "null"); 441 | //6. xlsx input 442 | sbArgs.Append(input); 443 | 444 | return sbArgs.ToString(); 445 | }; 446 | 447 | //shell tabtoy 448 | Action shellProcess = (args) => 449 | { 450 | System.Diagnostics.Process process = new System.Diagnostics.Process(); 451 | process.StartInfo = new System.Diagnostics.ProcessStartInfo("/bin/bash", args); 452 | process.StartInfo.UseShellExecute = false; 453 | process.StartInfo.RedirectStandardOutput = true; 454 | process.StartInfo.RedirectStandardError = true; 455 | process.Start(); 456 | 457 | outputStr += process.StandardOutput.ReadToEnd() + "\n"; 458 | process.WaitForExit(); 459 | process.Close(); 460 | }; 461 | 462 | if (!xlsxPrefs.ShareClass) 463 | { 464 | StringBuilder inputSb = new StringBuilder(); 465 | for (int i = 0; i < xlsxPrefs.InputPaths.Count; i++) 466 | { 467 | inputSb.AppendFormat(" \"{0}\"", Path.GetFullPath(xlsxPrefs.InputPaths[i])); 468 | } 469 | string args = buildArgs(Path.GetFullPath(xlsxPrefs.DataOutputPath), inputSb.ToString()); 470 | //Debug.Log(">>>>>> shell args: " + args); 471 | shellProcess(args); 472 | } 473 | else 474 | { 475 | List dataOutputs = xlsxPrefs.ShareClassDataOutputPaths(); 476 | for (int i = 0; i < xlsxPrefs.InputPaths.Count; i++) 477 | { 478 | string args = buildArgs(Path.GetFullPath(dataOutputs[i]), string.Format(" \"{0}\"", Path.GetFullPath(xlsxPrefs.InputPaths[i]))); 479 | //Debug.Log(">>>>>> shell args: " + args); 480 | shellProcess(args); 481 | } 482 | } 483 | 484 | //export partial class 485 | if (xlsxPrefs.ExportPartialClass) 486 | { 487 | string partialClassPath = Path.GetFullPath(xlsxPrefs.PartialCodeOutputPath); 488 | if (!File.Exists(partialClassPath)) 489 | { 490 | //only export once 491 | string str = System.IO.File.ReadAllText(Path.GetFullPath(xlsxPrefs.CodeOutputPath)); 492 | if (!string.IsNullOrEmpty(str)) 493 | { 494 | string namespaceStr = str.Substring(str.IndexOf("namespace"), str.IndexOf("{") - str.IndexOf("namespace")); 495 | namespaceStr = namespaceStr.Trim(); 496 | string[] strs = namespaceStr.Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries); 497 | namespaceStr = strs[1]; 498 | 499 | StringBuilder sb = new StringBuilder(); 500 | sb.Append("// Generated by Putao.PTXlsxReader only once\n"); 501 | sb.Append("// Free to edit\n\n"); 502 | sb.AppendFormat("namespace {0}\n", namespaceStr); 503 | sb.Append("{\n"); 504 | sb.AppendFormat("\tpublic partial class {0}\n", xlsxPrefs.combineClassName); 505 | sb.Append("\t{\n\n"); 506 | sb.Append("\t}\n"); 507 | sb.Append("}"); 508 | 509 | System.IO.File.WriteAllText(partialClassPath, sb.ToString()); 510 | } 511 | } 512 | } 513 | } 514 | 515 | void ExportAll() 516 | { 517 | outputStr = ""; 518 | StringBuilder sb = new StringBuilder(); 519 | foreach (ExcelReaderPrefs xlsxPrefs in mPrefsDatas) 520 | { 521 | if (xlsxPrefs.DataPerfect) 522 | { 523 | Export(xlsxPrefs); 524 | } 525 | else 526 | { 527 | sb.Append("\n" + xlsxPrefs.combineClassName); 528 | } 529 | } 530 | 531 | WriteConfigCollectionClass(); 532 | AssetDatabase.Refresh(); 533 | if (!string.IsNullOrEmpty(sb.ToString())) 534 | { 535 | EditorUtility.DisplayDialog("", "请完善数据!" + sb.ToString(), "OK"); 536 | } 537 | } 538 | 539 | void WriteConfigCollectionClass() 540 | { 541 | string path = Path.Combine(EXCELREADER_PATH, "ConfigCollection.cs"); 542 | string text = System.IO.File.ReadAllText(path); 543 | 544 | int startIndex = text.IndexOf("//start") + "//start".Length; 545 | int endIndex = text.IndexOf("//end"); 546 | string replaceStr = text.Substring(startIndex, endIndex - startIndex); 547 | string replaceStrNew = "\r\n"; 548 | foreach (var prefsData in mPrefsDatas) 549 | { 550 | Regex rgx = new Regex(@"^" + prefsData.combineClassName + @"-\d*$"); 551 | if (prefsData.DataPerfect && !rgx.IsMatch(prefsData.prefsName)) 552 | replaceStrNew += "\t\t\t typeof(" + prefsData.combineClassName + "),\n"; 553 | } 554 | replaceStrNew += "\t\t\t"; 555 | text = text.Replace(replaceStr, replaceStrNew); 556 | 557 | System.IO.File.WriteAllText(path, text); 558 | } 559 | 560 | static string MakeRelativePath(string filePath, string referencePath) 561 | { 562 | var fileUri = new Uri(filePath); 563 | Uri referenceUri = new Uri(referencePath); 564 | string relativePath = Uri.UnescapeDataString(referenceUri.MakeRelativeUri(fileUri).ToString().Replace('/', Path.DirectorySeparatorChar)); 565 | return relativePath; 566 | } 567 | } 568 | } 569 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/ExcelReaderEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58348d13234d84352995844d634db3c8 3 | timeCreated: 1492417996 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/SaveInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "PrefsList": [ 3 | { 4 | "prefsName": "WordSleepConfig", 5 | "combineClassName": "WordSleepConfig", 6 | "InputPaths": [ 7 | "Assets/Examples/WordSleep.xlsx" 8 | ], 9 | "CodeOutputPath": "Assets/Examples/CodeOutput/WordSleepConfig.cs", 10 | "DataOutputPath": "Assets/Examples/DataOutput/WordSleepConfig.bytes", 11 | "ExportJson": true, 12 | "ExportLua": true, 13 | "ExportPartialClass": true, 14 | "ShareClass": false 15 | }, 16 | { 17 | "prefsName": "ParentFAQConfig", 18 | "combineClassName": "ParentFAQConfig", 19 | "InputPaths": [ 20 | "Assets/Examples/ParentFAQ.xlsx", 21 | "Assets/Examples/ParentFAQ_en.xlsx" 22 | ], 23 | "CodeOutputPath": "Assets/Examples/CodeOutput/ParentFAQConfig.cs", 24 | "DataOutputPath": "Assets/Examples/DataOutput", 25 | "ExportJson": false, 26 | "ExportLua": false, 27 | "ExportPartialClass": false, 28 | "ShareClass": true 29 | } 30 | ], 31 | "CacheInputDirectory": "Assets/Examples", 32 | "CacheCodeOutputDirectory": "Assets/Examples/CodeOutput", 33 | "CacheDataOutputDirectory": "Assets/Examples", 34 | "Version": "1.0.0" 35 | } -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/SaveInfo.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 109971c2a2e67404e929a94cafd4803c 3 | timeCreated: 1510733547 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/generate_configs_bin_mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | 5 | case $OSTYPE in 6 | darwin*) 7 | OS=macosx 8 | ;; 9 | linux*) 10 | OS=linux 11 | ;; 12 | *) 13 | echo "Unsupported OS: $OSTYPE" > /dev/stderr 14 | exit 1 15 | ;; 16 | esac 17 | 18 | uname_m="$(uname -m)" 19 | case "$uname_m" in 20 | x86_64) 21 | ARCH="x64" 22 | ;; 23 | i686) 24 | ARCH="x86" 25 | ;; 26 | *) 27 | echo "Unsupported Arch: $uname_m" > /dev/stderr 28 | exit 1 29 | ;; 30 | esac 31 | 32 | TABTOY="$DIR/tabtoy/${OS}_${ARCH}/tabtoy" 33 | chmod +x "$TABTOY" 34 | 35 | exportJson=true 36 | exportLua=true 37 | 38 | if [ $4 = "null" ]; then 39 | exportJson=false 40 | fi 41 | 42 | if [ $5 = "null" ]; then 43 | exportLua=false 44 | fi 45 | 46 | if [[ $exportJson = true && $exportLua = true ]]; then 47 | "$TABTOY" -mode=exportorv2 -combinename=$1 -csharp_out="$2" -binary_out="$3" -json_out="$4" -lua_out="$5" "${@:6}" 48 | fi 49 | 50 | if [[ $exportJson = true && $exportLua = false ]]; then 51 | "$TABTOY" -mode=exportorv2 -combinename=$1 -csharp_out="$2" -binary_out="$3" -json_out="$4" "${@:6}" 52 | fi 53 | 54 | if [[ $exportJson = false && $exportLua = true ]]; then 55 | "$TABTOY" -mode=exportorv2 -combinename=$1 -csharp_out="$2" -binary_out="$3" -lua_out="$5" "${@:6}" 56 | fi 57 | 58 | if [[ $exportJson = false && $exportLua = false ]]; then 59 | "$TABTOY" -mode=exportorv2 -combinename=$1 -csharp_out="$2" -binary_out="$3" "${@:6}" 60 | fi 61 | 62 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/generate_configs_bin_mac.sh.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34fef997be6c5434eb5dc64507497aee 3 | timeCreated: 1493802716 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27b0192c16b3c45cd98d712b8cd42ea6 3 | folderAsset: yes 4 | timeCreated: 1493802716 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy/macosx_x64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1601b0008a9114ecea62be0dc8084a94 3 | folderAsset: yes 4 | timeCreated: 1493802716 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy/macosx_x64/tabtoy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/Assets/UExcelReader/Editor/tabtoy/macosx_x64/tabtoy -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy/macosx_x64/tabtoy.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43a4c151427e1455da534272e34a22cf 3 | timeCreated: 1495681518 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy/windows_x64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e602b0f28f658477f94f89fc88dd0b63 3 | folderAsset: yes 4 | timeCreated: 1493802716 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy/windows_x64/tabtoy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/Assets/UExcelReader/Editor/tabtoy/windows_x64/tabtoy.exe -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy/windows_x64/tabtoy.exe.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f20da269887041a0811269e5c90051f 3 | timeCreated: 1495681525 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy/windows_x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 124896482e5304785bb5e32f1388f241 3 | folderAsset: yes 4 | timeCreated: 1493802716 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy/windows_x86/tabtoy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/Assets/UExcelReader/Editor/tabtoy/windows_x86/tabtoy.exe -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Editor/tabtoy/windows_x86/tabtoy.exe.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 76545591063f146c09bd507e33828c96 3 | timeCreated: 1495681528 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Logger.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics; 3 | 4 | namespace tabtoy 5 | { 6 | public enum LogLevel 7 | { 8 | Debug, 9 | Info, 10 | Warnning, 11 | Error, 12 | } 13 | 14 | public class LogTarget 15 | { 16 | public virtual void WriteLog(LogLevel level, string msg) 17 | { 18 | 19 | } 20 | 21 | public static string LevelToString( LogLevel level ) 22 | { 23 | switch (level) 24 | { 25 | case LogLevel.Debug: 26 | return "tabtoy [Debug] "; 27 | case LogLevel.Info: 28 | return "tabtoy [Info] "; 29 | case LogLevel.Warnning: 30 | return "tabtoy [Warn] "; 31 | case LogLevel.Error: 32 | return "tabtoy [Error] "; 33 | } 34 | 35 | return "tabtoy [Unknown] "; 36 | } 37 | } 38 | 39 | 40 | 41 | public class DebuggerTarget : LogTarget 42 | { 43 | public override void WriteLog(LogLevel level, string msg) 44 | { 45 | Debug.WriteLine( LevelToString(level) + msg ); 46 | } 47 | } 48 | 49 | 50 | public class Logger 51 | { 52 | List _targets = new List(); 53 | 54 | public void AddTarget(LogTarget tgt) 55 | { 56 | _targets.Add(tgt); 57 | } 58 | 59 | public void ClearTargets( ) 60 | { 61 | _targets.Clear(); 62 | } 63 | 64 | void WriteLine(LogLevel level, string msg) 65 | { 66 | foreach(var tgt in _targets ) 67 | { 68 | tgt.WriteLog(level, msg); 69 | } 70 | } 71 | 72 | public void DebugLine(string fmt, params object[] args) 73 | { 74 | var text = string.Format(fmt, args); 75 | 76 | WriteLine(LogLevel.Debug, text); 77 | } 78 | 79 | public void InfoLine(string fmt, params object[] args) 80 | { 81 | var text = string.Format(fmt, args); 82 | 83 | WriteLine(LogLevel.Info, text); 84 | } 85 | 86 | public void WarningLine(string fmt, params object[] args) 87 | { 88 | var text = string.Format(fmt, args); 89 | 90 | WriteLine(LogLevel.Warnning, text); 91 | } 92 | 93 | public void ErrorLine(string fmt, params object[] args) 94 | { 95 | var text = string.Format(fmt, args); 96 | 97 | WriteLine(LogLevel.Error, text); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Example/Assets/UExcelReader/Logger.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5293c98c117f443c5b91733b3e0f595c 3 | timeCreated: 1495681696 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Example/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /Example/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/Example/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Bell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## UExcelReader 2 | 3 | [Tabtoy](https://github.com/davyxu/tabtoy) 是一个广受欢迎的跨平台Excel导出工具,支持导出多种格式的数据,并且可以在配置表中定义对象。于是我将其移植到Unity项目中,并且增加了可视化编辑,以及加载方法,使其在Unity中更方便使用。 4 | 5 | ### 使用方法 6 | 7 | 可以参考Example,用Unity打开。 8 | 9 | 1. 将**UnityPackage.unitypackage**导入项目中。 10 | 11 | 2. 点击**UExcelReader/Open Edit Window**打开编辑页面,如下: 12 | 13 | ![](https://github.com/imagicbell/UExcelReader/blob/master/README/editor_window.png) 14 | 15 | 16 | 17 | ### 功能 18 | 19 | 1. 数据导出支持:bytes, json, lua; 20 | 21 | 2. 支持多个具有相同格式的配置表share同一个类,见Example中的ParentFAQConfig。 22 | 23 | 3. 数据加载在`ConfigManager.cs`,使用方法: 24 | 25 | ```c# 26 | //1. 游戏开始时,在下载完assetbundle后,加载 27 | ConfigManager.Instance.Load(); 28 | 29 | //2. 应用层获取配置数据 30 | WordSleepConfig cfg = ConfigManager.Instance.GetConfig(); 31 | Debug.Log(">>>>>> config: " + cfg.WordSleep.Count); 32 | ``` 33 | 34 | ### 限制 35 | 暂时只支持Mac,后续会支持windows. 36 | 37 | 38 | ### 特别感谢 39 | 40 | [Tabtoy](https://github.com/davyxu/tabtoy) 41 | -------------------------------------------------------------------------------- /README/editor_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/README/editor_window.png -------------------------------------------------------------------------------- /UnityPackage.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imagicbell/UExcelReader/228c952a3025d9a1f753cf5ee1ef606e95b6f0a9/UnityPackage.unitypackage --------------------------------------------------------------------------------