private void MoveToNextMap() { if (m_mapAcrossIDList.Count > 0) { uint fromMapID = this.mapId; m_currentMoveToMapID = m_mapAcrossIDList[0]; m_mapAcrossIDList.Remove(m_currentMoveToMapID); KTabFile <KMapTriggerInfo> focusMap = KConfigFileManager.GetInstance().mapMapsTrigger[fromMapID]; foreach (KeyValuePair <string, KMapTriggerInfo> kmt in focusMap.getAllData()) { if (kmt.Value.ChangeMapID == m_currentMoveToMapID) { string[] pos = kmt.Value.TriggerPoint.Split(';'); if (pos.Length != 2) { Debug.LogError("MoveToNextMap error TriggerPoint; from " + fromMapID.ToString() + "to " + m_currentMoveToMapID.ToString()); } Vector3 target = MapUtils.GetMetreFromInt(int.Parse(pos[0]), int.Parse(pos[1])); this.MainHero.DispatchEvent(ControllerCommand.MOVE_TO_DES, target, true); break; } } } else { m_bInAutoAcrossMap = false; this.MainHero.DispatchEvent(ControllerCommand.MOVE_TO_DES, m_vecTargetPos, true); } }
private static void EnsureConfigFile() { if (!File.Exists(ConfFilePath)) { KTabFile confFile = new KTabFile(); confFile.NewColumn("Key"); confFile.NewColumn("Value"); confFile.NewColumn("Comment"); foreach (string[] strArr in DefaultConfigs) { int row = confFile.NewRow(); confFile.SetValue <string>(row, "Key", strArr[0]); confFile.SetValue <string>(row, "Value", strArr[1]); confFile.SetValue <string>(row, "Comment", strArr[2]); } confFile.Save(ConfFilePath); Logger.Log("新建CosmosEngine配置文件: {0}", ConfFilePath); AssetDatabase.Refresh(); } ConfFile = KTabFile.LoadFromFile(ConfFilePath); }
// 直接从字符串分析 public static KTabFile LoadFromString(string content) { KTabFile tabFile = new KTabFile(); tabFile.ParseString(content); return(tabFile); }
void Awake() { if (null == _camere) { _camere = Camera.main; } cameraConfig = new KTabFile <KCameraConfig>("Settings/camera_config"); }
// 直接从文件, 传入完整目录,跟通过资源管理器自动生成完整目录不一样,给art库用的 public static KTabFile LoadFromFile(string fileFullPath) { KTabFile tabFile = new KTabFile(); if (tabFile.LoadByIO(fileFullPath)) { return(tabFile); } else { return(null); } }
/// <summary> /// 真正进行读取 /// </summary> /// <param name="type"></param> /// <param name="contents"></param> private void DoLoadTab(Type type, IEnumerable <string> contents) { Debuger.Assert(typeof(CBaseInfo).IsAssignableFrom(type)); foreach (string content in contents) { using (KTabFile tabFile = KTabFile.LoadFromString(content)) { Dictionary <string, CBaseInfo> dict; if (!SettingInfos.TryGetValue(type, out dict)) // 如果没有才添加 { dict = new Dictionary <string, CBaseInfo>(); } const int rowStart = 1; for (int row = rowStart; row <= tabFile.GetHeight(); row++) { // 先读取ID, 获取是否之前已经读取过配置, // 如果已经读取过,那么获取原配置对象,并重新赋值 (因为游戏中其它地方已经存在它的引用了,直接替换内存泄露) string id = tabFile.GetString(row, "Id"); // 获取ID是否存在, 如果已经存在,那么替换其属性,不new一个 CBaseInfo existOne; if (dict.TryGetValue(id, out existOne)) { if (FoundDuplicatedIdEvent != null) { FoundDuplicatedIdEvent(type, row, id); } CBaseInfo existInfo = existOne; existInfo.ReadFromTab(type, ref existInfo, tabFile, row); // 修改原对象,不new existInfo.CustomReadLine(tabFile, row); (existInfo as CBaseInfo).Parse(); } else { CBaseInfo pInfo = CBaseInfo.NewFromTab(type, tabFile, row); pInfo.CustomReadLine(tabFile, row); pInfo.Parse(); dict[pInfo.Id] = pInfo; // 不存在,直接new } } SettingInfos[type] = dict; } } }
private void LoadMapListComplet() { LoadComplet(); mapMapsTrigger = new Dictionary <uint, KTabFile <KMapTriggerInfo> >(); foreach (KeyValuePair <string, KMapListSetting> kvp in mapListSetting.getAllData()) { uint mapID = 0; if (!uint.TryParse(kvp.Key, out mapID)) { continue; } KTabFile <KMapTriggerInfo> info = new KTabFile <KMapTriggerInfo>("maps/" + kvp.Key + "/map_trigger", LoadComplet); ++ToBeLoadTotalCount; mapMapsTrigger.Add(mapID, info); } }
public void WriteVersion() { string path = GetBuildVersionTab(); // MakeSureExportPath(VerCtrlInfo.VerFile, EditorUserBuildSettings.activeBuildTarget); KTabFile tabFile = new KTabFile(); tabFile.NewColumn("AssetPath"); tabFile.NewColumn("AssetMD5"); tabFile.NewColumn("AssetDateTime"); tabFile.NewColumn("ChangeCount"); foreach (var node in StoreBuildVersion) { int row = tabFile.NewRow(); tabFile.SetValue(row, "AssetPath", node.Key); tabFile.SetValue(row, "AssetMD5", node.Value.MD5); tabFile.SetValue(row, "AssetDateTime", node.Value.DateTime); tabFile.SetValue(row, "ChangeCount", node.Value.ChangeCount); } tabFile.Save(path); }
private void SetupHistory() { BuildedList.Clear(); string verFile = GetBuildVersionTab(); //MakeSureExportPath(VerCtrlInfo.VerFile, EditorUserBuildSettings.activeBuildTarget); KTabFile tabFile; if (File.Exists(verFile)) { tabFile = KTabFile.LoadFromFile(verFile); foreach (KTabFile.RowInterator row in tabFile) { var assetPath = row.GetString("AssetPath"); StoreBuildVersion[assetPath] = new BuildRecord( row.GetString("AssetMD5"), row.GetString("AssetDateTime"), row.GetInteger("ChangeCount")); } } }
private void SearchMap(KTabFile <KMapTriggerInfo> focusMap, List <uint> haveSearched, List <uint> resultList) { foreach (KeyValuePair <string, KMapTriggerInfo> kmt in focusMap.getAllData()) { uint id = kmt.Value.ChangeMapID; if (haveSearched.IndexOf(id) == -1) { List <uint> tempR = new List <uint>(); tempR.AddRange(resultList); tempR.Add(id); if (id == m_toMapId) { tempR.Remove(m_fromMapId); m_resultList.Add(tempR); break; } else { List <uint> tempH = new List <uint>(); tempH.AddRange(haveSearched); foreach (KeyValuePair <string, KMapTriggerInfo> exitKmt in focusMap.getAllData()) { tempH.Add(exitKmt.Value.ChangeMapID); } if (KConfigFileManager.GetInstance().mapMapsTrigger.ContainsKey(id)) { this.SearchMap(KConfigFileManager.GetInstance().mapMapsTrigger[id], tempH, tempR); } } } } haveSearched = null; resultList = null; }
private static void EnsureConfigFile() { if (!File.Exists(ConfFilePath)) { KTabFile confFile = new KTabFile(); confFile.NewColumn("Key"); confFile.NewColumn("Value"); confFile.NewColumn("Comment"); foreach (string[] strArr in DefaultConfigs) { int row = confFile.NewRow(); confFile.SetValue<string>(row, "Key", strArr[0]); confFile.SetValue<string>(row, "Value", strArr[1]); confFile.SetValue<string>(row, "Comment", strArr[2]); } confFile.Save(ConfFilePath); Logger.Log("新建CosmosEngine配置文件: {0}", ConfFilePath); AssetDatabase.Refresh(); } ConfFile = KTabFile.LoadFromFile(ConfFilePath); }
internal RowInterator(KTabFile tabFile) { TabFile = tabFile; }
public void LoadConfigFile() { kparams = new KTabFile <KParams>("Settings/params", LoadComplet); ++ToBeLoadTotalCount; animEvent = new KTabFile <KAminEvent>("Settings/skill/anim_event", LoadComplet); ++ToBeLoadTotalCount; localizationTexts = new KTabFile <KLocalizationText>("ClientSettings/localizationtext", LoadComplet); ++ToBeLoadTotalCount; itemTabInfos = new KTabFile <KTabLineItem>("ClientSettings/other", LoadComplet); ++ToBeLoadTotalCount; equipTabInfos = new KTabFile <KTabLineEquip>("ClientSettings/equip", LoadComplet); ++ToBeLoadTotalCount; equipStrengthenTab = new KTabFile <KEquipStrengthen>("Settings/item/equip_strengthen", LoadComplet); ++ToBeLoadTotalCount; equipSteptab = new KTabFile <KEquipStep>("Settings/item/equip_step", IntensifyLogic.GetInstance().EquipStepComplete, LoadComplet); ++ToBeLoadTotalCount; equipServerTab = new KTabFile <KTabServerEquip>("Settings/item/equip", LoadComplet); ++ToBeLoadTotalCount; equipClientTab = new KTabFile <KTabClientEquip>("ClientSettings/equip_client", LoadComplet); ++ToBeLoadTotalCount; equipSuitTab = new KTabFile <KTabEquipSuit>("Settings/item/equip_suit", LoadComplet); ++ToBeLoadTotalCount; showTabInfos = new KTabFile <KTabLineShowInfo>("ClientSettings/show", LoadComplet); ++ToBeLoadTotalCount; skillDisplay = new KTabFile <KSkillDisplay>("Settings/skill/skill_display", LoadComplet); ++ToBeLoadTotalCount; giftTabFile = new KTabFile <KGiftData>("Settings/gift", LoadComplet); ++ToBeLoadTotalCount; heroSetting = new KTabFile <KHeroSetting>("Settings/hero/hero", LoadComplet); ++ToBeLoadTotalCount; plotInfo = new KTabFile <KPlotInfo>("Settings/mission/plot_info", LoadComplet); ++ToBeLoadTotalCount; mapListSetting = new KTabFile <KMapListSetting>("Settings/map_list", LoadMapListComplet); ++ToBeLoadTotalCount; buffs = new KTabFile <KBuff>("Settings/skill/buff_info", GameApplication.BuffderLoadComplete, LoadComplet); ++ToBeLoadTotalCount; // activeSkillList = new KTabFile<KActiveSkill>("Settings/skill/active_skill", KSkillManager.GetInstance().ActiveSkillLoadComplete, LoadComplet); activeSkillList = new KTabFile <KActiveSkill>("Settings/skill/active_skill", LoadComplet); ++ToBeLoadTotalCount; // passiveSkillList = new KTabFile<KPassiveSkill>("Settings/skill/passive_skill", KSkillManager.GetInstance().PassiveSkillLoadComplete, LoadComplet); passiveSkillList = new KTabFile <KPassiveSkill>("Settings/skill/passive_skill", LoadComplet); ++ToBeLoadTotalCount; missionLoaclInfoList = new KTabFile <KMissionLoaclInfo>("Settings/quests", MissionLogic.GetInstance().MissionLoadComplete, LoadComplet); ++ToBeLoadTotalCount; missionDialogueList = new KTabFile <KMissionDialogue>("Settings/mission/dialogue", MissionLogic.GetInstance().DialogueLoadComplete, LoadComplet); ++ToBeLoadTotalCount; playerLevelSetting = new KTabFile <KPlayerLevelExpSetting>("Settings/player_level_exp", PlayerLevelExp.GetInstance().PlayerLevelExpLoadComplete, LoadComplet); ++ToBeLoadTotalCount; npcPoss = new KTabFile <KNpcPos>("ClientSettings/npc_pos", NpcLogic.GetInstance().NpcPosLoadComplete, LoadComplet); ++ToBeLoadTotalCount; clientConfig = new KIniFile("ClientSettings/config", LoadComplet); ++ToBeLoadTotalCount; resourceVersion = new KResourceVersion(LoadComplet); ++ToBeLoadTotalCount; pveList = new KTabFile <KPve>("Settings/pve", LoadComplet); ++ToBeLoadTotalCount; collectMissionInfo = new KTabFile <KCollectMissionInfo>("Settings/mission/collect_mission", LoadComplet); ++ToBeLoadTotalCount; }