调整连接设备样式。调整地球样式。去掉灯光。
This commit is contained in:
1 parent
4cb40f2c8e
commit
de61fbd291
26 files changed
+1586
-677
No files matched your search
@@ -20,7 +20,7 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
}
|
||||
set
|
||||
{
|
||||
Debug.Log(value);
|
||||
//Debug.Log(value);
|
||||
mSensorType = value;
|
||||
var deviceInfoStr = Utils.deviceDict[value.ToString()];
|
||||
if (deviceInfoStr != null)
|
||||
@@ -66,8 +66,8 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
|
||||
UIManager.AddEvent(closeBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
|
||||
{
|
||||
//this.gameObject.SetActive(false);
|
||||
this.Close();
|
||||
//DestroyImmediate(this.gameObject);
|
||||
}));
|
||||
|
||||
deviceItem = Resources.Load("UI/Prefab/Device/DeviceItem");
|
||||
@@ -156,6 +156,7 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
|
||||
var gameObject = (GameObject)Instantiate(deviceItem);
|
||||
gameObject.transform.SetParent(content.transform);
|
||||
gameObject.transform.localScale = new Vector3(1, 1, 1);
|
||||
var deviceItemObj = gameObject.GetComponent<DeviceItem>();
|
||||
deviceItemObj.DeviceInfo = device;
|
||||
|
||||
@@ -200,13 +201,17 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
public override void Close()
|
||||
{
|
||||
base.Close();
|
||||
DestroyImmediate(this.gameObject);
|
||||
//DestroyImmediate(this.gameObject);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
|
||||
float time = 0;
|
||||
float _x = 0;
|
||||
float _y = 0;
|
||||
/// <summary>
|
||||
/// 做search动画
|
||||
/// </summary>
|
||||
void Move()
|
||||
{
|
||||
var hudu = (2 * Mathf.PI / 360) * 1 * time;
|
||||
|
||||
@@ -70,18 +70,19 @@ public class DeviceView : MonoBehaviour
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
var rect = ((RectTransform)transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.2f, 0));
|
||||
//this.GetComponent<Image>().material = material;
|
||||
this.GetComponent<Image>().material = material;
|
||||
|
||||
var img1 = unconnectionPanel.GetComponent<Image>();
|
||||
if(img1 != null)
|
||||
{
|
||||
img1.material = material;
|
||||
|
||||
var gradient = unconnectionPanel.GetComponent<UIGradient>();
|
||||
if (gradient != null)
|
||||
{
|
||||
gradient.color1 = Utils.HexToColor("353543");
|
||||
gradient.color2 = Utils.HexToColor("23232D");
|
||||
}
|
||||
//var gradient = unconnectionPanel.GetComponent<UIGradient>();
|
||||
//if (gradient != null)
|
||||
//{
|
||||
// gradient.color1 = Utils.HexToColor("353543");
|
||||
// gradient.color2 = Utils.HexToColor("23232D");
|
||||
//}
|
||||
}
|
||||
|
||||
var img2 = connectionPanel.GetComponent<Image>();
|
||||
@@ -89,12 +90,12 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
img2.material = material;
|
||||
|
||||
var gradient1 = connectionPanel.GetComponent<UIGradient>();
|
||||
if (gradient1 != null)
|
||||
{
|
||||
gradient1.color1 = Utils.HexToColor("FF7485");
|
||||
gradient1.color2 = Utils.HexToColor("F93086");
|
||||
}
|
||||
//var gradient1 = connectionPanel.GetComponent<UIGradient>();
|
||||
//if (gradient1 != null)
|
||||
//{
|
||||
// gradient1.color1 = Utils.HexToColor("FF7485");
|
||||
// gradient1.color2 = Utils.HexToColor("F93086");
|
||||
//}
|
||||
}
|
||||
|
||||
logo = this.transform.Find("Logo").GetComponent<Image>();
|
||||
@@ -151,7 +152,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Power_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Power_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Power_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Power_4");
|
||||
|
||||
powerUnit.text = "W";
|
||||
}
|
||||
@@ -159,7 +160,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Speed_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Speed_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Speed_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Speed_4");
|
||||
|
||||
powerUnit.text = "KPH";
|
||||
}
|
||||
@@ -167,7 +168,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Cadence_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Cadence_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Cadence_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Cadence_4");
|
||||
|
||||
powerUnit.text = "RPM";
|
||||
}
|
||||
@@ -175,7 +176,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Heart Rate_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Heart Rate_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Heart Rate_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Heart Rate_4");
|
||||
|
||||
powerUnit.text = "BPM";
|
||||
}
|
||||
@@ -183,7 +184,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Trainer_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Trainer_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Trainer_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Trainer_4");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +256,11 @@ public class DeviceView : MonoBehaviour
|
||||
var connectionCanvasGroup = connectionPanel.GetComponent<CanvasGroup>();
|
||||
connectionCanvasGroup.alpha = 0;
|
||||
connectionPanel.SetActive(true);
|
||||
connectionCanvasGroup.DOFade(1f, .3f);
|
||||
connectionCanvasGroup.DOFade(1f, .3f).OnComplete(()=> {
|
||||
//if (logoSprite != null) {
|
||||
// logo.sprite = logoSprite;
|
||||
//}
|
||||
});
|
||||
}
|
||||
logo.sprite = sprite3;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user