调整连接设备样式。调整地球样式。去掉灯光。

This commit is contained in:
suntao committed 2021-04-29 18:10:09 +08:00
1 parent 4cb40f2c8e
commit de61fbd291
26 files changed
+1586 -677

No files matched your search

@@ -19,6 +19,8 @@ public class DeviceController : PFUIPanel
private Sprite circuloCarga;
private Sprite circuloCompleto;
RectTransform circulo;
private GameObject statusText;
private bool _available = false;
private bool Available
{
@@ -37,6 +39,8 @@ public class DeviceController : PFUIPanel
//circulo.gameObject.SetActive(false);
DOTween.Kill(circulo, false);
circulo.GetComponent<Image>().sprite = circuloCompleto;
ShowStatusText("ANT+ Connected");
}
else
{
@@ -44,6 +48,8 @@ public class DeviceController : PFUIPanel
//circulo.gameObject.SetActive(true);
circulo.GetComponent<Image>().sprite = circuloCarga;
circulo.DOLocalRotate(new Vector3(0, 0, 360), 1f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
ShowStatusText("ANT+ Disconnect");
}
}
}
@@ -80,6 +86,10 @@ public class DeviceController : PFUIPanel
var bg = this.transform.Find("Status").Find("Bg");
antStatus = bg.Find("Ant+").GetComponent<Image>();
statusText = this.transform.Find("Status").Find("GameObject").gameObject;
statusText.SetActive(false);
circulo = bg.Find("Image").GetComponent<RectTransform>();
//circulo.DORotate(new Vector3(0, 0, 360), 1.5f, RotateMode.Fast).SetLoops(-1);
circulo.DOLocalRotate(new Vector3(0, 0, 360), 1f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
@@ -126,4 +136,14 @@ public class DeviceController : PFUIPanel
{
}
private void ShowStatusText(string text)
{
statusText.transform.Find("Text").GetComponent<Text>().text = text;
statusText.GetComponent<CanvasGroup>().alpha = 0;
statusText.SetActive(true);
statusText.GetComponent<CanvasGroup>().DOFade(1f, 0.1f).OnComplete(()=> {
statusText.GetComponent<CanvasGroup>().DOFade(0f, 0.3f).SetDelay(3f);
});
}
}
@@ -19,14 +19,15 @@ public class EarthController : PFUIPanel
private Text CountText;
private Text OfficialText;
private Text RiderText;
private GameObject hotPanel;
private GameObject content;
private Object itemObject;
//private GameObject hotPanel;
//private GameObject content;
//private Object itemObject;
Transform rootPanel;
Canvas canvas;
float time = 0f;
bool showSummary = false;
Vector2 latlonCenter;
private GameObject panel;
protected override void Awake()
{
base.Awake();
@@ -40,40 +41,41 @@ public class EarthController : PFUIPanel
map = WorldMapGlobe.instance;
map.showProvinces = true;
map.showCities = true;
map.autoRotationSpeed = 0f;
//map.autoRotationSpeed = 0f;
//map.autoRotationSpeed = 0.1f;
//Camera.main.fieldOfView = 180;
map.SetZoomLevel(1.4f);
//map.allowUserZoom = false;
map.showLatitudeLines = false;
map.showLongitudeLines = false;
map.showCursor = false;
}
// Start is called before the first frame update
protected override void Start()
{
itemObject = Resources.Load("UI/Prefab/BigMap/Item");
//itemObject = Resources.Load("UI/Prefab/BigMap/Item");
var panel = rootPanel.Find("Panel");
panel = rootPanel.Find("Panel").gameObject;
SetRounded(panel.transform, 60);
panel.gameObject.SetActive(false);
SetRounded(panel, 60);
hotPanel = rootPanel.Find("HotPanel").gameObject;
SetRounded(hotPanel.transform, 60);
maskImage = rootPanel.Find("MaskImage").GetComponent<RawImage>();
Country = panel.Find("Country").GetComponent<Text>();
Province = panel.Find("Province").GetComponent<Text>();
CountText = panel.Find("CountPanel").Find("Count").GetComponent<Text>();
OfficialText = panel.Find("OfficialPanel").Find("Count").GetComponent<Text>();
RiderText = panel.Find("RiderPanel").Find("Count").GetComponent<Text>();
Country = panel.transform.Find("Country").GetComponent<Text>();
Province = panel.transform.Find("Province").GetComponent<Text>();
CountText = panel.transform.Find("CountPanel").Find("Count").GetComponent<Text>();
OfficialText = panel.transform.Find("OfficialPanel").Find("Count").GetComponent<Text>();
RiderText = panel.transform.Find("RiderPanel").Find("Count").GetComponent<Text>();
content = hotPanel.transform.Find("Scroll View").Find("Viewport").Find("Content").gameObject;
//map.SetZoomLevel(10);
//hotPanel = rootPanel.Find("HotPanel").gameObject;
//SetRounded(hotPanel.transform, 60);
//content = hotPanel.transform.Find("Scroll View").Find("Viewport").Find("Content").gameObject;
//var mainCanvas = GameObject.Find("Canvas");
//mainCanvas.gameObject.SetActive(false);
@@ -82,10 +84,10 @@ public class EarthController : PFUIPanel
Camera.main.transform.position = new Vector3(0, 0);
Camera.main.transform.rotation = Quaternion.Euler(0, 0, 0);
var zoom = map.GetZoomLevel();
map.SetZoomLevel(1.43f);
//var zoom = map.GetZoomLevel();
//Debug.Log(zoom);
map.OnZoomStart += Map_OnZoomStart;
map.OnZoomEnd += Map_OnZoomEnd;
@@ -93,6 +95,7 @@ public class EarthController : PFUIPanel
map.OnCountryEnter += (int countryIndex, int regionIndex) =>
{
map.autoRotationSpeed = 0f;
var country = map.countries[countryIndex];
if (country.name.ToLower().Contains("taiwan"))
{
@@ -144,6 +147,13 @@ public class EarthController : PFUIPanel
/// <param name="latlonCenter"></param>
private async void ShowSummary(Vector2 latlonCenter)
{
if(panel.activeInHierarchy == false)
{
panel.SetActive(true);
panel.GetComponent<CanvasGroup>().alpha = 0;
panel.GetComponent<CanvasGroup>().DOFade(1f, 0.1f);
}
var result = await mapApi.GetEarthData(latlonCenter.x, latlonCenter.y);
if (result.result == false)
{
@@ -155,29 +165,26 @@ public class EarthController : PFUIPanel
OfficialText.text = obj.Value<string>("officialCount");
RiderText.text = obj.Value<string>("riderCount");
//for (int i = 0; i < content.transform.childCount; i++)
//foreach (Transform item in content.transform)
//{
// DestroyImmediate(content.transform.GetChild(i));
//}
foreach (Transform item in content.transform)
{
GameObject.Destroy(item.gameObject);
}
// GameObject.Destroy(item.gameObject);
//}
var list = JArray.FromObject(obj["list"]);
foreach (var item in list)
{
var itemObject1 = (GameObject)Instantiate(itemObject, content.transform, false);
var iii = itemObject1.GetComponent<Item>();
iii.SetModel(new Assets.Scripts.Apis.Models.NearRouteModel
{
Id = item.Value<int>("Id"),
Name = item.Value<string>("Name"),
TheHeat = item.Value<int>("TheHat"),
IsFire = item.Value<bool>("IsFire")
});
}
//var list = JArray.FromObject(obj["list"]);
//foreach (var item in list)
//{
// var itemObject1 = (GameObject)Instantiate(itemObject, content.transform, false);
// var iii = itemObject1.GetComponent<Item>();
// iii.SetModel(new Assets.Scripts.Apis.Models.NearRouteModel
// {
// Id = item.Value<int>("Id"),
// Name = item.Value<string>("Name"),
// TheHeat = item.Value<int>("TheHat"),
// IsFire = item.Value<bool>("IsFire")
// });
//}
}
@@ -187,6 +194,8 @@ public class EarthController : PFUIPanel
/// <param name="latLon"></param>
private void EnterBigMap(Vector2 latLon)
{
Debug.Log("enter big map");
map.FlyToLocation(latLon.x, latLon.y, 1f, 0.1f).Then(() => {
//Close();
@@ -223,7 +232,7 @@ public class EarthController : PFUIPanel
// Update is called once per frame
void Update()
{
//var zoom = map.GetZoomLevel();
var zoom = map.GetZoomLevel();
//Debug.Log(zoom);
if (showSummary)