123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using GFGGame;
- using UnityEngine;
- namespace GFGEditor
- {
- public class ShopScanner
- {
- //计算每个副本的关卡数
- private static Dictionary<int, int> levelCountDIc = new Dictionary<int, int>();
- // private static string[] _shopItemType = new string[] { "推荐", "发型", "连衣裙", "内搭", "上衣", "下装", "外套", "袜子", "鞋子", "饰品" };
- private static string[] _shopItemType = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
- public static void StartScan()
- {
- WriteClothingShop();
- WriteCJShop();
- WriteCJAShop();
- }
- public static void WriteClothingShop()
- {
- Dictionary<int, string> _typeIndexDic = new Dictionary<int, string>();
- SQLiteHelper.Instance.OpenConnection();
- try
- {
- string typeIndex = "";
- int itemId;
- int id;
- var reader = SQLiteHelper.Instance.ReadFullTable("ShopCfgClothingArray");
- while (reader.Read())
- {
- typeIndex = reader["_typeIndex"].ToString();
- itemId = int.Parse(reader["_itemId"].ToString());
- id = int.Parse(reader["_id"].ToString());
- int count;
- if (Array.IndexOf(_shopItemType, typeIndex) >= 0)
- {
- count = Array.IndexOf(_shopItemType, typeIndex);
- }
- else
- {
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
- string itemType = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType).type.ToString();
- if (Array.IndexOf(_shopItemType, itemType) >= 0)
- {
- count = Array.IndexOf(_shopItemType, itemType);
- }
- else
- {
- count = _shopItemType.Length - 1;
- }
- }
- _typeIndexDic.Add(id, count.ToString());
- }
- }
- catch (System.Exception e)
- {
- ET.Log.Error(e);
- }
- finally
- {
- SQLiteHelper.Instance.CloseConnection();
- }
- SQLiteHelper.Instance.OpenConnection();
- try
- {
- ICollection keys = _typeIndexDic.Keys;
- foreach (int key in keys)
- {
- var names = new string[] { "typeIndex" };
- var values = new string[] { "" + _typeIndexDic[key] };
- SQLiteHelper.Instance.UpdateValues(nameof(ShopCfgClothingArray), names, values, "id", key.ToString());
- }
- }
- catch (Exception e)
- {
- ET.Log.Error(e.ToString());
- }
- finally
- {
- SQLiteHelper.Instance.CloseConnection();
- }
- }
- public static void WriteCJShop()
- {
- Dictionary<int, string> _typeIndexDic = new Dictionary<int, string>();
- SQLiteHelper.Instance.OpenConnection();
- try
- {
- string typeIndex = "";
- int itemId;
- int id;
- var reader = SQLiteHelper.Instance.ReadFullTable("ShopCfgCJArray");
- while (reader.Read())
- {
- typeIndex = reader["_typeIndex"].ToString();
- itemId = int.Parse(reader["_itemId"].ToString());
- id = int.Parse(reader["_id"].ToString());
- int count;
- if (Array.IndexOf(_shopItemType, typeIndex) >= 0)
- {
- count = Array.IndexOf(_shopItemType, typeIndex);
- }
- else
- {
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
- string itemType = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType).type.ToString();
- if (Array.IndexOf(_shopItemType, itemType) >= 0)
- {
- count = Array.IndexOf(_shopItemType, itemType);
- }
- else
- {
- count = _shopItemType.Length - 1;
- }
- }
- _typeIndexDic.Add(id, count.ToString());
- }
- }
- catch (System.Exception e)
- {
- ET.Log.Error(e);
- }
- finally
- {
- SQLiteHelper.Instance.CloseConnection();
- }
- SQLiteHelper.Instance.OpenConnection();
- try
- {
- ICollection keys = _typeIndexDic.Keys;
- foreach (int key in keys)
- {
- var names = new string[] { "typeIndex" };
- var values = new string[] { "" + _typeIndexDic[key] };
- SQLiteHelper.Instance.UpdateValues(nameof(ShopCfgCJArray), names, values, "id", key.ToString());
- }
- }
- catch (Exception e)
- {
- ET.Log.Error(e.ToString());
- }
- finally
- {
- SQLiteHelper.Instance.CloseConnection();
- }
- }
- public static void WriteCJAShop()
- {
- Dictionary<int, string> _typeIndexDic = new Dictionary<int, string>();
- SQLiteHelper.Instance.OpenConnection();
- try
- {
- string typeIndex = "";
- int itemId;
- int id;
- var reader = SQLiteHelper.Instance.ReadFullTable("ShopCfgCJAArray");
- while (reader.Read())
- {
- typeIndex = reader["_typeIndex"].ToString();
- itemId = int.Parse(reader["_itemId"].ToString());
- id = int.Parse(reader["_id"].ToString());
- int count;
- if (Array.IndexOf(_shopItemType, typeIndex) >= 0)
- {
- count = Array.IndexOf(_shopItemType, typeIndex);
- }
- else
- {
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
- string itemType = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType).type.ToString();
- if (Array.IndexOf(_shopItemType, itemType) >= 0)
- {
- count = Array.IndexOf(_shopItemType, itemType);
- }
- else
- {
- count = _shopItemType.Length - 1;
- }
- }
- _typeIndexDic.Add(id, count.ToString());
- }
- }
- catch (System.Exception e)
- {
- ET.Log.Error(e);
- }
- finally
- {
- SQLiteHelper.Instance.CloseConnection();
- }
- SQLiteHelper.Instance.OpenConnection();
- try
- {
- ICollection keys = _typeIndexDic.Keys;
- foreach (int key in keys)
- {
- var names = new string[] { "typeIndex" };
- var values = new string[] { "" + _typeIndexDic[key] };
- SQLiteHelper.Instance.UpdateValues(nameof(ShopCfgCJAArray), names, values, "id", key.ToString());
- }
- }
- catch (Exception e)
- {
- ET.Log.Error(e.ToString());
- }
- finally
- {
- SQLiteHelper.Instance.CloseConnection();
- }
- }
- }
- }
|