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
871fad6b
Commit
871fad6b
authored
Mar 06, 2025
by
潘梓豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
449ed984
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
68 deletions
+77
-68
LoginManager.cs
Assets/Scripts/Components/AGV/LoginManager.cs
+74
-65
EditorBuildSettings.asset
ProjectSettings/EditorBuildSettings.asset
+2
-2
ProjectSettings.asset
ProjectSettings/ProjectSettings.asset
+1
-1
No files found.
Assets/Scripts/Components/AGV/LoginManager.cs
View file @
871fad6b
...
...
@@ -2,7 +2,6 @@ using System.Collections;
using
UnityEngine.Networking
;
using
UnityEngine
;
using
TMPro
;
using
System.IO
;
using
LitJson
;
using
System
;
...
...
@@ -87,9 +86,11 @@ public class LoginManager : MonoBehaviour
{
while
(
true
)
{
if
(!
String
.
IsNullOrEmpty
(
productionlineID
.
text
))
{
using
(
UnityWebRequest
request
=
UnityWebRequest
.
Get
(
productionlineID
.
text
))
{
Debug
.
Log
(
productionlineID
.
text
);
// 设置请求头
request
.
SetRequestHeader
(
"Content-Type"
,
"application/json"
);
...
...
@@ -107,12 +108,12 @@ public class LoginManager : MonoBehaviour
Debug
.
Log
(
"Response: "
+
responseJson
);
// 使用 JsonUtility 解析 JSON 数据
positionData
=
JsonUtility
.
FromJson
<
RobotPositionData
>(
responseJson
);
positionData
=
JsonMapper
.
ToObject
<
RobotPositionData
>(
responseJson
);
OnReceiveMsg
.
Invoke
(
positionData
,
"RobotPositionData"
);
IsDataLoaded
=
true
;
}
}
}
yield
return
new
WaitForSeconds
(
1
);
}
}
...
...
@@ -122,6 +123,8 @@ public class LoginManager : MonoBehaviour
string
jsonData
=
"{\"lineId\":\""
+
lineID
.
text
+
"\"}"
;
while
(
true
)
{
if
(!
String
.
IsNullOrEmpty
(
faultInterface
.
text
))
{
using
(
UnityWebRequest
request
=
UnityWebRequest
.
PostWwwForm
(
faultInterface
.
text
,
jsonData
))
{
...
...
@@ -145,7 +148,7 @@ public class LoginManager : MonoBehaviour
string
responseJson
=
request
.
downloadHandler
.
text
;
// 使用 JsonUtility 解析 JSON 数据
faultData
=
JsonUtility
.
FromJson
<
FaultEventData
>(
responseJson
);
faultData
=
JsonMapper
.
ToObject
<
FaultEventData
>(
responseJson
);
// 检查是否成功拿到数据
...
...
@@ -160,6 +163,7 @@ public class LoginManager : MonoBehaviour
}
}
}
}
yield
return
new
WaitForSeconds
(
5f
);
}
}
...
...
@@ -167,6 +171,8 @@ public class LoginManager : MonoBehaviour
private
IEnumerator
GetThreeModelSensorData
()
{
while
(
true
)
{
if
(!
String
.
IsNullOrEmpty
(
post_url
.
text
))
{
using
(
UnityWebRequest
request
=
UnityWebRequest
.
Get
(
post_url
.
text
+
"?lineId="
+
lineID
.
text
))
{
...
...
@@ -191,6 +197,7 @@ public class LoginManager : MonoBehaviour
}
}
}
}
yield
return
new
WaitForSeconds
(
1f
);
}
}
...
...
@@ -268,11 +275,13 @@ public class LoginManager : MonoBehaviour
rq
.
SetRequestHeader
(
"Access-Control-Allow-Origin"
,
"*"
);
rq
.
SetRequestHeader
(
"Accept"
,
"*"
);
yield
return
rq
.
SendWebRequest
();
if
(
string
.
IsNullOrEmpty
(
rq
.
error
))
{
try
{
inputFieldData
=
JsonUtility
.
FromJson
<
InputFieldData
>(
rq
.
downloadHandler
.
text
);
inputFieldData
=
JsonMapper
.
ToObject
<
InputFieldData
>(
rq
.
downloadHandler
.
text
);
Debug
.
Log
(
rq
.
downloadHandler
.
text
);
if
(
IsLine1
)
{
productionlineID
.
text
=
inputFieldData
.
productionlineID1
;
...
...
ProjectSettings/EditorBuildSettings.asset
View file @
871fad6b
...
...
@@ -5,7 +5,7 @@ EditorBuildSettings:
m_ObjectHideFlags
:
0
serializedVersion
:
2
m_Scenes
:
-
enabled
:
1
-
enabled
:
0
path
:
Assets/_Scenes/1_Main.unity
guid
:
a1193329f89803b4f8a14f6c0b15d2c1
-
enabled
:
0
...
...
@@ -14,7 +14,7 @@ EditorBuildSettings:
-
enabled
:
0
path
:
Assets/_Scenes/3_Main.unity
guid
:
20c0c67e1155d7340be70873c2eb30f1
-
enabled
:
0
-
enabled
:
1
path
:
Assets/_Scenes/4_Main.unity
guid
:
da74b35adf3770040b51552fc0cb9a98
-
enabled
:
0
...
...
ProjectSettings/ProjectSettings.asset
View file @
871fad6b
...
...
@@ -653,7 +653,7 @@ PlayerSettings:
webGLDebugSymbols
:
0
webGLEmscriptenArgs
:
webGLModulesDirectory
:
webGLTemplate
:
APPLICATION:Default
webGLTemplate
:
PROJECT:ZeusWebGL
webGLAnalyzeBuildSize
:
0
webGLUseEmbeddedResources
:
0
webGLCompressionFormat
:
2
...
...
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