解决台湾无法点击的问题

This commit is contained in:
suntao 2021-05-20 16:15:53 +08:00
parent 3e38fd65c2
commit 5db375bcf5
3 changed files with 30 additions and 9 deletions

View File

@ -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
}
}

View File

@ -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;

View File

@ -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<Skybox>();
}
private void DelayEnterBigMapForTaiwan()
{
if (!isTaiwanClick) return;
var latLon = map.countries[36].latlonCenter;
EnterBigMap(latLon);
}
//private float rot = 0;
//Skybox skybox;
/// <summary>
@ -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);
}
}