LeagueScanner.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using GFGGame;
  7. using UnityEngine;
  8. namespace GFGEditor
  9. {
  10. public class LeagueScanner
  11. {
  12. private static Dictionary<int, int> skilCountDic = new Dictionary<int, int>();
  13. private static Dictionary<int, int> layerCountDic = new Dictionary<int, int>();
  14. private static string[] names = { "选茶", "备器", "择水", "取火", "候汤", "习茶" };
  15. public static void StartScan()
  16. {
  17. skilCountDic.Clear();
  18. layerCountDic.Clear();
  19. int typeValue = 1;
  20. List<LeagueSkillCfg> skillCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytype(typeValue);
  21. while (skillCfgs != null && skillCfgs.Count > 0)
  22. {
  23. skilCountDic[typeValue] = skillCfgs.Count;
  24. layerCountDic[typeValue] = 0;
  25. int layer = 1;
  26. List<LeagueSkillCfg> skillLayerCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytypeAndlayer(typeValue, layer);
  27. while (skillLayerCfgs != null && skillLayerCfgs.Count > 0)
  28. {
  29. layerCountDic[typeValue] = layer;
  30. layer++;
  31. skillLayerCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytypeAndlayer(typeValue, layer);
  32. }
  33. typeValue++;
  34. skillCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytype(typeValue);
  35. }
  36. SQLiteHelper.Instance.OpenConnection();
  37. try
  38. {
  39. ICollection<int> keys = layerCountDic.Keys;
  40. foreach (int key in skilCountDic.Keys)
  41. {
  42. string type = key.ToString();
  43. string layerCount = layerCountDic[key].ToString();
  44. string skillCount = skilCountDic[key].ToString();
  45. var names = new string[] { "layerCount", "skillCount" };
  46. var values = new string[] { layerCount, skillCount };
  47. SQLiteHelper.Instance.UpdateValues(nameof(LeagueSkillCountCfgArray), names, values, "type", key.ToString());
  48. // SQLiteHelper.Instance.InsertValues(nameof(LeagueSkillCountCfgArray), values);
  49. }
  50. }
  51. catch (Exception e)
  52. {
  53. ET.Log.Error(e.ToString());
  54. }
  55. finally
  56. {
  57. SQLiteHelper.Instance.CloseConnection();
  58. }
  59. }
  60. }
  61. }