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
xiaoye
mycard
Commits
3ce5d865
Commit
3ce5d865
authored
Apr 04, 2013
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
534ac52d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
49 deletions
+64
-49
graphics/system/deck_buttons.png
graphics/system/deck_buttons.png
+0
-0
lib/update.rb
lib/update.rb
+1
-1
lib/widget_msgbox.rb
lib/widget_msgbox.rb
+1
-1
lib/window_deck.rb
lib/window_deck.rb
+61
-47
lib/ygocore/game.rb
lib/ygocore/game.rb
+1
-0
No files found.
graphics/system/deck_buttons.png
View file @
3ce5d865
This diff was suppressed by a .gitattributes entry.
lib/update.rb
View file @
3ce5d865
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
require
"fileutils"
require
"fileutils"
require_relative
'card'
require_relative
'card'
module
Update
module
Update
Version
=
'
0.9.9
'
Version
=
'
1.0.1
'
URL
=
"http://my-card.in/mycard/update.json?version=
#{
Version
}
"
URL
=
"http://my-card.in/mycard/update.json?version=
#{
Version
}
"
class
<<
self
class
<<
self
attr_reader
:thumbnails
,
:images
,
:status
attr_reader
:thumbnails
,
:images
,
:status
...
...
lib/widget_msgbox.rb
View file @
3ce5d865
...
@@ -27,7 +27,7 @@ class Widget_Msgbox < Window
...
@@ -27,7 +27,7 @@ class Widget_Msgbox < Window
@proc
=
proc
@proc
=
proc
@index
=
nil
@index
=
nil
@items
=
{}
@items
=
{}
@space
=
(
@width
-
@buttons
.
size
*
@button
.
w
/
3
)
/
(
@buttons
.
size
+
1
)
@space
=
(
@width
-
@buttons
.
size
*
@button
.
w
/
3
)
/
(
@buttons
.
size
+
1
)
button_y
=
100
button_y
=
100
...
...
lib/window_deck.rb
View file @
3ce5d865
class
Window_Deck
<
Window
class
Window_Deck
<
Window
_Scrollable
attr_reader
:index
attr_reader
:index
def
initialize
def
initialize
@items
=
Dir
.
glob
(
"ygocore/deck/*.ydk"
)
[
0
,
10
]
@items
=
Dir
.
glob
(
"ygocore/deck/*.ydk"
)
@background
=
Surface
.
load
(
@items
.
size
>
4
?
'graphics/lobby/host.png'
:
'graphics/system/msgbox.png'
).
display_format
@background
=
Surface
.
load
(
@items
.
size
>
4
?
'graphics/lobby/host.png'
:
'graphics/system/msgbox.png'
).
display_format
super
((
1024
-
@background
.
w
)
/
2
,
230
,
@background
.
w
,
@background
.
h
,
300
)
super
((
1024
-
@background
.
w
)
/
2
,
230
,
@background
.
w
,
@background
.
h
,
300
)
...
@@ -21,19 +21,20 @@ class Window_Deck < Window
...
@@ -21,19 +21,20 @@ class Window_Deck < Window
@font
=
TTF
.
open
(
Font
,
16
)
@font
=
TTF
.
open
(
Font
,
16
)
@title_color
=
[
0xFF
,
0xFF
,
0xFF
]
@title_color
=
[
0xFF
,
0xFF
,
0xFF
]
@color
=
[
0x04
,
0x47
,
0x7c
]
@color
=
[
0x04
,
0x47
,
0x7c
]
@page_size
=
10
refresh
refresh
end
end
def
refresh
def
refresh
clear
clear
@font
.
draw_blended_utf8
(
@contents
,
"卡组编辑"
,
(
@width
-
@font
.
text_size
(
"卡组编辑"
)[
0
])
/
2
,
2
,
*
@title_color
)
@font
.
draw_blended_utf8
(
@contents
,
"卡组编辑"
,
(
@width
-
@font
.
text_size
(
"卡组编辑"
)[
0
])
/
2
,
2
,
*
@title_color
)
@items
=
Dir
.
glob
(
"ygocore/deck/*.ydk"
)
[
0
,
10
]
@items
=
Dir
.
glob
(
"ygocore/deck/*.ydk"
)
@background
=
Surface
.
load
(
@items
.
size
>
4
?
'graphics/lobby/host.png'
:
'graphics/system/msgbox.png'
).
display_format
@background
=
Surface
.
load
(
@items
.
size
>
4
?
'graphics/lobby/host.png'
:
'graphics/system/msgbox.png'
).
display_format
@height
=
@background
.
h
@height
=
@background
.
h
@items
.
each_with_index
do
|
deck
,
index
|
@items
[
@scroll
...
[(
@scroll
+
@page_size
),
@items
.
size
].
min
]
.
each_with_index
do
|
deck
,
index
|
@font
.
draw_blended_utf8
(
@contents
,
File
.
basename
(
deck
,
".ydk"
),
16
,
28
+
WLH
*
index
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
File
.
basename
(
deck
,
".ydk"
),
16
,
28
+
WLH
*
index
,
*
@color
)
end
end
@items
.
size
.
times
do
|
index
|
(
@scroll
...
[(
@scroll
+
@page_size
),
@items
.
size
].
min
).
each
do
|
index
|
@items_buttons
.
each_key
do
|
key
|
@items_buttons
.
each_key
do
|
key
|
draw_item
([
index
,
key
],
self
.
index
==
[
index
,
key
]
?
1
:
0
)
draw_item
([
index
,
key
],
self
.
index
==
[
index
,
key
]
?
1
:
0
)
end
end
...
@@ -56,8 +57,8 @@ class Window_Deck < Window
...
@@ -56,8 +57,8 @@ class Window_Deck < Window
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
new_index
=
nil
new_index
=
nil
line
=
(
y
-
@y
-
28
)
/
WLH
line
=
(
y
-
@y
-
28
)
/
WLH
+
@scroll
if
line
.
between?
(
0
,
@items
.
size
-
1
)
if
line
.
between?
(
@scroll
,
[
@scroll
+
@page_size
-
1
,
@items
.
size
-
1
].
min
)
i
=
(
x
-
@x
-
(
@width
-
@items_buttons
.
size
*
@items_button
.
w
/
3
))
/
(
@items_button
.
w
/
3
)
i
=
(
x
-
@x
-
(
@width
-
@items_buttons
.
size
*
@items_button
.
w
/
3
))
/
(
@items_button
.
w
/
3
)
if
i
>=
0
if
i
>=
0
new_index
=
[
line
,
@items_buttons
.
keys
[
i
]]
new_index
=
[
line
,
@items_buttons
.
keys
[
i
]]
...
@@ -74,12 +75,16 @@ class Window_Deck < Window
...
@@ -74,12 +75,16 @@ class Window_Deck < Window
end
end
self
.
index
=
new_index
self
.
index
=
new_index
end
end
def
cursor_up
(
wrap
=
false
)
end
def
cursor_down
(
wrap
=
false
)
end
def
item_rect
(
index
)
def
item_rect
(
index
)
if
index
.
is_a?
Array
if
index
.
is_a?
Array
[
[
@width
-
(
@items_button
.
w
/
3
)
*
(
@items_buttons
.
keys
.
reverse
.
index
(
index
[
1
])
+
1
),
@width
-
(
@items_button
.
w
/
3
)
*
(
@items_buttons
.
keys
.
reverse
.
index
(
index
[
1
])
+
1
),
28
+
WLH
*
index
[
0
]
,
28
+
WLH
*
(
index
[
0
]
-
@scroll
)
,
@items_button
.
w
/
3
,
@items_button
.
w
/
3
,
@items_button
.
h
/
@items_buttons
.
size
@items_button
.
h
/
@items_buttons
.
size
]
]
...
@@ -91,17 +96,25 @@ class Window_Deck < Window
...
@@ -91,17 +96,25 @@ class Window_Deck < Window
def
index
=
(
index
)
def
index
=
(
index
)
return
if
index
==
@index
return
if
index
==
@index
if
@index
if
@index
and
index_legal?
(
@index
)
clear
(
*
item_rect
(
@index
))
clear
(
*
item_rect
(
@index
))
draw_item
(
@index
,
0
)
draw_item
(
@index
,
0
)
end
end
@index
=
index
@index
=
index
if
@index
if
@index
and
index_legal?
(
@index
)
clear
(
*
item_rect
(
@index
))
clear
(
*
item_rect
(
@index
))
draw_item
(
@index
,
1
)
draw_item
(
@index
,
1
)
end
end
end
end
def
index_legal?
(
index
)
if
index
.
is_a?
Array
(
@scroll
...
[(
@scroll
+
@page_size
),
@items
.
size
].
min
).
include?
index
[
0
]
else
true
end
end
def
clicked
def
clicked
case
self
.
index
case
self
.
index
when
:import
when
:import
...
@@ -115,45 +128,46 @@ class Window_Deck < Window
...
@@ -115,45 +128,46 @@ class Window_Deck < Window
case
index
[
1
]
case
index
[
1
]
when
:edit
when
:edit
Ygocore
.
run_ygocore
(
File
.
basename
(
@items
[
index
[
0
]],
".ydk"
))
Ygocore
.
run_ygocore
(
File
.
basename
(
@items
[
index
[
0
]],
".ydk"
))
when
:share
when
:share
card_usages
=
[]
card_usages
=
[]
side
=
false
side
=
false
last_id
=
nil
last_id
=
nil
count
=
0
count
=
0
IO
.
readlines
(
@items
[
index
[
0
]]).
each
do
|
line
|
IO
.
readlines
(
@items
[
index
[
0
]]).
each
do
|
line
|
if
line
[
0
]
==
'#'
if
line
[
0
]
==
'#'
next
next
elsif
line
[
0
,
5
]
==
'!side'
elsif
line
[
0
,
5
]
==
'!side'
card_usages
.
push
({
card_id:
last_id
,
side:
side
,
count:
count
})
if
last_id
card_usages
.
push
({
card_id:
last_id
,
side:
side
,
count:
count
})
if
last_id
side
=
true
side
=
true
last_id
=
nil
last_id
=
nil
else
else
card_id
=
line
.
to_i
card_id
=
line
.
to_i
if
card_id
.
zero?
if
card_id
.
zero?
next
next
else
else
if
card_id
==
last_id
if
card_id
==
last_id
count
+=
1
count
+=
1
else
else
card_usages
.
push
({
card_id:
last_id
,
side:
side
,
count:
count
})
if
last_id
card_usages
.
push
({
card_id:
last_id
,
side:
side
,
count:
count
})
if
last_id
last_id
=
card_id
last_id
=
card_id
count
=
1
count
=
1
end
end
end
end
end
end
end
end
result
=
""
result
=
""
key
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="
key
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="
card_usages
.
each
do
|
card_usage
|
card_usages
.
each
do
|
card_usage
|
c
=
(
card_usage
[
:side
]
?
1
:
0
)
<<
29
|
card_usage
[
:count
]
<<
27
|
card_usage
[
:card_id
]
c
=
(
card_usage
[
:side
]
?
1
:
0
)
<<
29
|
card_usage
[
:count
]
<<
27
|
card_usage
[
:card_id
]
4
.
downto
(
0
)
do
|
i
|
4
.
downto
(
0
)
do
|
i
|
result
<<
key
[(
c
>>
i
*
6
)
&
0x3F
]
result
<<
key
[(
c
>>
i
*
6
)
&
0x3F
]
end
end
end
end
Dialog
.
web
"http://my-card.in/decks/new?name=
#{
File
.
basename
(
@items
[
index
[
0
]],
".ydk"
)
}
&cards=
#{
result
}
#share"
Dialog
.
web
"http://my-card.in/decks/new?name=
#{
File
.
basename
(
@items
[
index
[
0
]],
".ydk"
)
}
&cards=
#{
result
}
#share"
when
:delete
when
:delete
require_relative
'widget_msgbox'
require_relative
'widget_msgbox'
index
=
@index
Widget_Msgbox
.
new
(
"删除卡组"
,
"确定要删除卡组
#{
File
.
basename
(
@items
[
index
[
0
]],
'.ydk'
)
}
吗"
,
buttons
=
{
ok:
"确定"
,
cancel:
"取消"
})
do
|
clicked
|
Widget_Msgbox
.
new
(
"删除卡组"
,
"确定要删除卡组
#{
File
.
basename
(
@items
[
index
[
0
]],
'.ydk'
)
}
吗"
,
buttons
=
{
ok:
"确定"
,
cancel:
"取消"
})
do
|
clicked
|
if
clicked
==
:ok
if
clicked
==
:ok
File
.
delete
@items
[
index
[
0
]]
File
.
delete
@items
[
index
[
0
]]
...
...
lib/ygocore/game.rb
View file @
3ce5d865
...
@@ -336,6 +336,7 @@ class Ygocore < Game
...
@@ -336,6 +336,7 @@ class Ygocore < Game
when
:deck
when
:deck
args
=
'-d'
args
=
'-d'
when
String
when
String
File
.
rename
(
File
.
join
(
File
.
dirname
(
ygocore_path
),
'deck'
,
option
+
'.ydk'
),
File
.
join
(
File
.
dirname
(
ygocore_path
),
'deck'
,
option
.
gsub!
(
' '
,
'_'
)
+
'.ydk'
))
if
option
[
' '
]
write_system_conf
'lastdeck'
=>
option
write_system_conf
'lastdeck'
=>
option
args
=
'-d'
args
=
'-d'
end
end
...
...
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