This commit is contained in:
高铎 2026-05-15 17:04:48 +08:00
parent 50192d18f1
commit 9ef66320ae
3 changed files with 20 additions and 17 deletions

View File

@ -41,14 +41,14 @@ public class MianQian_SenSor : Sensor
public override void ReceiveData(string datas, SerialPort sp = null) public override void ReceiveData(string datas, SerialPort sp = null)
{ {
base.ReceiveData(datas); base.ReceiveData(datas, sp);
if (!datas.Split("OK")[0].Split("ID:")[1].Split(',')[0].Equals("MQ")) return; if (!datas.Split("%")[0].Split("ID:")[1].Split(',')[0].Equals("MQ")) return;
//if (!datas.Split("OK")[0].Split("ID:")[1].Split(',')[0].Equals("ZSQ20")) return; //if (!datas.Split("OK")[0].Split("ID:")[1].Split(',')[0].Equals("ZSQ20")) return;
//this.Error(datas); //this.Error(datas);
lastTime = time; lastTime = time;
X = float.Parse(datas.Split("OK")[0].Split("PIT:")[1].Split(',')[0]); X = float.Parse(datas.Split("%")[0].Split("PIT:")[1].Split(',')[0]);
Y = float.Parse(datas.Split("OK")[0].Split("YAW:")[1].Split(',')[0]); Y = float.Parse(datas.Split("%")[0].Split("YAW:")[1].Split(',')[0]);
Z = float.Parse(datas.Split("OK")[0].Split("ROL:")[1].Split(',')[0]); Z = float.Parse(datas.Split("%")[0].Split("ROL:")[1].Split(',')[0]);
//this.Error($"当前旋转角度为:{X},{Y},{Z}"); //this.Error($"当前旋转角度为:{X},{Y},{Z}");
} }

View File

@ -1,10 +1,11 @@
using DongWuYiXue.Main;
using LitJson; using LitJson;
using System; using System;
using System.Collections; using System.Collections;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using UnityEngine; using UnityEngine;
using UnityEngine.Networking; using UnityEngine.Networking;
using DongWuYiXue.Main;
public class ChatZxkAI : LLM public class ChatZxkAI : LLM
{ {
@ -77,8 +78,10 @@ public class ChatZxkAI : LLM
string _msg = currentRequest.downloadHandler.text; string _msg = currentRequest.downloadHandler.text;
Debug.Log(_msg); Debug.Log(_msg);
JsonData responseBody = JsonMapper.ToObject(_msg); JsonData responseBody = JsonMapper.ToObject(_msg);
Debug.Log(responseBody["choices"][0]["message"]["content"].ToString() + "\nAI-ºÄʱ" + stopwatch.Elapsed.TotalSeconds); //Debug.Log(responseBody["choices"][0]["message"]["content"].ToString() + "\nAI-ºÄʱ" + stopwatch.Elapsed.TotalSeconds);
assistant = responseBody["choices"][0]["message"]["content"].ToString(); Debug.Log(Regex.Replace(responseBody["choices"][0]["message"]["content"].ToString(), @"\[.*?\]", "") + "\nAI-ºÄʱ" + stopwatch.Elapsed.TotalSeconds);
//assistant = responseBody["choices"][0]["message"]["content"].ToString();
assistant = Regex.Replace(responseBody["choices"][0]["message"]["content"].ToString(), @"\[.*?\]", "");
//»Øµ÷ //»Øµ÷
_callback?.Invoke(responseBody["choices"][0]["message"]["content"].ToString()); _callback?.Invoke(responseBody["choices"][0]["message"]["content"].ToString());
success = true; success = true;

View File

@ -26,17 +26,17 @@ namespace DongWuYiXue.DaoNiaoShu
GameManager.Instance.webSockerCameraSender.OnMessageReceived.AddListener(Test); GameManager.Instance.webSockerCameraSender.OnMessageReceived.AddListener(Test);
GameManager.Instance.videoUI.SetActive(true); GameManager.Instance.videoUI.SetActive(true);
cor = Game.Instance.IEnumeratorManager.Run(5.0f, () => cor = Game.Instance.IEnumeratorManager.Run(2.0f, () =>
{ {
isLianJie = true; isLianJie = true;
if (fsm.main_gameModel.modeType == ModeType.ShiXun) //if (fsm.main_gameModel.modeType == ModeType.ShiXun)
{ //{
fsm.AddScore(2, 0); // fsm.AddScore(2, 0);
} //}
if (fsm.main_gameModel.modeType == ModeType.KaoHe) //if (fsm.main_gameModel.modeType == ModeType.KaoHe)
{ //{
fsm.AddScore(2, 0); // fsm.AddScore(2, 0);
} //}
}); });
} }