private static void CityLoad(TiledMapInfo tiledmapinfo, lc_ObjGather objgather) { lc_ObjManager tmpmanager = new lc_ObjManager(objgather); for (int i = 0; i < tiledmapinfo.baselayertiled.Count; i++) { if (tiledmapinfo.baselayertiled[i].iscity == true) { lc_City city = objgather.AddObject <lc_City>(tiledmapinfo.baselayertiled[i].name); city.user_id = tiledmapinfo.baselayertiled[i].id; tiledmapinfo.baselayertiled[i].obj_id = city.obj_id; tmpmanager.SetCityRelNum(city.obj_id, tiledmapinfo.baselayertiled[i].citynum); lc_Country country = tmpmanager.GetObjectByUserId <lc_Country>(tiledmapinfo.baselayertiled[i].countryid); if (country != null) { //Debug.Log("set city[" + city.m_name + "] belong country[" + country_objid + "]"); tmpmanager.SetCityBel(city.obj_id, country.obj_id); } else { Debug.Log("map_id " + tiledmapinfo.baselayertiled[i].countryid + " not mapping city id=[" + city.user_id + "]"); } } } tmpmanager = null; }
public void ValueInit(lc_Country country) { Transform transform = this.gameObject.transform; transform.Find("NAME_VALUE").GetComponent <Text>().text = country.m_name; transform.Find("POP_VALUE").GetComponent <Text>().text = country.m_pop.ToString(); transform.Find("MILITARY_VALUE").GetComponent <Text>().text = country.m_military.ToString(); transform.Find("CROWN_VALUE").GetComponent <Text>().text = country.m_crown.ToString(); transform.Find("EMS_VALUE").GetComponent <Text>().text = country.m_ems.ToString(); }
} /*读取游戏XML*/ private static void CountryLoad(XmlDocument doc, lc_ObjGather objgather) { XmlNodeList countrylist = doc.SelectNodes("listType/InitConf/CountryConf/Country"); foreach (XmlNode country in countrylist) { XmlElement tempelement = (XmlElement)country; string name = tempelement.GetAttribute("name"); int mapid = int.Parse(tempelement.GetAttribute("mapid")); int military = int.Parse(country.SelectSingleNode("military").InnerText); int crown = int.Parse(country.SelectSingleNode("crown").InnerText); lc_Country lccountry = objgather.AddObject <lc_Country>(name); lccountry.m_military = military; lccountry.m_crown = crown; lccountry.user_id = mapid; } }