123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using GFGGame;
- using UnityEngine;
- namespace GFGEditor
- {
- public class ShopScanner
- {
- // private static string[] _shopItemType = new string[] { "推荐", "发型", "连衣裙", "内搭", "上衣", "下装", "外套", "袜子", "鞋子", "饰品" };
- private static string[] _shopItemType = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
- //[背景,人物,道具,边框,滤镜]
- private static string[] _galleryShopItemType = new string[] { "0", "1", "2", "3", "4" };
- public static void StartScan()
- {
- WriteClothingShop();
- // WriteCJShop();
- // WriteCJAShop();
- WriteGalleryShop();
- }
- public static void WriteClothingShop()
- {
- Dictionary<int, string> _typeIndexDic = new Dictionary<int, string>();
- SQLiteHelper.Instance.OpenConnection();
- try
- {
- List<ShopCfg> clothingShopCfg = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.FU_ZHUANG_DIAN, ConstStoreSubId.FU_ZHUANG_DIAN);
- for (int i = 0; i < clothingShopCfg.Count; i++)
- {
- int count;
- if (Array.IndexOf(_shopItemType, clothingShopCfg[i].typeIndex) >= 0)
- {
- count = Array.IndexOf(_shopItemType, clothingShopCfg[i].typeIndex);
- }
- else
- {
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(clothingShopCfg[i].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(clothingShopCfg[i].id, count.ToString());
- }
- }
- catch (Exception e)
- {
- ET.Log.Error(e.ToString());
- }
- 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(ShopCfgArray), 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();
- // }
- }
- public static void WriteGalleryShop()
- {
- // Dictionary<int, string> _typeIndexDic = new Dictionary<int, string>();
- // SQLiteHelper.Instance.OpenConnection();
- // try
- // {
- // string typeIndex = "";
- // int itemId;
- // int id;
- // var reader = SQLiteHelper.Instance.ReadFullTable("ShopCfgGalleryArray");
- // while (reader.Read())
- // {
- // typeIndex = reader["_typeIndex"].ToString();
- // itemId = int.Parse(reader["_itemId"].ToString());
- // id = int.Parse(reader["_id"].ToString());
- // int count = 2;
- // ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
- // if (itemCfg.itemType == ConstItemType.DRESS_UP)
- // {
- // if (itemCfg.subType == ConstDressUpItemType.BEI_JING)
- // {
- // count = 0;//背景
- // }
- // else
- // {
- // count = 2;//道具
- // }
- // }
- // else if (itemCfg.itemType == ConstItemType.PHOTOGRAPH)
- // {
- // if (itemCfg.subType == ConstItemSubType.PHOTOGRAPH_NPC)
- // {
- // count = 1;//人物
- // }
- // else if (itemCfg.subType == ConstItemSubType.PHOTOGRAPH_BOREDR)
- // {
- // count = 3;//npc
- // }
- // else if (itemCfg.subType == ConstItemSubType.PHOTOGRAPH_EFFECT)
- // {
- // count = 4;//滤镜
- // }
- // }
- // _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(ShopCfgGalleryArray), names, values, "id", key.ToString());
- // }
- // }
- // catch (Exception e)
- // {
- // ET.Log.Error(e.ToString());
- // }
- // finally
- // {
- // SQLiteHelper.Instance.CloseConnection();
- // }
- }
- }
- }
|