public void expand() { if (pois.Count == 1) { openPoi(0); return; } camera_fixed_before_expanding = camera_script.camera_fixed; camera_script.camera_fixed = true; NatCamProjectController.getInstance().Pause(); minimize_view.SetActive(false); expand_view.SetActive(true); for (int i = 0; i < pois.Count; ++i) { GameObject item = Instantiate(Resources.Load("PoiListItem"), new Vector3(0, -15, 0), Quaternion.identity) as GameObject; Transform item_transform = item.transform; item_transform.Find("txt_title").GetComponent <Text>().text = pois[i].basic_poi.original_name; item.transform.Find("img_pictogram").GetComponent <Image>().sprite = icon(pois[i].basic_poi.icon); item_transform.Find("txt_distance").GetComponent <Text>().text = Mathf.Ceil((float)map.dist(pois[i].basic_poi.pos_lat, pois[i].basic_poi.pos_lon) * 1000) + "m"; item_transform.SetParent(list_container.transform); item_transform.localScale = new Vector3(1, 1, 1); item_transform.localEulerAngles = new Vector3(0, 0, 0); item.GetComponent <RectTransform>().localPosition = new Vector3(0, 0, 0); item.GetComponent <PoiListItemScript>().id = pois[i].id; item.GetComponent <PoiListItemScript>().poi_name_bar_script = this; list_items.Add(item); } }
public void minimize() { camera_script.camera_fixed = camera_fixed_before_expanding; NatCamProjectController.getInstance().Play(); for (int i = 0; i < list_items.Count; ++i) { DestroyImmediate(list_items[i], true); } list_items.Clear(); minimize_view.SetActive(true); expand_view.SetActive(false); }