tcp库更新&附近人下拉调整

This commit is contained in:
lishuo 2021-08-25 11:20:59 +08:00
parent 3de8b1d555
commit bb08b6b762
4 changed files with 14 additions and 2 deletions

Binary file not shown.

View File

@ -167,6 +167,15 @@ namespace Assets.Scripts.Ble
}; };
public static readonly IReadOnlyList<ServiceUuid> CyclingServices = ServiceUuids.Services.Where(s => s.IsCycling).ToList(); public static readonly IReadOnlyList<ServiceUuid> CyclingServices = ServiceUuids.Services.Where(s => s.IsCycling).ToList();
public static List<string> GetServiceUuidList()
{
List<string> list = new List<string>();
foreach (var item in Services)
{
list.Add(item.IdGuid.ToString());
}
return list;
}
public static ServiceUuid Get(byte[] type) public static ServiceUuid Get(byte[] type)
{ {
return ServiceUuids.Services.Single(s => s.IdByteArray == type); return ServiceUuids.Services.Single(s => s.IdByteArray == type);

View File

@ -66,7 +66,8 @@ namespace Assets.Scripts.Devices.Ble
} }
public void StartWatcher() { public void StartWatcher() {
BluetoothLEHardwareInterface.ScanForPeripheralsWithServices(null, null, (address, name, rssi, bytes) =>
BluetoothLEHardwareInterface.ScanForPeripheralsWithServices(ServiceUuids.GetServiceUuidList().ToArray(), null, (address, name, rssi, bytes) =>
{ {
ScanInfoReceived?.Invoke(this, address, name, rssi, bytes); ScanInfoReceived?.Invoke(this, address, name, rssi, bytes);
}, true); }, true);

View File

@ -1,6 +1,7 @@
using Assets.Scenes.Ride.Scripts.Model; using Assets.Scenes.Ride.Scripts.Model;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI; using UnityEngine.UI;
namespace Assets.Scenes.Ride.Scripts namespace Assets.Scenes.Ride.Scripts
@ -24,7 +25,7 @@ namespace Assets.Scenes.Ride.Scripts
Title = transform.Find("Title").GetComponent<Text>(); Title = transform.Find("Title").GetComponent<Text>();
OnlineUserNum = transform.Find("NearByView/OnlineUserNum").GetComponent<Text>(); OnlineUserNum = transform.Find("NearByView/OnlineUserNum").GetComponent<Text>();
pageSize = 999;//开启无线下拉 pageSize = 5;//开启无线下拉
} }
protected override void CreateList() protected override void CreateList()
{ {
@ -49,6 +50,7 @@ namespace Assets.Scenes.Ride.Scripts
Create(nearList[i]); Create(nearList[i]);
} }
} }
private void Create(NearRiderModel item) private void Create(NearRiderModel item)
{ {
var rankingList = FindObjectsOfType<NearByItemScript>(); var rankingList = FindObjectsOfType<NearByItemScript>();