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
0e2b5e19
Commit
0e2b5e19
authored
Jan 13, 2012
by
zh99998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对手卡片位置修正
parent
cafaae12
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
158 additions
and
127 deletions
+158
-127
1.txt
1.txt
+1
-0
lib/card.rb
lib/card.rb
+6
-3
lib/game_card.rb
lib/game_card.rb
+10
-4
lib/iduel/event.rb
lib/iduel/event.rb
+4
-0
lib/iduel/game.rb
lib/iduel/game.rb
+4
-4
lib/nbx/game.rb
lib/nbx/game.rb
+3
-0
lib/scene_duel.rb
lib/scene_duel.rb
+4
-6
lib/widget_scrollbar.rb
lib/widget_scrollbar.rb
+8
-2
lib/window_action.rb
lib/window_action.rb
+1
-4
lib/window_field.rb
lib/window_field.rb
+109
-96
lib/window_list.rb
lib/window_list.rb
+8
-8
No files found.
1.txt
0 → 100644
View file @
0e2b5e19
通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 - bind(2)
\ No newline at end of file
lib/card.rb
View file @
0e2b5e19
...
@@ -12,8 +12,8 @@ class Card
...
@@ -12,8 +12,8 @@ class Card
@db
.
results_as_hash
=
true
@db
.
results_as_hash
=
true
#PicPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/YGODATA/YGOPIC'
#PicPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/YGODATA/YGOPIC'
PicPath
=
'E:/game/yu-gi-oh/YGODATA/YGOPIC'
PicPath
=
'E:/game/yu-gi-oh/YGODATA/YGOPIC'
CardBack
=
Surface
.
load
"graphics/field/card.jpg"
CardBack
=
Surface
.
load
(
"graphics/field/card.jpg"
).
display_format
CardBack_Small
=
Surface
.
load
"graphics/field/card_small.gif"
CardBack_Small
=
Surface
.
load
(
"graphics/field/card_small.gif"
).
display_format
class
<<
self
class
<<
self
def
find
(
id
,
order_by
=
nil
)
def
find
(
id
,
order_by
=
nil
)
...
@@ -152,7 +152,10 @@ attr_accessor :tokens
...
@@ -152,7 +152,10 @@ attr_accessor :tokens
@image
||=
Surface
.
load
"
#{
PicPath
}
/
#{
@id
-
1
}
.jpg"
rescue
Surface
.
load
"graphics/field/card.jpg"
@image
||=
Surface
.
load
"
#{
PicPath
}
/
#{
@id
-
1
}
.jpg"
rescue
Surface
.
load
"graphics/field/card.jpg"
end
end
def
image_small
def
image_small
@image_small
||=
image
.
transform_surface
(
0
,
0
,
54.0
/
image
.
w
,
81.0
/
image
.
h
,
0
).
copy_rect
(
1
,
1
,
54
,
81
)
#尼玛!
@image_small
||=
image
.
transform_surface
(
0xFF000000
,
0
,
54.0
/
image
.
w
,
81.0
/
image
.
h
,
0
)
end
def
image_horizontal
@image_horizontal
||=
image_small
.
transform_surface
(
0xFF000000
,
90
,
1
,
1
,
0
)
end
end
def
unknown?
def
unknown?
@id
==
1
@id
==
1
...
...
lib/game_card.rb
View file @
0e2b5e19
...
@@ -15,15 +15,14 @@ class Game_Card
...
@@ -15,15 +15,14 @@ class Game_Card
def
def
def
def
@card
.
atk
.
to_i
#把"?"转为0
@card
.
atk
.
to_i
#把"?"转为0
end
end
def
reset
def
reset
(
reset_position
=
true
)
@position
=
:set
@position
=
:set
if
reset_position
@atk
=
@card
.
atk
@atk
=
@card
.
atk
@def
=
@card
.
def
@def
=
@card
.
def
end
end
def
card
=
(
card
)
def
card
=
(
card
)
@card
=
card
@card
=
card
@atk
=
@card
.
atk
reset
(
false
)
@def
=
@card
.
def
end
end
def
known?
def
known?
@card
!=
Card
::
Unknown
@card
!=
Card
::
Unknown
...
@@ -35,6 +34,13 @@ class Game_Card
...
@@ -35,6 +34,13 @@ class Game_Card
@card
.
image_small
@card
.
image_small
end
end
end
end
def
image_horizontal
if
@position
==
:set
and
!
$game
.
player_field
.
hand
.
include?
(
self
)
Card
.
find
(
nil
).
image_horizontal
else
@card
.
image_horizontal
end
end
def
method_missing
(
method
,
*
args
)
def
method_missing
(
method
,
*
args
)
if
method
.
to_s
[
0
,
9
]
==
"original_"
if
method
.
to_s
[
0
,
9
]
==
"original_"
method
=
method
.
to_s
[
9
,
method
.
to_s
.
size
-
9
]
method
=
method
.
to_s
[
9
,
method
.
to_s
.
size
-
9
]
...
...
lib/iduel/event.rb
View file @
0e2b5e19
...
@@ -192,6 +192,10 @@ class Game_Event
...
@@ -192,6 +192,10 @@ class Game_Event
def
initialize
(
action
,
str
,
user
)
def
initialize
(
action
,
str
,
user
)
@user
=
user
@user
=
user
super
(
action
,
str
)
super
(
action
,
str
)
if
$game
.
room
.
nil?
#通常是由于断线重连引起的
Game_Event
.
push
Watch
.
new
(
Room
.
new
(
0
,
@user
,
User
.
new
(
0
,
""
)))
#$game.refresh
end
@action
.
from_player
=
@user
==
$game
.
room
.
player1
@action
.
from_player
=
@user
==
$game
.
room
.
player1
end
end
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
...
...
lib/iduel/game.rb
View file @
0e2b5e19
...
@@ -47,7 +47,7 @@ class Iduel < Game
...
@@ -47,7 +47,7 @@ class Iduel < Game
end
end
end
end
def
action
(
action
)
def
action
(
action
)
send
(
2
,
"
#{
checknum
(
"RMSG"
,
@session
)
}
@
#{
@key
}
"
,
"
#{
action
.
escape
}
▊▊▊mycard"
)
#
if @room.include? @user#TODO:iduel校验字串
send
(
2
,
"
#{
checknum
(
"RMSG"
,
@session
)
}
@
#{
@key
}
"
,
"
#{
action
.
escape
}
▊▊▊mycard"
)
#
消息校验字串,为了防止由于mycard开源造成外挂泛滥扰乱正常iduel秩序,这里不模仿iduel计算校验字串,直接发送mycard供iduel识别
end
end
def
exit
def
exit
@recv
.
exit
@recv
.
exit
...
@@ -74,9 +74,9 @@ class Iduel < Game
...
@@ -74,9 +74,9 @@ class Iduel < Game
end
end
end
end
def
qroom
(
room
)
#
def qroom(room)
send
(
10
,
@key
,
room
.
id
,
checknum
(
"QROOM"
,
@session
+
room
.
id
.
to_s
))
#
send(10, @key, room.id, checknum("QROOM", @session + room.id.to_s))
end
#
end
def
chat
(
msg
)
def
chat
(
msg
)
send
(
4
,
@key
,
msg
,
checknum
(
"CHATP"
,
@session
))
send
(
4
,
@key
,
msg
,
checknum
(
"CHATP"
,
@session
))
#4|241019,test,2368c6b89b3e2eedb92e1b624a2a157c
#4|241019,test,2368c6b89b3e2eedb92e1b624a2a157c
...
...
lib/nbx/game.rb
View file @
0e2b5e19
...
@@ -91,6 +91,9 @@ class NBX < Game
...
@@ -91,6 +91,9 @@ class NBX < Game
$log
.
error
(
'nbx-connect-1'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
)}
$log
.
error
(
'nbx-connect-1'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
)}
end
end
end
end
rescue
Errno
::
EADDRINUSE
self
.
exit
Game_Event
.
push
Game_Event
::
Error
.
new
(
"局域网"
,
"局域网模式不支持双开"
)
rescue
Exception
=>
exception
rescue
Exception
=>
exception
self
.
exit
self
.
exit
Game_Event
.
push
Game_Event
::
Error
.
new
(
exception
.
class
.
to_s
,
exception
.
message
)
Game_Event
.
push
Game_Event
::
Error
.
new
(
exception
.
class
.
to_s
,
exception
.
message
)
...
...
lib/scene_duel.rb
View file @
0e2b5e19
...
@@ -18,7 +18,6 @@ class Scene_Duel < Scene
...
@@ -18,7 +18,6 @@ class Scene_Duel < Scene
require_relative
'game_field'
require_relative
'game_field'
require_relative
'window_roomchat'
require_relative
'window_roomchat'
attr_reader
:cardinfo_window
attr_reader
:cardinfo_window
attr_reader
:action_window
attr_reader
:player_field_window
attr_reader
:player_field_window
attr_reader
:opponent_field_window
attr_reader
:opponent_field_window
attr_reader
:fieldback_window
attr_reader
:fieldback_window
...
@@ -36,15 +35,14 @@ class Scene_Duel < Scene
...
@@ -36,15 +35,14 @@ class Scene_Duel < Scene
init_game
init_game
init_replay
init_replay
@phases_window
=
Window_Phases
.
new
(
122
,
356
)
@fieldback_window
=
Window_FieldBack
.
new
(
130
,
174
)
@cardinfo_window
=
Window_CardInfo
.
new
(
715
,
0
)
@player_lp_window
=
Window_LP
.
new
(
0
,
0
,
@room
.
player1
,
true
)
@player_lp_window
=
Window_LP
.
new
(
0
,
0
,
@room
.
player1
,
true
)
@opponent_lp_window
=
Window_LP
.
new
(
360
,
0
,
@room
.
player2
,
false
)
@opponent_lp_window
=
Window_LP
.
new
(
360
,
0
,
@room
.
player2
,
false
)
@player_field_window
=
Window_Field
.
new
(
4
,
398
,
$game
.
player_field
,
true
)
@player_field_window
=
Window_Field
.
new
(
4
,
398
,
$game
.
player_field
,
true
)
@opponent_field_window
=
Window_Field
.
new
(
4
,
60
,
$game
.
opponent_field
,
false
)
@opponent_field_window
=
Window_Field
.
new
(
4
,
60
,
$game
.
opponent_field
,
false
)
#@opponent_field_window.angle=180
@phases_window
=
Window_Phases
.
new
(
122
,
356
)
@fieldback_window
=
Window_FieldBack
.
new
(
130
,
174
)
@cardinfo_window
=
Window_CardInfo
.
new
(
715
,
0
)
@chat_window
=
Window_RoomChat
.
new
(
@cardinfo_window
.
x
,
@cardinfo_window
.
height
,
1024
-
@cardinfo_window
.
x
,
768
-
@cardinfo_window
.
height
)
@chat_window
=
Window_RoomChat
.
new
(
@cardinfo_window
.
x
,
@cardinfo_window
.
height
,
1024
-
@cardinfo_window
.
x
,
768
-
@cardinfo_window
.
height
)
create_action_window
create_action_window
...
...
lib/widget_scrollbar.rb
View file @
0e2b5e19
...
@@ -67,11 +67,17 @@ class Widget_ScrollBar < Window
...
@@ -67,11 +67,17 @@ class Widget_ScrollBar < Window
def
clicked
def
clicked
case
@index
case
@index
when
:up
when
:up
@parent_window
.
scroll
-=
1
scroll_up
when
:down
when
:down
@parent_window
.
scroll
+=
1
scroll_down
end
end
end
end
def
scroll_up
@parent_window
.
scroll_up
end
def
scroll_down
@parent_window
.
scroll_down
end
def
scroll
=
(
scroll
)
def
scroll
=
(
scroll
)
return
unless
scroll
and
scroll
.
between?
(
0
,
@scroll_max
)
return
unless
scroll
and
scroll
.
between?
(
0
,
@scroll_max
)
@scroll
=
scroll
@scroll
=
scroll
...
...
lib/window_action.rb
View file @
0e2b5e19
...
@@ -12,8 +12,6 @@ class Window_Action < Window_List
...
@@ -12,8 +12,6 @@ class Window_Action < Window_List
@up
.
set_alpha
(
RLEACCEL
,
255
)
@up
.
set_alpha
(
RLEACCEL
,
255
)
@middle
.
set_alpha
(
RLEACCEL
,
255
)
@middle
.
set_alpha
(
RLEACCEL
,
255
)
@down
.
set_alpha
(
RLEACCEL
,
255
)
@down
.
set_alpha
(
RLEACCEL
,
255
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x22555500
)
@font
=
TTF
.
open
(
'fonts/WenQuanYi Micro Hei.ttf'
,
16
)
@font
=
TTF
.
open
(
'fonts/WenQuanYi Micro Hei.ttf'
,
16
)
@visible
=
false
@visible
=
false
end
end
...
@@ -22,7 +20,6 @@ class Window_Action < Window_List
...
@@ -22,7 +20,6 @@ class Window_Action < Window_List
@items
=
items
.
keys
@items
=
items
.
keys
@items_available
=
items
.
values
@items_available
=
items
.
values
@height
=
@viewport
[
3
]
=
@items
.
size
*
WLH
+
15
*
2
@height
=
@viewport
[
3
]
=
@items
.
size
*
WLH
+
15
*
2
@item_max
=
@items
.
size
@index
=
@items_available
.
find_index
(
true
)
||
0
@index
=
@items_available
.
find_index
(
true
)
||
0
refresh
refresh
@visible
=
true
@visible
=
true
...
@@ -36,7 +33,7 @@ class Window_Action < Window_List
...
@@ -36,7 +33,7 @@ class Window_Action < Window_List
@contents
.
put
(
@down
,
0
,
@height
-
15
)
@contents
.
put
(
@down
,
0
,
@height
-
15
)
end
end
def
index
=
(
index
)
def
index
=
(
index
)
if
index
and
index
>=
0
and
index
<
@item
_max
if
index
and
index
>=
0
and
index
<
@item
s
.
size
super
(
index
)
super
(
index
)
refresh
refresh
end
end
...
...
lib/window_field.rb
View file @
0e2b5e19
...
@@ -68,17 +68,24 @@ class Window_Field < Window
...
@@ -68,17 +68,24 @@ class Window_Field < Window
@items
[
index
+
11
]
=
[
hand_x
+
index
*
Hand_Pos
[
2
],
Hand_Pos
[
1
]]
+
Card_Size
@items
[
index
+
11
]
=
[
hand_x
+
index
*
Hand_Pos
[
2
],
Hand_Pos
[
1
]]
+
Card_Size
@cards
[
index
+
11
]
=
card
@cards
[
index
+
11
]
=
card
end
end
if
!
@player
#对手的情况,把卡片位置翻转
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x66000000
)
@items
.
each_pair
do
|
key
,
value
|
value
[
0
]
=
@width
-
value
[
0
]
-
Card_Size
[
0
]
value
[
1
]
=
@height
-
value
[
1
]
-
Card_Size
[
1
]
@items
[
key
]
=
value
end
end
clear
@items
.
each_key
{
|
index
|
draw_item
(
index
)}
@items
.
each_key
{
|
index
|
draw_item
(
index
)}
refresh_action_window
end
end
def
draw_item
(
index
,
status
=
0
)
def
draw_item
(
index
,
status
=
0
)
if
(
6
..
10
).
include?
(
index
)
and
@cards
[
index
].
position
!=
:attack
if
(
6
..
10
).
include?
(
index
)
and
@cards
[
index
].
position
!=
:attack
Surface
.
transform_draw
(
@cards
[
index
].
image_small
,
@contents
,
90
,
1
,
1
,
0
,
0
,
@items
[
index
][
0
]
+
Card_Size
[
1
],
@items
[
index
][
1
],
Surface
::
TRANSFORM_SAFE
)
@contents
.
put
(
@cards
[
index
].
image_horizontal
,
item_rect
(
index
)[
0
],
item_rect
(
index
)[
1
]
)
@contents
.
put
(
@border_horizontal
,
@items
[
index
][
0
]
-
1
,
@items
[
index
]
[
1
]
-
1
)
if
status
==
1
@contents
.
put
(
@border_horizontal
,
item_rect
(
index
)[
0
]
-
1
,
item_rect
(
index
)
[
1
]
-
1
)
if
status
==
1
else
else
@contents
.
put
(
@cards
[
index
].
image_small
,
@items
[
index
][
0
],
@items
[
index
]
[
1
])
@contents
.
put
(
@cards
[
index
].
image_small
,
item_rect
(
index
)[
0
],
item_rect
(
index
)
[
1
])
@contents
.
put
(
@border
,
@items
[
index
][
0
]
-
1
,
@items
[
index
]
[
1
]
-
1
)
if
status
==
1
@contents
.
put
(
@border
,
item_rect
(
index
)[
0
]
-
1
,
item_rect
(
index
)
[
1
]
-
1
)
if
status
==
1
end
end
if
(
6
..
10
).
include?
(
index
)
and
@cards
[
index
].
position
!=
:set
if
(
6
..
10
).
include?
(
index
)
and
@cards
[
index
].
position
!=
:set
size
=
@font
.
text_size
(
'/'
)
size
=
@font
.
text_size
(
'/'
)
...
@@ -88,109 +95,115 @@ class Window_Field < Window
...
@@ -88,109 +95,115 @@ class Window_Field < Window
@font
.
draw_blended_utf8
(
@contents
,
'/'
,
x
,
y
,
0xFF
,
0xFF
,
0xFF
)
@font
.
draw_blended_utf8
(
@contents
,
'/'
,
x
,
y
,
0xFF
,
0xFF
,
0xFF
)
@font
.
draw_blended_utf8
(
@contents
,
@cards
[
index
].
atk
.
to_s
,
x
-
@font
.
text_size
(
@cards
[
index
].
atk
.
to_s
)[
0
],
y
,
0xFF
,
0xFF
,
0xFF
)
@font
.
draw_blended_utf8
(
@contents
,
@cards
[
index
].
atk
.
to_s
,
x
-
@font
.
text_size
(
@cards
[
index
].
atk
.
to_s
)[
0
],
y
,
0xFF
,
0xFF
,
0xFF
)
@font
.
draw_blended_utf8
(
@contents
,
@cards
[
index
].
def
.
to_s
,
x
+
size
,
y
,
0xFF
,
0xFF
,
0xFF
)
@font
.
draw_blended_utf8
(
@contents
,
@cards
[
index
].
def
.
to_s
,
x
+
size
,
y
,
0xFF
,
0xFF
,
0xFF
)
end
end
end
end
def
item_rect
(
index
)
def
item_rect
(
index
)
@items
[
index
]
@items
[
index
]
end
end
def
index
=
(
index
)
def
index
=
(
index
)
index
=
nil
if
!
@items
.
has_key?
(
index
)
or
(
index
==
:deck
and
@field
.
deck
.
empty?
)
or
(
index
==
:removed
and
@field
.
removed
.
empty?
)
or
(
index
==
:extra
and
@field
.
extra
.
empty?
)
or
(
index
==
:graveyard
and
@field
.
graveyard
.
empty?
)
return
if
index
==
@index
return
if
index
==
@index
if
@index
and
@items
.
has_key?
(
@index
)
||
(
@index
==
:deck
and
!
@field
.
deck
.
empty?
)
||
(
@index
==
:removed
and
!
@field
.
removed
.
empty?
)
||
(
@index
==
:extra
and
!
@field
.
extra
.
empty?
)
||
(
@index
==
:graveyard
and
!
@field
.
graveyard
.
empty?
)
if
@index
and
@items
.
has_key?
(
@index
)
||
(
@index
==
:deck
and
!
@field
.
deck
.
empty?
)
||
(
@index
==
:removed
and
!
@field
.
removed
.
empty?
)
||
(
@index
==
:extra
and
!
@field
.
extra
.
empty?
)
||
(
@index
==
:graveyard
and
!
@field
.
graveyard
.
empty?
)
clear
(
@items
[
@index
][
0
]
-
1
,
@items
[
@index
][
1
]
-
1
,
@items
[
@index
][
2
]
+
2
,
@items
[
@index
][
3
]
+
2
)
clear
(
@items
[
@index
][
0
]
-
1
,
@items
[
@index
][
1
]
-
1
,
@items
[
@index
][
2
]
+
2
,
@items
[
@index
][
3
]
+
2
)
draw_item
(
@index
,
0
)
draw_item
(
@index
,
0
)
end
end
if
index
.
nil?
or
!
@items
.
has_key?
(
index
)
or
(
index
==
:deck
and
@field
.
deck
.
empty?
)
or
(
index
==
:removed
and
@field
.
removed
.
empty?
)
or
(
index
==
:extra
and
@field
.
extra
.
empty?
)
or
(
index
==
:graveyard
and
@field
.
graveyard
.
empty?
)
@index
=
index
@index
=
nil
if
@index
@action_window
.
items
=
nil
if
@action_window
else
@index
=
index
draw_item
(
@index
,
1
)
draw_item
(
@index
,
1
)
case
@index
refresh_cardinfo_window
when
:deck
end
@card
=
@field
.
deck
.
first
refresh_action_window
@action_names
=
{
"抽卡"
=>
true
,
end
"查看卡组"
=>
true
,
def
refresh_cardinfo_window
"卡组洗切"
=>
true
,
$scene
.
cardinfo_window
.
card
=
@card
=
case
@index
"抽卡并确认"
=>
false
,
when
:deck
"顶牌回卡组底"
=>
false
,
@field
.
deck
.
first
"顶牌送入墓地"
=>
true
,
when
:extra
"顶牌除外"
=>
true
,
@field
.
extra
.
first
"顶牌背面除外"
=>
false
,
when
:graveyard
"确认顶牌"
=>
false
,
@field
.
graveyard
.
first
"双方确认顶牌"
=>
false
,
when
0
..
10
"对方确认顶牌"
=>
false
@field
.
field
[
@index
]
}
when
Integer
#手卡
when
:extra
@field
.
hand
[
@index
-
11
]
@card
=
@field
.
extra
.
first
end
@action_names
=
{
"查看"
=>
true
,
end
"特殊召唤"
=>
!
@field
.
empty_field
(
@card
).
nil?
,
def
refresh_action_window
"效果发动"
=>
true
,
return
unless
@action_window
"从游戏中除外"
=>
true
,
return
@action_window
.
visible
=
false
unless
@index
and
@items
[
@index
]
"送入墓地"
=>
true
@action_window
.
items
=
case
@index
}
when
:deck
when
:removed
{
"抽卡"
=>
true
,
@card
=
@field
.
removed
.
first
"查看卡组"
=>
true
,
@action_names
=
{
"查看"
=>
true
,
"卡组洗切"
=>
true
,
"特殊召唤"
=>
@card
.
monster?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"抽卡并确认"
=>
false
,
"效果发动"
=>
true
,
"顶牌回卡组底"
=>
false
,
"加入手卡"
=>
true
,
"顶牌送入墓地"
=>
true
,
"返回卡组"
=>
true
,
"顶牌除外"
=>
true
,
"送入墓地"
=>
true
"顶牌背面除外"
=>
false
,
}
"确认顶牌"
=>
false
,
when
:graveyard
"双方确认顶牌"
=>
false
,
@card
=
@field
.
graveyard
.
first
"对方确认顶牌"
=>
false
@action_names
=
{
"查看"
=>
true
,
}
"特殊召唤"
=>
@card
.
monster?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
when
:extra
"效果发动"
=>
true
,
{
"查看"
=>
true
,
"加入手卡"
=>
true
,
"特殊召唤"
=>
!
@field
.
empty_field
(
@card
).
nil?
,
"返回卡组"
=>
true
,
"效果发动"
=>
true
,
"从游戏中除外"
=>
true
"从游戏中除外"
=>
true
,
}
"送入墓地"
=>
true
when
0
..
5
}
@card
=
@field
.
field
[
@index
]
when
:removed
@action_names
=
{
"效果发动"
=>
true
,
{
"查看"
=>
true
,
"返回卡组"
=>
true
,
"特殊召唤"
=>
@card
.
monster?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"送入墓地"
=>
true
,
"效果发动"
=>
true
,
"从游戏中除外"
=>
true
,
"加入手卡"
=>
true
,
"加入手卡"
=>
true
,
"返回卡组"
=>
true
,
"盖伏"
=>
true
"送入墓地"
=>
true
}
}
when
6
..
10
when
:graveyard
@card
=
@field
.
field
[
@index
]
{
"查看"
=>
true
,
@action_names
=
{
"攻击表示"
=>
@card
.
position
==
:defense
,
"特殊召唤"
=>
@card
.
monster?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"守备表示"
=>
@card
.
position
==
:attack
,
"效果发动"
=>
true
,
"里侧表示"
=>
@card
.
position!
=
:set
,
"加入手卡"
=>
true
,
"反转召唤"
=>
@card
.
position
==
:set
,
"返回卡组"
=>
true
,
"打开"
=>
@card
.
position
==
:set
,
"从游戏中除外"
=>
true
"效果发动"
=>
true
,
}
"攻击宣言"
=>
@card
.
position
==
:attack
,
when
0
..
5
"转移控制权"
=>
false
,
{
"效果发动"
=>
true
,
"放回卡组顶端"
=>
true
,
"返回卡组"
=>
true
,
"送入墓地"
=>
true
,
"送入墓地"
=>
true
,
"解放"
=>
true
,
"从游戏中除外"
=>
true
,
"加入手卡"
=>
true
,
"加入手卡"
=>
true
,
#"送入对手墓地" => false
"盖伏"
=>
true
}
}
when
Integer
#手卡
when
6
..
10
@card
=
@field
.
hand
[
@index
-
11
]
{
"攻击表示"
=>
@card
.
position
==
:defense
,
@action_names
=
{
"召唤"
=>
@card
.
monster?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"守备表示"
=>
@card
.
position
==
:attack
,
"特殊召唤"
=>
false
,
"里侧表示"
=>
@card
.
position!
=
:set
,
"发动"
=>
@card
.
spell?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"反转召唤"
=>
@card
.
position
==
:set
,
"放置到场上"
=>
true
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"打开"
=>
@card
.
position
==
:set
,
"放回卡组顶端"
=>
true
,
"效果发动"
=>
true
,
"送入墓地"
=>
true
,
"攻击宣言"
=>
@card
.
position
==
:attack
,
"从游戏中除外"
=>
true
,
"转移控制权"
=>
false
,
"效果发动"
=>
true
"放回卡组顶端"
=>
true
,
}
"送入墓地"
=>
true
,
end
"解放"
=>
true
,
if
@action_window
"加入手卡"
=>
true
,
@action_window
.
items
=
@action_names
#"送入对手墓地" => false
@action_window
.
x
=
@x
+
@items
[
@index
][
0
]
-
(
@action_window
.
width
-
@items
[
@index
][
2
])
/
2
}
@action_window
.
y
=
@y
+
@items
[
@index
][
1
]
-
@action_window
.
height
when
Integer
#手卡
end
{
"召唤"
=>
@card
.
monster?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
$scene
.
cardinfo_window
.
card
=
@card
if
@card
.
known?
"特殊召唤"
=>
false
,
"发动"
=>
@card
.
spell?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"放置到场上"
=>
true
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"放回卡组顶端"
=>
true
,
"送入墓地"
=>
true
,
"从游戏中除外"
=>
true
,
"效果发动"
=>
true
}
end
end
@action_window
.
x
=
@x
+
@items
[
@index
][
0
]
-
(
@action_window
.
width
-
@items
[
@index
][
2
])
/
2
@action_window
.
y
=
@y
+
@items
[
@index
][
1
]
-
@action_window
.
height
end
end
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
self
.
index
=
@items
.
each
do
|
index
,
item_rect
|
self
.
index
=
@items
.
each
do
|
index
,
item_rect
|
...
...
lib/window_list.rb
View file @
0e2b5e19
...
@@ -45,18 +45,18 @@ class Window_List < Window
...
@@ -45,18 +45,18 @@ class Window_List < Window
@items
.
each_index
{
|
index
|
draw_item
(
index
,
index
==
@index
?
1
:
0
)}
@items
.
each_index
{
|
index
|
draw_item
(
index
,
index
==
@index
?
1
:
0
)}
end
end
def
cursor_up
(
wrap
=
false
)
def
cursor_up
(
wrap
=
false
)
self
.
index
=
@index
?
(
@index
-
@column_max
)
%
[
@items
.
size
,
@items
.
size
].
min
:
0
return
unless
wrap
or
@index
.
nil?
or
@index
>
0
self
.
index
=
@index
?
(
@index
-
1
)
%
@items
.
size
:
0
end
end
def
cursor_down
(
wrap
=
false
)
def
cursor_down
(
wrap
=
false
)
#if @index
return
unless
wrap
or
@index
.
nil?
or
@index
<
@items
.
size
-
1
self
.
index
=
@index
?
((
@index
+
@column_max
)
%
[
@items
.
size
,
@items
.
size
].
min
)
:
0
self
.
index
=
@index
?
(
@index
+
1
)
%
@items
.
size
:
0
#p @index, @index + @column_max, [@items.size, @items.size].min, (@index + @column_max) % [@items.size, @items.size].min, @index ? ((@index + @column_max) % [@items.size, @items.size].min) : 0
end
end
def
cursor_left
def
cursor_left
(
wrap
=
false
)
self
.
index
=
@index
?
(
@index
-
1
)
%
[
@items
.
size
,
@items
.
size
].
min
:
0
cursor_up
(
wrap
)
end
end
def
cursor_right
def
cursor_right
(
wrap
=
false
)
self
.
index
=
@index
?
(
@index
+
1
)
%
[
@items
.
size
,
@items
.
size
].
min
:
0
cursor_down
(
wrap
)
end
end
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
#子类定义
#子类定义
...
...
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