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
faa65200
Commit
faa65200
authored
Apr 08, 2023
by
潘梓豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新巡检
parent
a75c82c6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62596 additions
and
0 deletions
+62596
-0
ValManager.cs
Assets/Scripts/ValManager.cs
+176
-0
ValManager.cs.meta
Assets/Scripts/ValManager.cs.meta
+11
-0
WHF-TestScene.unity
Assets/WHF-TestScene.unity
+61455
-0
WHF-TestScene.unity.meta
Assets/WHF-TestScene.unity.meta
+7
-0
ValScene.unity
Assets/_Scenes/ValScene.unity
+940
-0
ValScene.unity.meta
Assets/_Scenes/ValScene.unity.meta
+7
-0
No files found.
Assets/Scripts/ValManager.cs
0 → 100644
View file @
faa65200
using
LitJson
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
UnityEngine
;
using
UnityEngine.Networking
;
using
UnityEngine.SceneManagement
;
using
TMPro
;
using
UnityEngine.UI
;
public
class
ValManager
:
MonoBehaviour
{
public
TMP_Text
text
;
public
Button
login_btn
;
IEnumerator
Start
()
{
//string path = "C:\\Users\\Zeus_PC\\Desktop\\testval\\ReqData.json";
//string path = "ReqData.json";
login_btn
.
onClick
.
AddListener
(()=>{
/*using (var rq = UnityWebRequest.Get(arg[4] + "/getRobotCode?productionid=" + arg[2] + "&code=" + code))
{
rq.SetRequestHeader("Authorization", arg[1]);
yield return rq.SendWebRequest();
if (string.IsNullOrEmpty(rq.error))
{
Dictionary<string, object> jsonData = JsonMapper.ToObject<Dictionary<string, object>>(rq.downloadHandler.text);
string scene = (string)jsonData.Where(S => S.Key == "LoadScene").Select(S => S.Value).First();
if (scene != null && !scene.Equals(""))
{
text.text = "验证成功,正在跳转。。。";
SceneManager.LoadScene(scene);
//删除参数配置文件
//File.Delete(path);
}
else
{
text.text = "没有注册码,请先注册";
}
}
}*/
});
string
[]
arg
=
Environment
.
GetCommandLineArgs
();
if
(
arg
!=
null
&&
arg
.
Length
>
1
)
{
valInit
(
arg
);
//重定向项目路径
Directory
.
SetCurrentDirectory
(
arg
[
3
]);
//获取本机code
string
code
=
getMNum
();
//通过机器码code、产品id判读是否已校验
using
(
var
rq
=
UnityWebRequest
.
Get
(
arg
[
4
]
+
"/getRobotCode?productionid="
+
arg
[
2
]
+
"&code="
+
code
))
{
rq
.
SetRequestHeader
(
"Authorization"
,
arg
[
1
]);
yield
return
rq
.
SendWebRequest
();
if
(
string
.
IsNullOrEmpty
(
rq
.
error
))
{
Dictionary
<
string
,
object
>
jsonData
=
JsonMapper
.
ToObject
<
Dictionary
<
string
,
object
>>(
rq
.
downloadHandler
.
text
);
string
scene
=
(
string
)
jsonData
.
Where
(
S
=>
S
.
Key
==
"LoadScene"
).
Select
(
S
=>
S
.
Value
).
First
();
if
(
scene
!=
null
&&
!
scene
.
Equals
(
""
))
{
text
.
text
=
"验证成功,正在跳转。。。"
;
SceneManager
.
LoadScene
(
scene
);
//删除参数配置文件
//File.Delete(path);
}
else
{
text
.
text
=
"没有注册码,请先注册"
;
}
}
}
}
else
{
text
.
text
=
"丢失参数文件,请在ZeusHub中启动软件"
;
}
yield
return
null
;
}
public
bool
valInit
(
string
[]
arg
)
{
if
(
arg
[
4
]
==
""
||
arg
[
4
].
Equals
(
""
))
{
text
.
text
=
"缺少验证地址,请联系技术人员"
;
return
false
;
}
else
if
(
arg
[
2
]
==
""
||
arg
[
2
].
Equals
(
""
))
{
text
.
text
=
"缺少产品id,请联系技术人员"
;
return
false
;
}
else
{
return
true
;
}
}
//生成机器码
public
static
string
getMNum
()
{
//string strNum = getCpu() + GetDiskVolumeSerialNumber();//获得24位Cpu和硬盘序列号
string
strNum
=
SystemInfo
.
deviceUniqueIdentifier
;
string
strMNum
=
strNum
.
Substring
(
0
,
24
);
//从生成的字符串中取出前24个字符做为机器码
return
strMNum
;
}
public
static
int
[]
intCode
=
new
int
[
127
];
//存储密钥
public
static
int
[]
intNumber
=
new
int
[
25
];
//存机器码的Ascii值
public
static
char
[]
Charcode
=
new
char
[
25
];
//存储机器码字
public
static
void
setIntCode
()
//给数组赋值小于10的数
{
for
(
int
i
=
1
;
i
<
intCode
.
Length
;
i
++)
{
intCode
[
i
]
=
i
%
9
;
}
}
public
static
string
getRNum
()
{
setIntCode
();
//初始化127位数组
for
(
int
i
=
1
;
i
<
Charcode
.
Length
;
i
++)
//把机器码存入数组中
{
Charcode
[
i
]
=
Convert
.
ToChar
(
getMNum
().
Substring
(
i
-
1
,
1
));
}
for
(
int
j
=
1
;
j
<
intNumber
.
Length
;
j
++)
//把字符的ASCII值存入一个整数组中。
{
intNumber
[
j
]
=
intCode
[
Convert
.
ToInt32
(
Charcode
[
j
])]
+
Convert
.
ToInt32
(
Charcode
[
j
]);
}
string
strAsciiName
=
""
;
//用于存储注册码
for
(
int
j
=
1
;
j
<
intNumber
.
Length
;
j
++)
{
if
(
intNumber
[
j
]
>=
48
&&
intNumber
[
j
]
<=
57
)
//判断字符ASCII值是否0-9之间
{
strAsciiName
+=
Convert
.
ToChar
(
intNumber
[
j
]).
ToString
();
}
else
if
(
intNumber
[
j
]
>=
65
&&
intNumber
[
j
]
<=
90
)
//判断字符ASCII值是否A-Z之间
{
strAsciiName
+=
Convert
.
ToChar
(
intNumber
[
j
]).
ToString
();
}
else
if
(
intNumber
[
j
]
>=
97
&&
intNumber
[
j
]
<=
122
)
//判断字符ASCII值是否a-z之间
{
strAsciiName
+=
Convert
.
ToChar
(
intNumber
[
j
]).
ToString
();
}
else
//判断字符ASCII值不在以上范围内
{
if
(
intNumber
[
j
]
>
122
)
//判断字符ASCII值是否大于z
{
strAsciiName
+=
Convert
.
ToChar
(
intNumber
[
j
]
-
10
).
ToString
();
}
else
{
strAsciiName
+=
Convert
.
ToChar
(
intNumber
[
j
]
-
9
).
ToString
();
}
}
}
return
strAsciiName
;
}
public
void
click_btn
()
{
System
.
Diagnostics
.
Process
.
GetCurrentProcess
().
Kill
();
}
}
Assets/Scripts/ValManager.cs.meta
0 → 100644
View file @
faa65200
fileFormatVersion: 2
guid: 3645793e778ee4d43b802f5ff4b5939d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/WHF-TestScene.unity
0 → 100644
View file @
faa65200
This diff is collapsed.
Click to expand it.
Assets/WHF-TestScene.unity.meta
0 → 100644
View file @
faa65200
fileFormatVersion: 2
guid: 2fb874f12e51eac468ce370c58911cbf
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/_Scenes/ValScene.unity
0 → 100644
View file @
faa65200
This diff is collapsed.
Click to expand it.
Assets/_Scenes/ValScene.unity.meta
0 → 100644
View file @
faa65200
fileFormatVersion: 2
guid: 91b55352dd7722f489a1e4115408540f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
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