bool InitConfig() { string fsPath = LevelUtil.GetConfigPath(this.Id); this.m_Config = new LvlConfig(); return(this.m_Config.Load(fsPath)); }
public override void DrawGUI() { #if UNITY_EDITOR GUILayout.Space(10); this.Id = UnityEditor.EditorGUILayout.IntField("Id", this.Id); this.LvlName = UnityEditor.EditorGUILayout.TextField("LvlName", this.LvlName); GUI.color = new Color(0.8f, 0.8f, 1.0f); if (GUILayout.Button("Import", GUILayout.Height(30))) { bool success = this.InitConfig(); if (success) { this.DelAllElements(); this.Import(m_Config); } else { Debug.LogError(string.Format("LvlID = {0},无法导入数据", this.Id)); } } GUI.color = new Color(0.0f, 0.9f, 0.2f); GUILayout.Space(5); if (GUILayout.Button("Export", GUILayout.Height(30))) { LvlConfig mc = (LvlConfig)Export(); mc.Id = Id; mc.LvlName = LvlName; string fileName = string.Format("{0}/Resources/Text/Lvl/{1}.xml", Application.dataPath, mc.Id); mc.Save(fileName); } #endif }
public void ImportInPlay(DCFG dd) { LvlConfig cfg = dd as LvlConfig; ImportDCFGByElement <LevelBorn, GroupBorn, LvlBorn>(cfg.Borns, GetGroup <GroupBorn>(), false); ImportDCFGByElement <LevelPortal, GroupPortal, LvlPortal>(cfg.Portals, GetGroup <GroupPortal>(), false); ImportDCFGByElement <LevelBarrier, GroupBarrier, LvlBarrier>(cfg.Barriers, GetGroup <GroupBarrier>(), false); ImportDCFGByElement <LevelObj, GroupObj, LvlObj>(cfg.Objs, GetGroup <GroupObj>(), false); ImportDCFGByElement <LevelMonster, GroupMonster, LvlMonster>(cfg.Monsters, GetGroup <GroupMonster>(), false); ImportDCFGByElement <LevelNpc, GroupNpc, LvlNpc>(cfg.Npcs, GetGroup <GroupNpc>(), false); ImportDCFGByElement <LevelRegion, GroupRegion, LvlRegion>(cfg.Regions, GetGroup <GroupRegion>(), false); ImportDCFGByElement <LevelRegionMine, GroupRegionMine, LvlRegionMine>(cfg.RegionMines, GetGroup <GroupRegionMine>(), false); ImportDCFGByElement <LevelRegionWave, GroupRegionWave, LvlRegionWave>(cfg.RegionWaves, GetGroup <GroupRegionWave>(), false); ImportDCFGByElement <LevelRegionMonster, GroupRegionMonster, LvlRegionMonster>(cfg.RegionMonsters, GetGroup <GroupRegionMonster>(), false); ImportDCFGByElement <LevelPath, GroupPath, LvlPath>(cfg.Paths, GetGroup <GroupPath>(), false); }
public override DCFG Export() { LvlConfig cfg = new LvlConfig(); ExportDCFGByElement <LevelBorn, GroupBorn, LvlBorn>(cfg.Borns); ExportDCFGByElement <LevelPortal, GroupPortal, LvlPortal>(cfg.Portals); ExportDCFGByElement <LevelBarrier, GroupBarrier, LvlBarrier>(cfg.Barriers); ExportDCFGByElement <LevelObj, GroupObj, LvlObj>(cfg.Objs); ExportDCFGByElement <LevelMonster, GroupMonster, LvlMonster>(cfg.Monsters); ExportDCFGByElement <LevelNpc, GroupNpc, LvlNpc>(cfg.Npcs); ExportDCFGByElement <LevelRegion, GroupRegion, LvlRegion>(cfg.Regions); ExportDCFGByElement <LevelRegionMine, GroupRegionMine, LvlRegionMine>(cfg.RegionMines); ExportDCFGByElement <LevelRegionWave, GroupRegionWave, LvlRegionWave>(cfg.RegionWaves); ExportDCFGByElement <LevelRegionMonster, GroupRegionMonster, LvlRegionMonster>(cfg.RegionMonsters); ExportDCFGByElement <LevelPath, GroupPath, LvlPath>(cfg.Paths); return(cfg); }
public void CreateLvl(LvlConfig Config) { _entityFactory.GetNewEntity(Config.Player, new Vector3(-6f, 0f, 0f)); }