public void ScouterParse() { try { ScoutObj = new Scouter(WAS.scouter); } catch { ScoutObj = new Scouter("0_1_0_0_0_0_0_0_0_0_0_0"); } }
public static Scouter GetApi(string url) { // 例外が発生したらとりあえず上で何とかするのでここではキャッチしない UnityWebRequest request = UnityWebRequest.Get(url); // リクエスト送信 AsyncOperation checkAsync = request.Send(); var scouter = new Scouter(); while (!checkAsync.isDone) { ; } // GazeGestureManager gazeGestureManeger = FindObjectOfType<GazeGestureManager>(); scouter = JsonUtility.FromJson <Scouter>(request.downloadHandler.text); return(scouter); }
public void SetBotScouter() { if (!WAS.isKicker) { ScoutObj = new Scouter("3_4_11_13_14_22_15_16_11_12_18_21"); return; } ScoutObj = new Scouter(); for (int k = 1; k <= 4; k++) { int wid = WAS.GetWidthOfDirection(k); int s = wid * 5 / AgUtil.RandomInclude(50, 98); int f = wid * 4 / AgUtil.RandomInclude(40, 78); s = s.GetSmaller(AgUtil.RandomInclude(3, 15)); f = f.GetSmaller(AgUtil.RandomInclude(3, 15)); //(k + " wid " + wid + " s / f " + s + ", " + f).HtLog (); ScoutObj.SetValue(k, s, f); } ScoutObj.GetString().HtLog(); }
// 写真撮影時のイベント void onPhotoCaptured(List <byte> image, int width, int height) { /// テストパターン /// ①QRコードを読んでレスポンスを受け取ってそれを使う(実戦) /// ②QRコードを読まずにとりあえず表示だけしてみたいとき(表示やapiの確認、unityeditor) try { if (!isTest) { string url = qrDecoder.Decode(image.ToArray(), width, height); response = WebApi.GetApi(url); } else { string url = "https://esap.herokuapp.com/scouterapi/ranking/" + id.ToString() + "/"; response = WebApi.GetApi(url); // Debug.Log(response); /* * response.id = 1; * response.point = 150; * response.name = "ギークラボ長野"; * response.is_presented = false; */ } if (response != null) { Debug.Log(response.point); status = 10; } // 成功音声 // captureAudioSource.Play(); } catch { failedAudioSource.Play(); } }
private void Start() { player = FindObjectOfType <PlayerMap>(); scouter = FindObjectOfType <Scouter>(); }