Example #1
0
        /// <summary>
        /// 初始化地图
        /// </summary>
        /// <param name="mapName"></param>
        public void InitMap(string mapName)
        {
            // 加载地图配置
            var bundleName = "maps/datas/" + mapName.ToLower();
            var assetName  = mapName + ".xml";
            var ml         = ResMgr.Instance.LoadSync(bundleName, assetName, null);
            var asset      = ml.assetRes.GetAsset <TextAsset>();

            MapParse parse = new MapParse(asset.text);

            parse.Parse();

            ml.Unload();
            ml = null;

            // 初始化地图组件
            GameObject map = new GameObject();

            map.name       = "MapComponent";
            m_mapComponent = map.AddComponent <MapComponent>();
            m_mapComponent.Init(parse);
        }