public T LoadJsonDataConfig <T>(string filePath) where T : new() { string path = ""; if (ResourceManager.m_LoadFormAssetBundle) { path = JsonConfigPath.ConfigPath_Bundle + filePath; } else { path = JsonConfigPath.ConfigPath + filePath; } T data = new T(); if (File.Exists(path)) { StreamReader sr = new StreamReader(path); string jsonStr = sr.ReadToEnd(); sr.Close(); data = JsonMapper.ToObject <T>(jsonStr); return(data); } else { DebugPlus.LogError("JsonConfig Read Fail Path=" + path); } return(default(T)); }
public bool DataCheck() { bool result = true; List <string> configName = new List <string>(); for (int i = 0; i < configData.Count; i++) { if (configName.Contains(configData[i].configName)) { DebugPlus.LogError("[BlockConfigData] : Find Same Block Config Name ! configName=" + configData[i].configName); result = false; continue; } else { configName.Add(configData[i].configName); } if (CheckDistrictData(configData[i].districtConfig) == false) { result = false; continue; } } return(result); }
public bool DataCheck() { bool result = true; if (gamePrepareConfig.prepareProperty == null) { DebugPlus.LogError("[GamePrepareConfig] : prepareProperty null!"); return(false); } for (int i = 0; i < gamePrepareConfig.prepareProperty.Count; i++) { var item = gamePrepareConfig.prepareProperty[i]; for (int j = 0; j < item.levelMax; j++) { GamePreapre_ConfigItem.ConfigLevelMap mapData = null; mapData = item.levelMap.Find(x => x.Level == j + 1); if (mapData == null) { DebugPlus.LogError("[GamePrepareConfig] : levelMap Empty! configName=" + item.configID + " levelID=" + (j + 1).ToString()); result = false; continue; } } if (item.defaultSelectLevel <= 0 || item.defaultSelectLevel > item.levelMax) { DebugPlus.LogError("[GamePrepareConfig] : DefaultSelect Error! configName=" + item.configID); } } for (int i = 0; i < gamePrepareConfig.AIPrepareConfig.Count; i++) { var item = gamePrepareConfig.AIPrepareConfig[i]; for (int j = 0; j < item.levelMax; j++) { GamePreapre_ConfigItem.ConfigLevelMap mapData = null; mapData = item.levelMap.Find(x => x.Level == j + 1); if (mapData == null) { DebugPlus.LogError("[GamePrepareConfig] : levelMap Empty! configName=" + item.configID + " levelID=" + (j + 1).ToString()); result = false; continue; } } if (item.defaultSelectLevel <= 0 || item.defaultSelectLevel > item.levelMax) { DebugPlus.LogError("[GamePrepareConfig] : DefaultSelect Error! configName=" + item.configID); } } return(result); }
private bool CheckDistrictData(Block_District_Config config) { bool result = true; if (config == null) { return(false); } List <Vector2> posList = new List <Vector2>(); for (int i = 0; i < config.gridConfig.Count; i++) { byte[] posArray = config.gridConfig[i].coordinate; if (posArray.Length != 2) { DebugPlus.LogError("[BlockConfigData] : Pos FormatError! array= " + posArray.ToString() + " Name=" + config.configName); result = false; continue; } Vector2 pos = new Vector2(posArray[0], posArray[1]); if (posList.Contains(pos)) { DebugPlus.LogError("[BlockConfigData] : Find Same Coordinate! array=" + posArray.ToString() + " Name=" + config.configName); result = false; continue; } } ///Check Match for (int i = 0; i < config.areaX; i++) { for (int j = 0; j < config.areaY; j++) { Vector2 pos = new Vector2(i, j); if (!posList.Contains(pos)) { DebugPlus.LogError("[BlockConfigData] : Find Empty Coordinate! posX=" + i + " , PosY= " + j + "Name = " + config.configName); result = false; continue; } } } ///Check Size if (Utility.TryParseInt((config.realityRatio * config.areaX).ToString()) == 0 || Utility.TryParseInt((config.realityRatio * config.areaY).ToString()) == 0) { DebugPlus.LogError("[BlockConfigData] : DistrictRealSize is not interger!" + config.configName); result = false; } return(result); }
public bool DataCheck() { bool result = true; if (shield_slot_unlock_energycost_map == null || shield_slot_unlock_energycost_map.Length == 0) { DebugPlus.LogError("[MainShipBasePropertyConfig] : shield_slot_unlock_energycost_map config is null"); return(false); } if (shieldLevelMap == null || shieldLevelMap.Count == 0) { DebugPlus.LogError("[MainShipBasePropertyConfig] : shieldLevelMap config is null!"); return(false); } List <int> levelMapList = new List <int>(); for (int i = 0; i < shieldLevelMap.Count; i++) { if (levelMapList.Contains(shieldLevelMap[i].Level)) { DebugPlus.LogError("[MainShipShieldLevelMap] : find same levelID! levelID=" + shieldLevelMap[i].Level); result = false; continue; } } ///Check Range if (shield_slot_unlock_energycost_map[shield_slot_unlock_energycost_map.Length - 1] > shield_energy_total_max_limit) { DebugPlus.LogError("[shield_slot_unlock_energycost_map] : Out of Range! max=" + shield_energy_total_max_limit); result = false; } ///Check Data for (int i = 0; i <= shield_energy_total_max_limit; i++) { if (!levelMapList.Contains(i)) { DebugPlus.LogError("[MainShipShieldLevelMap] : find empty config ! Level=" + i); result = false; continue; } } return(result); }