Exemplo n.º 1
0
        public static SceneGraph loadWholeMap(string filename)
        {
            RuntimeData rd = RuntimeData.get();

            SceneGraph     m_scene_graph = new SceneGraph();
            LoadingContext ctx           = new LoadingContext(0);

            ctx.m_target = m_scene_graph;
            int geobin_idx = filename.IndexOf("geobin");
            int maps_idx   = filename.IndexOf("maps");

            ctx.m_base_path = filename.Substring(0, geobin_idx);
            Debug.Assert(rd.m_prefab_mapping != null);
            string upcase_city = filename;

            upcase_city = upcase_city.Replace("city_", "City_");
            upcase_city = upcase_city.Replace("hazard_", "Hazard_");
            upcase_city = upcase_city.Replace("/trial_", "/Trial_");
            if (upcase_city.StartsWith("trial_"))
            {
                upcase_city = "Trial_" + upcase_city.Substring(6);
            }
            upcase_city = upcase_city.Replace("zones_", "Zones_");
            rd.m_prefab_mapping.sceneGraphWasReset();
            bool res = ctx.loadSceneGraph(maps_idx == -1 ? upcase_city : upcase_city.Substring(maps_idx), rd.m_prefab_mapping);

            if (!res)
            {
                return(null);
            }

            return(m_scene_graph);
        }
Exemplo n.º 2
0
        public void loadSubgraph(string geopath, PrefabStore prefabs)
        {
            var            fi  = new FileInfo(geopath);
            LoadingContext tmp = new LoadingContext(nesting_level + 1);

            tmp.m_renamer    = DeepClone <NameList>(m_renamer);
            tmp.m_target     = m_target;
            tmp.last_node_id = last_node_id;
            tmp.m_base_path  = m_base_path;
            string complete_base_name = Path.GetFileNameWithoutExtension(fi.Name);

            tmp.loadSceneGraph(fi.DirectoryName + "/" + complete_base_name + ".txt", prefabs);
        }