This commit is contained in:
taosuqi 2026-04-09 18:18:55 +08:00
parent 7976599568
commit a3a12084cb
3 changed files with 85 additions and 1 deletions

View File

@ -1426,6 +1426,56 @@ MonoBehaviour:
minIntensity: 0.2
maxIntensity: 0.8
hoverDelay: 1.5
--- !u!1 &356366128
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 356366130}
- component: {fileID: 356366129}
m_Layer: 0
m_Name: "Modbus\u63A7\u5236\u5668"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &356366129
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 356366128}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 21766cb5ef385fb4ea8a5e28c36c993c, type: 3}
m_Name:
m_EditorClassIdentifier:
portName: COM1
baudRate: 9600
deviceList: []
enableDebug: 1
commandInterval: 0.1
deviceStatus: []
--- !u!4 &356366130
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 356366128}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.098803386, y: 1.045672, z: 0.118324734}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 17
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &356808669 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2669374314144407500, guid: 9d5faa837db5bd940bc4f9aee8b423d7, type: 3}
@ -1815,6 +1865,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
firstStep: 4
secondStep: 10
currentStep: 0
currentState: 0
--- !u!114 &456633870
MonoBehaviour:
@ -13102,6 +13153,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
firstStep: 1
secondStep: 11
currentStep: 0
currentState: 0
--- !u!1 &665259325
GameObject:
@ -13317,6 +13369,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
firstStep: 3
secondStep: 9
currentStep: 0
currentState: 0
--- !u!114 &713240770
MonoBehaviour:
@ -17902,6 +17955,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
firstStep: 7
secondStep: 8
currentStep: 0
currentState: 0
--- !u!1 &1389000718 stripped
GameObject:
@ -19210,6 +19264,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
firstStep: 6
secondStep: 14
currentStep: 0
currentState: 0
--- !u!1 &1652472845
GameObject:
@ -19240,6 +19295,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f4f174381a8ac54784d6658a70c3461, type: 3}
m_Name:
m_EditorClassIdentifier:
modbusDeviceController: {fileID: 356366129}
FirstPersonController:
- {fileID: 2130599168}
- {fileID: 1159089850}
@ -19752,6 +19808,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
firstStep: 5
secondStep: 13
currentStep: 0
currentState: 0
--- !u!1 &1739010014 stripped
GameObject:
@ -21188,6 +21245,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
firstStep: 2
secondStep: 12
currentStep: 0
currentState: 0
--- !u!114 &1992144278
MonoBehaviour:
@ -21627,6 +21685,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a65b54357a3caa44b954de966112305d, type: 3}
m_Name:
m_EditorClassIdentifier:
currentEquipment: {fileID: 0}
_expectStepIndex: 0
--- !u!1 &2143385980
GameObject:

View File

@ -5,7 +5,9 @@ using UnityEngine;
public class GameMangner_TSQ : MonoBehaviour
{
public static GameMangner_TSQ instance;
public ModbusDeviceController modbusDeviceController;
/// <summary>
/// 三个场景中第一人称
/// </summary>
@ -27,4 +29,23 @@ public class GameMangner_TSQ : MonoBehaviour
{
Init();
}
public void bengStartOrStop(bool ison)
{
modbusDeviceController.ControlRedPipe(ison);
modbusDeviceController.ControlGreenPipe(ison);
modbusDeviceController.ControlBluePipe(ison);
modbusDeviceController.ControlTank(ison);
modbusDeviceController.ControlLighting(ison);
}
public void FengJiStartOrStop(bool ison)
{
modbusDeviceController.ControlAirCompressor(ison);
modbusDeviceController.ControlCabinetLight(ison);
modbusDeviceController.ControlRedPipeFlow(ison);
modbusDeviceController.ControlTankUp(ison);
modbusDeviceController.ControlBluePipeFlow(ison);
modbusDeviceController.ControlSecondTankLight(ison);
modbusDeviceController.ControlSecondTurbine(ison);
}
}

View File

@ -611,6 +611,7 @@ public class EquipmentSimulationView : UIView
variables.Get<Button>("启动运行-泵").onClick.AddListener(delegate
{
Stepbools[7] = true;
GameMangner_TSQ.instance.bengStartOrStop(true);
SBStartOperation("开启泵成功");
UIView.Get<EquipmentSimulationView>().variables.Get<Text>("泵机Text").text = "关闭泵";
UIView.Get<EquipmentSimulationView>().variables.Get<Button>("启动运行-泵").Deactivate();
@ -621,6 +622,7 @@ public class EquipmentSimulationView : UIView
{
Stepbools[7] = false;
SBStartOperation("关闭泵成功");
GameMangner_TSQ.instance.bengStartOrStop(false);
UIView.Get<EquipmentSimulationView>().variables.Get<Text>("泵机Text").text = "开启泵";
UIView.Get<EquipmentSimulationView>().variables.Get<Button>("启动运行-泵").Activate();
UIView.Get<EquipmentSimulationView>().variables.Get<Button>("停止运行-泵").Deactivate();
@ -630,6 +632,7 @@ public class EquipmentSimulationView : UIView
{
Stepbools[8] = true;
SBStartOperation("开启空压机成功");
GameMangner_TSQ.instance.FengJiStartOrStop(true);
UIView.Get<EquipmentSimulationView>().variables.Get<Text>("空压机主机Text").text = "关闭空压机";
UIView.Get<EquipmentSimulationView>().variables.Get<Button>("启动运行-空压机").Deactivate();
UIView.Get<EquipmentSimulationView>().variables.Get<Button>("停止运行-空压机").Activate();
@ -639,6 +642,7 @@ public class EquipmentSimulationView : UIView
{
Stepbools[8] = false;
SBStartOperation("关闭空压机成功");
GameMangner_TSQ.instance.FengJiStartOrStop(false);
UIView.Get<EquipmentSimulationView>().variables.Get<Text>("空压机主机Text").text = "开启空压机";
UIView.Get<EquipmentSimulationView>().variables.Get<Button>("启动运行-空压机").Activate();
UIView.Get<EquipmentSimulationView>().variables.Get<Button>("停止运行-空压机").Deactivate();