Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
MDPro2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangbiao
MDPro2
Commits
978a4a43
Commit
978a4a43
authored
Jun 17, 2023
by
perfectdicky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check update version
parent
d3976df6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
23 deletions
+18
-23
Assets/SibylSystem/Menu/Menu.cs
Assets/SibylSystem/Menu/Menu.cs
+18
-18
Assets/SibylSystem/Program.cs
Assets/SibylSystem/Program.cs
+0
-5
No files found.
Assets/SibylSystem/Menu/Menu.cs
View file @
978a4a43
...
...
@@ -26,9 +26,10 @@ public class Menu : WindowServantSP
UIHelper
.
registEvent
(
gameObject
,
"online_"
,
onClickOnline
);
UIHelper
.
registEvent
(
gameObject
,
"replay_"
,
onClickReplay
);
UIHelper
.
registEvent
(
gameObject
,
"single_"
,
onClickPizzle
);
//UIHelper.registEvent(gameObject, "ai_", Program.gugugu);
UIHelper
.
registEvent
(
gameObject
,
"ai_"
,
onClickAI
);
UIHelper
.
registEvent
(
gameObject
,
"exit_"
,
onClickExit
);
//MDPRO2 update
UIHelper
.
getByName
<
UILabel
>(
gameObject
,
"version_"
).
text
=
"1.7.4"
;
Program
.
I
().
StartCoroutine
(
checkUpdate
());
}
...
...
@@ -41,21 +42,19 @@ public class Menu : WindowServantSP
private
IEnumerator
checkUpdate
()
{
yield
return
new
WaitForSeconds
(
1
);
var
verFile
=
File
.
ReadAllLines
(
"config/ver.txt"
,
Encoding
.
UTF8
);
if
(
verFile
.
Length
==
0
)
// 放一个空的 ver.txt 以关闭自动更新功能
yield
break
;
if
(
verFile
.
Length
!=
2
||
!
Uri
.
IsWellFormedUriString
(
verFile
[
1
],
UriKind
.
Absolute
))
{
Program
.
PrintToChat
(
InterString
.
Get
(
"YGOPro2 自动更新:[ff5555]未设置更新服务器,无法检查更新。[-]@n请从官网重新下载安装完整版以获得更新。"
));
yield
break
;
}
var
ver
=
verFile
[
0
];
var
url
=
verFile
[
1
];
var
www
=
UnityWebRequest
.
Get
(
url
);
// var verFile = File.ReadAllLines("config/ver.txt", Encoding.UTF8);
// if (verFile.Length != 2 || !Uri.IsWellFormedUriString(verFile[1], UriKind.Absolute))
// {
// Program.PrintToChat(InterString.Get("MDPro2 自动更新:[ff5555]未设置更新服务器,无法检查更新。[-]"));
// yield break;
// }
// var ver = verFile[0];
// var url = verFile[1];
var
ver
=
UIHelper
.
getByName
<
UILabel
>(
gameObject
,
"version_"
).
text
;
var
www
=
UnityWebRequest
.
Get
(
"https://code.mycard.moe/sherry_chaos/MDPro2_Version/-/raw/master/ver.txt"
);
www
.
SetRequestHeader
(
"Cache-Control"
,
"max-age=0, no-cache, no-store"
);
www
.
SetRequestHeader
(
"Pragma"
,
"no-cache"
);
yield
return
www
.
Send
();
yield
return
www
.
Send
WebRequest
();
try
{
var
result
=
www
.
downloadHandler
.
text
;
...
...
@@ -63,17 +62,18 @@ public class Menu : WindowServantSP
var
mats
=
lines
[
0
].
Split
(
":.:"
);
if
(
ver
!=
mats
[
0
])
{
upurl
=
mats
[
1
];
for
(
var
i
=
1
;
i
<
lines
.
Length
;
i
++)
uptxt
+=
lines
[
i
]
+
"\n"
;
Program
.
PrintToChat
(
InterString
.
Get
(
"MDPro2 不是最新版本 更新!更新!更新![-]"
));
// upurl = mats[1];
// for (var i = 1; i < lines.Length; i++) uptxt += lines[i] + "\n";
}
else
{
Program
.
PrintToChat
(
InterString
.
Get
(
"
YGO
Pro2 自动更新:[55ff55]当前已是最新版本。[-]"
));
Program
.
PrintToChat
(
InterString
.
Get
(
"
MD
Pro2 自动更新:[55ff55]当前已是最新版本。[-]"
));
}
}
catch
(
Exception
e
)
{
Program
.
PrintToChat
(
InterString
.
Get
(
"
YGO
Pro2 自动更新:[ff5555]检查更新失败![-]"
));
Program
.
PrintToChat
(
InterString
.
Get
(
"
MD
Pro2 自动更新:[ff5555]检查更新失败![-]"
));
}
}
...
...
Assets/SibylSystem/Program.cs
View file @
978a4a43
...
...
@@ -8,11 +8,6 @@ using YGOSharp;
public
class
Program
:
MonoBehaviour
{
public
static
void
gugugu
()
{
PrintToChat
(
InterString
.
Get
(
"非常抱歉,因为技术原因,此功能暂时无法使用。请关注官方网站获取更多消息。"
));
}
#
region
Resources
[
Header
(
"场景"
)]
...
...
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