Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOProUnity_V2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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
MyCard
YGOProUnity_V2
Commits
00f83095
Commit
00f83095
authored
May 09, 2020
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add puzzle mode back, update script reader
parent
fa16a4e5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
18 deletions
+47
-18
Assets/SibylSystem/Menu/Menu.cs
Assets/SibylSystem/Menu/Menu.cs
+1
-1
Assets/SibylSystem/MonoHelpers/UIHelper.cs
Assets/SibylSystem/MonoHelpers/UIHelper.cs
+0
-9
Assets/SibylSystem/coreWrapper.cs
Assets/SibylSystem/coreWrapper.cs
+23
-4
Assets/SibylSystem/precy.cs
Assets/SibylSystem/precy.cs
+23
-4
No files found.
Assets/SibylSystem/Menu/Menu.cs
View file @
00f83095
...
...
@@ -18,7 +18,7 @@ public class Menu : WindowServantSP
UIHelper
.
registEvent
(
gameObject
,
"deck_"
,
onClickSelectDeck
);
UIHelper
.
registEvent
(
gameObject
,
"online_"
,
onClickOnline
);
UIHelper
.
registEvent
(
gameObject
,
"replay_"
,
onClickReplay
);
UIHelper
.
registEvent
(
gameObject
,
"single_"
,
Program
.
gugugu
);
UIHelper
.
registEvent
(
gameObject
,
"single_"
,
onClickPizzle
);
UIHelper
.
registEvent
(
gameObject
,
"ai_"
,
Program
.
gugugu
);
UIHelper
.
registEvent
(
gameObject
,
"exit_"
,
onClickExit
);
//(new Thread(up)).Start();
...
...
Assets/SibylSystem/MonoHelpers/UIHelper.cs
View file @
00f83095
...
...
@@ -235,15 +235,6 @@ public static class UIHelper
return
result
;
}
internal
static
IntPtr
getPtrString
(
string
path
)
{
IntPtr
ptrFileName
=
Marshal
.
AllocHGlobal
(
path
.
Length
+
1
);
byte
[]
s
=
System
.
Text
.
Encoding
.
UTF8
.
GetBytes
(
path
);
Marshal
.
Copy
(
s
,
0
,
ptrFileName
,
s
.
Length
);
return
ptrFileName
;
}
public
static
T
getByName
<
T
>(
GameObject
father
,
string
name
)
where
T
:
Component
{
T
return_value
=
null
;
...
...
Assets/SibylSystem/coreWrapper.cs
View file @
00f83095
...
...
@@ -213,6 +213,11 @@ namespace Percy
public
int
LScale
;
public
int
RScale
;
}
public
struct
ScriptData
{
public
IntPtr
buffer
;
public
int
len
;
}
unsafe
static
class
dll
{
[
UnmanagedFunctionPointer
(
CallingConvention
.
Cdecl
)]
...
...
@@ -233,6 +238,18 @@ namespace Percy
card_handler
=
h
;
set_card_reader
(
OnCardReader
);
}
static
smallYgopro
.
scriptHandler
script_handler
;
public
static
void
set_script_api
(
smallYgopro
.
scriptHandler
h
)
{
script_handler
=
h
;
set_script_reader
(
OnScriptHandler
);
}
private
static
IntPtr
OnScriptHandler
(
string
scriptName
,
int
*
len
)
{
ScriptData
ret
=
script_handler
(
scriptName
);
*
len
=
ret
.
len
;
return
ret
.
buffer
;
}
static
smallYgopro
.
chatHandler
chat_handler
;
public
static
void
set_chat_api
(
smallYgopro
.
chatHandler
h
)
{
...
...
@@ -302,6 +319,7 @@ namespace Percy
//public
public
delegate
CardData
cardHandler
(
long
code
);
public
delegate
ScriptData
scriptHandler
(
string
name
);
public
delegate
void
chatHandler
(
string
str
);
chatHandler
cast
;
...
...
@@ -315,10 +333,11 @@ namespace Percy
}
}
public
smallYgopro
(
Action
<
byte
[
]>
HowToSendBufferToPlayer
,
cardHandler
HowToReadCard
,
chatHandler
HowToShowLog
)
public
smallYgopro
(
Action
<
byte
[
]>
HowToSendBufferToPlayer
,
cardHandler
HowToReadCard
,
scriptHandler
HowToReadScript
,
chatHandler
HowToShowLog
)
{
sendToPlayer
=
HowToSendBufferToPlayer
;
dll
.
set_card_api
(
HowToReadCard
);
dll
.
set_script_api
(
HowToReadScript
);
dll
.
set_chat_api
(
HowToShowLog
);
cast
=
HowToShowLog
;
Random
ran
=
new
Random
(
Environment
.
TickCount
);
...
...
@@ -341,7 +360,7 @@ namespace Percy
var
reult
=
0
;
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
reult
=
dll
.
preload_script
(
duel
,
getPtrString
(
path
),
path
.
Length
);
reult
=
dll
.
preload_script
(
duel
,
getPtrString
(
path
),
0
);
if
(
reult
>
0
)
{
break
;
...
...
@@ -366,7 +385,7 @@ namespace Percy
var
reult
=
0
;
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
reult
=
dll
.
preload_script
(
duel
,
getPtrString
(
aiScript
),
aiScript
.
Length
);
reult
=
dll
.
preload_script
(
duel
,
getPtrString
(
aiScript
),
0
);
if
(
reult
>
0
)
{
break
;
...
...
@@ -423,8 +442,8 @@ namespace Percy
private
IntPtr
getPtrString
(
string
path
)
{
IntPtr
ptrFileName
=
Marshal
.
AllocHGlobal
(
path
.
Length
+
1
);
byte
[]
s
=
System
.
Text
.
Encoding
.
UTF8
.
GetBytes
(
path
);
IntPtr
ptrFileName
=
Marshal
.
AllocHGlobal
(
s
.
Length
+
1
);
Marshal
.
Copy
(
s
,
0
,
ptrFileName
,
s
.
Length
);
return
ptrFileName
;
}
...
...
Assets/SibylSystem/precy.cs
View file @
00f83095
...
...
@@ -15,10 +15,13 @@ public class PrecyOcg
static
string
error
=
"Error occurred."
;
static
IntPtr
_buffer
;
public
PrecyOcg
()
{
_buffer
=
Marshal
.
AllocHGlobal
(
1024
*
256
);
// 256 KiB
error
=
InterString
.
Get
(
"Error occurred! @nError occurred! @nError occurred! @nError occurred! @nError occurred! @nError occurred! @nYGOPro1旧版的录像崩溃了!您可以选择使用永不崩溃的新版录像。"
);
ygopro
=
new
Percy
.
smallYgopro
(
receiveHandler
,
cardHandler
,
chatHandler
);
ygopro
=
new
Percy
.
smallYgopro
(
receiveHandler
,
cardHandler
,
scriptHandler
,
chatHandler
);
ygopro
.
m_log
=
(
a
)
=>
{
Program
.
DEBUGLOG
(
a
);
};
}
...
...
@@ -41,14 +44,13 @@ public class PrecyOcg
if
(
Program
.
I
().
ocgcore
.
isShowed
==
false
)
{
Program
.
I
().
room
.
mode
=
0
;
Program
.
I
().
ocgcore
.
MasterRule
=
3
;
godMode
=
true
;
prepareOcgcore
();
Program
.
I
().
ocgcore
.
isFirst
=
true
;
Program
.
I
().
ocgcore
.
returnServant
=
Program
.
I
().
puzzleMode
;
if
(!
ygopro
.
startPuzzle
(
path
))
{
Program
.
I
().
cardDescription
.
RMSshow_none
(
InterString
.
Get
(
"游戏内部出错,请重试
,文件名中不能包含中文
。"
));
Program
.
I
().
cardDescription
.
RMSshow_none
(
InterString
.
Get
(
"游戏内部出错,请重试。"
));
return
;
}
else
...
...
@@ -73,7 +75,7 @@ public class PrecyOcg
Program
.
I
().
ocgcore
.
returnServant
=
Program
.
I
().
aiRoom
;
if
(!
ygopro
.
startAI
(
playerDek
,
aiDeck
,
aiScript
,
playerGo
,
unrand
,
life
,
god
,
rule
))
{
Program
.
I
().
cardDescription
.
RMSshow_none
(
InterString
.
Get
(
"游戏内部出错,请重试
,文件名中不能包含中文
。"
));
Program
.
I
().
cardDescription
.
RMSshow_none
(
InterString
.
Get
(
"游戏内部出错,请重试。"
));
return
;
}
else
...
...
@@ -126,6 +128,23 @@ public class PrecyOcg
return
retuvalue
;
}
Percy
.
ScriptData
scriptHandler
(
String
filename
)
{
//string filename = GetScriptFilename(scriptName);
Percy
.
ScriptData
ret
;
if
(!
File
.
Exists
(
filename
))
{
ret
.
buffer
=
IntPtr
.
Zero
;
ret
.
len
=
0
;
return
ret
;
}
byte
[]
content
=
File
.
ReadAllBytes
(
filename
);
Marshal
.
Copy
(
content
,
0
,
_buffer
,
content
.
Length
);
ret
.
buffer
=
_buffer
;
ret
.
len
=
content
.
Length
;
return
ret
;
}
void
chatHandler
(
string
result
)
{
BinaryMaster
p
=
new
BinaryMaster
();
...
...
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