骑行内存优化&设备连接点击优化
This commit is contained in:
parent
004410048f
commit
8b3dd7a40a
@ -30,7 +30,7 @@ RectTransform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 189965521107699628}
|
m_Father: {fileID: 189965521107699628}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0.5}
|
m_AnchorMin: {x: 0, y: 0.5}
|
||||||
m_AnchorMax: {x: 1, y: 0.5}
|
m_AnchorMax: {x: 1, y: 0.5}
|
||||||
@ -102,6 +102,7 @@ RectTransform:
|
|||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
|
- {fileID: 1107195470343135181}
|
||||||
- {fileID: 4347642619387382541}
|
- {fileID: 4347642619387382541}
|
||||||
- {fileID: 5333104648953487716}
|
- {fileID: 5333104648953487716}
|
||||||
- {fileID: 6514089965287851756}
|
- {fileID: 6514089965287851756}
|
||||||
@ -153,7 +154,7 @@ MonoBehaviour:
|
|||||||
m_SelectedTrigger: Selected
|
m_SelectedTrigger: Selected
|
||||||
m_DisabledTrigger: Disabled
|
m_DisabledTrigger: Disabled
|
||||||
m_Interactable: 1
|
m_Interactable: 1
|
||||||
m_TargetGraphic: {fileID: 0}
|
m_TargetGraphic: {fileID: 5133914736490982493}
|
||||||
--- !u!1 &6092777681612193971
|
--- !u!1 &6092777681612193971
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -184,7 +185,7 @@ RectTransform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 189965521107699628}
|
m_Father: {fileID: 189965521107699628}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0.5}
|
m_AnchorMin: {x: 0, y: 0.5}
|
||||||
m_AnchorMax: {x: 0, y: 0.5}
|
m_AnchorMax: {x: 0, y: 0.5}
|
||||||
@ -258,7 +259,7 @@ RectTransform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 189965521107699628}
|
m_Father: {fileID: 189965521107699628}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
@ -336,7 +337,7 @@ RectTransform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 189965521107699628}
|
m_Father: {fileID: 189965521107699628}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 1, y: 0.5}
|
m_AnchorMin: {x: 1, y: 0.5}
|
||||||
m_AnchorMax: {x: 1, y: 0.5}
|
m_AnchorMax: {x: 1, y: 0.5}
|
||||||
@ -380,3 +381,77 @@ MonoBehaviour:
|
|||||||
m_FillOrigin: 0
|
m_FillOrigin: 0
|
||||||
m_UseSpriteMesh: 0
|
m_UseSpriteMesh: 0
|
||||||
m_PixelsPerUnitMultiplier: 1
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
--- !u!1 &8209227311586515756
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1107195470343135181}
|
||||||
|
- component: {fileID: 1947824279171277418}
|
||||||
|
- component: {fileID: 5133914736490982493}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Panel
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &1107195470343135181
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8209227311586515756}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 189965521107699628}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &1947824279171277418
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8209227311586515756}
|
||||||
|
m_CullTransparentMesh: 0
|
||||||
|
--- !u!114 &5133914736490982493
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8209227311586515756}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Sprite: {fileID: 0}
|
||||||
|
m_Type: 1
|
||||||
|
m_PreserveAspect: 0
|
||||||
|
m_FillCenter: 1
|
||||||
|
m_FillMethod: 4
|
||||||
|
m_FillAmount: 1
|
||||||
|
m_FillClockwise: 1
|
||||||
|
m_FillOrigin: 0
|
||||||
|
m_UseSpriteMesh: 0
|
||||||
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -51,6 +51,12 @@ namespace Assets.Scripts.Scenes
|
|||||||
App.MainDeviceAdapter.Dispose();
|
App.MainDeviceAdapter.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
Resources.UnloadUnusedAssets();
|
||||||
|
GC.Collect();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnApplicationPause(bool focus)
|
private void OnApplicationPause(bool focus)
|
||||||
{
|
{
|
||||||
if (focus)
|
if (focus)
|
||||||
|
|||||||
@ -88,6 +88,7 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
{
|
{
|
||||||
Resources.UnloadUnusedAssets();
|
Resources.UnloadUnusedAssets();
|
||||||
|
GC.Collect();
|
||||||
}
|
}
|
||||||
Transform target;
|
Transform target;
|
||||||
GameObject watcher;
|
GameObject watcher;
|
||||||
@ -107,6 +108,8 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
return OnlineHeadPanel;
|
return OnlineHeadPanel;
|
||||||
}
|
}
|
||||||
Material Graph3d { get; set; }
|
Material Graph3d { get; set; }
|
||||||
|
Material Graph4 { get; set; }
|
||||||
|
Material Graph1 { get; set; }
|
||||||
public Material Get3dGraph2()
|
public Material Get3dGraph2()
|
||||||
{
|
{
|
||||||
if (Graph3d == null)
|
if (Graph3d == null)
|
||||||
@ -115,6 +118,26 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
}
|
}
|
||||||
return Graph3d;
|
return Graph3d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Material GetMaterial4()
|
||||||
|
{
|
||||||
|
if (Graph4 == null)
|
||||||
|
{
|
||||||
|
Graph4 = Resources.Load<Material>("UI/Material/4");
|
||||||
|
}
|
||||||
|
return Graph4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Material GetMaterial1()
|
||||||
|
{
|
||||||
|
if (Graph1 == null)
|
||||||
|
{
|
||||||
|
Graph1 = Resources.Load<Material>("UI/Material/1");
|
||||||
|
}
|
||||||
|
return Graph1;
|
||||||
|
}
|
||||||
|
|
||||||
Image CompetitionArrow { get; set; }
|
Image CompetitionArrow { get; set; }
|
||||||
public Image GetCompetitionArrow()
|
public Image GetCompetitionArrow()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -86,8 +86,13 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
nearByItemscript.setName(item.Name);
|
nearByItemscript.setName(item.Name);
|
||||||
nearByItemscript.setRatio(item.KGWeight + "W/KG");
|
nearByItemscript.setRatio(item.KGWeight + "W/KG");
|
||||||
nearByItemscript.setSpeed(item.Speed.ToString() + "KM/H");
|
nearByItemscript.setSpeed(item.Speed.ToString() + "KM/H");
|
||||||
nearByItemscript.setHead(item.Headimage);
|
if (cyclingController.currentPlayer.UserId == item.Id)
|
||||||
|
{
|
||||||
|
nearByItemscript.setHead(item.Headimage);
|
||||||
|
}
|
||||||
|
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||||
nearByItemscript.setCountry(cyclingController.GetCountryImageByName(item.Country));
|
nearByItemscript.setCountry(cyclingController.GetCountryImageByName(item.Country));
|
||||||
|
#endif
|
||||||
nearByItemscript.setDistance(item.Near.ToString() + "KM");
|
nearByItemscript.setDistance(item.Near.ToString() + "KM");
|
||||||
nearByItemscript.transform.SetSiblingIndex((int)item.Near);
|
nearByItemscript.transform.SetSiblingIndex((int)item.Near);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,7 +170,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
trailRenderer = FindObjectOfType<TrailRenderer>();
|
trailRenderer = FindObjectOfType<TrailRenderer>();
|
||||||
//var color7 = Resources.Load<Material>("UI/Material/color7");
|
//var color7 = Resources.Load<Material>("UI/Material/color7");
|
||||||
var Graph2 = mainController.Get3dGraph2(); //Resources.Load<Material>("UI/Material/3dGraph2");
|
var Graph2 = mainController.Get3dGraph2(); //Resources.Load<Material>("UI/Material/3dGraph2");
|
||||||
trailRenderer.materials = new Material[] { Graph2 };
|
trailRenderer.material = Graph2;//new Material[] { Graph2 };
|
||||||
trailRenderer.time = 30;
|
trailRenderer.time = 30;
|
||||||
trailRenderer.startWidth = 1f;
|
trailRenderer.startWidth = 1f;
|
||||||
trailRenderer.endWidth = 1f;
|
trailRenderer.endWidth = 1f;
|
||||||
@ -222,7 +222,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
_directionsGO.transform.SetParent(transform);
|
_directionsGO.transform.SetParent(transform);
|
||||||
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
||||||
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||||
lineRender.material = Resources.Load<Material>("UI/Material/4");
|
lineRender.material = mainController.GetMaterial4(); //Resources.Load<Material>("UI/Material/4");
|
||||||
lineRender.endColor = new Color(0.1529412f, 0.8745098f, 0.8901961f, 1f);
|
lineRender.endColor = new Color(0.1529412f, 0.8745098f, 0.8901961f, 1f);
|
||||||
lineRender.startColor = new Color(0.1529412f, 0.8745098f, 0.8901961f, 1f);
|
lineRender.startColor = new Color(0.1529412f, 0.8745098f, 0.8901961f, 1f);
|
||||||
|
|
||||||
@ -258,10 +258,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
headPanel.transform.SetParent(graph.transform);
|
headPanel.transform.SetParent(graph.transform);
|
||||||
headPanel.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
|
headPanel.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
|
||||||
}
|
}
|
||||||
if (CurrentIndex == 1)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
int nextIndex = CurrentIndex;
|
int nextIndex = CurrentIndex;
|
||||||
var viewIndex = chartDataSourceScript.GetViewIndex(nextIndex);
|
var viewIndex = chartDataSourceScript.GetViewIndex(nextIndex);
|
||||||
//人物移动 停止条件 到中间且线未加载完
|
//人物移动 停止条件 到中间且线未加载完
|
||||||
|
|||||||
@ -130,7 +130,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
||||||
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||||
//lineRender.material = Resources.Load<Material>("UI/Material/color8");
|
//lineRender.material = Resources.Load<Material>("UI/Material/color8");
|
||||||
lineRender.material = Resources.Load<Material>("UI/Material/1");
|
lineRender.material = mainController.GetMaterial1(); //Resources.Load<Material>("UI/Material/1");
|
||||||
lineRender.endColor = new Color(1, 1f, 1f, 0.65f);
|
lineRender.endColor = new Color(1, 1f, 1f, 0.65f);
|
||||||
lineRender.startColor = new Color(1, 1f, 1f, 0.65f);
|
lineRender.startColor = new Color(1, 1f, 1f, 0.65f);
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ using System;
|
|||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
{
|
{
|
||||||
public class RouteController : MonoBehaviour
|
public class RouteController : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
AbstractMap _map;
|
AbstractMap _map;
|
||||||
@ -21,7 +21,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
Material _material;
|
Material _material;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
[Range(1, 10)]
|
[Range(1, 10)]
|
||||||
private float UpdateFrequency = 0.1f;
|
private float UpdateFrequency = 1f;
|
||||||
|
|
||||||
private int _counter;
|
private int _counter;
|
||||||
|
|
||||||
@ -31,33 +31,35 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
CyclingController cyclingCotroller;
|
CyclingController cyclingCotroller;
|
||||||
private bool initComplete = false;
|
private bool initComplete = false;
|
||||||
|
|
||||||
|
Material Graph2 { get; set; }
|
||||||
|
Material linematerial { get; set; }
|
||||||
|
|
||||||
protected virtual void Awake()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
if (_map == null)
|
if (_map == null)
|
||||||
{
|
{
|
||||||
_map = FindObjectOfType<AbstractMap>();
|
_map = FindObjectOfType<AbstractMap>();
|
||||||
}
|
}
|
||||||
// _map.OnInitialized += _map_OnInitialized; ;
|
// _map.OnInitialized += _map_OnInitialized; ;
|
||||||
//_map.OnUpdated += _map_OnUpdated; ;
|
//_map.OnUpdated += _map_OnUpdated; ;
|
||||||
|
Graph2 = Resources.Load<Material>("UI/Material/3dGraph2");
|
||||||
|
linematerial = Resources.Load<Material>("UI/Material/3");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _map_OnUpdated()
|
private void _map_OnUpdated()
|
||||||
{
|
{
|
||||||
Debug.Log("_map_OnUpdated");
|
Debug.Log("_map_OnUpdated");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _map_OnInitialized()
|
private void _map_OnInitialized()
|
||||||
{
|
{
|
||||||
Debug.Log("_map_OnInitialized");
|
Debug.Log("_map_OnInitialized");
|
||||||
CreateRoute();
|
CreateRoute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _map_OnTileFinished(UnityTile obj)
|
private void _map_OnTileFinished(UnityTile obj)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!initComplete)
|
if (!initComplete)
|
||||||
{
|
{
|
||||||
CreateRoute(obj);
|
CreateRoute(obj);
|
||||||
@ -94,7 +96,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
void CreateRoute(UnityTile tile)
|
void CreateRoute(UnityTile tile)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
var meshData = new MeshData();
|
//var meshData = new MeshData();
|
||||||
var dat = new List<Vector3>();
|
var dat = new List<Vector3>();
|
||||||
var path = new List<Vector3>();
|
var path = new List<Vector3>();
|
||||||
|
|
||||||
@ -121,13 +123,13 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
if (diffAbs <= 200)
|
if (diffAbs <= 200)
|
||||||
{
|
{
|
||||||
//if (!dat.Contains(item))
|
//if (!dat.Contains(item))
|
||||||
dat.Add(item);
|
dat.Add(item);
|
||||||
}
|
}
|
||||||
if (diff <= 0 && diff > -200)
|
if (diff <= 0 && diff > -200)
|
||||||
{
|
{
|
||||||
item.y += 0.15f;
|
item.y += 0.15f;
|
||||||
//if (!dat.Contains(item))
|
//if (!dat.Contains(item))
|
||||||
path.Add(item);
|
path.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var feat = new VectorFeatureUnity();
|
var feat = new VectorFeatureUnity();
|
||||||
@ -161,7 +163,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
bool foundTile = _map.MapVisualizer.ActiveTiles.TryGetValue(Conversions.LatitudeLongitudeToTileId(_map.CenterLatitudeLongitude.x, _map.CenterLatitudeLongitude.y, (int)_map.Zoom), out tile);
|
bool foundTile = _map.MapVisualizer.ActiveTiles.TryGetValue(Conversions.LatitudeLongitudeToTileId(_map.CenterLatitudeLongitude.x, _map.CenterLatitudeLongitude.y, (int)_map.Zoom), out tile);
|
||||||
if (foundTile)
|
if (foundTile)
|
||||||
{
|
{
|
||||||
var meshData = new MeshData();
|
//var meshData = new MeshData();
|
||||||
var dat = new List<Vector3>();
|
var dat = new List<Vector3>();
|
||||||
|
|
||||||
var mapData = cyclingCotroller.GetMapData();
|
var mapData = cyclingCotroller.GetMapData();
|
||||||
@ -188,16 +190,16 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
if (_directionsGO != null)
|
if (_directionsGO != null)
|
||||||
{
|
{
|
||||||
_directionsGO.Destroy();
|
DestroyImmediate(_directionsGO);
|
||||||
}
|
}
|
||||||
_directionsGO = new GameObject("MapRoute");
|
_directionsGO = new GameObject("MapRoute");
|
||||||
_directionsGO.transform.parent = transform;
|
_directionsGO.transform.parent = transform;
|
||||||
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
||||||
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||||
lineRender.material = Resources.Load<Material>("UI/Material/3");
|
lineRender.material = linematerial; //Resources.Load<Material>("UI/Material/3");
|
||||||
var dat = feat.Points[0];
|
var dat = feat.Points[0];
|
||||||
ColorUtility.TryParseHtmlString("#FF2742", out Color c);
|
ColorUtility.TryParseHtmlString("#FF2742", out Color c);
|
||||||
lineRender.endColor = new Color(1,1,1,0.65f);
|
lineRender.endColor = new Color(1, 1, 1, 0.65f);
|
||||||
lineRender.startColor = new Color(1, 1, 1, 0.65f);
|
lineRender.startColor = new Color(1, 1, 1, 0.65f);
|
||||||
|
|
||||||
//设置宽度
|
//设置宽度
|
||||||
@ -205,26 +207,26 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
lineRender.endWidth = 1.5f;
|
lineRender.endWidth = 1.5f;
|
||||||
lineRender.positionCount = dat.Count;
|
lineRender.positionCount = dat.Count;
|
||||||
lineRender.SetPositions(feat.Points[0].ToArray());
|
lineRender.SetPositions(feat.Points[0].ToArray());
|
||||||
lineRender.loop = false;
|
lineRender.loop = false;
|
||||||
lineRender.numCapVertices = 10;
|
lineRender.numCapVertices = 10;
|
||||||
//lineRender.numCornerVertices = 30;
|
//lineRender.numCornerVertices = 30;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatPathRoute(List<Vector3> feat)
|
void CreatPathRoute(List<Vector3> feat)
|
||||||
{
|
{
|
||||||
if (_pathRoute != null)
|
if (_pathRoute != null)
|
||||||
{
|
{
|
||||||
_pathRoute.Destroy();
|
DestroyImmediate(_pathRoute);
|
||||||
}
|
}
|
||||||
_pathRoute = new GameObject("MapPathRoute");
|
_pathRoute = new GameObject("MapPathRoute");
|
||||||
_pathRoute.transform.parent = transform;
|
_pathRoute.transform.parent = transform;
|
||||||
var lineRender = _pathRoute.AddComponent<LineRenderer>();
|
var lineRender = _pathRoute.AddComponent<LineRenderer>();
|
||||||
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||||
//var color7 = Resources.Load<Material>("UI/Material/color7");
|
//var color7 = Resources.Load<Material>("UI/Material/color7");
|
||||||
var Graph2 = Resources.Load<Material>("UI/Material/3dGraph2");
|
//var Graph2 = Resources.Load<Material>("UI/Material/3dGraph2");
|
||||||
lineRender.materials = new Material[] { Graph2 };
|
lineRender.material = Graph2;//new Material[] { Graph2 };
|
||||||
lineRender.endColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
lineRender.endColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
||||||
lineRender.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
lineRender.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
||||||
|
|
||||||
@ -233,11 +235,11 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
lineRender.endWidth = 1f;
|
lineRender.endWidth = 1f;
|
||||||
lineRender.positionCount = feat.Count;
|
lineRender.positionCount = feat.Count;
|
||||||
lineRender.SetPositions(feat.ToArray());
|
lineRender.SetPositions(feat.ToArray());
|
||||||
lineRender.loop = false;
|
lineRender.loop = false;
|
||||||
lineRender.numCapVertices = 10;
|
lineRender.numCapVertices = 10;
|
||||||
//lineRender.numCornerVertices = 10;
|
//lineRender.numCornerVertices = 10;
|
||||||
//
|
//
|
||||||
lineRender.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
lineRender.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||||
lineRender.allowOcclusionWhenDynamic = false;
|
lineRender.allowOcclusionWhenDynamic = false;
|
||||||
lineRender.textureMode = LineTextureMode.Tile;
|
lineRender.textureMode = LineTextureMode.Tile;
|
||||||
lineRender.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion;
|
lineRender.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion;
|
||||||
|
|||||||
@ -72,8 +72,11 @@ public class ConnectDeviceModal : PFUIPanel
|
|||||||
this.Close();
|
this.Close();
|
||||||
//DestroyImmediate(this.gameObject);
|
//DestroyImmediate(this.gameObject);
|
||||||
}));
|
}));
|
||||||
|
#if UNITY_IOS || UNITY_ANDROID
|
||||||
|
deviceItem = Resources.Load("UI/Prefab/Device/Mobile/DeviceItem");
|
||||||
|
#else
|
||||||
deviceItem = Resources.Load("UI/Prefab/Device/DeviceItem");
|
deviceItem = Resources.Load("UI/Prefab/Device/DeviceItem");
|
||||||
|
#endif
|
||||||
|
|
||||||
connectBtn = container.Find("ConnectBtn").GetComponent<PfUIButton>();
|
connectBtn = container.Find("ConnectBtn").GetComponent<PfUIButton>();
|
||||||
connectBtnText = connectBtn.transform.Find("Text").GetComponent<Text>();
|
connectBtnText = connectBtn.transform.Find("Text").GetComponent<Text>();
|
||||||
|
|||||||
@ -29,7 +29,8 @@ public class DeviceItem : Selectable, IEventSystemHandler, IPointerClickHandler
|
|||||||
protected override void Start()
|
protected override void Start()
|
||||||
{
|
{
|
||||||
//this.currentSelectionState = SelectionState.Selected
|
//this.currentSelectionState = SelectionState.Selected
|
||||||
|
if (DeviceInfo == null)
|
||||||
|
return;
|
||||||
mText.text = DeviceInfo.Name;// + "-" + DeviceInfo.DeviceNumber;
|
mText.text = DeviceInfo.Name;// + "-" + DeviceInfo.DeviceNumber;
|
||||||
if(DeviceInfo.Network == NetworkType.ANT)
|
if(DeviceInfo.Network == NetworkType.ANT)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -58,6 +58,9 @@ public class DeviceView : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private Sprite sprite3;
|
private Sprite sprite3;
|
||||||
|
|
||||||
|
private Button unconnectionButton;
|
||||||
|
private Button connectionButton;
|
||||||
|
|
||||||
private float timer = 1.0f;
|
private float timer = 1.0f;
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
@ -67,9 +70,10 @@ public class DeviceView : MonoBehaviour
|
|||||||
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
|
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
|
||||||
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
|
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
|
||||||
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
|
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
|
||||||
|
unconnectionButton = unconnectionPanel.GetComponent<Button>();
|
||||||
mPairButton.SetActive(false);
|
mPairButton.SetActive(false);
|
||||||
connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
|
connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
|
||||||
|
connectionButton = connectionPanel.GetComponent<Button>();
|
||||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||||
var rect = ((RectTransform)transform).rect;
|
var rect = ((RectTransform)transform).rect;
|
||||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.2f, 0));
|
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.2f, 0));
|
||||||
@ -122,41 +126,68 @@ public class DeviceView : MonoBehaviour
|
|||||||
|
|
||||||
connectionPanel.SetActive(false);
|
connectionPanel.SetActive(false);
|
||||||
|
|
||||||
UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
|
UIManager.AddEvent(unconnectionButton.gameObject, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
|
||||||
{
|
{
|
||||||
if (deviceModal == null)
|
if (!mPairButton.activeSelf)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
#if UNITY_IOS || UNITY_ANDROID
|
|
||||||
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
|
|
||||||
#else
|
|
||||||
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
|
|
||||||
#endif
|
|
||||||
GameObject gameObject = (GameObject)Instantiate(obj);
|
|
||||||
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
|
|
||||||
}
|
}
|
||||||
deviceModal.SensorType = this.SensorType;
|
connectButtonClick();
|
||||||
UIManager.Show(deviceModal, null, true);
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
|
||||||
|
{
|
||||||
|
connectButtonClick();
|
||||||
|
}));
|
||||||
|
|
||||||
|
UIManager.AddEvent(connectionButton.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
|
||||||
|
if (!mPairButton.activeSelf)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mDisconnectButtonClick();
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
|
UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
|
||||||
//var device = GetDevice();
|
mDisconnectButtonClick();
|
||||||
//if(device != null && device.State == DeviceState.Connected)
|
}));
|
||||||
//{
|
|
||||||
// device.Disconnect();
|
}
|
||||||
//}
|
void connectButtonClick()
|
||||||
|
{
|
||||||
|
if (deviceModal == null)
|
||||||
|
{
|
||||||
|
|
||||||
#if UNITY_IOS || UNITY_ANDROID
|
#if UNITY_IOS || UNITY_ANDROID
|
||||||
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
|
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
|
||||||
#else
|
#else
|
||||||
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
|
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
|
||||||
#endif
|
#endif
|
||||||
GameObject gameObject = (GameObject)Instantiate(obj);
|
GameObject gameObject = (GameObject)Instantiate(obj);
|
||||||
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
|
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
|
||||||
deviceModal.SensorType = this.SensorType;
|
}
|
||||||
UIManager.Show(deviceModal, null, true);
|
deviceModal.SensorType = this.SensorType;
|
||||||
}));
|
UIManager.Show(deviceModal, null, true);
|
||||||
|
}
|
||||||
|
void mDisconnectButtonClick()
|
||||||
|
{
|
||||||
|
//var device = GetDevice();
|
||||||
|
//if(device != null && device.State == DeviceState.Connected)
|
||||||
|
//{
|
||||||
|
// device.Disconnect();
|
||||||
|
//}
|
||||||
|
|
||||||
|
#if UNITY_IOS || UNITY_ANDROID
|
||||||
|
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
|
||||||
|
#else
|
||||||
|
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
|
||||||
|
#endif
|
||||||
|
GameObject gameObject = (GameObject)Instantiate(obj);
|
||||||
|
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
|
||||||
|
deviceModal.SensorType = this.SensorType;
|
||||||
|
UIManager.Show(deviceModal, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitLogo()
|
void InitLogo()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user