This commit is contained in:
parent
c338f9a943
commit
636973b26b
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -118276,7 +118276,7 @@ GameObject:
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &372195433
|
--- !u!224 &372195433
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -147085,7 +147085,7 @@ GameObject:
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!4 &463649141
|
--- !u!4 &463649141
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -379705,7 +379705,7 @@ GameObject:
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &1223963662
|
--- !u!224 &1223963662
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -397328,6 +397328,24 @@ MonoBehaviour:
|
||||||
leftTurnSignal2: {fileID: 1451361451}
|
leftTurnSignal2: {fileID: 1451361451}
|
||||||
rightTurnSignal2: {fileID: 1223963661}
|
rightTurnSignal2: {fileID: 1223963661}
|
||||||
turnSignalState: 0
|
turnSignalState: 0
|
||||||
|
--- !u!114 &1276762329
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1276762317}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: bbeae135ab034b18b4ee0f161868df08, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
turnSignalController: {fileID: 1276762328}
|
||||||
|
vehicleController: {fileID: 2037673176}
|
||||||
|
cam1: {fileID: 1136185827}
|
||||||
|
cam2: {fileID: 1785647646}
|
||||||
|
menuUI: {fileID: 1648579876}
|
||||||
|
carInfoUI: {fileID: 1944520099}
|
||||||
--- !u!1 &1277129999
|
--- !u!1 &1277129999
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -515864,6 +515882,41 @@ PrefabInstance:
|
||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5147937073826101263, guid: 0963d4822fd9c94449c14b6193a82711,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5147937073826101263, guid: 0963d4822fd9c94449c14b6193a82711,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5147937073826101263, guid: 0963d4822fd9c94449c14b6193a82711,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1648579877}
|
||||||
|
- target: {fileID: 5147937073826101263, guid: 0963d4822fd9c94449c14b6193a82711,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5147937073826101263, guid: 0963d4822fd9c94449c14b6193a82711,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
|
||||||
|
value: BackScene
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5147937073826101263, guid: 0963d4822fd9c94449c14b6193a82711,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
|
||||||
|
value: CarMenuManager, Assembly-CSharp
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5147937073826101263, guid: 0963d4822fd9c94449c14b6193a82711,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
|
||||||
|
value: UnityEngine.Object, UnityEngine
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 0963d4822fd9c94449c14b6193a82711, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 0963d4822fd9c94449c14b6193a82711, type: 3}
|
||||||
--- !u!224 &1648579875 stripped
|
--- !u!224 &1648579875 stripped
|
||||||
|
|
@ -515878,6 +515931,18 @@ GameObject:
|
||||||
type: 3}
|
type: 3}
|
||||||
m_PrefabInstance: {fileID: 1648579874}
|
m_PrefabInstance: {fileID: 1648579874}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!114 &1648579877 stripped
|
||||||
|
MonoBehaviour:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 5147937073258533037, guid: 0963d4822fd9c94449c14b6193a82711,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1648579874}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1648579876}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 23d5610a9722fd84a87dde668e3090b7, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &1648598824
|
--- !u!1 &1648598824
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -560045,6 +560110,12 @@ Transform:
|
||||||
m_Father: {fileID: 1728209287}
|
m_Father: {fileID: 1728209287}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &1785647646 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 3190887408370009811, guid: 4292160a5e1fde347934ac660b2c5d30,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 2037673174}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1 &1785683964
|
--- !u!1 &1785683964
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -643853,6 +643924,10 @@ PrefabInstance:
|
||||||
propertyPath: gearControl
|
propertyPath: gearControl
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1276762320}
|
objectReference: {fileID: 1276762320}
|
||||||
|
- target: {fileID: 11461196, guid: 4292160a5e1fde347934ac660b2c5d30, type: 3}
|
||||||
|
propertyPath: m_Enabled
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 15384928, guid: 4292160a5e1fde347934ac660b2c5d30, type: 3}
|
- target: {fileID: 15384928, guid: 4292160a5e1fde347934ac660b2c5d30, type: 3}
|
||||||
propertyPath: m_ConnectedAnchor.x
|
propertyPath: m_ConnectedAnchor.x
|
||||||
value: -0.394989
|
value: -0.394989
|
||||||
|
|
@ -643893,6 +643968,10 @@ PrefabInstance:
|
||||||
propertyPath: carMenuUI
|
propertyPath: carMenuUI
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1648579876}
|
objectReference: {fileID: 1648579876}
|
||||||
|
- target: {fileID: 1276762318, guid: 4292160a5e1fde347934ac660b2c5d30, type: 3}
|
||||||
|
propertyPath: m_Enabled
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1276762318, guid: 4292160a5e1fde347934ac660b2c5d30, type: 3}
|
- target: {fileID: 1276762318, guid: 4292160a5e1fde347934ac660b2c5d30, type: 3}
|
||||||
propertyPath: thirdPerson
|
propertyPath: thirdPerson
|
||||||
value:
|
value:
|
||||||
|
|
@ -644104,7 +644183,7 @@ PrefabInstance:
|
||||||
- target: {fileID: 5904705805594164072, guid: 4292160a5e1fde347934ac660b2c5d30,
|
- target: {fileID: 5904705805594164072, guid: 4292160a5e1fde347934ac660b2c5d30,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 6214432986421238931, guid: 4292160a5e1fde347934ac660b2c5d30,
|
- target: {fileID: 6214432986421238931, guid: 4292160a5e1fde347934ac660b2c5d30,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using EVP;
|
using EVP;
|
||||||
|
using Script.Manaegr;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
using Button = UnityEngine.UI.Button;
|
using Button = UnityEngine.UI.Button;
|
||||||
|
|
@ -22,7 +23,9 @@ namespace Script
|
||||||
private VehicleController vehicleController;
|
private VehicleController vehicleController;
|
||||||
|
|
||||||
private VehicleStandardInput vehicleStandardInput;
|
private VehicleStandardInput vehicleStandardInput;
|
||||||
|
|
||||||
public int currentGear = 0; // 当前挡位
|
public int currentGear = 0; // 当前挡位
|
||||||
|
|
||||||
//public float[] gearSpeeds = { 0f, 20f, 40f, 60f }; // 每个挡位的最大速度
|
//public float[] gearSpeeds = { 0f, 20f, 40f, 60f }; // 每个挡位的最大速度
|
||||||
public List<float> gearSpeeds; // 每个挡位的最大速度
|
public List<float> gearSpeeds; // 每个挡位的最大速度
|
||||||
|
|
||||||
|
|
@ -72,6 +75,7 @@ namespace Script
|
||||||
private int currentEndIndex = 0; // 当前的结束索引
|
private int currentEndIndex = 0; // 当前的结束索引
|
||||||
|
|
||||||
public bool isShache = false;
|
public bool isShache = false;
|
||||||
|
|
||||||
public void LoadData()
|
public void LoadData()
|
||||||
{
|
{
|
||||||
gearSpeeds = new List<float>();
|
gearSpeeds = new List<float>();
|
||||||
|
|
@ -89,7 +93,6 @@ namespace Script
|
||||||
float endValue = i + 1;
|
float endValue = i + 1;
|
||||||
for (int j = 1; j < interval; j++)
|
for (int j = 1; j < interval; j++)
|
||||||
{
|
{
|
||||||
|
|
||||||
float interpolatedValue = startValue + (endValue - startValue) * j / interval;
|
float interpolatedValue = startValue + (endValue - startValue) * j / interval;
|
||||||
gearSpeeds.Add(interpolatedValue);
|
gearSpeeds.Add(interpolatedValue);
|
||||||
}
|
}
|
||||||
|
|
@ -107,13 +110,11 @@ namespace Script
|
||||||
gearSpeeds[8] = 0;
|
gearSpeeds[8] = 0;
|
||||||
gearSpeeds[9] = 0;
|
gearSpeeds[9] = 0;
|
||||||
gearSpeeds[10] = 0;
|
gearSpeeds[10] = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
|
||||||
LoadData();
|
LoadData();
|
||||||
|
|
||||||
vehicleController = GetComponent<VehicleController>();
|
vehicleController = GetComponent<VehicleController>();
|
||||||
|
|
@ -121,14 +122,24 @@ namespace Script
|
||||||
|
|
||||||
StartModbus();
|
StartModbus();
|
||||||
ModBusQueue();
|
ModBusQueue();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task StartModbus()
|
async Task StartModbus()
|
||||||
{
|
{
|
||||||
client = new ModbusTcpClient();
|
client = new ModbusTcpClient();
|
||||||
await client.ConnectToServer();
|
if (await client.ConnectToServer())
|
||||||
|
{
|
||||||
|
Debug.Log("连接上");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.GetComponent<CarGearControl>().enabled = false;
|
||||||
|
this.GetComponent<VehicleStandardInput>().enabled = true;
|
||||||
|
|
||||||
|
this.GetComponent<CarInputManager>().Init();
|
||||||
|
Debug.Log("断开连接");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// client.StartModbus();
|
// client.StartModbus();
|
||||||
|
|
||||||
|
|
@ -176,8 +187,6 @@ namespace Script
|
||||||
vehicleController.steerInput = NormalizeValue(carData.SteeringWheelAngle, minValue, maxValue);
|
vehicleController.steerInput = NormalizeValue(carData.SteeringWheelAngle, minValue, maxValue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//钥匙 00是熄火,1是通电,2是点火
|
//钥匙 00是熄火,1是通电,2是点火
|
||||||
switch (carData.KeyStatus)
|
switch (carData.KeyStatus)
|
||||||
{
|
{
|
||||||
|
|
@ -256,6 +265,7 @@ namespace Script
|
||||||
lastEndIndex = currentEndIndex;
|
lastEndIndex = currentEndIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//当转向没有打灯就弹窗
|
//当转向没有打灯就弹窗
|
||||||
if (carData.SteeringWheelAngle > 200)
|
if (carData.SteeringWheelAngle > 200)
|
||||||
{
|
{
|
||||||
|
|
@ -263,7 +273,6 @@ namespace Script
|
||||||
{
|
{
|
||||||
accidentManager.PlayAnimationSequence("MsgWinAnimOpen", "MsgWinAnimClose");
|
accidentManager.PlayAnimationSequence("MsgWinAnimOpen", "MsgWinAnimClose");
|
||||||
accidentManager.uis.transform.Find("UI/转向").gameObject.SetActive(true);
|
accidentManager.uis.transform.Find("UI/转向").gameObject.SetActive(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (carData.SteeringWheelAngle < -200)
|
else if (carData.SteeringWheelAngle < -200)
|
||||||
|
|
@ -272,10 +281,8 @@ namespace Script
|
||||||
{
|
{
|
||||||
accidentManager.PlayAnimationSequence("MsgWinAnimOpen", "MsgWinAnimClose");
|
accidentManager.PlayAnimationSequence("MsgWinAnimOpen", "MsgWinAnimClose");
|
||||||
accidentManager.uis.transform.Find("UI/转向").gameObject.SetActive(true);
|
accidentManager.uis.transform.Find("UI/转向").gameObject.SetActive(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -473,6 +480,7 @@ namespace Script
|
||||||
{
|
{
|
||||||
shache[i].SetActive(true);
|
shache[i].SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
vehicleController.throttleInput = 0;
|
vehicleController.throttleInput = 0;
|
||||||
currentGear = 0;
|
currentGear = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -525,6 +533,7 @@ namespace Script
|
||||||
|
|
||||||
currentCoroutine = null;
|
currentCoroutine = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CarMenuButton(int bt)
|
void CarMenuButton(int bt)
|
||||||
{
|
{
|
||||||
if (bt == 3)
|
if (bt == 3)
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,9 @@ public class CarMenuManager : MonoBehaviour
|
||||||
SceneManager.LoadScene("menu");
|
SceneManager.LoadScene("menu");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void BackScene()
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene("menu");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
using System;
|
||||||
|
using EVP;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Script.Manaegr
|
||||||
|
{
|
||||||
|
public class CarInputManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
public TurnSignalController turnSignalController;
|
||||||
|
public VehicleController vehicleController;
|
||||||
|
|
||||||
|
|
||||||
|
public GameObject cam1;
|
||||||
|
public GameObject cam2;
|
||||||
|
|
||||||
|
public GameObject menuUI;
|
||||||
|
public GameObject carInfoUI;
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
vehicleController.maxSpeedForward = 11;
|
||||||
|
carInfoUI.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
//左转向
|
||||||
|
if (Input.GetKeyDown(KeyCode.J))
|
||||||
|
{
|
||||||
|
turnSignalController.SetSignal(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.K))
|
||||||
|
{
|
||||||
|
turnSignalController.SetSignal(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.L))
|
||||||
|
{
|
||||||
|
turnSignalController.SetSignal(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.U))
|
||||||
|
{
|
||||||
|
if (cam1.activeInHierarchy)
|
||||||
|
{
|
||||||
|
cam1.SetActive(false);
|
||||||
|
cam2.SetActive(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cam1.SetActive(true);
|
||||||
|
cam2.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Input.GetKeyDown(KeyCode.Escape))
|
||||||
|
{
|
||||||
|
if (menuUI.activeInHierarchy)
|
||||||
|
{
|
||||||
|
menuUI.SetActive(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menuUI.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bbeae135ab034b18b4ee0f161868df08
|
||||||
|
timeCreated: 1704940206
|
||||||
|
|
@ -78,7 +78,6 @@ namespace ModbusManager
|
||||||
{
|
{
|
||||||
tcpClient = new TcpClient();
|
tcpClient = new TcpClient();
|
||||||
modbusQueue = new Queue<CarStatusData>();
|
modbusQueue = new Queue<CarStatusData>();
|
||||||
|
|
||||||
string str= System.IO.File.ReadAllText(Application.streamingAssetsPath + "/setting.txt");
|
string str= System.IO.File.ReadAllText(Application.streamingAssetsPath + "/setting.txt");
|
||||||
serverIp = str.Split(',')[0];
|
serverIp = str.Split(',')[0];
|
||||||
serverPort = int.Parse(str.Split(',')[1]);
|
serverPort = int.Parse(str.Split(',')[1]);
|
||||||
|
|
@ -89,17 +88,31 @@ namespace ModbusManager
|
||||||
/// 协议为MODBUS/TCP,数据为十六进制数据。
|
/// 协议为MODBUS/TCP,数据为十六进制数据。
|
||||||
/// 硬件设备为服务器端,IP地址192.168.0.100,端口12315,电脑为客户端。
|
/// 硬件设备为服务器端,IP地址192.168.0.100,端口12315,电脑为客户端。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task ConnectToServer()
|
public async Task<bool> ConnectToServer()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await tcpClient.ConnectAsync(serverIp, serverPort);
|
// await tcpClient.ConnectAsync(serverIp, serverPort);
|
||||||
Debug.Log("已连接到Modbus服务器。");
|
|
||||||
|
var result= tcpClient.BeginConnect(serverIp, serverPort, null, null);
|
||||||
|
|
||||||
|
var success = result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(1));
|
||||||
|
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
throw new Exception("连接Modbus服务器时出错");
|
||||||
|
}
|
||||||
|
// tcpClient.EndConnect(result);
|
||||||
|
|
||||||
|
Debug.Log("已连接到Modbus服务器。");
|
||||||
|
|
||||||
await SendModbusRequest12();
|
await SendModbusRequest12();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.Log("连接Modbus服务器时出错: " + ex.Message);
|
Debug.Log("连接Modbus服务器时出错: " + ex.Message);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ public class OneWaySemaphoreSystem : SemaphoreSystem
|
||||||
semaphore.ChangeYellow(true);
|
semaphore.ChangeYellow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log(this.name);
|
// Debug.Log(this.name);
|
||||||
yield return new WaitForSeconds(yellowTime);
|
yield return new WaitForSeconds(yellowTime);
|
||||||
|
|
||||||
StartCoroutine(Green());
|
StartCoroutine(Green());
|
||||||
|
|
@ -162,7 +162,7 @@ public class OneWaySemaphoreSystem : SemaphoreSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
countdownTime = greenTime;
|
countdownTime = greenTime;
|
||||||
Debug.Log(this.name);
|
// Debug.Log(this.name);
|
||||||
yield return new WaitForSeconds(greenTime);
|
yield return new WaitForSeconds(greenTime);
|
||||||
|
|
||||||
StartFlick();
|
StartFlick();
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -5,14 +5,14 @@
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.ext.nunit": {
|
"com.unity.ext.nunit": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.ide.rider": {
|
"com.unity.ide.rider": {
|
||||||
"version": "3.0.7",
|
"version": "3.0.7",
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.ext.nunit": "1.0.6"
|
"com.unity.ext.nunit": "1.0.6"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.ide.visualstudio": {
|
"com.unity.ide.visualstudio": {
|
||||||
"version": "2.0.11",
|
"version": "2.0.11",
|
||||||
|
|
@ -30,14 +30,14 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.test-framework": "1.1.9"
|
"com.unity.test-framework": "1.1.9"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.ide.vscode": {
|
"com.unity.ide.vscode": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.postprocessing": {
|
"com.unity.postprocessing": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.modules.physics": "1.0.0"
|
"com.unity.modules.physics": "1.0.0"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.test-framework": {
|
"com.unity.test-framework": {
|
||||||
"version": "1.1.29",
|
"version": "1.1.29",
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
"com.unity.modules.imgui": "1.0.0",
|
"com.unity.modules.imgui": "1.0.0",
|
||||||
"com.unity.modules.jsonserialize": "1.0.0"
|
"com.unity.modules.jsonserialize": "1.0.0"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.textmeshpro": {
|
"com.unity.textmeshpro": {
|
||||||
"version": "3.0.6",
|
"version": "3.0.6",
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.ugui": "1.0.0"
|
"com.unity.ugui": "1.0.0"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.timeline": {
|
"com.unity.timeline": {
|
||||||
"version": "1.5.6",
|
"version": "1.5.6",
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
"com.unity.modules.audio": "1.0.0",
|
"com.unity.modules.audio": "1.0.0",
|
||||||
"com.unity.modules.particlesystem": "1.0.0"
|
"com.unity.modules.particlesystem": "1.0.0"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.ugui": {
|
"com.unity.ugui": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
"com.unity.modules.physics": "1.0.0",
|
"com.unity.modules.physics": "1.0.0",
|
||||||
"com.unity.modules.physics2d": "1.0.0"
|
"com.unity.modules.physics2d": "1.0.0"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.modules.ai": {
|
"com.unity.modules.ai": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|
|
||||||
|
|
@ -1,54 +1,39 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
# Visual Studio 15
|
# Visual Studio 2010
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{90D7B334-9907-D211-326F-33D0FF6F6206}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{34b3d790-0799-11d2-326f-33d0ff6f6206}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxophobic.Utils.Scripts", "Boxophobic.Utils.Scripts.csproj", "{CDFF3BE2-7F3F-3464-C8D9-78B1AE3BC3C2}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxophobic.Utils.Scripts", "Boxophobic.Utils.Scripts.csproj", "{e23bffcd-3f7f-6434-c8d9-78b1ae3bc3c2}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxophobic.AtmosphericHeightFog.Runtime", "Boxophobic.AtmosphericHeightFog.Runtime.csproj", "{4C96BD12-F6EB-0840-DC94-863A1F7D1D40}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxophobic.AtmosphericHeightFog.Runtime", "Boxophobic.AtmosphericHeightFog.Runtime.csproj", "{12bd964c-ebf6-4008-dc94-863a1f7d1d40}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmplifyShaderEditor", "AmplifyShaderEditor.csproj", "{19680DCC-6E6D-4577-34A0-666CCEA436DB}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmplifyShaderEditor", "AmplifyShaderEditor.csproj", "{cc0d6819-6d6e-7745-34a0-666ccea436db}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxophobic.AtmosphericHeightFog.Editor", "Boxophobic.AtmosphericHeightFog.Editor.csproj", "{2FB7B5C3-8350-5D1C-9F5A-F691307D3EFB}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxophobic.AtmosphericHeightFog.Editor", "Boxophobic.AtmosphericHeightFog.Editor.csproj", "{c3b5b72f-5083-1c5d-9f5a-f691307d3efb}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxophobic.Utils.Editor", "Boxophobic.Utils.Editor.csproj", "{EE237F7D-34D2-D9AE-0263-133C3F95283C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boxophobic.Utils.Editor", "Boxophobic.Utils.Editor.csproj", "{7d7f23ee-d234-aed9-0263-133c3f95283c}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{50ADFF00-8BA1-5513-3A1B-93449EB2679C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{00ffad50-a18b-1355-3a1b-93449eb2679c}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{90D7B334-9907-D211-326F-33D0FF6F6206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{34b3d790-0799-11d2-326f-33d0ff6f6206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{90D7B334-9907-D211-326F-33D0FF6F6206}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{34b3d790-0799-11d2-326f-33d0ff6f6206}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{90D7B334-9907-D211-326F-33D0FF6F6206}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{e23bffcd-3f7f-6434-c8d9-78b1ae3bc3c2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{90D7B334-9907-D211-326F-33D0FF6F6206}.Release|Any CPU.Build.0 = Release|Any CPU
|
{e23bffcd-3f7f-6434-c8d9-78b1ae3bc3c2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{CDFF3BE2-7F3F-3464-C8D9-78B1AE3BC3C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{12bd964c-ebf6-4008-dc94-863a1f7d1d40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{CDFF3BE2-7F3F-3464-C8D9-78B1AE3BC3C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{12bd964c-ebf6-4008-dc94-863a1f7d1d40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{CDFF3BE2-7F3F-3464-C8D9-78B1AE3BC3C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{cc0d6819-6d6e-7745-34a0-666ccea436db}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{CDFF3BE2-7F3F-3464-C8D9-78B1AE3BC3C2}.Release|Any CPU.Build.0 = Release|Any CPU
|
{cc0d6819-6d6e-7745-34a0-666ccea436db}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4C96BD12-F6EB-0840-DC94-863A1F7D1D40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{c3b5b72f-5083-1c5d-9f5a-f691307d3efb}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{4C96BD12-F6EB-0840-DC94-863A1F7D1D40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{c3b5b72f-5083-1c5d-9f5a-f691307d3efb}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4C96BD12-F6EB-0840-DC94-863A1F7D1D40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{7d7f23ee-d234-aed9-0263-133c3f95283c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{4C96BD12-F6EB-0840-DC94-863A1F7D1D40}.Release|Any CPU.Build.0 = Release|Any CPU
|
{7d7f23ee-d234-aed9-0263-133c3f95283c}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{19680DCC-6E6D-4577-34A0-666CCEA436DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{00ffad50-a18b-1355-3a1b-93449eb2679c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{19680DCC-6E6D-4577-34A0-666CCEA436DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{00ffad50-a18b-1355-3a1b-93449eb2679c}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{19680DCC-6E6D-4577-34A0-666CCEA436DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{19680DCC-6E6D-4577-34A0-666CCEA436DB}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{2FB7B5C3-8350-5D1C-9F5A-F691307D3EFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{2FB7B5C3-8350-5D1C-9F5A-F691307D3EFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{2FB7B5C3-8350-5D1C-9F5A-F691307D3EFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{2FB7B5C3-8350-5D1C-9F5A-F691307D3EFB}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{EE237F7D-34D2-D9AE-0263-133C3F95283C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{EE237F7D-34D2-D9AE-0263-133C3F95283C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{EE237F7D-34D2-D9AE-0263-133C3F95283C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{EE237F7D-34D2-D9AE-0263-133C3F95283C}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{50ADFF00-8BA1-5513-3A1B-93449EB2679C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{50ADFF00-8BA1-5513-3A1B-93449EB2679C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{50ADFF00-8BA1-5513-3A1B-93449EB2679C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{50ADFF00-8BA1-5513-3A1B-93449EB2679C}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue