/// <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; }
// 初始化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); } }
// 任务脚本 private void LoadSeasonConfig(string strPath) { ScpReader reader = new ScpReader(strPath, true, 2); m_mapSeasonPrizeConfig = new Dictionary <int, Dictionary <int, SSchemeSeasonPrizeConfig> >(); for (int i = 0; i < reader.GetRecordCount(); i++) { int nCol = 0; SSchemeSeasonPrizeConfig node = new SSchemeSeasonPrizeConfig(); node.nPrizeConfigID = reader.GetInt(i, nCol++, 0); node.szSeasonDesc = reader.GetString(i, nCol++, ""); node.nRankGrade = reader.GetInt(i, nCol++, 0); node.szGradeDesc = reader.GetString(i, nCol++, ""); string[] strNormalPrizeList = reader.GetString(i, nCol++, "").Split(';'); if (strNormalPrizeList != null && strNormalPrizeList.Length > 0) { node.arrNormalPrize = new int[strNormalPrizeList.Length]; for (int j = 0; j < strNormalPrizeList.Length; j++) { Int32.TryParse(strNormalPrizeList[j], out node.arrNormalPrize[j]); } } string[] strExtraConditionList = reader.GetString(i, nCol++, "").Split(';'); if (strExtraConditionList != null && strExtraConditionList.Length > 0) { node.arrExtraCondition = new int[strExtraConditionList.Length]; for (int j = 0; j < strExtraConditionList.Length; j++) { Int32.TryParse(strExtraConditionList[j], out node.arrExtraCondition[j]); } } string[] strExtraPrizeList = reader.GetString(i, nCol++, "").Split(';'); if (strExtraPrizeList != null && strExtraPrizeList.Length > 0) { node.arrExtraPrize = new int[strExtraPrizeList.Length]; for (int j = 0; j < strExtraPrizeList.Length; j++) { Int32.TryParse(strExtraPrizeList[j], out node.arrExtraPrize[j]); } } node.nAccountScore = reader.GetInt(i, nCol++, 0); node.szNormalCondition = reader.GetString(i, nCol++, ""); node.szExtralCondition = reader.GetString(i, nCol++, ""); if (m_mapSeasonPrizeConfig.ContainsKey(node.nPrizeConfigID) == false) { Dictionary <int, SSchemeSeasonPrizeConfig> dicPrize = new Dictionary <int, SSchemeSeasonPrizeConfig>(); m_mapSeasonPrizeConfig.Add(node.nPrizeConfigID, dicPrize); } m_mapSeasonPrizeConfig[node.nPrizeConfigID].Add(node.nRankGrade, node); } }
public void Load(string strFilePath) { ScpReader reader = new ScpReader(strFilePath, true); if (reader == null) { Trace.LogError("read scheme fail! file = " + strFilePath); return; } m_dicLightEffectNodeList.Clear(); if (AssetBundleManager.isOnRunTimeMode) { int nRecorderCount = reader.GetRecordCount(); for (int row = 0; row < nRecorderCount; row++) { int nType = reader.GetInt(row, (int)Column_Common.COL_CFGTYPE, 0); AddSchemeNode(nType, reader, row); } } else { UnityEngine.Object[] assets = AssetBundleManager.LoadAllAssetOnEditorFromPathInstance(editorModeAssetPath, typeof(LightingEffect)); foreach (UnityEngine.Object asset in assets) { LightingEffect ef = asset as LightingEffect; AddLightEffect(ef); } } }
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 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 InitWarBgmConfigCsv(string path) { ScpReader reader = new ScpReader(path, true, 2); warBgmConfigDic = new Dictionary <int, List <SSchemeWarBgmConfig> >(); for (int i = 0; i < reader.GetRecordCount(); i++) { int nCol = 0; int configID = reader.GetInt(i, nCol++, 0); SSchemeWarBgmConfig sConfig = new SSchemeWarBgmConfig(); sConfig.soundID = reader.GetInt(i, nCol++, 0); sConfig.playCount = reader.GetInt(i, nCol++, 0); sConfig.playDelay = reader.GetFloat(i, nCol++, 0); sConfig.playInterval = reader.GetFloat(i, nCol++, 0); List <SSchemeWarBgmConfig> warBgmList; if (!warBgmConfigDic.TryGetValue(configID, out warBgmList)) { warBgmList = new List <SSchemeWarBgmConfig>(); warBgmConfigDic.Add(configID, warBgmList); } warBgmConfigDic[configID].Add(sConfig); } reader.Dispose(); reader = null; }
// 初始化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; } }
// 载入商城广告页脚本 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); } }
// 初始化csv表 protected void InitWarSupportPositionConfigCsv(string stPath) { ScpReader reader = new ScpReader(stPath, true, 2); allWarSupportPositionConfigTable = new Hashtable(); for (int i = 0; i < reader.GetRecordCount(); i++) { int nCol = 0; SSchemeWarSupportPositionConfig sConfig = new SSchemeWarSupportPositionConfig(); sConfig.nSortID = reader.GetInt(i, nCol++, 0); sConfig.nPlayerCount = reader.GetInt(i, nCol++, 0); sConfig.fUIPositionOffsetX = reader.GetFloat(i, nCol++, 0.0f); sConfig.playerOffsetVec3.x = reader.GetFloat(i, nCol++, 0.0f); sConfig.playerOffsetVec3.y = reader.GetFloat(i, nCol++, 0.0f); sConfig.playerOffsetVec3.z = reader.GetFloat(i, nCol++, 0.0f); if (allWarSupportPositionConfigTable.ContainsKey(sConfig.nSortID)) { (allWarSupportPositionConfigTable[sConfig.nSortID] as List <SSchemeWarSupportPositionConfig>).Add(sConfig); } else { List <SSchemeWarSupportPositionConfig> positionList = new List <SSchemeWarSupportPositionConfig>(); positionList.Add(sConfig); allWarSupportPositionConfigTable[sConfig.nSortID] = positionList; } } }
// 初始化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 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; } }
public void Load(string strFilePath) { ScpReader reader = new ScpReader(strFilePath, true, 2); if (reader == null) { Trace.LogError("read scheme fail! file:" + strFilePath); return; } m_dicOBCtrlKeyCodeNodeMap.Clear(); m_dicOBCtrlParamNodeMap.Clear(); int nCount = reader.GetRecordCount(); for (int row = 0; row < nCount; row++) { int nType = reader.GetInt(row, (int)Column_OBCtrl.COL_TYPE, 0); if (nType == 1) { LoadKeyCodeNode(reader, row); } else if (nType == 2) { LoadParamNode(reader, row); } else { Trace.LogError("invalid type! row = " + row + "file:" + strFilePath); } } }
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 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 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; }
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 InitCameraConfigCsv(string stPath) { ScpReader reader = new ScpReader(stPath, true, 2); CameraConfigTable = new Hashtable(); for (int i = 0; i < reader.GetRecordCount(); i++) { int index = reader.GetInt(i, (int)CamConfig.EMT_INDEX, 0); int heroID = reader.GetInt(i, (int)CamConfig.EMT_HEROTYPE, 0); int mapID = reader.GetInt(i, (int)CamConfig.EMT_MAPTYPE, 0); SoldierCamera.CameraParam[] caminfo = new SoldierCamera.CameraParam[4]; int modeAttributeCount = 8;//每一项有8个参数 for (int mode = 0; mode < 4; mode++) { caminfo[mode] = new SoldierCamera.CameraParam(); caminfo[mode].curDistance = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_DEFAULTDISTANCE, 0); Vector2 disRange = new Vector2(); disRange.x = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_MINDISTANCE, 0); disRange.y = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_MAXDISTANCE, 0); caminfo[mode].distanceRange = disRange; caminfo[mode].curPitchAngle = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_DEFAULTANGLE, 0); Vector2 angleRange = new Vector2(); angleRange.x = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_MINANGLE, 0); angleRange.y = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_MAXANGLE, 0); caminfo[mode].pitchAngleRange = angleRange; caminfo[mode].targetOffset = reader.GetFloat(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_TARGETOFFSET, 0); caminfo[mode].FOV = reader.GetInt(i, mode * modeAttributeCount + (int)CamConfig.EMT_USER_FOV, 0); } CameraConfigTable[mapID * MAX_HERO_TYPE + heroID] = caminfo; } }
// 初始化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 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); } }
// 初始化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 InitSpellSlotConfigCsv(string stPath) { if (slotDict != null || slotDict.Count > 0) { return; } if (!File.Exists(stPath)) { return; } ScpReader reader = new ScpReader(stPath, true, 2); for (int i = 0; i < reader.GetRecordCount(); i++) { int nCol = 0; //读取表中记录的数据类型(HeroGemPageSettingConfig) int nHeroID = reader.GetInt(i, nCol, 0); int nGemPageIndex = reader.GetInt(i, nCol++, 0); HeroSlotItem item = new HeroSlotItem(); const int slotNumCol = 13; item.slotNum = reader.GetInt(i, slotNumCol, 0); item.skillIDList = new List <int>(); for (int n = 1; n <= item.slotNum; n++) { int skillID = reader.GetInt(i, slotNumCol + n, 0); item.skillIDList.Add(skillID); } slotDict.Add(nHeroID, item); } }
// 比赛脚本 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; } }
public static void LoadResourceTable(string path) { resourcetable.Clear(); ScpReader reader = new ScpReader(path, true); for (int i = 0; i < reader.GetRecordCount(); i++) { ResourceInfoEx currentinfo = new ResourceInfoEx(); currentinfo.bundlename = reader.GetString(i, 2, ""); currentinfo.assetfilename = reader.GetString(i, 3, ""); currentinfo.objectname = reader.GetString(i, 1, ""); currentinfo.classname = reader.GetString(i, 0, ""); currentinfo.typename = reader.GetString(i, 4, ""); currentinfo.path = reader.GetString(i, 5, ""); currentinfo.offset = reader.GetLong(i, 6, -1); currentinfo.length = reader.GetLong(i, 7, -1); if (resourcetable.ContainsKey(currentinfo.classname) == false) { resourcetable[currentinfo.classname] = new Dictionary <string, ResourceInfoEx>(); } Dictionary <string, ResourceInfoEx> resourcelist = resourcetable[currentinfo.classname]; resourcelist[currentinfo.objectname] = currentinfo; } reader.Dispose(); Trace.Log("ResourceEx::LoadResourceTable:" + path + " finish"); }
/// <summary> /// 初始化技能提示 /// </summary> /// <param name="strDefaultViewConfigPath"></param> private void InitAboutShowSpellPromptScheme(string strDefaultViewConfigPath) { string strLabelDescriptionPath = strDefaultViewConfigPath + MobaSchemesConfig.SHOW_SPELL_PROMPT; ScpReader ShowSpellPromptReader = new ScpReader(strLabelDescriptionPath, true, 2); ShowSpellPromptTable = new Hashtable(); for (int i = 0; i < ShowSpellPromptReader.GetRecordCount(); i++) { SSchemeShowSpellPrompt data = new SSchemeShowSpellPrompt(); data.nID = ShowSpellPromptReader.GetInt(i, (int)EShowSpellPrompt.ESSP_ID, -1); if (data.nID == -1) { break; } data.nSpellID = ShowSpellPromptReader.GetInt(i, (int)EShowSpellPrompt.ESSP_SpellID, 0); data.nSlotID = ShowSpellPromptReader.GetInt(i, (int)EShowSpellPrompt.ESSP_SlotID, 0); ShowSpellPromptTable.Add(data.nID, data); } ShowSpellPromptReader.Dispose(); }
/// <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); } }
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; }
/// <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); } } }