Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
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
syntax_j
mycard
Commits
a287617c
Commit
a287617c
authored
Mar 23, 2012
by
zh99998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本0.4.5,ygocore调用方式改变。
parent
720c746d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
101 deletions
+25
-101
Rakefile
Rakefile
+1
-1
lib/scene_title.rb
lib/scene_title.rb
+1
-0
lib/update.rb
lib/update.rb
+2
-2
lib/ygocore/game.rb
lib/ygocore/game.rb
+21
-98
No files found.
Rakefile
View file @
a287617c
...
...
@@ -24,7 +24,7 @@ end
spec
=
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
'mycard'
s
.
version
=
'0.4.
4
'
s
.
version
=
'0.4.
5
'
s
.
extra_rdoc_files
=
[
'README.txt'
,
'LICENSE.txt'
]
s
.
summary
=
'a card game'
s
.
description
=
s
.
summary
...
...
lib/scene_title.rb
View file @
a287617c
...
...
@@ -5,6 +5,7 @@
# �title
#==============================================================================
require_relative
'scene'
require_relative
'widget_inputbox'
require_relative
'window_title'
BGM
=
'title.ogg'
class
Scene_Title
<
Scene
...
...
lib/update.rb
View file @
a287617c
require
'open-uri'
module
Update
Version
=
'0.4.
4
'
URL
=
'http://card.touhou.cc/mycard/update.json?version=0.4.
4
'
Version
=
'0.4.
5
'
URL
=
'http://card.touhou.cc/mycard/update.json?version=0.4.
5
'
class
<<
self
attr_reader
:thumbnails
,
:images
,
:status
def
start
...
...
lib/ygocore/game.rb
View file @
a287617c
...
...
@@ -3,18 +3,6 @@ load 'lib/ygocore/window_login.rb'
class
Ygocore
<
Game
attr_reader
:password
@@config
=
YAML
.
load_file
(
"lib/ygocore/server.yml"
)
WM_LBUTTONDOWN
=
0x201
WM_LBUTTONUP
=
0x202
VK_CONTROL
=
0x11
VK_A
=
0x41
VK_V
=
0x56
VK_TAB
=
0x09
VK_RETURN
=
0x0D
KEYEVENTF_KEYUP
=
0x02
CF_UNICODETEXT
=
13
;
GMEM_DDESHARE
=
0x2000
;
def
initialize
super
load
'lib/ygocore/event.rb'
...
...
@@ -132,16 +120,23 @@ class Ygocore < Game
@@config
[
'port'
]
end
def
self
.
run_ygocore
(
option
)
path
=
'ygocore/gframe.exe'
Widget_Msgbox
.
new
(
"ygocore"
,
"正在启动ygocore"
)
$scene
.
draw
#写入配置文件并运行ygocore
Dir
.
chdir
(
File
.
dirname
(
path
))
do
$log
.
info
(
'当前目录'
){
Dir
.
pwd
.
encode
(
"UTF-8"
)}
if
option
.
is_a?
(
Room
)
case
option
when
Room
room
=
option
room_name
=
if
room
.
pvp?
and
room
.
match?
"PM#"
+
room
.
name
elsif
room
.
pvp?
"P#"
+
room
.
name
elsif
room
.
match?
"M#"
+
room
.
name
else
room
.
name
end
system_conf
=
{}
begin
IO
.
readlines
(
'system.conf'
).
each
do
|
line
|
...
...
@@ -160,91 +155,19 @@ class Ygocore < Game
system_conf
[
'nickname'
]
=
"
#{
$game
.
user
.
name
}#{
"$"
unless
$game
.
password
.
nil?
or
$game
.
password
.
empty?
}#{
$game
.
password
}
"
system_conf
[
'lastip'
]
=
$game
.
server
system_conf
[
'lastport'
]
=
$game
.
port
.
to_s
system_conf
[
'roompass'
]
=
room_name
open
(
'system.conf'
,
'w'
)
{
|
file
|
file
.
write
system_conf
.
collect
{
|
key
,
value
|
"
#{
key
}
=
#{
value
}
"
}.
join
(
"
\n
"
)}
args
=
'-j'
when
:replay
args
=
'-r'
when
:deck
args
=
'-d'
end
$log
.
info
(
'ygocore路径'
)
{
path
}
IO
.
popen
(
'gframe.exe'
)
#执行外部程序....有中文的情况下貌似只能这样了orz
end
#初始化windows API
require
'win32api'
@@FindWindow
||=
Win32API
.
new
(
"user32"
,
"FindWindow"
,
"pp"
,
"l"
)
@@SendMessage
||=
Win32API
.
new
(
'user32'
,
'SendMessage'
,
[
"L"
,
"L"
,
"L"
,
"L"
],
"L"
)
@@SetForegroundWindow
||=
Win32API
.
new
(
'user32'
,
'SetForegroundWindow'
,
'l'
,
'v'
)
@@keybd_event
||=
Win32API
.
new
(
'user32'
,
'keybd_event'
,
'llll'
,
'v'
)
@@lstrcpy
||=
Win32API
.
new
(
'kernel32'
,
'lstrcpyW'
,
[
'I'
,
'P'
],
'P'
);
@@lstrlen
||=
Win32API
.
new
(
'kernel32'
,
'lstrlenW'
,
[
'P'
],
'I'
);
@@OpenClipboard
||=
Win32API
.
new
(
'user32'
,
'OpenClipboard'
,
[
'I'
],
'I'
);
@@CloseClipboard
||=
Win32API
.
new
(
'user32'
,
'CloseClipboard'
,
[],
'I'
);
@@EmptyClipboard
||=
Win32API
.
new
(
'user32'
,
'EmptyClipboard'
,
[],
'I'
);
@@SetClipboardData
||=
Win32API
.
new
(
'user32'
,
'SetClipboardData'
,
[
'I'
,
'I'
],
'I'
);
@@GlobalAlloc
||=
Win32API
.
new
(
'kernel32'
,
'GlobalAlloc'
,
[
'I'
,
'I'
],
'I'
);
@@GlobalLock
||=
Win32API
.
new
(
'kernel32'
,
'GlobalLock'
,
[
'I'
],
'I'
);
@@GlobalUnlock
||=
Win32API
.
new
(
'kernel32'
,
'GlobalUnlock'
,
[
'I'
],
'I'
);
#获取句柄
hwnd
=
nil
50
.
times
do
if
(
hwnd
=
@@FindWindow
.
call
(
'CIrrDeviceWin32'
,
nil
))
!=
0
break
else
sleep
0.1
end
end
if
hwnd
and
hwnd
!=
0
#操作ygocore进入主机
$log
.
info
(
'ygocore参数'
)
{
args
}
IO
.
popen
(
"gframe.exe
#{
args
}
"
)
WM
.
iconify
if
option
.
is_a?
Room
@@SendMessage
.
call
(
hwnd
,
WM_LBUTTONDOWN
,
0
,
MAKELPARAM
(
507
,
242
))
@@SendMessage
.
call
(
hwnd
,
WM_LBUTTONUP
,
0
,
MAKELPARAM
(
507
,
242
))
sleep
0.5
if
@@OpenClipboard
.
Call
(
0
)
!=
0
room
=
option
room_name
=
if
room
.
pvp?
and
room
.
match?
"PM#"
+
room
.
name
elsif
room
.
pvp?
"P#"
+
room
.
name
elsif
room
.
match?
"M#"
+
room
.
name
else
room
.
name
end
$log
.
info
(
'加入房间'
){
room_name
}
@@EmptyClipboard
.
Call
();
len
=
room_name
.
encode
(
"UTF-16LE"
).
bytesize
#p len=@@lstrlen.call(room_name.encode("UTF-16LE"))#
$log
.
info
(
'房间名长度'
){
len
.
to_s
}
hmem
=
@@GlobalAlloc
.
Call
(
GMEM_DDESHARE
,
len
+
2
);
pmem
=
@@GlobalLock
.
Call
(
hmem
);
@@lstrcpy
.
Call
(
pmem
,
room_name
.
encode
(
"UTF-16LE"
));
@@SetClipboardData
.
Call
(
CF_UNICODETEXT
,
hmem
);
@@GlobalUnlock
.
Call
(
hmem
);
@@CloseClipboard
.
Call
;
@@SetForegroundWindow
.
call
(
hwnd
)
@@SendMessage
.
call
(
hwnd
,
WM_LBUTTONDOWN
,
0
,
MAKELPARAM
(
380
,
500
))
@@SendMessage
.
call
(
hwnd
,
WM_LBUTTONUP
,
0
,
MAKELPARAM
(
380
,
500
))
@@keybd_event
.
call
(
VK_CONTROL
,
0
,
0
,
0
)
@@keybd_event
.
call
(
VK_A
,
0
,
0
,
0
)
#全选以避免密码处已经有字的情况,正常情况下应该无用
@@keybd_event
.
call
(
VK_A
,
0
,
KEYEVENTF_KEYUP
,
0
)
@@keybd_event
.
call
(
VK_V
,
0
,
0
,
0
)
@@keybd_event
.
call
(
VK_V
,
0
,
KEYEVENTF_KEYUP
,
0
)
@@keybd_event
.
call
(
VK_CONTROL
,
0
,
KEYEVENTF_KEYUP
,
0
)
@@keybd_event
.
call
(
VK_TAB
,
0
,
0
,
0
)
@@keybd_event
.
call
(
VK_TAB
,
0
,
KEYEVENTF_KEYUP
,
0
)
@@keybd_event
.
call
(
VK_RETURN
,
0
,
0
,
0
)
@@keybd_event
.
call
(
VK_RETURN
,
0
,
KEYEVENTF_KEYUP
,
0
)
Widget_Msgbox
.
destroy
else
Widget_Msgbox
.
new
(
"加入房间"
,
'填写房间名失败 请把房间名手动填写到房间密码处'
,
:ok
=>
"确定"
)
end
else
@@SendMessage
.
call
(
hwnd
,
WM_LBUTTONDOWN
,
0
,
MAKELPARAM
(
507
,
389
))
@@SendMessage
.
call
(
hwnd
,
WM_LBUTTONUP
,
0
,
MAKELPARAM
(
507
,
389
))
Widget_Msgbox
.
destroy
end
else
Widget_Msgbox
.
new
(
"加入房间"
,
'ygocore运行失败'
,
:ok
=>
"确定"
)
end
Widget_Msgbox
.
destroy
end
private
def
connect
...
...
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