public static void LoadData() { List <SuitSetData> dataList = new List <SuitSetData>(); SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("SuitSet"); int num = (reader.FieldCount - 3) / 2; while (reader.Read()) { SuitSetData data = new SuitSetData(); data.suitSetName = PELocalization.GetString(PETools.Db.GetInt(reader, "NameID")); data.itemProtoList = new List <int>(); data.itemProtoList.AddRange(PETools.Db.GetIntArray(reader, "IdList")); data.itemNames = GetEquipName(data.itemProtoList); data.setBuffs = new int[num][]; data.tips = new int[num]; for (int i = 0; i < num; i++) { data.setBuffs[i] = PETools.Db.GetIntArray(reader, "set" + (i + 2)); data.tips[i] = PETools.Db.GetInt(reader, "Tips" + (i + 2)); } dataList.Add(data); } g_SuitSetDatas = dataList.ToArray(); }
public void CheckEXBuffs() { if (m_EquipmentDirty) { m_EquipmentDirty = false; if (null == mSkEntity) { return; } if (null != m_EXBuffs) { for (int i = 0; i < m_EXBuffs.Count; ++i) { mSkEntity.CancelBuffById(m_EXBuffs[i]); } } m_EXBuffs.Clear(); m_SuitSetMatchDatas.Clear(); EquipSetData.GetSuitSetEffect(_ItemList, ref m_EXBuffs); SuitSetData.GetSuitSetEffect(_ItemList, ref m_EXBuffs, ref m_SuitSetMatchDatas); for (int i = 0; i < m_EXBuffs.Count; ++i) { SkEntity.MountBuff(mSkEntity, m_EXBuffs[i], null, null); } if (null != onSuitSetChange) { onSuitSetChange(m_SuitSetMatchDatas); } } }
public static SuitSetData GetData(int protoID) { if (null == g_SuitSetDatas) { return(null); } for (int i = 0; i < g_SuitSetDatas.Length; ++i) { SuitSetData data = g_SuitSetDatas[i]; if (null == data.itemProtoList) { continue; } if (data.itemProtoList.Contains(protoID)) { return(data); } } return(null); }
public static void LoadAllData() { if (s_localDatabase != null) { return; } #if UNITY_EDITOR System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); #endif s_localDatabase = LoadDb(); SkillSystem.SkData.LoadData(); Pathea.Effect.EffectData.LoadData(); Pathea.Projectile.ProjectileData.LoadData(); Pathea.RequestRelation.LoadData(); Pathea.CampData.LoadData(); Pathea.ThreatData.LoadData(); Pathea.DamageData.LoadData(); HumanSoundData.LoadData(); ItemDropData.LoadData(); PELocalization.LoadData(); NaturalResAsset.NaturalRes.LoadData(); //SkillAsset.EffCastData.LoadData(); //SkillAsset.EffSkill.LoadData(); //SkillAsset.MergeSkill.LoadData(); //AnimData.LoadData(); //AnimSoundData.LoadData(); AiAsset.AiData.LoadData(); SoundAsset.SESoundBuff.LoadData(); SoundAsset.SESoundStory.LoadData(); //CharacterData.LoadCharacterData(); StoryDoodadMap.LoadData(); StoreRepository.LoadData(); NpcMissionDataRepository.LoadData(); //PlayerAttribute.LoadData(); MissionRepository.LoadData(); TalkRespository.LoadData(); //NpcRandomRepository.LoadData(); ShopRespository.LoadData(); WareHouseManager.LoadData(); //HeroTalkRepository.LoadData(); MutiPlayRandRespository.LoadData(); PromptRepository.LoadData(); //MapIconData.LoadDate(); //MapMaskData.LoadDate(); CampPatrolData.LoadDate(); Camp.LoadData(); RepProcessor.LoadData(); CloudManager.LoadData(); //BattleUnitData.LoadData(); TutorialData.LoadData(); //RepairMachineManager.LoadData(); MapMaskData.LoadDate(); MessageData.LoadData(); //lz-2016.07.13 Add it MonsterHandbookData.LoadData(); //lz-2016.07.20 Add it StoryRepository.LoadData(); RMRepository.LoadRandMission(); MisInitRepository.LoadData(); CameraRepository.LoadCameraPlot(); AdRMRepository.LoadData(); VCConfig.InitConfig(); Cutscene.LoadData(); // BuildBrushData.LoadBrush(); BSPattern.LoadBrush(); BSVoxelMatMap.Load(); BSBlockMatMap.Load(); BlockBuilding.LoadBuilding(); LifeFormRule.LoadData(); PlantInfo.LoadData(); MetalScanData.LoadData(); BattleConstData.LoadData(); CustomCharactor.CustomMetaData.LoadData(); SkillTreeInfo.LoadData(); VArtifactUtil.LoadData(); Pathea.ActionRelationData.LoadActionRelation(); //colony CSInfoMgr.LoadData(); ProcessingObjInfo.LoadData(); CSTradeInfoData.LoadData(); CampTradeIdData.LoadData(); AbnormalTypeTreatData.LoadData(); CSMedicineSupport.LoadData(); //RandomItemMgr RandomItemDataMgr.LoadData(); FecesData.LoadData(); //randomdungeon RandomDungeonDataBase.LoadData(); AbnormalData.LoadData(); PEAbnormalNoticeData.LoadData(); RelationInfo.LoadData(); EquipSetData.LoadData(); SuitSetData.LoadData(); CheatData.LoadData(); Pathea.NpcProtoDb.Load(); Pathea.MonsterProtoDb.Load(); Pathea.MonsterRandomDb.Load(); Pathea.MonsterGroupProtoDb.Load(); Pathea.RandomNpcDb.Load(); Pathea.PlayerProtoDb.Load(); Pathea.TowerProtoDb.Load(); Pathea.DoodadProtoDb.Load(); Pathea.AttPlusNPCData.Load(); Pathea.AttPlusBuffDb.Load(); Pathea.NpcTypeDb.Load(); Pathea.NpcRandomTalkDb.Load(); Pathea.NpcThinkDb.LoadData(); Pathea.NpcEatDb.LoadData(); Pathea.NpcRobotDb.Load(); Pathea.NPCScheduleData.Load(); Pathea.NpcVoiceDb.LoadData(); InGameAidData.LoadData(); //lz-2016.08.21 add it MountsSkillDb.LoadData(); #if UNITY_EDITOR sw.Stop(); Debug.Log("Database Loaded : " + sw.ElapsedMilliseconds); sw.Reset(); #else Debug.Log("Database Loaded"); #endif }
/// <summary>套装属性</summary> string SuitAttribute(string text) { string str = text; if (null == str) { return(string.Empty); } if (null == ItemObj) { return(text); } string greenColFomat = "[B7EF54]{0}[-]"; string grayColFomat = "[808080]{0}[-]"; string suitNameFomat = "{0} ( {1}/{2} )"; char newLineStr = '\n'; string baseAttribute = ""; //基础属性 string singleAttribute = ""; //单个属性加成 string suitActiveInfo = ""; //套装信息 string suitAttribute = ""; //套装属性加成 string commonAttribute = ""; //通用属性 List <string> curCommonAttributes = new List <string>(); for (int i = 0; i < m_CommonAttributeIDs.Count; i++) { curCommonAttributes.Add(PELocalization.GetString(m_CommonAttributeIDs[i])); } if (curCommonAttributes.Count > 0) { string[] strArray = text.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries); if (null != strArray && strArray.Length > 0) { string curStr = ""; bool containsCommonAttri = false; for (int i = 0; i < strArray.Length; i++) { containsCommonAttri = false; curStr = strArray[i]; for (int j = 0; j < curCommonAttributes.Count; j++) { if (curStr.Contains(curCommonAttributes[j])) { commonAttribute += (curStr + newLineStr); containsCommonAttri = true; break; } } if (!containsCommonAttri) { baseAttribute += (curStr + newLineStr); } } } if (baseAttribute.Length > 1) { baseAttribute = baseAttribute.Substring(0, baseAttribute.Length - 1); } if (commonAttribute.Length > 1) { commonAttribute = commonAttribute.Substring(0, commonAttribute.Length - 1); } } else { baseAttribute = str; } EquipSetData data = EquipSetData.GetData(ItemObj); if (null != data) { singleAttribute = data.desStr; if (singleAttribute.Length > 1) { singleAttribute = singleAttribute.Substring(0, singleAttribute.Length - 1); } //lz-2016.11.07 颜色改到里面处理 //singleAttribute = string.Format(greenColFomat, singleAttribute); } EquipmentCmpt equipCmpt = GetEquipmentByCurItemPlace(); List <SuitSetData.MatchData> matchDatas = new List <SuitSetData.MatchData>(); if (null != equipCmpt && equipCmpt.matchDatas.Count > 0) { matchDatas = equipCmpt.matchDatas; } else { SuitSetData suitData = SuitSetData.GetData(ItemObj.protoId); if (null != suitData) { SuitSetData.MatchData matchData = new SuitSetData.MatchData(); matchData.name = suitData.suitSetName; matchData.itemProtoList = suitData.itemProtoList; matchData.itemNames = suitData.itemNames; matchData.tips = suitData.tips; matchData.activeTipsIndex = -1; matchDatas.Add(matchData); } } suitActiveInfo = ""; if (null != matchDatas && matchDatas.Count > 0) { SuitSetData.MatchData matchData = new SuitSetData.MatchData(); string curStr = ""; for (int i = 0; i < matchDatas.Count; i++) { if (null != matchDatas[i].itemProtoList && matchDatas[i].itemProtoList.Contains(ItemObj.protoId)) { matchData = matchDatas[i]; break; } } if (null != matchData.itemNames && matchData.itemNames.Count > 0) { int activeCount = (null == matchData.activeIndex) ? 0 : matchData.activeIndex.Count(a => a == true); suitActiveInfo = string.Format(suitNameFomat, matchData.name, activeCount, matchData.itemNames.Count); suitActiveInfo = string.Format(greenColFomat, suitActiveInfo); suitActiveInfo += newLineStr; for (int j = 0; j < matchData.itemNames.Count; j++) { curStr = matchData.itemNames[j]; if (!string.IsNullOrEmpty(curStr)) { if (null != matchData.activeIndex && j < matchData.activeIndex.Count && matchData.activeIndex[j]) { curStr = string.Format(greenColFomat, curStr); } else { curStr = string.Format(grayColFomat, curStr); } suitActiveInfo += (curStr + newLineStr); } } } if (null != matchData.tips && matchData.tips.Length > 0) { for (int j = 0; j < matchData.tips.Length; j++) { if (0 != matchData.tips[j]) { curStr = PELocalization.GetString(matchData.tips[j]); if (!string.IsNullOrEmpty(curStr)) { if (j <= matchData.activeTipsIndex) { curStr = string.Format(greenColFomat, curStr); } else { curStr = string.Format(grayColFomat, curStr); } suitAttribute += (curStr + newLineStr); } } } } } if (suitActiveInfo.Length > 1) { suitActiveInfo = suitActiveInfo.Substring(0, suitActiveInfo.Length - 1); } if (suitAttribute.Length > 1) { suitAttribute = suitAttribute.Substring(0, suitAttribute.Length - 1); } string newAttributeStr = ""; if (string.IsNullOrEmpty(singleAttribute) && string.IsNullOrEmpty(suitActiveInfo) && string.IsNullOrEmpty(suitAttribute)) { newAttributeStr = str; } else { if (!string.IsNullOrEmpty(baseAttribute)) { newAttributeStr += (baseAttribute + newLineStr + newLineStr); } if (!string.IsNullOrEmpty(singleAttribute)) { newAttributeStr += (singleAttribute + newLineStr + newLineStr); } if (!string.IsNullOrEmpty(suitActiveInfo)) { newAttributeStr += (suitActiveInfo + newLineStr + newLineStr); } if (!string.IsNullOrEmpty(suitAttribute)) { newAttributeStr += (suitAttribute + newLineStr + newLineStr); } if (!string.IsNullOrEmpty(commonAttribute)) { newAttributeStr += commonAttribute; } for (int i = newAttributeStr.Length - 1; i >= 0; i--) { if (newAttributeStr[i] == newLineStr) { newAttributeStr = newAttributeStr.Substring(0, i); } else { break; } } } return(newAttributeStr); }
public static void GetSuitSetEffect(List <ItemObject> equipList, ref List <int> buffList, ref List <MatchData> matchList) { if (null == buffList) { return; } if (null == equipList) { return; } if (null == matchList) { return; } if (null == g_SuitSetDatas) { return; } List <bool> activeIndex = null; int hitCount = 0; for (int i = 0; i < g_SuitSetDatas.Length; ++i) { SuitSetData data = g_SuitSetDatas[i]; if (null == data.itemProtoList) { continue; } if (null == activeIndex) { activeIndex = new List <bool>(); } else { activeIndex.Clear(); } hitCount = 0; for (int protoIDIndex = 0; protoIDIndex < data.itemProtoList.Count; ++protoIDIndex) { activeIndex.Add(false); for (int j = 0; j < equipList.Count; ++j) { if (null == equipList[j]) { continue; } if (data.itemProtoList[protoIDIndex] == equipList[j].protoId) { ++hitCount; activeIndex[protoIDIndex] = true; break; } } } if (0 < hitCount) { MatchData matchData = new MatchData(); matchData.itemProtoList = data.itemProtoList; matchData.name = data.suitSetName; matchData.itemNames = data.itemNames; matchData.activeIndex = activeIndex; matchData.tips = data.tips; matchData.activeTipsIndex = 1 < hitCount ? hitCount - 2 : -1; matchList.Add(matchData); activeIndex = null; for (int j = 0; j <= matchData.activeTipsIndex; ++j) { if (null != data.setBuffs[j]) { buffList.AddRange(data.setBuffs[j]); } } } } }