public void LoadCenter(int centerID) { datacenter = Datacenter.instance.listCenter[centerID]; // load dia chir txtDiaChi.text = datacenter.Address; txtName.text = datacenter.name; }
public void UpdateDistantCenter() { if (!Input.location.isEnabledByUser) { return; } Input.location.Start(); Vector2 currentPos = new Vector2(Input.location.lastData.latitude, Input.location.lastData.longitude); Location l1 = new Location(); l1.Latitude = Input.location.lastData.latitude; l1.Longitude = Input.location.lastData.longitude; List <double> listKC = new List <double>(); for (int i = 0; i < Datacenter.instance.listCenter.Count; i++) { PositionWELCenter pos = Datacenter.instance.listCenter[i]; Location l2 = new Location(); l2.Longitude = pos.pos.x; l2.Latitude = pos.pos.y; double rs = Utils.CalculateDistance(l1, l2); txtListKhoangcach[i].text = Datacenter.instance.listCenter[i].name + " " + Math.Round(rs, 2).ToString() + "km"; listKC.Add(rs); } Sort(listKC); }
public bool CheckGotoCenter(int CenterID) { return(true); Vector2 currentPos = new Vector2(Input.location.lastData.latitude, Input.location.lastData.longitude); PositionWELCenter pos = Datacenter.instance.listCenter[CenterID]; Debug.Log(pos.name + "//" + pos.pos + "/// " + currentPos.ToString()); }
public bool CheckGotoCenter(int CenterID) { if (StaticClass.isCheating) { return(true); } // return true; #if UNITY_EDITOR return(true); #else Input.location.Start(); Vector2 currentPos = new Vector2(Input.location.lastData.latitude, Input.location.lastData.longitude); Location l1 = new Location(); l1.Latitude = Input.location.lastData.latitude; l1.Longitude = Input.location.lastData.longitude; PositionWELCenter pos = Datacenter.instance.listCenter[CenterID]; Location l2 = new Location(); //l2.Longitude = 106.683395;// pos.pos.x; //l2.Latitude = 10.776305 ;// pos.pos.y; l2.Longitude = pos.pos.x; l2.Latitude = pos.pos.y; double rs = Utils.CalculateDistance(l1, l2); st = CenterID.ToString() + rs.ToString() + "/[" + l1.Latitude.ToString() + "," + l1.Longitude.ToString() + "]/[" + l2.Latitude.ToString() + "," + l2.Longitude + "]"; if (rs < 0.5) { return(true); } return(false); #endif }