|
@@ -6,7 +6,9 @@ using System;
|
|
|
namespace GFGEditor
|
|
|
{
|
|
|
/// <summary>
|
|
|
- /// 物品获取途径扫描器:扫描获取途径,并填入物品表的获取途径字段
|
|
|
+ /// 物品扫描器:
|
|
|
+ /// 1.扫描获取途径,并填入物品表的获取途径字段
|
|
|
+ /// 2.扫描套装部件个数
|
|
|
/// </summary>
|
|
|
public class ItemApproachScanner
|
|
|
{
|
|
@@ -16,35 +18,59 @@ namespace GFGEditor
|
|
|
|
|
|
public static void startScan()
|
|
|
{
|
|
|
- ItemCfgArray itemManager = ItemCfgArray.Instance;
|
|
|
- if (itemManager != null)
|
|
|
+ ItemCfg[] dataArray = ItemCfgArray.Instance.dataArray;
|
|
|
+ GetApproachCall[] actions = new GetApproachCall[] { GetClothingShopApproach, GetZhaiXingApproach, GetStoryLevelApproach, GetClothingSyntheticApproach, GetSuitGuideApproach, GetSuitSyntheticApproach };
|
|
|
+ Dictionary<SuitCfg, List<int>> suitDic = new Dictionary<SuitCfg, List<int>>();
|
|
|
+ foreach (ItemCfg cfg in dataArray)
|
|
|
+ {
|
|
|
+ HandleSuitTable(cfg, suitDic);
|
|
|
+ HandleItemApproch(cfg, actions);
|
|
|
+ }
|
|
|
+ SQLiteHelper.Instance.OpenConnection();
|
|
|
+ try
|
|
|
{
|
|
|
- ItemCfg[] dataArray = itemManager.dataArray;
|
|
|
- GetApproachCall[] actions = new GetApproachCall[] { GetClothingShopApproach, GetZhaiXingApproach, GetStoryLevelApproach, GetClothingSyntheticApproach, GetSuitGuideApproach, GetSuitSyntheticApproach };
|
|
|
foreach (ItemCfg cfg in dataArray)
|
|
|
{
|
|
|
- //HandleItemType(cfg);
|
|
|
- HandleItemApproch(cfg, actions);
|
|
|
- }
|
|
|
- SQLiteHelper.Instance.OpenConnection();
|
|
|
- try
|
|
|
- {
|
|
|
- foreach (ItemCfg cfg in dataArray)
|
|
|
- {
|
|
|
- var names = new string[] { nameof(cfg.subType), nameof(cfg.itemType), nameof(cfg.approach) };
|
|
|
- var values = new string[] { "" + cfg.subType, "" + cfg.itemType, "" + cfg.approach };
|
|
|
- SQLiteHelper.Instance.UpdateValues(nameof(ItemCfgArray), names, values, nameof(cfg.id), cfg.id.ToString());
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- ET.Log.Error(e.ToString());
|
|
|
+ var names = new string[] { nameof(cfg.subType), nameof(cfg.itemType), nameof(cfg.approach) };
|
|
|
+ var values = new string[] { "" + cfg.subType, "" + cfg.itemType, "" + cfg.approach };
|
|
|
+ SQLiteHelper.Instance.UpdateValues(nameof(ItemCfgArray), names, values, nameof(cfg.id), cfg.id.ToString());
|
|
|
}
|
|
|
- finally
|
|
|
+ foreach (var a in suitDic)
|
|
|
{
|
|
|
- SQLiteHelper.Instance.CloseConnection();
|
|
|
+
|
|
|
+ var names = new string[] { nameof(a.Key.partsArr).Replace("Arr", "") };
|
|
|
+ var values = new string[] { string.Join(";", a.Value) };
|
|
|
+ SQLiteHelper.Instance.UpdateValues(nameof(SuitCfgArray), names, values, nameof(a.Key.id), a.Key.id.ToString());
|
|
|
}
|
|
|
}
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ ET.Log.Error(e.ToString());
|
|
|
+ }
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ SQLiteHelper.Instance.CloseConnection();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void HandleSuitTable(ItemCfg itemCfg, Dictionary<SuitCfg, List<int>> suitDic)
|
|
|
+ {
|
|
|
+ if (itemCfg.suitId <= 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var suitCfg = SuitCfgArray.Instance.GetCfg(itemCfg.suitId);
|
|
|
+ if(suitCfg == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ suitDic.TryGetValue(suitCfg, out var partsList);
|
|
|
+ if(partsList == null)
|
|
|
+ {
|
|
|
+ partsList = new List<int>();
|
|
|
+ suitDic[suitCfg] = partsList;
|
|
|
+ }
|
|
|
+ partsList.Add(itemCfg.id);
|
|
|
}
|
|
|
|
|
|
private static void HandleItemApproch(ItemCfg cfg, GetApproachCall[] actions)
|
|
@@ -160,17 +186,25 @@ namespace GFGEditor
|
|
|
/// <returns></returns>
|
|
|
private static string GetClothingSyntheticApproach(int itemId)
|
|
|
{
|
|
|
- SuitSyntheticMenuCfgArray manager = SuitSyntheticMenuCfgArray.Instance;
|
|
|
- SuitSyntheticMenuCfg[] dataArray = manager.dataArray;
|
|
|
- foreach (SuitSyntheticMenuCfg cfg in dataArray)
|
|
|
+ var itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
|
|
|
+ if(itemCfg == null)
|
|
|
{
|
|
|
- int suitId = CheckItemInSuit(itemId, cfg.suitIds);
|
|
|
- if (suitId > 0)
|
|
|
- {
|
|
|
- return "FU_ZHUANG_HE_CHENG=" + suitId;
|
|
|
- }
|
|
|
+ return null;
|
|
|
}
|
|
|
- return null;
|
|
|
+ if(itemCfg.suitId <= 0)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ var suitCfg = SuitCfgArray.Instance.GetCfg(itemCfg.suitId);
|
|
|
+ if(suitCfg == null)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if(suitCfg.syntheticType <= 0)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return "FU_ZHUANG_HE_CHENG=" + suitCfg.id;
|
|
|
}
|
|
|
|
|
|
private static string GetSuitGuideApproach(int itemId)
|
|
@@ -179,7 +213,7 @@ namespace GFGEditor
|
|
|
SuitCfg[] dataArray = manager.dataArray;
|
|
|
foreach (SuitCfg cfg in dataArray)
|
|
|
{
|
|
|
- bool result = CheckItemInBonus(itemId, cfg.boxBonusArr);
|
|
|
+ bool result = CheckItemInBonus(itemId, cfg.guideBoxBonusArr);
|
|
|
if (result)
|
|
|
{
|
|
|
return "TAO_ZHUANG_TU_JIAN";
|
|
@@ -190,15 +224,29 @@ namespace GFGEditor
|
|
|
|
|
|
private static string GetSuitSyntheticApproach(int itemId)
|
|
|
{
|
|
|
- SuitSyntheticCfgArray manager = SuitSyntheticCfgArray.Instance;
|
|
|
- SuitSyntheticCfg[] dataArray = manager.dataArray;
|
|
|
- foreach (SuitSyntheticCfg cfg in dataArray)
|
|
|
+
|
|
|
+ var itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
|
|
|
+ if (itemCfg == null)
|
|
|
{
|
|
|
- bool result = CheckItemInBonus(itemId, cfg.boxBonusArr);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- return "TAO_ZHUANG_HE_CHENG";
|
|
|
- }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (itemCfg.suitId <= 0)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ var suitCfg = SuitCfgArray.Instance.GetCfg(itemCfg.suitId);
|
|
|
+ if (suitCfg == null)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (suitCfg.syntheticType <= 0)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ bool result = CheckItemInBonus(itemId, suitCfg.syntheticBoxBonusArr);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ return "TAO_ZHUANG_HE_CHENG";
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -280,37 +328,5 @@ namespace GFGEditor
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- private static int CheckItemInSuit(int ItemId, string suitIds)
|
|
|
- {
|
|
|
- if (suitIds.Length > 0)
|
|
|
- {
|
|
|
- string[] aArray = suitIds.Split(';');
|
|
|
- foreach (string value in aArray)
|
|
|
- {
|
|
|
- int valueInt = int.Parse(value);
|
|
|
- bool result = CheckItemInSuit(ItemId, valueInt);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- return valueInt;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
- private static bool CheckItemInSuit(int ItemId, int suitId)
|
|
|
- {
|
|
|
- SuitCfgArray manager = SuitCfgArray.Instance;
|
|
|
- SuitCfg suitCfg = manager.GetCfg(suitId);
|
|
|
- int[] aArray = suitCfg.partsArr;
|
|
|
- foreach (int valueInt in aArray)
|
|
|
- {
|
|
|
- if (ItemId == valueInt)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
}
|
|
|
}
|