void loadMap(string level) { //检查文件夹 if (!Directory.Exists(LevelMapData.LevelDir)) { Debug.Log("找不到地图文件"); return; } //加载文件 //string fp = LevelMapData.LevelDir+level+".asset"; //TODO 关卡内加载数据的方式还没对 //LevelMapData map = LevelMapData.LoadScriptableObject (fp); LevelMapData map = LevelMapData.Bundle_PvE_Level_Data.LoadAsset <LevelMapData>(level.ToString()); //测试 if (map.list_area_grid.Count > 0) { string str = "Bundle中的area_grid数据:\r\n"; foreach (var item in map.list_area_grid[0].list) { str += item + ","; } Debug.Log(str); } //检查数据 if (map == null) { Debug.Log(TextUnit.BKME_DataBroken); return; } //三大数据 map_data = map; //mydic_grid_unit = LevelMapData.ParseUnitDataToDic(map.my_unit_info_key,map.my_unit_info); //map_data.mydic_grid_unit = JsonConvert.DeserializeObject<Dictionary<int,List<UnitInfo>>>(map.json_grid_unit); //LevelMapData.ParseEventDataToDic(event_list,map.my_event,map.event_script); //map_data.list_event_data = JsonConvert.DeserializeObject<List<EventInfo>>(map.my_event_json); //数据安全检测 //if (map_data.mydic_grid_unit==null || // event_list.Count==0) { // Debug.Log(TextUnit.BKME_DataBroken); // Debug.Log("地图单位/事件数据异常"); // return; //} }
void OnEnable() { mapdata = target as LevelMapData; }