LeagueScanner.cs 2.3 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. public static void StartScan()
  15. {
  16. skilCountDic.Clear();
  17. layerCountDic.Clear();
  18. int typeValue = 1;
  19. List<LeagueSkillCfg> skillCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytype(typeValue);
  20. while (skillCfgs != null && skillCfgs.Count > 0)
  21. {
  22. skilCountDic[typeValue] = skillCfgs.Count;
  23. layerCountDic[typeValue] = 0;
  24. int layer = 1;
  25. List<LeagueSkillCfg> skillLayerCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytypeAndlayer(typeValue, layer);
  26. while (skillLayerCfgs != null && skillLayerCfgs.Count > 0)
  27. {
  28. layerCountDic[typeValue] = layer;
  29. layer++;
  30. skillLayerCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytypeAndlayer(typeValue, layer);
  31. }
  32. typeValue++;
  33. skillCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytype(typeValue);
  34. }
  35. SQLiteHelper.Instance.OpenConnection();
  36. try
  37. {
  38. ICollection<int> keys = layerCountDic.Keys;
  39. foreach (int key in skilCountDic.Keys)
  40. {
  41. string type = key.ToString();
  42. string layerCount = layerCountDic[key].ToString();
  43. string skillCount = skilCountDic[key].ToString();
  44. var values = new string[] { type, layerCount, skillCount };
  45. // SQLiteHelper.Instance.UpdateValues(nameof(LeagueSkillCountCfgArray), names, values, "type", key.ToString());
  46. SQLiteHelper.Instance.InsertValues(nameof(LeagueSkillCountCfgArray), values);
  47. }
  48. }
  49. catch (Exception e)
  50. {
  51. ET.Log.Error(e.ToString());
  52. }
  53. finally
  54. {
  55. SQLiteHelper.Instance.CloseConnection();
  56. }
  57. }
  58. }
  59. }