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
534ac52d
Commit
534ac52d
authored
Apr 02, 2013
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deck share
parent
e2710f1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
4 deletions
+40
-4
graphics/system/deck_buttons.png
graphics/system/deck_buttons.png
+0
-0
lib/window_deck.rb
lib/window_deck.rb
+40
-4
No files found.
graphics/system/deck_buttons.png
View file @
534ac52d
This diff was suppressed by a .gitattributes entry.
lib/window_deck.rb
View file @
534ac52d
...
...
@@ -3,12 +3,11 @@ class Window_Deck < Window
def
initialize
@items
=
Dir
.
glob
(
"ygocore/deck/*.ydk"
)[
0
,
10
]
p
@items
@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
)
@items_button
=
Surface
.
load
(
"graphics/system/deck_buttons.png"
)
@items_buttons
=
{
edit:
"编辑"
,
delete:
"删除"
,
export:
"导出"
}
@items_buttons
=
{
edit:
"编辑"
,
delete:
"删除"
,
export:
"导出"
,
share:
"分享"
}
button_y
=
@height
-
36
@button
=
Surface
.
load
(
"graphics/system/button.png"
)
...
...
@@ -47,7 +46,7 @@ class Window_Deck < Window
def
draw_item
(
index
,
status
=
0
)
x
,
y
=
item_rect
(
index
)
if
index
.
is_a?
Array
Surface
.
blit
(
@items_button
,
status
*
@items_button
.
w
/
3
,
@items_buttons
.
keys
.
index
(
index
[
1
])
*
@items_button
.
h
/
3
,
@items_button
.
w
/
3
,
@items_button
.
h
/
3
,
@contents
,
x
,
y
)
Surface
.
blit
(
@items_button
,
status
*
@items_button
.
w
/
3
,
@items_buttons
.
keys
.
index
(
index
[
1
])
*
@items_button
.
h
/
@items_buttons
.
size
,
@items_button
.
w
/
3
,
@items_button
.
h
/
@items_buttons
.
size
,
@contents
,
x
,
y
)
else
Surface
.
blit
(
@button
,
@button
.
w
/
3
*
status
,
0
,
@button
.
w
/
3
,
@button
.
h
,
@contents
,
x
,
y
)
text_size
=
@font
.
text_size
(
@buttons
[
index
])
...
...
@@ -82,7 +81,7 @@ class Window_Deck < Window
@width
-
(
@items_button
.
w
/
3
)
*
(
@items_buttons
.
keys
.
reverse
.
index
(
index
[
1
])
+
1
),
28
+
WLH
*
index
[
0
],
@items_button
.
w
/
3
,
@items_button
.
h
/
3
@items_button
.
h
/
@items_buttons
.
size
]
else
@buttons_pos
[
index
]
...
...
@@ -116,6 +115,43 @@ class Window_Deck < Window
case
index
[
1
]
when
:edit
Ygocore
.
run_ygocore
(
File
.
basename
(
@items
[
index
[
0
]],
".ydk"
))
when
:share
card_usages
=
[]
side
=
false
last_id
=
nil
count
=
0
IO
.
readlines
(
@items
[
index
[
0
]]).
each
do
|
line
|
if
line
[
0
]
==
'#'
next
elsif
line
[
0
,
5
]
==
'!side'
card_usages
.
push
({
card_id:
last_id
,
side:
side
,
count:
count
})
if
last_id
side
=
true
last_id
=
nil
else
card_id
=
line
.
to_i
if
card_id
.
zero?
next
else
if
card_id
==
last_id
count
+=
1
else
card_usages
.
push
({
card_id:
last_id
,
side:
side
,
count:
count
})
if
last_id
last_id
=
card_id
count
=
1
end
end
end
end
result
=
""
key
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="
card_usages
.
each
do
|
card_usage
|
c
=
(
card_usage
[
:side
]
?
1
:
0
)
<<
29
|
card_usage
[
:count
]
<<
27
|
card_usage
[
:card_id
]
4
.
downto
(
0
)
do
|
i
|
result
<<
key
[(
c
>>
i
*
6
)
&
0x3F
]
end
end
Dialog
.
web
"http://my-card.in/decks/new?name=
#{
File
.
basename
(
@items
[
index
[
0
]],
".ydk"
)
}
&cards=
#{
result
}
#share"
when
:delete
require_relative
'widget_msgbox'
Widget_Msgbox
.
new
(
"删除卡组"
,
"确定要删除卡组
#{
File
.
basename
(
@items
[
index
[
0
]],
'.ydk'
)
}
吗"
,
buttons
=
{
ok:
"确定"
,
cancel:
"取消"
})
do
|
clicked
|
...
...
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