| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEditor; |
| | | using System.IO; |
| | | using System.Text; |
| | | |
| | | public class AssetsPostProcessor : AssetPostprocessor |
| | | { |
| | | |
| | | static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) |
| | | { |
| | | foreach (string str in importedAssets) |
| | | { |
| | | OnAssetImported(str); |
| | | } |
| | | foreach (string str in deletedAssets) |
| | | { |
| | | } |
| | | |
| | | for (int i = 0; i < movedAssets.Length; i++) |
| | | { |
| | | } |
| | | } |
| | | |
| | | static void OnAssetImported(string assetPath) |
| | | { |
| | | switch (assetPath) |
| | | { |
| | | case "Assets/ResourcesOut/Refdata/Config/Item.txt": |
| | | CreateGemItemConfig(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | static void CreateGemItemConfig() |
| | | { |
| | | var gemItemConfigPath = Application.dataPath + "/ResourcesOut/Refdata/Config/GemItem.txt"; |
| | | var lines = new List<string>(); |
| | | lines.Add("int\tint"); |
| | | lines.Add("ID\tType"); |
| | | lines.Add("唯一标识\t类型"); |
| | | ItemConfig.Init(true); |
| | | var keys = ItemConfig.GetKeys(); |
| | | foreach (var key in keys) |
| | | { |
| | | var config = ItemConfig.Get(key); |
| | | if ((config.Type == 25 || config.Type == 140) && config.Effect1 == 225) |
| | | { |
| | | lines.Add(StringUtility.Contact(config.ID, '\t', config.Type)); |
| | | } |
| | | } |
| | | |
| | | if (File.Exists(gemItemConfigPath)) |
| | | { |
| | | File.Delete(gemItemConfigPath); |
| | | } |
| | | File.WriteAllLines(gemItemConfigPath, lines.ToArray(), Encoding.UTF8); |
| | | } |
| | | |
| | | } |