Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile

This commit is contained in:
CaiYanPeng 2021-09-16 19:50:38 +08:00
commit 750d9107b4
4 changed files with 3024 additions and 23 deletions

File diff suppressed because it is too large Load Diff

View File

@ -369,7 +369,7 @@ public class DeviceView : MonoBehaviour
case SensorType.Power:
return (connectedDevice as IPowerDevice).Power.ToString();
case SensorType.Speed:
return (connectedDevice as ISpeedDevice).Speed.ToString();
return (connectedDevice as ISpeedDevice).Speed.ToString("f1");
case SensorType.Trainer:
//powerValue.text = (connectedDevice as IPowerDevice).Power.ToString();
//cadenceValue.GetComponent<Text>().text = (connectedDevice as ICadenceDevice).Cadence.ToString();

View File

@ -231,8 +231,9 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
//{
// position.y = position.z;
//}
#if !(UNITY_ANDROID || UNITY_IOS)
this.Move(position);
#endif
this.gameObject.SetActive(true);
//this.SetModel(model);
@ -254,6 +255,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
public void Move(Vector3 position)
{
#if !(UNITY_ANDROID || UNITY_IOS)
this.transform.position = position;
var localPosition = this.transform.localPosition;
@ -282,11 +284,16 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
this.transform.localScale = new Vector2(2, 2);
Debug.Log($"{ this.transform.localPosition.y }, { this.transform.localPosition.y }");
#endif
}
public void Hide()
{
#if UNITY_ANDROID || UNITY_IOS
this.gameObject.SetActive(false);
#else
DestroyImmediate(this.gameObject);
#endif
}
public void OnPointerUp(PointerEventData eventData)

View File

@ -39,7 +39,11 @@ public class BigMapController : PFUIPanel
{
if (_tips == null)
{
#if !(UNITY_IOS || UNITY_ANDROID)
_tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<MapItem>();
#else
_tips = canvas.transform.Find("TipsContainer/MapItem-Mobile").GetComponent<MapItem>();
#endif
}
return _tips;
}
@ -85,7 +89,6 @@ public class BigMapController : PFUIPanel
canvas = this.transform.Find("Canvas").gameObject;
#if UNITY_ANDROID || UNITY_IOS
mainContainer = canvas.transform.Find("MainContainer").gameObject;
#else
mainContainer = canvas;
#endif
@ -334,7 +337,9 @@ public class BigMapController : PFUIPanel
if(item.Value.Selected)
{
tips.Hide();
#if !(UNITY_ANDROID || UNITY_IOS)
tips = null;
#endif
}
}
}
@ -402,20 +407,23 @@ public class BigMapController : PFUIPanel
if(_tips != null)
{
_tips.Hide();
#if !(UNITY_ANDROID || UNITY_IOS)
_tips = null;
#endif
}
if (line.Selected)
{
line.Selected = false;
//tips.Hide();
//tips = null;
#if !(UNITY_ANDROID || UNITY_IOS)
tips = null;
#endif
return;
}
line.Selected = true;
//iii.Selected(true);
var position = line.BeginMarker.transform.position;
//position.z += 25;
position = DefaultPosition();
tips.Show(position, line.Model);
foreach (var item in linesCache)
@ -450,7 +458,7 @@ public class BigMapController : PFUIPanel
var position = line.BeginMarker.transform.position;
//position.z += 25;
position = DefaultPosition();
tips.Show(position, line.Model);
foreach (var item in linesCache)
@ -478,7 +486,6 @@ public class BigMapController : PFUIPanel
var position = line.BeginMarker.transform.position;
//position.z += 25;
//tips.Show(position, line.Model);
position = DefaultPosition();
tips.Move(position);
}
}
@ -501,16 +508,6 @@ public class BigMapController : PFUIPanel
}
Vector3 DefaultPosition()
{
Vector3 vector3 = new Vector3(0.8f, 0.35f, 180f);
////Debug.Log(vp);
//var wd = Camera.main.WorldToScreenPoint(worldPosition);
var wd = Camera.main.ViewportToWorldPoint(vector3);
return wd;
}
// Update is called once per frame
void Update()
{
@ -530,8 +527,6 @@ public class BigMapController : PFUIPanel
if (_tips != null)
{
_tips.Hide();
_tips = null;
canvas.transform.Find("TipsContainer").gameObject.SetActive(false);
}
}
}