123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- using GFGGame;
- using UnityEngine;
- using System.Collections.Generic;
- using System;
- namespace GFGEditor
- {
- /// <summary>
- /// 配置表检查器:在有限范围内检查表格间关联的数据是否合法,并打印非法数据
- /// </summary>
- public class ExcelChecker
- {
- public static void StartCheck()
- {
- CheckLuckyBoxCfg();
- CheckDropOutCfg();
- CheckStoryChapterCfg();
- CheckStoryLevelCfg();
- CheckStoryFightCfg();
- CheckClothingShopCfg();
- CheckSuitCfg();
- CheckSuitGuideMenuCfg();
- CheckItemCfg();
- CheckCardStarCfg();
- CheckCardStoryCfg();
- }
- private static void CheckLuckyBoxCfg()
- {
- LuckyBoxCfgArray cfgArray = LuckyBoxCfgArray.Instance;
- LuckyBoxCfg[] dataArray = cfgArray.dataArray;
- foreach (LuckyBoxCfg boxCfg in dataArray)
- {
- CheckItemIdExist(boxCfg.costID, "抽奖LuckyBoxCfg.costID");
- }
- }
- private static void CheckDropOutCfg()
- {
- DropOutCfgArray cfgArray = DropOutCfgArray.Instance;
- DropOutCfg[] dataArray = cfgArray.dataArray;
- foreach (DropOutCfg cfg in dataArray)
- {
- if (cfg.item >= 10000000)//掉落id
- {
- CheckDropOutExist(cfg.item, "掉落DropOutCfg.item");
- }
- else
- {
- CheckItemIdExist(cfg.item, "掉落DropOutCfg.item");
- }
- }
- }
- private static void CheckStoryChapterCfg()
- {
- StoryChapterCfgArray cfgArray = StoryChapterCfgArray.Instance;
- StoryChapterCfg[] dataArray = cfgArray.dataArray;
- foreach (StoryChapterCfg cfg in dataArray)
- {
- CheckItemsExist(cfg.bonus1Arr, "剧情副本StoryChapterCfg.bonus1");
- CheckItemsExist(cfg.bonus2Arr, "剧情副本StoryChapterCfg.bonus2");
- CheckItemsExist(cfg.bonus3Arr, "剧情副本StoryChapterCfg.bonus3");
- }
- }
- private static void CheckStoryLevelCfg()
- {
- StoryLevelCfgArray cfgArray = StoryLevelCfgArray.Instance;
- StoryLevelCfg[] dataArray = cfgArray.dataArray;
- foreach (StoryLevelCfg cfg in dataArray)
- {
- CheckItemsExist(cfg.bonusOnceArr, "剧情副本StoryLevelCfg.bonusOnce");
- CheckStoryDialogExist(cfg.storyStartID, "剧情副本StoryLevelCfg.storyStartID");
- CheckStoryFightExist(cfg.fightID, "剧情副本StoryLevelCfg.fightID");
- }
- }
- private static void CheckStoryFightCfg()
- {
- StoryFightCfgArray cfgArray = StoryFightCfgArray.Instance;
- StoryFightCfg[] dataArray = cfgArray.dataArray;
- foreach (StoryFightCfg cfg in dataArray)
- {
- if (cfg.needSuitId > 0)
- {
- CheckSuitExist(cfg.needSuitId, "剧情副本StoryFightCfg.needSuitId");
- }
- else if (cfg.needItemId > 0)
- {
- CheckItemIdExist(cfg.needItemId, "剧情副本StoryFightCfg.needItemId");
- }
- CheckItemsExist(cfg.bonusBaseArr, "剧情副本StoryFightCfg.bonusBase");
- foreach (int value in cfg.bonusRandomArr)
- {
- CheckDropOutExist(value, "剧情副本StoryFightCfg.bonusRandom");
- }
- }
- }
- private static void CheckClothingShopCfg()
- {
- List<ShopCfg> dataArray = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.FU_ZHUANG_DIAN, ConstStoreSubId.FU_ZHUANG_DIAN);
- foreach (ShopCfg cfg in dataArray)
- {
- CheckItemIdExist(cfg.itemId, "商城ClothingShopCfg.itemID");
- CheckItemIdExist(cfg.CostIdReal, "商城ClothingShopCfg.costID");
- }
- }
- private static void CheckSuitCfg()
- {
- SuitCfgArray cfgArray = SuitCfgArray.Instance;
- SuitCfg[] dataArray = cfgArray.dataArray;
- foreach (SuitCfg suitCfg in dataArray)
- {
- CheckItemsExist(suitCfg.partsArr, "套装suitCfg.parts");
- CheckItemsExist(suitCfg.partsOptionalArr, "套装suitCfg.partsOptional");
- }
- }
- private static void CheckSuitGuideMenuCfg()
- {
- SuitGuideMenuCfgArray cfgArray = SuitGuideMenuCfgArray.Instance;
- SuitGuideMenuCfg[] dataArray = cfgArray.dataArray;
- foreach (SuitGuideMenuCfg cfg in dataArray)
- {
- if (cfg.suitIds.Length > 0)
- {
- string[] values = cfg.suitIds.Split(';');
- foreach (string value in values)
- {
- if (value.Length > 0)
- {
- int valueInt = int.Parse(value);
- CheckSuitExist(valueInt, "图鉴SuitGuideMenuCfg.suitIds");
- }
- }
- }
- }
- }
- private static void CheckClothingSyntheticCfg()
- {
- //ClothingSyntheticCfgArray cfgArray = ClothingSyntheticCfgArray.Instance;
- //ClothingSyntheticCfg[] dataArray = cfgArray.dataArray;
- //foreach(ClothingSyntheticCfg cfg in dataArray)
- //{
- // CheckItemIdExist(cfg.costID, "合成ClothingSyntheticCfg.costID");
- // CheckItemsExist(cfg.materiarsArr, "合成ClothingSyntheticCfg.materiars");
- //}
- }
- private static void CheckItemCfg()
- {
- ItemCfgArray cfgArray = ItemCfgArray.Instance;
- ItemCfg[] dataArray = cfgArray.dataArray;
- foreach (ItemCfg cfg in dataArray)
- {
- if (string.IsNullOrEmpty(cfg.resLayer1) && string.IsNullOrEmpty(cfg.resLayer2) && string.IsNullOrEmpty(cfg.resLayer3) && ItemUtilCS.IsDressUpItem(cfg.id))
- {
- ET.Log.Error(new Exception("物品" + cfg.id + "没有配置显示层"));
- }
- CheckClothingSyntheticCfgExist(cfg);
- }
- }
- //=====================================================================================================
- private static void CheckItemIdExist(int id, string keyName)
- {
- if (id > 0)
- {
- ItemCfgArray cfgArray = ItemCfgArray.Instance;
- ItemCfg itemCfg = cfgArray.GetCfg(id);
- if (itemCfg == null)
- {
- Debug.LogErrorFormat("{0}配置的物品{1}不存在", new object[] { keyName, id });
- }
- }
- }
- private static void CheckItemsExist(string itemsStr, string keyName)
- {
- string[] itemInfos = itemsStr.Split(';');
- foreach (string itemInfo in itemInfos)
- {
- if (itemInfo.Length > 0)
- {
- string[] itemValues = itemInfo.Split('*');
- CheckItemIdExist(int.Parse(itemValues[0]), keyName);
- }
- }
- }
- private static void CheckItemsExist(int[] items, string keyName)
- {
- foreach (int itemId in items)
- {
- CheckItemIdExist(itemId, keyName);
- }
- }
- private static void CheckItemsExist(int[][] items, string keyName)
- {
- foreach (int[] itemInfo in items)
- {
- CheckItemIdExist(itemInfo[0], keyName);
- }
- }
- private static void CheckStoryDialogExist(string id, string keyName)
- {
- if (id.Length > 0)
- {
- StoryDialogCfgArray cfgArray = StoryDialogCfgArray.Instance;
- List<StoryDialogCfg> cfg = cfgArray.GetCfgsByid(id);
- if (cfg == null && cfg.Count > 0)
- {
- Debug.LogErrorFormat("{0}配置的对话{1}不存在", new object[] { keyName, id });
- }
- }
- }
- private static void CheckStoryFightExist(string id, string keyName)
- {
- if (id.Length > 0)
- {
- StoryFightCfgArray cfgArray = StoryFightCfgArray.Instance;
- StoryFightCfg cfg = cfgArray.GetCfg(id);
- if (cfg == null)
- {
- Debug.LogErrorFormat("{0}配置的战斗{1}不存在", new object[] { keyName, id });
- }
- }
- }
- private static void CheckDropOutExist(int id, string keyName)
- {
- var arr = DropOutCfgArray.Instance.GetCfgsByid(id);
- List<DropOutCfg> dropOutCfgs = new List<DropOutCfg>(arr);
- if (dropOutCfgs == null || dropOutCfgs.Count <= 0)
- {
- Debug.LogErrorFormat("{0}配置的掉落{1}不存在", new object[] { keyName, id });
- }
- }
- private static void CheckSuitExist(int id, string keyName)
- {
- if (id > 0)
- {
- SuitCfgArray cfgArray = SuitCfgArray.Instance;
- SuitCfg cfg = cfgArray.GetCfg(id);
- if (cfg == null)
- {
- Debug.LogErrorFormat("{0}配置的套装{1}不存在", new object[] { keyName, id });
- }
- }
- }
- private static void CheckClothingSyntheticCfgExist(ItemCfg itemCfg)
- {
- if (itemCfg.itemType == ConstItemType.DRESS_UP && itemCfg.suitId > 0)
- {
- var suitCfg = SuitCfgArray.Instance.GetCfg(itemCfg.suitId);
- if (suitCfg != null && suitCfg.syntheticType > 0)
- {
- if (itemCfg.syntheticCostID <= 0 || itemCfg.syntheticCostNum <= 0 || itemCfg.syntheticMateriarsArr.Length <= 0)
- {
- Debug.LogErrorFormat("服装{0}没有对应的合成消耗配置", new object[] { itemCfg.id });
- }
- }
- }
- }
- private static void CheckStoryLevelCfgExist(int id, string keyName)
- {
- if (id > 0)
- {
- StoryLevelCfgArray cfgArray = StoryLevelCfgArray.Instance;
- StoryLevelCfg cfg = cfgArray.GetCfg(id);
- if (cfg == null)
- {
- Debug.LogErrorFormat("{0}配置的关卡{1}不存在", new object[] { keyName, id });
- }
- }
- }
- private static void CheckCardStarCfg()
- {
- CardStarCfgArray cfgArray = CardStarCfgArray.Instance;
- CardStarCfg[] dataArray = cfgArray.dataArray;
- foreach (CardStarCfg cfg in dataArray)
- {
- CheckItemsExist(cfg.materiarsArr, "词牌CardStarCfg.materiars");
- }
- }
- private static void CheckCardStoryCfg()
- {
- CardStoryCfgArray cfgArray = CardStoryCfgArray.Instance;
- CardStoryCfg[] dataArray = cfgArray.dataArray;
- foreach (CardStoryCfg cfg in dataArray)
- {
- CheckStoryDialogExist(cfg.storyStartID, "词牌CardStoryCfg.storyStartID");
- }
- }
- }
- }
|