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
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
nanahira
ygopro2
Commits
68976359
Commit
68976359
authored
May 14, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format json object classes
parent
79d6fca6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
Assets/SibylSystem/selectServer/MyCardHelper.cs
Assets/SibylSystem/selectServer/MyCardHelper.cs
+13
-14
No files found.
Assets/SibylSystem/selectServer/MyCardHelper.cs
View file @
68976359
...
@@ -4,14 +4,8 @@ using System.Text;
...
@@ -4,14 +4,8 @@ using System.Text;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
public
class
JSONObject
{
[
Serializable
]
public
string
Stringify
()
public
class
LoginUserObject
{
{
return
JsonUtility
.
ToJson
(
this
);
}
}
public
class
LoginUserObject
:
JSONObject
{
public
int
id
;
public
int
id
;
public
string
username
;
public
string
username
;
public
string
name
;
public
string
name
;
...
@@ -27,13 +21,15 @@ public class LoginUserObject : JSONObject {
...
@@ -27,13 +21,15 @@ public class LoginUserObject : JSONObject {
public
string
updated_at
;
public
string
updated_at
;
public
string
token
;
public
string
token
;
}
}
public
class
LoginObject
:
JSONObject
{
[
Serializable
]
public
class
LoginObject
{
public
LoginUserObject
user
;
public
LoginUserObject
user
;
public
string
token
;
public
string
token
;
public
string
message
;
}
}
public
class
LoginRequest
:
JSONObject
{
[
Serializable
]
public
class
LoginRequest
{
public
string
account
;
public
string
account
;
public
string
password
;
public
string
password
;
public
LoginRequest
(
string
user
,
string
pass
)
{
public
LoginRequest
(
string
user
,
string
pass
)
{
...
@@ -42,7 +38,8 @@ public class LoginRequest : JSONObject {
...
@@ -42,7 +38,8 @@ public class LoginRequest : JSONObject {
}
}
}
}
public
class
MatchObject
:
JSONObject
{
[
Serializable
]
public
class
MatchObject
{
public
string
address
;
public
string
address
;
public
int
port
;
public
int
port
;
public
string
password
;
public
string
password
;
...
@@ -53,8 +50,10 @@ public class MyCardHelper {
...
@@ -53,8 +50,10 @@ public class MyCardHelper {
int
userid
=
-
1
;
int
userid
=
-
1
;
public
bool
login
(
string
name
,
string
password
,
out
string
fail_reason
)
{
public
bool
login
(
string
name
,
string
password
,
out
string
fail_reason
)
{
try
{
try
{
LoginRequest
data
=
new
LoginRequest
(
name
,
password
);
LoginRequest
data
=
new
LoginRequest
();
string
data_str
=
data
.
Stringify
();
data
.
account
=
username
;
data
.
password
=
password
;
string
data_str
=
JsonUtility
.
ToJson
(
data
);
Dictionary
<
String
,
String
>
header_list
=
new
Dictionary
<
String
,
String
>();
Dictionary
<
String
,
String
>
header_list
=
new
Dictionary
<
String
,
String
>();
header_list
.
Add
(
"Content-Type"
,
"application/json"
);
header_list
.
Add
(
"Content-Type"
,
"application/json"
);
byte
[]
data_bytes
=
Encoding
.
UTF8
.
GetBytes
(
data_str
);
byte
[]
data_bytes
=
Encoding
.
UTF8
.
GetBytes
(
data_str
);
...
...
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