diff --git a/Assets/Scripts/App.cs b/Assets/Scripts/App.cs index 52031556..e56f8bc4 100644 --- a/Assets/Scripts/App.cs +++ b/Assets/Scripts/App.cs @@ -50,10 +50,10 @@ public static class App static App() { -#if !UNITY_EDITOR - //Host = "http://pf.juze.pro/"; - //UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000); - //TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001); -#endif +//#if !UNITY_EDITOR +// //Host = "http://pf.juze.pro/"; +// //UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000); +// //TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001); +//#endif } } diff --git a/Assets/Scripts/Devices/Ant/AntConnector.cs b/Assets/Scripts/Devices/Ant/AntConnector.cs index 103ab48c..0e08c844 100644 --- a/Assets/Scripts/Devices/Ant/AntConnector.cs +++ b/Assets/Scripts/Devices/Ant/AntConnector.cs @@ -183,6 +183,11 @@ namespace Assets.Scripts.Devices.Ant } searchChannel.channelResponse -= antChannel_channelResponse_FeSearch; searchChannel = null; + foreach (var item in discoveredDevices) + { + item.State = DeviceState.Disconnected; + } + discoveredDevices.Clear(); usedChannels.Clear(); IsBackgroundScanning = false; diff --git a/Assets/Scripts/UI/Prefab/Panel/EarthController.cs b/Assets/Scripts/UI/Prefab/Panel/EarthController.cs index 58457c4d..57c04780 100644 --- a/Assets/Scripts/UI/Prefab/Panel/EarthController.cs +++ b/Assets/Scripts/UI/Prefab/Panel/EarthController.cs @@ -8,6 +8,7 @@ using Assets.Scripts.Apis; using Newtonsoft.Json.Linq; using Assets.Scripts; using UnityEngine.EventSystems; +using System; public class EarthController : PFUIPanel { @@ -29,6 +30,7 @@ public class EarthController : PFUIPanel bool showSummary = false; Vector2 latlonCenter; private GameObject panel; + private bool isTaiwanClick = false; protected override void Awake() { base.Awake(); @@ -123,11 +125,15 @@ public class EarthController : PFUIPanel map.OnCountryClick += (int countryIndex, int regionIndex) => { + var country = map.countries[countryIndex]; - if (country.name.ToLower().Contains("taiwan")) + Debug.Log($"country click { country.name }, { countryIndex }, { regionIndex }"); + if (country.name.ToLower().Contains("taiwan") || country.name.ToLower().Contains("china")) { - var latLon = country.latlonCenter; - EnterBigMap(latLon); + //var latLon = map.countries[36].latlonCenter; //country.latlonCenter; + //EnterBigMap(latLon); + isTaiwanClick = true; + Invoke("DelayEnterBigMapForTaiwan", 0.01f); } }; @@ -148,6 +154,8 @@ public class EarthController : PFUIPanel }; map.OnProvinceClick += (int provinceIndex, int regionIndex) => { + isTaiwanClick = false; + Debug.Log("province click"); var province = map.provinces[provinceIndex]; var latLon = province.latlonCenter; EnterBigMap(latLon); @@ -156,6 +164,13 @@ public class EarthController : PFUIPanel //skybox = Camera.main.GetComponent(); } + private void DelayEnterBigMapForTaiwan() + { + if (!isTaiwanClick) return; + var latLon = map.countries[36].latlonCenter; + EnterBigMap(latLon); + } + //private float rot = 0; //Skybox skybox; /// @@ -229,7 +244,7 @@ public class EarthController : PFUIPanel //Debug.Log("click"); Vector2 latLon = Conversion.GetLatLonFromSpherePoint(sphereLocation); - Debug.Log("Clicked on Latitude: " + latLon.x + ", Longitude: " + latLon.y); + Debug.Log("Clicked on Latitude: " + latLon.x + ", Longitude: " + latLon.y); } @@ -280,5 +295,6 @@ public class EarthController : PFUIPanel //base.Close(); map.Destroy(); DestroyImmediate(this.gameObject); + GC.SuppressFinalize(this); } }