Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro2
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
mercury233
ygopro2
Commits
2f0b067b
Commit
2f0b067b
authored
May 08, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve MyCard match
parent
3d535df2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
33 deletions
+33
-33
Assets/SibylSystem/MyCard/MyCard.cs
Assets/SibylSystem/MyCard/MyCard.cs
+16
-16
Assets/SibylSystem/MyCard/MyCardHelper.cs
Assets/SibylSystem/MyCard/MyCardHelper.cs
+14
-14
Assets/SibylSystem/Program.cs
Assets/SibylSystem/Program.cs
+1
-1
Assets/transUI/prefab/trans_menu.prefab
Assets/transUI/prefab/trans_menu.prefab
+1
-1
ProjectSettings/ProjectSettings.asset
ProjectSettings/ProjectSettings.asset
+1
-1
No files found.
Assets/SibylSystem/MyCard/MyCard.cs
View file @
2f0b067b
...
@@ -8,11 +8,11 @@ public class MyCard : WindowServantSP
...
@@ -8,11 +8,11 @@ public class MyCard : WindowServantSP
{
{
public
bool
isMatching
=
false
;
public
bool
isMatching
=
false
;
public
bool
isRequesting
=
false
;
public
bool
isRequesting
=
false
;
const
string
mycard
_ip
=
"tiramisu.mycard.moe"
;
const
string
mycard
TiramisuAddress
=
"tiramisu.mycard.moe"
;
const
string
athletic_p
ort
=
"8911"
;
const
string
mycardTiramisuAthleticP
ort
=
"8911"
;
const
string
entertain_p
ort
=
"7911"
;
const
string
mycardTiramisuEntertainP
ort
=
"7911"
;
Thread
requestThread
=
null
;
Thread
requestThread
=
null
;
MyCardHelper
h
elper
;
MyCardHelper
mycardH
elper
;
UIInput
inputUsername
;
UIInput
inputUsername
;
UIInput
inputPsw
;
UIInput
inputPsw
;
...
@@ -26,7 +26,7 @@ public class MyCard : WindowServantSP
...
@@ -26,7 +26,7 @@ public class MyCard : WindowServantSP
UIHelper
.
registEvent
(
gameObject
,
"community_"
,
onClickCommunity
);
UIHelper
.
registEvent
(
gameObject
,
"community_"
,
onClickCommunity
);
inputUsername
=
UIHelper
.
getByName
<
UIInput
>(
gameObject
,
"name_"
);
inputUsername
=
UIHelper
.
getByName
<
UIInput
>(
gameObject
,
"name_"
);
inputPsw
=
UIHelper
.
getByName
<
UIInput
>(
gameObject
,
"psw_"
);
inputPsw
=
UIHelper
.
getByName
<
UIInput
>(
gameObject
,
"psw_"
);
h
elper
=
new
MyCardHelper
();
mycardH
elper
=
new
MyCardHelper
();
loadUser
();
loadUser
();
SetActiveFalse
();
SetActiveFalse
();
}
}
...
@@ -74,27 +74,27 @@ public class MyCard : WindowServantSP
...
@@ -74,27 +74,27 @@ public class MyCard : WindowServantSP
Application
.
OpenURL
(
"https://ygobbs.com/"
);
Application
.
OpenURL
(
"https://ygobbs.com/"
);
}
}
void
matchThread
(
string
username
,
string
password
,
string
match
_t
ype
)
{
void
matchThread
(
string
username
,
string
password
,
string
match
T
ype
)
{
try
{
try
{
Program
.
PrintToChat
(
InterString
.
Get
(
"正在登录至MyCard。"
));
Program
.
PrintToChat
(
InterString
.
Get
(
"正在登录至MyCard。"
));
string
fail
_r
eason
=
""
;
string
fail
R
eason
=
""
;
bool
res
=
helper
.
login
(
username
,
password
,
out
fail_r
eason
);
bool
res
=
mycardHelper
.
login
(
username
,
password
,
out
failR
eason
);
if
(!
res
)
{
if
(!
res
)
{
Program
.
PrintToChat
(
InterString
.
Get
(
"MyCard登录失败。原因: "
)
+
fail
_r
eason
);
Program
.
PrintToChat
(
InterString
.
Get
(
"MyCard登录失败。原因: "
)
+
fail
R
eason
);
isRequesting
=
false
;
isRequesting
=
false
;
return
;
return
;
}
}
Program
.
PrintToChat
(
InterString
.
Get
(
"正在请求匹配。匹配类型: "
)
+
match
_t
ype
);
Program
.
PrintToChat
(
InterString
.
Get
(
"正在请求匹配。匹配类型: "
)
+
match
T
ype
);
string
pswString
=
helper
.
requestMatch
(
match_type
,
out
fail_r
eason
);
MatchResultObject
matchResultObject
=
mycardHelper
.
requestMatch
(
matchType
,
out
failR
eason
);
if
(
pswString
==
null
)
{
if
(
matchResultObject
==
null
)
{
Program
.
PrintToChat
(
InterString
.
Get
(
"匹配请求失败。原因: "
)
+
fail
_r
eason
);
Program
.
PrintToChat
(
InterString
.
Get
(
"匹配请求失败。原因: "
)
+
fail
R
eason
);
isRequesting
=
false
;
isRequesting
=
false
;
return
;
return
;
}
}
Program
.
PrintToChat
(
InterString
.
Get
(
"匹配成功。正在进入房间。"
));
Program
.
PrintToChat
(
InterString
.
Get
(
"匹配成功。正在进入房间。"
));
Program
.
I
().
mycard
.
isMatching
=
true
;
Program
.
I
().
mycard
.
isMatching
=
true
;
(
new
Thread
(()
=>
{
TcpHelper
.
join
(
m
ycard_ip
,
username
,
match_type
==
"athletic"
?
athletic_port
:
entertain_port
,
pswString
,
"0x"
+
String
.
Format
(
"{0:X}"
,
Config
.
ClientVersion
));
})).
Start
();
(
new
Thread
(()
=>
{
TcpHelper
.
join
(
m
atchResultObject
.
address
,
mycardHelper
.
username
,
matchResultObject
.
port
,
matchResultObject
.
password
,
"0x"
+
String
.
Format
(
"{0:X}"
,
Config
.
ClientVersion
));
})).
Start
();
isRequesting
=
false
;
isRequesting
=
false
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
e
.
GetType
()
!=
typeof
(
ThreadAbortException
))
{
if
(
e
.
GetType
()
!=
typeof
(
ThreadAbortException
))
{
...
@@ -106,7 +106,7 @@ public class MyCard : WindowServantSP
...
@@ -106,7 +106,7 @@ public class MyCard : WindowServantSP
}
}
}
}
void
startMatch
(
string
match
_t
ype
)
{
void
startMatch
(
string
match
T
ype
)
{
string
username
=
inputUsername
.
value
;
string
username
=
inputUsername
.
value
;
string
password
=
inputPsw
.
value
;
string
password
=
inputPsw
.
value
;
if
(
username
==
""
||
password
==
""
)
if
(
username
==
""
||
password
==
""
)
...
@@ -123,7 +123,7 @@ public class MyCard : WindowServantSP
...
@@ -123,7 +123,7 @@ public class MyCard : WindowServantSP
Program
.
PrintToChat
(
InterString
.
Get
(
"已开始匹配。"
));
Program
.
PrintToChat
(
InterString
.
Get
(
"已开始匹配。"
));
requestThread
=
new
Thread
(()
=>
requestThread
=
new
Thread
(()
=>
{
{
matchThread
(
username
,
password
,
match
_t
ype
);
matchThread
(
username
,
password
,
match
T
ype
);
});
});
requestThread
.
Start
();
requestThread
.
Start
();
}
}
...
...
Assets/SibylSystem/MyCard/MyCardHelper.cs
View file @
2f0b067b
...
@@ -49,16 +49,16 @@ public class LoginRequest {
...
@@ -49,16 +49,16 @@ public class LoginRequest {
}
}
[
Serializable
]
[
Serializable
]
public
class
MatchObject
{
public
class
Match
Result
Object
{
public
string
address
;
public
string
address
;
public
int
port
;
public
int
port
;
public
string
password
;
public
string
password
;
}
}
public
class
MyCardHelper
{
public
class
MyCardHelper
{
string
username
=
null
;
public
string
username
=
null
;
int
userid
=
-
1
;
int
userid
=
-
1
;
public
bool
login
(
string
name
,
string
password
,
out
string
fail
_r
eason
)
{
public
bool
login
(
string
name
,
string
password
,
out
string
fail
R
eason
)
{
try
{
try
{
LoginRequest
data
=
new
LoginRequest
();
LoginRequest
data
=
new
LoginRequest
();
data
.
account
=
name
;
data
.
account
=
name
;
...
@@ -71,7 +71,7 @@ public class MyCardHelper {
...
@@ -71,7 +71,7 @@ public class MyCardHelper {
while
(!
www
.
isDone
)
{
while
(!
www
.
isDone
)
{
if
(
Application
.
internetReachability
==
NetworkReachability
.
NotReachable
||
!
string
.
IsNullOrEmpty
(
www
.
error
))
if
(
Application
.
internetReachability
==
NetworkReachability
.
NotReachable
||
!
string
.
IsNullOrEmpty
(
www
.
error
))
{
{
fail
_r
eason
=
www
.
error
;
fail
R
eason
=
www
.
error
;
return
false
;
return
false
;
}
}
}
}
...
@@ -80,17 +80,17 @@ public class MyCardHelper {
...
@@ -80,17 +80,17 @@ public class MyCardHelper {
username
=
result_object
.
user
.
username
;
username
=
result_object
.
user
.
username
;
userid
=
result_object
.
user
.
id
;
userid
=
result_object
.
user
.
id
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
fail
_r
eason
=
e
.
Message
;
fail
R
eason
=
e
.
Message
;
return
false
;
return
false
;
}
}
fail
_r
eason
=
null
;
fail
R
eason
=
null
;
return
true
;
return
true
;
}
}
public
string
requestMatch
(
string
match_type
,
out
string
fail_r
eason
)
{
public
MatchResultObject
requestMatch
(
string
matchType
,
out
string
failR
eason
)
{
string
re
t
;
MatchResultObject
matchResultObjec
t
;
if
(
username
==
null
||
userid
<
0
)
{
if
(
username
==
null
||
userid
<
0
)
{
fail
_r
eason
=
"Not logged in"
;
fail
R
eason
=
"Not logged in"
;
return
null
;
return
null
;
}
}
try
{
try
{
...
@@ -99,22 +99,22 @@ public class MyCardHelper {
...
@@ -99,22 +99,22 @@ public class MyCardHelper {
header_list
.
Add
(
"Authorization"
,
auth_str
);
header_list
.
Add
(
"Authorization"
,
auth_str
);
header_list
.
Add
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
header_list
.
Add
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
byte
[]
meta
=
new
byte
[
1
];
byte
[]
meta
=
new
byte
[
1
];
WWW
www
=
new
WWW
(
"https://api.m
ycard.moe/ygopro/match?locale=zh-CN&arena="
+
match_t
ype
,
meta
,
header_list
);
WWW
www
=
new
WWW
(
"https://api.m
oecube.com/ygopro/match?locale=zh-CN&arena="
+
matchT
ype
,
meta
,
header_list
);
while
(!
www
.
isDone
)
{
while
(!
www
.
isDone
)
{
if
(
Application
.
internetReachability
==
NetworkReachability
.
NotReachable
||
!
string
.
IsNullOrEmpty
(
www
.
error
))
if
(
Application
.
internetReachability
==
NetworkReachability
.
NotReachable
||
!
string
.
IsNullOrEmpty
(
www
.
error
))
{
{
fail
_r
eason
=
www
.
error
;
fail
R
eason
=
www
.
error
;
return
null
;
return
null
;
}
}
}
}
string
result
=
www
.
text
;
string
result
=
www
.
text
;
MatchObject
result_object
=
JsonUtility
.
FromJson
<
Match
Object
>(
result
);
matchResultObject
=
JsonUtility
.
FromJson
<
MatchResult
Object
>(
result
);
ret
=
result_object
.
password
;
ret
=
result_object
.
password
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
fail
_r
eason
=
e
.
Message
;
fail
R
eason
=
e
.
Message
;
return
null
;
return
null
;
}
}
fail
_r
eason
=
null
;
fail
R
eason
=
null
;
return
ret
;
return
ret
;
}
}
...
...
Assets/SibylSystem/Program.cs
View file @
2f0b067b
...
@@ -1116,7 +1116,7 @@ public class Program : MonoBehaviour
...
@@ -1116,7 +1116,7 @@ public class Program : MonoBehaviour
string
FPS
=
m_FPS
.
ToString
();
string
FPS
=
m_FPS
.
ToString
();
try
{
FPS
=
FPS
.
Substring
(
0
,
5
);
}
catch
{}
try
{
FPS
=
FPS
.
Substring
(
0
,
5
);
}
catch
{}
GUI
.
Label
(
new
Rect
(
10
,
5
,
200
,
200
),
"[Ver 1.035.2-Nekoyuki] "
+
"FPS: "
+
FPS
);
GUI
.
Label
(
new
Rect
(
10
,
5
,
200
,
200
),
"[Ver 1.035.2-Nekoyuki
w
] "
+
"FPS: "
+
FPS
);
}
}
void
Update
()
void
Update
()
...
...
Assets/transUI/prefab/trans_menu.prefab
View file @
2f0b067b
...
@@ -1417,7 +1417,7 @@ MonoBehaviour:
...
@@ -1417,7 +1417,7 @@ MonoBehaviour:
keepCrispWhenShrunk
:
1
keepCrispWhenShrunk
:
1
mTrueTypeFont
:
{
fileID
:
12800000
,
guid
:
f775853fdfd14bb47934543e95c3bae3
,
type
:
3
}
mTrueTypeFont
:
{
fileID
:
12800000
,
guid
:
f775853fdfd14bb47934543e95c3bae3
,
type
:
3
}
mFont
:
{
fileID
:
0
}
mFont
:
{
fileID
:
0
}
mText
:
KoishiPro2 iOS 1.035.2-Nekoyuki
mText
:
KoishiPro2 iOS 1.035.2-Nekoyuki
w
mFontSize
:
18
mFontSize
:
18
mFontStyle
:
0
mFontStyle
:
0
mAlignment
:
1
mAlignment
:
1
...
...
ProjectSettings/ProjectSettings.asset
View file @
2f0b067b
...
@@ -123,7 +123,7 @@ PlayerSettings:
...
@@ -123,7 +123,7 @@ PlayerSettings:
16:10:
1
16:10:
1
16:9:
1
16:9:
1
Others
:
1
Others
:
1
bundleVersion
:
1.035.2-Nekoyuki
bundleVersion
:
1.035.2-Nekoyuki
w
preloadedAssets
:
[]
preloadedAssets
:
[]
metroInputSource
:
0
metroInputSource
:
0
m_HolographicPauseOnTrackingLoss
:
1
m_HolographicPauseOnTrackingLoss
:
1
...
...
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