123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- using GFGGame;
- using UnityEngine;
- using System.Collections.Generic;
- using System;
- namespace GFGEditor
- {
- /// <summary>
- /// 配置表检查器:在有限范围内检查表格间关联的数据是否合法,并打印非法数据
- /// </summary>
- public class ExcelChecker
- {
- public static void StartCheck()
- {
- CheckLuckyBoxCfg();
- CheckBonusListCfg();
- CheckDropOutCfg();
- CheckStoryChapterCfg();
- CheckStoryLevelCfg();
- CheckStoryFightCfg();
- CheckClothingShopCfg();
- CheckSuitCfg();
- CheckSuitGuideMenuCfg();
- CheckSuitSyntheticMenuCfg();
- CheckSuitSyntheticCfg();
- CheckClothingSyntheticCfg();
- 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");
- foreach(int valueInt in boxCfg.bonusShowArr)
- {
- CheckBonusExist(valueInt, "抽奖LuckyBoxCfg.bonusShow");
- }
- }
- }
- private static void CheckBonusListCfg()
- {
- BonusListCfgArray cfgArray = BonusListCfgArray.Instance;
- BonusListCfg[] dataArray = cfgArray.dataArray;
- foreach(BonusListCfg cfg in dataArray)
- {
- foreach(int[] values in cfg.bonusListArr)
- {
- CheckItemIdExist(values[0], "抽奖BonusListCfg.bonusList");
- }
- }
- }
- 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()
- {
- ClothingShopCfgArray cfgArray = ClothingShopCfgArray.Instance;
- ClothingShopCfg[] dataArray = cfgArray.dataArray;
- foreach(ClothingShopCfg cfg in dataArray)
- {
- CheckItemIdExist(cfg.itemID, "商城ClothingShopCfg.itemID");
- CheckItemIdExist(cfg.costID, "商城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 CheckSuitSyntheticMenuCfg()
- {
- SuitSyntheticMenuCfgArray cfgArray = SuitSyntheticMenuCfgArray.Instance;
- SuitSyntheticMenuCfg[] dataArray = cfgArray.dataArray;
- foreach(SuitSyntheticMenuCfg cfg in dataArray)
- {
- if (cfg.suitIds.Length > 0)
- {
- string[] values = cfg.suitIds.Split(';');
- foreach (string value in values)
- {
- int valueInt = int.Parse(value);
- CheckSuitExist(valueInt, "合成SuitSyntheticMenuCfg.suitIds");
- CheckSuitSyntheticCfgExist(valueInt, "合成SuitSyntheticMenuCfg.suitIds");
- CheckSuitClothingSyntheticCfgExist(valueInt, "合成SuitSyntheticMenuCfg.suitIds");
- }
- }
- }
- }
- private static void CheckSuitSyntheticCfg()
- {
- SuitSyntheticCfgArray cfgArray = SuitSyntheticCfgArray.Instance;
- SuitSyntheticCfg[] dataArray = cfgArray.dataArray;
- foreach(SuitSyntheticCfg cfg in dataArray)
- {
- CheckStoryLevelCfgExist(cfg.storyLevelId, "合成SuitSyntheticCfg.storyLevelId");
- CheckSuitExist(cfg.preSuitId, "合成SuitSyntheticCfg.preSuitId");
- CheckItemsExist(cfg.boxBonusArr, "合成SuitSyntheticCfg.boxBonus");
- }
- }
- private static void CheckClothingSyntheticCfg()
- {
- ClothingSyntheticCfgArray cfgArray = ClothingSyntheticCfgArray.Instance;
- ClothingSyntheticCfg[] dataArray = cfgArray.dataArray;
- foreach(ClothingSyntheticCfg cfg in dataArray)
- {
- CheckItemIdExist(cfg.costID, "合成ClothingSyntheticCfg.costID");
- CheckItemsExist(cfg.materiars, "合成ClothingSyntheticCfg.materiars");
- }
- }
- private static void CheckItemCfg()
- {
- ItemCfgArray cfgArray = ItemCfgArray.Instance;
- ItemCfg[] dataArray = cfgArray.dataArray;
- foreach(ItemCfg cfg in dataArray)
- {
- if (cfg.resLayer1 == 0 && cfg.resLayer2 == 0 && ItemUtilCS.IsDressUpItem(cfg.id))
- {
- throw (new Exception("物品" + cfg.id + "没有配置显示层"));
- }
- }
- }
- //=====================================================================================================
- 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 CheckBonusExist(int id, string keyName)
- {
- BonusListCfgArray cfgArray = BonusListCfgArray.Instance;
- BonusListCfg cfg = cfgArray.GetCfg(id);
- if(cfg == null)
- {
- Debug.LogErrorFormat("{0}配置的奖励{1}不存在", new object[]{keyName, id} );
- }
- }
- private static void CheckStoryDialogExist(string id, string keyName)
- {
- if(id.Length > 0)
- {
- StoryDialogCfgArray cfgArray = StoryDialogCfgArray.Instance;
- StoryDialogCfg[] cfg = cfgArray.GetCfgs(id);
- if(cfg == null && cfg.Length > 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.GetCfgs(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 CheckSuitSyntheticCfgExist(int id, string keyName)
- {
- if(id > 0)
- {
- SuitSyntheticCfgArray cfgArray = SuitSyntheticCfgArray.Instance;
- SuitSyntheticCfg cfg = cfgArray.GetCfg(id);
- if (cfg == null)
- {
- Debug.LogFormat("{0}配置的套装{1}没有对应的合成解锁配置", new object[] { keyName, id });
- }
- }
- }
- private static void CheckSuitClothingSyntheticCfgExist(int id, string keyName)
- {
- if (id > 0)
- {
- SuitCfgArray cfgArray = SuitCfgArray.Instance;
- SuitCfg cfg = cfgArray.GetCfg(id);
- int[] itemInfos = cfg.partsArr;
- foreach (int itemId in itemInfos)
- {
- keyName = string.Format("{0}配置的套装{1}必含部件", keyName, id);
- CheckClothingSyntheticCfgExist(itemId, keyName);
- }
- }
- }
- private static void CheckClothingSyntheticCfgExist(int id, string keyName)
- {
- if(id > 0)
- {
- ClothingSyntheticCfgArray cfgArray = ClothingSyntheticCfgArray.Instance;
- ClothingSyntheticCfg cfg = cfgArray.GetCfg(id);
- if (cfg == null)
- {
- Debug.LogErrorFormat("{0}配置的服装{1}没有对应的合成消耗配置", new object[] { keyName, id });
- }
- }
- }
- private static void CheckStoryLevelCfgExist(string id, string keyName)
- {
- if(id.Length > 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");
- }
- }
- }
- }
|