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
94321db6
Commit
94321db6
authored
Aug 19, 2024
by
杨泽宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
7b50434b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
7 deletions
+29
-7
LoginManager.cs
Assets/Scripts/Components/AGV/LoginManager.cs
+27
-7
1_Main.unity
Assets/_Scenes/1_Main.unity
+2
-0
No files found.
Assets/Scripts/Components/AGV/LoginManager.cs
View file @
94321db6
...
...
@@ -26,6 +26,8 @@ public class LoginManager : MonoBehaviour
public
FaultEventData
Failure
;
public
float
angle
;
public
bool
IsLine1
;
private
void
Awake
()
{
OnReceiveMsg
.
AddListener
(
_getData
);
...
...
@@ -154,9 +156,17 @@ public class LoginManager : MonoBehaviour
public
void
SaveInputFields
()
{
// 使用 PlayerPrefs 保存输入字段数据
PlayerPrefs
.
SetString
(
"productionlineID"
,
productionlineID
.
text
);
if
(
IsLine1
)
{
PlayerPrefs
.
SetString
(
"productionlineID1"
,
productionlineID
.
text
);
PlayerPrefs
.
SetString
(
"lineID1"
,
lineID
.
text
);
}
else
{
PlayerPrefs
.
SetString
(
"productionlineID2"
,
productionlineID
.
text
);
PlayerPrefs
.
SetString
(
"lineID2"
,
lineID
.
text
);
}
PlayerPrefs
.
SetString
(
"faultInterface"
,
faultInterface
.
text
);
PlayerPrefs
.
SetString
(
"lineID"
,
lineID
.
text
);
PlayerPrefs
.
Save
();
// 确保数据被保存
Debug
.
Log
(
"Input fields saved to PlayerPrefs."
);
...
...
@@ -165,11 +175,19 @@ public class LoginManager : MonoBehaviour
public
void
LoadInputFields
()
{
// 使用 PlayerPrefs 加载输入字段数据
if
(
PlayerPrefs
.
HasKey
(
"productionlineID"
))
if
(
PlayerPrefs
.
HasKey
(
"productionlineID
1
"
))
{
productionlineID
.
text
=
PlayerPrefs
.
GetString
(
"productionlineID"
);
if
(
IsLine1
)
{
productionlineID
.
text
=
PlayerPrefs
.
GetString
(
"productionlineID1"
);
lineID
.
text
=
PlayerPrefs
.
GetString
(
"lineID1"
);
}
else
{
productionlineID
.
text
=
PlayerPrefs
.
GetString
(
"productionlineID2"
);
lineID
.
text
=
PlayerPrefs
.
GetString
(
"lineID2"
);
}
faultInterface
.
text
=
PlayerPrefs
.
GetString
(
"faultInterface"
);
lineID
.
text
=
PlayerPrefs
.
GetString
(
"lineID"
);
Debug
.
Log
(
"Input fields loaded from PlayerPrefs."
);
}
...
...
@@ -183,9 +201,11 @@ public class LoginManager : MonoBehaviour
[System.Serializable]
public
class
InputFieldData
{
public
string
productionlineID
;
public
string
productionlineID1
;
public
string
productionlineID2
;
public
string
faultInterface
;
public
string
lineID
;
public
string
lineID1
;
public
string
lineID2
;
}
// 定义机器人位置数据结构
...
...
Assets/_Scenes/1_Main.unity
View file @
94321db6
...
...
@@ -23252,6 +23252,7 @@ MonoBehaviour:
message:
data: []
angle: 0
IsLine1: 0
--- !u!114 &346303892
MonoBehaviour:
m_ObjectHideFlags: 0
...
...
@@ -32406,6 +32407,7 @@ MonoBehaviour:
message:
data: []
angle: 0
IsLine1: 1
--- !u!114 &560685329
MonoBehaviour:
m_ObjectHideFlags: 0
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