骑行内存优化&设备连接点击优化
This commit is contained in:
parent
004410048f
commit
8b3dd7a40a
@ -30,7 +30,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 189965521107699628}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
@ -102,6 +102,7 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1107195470343135181}
|
||||
- {fileID: 4347642619387382541}
|
||||
- {fileID: 5333104648953487716}
|
||||
- {fileID: 6514089965287851756}
|
||||
@ -153,7 +154,7 @@ MonoBehaviour:
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 0}
|
||||
m_TargetGraphic: {fileID: 5133914736490982493}
|
||||
--- !u!1 &6092777681612193971
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -184,7 +185,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 189965521107699628}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {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_Children: []
|
||||
m_Father: {fileID: 189965521107699628}
|
||||
m_RootOrder: 0
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
@ -336,7 +337,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 189965521107699628}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
@ -380,3 +381,77 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
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();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Resources.UnloadUnusedAssets();
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
private void OnApplicationPause(bool focus)
|
||||
{
|
||||
if (focus)
|
||||
|
||||
@ -88,6 +88,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
void OnDestroy()
|
||||
{
|
||||
Resources.UnloadUnusedAssets();
|
||||
GC.Collect();
|
||||
}
|
||||
Transform target;
|
||||
GameObject watcher;
|
||||
@ -107,6 +108,8 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
return OnlineHeadPanel;
|
||||
}
|
||||
Material Graph3d { get; set; }
|
||||
Material Graph4 { get; set; }
|
||||
Material Graph1 { get; set; }
|
||||
public Material Get3dGraph2()
|
||||
{
|
||||
if (Graph3d == null)
|
||||
@ -115,6 +118,26 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
}
|
||||
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; }
|
||||
public Image GetCompetitionArrow()
|
||||
{
|
||||
|
||||
@ -86,8 +86,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
nearByItemscript.setName(item.Name);
|
||||
nearByItemscript.setRatio(item.KGWeight + "W/KG");
|
||||
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));
|
||||
#endif
|
||||
nearByItemscript.setDistance(item.Near.ToString() + "KM");
|
||||
nearByItemscript.transform.SetSiblingIndex((int)item.Near);
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
trailRenderer = FindObjectOfType<TrailRenderer>();
|
||||
//var color7 = Resources.Load<Material>("UI/Material/color7");
|
||||
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.startWidth = 1f;
|
||||
trailRenderer.endWidth = 1f;
|
||||
@ -222,7 +222,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
_directionsGO.transform.SetParent(transform);
|
||||
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
||||
//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.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.localScale = new Vector3(0.8f, 0.8f, 0.8f);
|
||||
}
|
||||
if (CurrentIndex == 1)
|
||||
{
|
||||
|
||||
}
|
||||
int nextIndex = CurrentIndex;
|
||||
var viewIndex = chartDataSourceScript.GetViewIndex(nextIndex);
|
||||
//人物移动 停止条件 到中间且线未加载完
|
||||
|
||||
@ -130,7 +130,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
||||
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||
//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.startColor = new Color(1, 1f, 1f, 0.65f);
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ using System;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
public class RouteController : MonoBehaviour
|
||||
public class RouteController : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
AbstractMap _map;
|
||||
@ -21,7 +21,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Material _material;
|
||||
[SerializeField]
|
||||
[Range(1, 10)]
|
||||
private float UpdateFrequency = 0.1f;
|
||||
private float UpdateFrequency = 1f;
|
||||
|
||||
private int _counter;
|
||||
|
||||
@ -31,32 +31,34 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
CyclingController cyclingCotroller;
|
||||
private bool initComplete = false;
|
||||
|
||||
Material Graph2 { get; set; }
|
||||
Material linematerial { get; set; }
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
if (_map == null)
|
||||
{
|
||||
_map = FindObjectOfType<AbstractMap>();
|
||||
}
|
||||
// _map.OnInitialized += _map_OnInitialized; ;
|
||||
//_map.OnUpdated += _map_OnUpdated; ;
|
||||
|
||||
|
||||
|
||||
// _map.OnInitialized += _map_OnInitialized; ;
|
||||
//_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");
|
||||
}
|
||||
}
|
||||
|
||||
private void _map_OnInitialized()
|
||||
{
|
||||
private void _map_OnInitialized()
|
||||
{
|
||||
Debug.Log("_map_OnInitialized");
|
||||
CreateRoute();
|
||||
}
|
||||
|
||||
private void _map_OnTileFinished(UnityTile obj)
|
||||
{
|
||||
private void _map_OnTileFinished(UnityTile obj)
|
||||
{
|
||||
|
||||
if (!initComplete)
|
||||
{
|
||||
@ -94,7 +96,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
void CreateRoute(UnityTile tile)
|
||||
{
|
||||
{
|
||||
var meshData = new MeshData();
|
||||
//var meshData = new MeshData();
|
||||
var dat = new List<Vector3>();
|
||||
var path = new List<Vector3>();
|
||||
|
||||
@ -121,13 +123,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (diffAbs <= 200)
|
||||
{
|
||||
//if (!dat.Contains(item))
|
||||
dat.Add(item);
|
||||
dat.Add(item);
|
||||
}
|
||||
if (diff <= 0 && diff > -200)
|
||||
{
|
||||
item.y += 0.15f;
|
||||
//if (!dat.Contains(item))
|
||||
path.Add(item);
|
||||
path.Add(item);
|
||||
}
|
||||
}
|
||||
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);
|
||||
if (foundTile)
|
||||
{
|
||||
var meshData = new MeshData();
|
||||
//var meshData = new MeshData();
|
||||
var dat = new List<Vector3>();
|
||||
|
||||
var mapData = cyclingCotroller.GetMapData();
|
||||
@ -188,16 +190,16 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
if (_directionsGO != null)
|
||||
{
|
||||
_directionsGO.Destroy();
|
||||
DestroyImmediate(_directionsGO);
|
||||
}
|
||||
_directionsGO = new GameObject("MapRoute");
|
||||
_directionsGO.transform.parent = transform;
|
||||
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
||||
//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];
|
||||
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);
|
||||
|
||||
//设置宽度
|
||||
@ -205,26 +207,26 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
lineRender.endWidth = 1.5f;
|
||||
lineRender.positionCount = dat.Count;
|
||||
lineRender.SetPositions(feat.Points[0].ToArray());
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 10;
|
||||
//lineRender.numCornerVertices = 30;
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 10;
|
||||
//lineRender.numCornerVertices = 30;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CreatPathRoute(List<Vector3> feat)
|
||||
{
|
||||
if (_pathRoute != null)
|
||||
{
|
||||
_pathRoute.Destroy();
|
||||
DestroyImmediate(_pathRoute);
|
||||
}
|
||||
_pathRoute = new GameObject("MapPathRoute");
|
||||
_pathRoute.transform.parent = transform;
|
||||
var lineRender = _pathRoute.AddComponent<LineRenderer>();
|
||||
//lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||
//var color7 = Resources.Load<Material>("UI/Material/color7");
|
||||
var Graph2 = Resources.Load<Material>("UI/Material/3dGraph2");
|
||||
lineRender.materials = new Material[] { Graph2 };
|
||||
//var Graph2 = Resources.Load<Material>("UI/Material/3dGraph2");
|
||||
lineRender.material = Graph2;//new Material[] { Graph2 };
|
||||
lineRender.endColor = 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.positionCount = feat.Count;
|
||||
lineRender.SetPositions(feat.ToArray());
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 10;
|
||||
//lineRender.numCornerVertices = 10;
|
||||
//
|
||||
lineRender.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 10;
|
||||
//lineRender.numCornerVertices = 10;
|
||||
//
|
||||
lineRender.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
lineRender.allowOcclusionWhenDynamic = false;
|
||||
lineRender.textureMode = LineTextureMode.Tile;
|
||||
lineRender.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion;
|
||||
|
||||
@ -72,8 +72,11 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
this.Close();
|
||||
//DestroyImmediate(this.gameObject);
|
||||
}));
|
||||
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
deviceItem = Resources.Load("UI/Prefab/Device/Mobile/DeviceItem");
|
||||
#else
|
||||
deviceItem = Resources.Load("UI/Prefab/Device/DeviceItem");
|
||||
#endif
|
||||
|
||||
connectBtn = container.Find("ConnectBtn").GetComponent<PfUIButton>();
|
||||
connectBtnText = connectBtn.transform.Find("Text").GetComponent<Text>();
|
||||
|
||||
@ -29,7 +29,8 @@ public class DeviceItem : Selectable, IEventSystemHandler, IPointerClickHandler
|
||||
protected override void Start()
|
||||
{
|
||||
//this.currentSelectionState = SelectionState.Selected
|
||||
|
||||
if (DeviceInfo == null)
|
||||
return;
|
||||
mText.text = DeviceInfo.Name;// + "-" + DeviceInfo.DeviceNumber;
|
||||
if(DeviceInfo.Network == NetworkType.ANT)
|
||||
{
|
||||
|
||||
@ -58,6 +58,9 @@ public class DeviceView : MonoBehaviour
|
||||
/// </summary>
|
||||
private Sprite sprite3;
|
||||
|
||||
private Button unconnectionButton;
|
||||
private Button connectionButton;
|
||||
|
||||
private float timer = 1.0f;
|
||||
private void Awake()
|
||||
{
|
||||
@ -67,9 +70,10 @@ public class DeviceView : MonoBehaviour
|
||||
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
|
||||
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
|
||||
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
|
||||
unconnectionButton = unconnectionPanel.GetComponent<Button>();
|
||||
mPairButton.SetActive(false);
|
||||
connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
|
||||
|
||||
connectionButton = connectionPanel.GetComponent<Button>();
|
||||
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));
|
||||
@ -122,41 +126,68 @@ public class DeviceView : MonoBehaviour
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
#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>();
|
||||
return;
|
||||
}
|
||||
deviceModal.SensorType = this.SensorType;
|
||||
UIManager.Show(deviceModal, null, true);
|
||||
connectButtonClick();
|
||||
}));
|
||||
|
||||
|
||||
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 => {
|
||||
//var device = GetDevice();
|
||||
//if(device != null && device.State == DeviceState.Connected)
|
||||
//{
|
||||
// device.Disconnect();
|
||||
//}
|
||||
mDisconnectButtonClick();
|
||||
}));
|
||||
|
||||
}
|
||||
void connectButtonClick()
|
||||
{
|
||||
if (deviceModal == null)
|
||||
{
|
||||
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
|
||||
#else
|
||||
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
|
||||
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);
|
||||
}));
|
||||
}
|
||||
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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user