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
Xu Chenxi
ygopro2
Commits
76406cf5
Commit
76406cf5
authored
Apr 13, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'deck_code' into Android
parents
c56628f5
85d0d79b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
123 additions
and
5 deletions
+123
-5
Assets/SibylSystem/Program.cs
Assets/SibylSystem/Program.cs
+1
-1
Assets/SibylSystem/SelectDeck/selectDeck.cs
Assets/SibylSystem/SelectDeck/selectDeck.cs
+47
-2
Assets/SibylSystem/deckManager/DeckManager.cs
Assets/SibylSystem/deckManager/DeckManager.cs
+73
-0
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/Program.cs
View file @
76406cf5
...
...
@@ -1068,7 +1068,7 @@ public class Program : MonoBehaviour
_padScroll
=
0
;
}
GUI
.
Label
(
new
Rect
(
10
,
5
,
200
,
200
),
"[Ver 1.034.9-
7
] "
+
"FPS: "
+
m_FPS
);
GUI
.
Label
(
new
Rect
(
10
,
5
,
200
,
200
),
"[Ver 1.034.9-
8
] "
+
"FPS: "
+
m_FPS
);
}
void
Update
()
...
...
Assets/SibylSystem/SelectDeck/selectDeck.cs
View file @
76406cf5
...
...
@@ -3,8 +3,8 @@ using System.Collections.Generic;
using
System.IO
;
using
System.Text.RegularExpressions
;
using
UnityEngine
;
using
YGOSharp.OCGWrapper.Enums
;
using
YGOSharp.OCGWrapper.Enums
;
public
class
selectDeck
:
WindowServantSP
{
...
...
@@ -187,6 +187,41 @@ public class selectDeck : WindowServantSP
RMSshow_none
(
InterString
.
Get
(
"非法输入!请检查输入的文件名。"
));
}
}
if
(
hashCode
==
"onCode"
)
{
if
(
result
[
0
].
value
!=
""
)
{
try
{
YGOSharp
.
Deck
deck
;
if
(
DeckManager
.
FromBase64toCodedDeck
(
result
[
0
].
value
,
out
deck
))
{
RMSshow_none
(
InterString
.
Get
(
"卡组代码无效。"
));
return
;
}
string
value
=
"#created by ygopro2\r\n#main\r\n"
;
for
(
int
i
=
0
;
i
<
deck
.
Main
.
Count
;
i
++)
{
value
+=
deck
.
Main
[
i
].
ToString
()
+
"\r\n"
;
}
value
+=
"#extra\r\n"
;
for
(
int
i
=
0
;
i
<
deck
.
Extra
.
Count
;
i
++)
{
value
+=
deck
.
Extra
[
i
].
ToString
()
+
"\r\n"
;
}
value
+=
"!side\r\n"
;
for
(
int
i
=
0
;
i
<
deck
.
Side
.
Count
;
i
++)
{
value
+=
deck
.
Side
[
i
].
ToString
()
+
"\r\n"
;
}
System
.
IO
.
File
.
WriteAllText
(
"deck/"
+
superScrollView
.
selectedString
+
".ydk"
,
value
,
System
.
Text
.
Encoding
.
UTF8
);
printSelected
();
}
catch
(
Exception
)
{
RMSshow_none
(
InterString
.
Get
(
"卡组代码无效。"
));
}
}
}
}
void
onNew
()
...
...
@@ -255,6 +290,7 @@ public class selectDeck : WindowServantSP
string
path
=
"deck/"
+
superScrollView
.
selectedString
+
".ydk"
;
if
(
File
.
Exists
(
path
))
{
/*
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
System.Diagnostics.Process.Start("notepad.exe", path);
#elif UNITY_STANDALONE_OSX //Mac OS X
...
...
@@ -266,6 +302,15 @@ public class selectDeck : WindowServantSP
jo.Call("openFile", Program.ANDROID_GAME_PATH + path);
//#elif UNITY_IPHONE //iPhone
#endif
*/
YGOSharp
.
Deck
deck
;
DeckManager
.
FromYDKtoCodedDeck
(
path
,
out
deck
);
string
default_string
;
if
(
deck
.
Main
.
Count
>
0
||
deck
.
Extra
.
Count
>
0
||
deck
.
Side
.
Count
>
0
)
default_string
=
DeckManager
.
convertDeckToBase64
(
deck
);
else
default_string
=
""
;
RMSshow_input
(
"onCode"
,
InterString
.
Get
(
"卡组代码"
),
default_string
);
}
}
...
...
Assets/SibylSystem/deckManager/DeckManager.cs
View file @
76406cf5
...
...
@@ -1530,6 +1530,79 @@ public class DeckManager : ServantWithCardDescription
}
}
public
static
bool
FromBase64toCodedDeck
(
string
base64
,
out
YGOSharp
.
Deck
deck
)
{
deck
=
new
YGOSharp
.
Deck
();
bool
res
=
true
;
try
{
byte
[]
buffer
=
Convert
.
FromBase64String
(
base64
);
int
offset
=
0
;
int
mainc
=
BitConverter
.
ToInt32
(
buffer
,
offset
);
offset
+=
4
;
int
sidec
=
BitConverter
.
ToInt32
(
buffer
,
offset
);
offset
+=
4
;
for
(
int
i
=
0
;
i
<
mainc
;
++
i
)
{
int
code
=
BitConverter
.
ToInt32
(
buffer
,
offset
);
offset
+=
4
;
if
(
code
>
100
)
{
YGOSharp
.
Card
card
=
YGOSharp
.
CardsManager
.
Get
(
code
);
if
(
card
.
Id
>
0
&&
card
.
IsExtraCard
())
{
deck
.
Extra
.
Add
(
code
);
deck
.
Deck_O
.
Extra
.
Add
(
code
);
}
else
{
deck
.
Main
.
Add
(
code
);
deck
.
Deck_O
.
Main
.
Add
(
code
);
}
}
}
for
(
int
i
=
0
;
i
<
sidec
;
++
i
)
{
int
code
=
BitConverter
.
ToInt32
(
buffer
,
offset
);
offset
+=
4
;
if
(
code
>
100
)
{
deck
.
Side
.
Add
(
code
);
deck
.
Deck_O
.
Side
.
Add
(
code
);
}
}
}
catch
(
Exception
e
)
{
res
=
false
;
}
return
res
;
}
public
static
string
convertDeckToBase64
(
YGOSharp
.
Deck
deck
)
{
List
<
byte
>
array_list
=
new
List
<
byte
>();
writeInt32ToList
(
array_list
,
deck
.
Main
.
Count
+
deck
.
Extra
.
Count
);
writeInt32ToList
(
array_list
,
deck
.
Side
.
Count
);
for
(
int
i
=
0
;
i
<
deck
.
Main
.
Count
;
i
++)
{
writeInt32ToList
(
array_list
,
deck
.
Main
[
i
]);
}
for
(
int
i
=
0
;
i
<
deck
.
Extra
.
Count
;
i
++)
{
writeInt32ToList
(
array_list
,
deck
.
Extra
[
i
]);
}
for
(
int
i
=
0
;
i
<
deck
.
Side
.
Count
;
i
++)
{
writeInt32ToList
(
array_list
,
deck
.
Side
[
i
]);
}
byte
[]
buffer
=
array_list
.
ToArray
();
return
Convert
.
ToBase64String
(
buffer
);
}
private
static
void
writeInt32ToList
(
List
<
byte
>
array_list
,
int
value
)
{
byte
[]
int_buffer
=
BitConverter
.
GetBytes
(
value
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
array_list
.
Add
(
int_buffer
[
i
]);
}
}
public
YGOSharp
.
Deck
getRealDeck
()
{
if
(
canSave
)
...
...
Assets/transUI/prefab/trans_menu.prefab
View file @
76406cf5
...
...
@@ -1415,7 +1415,7 @@ MonoBehaviour:
keepCrispWhenShrunk
:
1
mTrueTypeFont
:
{
fileID
:
12800000
,
guid
:
f775853fdfd14bb47934543e95c3bae3
,
type
:
3
}
mFont
:
{
fileID
:
0
}
mText
:
KoishiPro2 iOS 1.034.9-
7
mText
:
KoishiPro2 iOS 1.034.9-
8
mFontSize
:
18
mFontStyle
:
0
mAlignment
:
1
...
...
ProjectSettings/ProjectSettings.asset
View file @
76406cf5
...
...
@@ -123,7 +123,7 @@ PlayerSettings:
16:10:
1
16:9:
1
Others
:
1
bundleVersion
:
1.034.9-
7
bundleVersion
:
1.034.9-
8
preloadedAssets
:
[]
metroInputSource
:
0
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