private void InitChatEmoticonConfigCsv(string strPath) { ScpReader reader = new ScpReader(strPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeChatEmoticonData sConfig = new SSchemeChatEmoticonData(); sConfig.nEmoticonID = reader.GetInt(i, (int)EChatEmoticonConfig.EEmoticon_ID, 0); sConfig.nEmoticonSerialID = reader.GetInt(i, (int)EChatEmoticonConfig.EEmoticon_Serial, 0); sConfig.eEmoticonType = (EMChatEmoticonType)Enum.Parse(typeof(EMChatEmoticonType), reader.GetString(i, (int)EChatEmoticonConfig.EEmoticon_Type, "")); sConfig.szEmoticonKey = reader.GetString(i, (int)EChatEmoticonConfig.EEmoticon_Key, string.Empty); sConfig.szCharInput = reader.GetString(i, (int)EChatEmoticonConfig.EEmoticon_CharInput, string.Empty); sConfig.szTipDesc = reader.GetString(i, (int)EChatEmoticonConfig.EEmoticon_TipDesc, string.Empty); sConfig.nEmoticonSellID = reader.GetInt(i, (int)EChatEmoticonConfig.EEmoticon_SellID, 0); sConfig.nEmoticonSkillID = reader.GetInt(i, (int)EChatEmoticonConfig.EEmoticon_skillID, 0); if (m_dicChatEmoticonConfig.ContainsKey(sConfig.nEmoticonID)) { Trace.LogWarning("有相同的聊天表情ID" + sConfig.nEmoticonID + "表第" + i + "行"); } else { m_dicChatEmoticonConfig.Add(sConfig.nEmoticonID, sConfig); } if (!m_chatEmoticonSerialList.ContainsKey(sConfig.nEmoticonSerialID)) { m_chatEmoticonSerialList.Add(sConfig.nEmoticonSerialID, new List <SSchemeChatEmoticonData>()); } m_chatEmoticonSerialList[sConfig.nEmoticonSerialID].Add(sConfig); } reader.Dispose(); reader = null; }
public void Load(string strFilePath) { ScpReader reader = new ScpReader(strFilePath, true, 2); if (reader == null) { Trace.LogError("read sheme fail! file=" + strFilePath); return; } m_dicSocialSharingNodeList.Clear(); int nRecordCount = reader.GetRecordCount(); for (int row = 0; row < nRecordCount; row++) { int nType = reader.GetInt(row, (int)Column.COL_SHARINGTYPE, 0); if (nType < 0 || nType >= (int)SocialSharingType.TypeMax) { Trace.LogWarning("scheme sharingType invalid! file=" + strFilePath); continue; } string title = reader.GetString(row, (int)Column.COL_TITLE, ""); string desc = reader.GetString(row, (int)Column.COL_DESC, ""); AddNode((SocialSharingType)nType, title, desc); } }
//加载快捷键信息 private void LoadKeyCodeNode(ScpReader reader, int row) { int nGroup = reader.GetInt(row, (int)Column_OBCtrl.COL_GROUP, 0); int nIndex = reader.GetInt(row, (int)Column_OBCtrl.COL_INDEX, 0); List <SchemeOBCtrlKeyCodeNode> nodeList; if (m_dicOBCtrlKeyCodeNodeMap.TryGetValue(nGroup, out nodeList)) { int tempIndex = nodeList.FindIndex(x => x.nIndex == nIndex); if (tempIndex > -1) { Trace.Log("scheme repeat! row = " + row + "file:" + schemeFileName); return; } } string szLabel = reader.GetString(row, (int)Column_OBCtrl.COL_LABEL, ""); string szKeyCode = reader.GetString(row, (int)Column_OBCtrl.COL_KEYCODE, ""); if (!m_dicOBCtrlKeyCodeNodeMap.ContainsKey(nGroup)) { m_dicOBCtrlKeyCodeNodeMap.Add(nGroup, new List <SchemeOBCtrlKeyCodeNode>()); } SchemeOBCtrlKeyCodeNode node = new SchemeOBCtrlKeyCodeNode(nGroup, nIndex, szLabel, szKeyCode); m_dicOBCtrlKeyCodeNodeMap[nGroup].Add(node); List <UnityEngine.KeyCode[]> keyCodeList = new List <UnityEngine.KeyCode[]>(); keyCodeList.AddRange(node.keyCodeList); m_dicOBCtrlKeyCodeMap.Add(nGroup * keyCodeEachTypeMax + nIndex, keyCodeList); }
/// <summary> /// 初始化英雄信息配置 /// </summary> /// <param name="strDefaultViewConfigPath"></param> private void InitAboutDetailedPropertyInfo(string strDefaultViewConfigPath) { string strDetailedPropertyInfoPath = strDefaultViewConfigPath + MobaSchemesConfig.DETAILED_PROPERTY_INFO; ScpReader DetailedPropertyInfoReader = new ScpReader(strDetailedPropertyInfoPath, true, 2); DetailedPropertyInfoTable = new Hashtable(); int PropertyID = 0; for (int i = 0; i < DetailedPropertyInfoReader.GetRecordCount(); i++) { MobaDetatiledPropertyInfo PropertyInfo = new MobaDetatiledPropertyInfo(); PropertyID = DetailedPropertyInfoReader.GetInt(i, (int)EMobaDetailedPropertyInfo.EMDPIR_PropertyID, -1); if (PropertyID == -1) { continue; } PropertyInfo.PropertyName = DetailedPropertyInfoReader.GetString(i, (int)EMobaDetailedPropertyInfo.EMDPIR_PropertyName, ""); PropertyInfo.PropertyDes = DetailedPropertyInfoReader.GetString(i, (int)EMobaDetailedPropertyInfo.EMDPIR_PropertyDes, ""); UBB.toHtml(ref PropertyInfo.PropertyDes); DetailedPropertyInfoTable.Add(PropertyID, PropertyInfo); } }
// 初始化csv表 protected void InitHeroAIConfigCsv(string stPath) { // string stSchemeAllText = File.ReadAllText(stPath); ScpReader reader = new ScpReader(stPath, true, 2); allHeroAIConfigTable = new Hashtable(); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeHeroAIConfig sConfig = new SSchemeHeroAIConfig(); sConfig.nBattleFieldID = reader.GetInt(i, (int)HeroAI.EMT_BATTLEFIELDID, 0); sConfig.nHeroId = reader.GetInt(i, (int)HeroAI.EMT_HEROID, 0); sConfig.szAIIDArray = reader.GetString(i, (int)HeroAI.EMT_AI_IDLIST, ""); sConfig.szAIRankArray = reader.GetString(i, (int)HeroAI.EMT_AI_RANKLIST, ""); sConfig.szAIDESArray = reader.GetString(i, (int)HeroAI.EMT_AI_DESLIST, ""); sConfig.bIsOpen = reader.GetInt(i, (int)HeroAI.EMT_AI_ISOPEN, 0) == 1? true: false; // 配置检查 string szAIDescList = sConfig.szAIDESArray; string[] AIDescArrayStr = szAIDescList.Split(';'); int nAIDescArrayLength = AIDescArrayStr.Length; string szAIIDList = sConfig.szAIIDArray; string[] AIIDArrayStr = szAIDescList.Split(';'); int nAIIDArrayLength = AIIDArrayStr.Length; if (nAIDescArrayLength != nAIIDArrayLength) { Trace.LogError("配置出错 请检查 HeroAIConfig.csv 位置:=(" + (i + 1) + ")行"); } int keyID = sConfig.nBattleFieldID * KEY_ID_BASE + sConfig.nHeroId; allHeroAIConfigTable[keyID] = sConfig; } }
// 比赛脚本 private void LoadLegendCupConfig(string stPath) { ScpReader reader = new ScpReader(stPath, true, 2); m_cupConfig = new Dictionary <int, SSchemeLegendCupConfig>(); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeLegendCupConfig cupInfo = new SSchemeLegendCupConfig(); cupInfo.nConfigID = reader.GetInt(i, (int)ECupConfigCol.ECCC_COL_CUP_CUPID, 0); cupInfo.sCupConfigName = reader.GetString(i, (int)ECupConfigCol.ECCC_COL_CUP_NAME, ""); cupInfo.nNeedRoundNum = reader.GetInt(i, (int)ECupConfigCol.ECCC_COL_CUP_NEEDROUND, 0); cupInfo.nMaxKinNum = reader.GetInt(i, (int)ECupConfigCol.ECCC_COL_CUP_MAXKINNUM, 0); cupInfo.nCupDetailID = reader.GetInt(i, (int)ECupConfigCol.ECCC_COL_CUP_CONFIGID, 0); string[] strDeadline = reader.GetString(i, (int)ECupConfigCol.ECCC_COL_CUP_DEADLINE, "").Split(';'); if (strDeadline != null && strDeadline.Length > 0) { cupInfo.nDeadline = new int[strDeadline.Length]; for (int j = 0; j < strDeadline.Length; ++j) { //cupInfo.nDeadline[j] = Convert.ToInt32(strDeadline[j]); Int32.TryParse(strDeadline[j], out cupInfo.nDeadline[j]); } } cupInfo.nCreateNeedMoney = reader.GetInt(i, (int)ECupConfigCol.ECCC_COL_CUP_CREATENEEDMONEY, 0); cupInfo.nRegistNeedMoney = reader.GetInt(i, (int)ECupConfigCol.ECCL_COL_CUP_REGISTNEEDMONEY, 0); cupInfo.nRegistHighestMoney = reader.GetInt(i, (int)ECupConfigCol.ECCL_COL_CUP_REGISTHIGHESTMONEY, 0); cupInfo.nPrizeConfigID = reader.GetInt(i, (int)ECupConfigCol.ECCC_COL_CUP_PRIZECONFIGID, 0); cupInfo.bIsFree = reader.GetInt(i, (int)ECupConfigCol.ECCC_COL_CUP_ISFREE, 0) > 0; cupInfo.nMiniStartCount = reader.GetInt(i, (int)ECupConfigCol.ECCC_COL_CUP_MINI_START_KINNUM, 0); cupInfo.sCupConfigViewName = reader.GetString(i, (int)ECupConfigCol.ECCC_COL_CUP_VIEW_NAME, ""); m_cupConfig[cupInfo.nConfigID] = cupInfo; } }
// 初始化csv表 protected void InitMatchRoomOpenAILevelConfigCsv(string stPath) { // string stSchemeAllText = File.ReadAllText(stPath); ScpReader reader = new ScpReader(stPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeMatchRoomOpenAILevel sConfig = new SSchemeMatchRoomOpenAILevel(); sConfig.nMatchTypeID = reader.GetInt(i, (int)EMatchRoomOpenAILevel.ERC_MATCHTYPE_ID, 0); sConfig.AILevelDes = reader.GetString(i, (int)EMatchRoomOpenAILevel.ERC_AILEVEL_DES, ""); sConfig.AILevelScore = reader.GetString(i, (int)EMatchRoomOpenAILevel.ERC_AILEVEL_SCORE, ""); // 配置检查 string[] AILevelDesStr = sConfig.AILevelDes.Split(';'); int nDescLength = AILevelDesStr.Length; string[] AIScoreArrayStr = sConfig.AILevelScore.Split(';'); int nScoreLength = AIScoreArrayStr.Length; if (nDescLength != nScoreLength) { Trace.LogError("配置出错 请检查 MatchRoomOpenAILevel.csv 位置:=(" + (i + 1) + ")行"); } if (allOpenAILevelTable.ContainsKey(sConfig.nMatchTypeID)) { Trace.LogError("重复id 检查配置MatchRoomOpenAILevel.csv!id =" + sConfig.nMatchTypeID); } allOpenAILevelTable.Add(sConfig.nMatchTypeID, sConfig); } }
// 初始化csv表 protected void InitRunePageCsv(string stPath) { // string stSchemeAllText = File.ReadAllText(stPath); ScpReader reader = new ScpReader(stPath, true, 2); allRunePageTable = new Hashtable(); aRuneArray = new int[DefaultTypeCount, DefaultLevelCount, DefaultSameLevelCount]; // 目前写死 for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeRuneConfig sConfig = new SSchemeRuneConfig(); sConfig.nId = reader.GetInt(i, (int)Rune.EMT_ID, 0); sConfig.szRuneName = reader.GetString(i, (int)Rune.EMT_NAME, ""); sConfig.nRuneIconId = reader.GetInt(i, (int)Rune.EMT_ICONID, 0); sConfig.nExclusiveId = reader.GetInt(i, (int)Rune.EMT_EXCLUSIVEID, 0); sConfig.nRuneInlayType = reader.GetInt(i, (int)Rune.EMT_INLAYTYPE, 0); sConfig.nRunePropertyType = reader.GetInt(i, (int)Rune.EMT_PROPERTYTYPE, 0); sConfig.nRuneLevel = reader.GetInt(i, (int)Rune.EMT_LEVEL, 0); sConfig.szRuneDESC = reader.GetString(i, (int)Rune.EMT_DESC, ""); sConfig.szEffectIdArray = reader.GetString(i, (int)Rune.EMT_EFFECTIDARRAY, ""); sConfig.szParametersValueArray = reader.GetString(i, (int)Rune.EMT_EFFECTPARAMETERS, ""); sConfig.nPropertyNameType = reader.GetInt(i, (int)Rune.EMT_PROPERTYNAMETYPE, 0); if (sConfig.nId == 0) { continue; } allRunePageTable[sConfig.nId] = sConfig; } }
// 初始化csv表 protected void InitMatchRoomCustomerConfigCsv(string stPath) { // string stSchemeAllText = File.ReadAllText(stPath); ScpReader reader = new ScpReader(stPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeMatchRoomCustomer sConfig = new SSchemeMatchRoomCustomer(); sConfig.nID = reader.GetInt(i, (int)CreateRoomCustomer.ERC_ID, 0); sConfig.MapDes = reader.GetString(i, (int)CreateRoomCustomer.ERC_MAPDES, ""); sConfig.MapDetailDes = reader.GetString(i, (int)CreateRoomCustomer.ERC_MAPDETAILDES, ""); sConfig.PictrueID = reader.GetInt(i, (int)CreateRoomCustomer.ERC_PICTRUE_ID, 0); sConfig.strPersonCountListDes = reader.GetString(i, (int)CreateRoomCustomer.ERC_PERSONCOUNT_DES, ""); sConfig.strMatchTypeList = reader.GetString(i, (int)CreateRoomCustomer.ERC_MATCHTYPE_LIST, ""); // 配置检查 string[] PersonCountStr = sConfig.strPersonCountListDes.Split(';'); int nDescArrayLength = PersonCountStr.Length; string[] AIIDArrayStr = sConfig.strMatchTypeList.Split(';'); int nArrayLength = AIIDArrayStr.Length; if (nDescArrayLength != nArrayLength) { Trace.LogError("配置出错 请检查 MatchRoomCustomer.csv 位置:=(" + (i + 1) + ")行"); } sConfig.bIsOpen = reader.GetInt(i, (int)CreateRoomCustomer.ERC_ISOPEN, 0) == 1 ? true : false; if (allMatchRoomCustomerTable.ContainsKey(sConfig.nID)) { Trace.LogError("重复id 检查配置MatchRoomCustomer.csv!id =" + sConfig.nID); } allMatchRoomCustomerTable.Add(sConfig.nID, sConfig); } }
public void Load(string strPath) { m_personModelConfigs = new List <SSchemePersonModelData>(); ScpReader reader = new ScpReader(strPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemePersonModelData data = new SSchemePersonModelData(); data.nHeroID = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROID, 0); data.nHeroType = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROTYPE, 0); data.nOperationType = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_OPERATIONTYPE, 0); data.nHeroCharacter = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROCHARACTER, 0); data.nSex = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_SEX, 0); data.nDefaultSkinID = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_DEFAULTSKINID, 0); data.szHeroName = reader.GetString(i, (int)EMPersonModelConfig.EMPMC_HERONAME, ""); data.szHeroTitle = reader.GetString(i, (int)EMPersonModelConfig.EMPMC_HEROTITLE, ""); data.nMiniMapIcon = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_MINIMAPICON, 0); data.nViewDistance = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_VIEWDISTANCE, 0); data.nHeroSwitch = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROSWITCH, 0); data.szTotalSkinID = reader.GetString(i, (int)EMPersonModelConfig.EMPMC_TOTALSKINID, ""); data.nHeroUnLockLv = reader.GetInt(i, (int)EMPersonModelConfig.EMPMC_HEROUNLOCKLV, 0); m_personModelConfigs.Add(data); } reader.Dispose(); reader = null; }
// 载入商城广告页脚本 private void LoadPointShopADPageConfig(string stPath) { m_adConfig = new List <SSchemePointShopADConfig>(); ScpReader reader = new ScpReader(stPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemePointShopADConfig config = new SSchemePointShopADConfig(); int nIndex = 0; config.nID = reader.GetInt(i, nIndex++, 0); config.strTitle = reader.GetString(i, nIndex++, ""); config.strDesc = reader.GetString(i, nIndex++, ""); config.nLocType = reader.GetInt(i, nIndex++, 0); String strSellID = reader.GetString(i, nIndex++, ""); string[] sellIDList = strSellID.Split(';'); if (sellIDList != null) { config.nSellIDList = new List <int>(); for (int j = 0; j < sellIDList.Length; ++j) { int nSellID = 0; if (Int32.TryParse(sellIDList[j], out nSellID)) { config.nSellIDList.Add(nSellID); } } } config.strPicName = reader.GetString(i, nIndex++, ""); m_adConfig.Add(config); } }
private void LoadGuideTypeConfig(string stPath) { ScpReader reader = new ScpReader(stPath, true, 2); m_guideTypeDic = new Dictionary <int, SSchemeGuideType>(); for (int i = 0; i < reader.GetRecordCount(); i++) { int nTypeId = reader.GetInt(i, (int)EConsumptionGuideConfig.ECGC_COL_TYPE, 0); string strGuideName = reader.GetString(i, (int)EConsumptionGuideConfig.ECGC_COL_NAME, ""); string strGuideTitle = reader.GetString(i, (int)EConsumptionGuideConfig.ECGC_COL_TITLE, ""); string strGuideDesc = reader.GetString(i, (int)EConsumptionGuideConfig.ECGC_COL_DESC, ""); int nWndId = reader.GetInt(i, (int)EConsumptionGuideConfig.ECGC_COL_WND, 0); if (!m_guideTypeDic.ContainsKey(nTypeId)) { SSchemeGuideType guideType = new SSchemeGuideType(); guideType.nTypeId = nTypeId; guideType.strGuideName = strGuideName; guideType.strGuideTitle = strGuideTitle; guideType.guideWndList = new List <SSchemeGuideWnd>(); m_guideTypeDic.Add(nTypeId, guideType); } SSchemeGuideWnd guideWnd = new SSchemeGuideWnd(); guideWnd.nGuideDesc = strGuideDesc; guideWnd.nGuideWnd = nWndId; m_guideTypeDic[nTypeId].guideWndList.Add(guideWnd); } }
// 载入奖励脚本 private void LoadActorPrizeConfig(string stPath) { ScpReader reader = new ScpReader(stPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { int nIndex = 0; SSchemeActorPrizeConfig sConfig = new SSchemeActorPrizeConfig(); sConfig.nPrizeID = reader.GetInt(i, (int)nIndex++, 0); sConfig.strPrizeName = reader.GetString(i, (int)nIndex++, ""); sConfig.nPrizeIcon = reader.GetInt(i, (int)nIndex++, 0); sConfig.nPrizeGrade = reader.GetInt(i, (int)nIndex++, 0); sConfig.strPrizeDesc = reader.GetString(i, (int)nIndex++, ""); sConfig.nBroadcastFlag = reader.GetInt(i, (int)nIndex++, 0); sConfig.nPrizeType = reader.GetInt(i, (int)nIndex++, 0); sConfig.nCakeTrailEffectID = reader.GetInt(i, (int)nIndex++, 0); sConfig.nPedestalEffectID = reader.GetInt(i, (int)nIndex++, 0); sConfig.nPedestalGlowEffectID = reader.GetInt(i, (int)nIndex++, 0); sConfig.nPrizeParam = new int[5]; for (int j = 0; j < 5; ++j) { sConfig.nPrizeParam[j] = reader.GetInt(i, (int)nIndex++, 0); } m_actorPrizeConfig[sConfig.nPrizeID] = sConfig; } }
// 载入宝箱脚本 private void LoadPrizeChestConfig(string stPath) { ScpReader reader = new ScpReader(stPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { int nIndex = 0; SSchemePrizeChestConfig sConfig = new SSchemePrizeChestConfig(); sConfig.nChestId = reader.GetInt(i, (int)nIndex++, 0); sConfig.nChestFlag = reader.GetInt(i, (int)nIndex++, 0); sConfig.strChestName = reader.GetString(i, (int)nIndex++, ""); sConfig.nShowPrizeID = reader.GetInt(i, (int)nIndex++, 0); sConfig.nChestIcon = reader.GetInt(i, (int)nIndex++, 0); sConfig.strChestDesc = reader.GetString(i, (int)nIndex++, ""); sConfig.nCanBuy = reader.GetInt(i, (int)nIndex++, 0); sConfig.nAlwaysShow = reader.GetInt(i, (int)nIndex++, 0); sConfig.nChestModelID = reader.GetInt(i, (int)nIndex++, 0); sConfig.strNormalAction = reader.GetString(i, (int)nIndex++, ""); sConfig.strOpenAction = reader.GetString(i, (int)nIndex++, ""); sConfig.strShowAction = reader.GetString(i, (int)nIndex++, ""); sConfig.nCamEffectID = reader.GetInt(i, (int)nIndex++, 0); sConfig.nNormalEffect = reader.GetInt(i, (int)nIndex++, 0); sConfig.nOpenEffect = reader.GetInt(i, (int)nIndex++, 0); sConfig.nShowEffect = reader.GetInt(i, (int)nIndex++, 0); sConfig.nNotHaveEffect = reader.GetInt(i, (int)nIndex++, 0); sConfig.nPrizeGroupID = reader.GetInt(i, (int)nIndex++, 0); sConfig.nBgEffectID = reader.GetInt(i, (int)nIndex++, 0); m_prizeChestConfig[sConfig.nChestId] = sConfig; } }
/// <summary> /// 读取细节文件 /// </summary> /// <param name="dealitFileName">名称</param> /// <param name="modifList"></param> /// <param name="deleteList"></param> private static void ReadDetailFile(string dealitFileName, ref List <string> modifList, ref List <string> deleteList) { if (null == modifList) { modifList = new List <string>(); } if (null == deleteList) { deleteList = new List <string>(); } if (!File.Exists(dealitFileName)) { return; } string stSchemeAllText = File.ReadAllText(dealitFileName); if (stSchemeAllText.Equals(string.Empty)) { return; } //去掉\n,因为ScpReader以"\r"分割 stSchemeAllText = stSchemeAllText.Replace("\n", ""); //再干掉最后的"\r" stSchemeAllText = stSchemeAllText.Remove(stSchemeAllText.Length - 1, 0); ScpReader packageReader = new ScpReader(stSchemeAllText, "packageList", 0); int currentIndex = 0; //先读修改的 for (int i = currentIndex; i < packageReader.GetRecordCount(); ++i) { string SplitKey = packageReader.GetString(i, 0, string.Empty); if (SplitKey.Contains(AssetBundleManager.SplitCSVKey)) { currentIndex = i + 1; break; } modifList.Add(SplitKey); } //再读取删除的 for (int i = currentIndex; i < packageReader.GetRecordCount(); ++i) { string SplitKey = packageReader.GetString(i, 0, string.Empty); if (SplitKey.Contains(AssetBundleManager.SplitCSVKey)) { currentIndex = i + 1; break; } deleteList.Add(SplitKey); } packageReader = null; }
/// <summary> /// 将File内容读进来并存储 /// </summary> /// <param name="_fileInfo"></param> private void ReadCSVFile(FileInfo _fileInfo) { string file, strViewFilter, strKey, strValue; file = _fileInfo.Name.Split('.')[0]; if (!LocalizeDataTable.ContainsKey(file)) { LocalizeDataTable.Add(file, new Dictionary <string, Dictionary <string, string> >()); } ScpReader tmpCSVDocument = new ScpReader(_fileInfo.FullName, true, 2); string tmpCurrentView = string.Empty; for (int i = 0; i < tmpCSVDocument.GetRecordCount(); ++i) { //读"界面名" strViewFilter = tmpCSVDocument.GetString(i, (int)ELocalizationFile.ELF_View, i == 0?string.Empty: tmpCurrentView); if (i == 0 && strViewFilter == string.Empty) { Trace.LogError("配置表 " + file + " 出错!!第一个ViewFilter不能是空的。"); break; } else if (strViewFilter == string.Empty)//表当前位置与上一个位置的ViewFilter一致 { strViewFilter = tmpCurrentView; } else if (strViewFilter != tmpCurrentView)//表当前位置属于另一个ViewFilter { tmpCurrentView = strViewFilter; } //读"关键字" strKey = tmpCSVDocument.GetString(i, (int)ELocalizationFile.ELF_Key, string.Empty); if (strKey == string.Empty) { Trace.LogError("配置表:" + file + ",在界面:" + strViewFilter + " 有个关键字是空的,这是不允许的出错。"); break; } //读"显示内容" strValue = tmpCSVDocument.GetString(i, (int)ELocalizationFile.ELF_Value, string.Empty); if (strValue == string.Empty) { Trace.LogWarning("配置表:" + file + ",在界面:" + strViewFilter + ",有个值:" + strKey + " 显示的内容是空的,虽然这是允许,但请注意下。"); } if (!LocalizeDataTable[file].ContainsKey(strViewFilter)) { LocalizeDataTable[file].Add(strViewFilter, new Dictionary <string, string>()); } if (LocalizeDataTable[file][strViewFilter].ContainsKey(strKey)) { Trace.LogError("配置表: " + file + ",在界面:" + strViewFilter + ",有个值:" + strKey + " 是重复的,这是不允许的,请修改。"); } else { LocalizeDataTable[file][strViewFilter].Add(strKey, strValue); } } }
/// <summary> /// 加载声音配置 /// </summary> private static bool LoadSoundConfig(ref Dictionary <int, SoundConfigData> dataSet) { if (dataSet == null) { SoundSystemLog("参数dataset为null"); return(false); } string patch = ViewConfigManager.GetConfigFullPath(ConfigFileName); ScpReader SoundReader = new ScpReader(patch, true, 2); // 遍歷整個表并存儲起來 for (int i = 0; i < SoundReader.GetRecordCount(); ++i) { SoundConfigData data = new SoundConfigData(); data.nID = SoundReader.GetInt(i, (int)SoundConfigCol.COL_ID, 0); data.soundType = (EMSoundType)SoundReader.GetInt(i, (int)SoundConfigCol.COL_Type, 2); data.mixerGroupType = (AudioMixerGroupType)SoundReader.GetInt(i, (int)SoundConfigCol.COL_MixerGroupType, 1); data.nMixerGroupIndex = SoundReader.GetInt(i, (int)SoundConfigCol.COL_MixerGroupIndex, 0); data.bBypassEffect = SoundReader.GetInt(i, (int)SoundConfigCol.COL_BypassEffect, 0) > 0; data.bBypassReverbZone = SoundReader.GetInt(i, (int)SoundConfigCol.COL_BypassReverbZone, 0) > 0; data.bPlayOnAwake = SoundReader.GetInt(i, (int)SoundConfigCol.COL_PlayOnAwake, 1) > 0; data.nPriority = Mathf.Clamp(SoundReader.GetInt(i, (int)SoundConfigCol.COL_Priority, 128), 0, 256); data.fPitch = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_Pitch, 1), -3.0f, 3.0f); data.fStereoPan = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_StereoPan, 0), -1.0f, 1.0f); data.fReverZoneMix = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_ReverZoneMix, 1), 0, 1.1f); data.b3DSound = SoundReader.GetInt(i, (int)SoundConfigCol.COL_3DSound, 1) > 0; data.fDopplerLv = Mathf.Clamp(SoundReader.GetFloat(i, (int)SoundConfigCol.COL_DopplerLv, 1), 0, 5.0f); data.nSpread = Mathf.Clamp(SoundReader.GetInt(i, (int)SoundConfigCol.COL_Spread, 0), 0, 360);; data.audioRoffType = (AudioRolloffMode)SoundReader.GetInt(i, (int)SoundConfigCol.COL_RolloffMode, 0); data.fMinDistance = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_MinDistance, 1); data.fMaxDistance = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_MaxDistance, 15); data.nPlayTimes = SoundReader.GetInt(i, (int)SoundConfigCol.COL_PlayTimes, 1); data.fDuartion = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_Duartion, 0); data.fDelayPlayTime = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_DelayTime, 0); data.fIntervalBetweenPlayTimes = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_IntervalBetweenPlayTimes, 0); data.AssetBundleName = SoundReader.GetString(i, (int)SoundConfigCol.COL_AssetBundleName, ""); data.AssetName = SoundReader.GetString(i, (int)SoundConfigCol.COL_AssetName, ""); data.AssetGUID = SoundReader.GetString(i, (int)SoundConfigCol.COL_AssetGUID, ""); data.AssetSize_X = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_AssetSize_X, -1); data.AssetSize_Y = SoundReader.GetFloat(i, (int)SoundConfigCol.COL_AssetSize_Y, -1); data.szDependAssetGUID = SoundReader.GetString(i, (int)SoundConfigCol.COL_DependAssetGUID, ""); if (dataSet.ContainsKey(data.nID)) { SoundSystemLog(ConfigFileName + "拥有重复的ID!"); dataSet[data.nID] = data; } else { CheckConfig(data); dataSet.Add(data.nID, data); } } SoundReader.Dispose(); SoundReader = null; return(true); }
// 初始化csv表 protected void InitHeroTalentConfigPageCsv(string stPath) { ScpReader reader = new ScpReader(stPath, true, 2); allHeroTalentConfigPageTable = new Hashtable(); int nIndex = 0; for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeHeroTalentConfig sConfig = new SSchemeHeroTalentConfig(); sConfig.nHeroId = reader.GetInt(i, (int)HeroTalentConfig.EMT_HEROID, 0); sConfig.nTalentId = reader.GetInt(i, (int)HeroTalentConfig.EMT_TALENTID, 0); sConfig.nLevelLimit = reader.GetInt(i, (int)HeroTalentConfig.EMT_LEVELPLIMIT, 0); sConfig.nTalentIconId = reader.GetInt(i, (int)HeroTalentConfig.EMT_TALENTICONID, 0); sConfig.nRecommandShow = reader.GetInt(i, (int)HeroTalentConfig.EMT_RECOMMAND_SHOW, 0); sConfig.nActiveType = reader.GetInt(i, (int)HeroTalentConfig.EMT_ACTIVETYPE, 0); sConfig.nActiveStarLv = reader.GetInt(i, (int)HeroTalentConfig.EMT_ACTIVESTARLEVEL, 0); sConfig.nOnlyActive = reader.GetInt(i, (int)HeroTalentConfig.EMT_ONLYACTIVE, 0); sConfig.nShowType = reader.GetInt(i, (int)HeroTalentConfig.EMT_SHOWTYPE, 0); sConfig.nSlotId = reader.GetInt(i, (int)HeroTalentConfig.EMT_SLOTID, 0); sConfig.sTalentName = reader.GetString(i, (int)HeroTalentConfig.EMT_TALENTNAME, ""); sConfig.sTalentPrizeName = reader.GetString(i, (int)HeroTalentConfig.EMT_TALENTPRIZENAME, ""); sConfig.sTalenActiveDescInStatic = reader.GetString(i, (int)HeroTalentConfig.EMT_TALENTACTIVEDESC, ""); sConfig.sTalenDisableDescInStatic = reader.GetString(i, (int)HeroTalentConfig.EMT_TALENTDISABLEDESC, ""); sConfig.sTalenDescInWar = reader.GetString(i, (int)HeroTalentConfig.EMT_TALENTDESCINWAR, ""); sConfig.nTalentTermId = reader.GetInt(i, (int)HeroTalentConfig.EMT_TALENTTERMID, 0); if (sConfig.sTalenDisableDescInStatic == String.Empty) { string str = String.Format(ULocalizationService.Instance.Get("UIView", "TalentView", "TalentUnActiveDesc"), sConfig.nActiveStarLv); sConfig.sTalenDisableDescInStatic = sConfig.sTalenActiveDescInStatic + str; } if (sConfig.nActiveType == 0 && sConfig.nActiveStarLv == 0) { string str = ULocalizationService.Instance.Get("UIView", "TalentView", "TalentUnActiveDescEx"); sConfig.sTalenDisableDescInStatic = sConfig.sTalenActiveDescInStatic + str; } if (allHeroTalentConfigPageTable.ContainsKey(sConfig.nHeroId)) { HeroDicTalentConfig dicConig = allHeroTalentConfigPageTable[sConfig.nHeroId] as HeroDicTalentConfig; dicConig.dicTalentConfig[sConfig.nTalentId] = sConfig; } else { HeroDicTalentConfig dicConig = new HeroDicTalentConfig(); dicConig.dicTalentConfig[sConfig.nTalentId] = sConfig; allHeroTalentConfigPageTable[sConfig.nHeroId] = dicConig; } if (m_MaxStarActiveLv < sConfig.nActiveStarLv) { m_MaxStarActiveLv = sConfig.nActiveStarLv; } } }
public void Load(string strPath) { m_dicAnimSpriteConfig = new Dictionary <string, SSchemeAnimFrameData>(); ScpReader reader = new ScpReader(strPath, true); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeAnimFrameData sConfig = new SSchemeAnimFrameData(); sConfig.strAssetName = reader.GetString(i, (int)EAnimSpriteConfig.EASC_AssetName, string.Empty); sConfig.strAnimName = reader.GetString(i, (int)EAnimSpriteConfig.EASC_AnimName, string.Empty); sConfig.nAnimFrame = reader.GetInt(i, (int)EAnimSpriteConfig.EASC_AnimFrame, 1); string tmpAnimStartPos = reader.GetString(i, (int)EAnimSpriteConfig.EASC_AnimStartPos, "0;0"); sConfig.vec2AnimStartPos = new Vector2(float.Parse(tmpAnimStartPos.Split(';')[0]), float.Parse(tmpAnimStartPos.Split(';')[1])); string tmpAnimFrameSize = reader.GetString(i, (int)EAnimSpriteConfig.EASC_AnimFrameSize, "32;32"); sConfig.vec2AnimFrameSize = new List <Vector2>(); if (tmpAnimFrameSize.Contains("|")) { string[] sizeArray = tmpAnimFrameSize.Split('|'); if (sizeArray.Length != sConfig.nAnimFrame) { Trace.LogWarning("动画帧尺寸不一致,且尺寸数量与帧数不符,所有帧都用第一帧尺寸使用"); string tmpSize = sizeArray[0]; sConfig.vec2AnimFrameSize.Add(new Vector2(float.Parse(tmpSize.Split(';')[0]), float.Parse(tmpSize.Split(';')[1]))); } else { foreach (var strSize in sizeArray) { sConfig.vec2AnimFrameSize.Add(new Vector2(float.Parse(strSize.Split(';')[0]), float.Parse(strSize.Split(';')[1]))); } } } else { sConfig.vec2AnimFrameSize.Add(new Vector2(float.Parse(tmpAnimFrameSize.Split(';')[0]), float.Parse(tmpAnimFrameSize.Split(';')[1]))); } if (m_dicAnimSpriteConfig.ContainsKey(sConfig.strAnimName)) { Trace.LogWarning("有相同的动画名称:" + sConfig.strAnimName + "在表第" + i + "行."); } else { m_dicAnimSpriteConfig.Add(sConfig.strAnimName, sConfig); } } reader.Dispose(); reader = null; }
public void Load(string strPath) { m_dicUSoundTable = new Dictionary <string, SSchemeUSoundData>(); ScpReader reader = new ScpReader(strPath, true, 1); sb_USoundName = new StringBuilder(); string tmpCurrentFilter = string.Empty; string tmpSoundName = string.Empty; for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeUSoundData sConfig = new SSchemeUSoundData(); sConfig.USoundFilter = reader.GetString(i, (int)EUSoundConfig.USC_Filter, tmpCurrentFilter); if (i == 0 && sConfig.USoundFilter == string.Empty) { Trace.LogError("配置表出错!!第一行Filter不能是空的。"); break; } //表当前位置与上一个位置的ViewFilter一致 else if (sConfig.USoundFilter == string.Empty) { sConfig.USoundFilter = tmpCurrentFilter; } //表当前位置属于另一个ViewFilter else if (sConfig.USoundFilter != tmpCurrentFilter) { tmpCurrentFilter = sConfig.USoundFilter; } sConfig.USoundKey = reader.GetString(i, (int)EUSoundConfig.USC_Key, string.Empty); sConfig.USoundID = reader.GetInt(i, (int)EUSoundConfig.USC_ID, 0); GetSoundName(sConfig.USoundFilter, sConfig.USoundKey, ref tmpSoundName); if (m_dicUSoundTable.ContainsKey(tmpSoundName)) { Trace.LogWarning("有相同的音效名称:" + sConfig.USoundFilter + "," + sConfig.USoundKey + "表第" + i + "行"); } else { m_dicUSoundTable.Add(tmpSoundName, sConfig); } } reader.Dispose(); reader = null; IsConfigLoad = true; }
public void Load(string _strPath) { m_dicGoodsSchemeTable = new Dictionary <int, SSchemeMobaGoods>(); ScpReader MobaGoodsReader = new ScpReader(_strPath, true, 2);//new ScpReader(SchemeAllText, "MobaGoods", 2); for (int i = 0; i < MobaGoodsReader.GetRecordCount(); i++) { SSchemeMobaGoods goods = new SSchemeMobaGoods(); goods.GoodsID = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_ID, 0); goods.GoodsName = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_Name, string.Empty); goods.GoodsIconID = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_IconID, 0); goods.GoodsCost = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_Cost, 0); goods.GoodsSoldOutCost = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_SoldOutCost, 0); goods.GoodsDes = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_Description, string.Empty); goods.GoodsCanComposeList = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_CanComposeList, string.Empty); goods.GoodsNeedComposeList = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_NeedComposeList, string.Empty); goods.GoodsLabel = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_Label, string.Empty); goods.GoodsWarLimit = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_WarLimit, string.Empty); goods.GoodsSlotDes = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_SlotDescription, string.Empty); goods.GoodsVocationLimit = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_VocationTypeLimit, 0); goods.GoodsPreciousDegree = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_PreciousDegree, 0); goods.GoodsFlag = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_Flag, 0); goods.GoodsLocationInstructions = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_LocationInstructions, string.Empty); m_dicGoodsSchemeTable.Add(goods.GoodsID, goods); } // 需要加一列空值(服务端传过来时会传过来一个0 在这个容器里查找 如果不加会报错) if (m_dicGoodsSchemeTable.ContainsKey(0) == false) { m_dicGoodsSchemeTable.Add(0, new SSchemeMobaGoods()); } MobaGoodsReader.Dispose(); }
// 比赛说明脚本 private void LoadLegendCupTipConfig(string stPath) { ScpReader reader = new ScpReader(stPath, true, 2); m_cupTipConfig = new Dictionary <int, SSchemeLegendCupTipConfig>(); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeLegendCupTipConfig tipInfo = new SSchemeLegendCupTipConfig(); tipInfo.nTipID = reader.GetInt(i, (int)ECupTipCol.ECTC_COL_TIP_ID, 0); tipInfo.sCupTitle = reader.GetString(i, (int)ECupTipCol.ECTC_COL_TIP_TITLE, ""); tipInfo.sCupContent = reader.GetString(i, (int)ECupTipCol.ECTC_COL_TIP_CONTENT, ""); m_cupTipConfig[tipInfo.nTipID] = tipInfo; } }
private void ImportCSV() { string patch = AssetBundleManager.GetUICSVConfigPatch(); if (!File.Exists(patch)) { return; } m_ConfigTable.Clear(); string stSchemeAllText = System.IO.File.ReadAllText(patch); //去掉\n,因为ScpReader以"\r"分割 stSchemeAllText = stSchemeAllText.Replace("\n", ""); //再干掉最后的"\r" stSchemeAllText = stSchemeAllText.Remove(stSchemeAllText.Length - 1, 1); ScpReader UIReader = new ScpReader(stSchemeAllText, "UIConfig", 2); // 遍歷整個表并存儲起來 for (int i = 0; i < UIReader.GetRecordCount(); ++i) { UFileData data = new UFileData(); //data.packageID = UIReader.GetInt(i, (int)AssetBundleManager.UIConfigCol.COL_ID, -1); data.configData.AssetBundleName = UIReader.GetString(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetBundleName, ""); data.configData.AssetName = UIReader.GetString(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetName, ""); data.configData.AssetBundleName = UIReader.GetString(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetGUID, ""); data.configData.AssetSize_X = UIReader.GetFloat(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetSize_X, -1); data.configData.AssetSize_Y = UIReader.GetFloat(i, (int)AssetBundleManager.AssetConfigCol.COL_AssetSize_Y, -1); //包名已经存在了 if (m_ConfigTable.ContainsKey(data.configData.AssetBundleName)) { Dictionary <string, UFileData> ta = m_ConfigTable[data.configData.AssetBundleName]; if (ta.ContainsKey(data.configData.AssetName)) { Debug.LogError("重复的资源名:" + data.configData.AssetName + ",包:" + data.configData.AssetBundleName); continue; } ta.Add(data.configData.AssetName, data); } else { Dictionary <string, UFileData> ta = new Dictionary <string, UFileData>(); ta.Add(data.configData.AssetName, data); m_ConfigTable.Add(data.configData.AssetBundleName, ta); } } UIReader.Dispose(); UIReader = null; }
// 初始化csv表 protected void InitClanConfigCsv(string stPath) { ScpReader reader = new ScpReader(stPath, true, 2); tClanConfig = new SSchemeClanConfig(); for (int i = 0; i < (int)ClanConfigRow.EMT_ROW_MAX; i++) { switch (i) { case (int)ClanConfigRow.EMT_ROW_CLAN_DISMISSING_LIFE: { tClanConfig.nDismissingLife = reader.GetInt(i, 1, 0); } break; case (int)ClanConfigRow.EMT_ROW_CLAN_TIP: { tClanConfig.sClanTip = reader.GetString(i, 1, string.Empty); } break; default: break; } } }
// 初始化csv表 protected void InitSelectArrayTipPageCsv(string stPath) { // string stSchemeAllText = File.ReadAllText(stPath); ScpReader reader = new ScpReader(stPath, true, 2); allSelectArrayTipPageTable = new Hashtable(); int nIndex = (int)SELECTARRAYTIP.EMT_ID; for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeSelectArrayTipConfig sConfig = new SSchemeSelectArrayTipConfig(); sConfig.nId = reader.GetInt(i, (int)nIndex++, 0); sConfig.sName = reader.GetString(i, (int)nIndex++, ""); sConfig.nTiplimit = reader.GetInt(i, (int)nIndex++, 0); sConfig.nAssassinDown = reader.GetInt(i, (int)nIndex++, 0); sConfig.nAssassinUp = reader.GetInt(i, (int)nIndex++, 0); sConfig.nSoldier_limitDown = reader.GetInt(i, (int)nIndex++, 0); sConfig.nSoldier_limitUp = reader.GetInt(i, (int)nIndex++, 0); sConfig.nMagicDown = reader.GetInt(i, (int)nIndex++, 0); sConfig.nMagicUp = reader.GetInt(i, (int)nIndex++, 0); sConfig.nAdcDown = reader.GetInt(i, (int)nIndex++, 0); sConfig.nAdcUp = reader.GetInt(i, (int)nIndex++, 0); sConfig.nSupportDown = reader.GetInt(i, (int)nIndex++, 0); sConfig.nSupportUp = reader.GetInt(i, (int)nIndex++, 0); allSelectArrayTipPageTable[sConfig.nId] = sConfig; } InitSelectArrayTypeWord((int)MatchType.MatchType_One); }
private void InitPreLoadSkinLayoutCsv(string stPath) { m_ConfigMap = new Dictionary <int, SPreLoadSkinLayout>(); ScpReader reader = new ScpReader(stPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { SPreLoadSkinLayout config = new SPreLoadSkinLayout(); config.nSkinID = reader.GetInt(i, (int)PreLoadSkinLayoutColnum.EPSLC_SKIN_ID, 0); string strRelateSkinID = reader.GetString(i, (int)PreLoadSkinLayoutColnum.EPSLC_RELATE_SKIN_ID, ""); string[] relateSkinIDArray = strRelateSkinID.Split(';'); config.nRelateSkinID = new int[relateSkinIDArray.Length]; for (int j = 0; j < relateSkinIDArray.Length; ++j) { if (relateSkinIDArray[j] == "") { continue; } if (!int.TryParse(relateSkinIDArray[j], out config.nRelateSkinID[j])) { Debug.LogError(String.Format("配置格式错误:皮肤id格式错误,relateskinid={0},{1}", relateSkinIDArray[j], stPath)); continue; } } m_ConfigMap.Add(config.nSkinID, config); } }
public void Load(string strFilePath) { ScpReader reader = new ScpReader(strFilePath, true, 2); if (reader == null) { Trace.LogError("read sheme fail! file=" + strFilePath); return; } m_dicHeroSoundNodeMap.Clear(); int nRecordCount = reader.GetRecordCount(); for (int row = 0; row < nRecordCount; row++) { int nHeroID = reader.GetInt(row, 0, 0); if (m_dicHeroSoundNodeMap.ContainsKey(nHeroID)) { Trace.LogWarning("scheme id repeat! " + schemeFileName + " row=" + row); continue; } string randomArry = reader.GetString(row, 1, ""); SchemeHeroSoundNode node = new SchemeHeroSoundNode(nHeroID); node.PushSoundData(randomArry); m_dicHeroSoundNodeMap.Add(nHeroID, node); } }
private void LoadDefaultConfig(string stPath) { //走mpk包暂不判断文件 //if (!File.Exists(stPath)) //{ // Trace.Error("配置表:ChatSettingConfig.csv 不存在!"); // return; //} ScpReader reader = new ScpReader(stPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { int index = reader.GetInt(i, (int)ChatSettingTableColumn.Index, 0); string value = reader.GetString(i, (int)ChatSettingTableColumn.Value, ""); if (defaultChatSettingTable.ContainsKey((ChatSettingIndex)index)) { defaultChatSettingTable[(ChatSettingIndex)index] = value; } else { defaultChatSettingTable.Add((ChatSettingIndex)index, value); } } foreach (KeyValuePair <ChatSettingIndex, string> kvp in defaultChatSettingTable) { currentChatSettingTable.Add(kvp.Key, kvp.Value); } }
public void Load(string strPath) { m_dicSchemeSceneEffectNodeData = new Dictionary <int, SSchemeSceneEffectNodeData>(); ScpReader reader = new ScpReader(strPath, true, 1); for (int i = 0; i < reader.GetRecordCount(); i++) { SSchemeSceneEffectNodeData sConfig = new SSchemeSceneEffectNodeData(); sConfig.eSceneEffectID = reader.GetInt(i, (int)ESceneEffectNodeConfig.SEN_ID, 0); sConfig.nSceneEffectDuration = reader.GetInt(i, (int)ESceneEffectNodeConfig.SEN_Duration, 0); sConfig.strSceneEffectPath = reader.GetString(i, (int)ESceneEffectNodeConfig.SEN_Path, string.Empty); if (m_dicSchemeSceneEffectNodeData.ContainsKey(sConfig.eSceneEffectID)) { Trace.LogWarning("有相同的场景特效ID" + sConfig.eSceneEffectID + "表第" + i + "行"); } else { m_dicSchemeSceneEffectNodeData.Add(sConfig.eSceneEffectID, sConfig); } } reader.Dispose(); reader = null; }
// 任务脚本 private void LoadTaskConfig(string strPath) { ScpReader reader = new ScpReader(strPath, true, 2); m_mapContactTaskConfig = new Dictionary <int, List <SSchemeContactTaskConfig> >(); m_mapSystemTaskConfig = new Dictionary <int, SSchemeSystemTaskConfig>(); for (int i = 0; i < reader.GetRecordCount(); i++) { int nType = reader.GetInt(i, (int)ETaskConfigCol.ETCC_TASK_TYPE, 0); if (nType == (int)ENTASK_TYPE.ENTASK_TYPE_CONTACT) { int nSubType = reader.GetInt(i, (int)ETaskConfigCol.ETCC_SUBTYPE_ID, 0); if (!m_mapContactTaskConfig.ContainsKey(nSubType)) { List <SSchemeContactTaskConfig> listTask = new List <SSchemeContactTaskConfig>(); m_mapContactTaskConfig[nSubType] = listTask; } // 已有nSpecificType数据 int nSpecificType = reader.GetInt(i, (int)ETaskConfigCol.ETCC_SPECIFICTYPE_ID, 0); int nIndex = m_mapContactTaskConfig[nSubType].FindIndex(item => item.nSpecificType == nSpecificType); if (nIndex >= 0) { continue; } SSchemeContactTaskConfig taskInfo = new SSchemeContactTaskConfig(); taskInfo.nSubType = reader.GetInt(i, (int)ETaskConfigCol.ETCC_SUBTYPE_ID, 0); taskInfo.strSubTypeName = reader.GetString(i, (int)ETaskConfigCol.ETCC_SUBTYPE_NAME, ""); taskInfo.nSpecificType = reader.GetInt(i, (int)ETaskConfigCol.ETCC_SPECIFICTYPE_ID, 0); taskInfo.strSpecificTypeName = reader.GetString(i, (int)ETaskConfigCol.ETCC_SPECIFICTYPE_NAME, ""); taskInfo.strPublishDescription = reader.GetString(i, (int)ETaskConfigCol.ETCC_PUBLISH_DESCRIPTION, ""); taskInfo.strEmotionWords = reader.GetString(i, (int)ETaskConfigCol.ETCC_EMOTION_WORDS, ""); taskInfo.nTaskLevel = reader.GetInt(i, (int)ETaskConfigCol.ECTT_TASK_LEVEL, 0); m_mapContactTaskConfig[nSubType].Add(taskInfo); } else { SSchemeSystemTaskConfig systemTaskInfo = new SSchemeSystemTaskConfig(); systemTaskInfo.nTaskID = reader.GetInt(i, (int)ETaskConfigCol.ETCC_TASK_ID, 0); systemTaskInfo.nTaskType = nType; systemTaskInfo.nTaskLevel = reader.GetInt(i, (int)ETaskConfigCol.ECTT_TASK_LEVEL, 0); m_mapSystemTaskConfig[systemTaskInfo.nTaskID] = systemTaskInfo; } } }