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
db69541c
Commit
db69541c
authored
May 27, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
URL protocol加强
parent
5f588e30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
11 deletions
+46
-11
lib/quickstart.rb
lib/quickstart.rb
+27
-9
lib/ygocore/game.rb
lib/ygocore/game.rb
+19
-2
No files found.
lib/quickstart.rb
View file @
db69541c
require
'json'
require_relative
'game'
require_relative
'game'
require_relative
'user'
require_relative
'user'
require_relative
'room'
require_relative
'room'
require_relative
'ygocore/game'
require_relative
'ygocore/game'
$game
=
Ygocore
.
new
$game
=
Ygocore
.
new
uri
=
ARGV
.
first
[
9
,
ARGV
.
first
.
size
-
9
]
args
=
JSON
.
parse
ARGV
.
first
[
7
,
ARGV
.
first
.
size
-
7
].
unpack
(
'm'
).
first
case
uri
$game
.
user
=
User
.
new
(
args
[
"username"
].
to_sym
,
args
[
"username"
])
when
/^(.*)\:(.*)\@(.*)\:(\d+)\/(.*)$/
$game
.
password
=
args
[
"password"
]
$game
.
user
=
User
.
new
(
$1
.
to_sym
,
$1
)
$game
.
server
=
args
[
'server_ip'
]
$game
.
password
=
$2
$game
.
port
=
args
[
'server_port'
]
$game
.
server
=
$3
Ygocore
.
run_ygocore
Room
.
new
(
0
,
args
[
'room_name'
]),
true
$game
.
port
=
$4
.
to_i
\ No newline at end of file
Ygocore
.
run_ygocore
Room
.
new
(
0
,
$5
),
true
when
/^(.*\.yrp)$/
require
'open-uri'
open
(
"http://"
+
$1
,
'rb'
)
{
|
src
|
Dir
.
mkdir
(
"replay"
)
unless
File
.
directory?
(
"replay"
)
open
(
'replay/'
+
File
.
basename
(
$1
),
'wb'
){
|
dest
|
dest
.
write
src
.
read
}
}
Ygocore
.
replay
(
'replay/'
+
File
.
basename
(
$1
),
true
)
when
/^(.*\.ydk)$/
require
'open-uri'
open
(
"http://"
+
$1
,
'rb'
)
{
|
src
|
Dir
.
mkdir
(
'ygocore/deck'
)
unless
File
.
directory?
(
"ygocore/deck"
)
open
(
'ygocore/deck/'
+
File
.
basename
(
$1
),
'wb'
){
|
dest
|
dest
.
write
src
.
read
}
}
Ygocore
.
run_ygocore
(
File
.
basename
(
$1
,
'.ydk'
),
true
)
end
\ No newline at end of file
lib/ygocore/game.rb
View file @
db69541c
...
@@ -139,6 +139,23 @@ class Ygocore < Game
...
@@ -139,6 +139,23 @@ class Ygocore < Game
args
=
'-r'
args
=
'-r'
when
:deck
when
:deck
args
=
'-d'
args
=
'-d'
when
String
system_conf
=
{}
begin
IO
.
readlines
(
'system.conf'
).
each
do
|
line
|
line
.
force_encoding
"UTF-8"
next
if
line
[
0
,
1
]
==
'#'
field
,
contents
=
line
.
chomp
.
split
(
' = '
,
2
)
system_conf
[
field
]
=
contents
end
rescue
system_conf
[
'antialias'
]
=
2
system_conf
[
'textfont'
]
=
'c:/windows/fonts/simsun.ttc 14'
system_conf
[
'numfont'
]
=
'c:/windows/fonts/arialbd.ttf'
end
system_conf
[
'lastdeck'
]
=
option
open
(
'system.conf'
,
'w'
)
{
|
file
|
file
.
write
system_conf
.
collect
{
|
key
,
value
|
"
#{
key
}
=
#{
value
}
"
}.
join
(
"
\n
"
)}
args
=
'-d'
end
end
IO
.
popen
(
"ygopro_vs.exe
#{
args
}
"
)
IO
.
popen
(
"ygopro_vs.exe
#{
args
}
"
)
WM
.
iconify
rescue
nil
WM
.
iconify
rescue
nil
...
@@ -164,11 +181,11 @@ class Ygocore < Game
...
@@ -164,11 +181,11 @@ class Ygocore < Game
end
end
end
end
end
end
def
self
.
replay
(
file
)
def
self
.
replay
(
file
,
skip_image_downloading
=
false
)
require
'fileutils'
require
'fileutils'
FileUtils
.
mv
Dir
.
glob
(
'ygocore/replay/*.yrp'
),
'replay/'
FileUtils
.
mv
Dir
.
glob
(
'ygocore/replay/*.yrp'
),
'replay/'
FileUtils
.
copy_file
(
file
,
"ygocore/replay/
#{
File
.
basename
(
file
)
}
"
)
FileUtils
.
copy_file
(
file
,
"ygocore/replay/
#{
File
.
basename
(
file
)
}
"
)
run_ygocore
(
:replay
)
run_ygocore
(
:replay
,
skip_image_downloading
)
end
end
private
private
...
...
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