/// <summary> /// オートスクロール可能なパネルに /// 定義されたラベル・テキストボックスを作成します /// </summary> private void MakeControls(FixedTextDefines source) { foreach (var record in source.Records) { //タブとパネル this.tabControlMain.TabPages.Add(record.Name, record.Name); var panel = new Panel() { Dock = DockStyle.Fill , AutoScroll = true }; //パネルの中身 int y = 0; int startIndex = 0; foreach (var item in record.Items) { var labelText = LabelTextFactory.Generate(item, startIndex); labelText.Location = new Point(0, y); panel.Controls.Add(labelText); y += 25; startIndex += item.Length; } this.tabControlMain.TabPages[record.Name].Controls.Add(panel); } }
IEnumerator SentAPIRequest(string json, string subMethod) { string url = "http://127.0.0.1:4200/" + subMethod; using (UnityWebRequest request = UnityWebRequest.Put(url, json)) { //Debug.Log("trying to send a json:"+json); request.SetRequestHeader("Content-Type", "application/json"); yield return(request.SendWebRequest()); Instance.received = Time.time; if (request.result != UnityWebRequest.Result.Success) { Debug.Log(request.error); Debug.Log("Have you started the API server?"); } else { string resultJson = System.Text.Encoding.Default.GetString(request.downloadHandler.data); Debug.Log(resultJson); DataResponseClass info = JsonUtility.FromJson <DataResponseClass>(resultJson); if (info != null) { if (info.image64 != null) { //Debug.Log("info.confidences:"+info.confidences); //Debug.Log(info); byte[] decodedBytes = Convert.FromBase64String(info.image64); OverlayCoordinator.RenderToPanelSingle(decodedBytes); LabelTextFactory.SetPositions(info.labels); } } Instance.end = Time.time; } } //Debug.Log("Received dif:"+(received - start)); //Debug.Log("Unity side dif:"+(end - received)); Debug.Log("Total dif:" + (end - start)); }
void OnInfStop(GameMessage message) { runInference = false; LabelTextFactory.HideAllTexts(); }