Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
山
山西检定流水线数字孪生项目
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨泽宇
山西检定流水线数字孪生项目
Commits
7b50434b
Commit
7b50434b
authored
Aug 19, 2024
by
杨泽宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
0d6be671
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
27 deletions
+40
-27
LoginManager.cs
Assets/Scripts/Components/AGV/LoginManager.cs
+19
-26
1_Main.unity
Assets/_Scenes/1_Main.unity
+21
-1
No files found.
Assets/Scripts/Components/AGV/LoginManager.cs
View file @
7b50434b
...
...
@@ -32,11 +32,11 @@ public class LoginManager : MonoBehaviour
LoadInputFields
();
// 在 Awake 中加载输入字段
}
private
void
Start
()
{
StartCoroutine
(
GetPositionData
());
StartCoroutine
(
FaultInformation
());
}
//
private void Start()
//
{
//
StartCoroutine(GetPositionData());
//
StartCoroutine(FaultInformation());
//
}
public
void
StartLogin
()
{
...
...
@@ -153,36 +153,29 @@ public class LoginManager : MonoBehaviour
public
void
SaveInputFields
()
{
InputFieldData
data
=
new
InputFieldData
{
productionlineID
=
productionlineID
.
text
,
faultInterface
=
faultInterface
.
text
,
lineID
=
lineID
.
text
};
string
json
=
JsonUtility
.
ToJson
(
data
);
File
.
WriteAllText
(
Application
.
persistentDataPath
+
"/inputFields.json"
,
json
);
Debug
.
Log
(
"Input fields saved to JSON."
);
// 使用 PlayerPrefs 保存输入字段数据
PlayerPrefs
.
SetString
(
"productionlineID"
,
productionlineID
.
text
);
PlayerPrefs
.
SetString
(
"faultInterface"
,
faultInterface
.
text
);
PlayerPrefs
.
SetString
(
"lineID"
,
lineID
.
text
);
PlayerPrefs
.
Save
();
// 确保数据被保存
Debug
.
Log
(
"Input fields saved to PlayerPrefs."
);
}
public
void
LoadInputFields
()
{
string
path
=
Application
.
persistentDataPath
+
"/inputFields.json"
;
if
(
File
.
Exists
(
path
))
// 使用 PlayerPrefs 加载输入字段数据
if
(
PlayerPrefs
.
HasKey
(
"productionlineID"
))
{
string
json
=
File
.
ReadAllText
(
path
);
InputFieldData
data
=
JsonUtility
.
FromJson
<
InputFieldData
>(
json
);
productionlineID
.
text
=
data
.
productionlineID
;
faultInterface
.
text
=
data
.
faultInterface
;
lineID
.
text
=
data
.
lineID
;
productionlineID
.
text
=
PlayerPrefs
.
GetString
(
"productionlineID"
);
faultInterface
.
text
=
PlayerPrefs
.
GetString
(
"faultInterface"
);
lineID
.
text
=
PlayerPrefs
.
GetString
(
"lineID"
);
Debug
.
Log
(
"Input fields loaded from
JSON
."
);
Debug
.
Log
(
"Input fields loaded from
PlayerPrefs
."
);
}
else
{
Debug
.
Log
(
"No saved input fields data found."
);
Debug
.
Log
(
"No saved input fields data found
in PlayerPrefs
."
);
}
}
}
...
...
Assets/_Scenes/1_Main.unity
View file @
7b50434b
...
...
@@ -41471,13 +41471,23 @@ PrefabInstance:
- target: {fileID: 1408881909033764182, guid: ed32f55596f4ce64e96fe9f95c481cc0,
type: 3}
propertyPath: m_Text
value:
http://192.168.1.10:8093/maintenance/jqrznxj/stt/getRobotRunState?lineId=AD6E344FAEEB2EA9E053A3001E0A371D
value:
objectReference: {fileID: 0}
- target: {fileID: 1510060172603623300, guid: ed32f55596f4ce64e96fe9f95c481cc0,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2685396657262849258, guid: ed32f55596f4ce64e96fe9f95c481cc0,
type: 3}
propertyPath: m_Text
value:
objectReference: {fileID: 0}
- target: {fileID: 2685396657295982406, guid: ed32f55596f4ce64e96fe9f95c481cc0,
type: 3}
propertyPath: m_Text
value:
objectReference: {fileID: 0}
- target: {fileID: 2685396657494966388, guid: ed32f55596f4ce64e96fe9f95c481cc0,
type: 3}
propertyPath: m_AnchorMax.y
...
...
@@ -41548,6 +41558,16 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: -558
objectReference: {fileID: 0}
- target: {fileID: 2685396658203011285, guid: ed32f55596f4ce64e96fe9f95c481cc0,
type: 3}
propertyPath: m_Text
value:
objectReference: {fileID: 0}
- target: {fileID: 2685396658211044749, guid: ed32f55596f4ce64e96fe9f95c481cc0,
type: 3}
propertyPath: m_Text
value:
objectReference: {fileID: 0}
- target: {fileID: 2685396658312707601, guid: ed32f55596f4ce64e96fe9f95c481cc0,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment