public virtual void MultiConnectAsync(int cubeNum, MonoBehaviour coroutineObject, Action <Cube, CONNECTION_STATUS> connectedAction = null, bool autoRunning = true) { if (null == this.nearScanner) { this.nearScanner = new NearScanner(cubeNum); } this.connectedAction = connectedAction; this.nearScanner.ScanAsync(coroutineObject, this.OnPeripheralScanned, autoRunning); }
// --- public methods --- public NearScanner(int satisfiedNum, NearScannerInterface impl = null) { #if UNITY_WEBGL && !SIMULATOR_ONLY Debug.Log("[NearScanner]NearScanner doesn't run on the web"); #endif if (null != impl) { // NearScannerの内部実装を外部入力から変更 this.impl = impl; } else { // プリセットで用意したマルチプラットフォーム内部実装(UnityEditor/Mobile/WebGL) this.impl = new Impl(satisfiedNum); } }
public virtual async UniTask <Cube[]> MultiConnect(int cubeNum) { #if UNITY_WEBGL Debug.Log("[CubeManager.MultiConnect]MultiConnect doesn't run on the web"); #endif if (null == this.nearScanner) { this.nearScanner = new NearScanner(cubeNum); } if (null == this.connecter) { this.connecter = new CubeConnecter(); } var peripheral = await this.nearScanner.Scan(); var cubes = await this.connecter.Connect(peripheral); this.AddCube(cubes); return(cubes); }
public void SetNearScanner(NearScannerInterface scanner) { this.nearScanner = scanner; }
// --- public methods --- public NearScanner(int satisfiedNum, NearScannerInterface impl) { // NearScannerの内部実装を外部入力から変更 this.impl = impl; }
public NearScanner(int satisfiedNum, ConnectType type = ConnectType.Auto) { // プリセットで用意したマルチプラットフォーム内部実装(UnityEditor/Mobile/WebGL) this.impl = new AdapterImpl(type, satisfiedNum); }