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
fb3c071a
Commit
fb3c071a
authored
Dec 24, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
观战消息,流程按钮图改变,LP初步
parent
7e3a0e0e
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
104 additions
and
77 deletions
+104
-77
graphics/system/phases_opponent.png
graphics/system/phases_opponent.png
+0
-0
graphics/system/phases_opponent.png_STOP
graphics/system/phases_opponent.png_STOP
+0
-0
graphics/system/phases_player.png
graphics/system/phases_player.png
+0
-0
graphics/system/phases_player.png_STOP
graphics/system/phases_player.png_STOP
+0
-0
lib/action.rb
lib/action.rb
+24
-5
lib/card.rb
lib/card.rb
+1
-1
lib/deck.rb
lib/deck.rb
+1
-1
lib/game_field.rb
lib/game_field.rb
+1
-1
lib/iduel/action.rb
lib/iduel/action.rb
+2
-4
lib/iduel/event.rb
lib/iduel/event.rb
+1
-1
lib/iduel/iduel.rb
lib/iduel/iduel.rb
+6
-3
lib/iduel/replay.rb
lib/iduel/replay.rb
+1
-1
lib/nbx/nbx.rb
lib/nbx/nbx.rb
+3
-4
lib/replay.rb
lib/replay.rb
+7
-15
lib/scene.rb
lib/scene.rb
+5
-1
lib/scene_duel.rb
lib/scene_duel.rb
+11
-13
lib/scene_login.rb
lib/scene_login.rb
+5
-9
lib/scene_title.rb
lib/scene_title.rb
+3
-3
lib/scene_watch.rb
lib/scene_watch.rb
+8
-1
lib/widget_inputbox.rb
lib/widget_inputbox.rb
+1
-2
lib/widget_msgbox.rb
lib/widget_msgbox.rb
+1
-1
lib/window_cardinfo.rb
lib/window_cardinfo.rb
+1
-1
lib/window_lp.rb
lib/window_lp.rb
+6
-8
lib/window_phases.rb
lib/window_phases.rb
+6
-1
lib/window_roomchat.rb
lib/window_roomchat.rb
+6
-1
lib/window_title.rb
lib/window_title.rb
+4
-0
No files found.
graphics/system/phases_opponent.png
View file @
fb3c071a
This diff was suppressed by a .gitattributes entry.
graphics/system/phases_opponent.png_STOP
0 → 100644
View file @
fb3c071a
File added
graphics/system/phases_player.png
View file @
fb3c071a
This diff was suppressed by a .gitattributes entry.
graphics/system/phases_player.png_STOP
0 → 100644
View file @
fb3c071a
File added
lib/action.rb
View file @
fb3c071a
...
@@ -15,7 +15,7 @@ class Action
...
@@ -15,7 +15,7 @@ class Action
@from_player
?
$game
.
opponent_field
:
$game
.
player_field
@from_player
?
$game
.
opponent_field
:
$game
.
player_field
end
end
def
run
def
run
$game
.
action
self
#子类定义
end
end
class
Reset
<
Action
class
Reset
<
Action
def
run
def
run
...
@@ -72,7 +72,7 @@ class Action
...
@@ -72,7 +72,7 @@ class Action
def
run
def
run
$game
.
phase
=
phase
$game
.
phase
=
phase
if
@from_player
and
phase
==
:EP
if
@from_player
and
phase
==
:EP
Game_Event
.
push
Game_Event
::
Action
.
new
(
TurnEnd
.
new
(
true
,
$game
.
player_field
,
$game
.
turn_player
?
@turn
:
@
turn
.
next
))
Game_Event
.
push
Game_Event
::
Action
.
new
(
TurnEnd
.
new
(
true
,
$game
.
player_field
,
$game
.
turn_player
?
$game
.
turn
:
$game
.
turn
.
next
))
end
end
super
super
end
end
...
@@ -164,8 +164,9 @@ class Action
...
@@ -164,8 +164,9 @@ class Action
else
else
card
.
position
=
:attack
card
.
position
=
:attack
end
end
else
card
.
position
=
:attack
end
end
card
.
position
=
@position
end
end
if
@to_pos
if
@to_pos
if
@to_pos
.
is_a?
Integer
if
@to_pos
.
is_a?
Integer
...
@@ -288,9 +289,9 @@ class Action
...
@@ -288,9 +289,9 @@ class Action
(
@field
[
:deck
]
-
player_field
.
deck
.
size
).
times
{
player_field
.
deck
.
push
Game_Card
.
new
(
Card
::
Unknown
)}
(
@field
[
:deck
]
-
player_field
.
deck
.
size
).
times
{
player_field
.
deck
.
push
Game_Card
.
new
(
Card
::
Unknown
)}
end
end
if
player_field
.
graveyard
.
size
>
@field
[
:graveyard
]
if
player_field
.
graveyard
.
size
>
@field
[
:graveyard
]
player_field
.
graveyard
.
pop
(
player_field
.
graveyard
.
size
-
@field
[
:graveyard
])
player_field
.
graveyard
.
pop
(
player_field
.
graveyard
.
size
-
@field
[
:graveyard
])
elsif
player_field
.
graveyard
.
size
<
@field
[
:graveyard
]
elsif
player_field
.
graveyard
.
size
<
@field
[
:graveyard
]
(
@field
[
:graveyard
]
-
player_field
.
graveyard
.
size
).
times
{
player_field
.
graveyard
.
push
Game_Card
.
new
(
Card
::
Unknown
)}
(
@field
[
:graveyard
]
-
player_field
.
graveyard
.
size
).
times
{
player_field
.
graveyard
.
push
Game_Card
.
new
(
Card
::
Unknown
)}
end
end
(
0
..
10
).
each
do
|
pos
|
(
0
..
10
).
each
do
|
pos
|
if
@field
[
pos
]
if
@field
[
pos
]
...
@@ -344,6 +345,24 @@ class Action
...
@@ -344,6 +345,24 @@ class Action
end
end
end
end
class
ViewDeck
<
Action
;
end
class
ViewDeck
<
Action
;
end
class
LP
<
Action
attr_accessor
:operator
,
:value
def
initialize
(
from_player
,
operator
,
value
)
super
(
from_player
)
@operator
=
operator
@value
=
value
end
def
run
case
operator
when
:lose
player_field
.
lp
-=
@value
when
:increase
player_field
.
lp
+=
@value
when
:become
player_field
.
lp
=
@value
end
end
end
class
Unknown
<
Action
class
Unknown
<
Action
def
initialize
(
str
)
def
initialize
(
str
)
@str
=
str
@str
=
str
...
...
lib/card.rb
View file @
fb3c071a
...
@@ -22,7 +22,7 @@ class Card
...
@@ -22,7 +22,7 @@ class Card
@all
[
id
]
||
old_new
(
@db
.
get_first_row
(
"select * from YGODATA where id =
#{
id
}
"
))
@all
[
id
]
||
old_new
(
@db
.
get_first_row
(
"select * from YGODATA where id =
#{
id
}
"
))
when
Symbol
when
Symbol
row
=
@db
.
get_first_row
(
"select * from YGODATA where name = '
#{
id
}
'"
)
row
=
@db
.
get_first_row
(
"select * from YGODATA where name = '
#{
id
}
'"
)
(
row
&&
(
@all
[
row
[
'id'
].
to_i
]
||
old_new
(
row
)))
||
Card
.
new
(
'id'
=>
0
,
'number'
=>
:"00000000"
,
'name'
=>
name
,
'card_type'
=>
:
通常怪兽
,
'stats'
=>
""
,
'archettypes'
=>
""
,
'mediums'
=>
""
,
'lore'
=>
""
)
(
row
&&
(
@all
[
row
[
'id'
].
to_i
]
||
old_new
(
row
)))
||
Card
.
new
(
'id'
=>
0
,
'number'
=>
:"00000000"
,
'name'
=>
id
,
'card_type'
=>
:
通常怪兽
,
'stats'
=>
""
,
'archettypes'
=>
""
,
'mediums'
=>
""
,
'lore'
=>
""
)
when
Hash
when
Hash
old_new
(
id
)
old_new
(
id
)
when
nil
when
nil
...
...
lib/deck.rb
View file @
fb3c071a
...
@@ -25,7 +25,7 @@ class Deck
...
@@ -25,7 +25,7 @@ class Deck
temp
=
[]
temp
=
[]
now
=
main
now
=
main
open
(
File
.
expand_path
(
name
,
DeckPath
))
do
|
file
|
open
(
File
.
expand_path
(
name
,
DeckPath
))
do
|
file
|
file
.
set_encoding
"GBK"
,
"UTF-8"
file
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
while
line
=
file
.
readline
.
chomp!
while
line
=
file
.
readline
.
chomp!
case
line
case
line
when
/^\[(.+?)\](?:\#.*\#)?$/
when
/^\[(.+?)\](?:\#.*\#)?$/
...
...
lib/game_field.rb
View file @
fb3c071a
...
@@ -25,7 +25,7 @@ class Game_Field
...
@@ -25,7 +25,7 @@ class Game_Field
attr_accessor
:removed
attr_accessor
:removed
def
initialize
(
deck
=
nil
)
def
initialize
(
deck
=
nil
)
@deck_original
=
deck
||
Deck
.
new
(
Array
.
new
(
60
,
Card
.
find
(
nil
)),
Array
.
new
(
15
,
Card
.
find
(
nil
)))
@deck_original
=
deck
||
Deck
.
new
(
Array
.
new
(
60
,
Card
.
find
(
nil
)),
[],
Array
.
new
(
15
,
Card
.
find
(
nil
)))
reset
reset
end
end
def
reset
def
reset
...
...
lib/iduel/action.rb
View file @
fb3c071a
...
@@ -169,7 +169,6 @@ class Action
...
@@ -169,7 +169,6 @@ class Action
end
end
def
self
.
parse
(
str
)
def
self
.
parse
(
str
)
from_player
=
nil
from_player
=
nil
p
str
case
str
case
str
when
/^\[(\d+)\] (.*)$/m
when
/^\[(\d+)\] (.*)$/m
#p $2, $2.match(/(◎|●)→=\[0:0:0\]==回合结束==<(\d+)>=\[\d+\]\n#{FieldFilter}(.*)/)
#p $2, $2.match(/(◎|●)→=\[0:0:0\]==回合结束==<(\d+)>=\[\d+\]\n#{FieldFilter}(.*)/)
...
@@ -265,6 +264,8 @@ class Action
...
@@ -265,6 +264,8 @@ class Action
Flip
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
Flip
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
when
/
#{
PhaseFilter
}
/
when
/
#{
PhaseFilter
}
/
ChangePhase
.
new
(
from_player
,
parse_phase
(
$1
))
ChangePhase
.
new
(
from_player
,
parse_phase
(
$1
))
when
/LP(损失|回复|变成)<(-?\d+)>/
LP
.
new
(
from_player
,
case
$1
when
"损失"
;
:lose
;
when
"回复"
;
:increase
;
when
"变成"
;
:become
end
,
$2
.
to_i
)
else
else
Unknown
.
new
str
Unknown
.
new
str
end
end
...
@@ -282,9 +283,6 @@ class Action
...
@@ -282,9 +283,6 @@ class Action
def
escape
def
escape
inspect
inspect
end
end
def
run
$game
.
action
self
if
@from_player
end
class
FirstToGo
class
FirstToGo
def
escape
def
escape
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→[11年3月1日禁卡表]先攻"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→[11年3月1日禁卡表]先攻"
...
...
lib/iduel/event.rb
View file @
fb3c071a
...
@@ -127,7 +127,7 @@ class Game_Event
...
@@ -127,7 +127,7 @@ class Game_Event
info
=~
/(.*)▊▊▊.*?$/m
info
=~
/(.*)▊▊▊.*?$/m
info
=
$1
info
=
$1
info
[
"◎"
]
=
"●"
if
info
[
"◎"
]
info
[
"◎"
]
=
"●"
if
info
[
"◎"
]
self
.
new
::
Action
.
parse
info
self
.
new
::
Action
.
parse
(
info
),
info
end
end
end
end
class
Leave
class
Leave
...
...
lib/iduel/iduel.rb
View file @
fb3c071a
...
@@ -4,7 +4,7 @@ class Iduel < Game
...
@@ -4,7 +4,7 @@ class Iduel < Game
Server
=
"iduel.ocgsoft.cn"
Server
=
"iduel.ocgsoft.cn"
Port
=
38522
Port
=
38522
RS
=
"
\xA1\xE9
"
.
force_encoding
(
"GBK"
).
encode
(
"UTF-8"
)
RS
=
"
¢"
attr_accessor
:session
attr_accessor
:session
attr_accessor
:key
attr_accessor
:key
def
initialize
def
initialize
...
@@ -20,10 +20,13 @@ class Iduel < Game
...
@@ -20,10 +20,13 @@ class Iduel < Game
require
'open-uri'
require
'open-uri'
begin
begin
@conn
=
TCPSocket
.
open
(
Server
,
Port
)
@conn
=
TCPSocket
.
open
(
Server
,
Port
)
@conn
.
set_encoding
"GBK"
,
"UTF-8"
@conn
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
@recv
=
Thread
.
new
do
@recv
=
Thread
.
new
do
begin
begin
recv
@conn
.
gets
(
RS
)
while
@conn
recv
@conn
.
gets
(
RS
)
while
@conn
rescue
Game_Event
.
push
Game_Event
::
Error
.
new
(
$!
.
class
.
to_s
,
$!
.
message
)
puts
$!
.
backtrace
ensure
ensure
exit
exit
end
end
...
@@ -57,7 +60,7 @@ class Iduel < Game
...
@@ -57,7 +60,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"
)
#
if @room.include? @user#TODO:iduel校验字串
end
end
def
exit
def
exit
@recv
.
exit
@recv
.
exit
...
...
lib/iduel/replay.rb
View file @
fb3c071a
...
@@ -11,7 +11,7 @@ class Replay
...
@@ -11,7 +11,7 @@ class Replay
def
self
.
load
(
filename
)
def
self
.
load
(
filename
)
#TODO:效率优化
#TODO:效率优化
file
=
open
(
filename
)
file
=
open
(
filename
)
file
.
set_encoding
"GBK"
,
"UTF-8"
file
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
result
=
self
.
new
(
file
)
result
=
self
.
new
(
file
)
contents
=
file
.
read
contents
=
file
.
read
contents
=~
Player_Filter
contents
=~
Player_Filter
...
...
lib/nbx/nbx.rb
View file @
fb3c071a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
class
NBX
<
Game
class
NBX
<
Game
Version
=
"20090622"
Version
=
"20090622"
Port
=
2583
Port
=
2583
RS
=
"
\xA1\xE9
"
.
force_encoding
"GBK
"
RS
=
"
¢
"
def
initialize
def
initialize
super
super
require
'socket'
require
'socket'
...
@@ -53,7 +53,7 @@ class NBX < Game
...
@@ -53,7 +53,7 @@ class NBX < Game
else
#连接
else
#连接
@conn_room
=
client
@conn_room
=
client
@conn_room
.
set_encoding
"GBK"
@conn_room
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
send
(
:room
,
"[LinkOK]|
#{
Version
}
"
)
send
(
:room
,
"[LinkOK]|
#{
Version
}
"
)
send
(
:room
,
"▓SetName:
#{
@user
.
name
}
▓"
)
send
(
:room
,
"▓SetName:
#{
@user
.
name
}
▓"
)
send
(
:room
,
"[☆]开启 游戏王NetBattleX Version 2.7.0
\r\n
[10年3月1日禁卡表]
\r\n
▊▊▊E8CB04"
)
send
(
:room
,
"[☆]开启 游戏王NetBattleX Version 2.7.0
\r\n
[10年3月1日禁卡表]
\r\n
▊▊▊E8CB04"
)
...
@@ -66,8 +66,7 @@ class NBX < Game
...
@@ -66,8 +66,7 @@ class NBX < Game
end
end
end
end
def
recv_room
(
info
)
def
recv_room
(
info
)
info
.
chomp!
(
RS
)
info
.
chomp!
(
RS
)
info
.
encode!
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
puts
">>
#{
info
}
"
puts
">>
#{
info
}
"
Game_Event
.
push
Game_Event
.
parse
info
Game_Event
.
push
Game_Event
.
parse
info
end
end
...
...
lib/replay.rb
View file @
fb3c071a
...
@@ -2,25 +2,17 @@ class Replay
...
@@ -2,25 +2,17 @@ class Replay
ReplayPath
=
'replay'
ReplayPath
=
'replay'
LastReplay
=
'lastreplay.txt'
LastReplay
=
'lastreplay.txt'
def
initialize
(
filename
=
LastReplay
)
def
initialize
(
filename
=
LastReplay
)
@file
=
open
(
File
.
expand_path
(
filename
,
ReplayPath
),
'w'
)
unless
filename
.
is_a?
IO
@file
=
open
(
File
.
expand_path
(
filename
,
ReplayPath
),
'w'
)
end
end
def
save
(
filename
=
"
#{
Time
.
now
.
strftime
(
"%Y-%m-%d_%H:%M-%S"
)
}
_
#{
$game
.
room
.
player1
.
name
}
(
#{
$game
.
room
.
player1
.
id
}
)_
#{
$game
.
room
.
player2
.
name
}
(
#{
$game
.
room
.
player2
.
id
}
).txt"
)
def
add
(
action
)
action
=
action
.
escape
if
action
.
is_a?
Action
@file
.
write
action
+
"
\n
"
end
def
save
(
filename
=
"
#{
Time
.
now
.
strftime
(
"%Y%m%d%H%M%S"
)
}
_
#{
$game
.
room
.
player1
.
name
}
(
#{
$game
.
room
.
player1
.
id
}
)_
#{
$game
.
room
.
player2
.
name
}
(
#{
$game
.
room
.
player2
.
id
}
).txt"
)
close
close
File
.
rename
(
@file
.
path
,
File
.
expand_path
(
filename
,
ReplayPath
))
File
.
rename
(
@file
.
path
,
File
.
expand_path
(
filename
,
ReplayPath
))
end
end
def
close
def
close
@file
.
close
@file
.
close
end
end
def
self
.
load
(
file
)
end
@file
=
open
(
file
)
end
def
add
(
action
)
#协议定义
end
def
get
#协议定义
end
def
eof?
@file
.
eof?
end
end
\ No newline at end of file
lib/scene.rb
View file @
fb3c071a
...
@@ -15,7 +15,11 @@ class Scene
...
@@ -15,7 +15,11 @@ class Scene
while
$scene
==
self
while
$scene
==
self
update
update
$fpstimer
.
wait_frame
do
$fpstimer
.
wait_frame
do
$screen
.
put
(
@background
,
0
,
0
)
if
@background
if
@background
$screen
.
put
(
@background
,
0
,
0
)
else
$screen
.
fill_rect
(
0
,
0
,
$screen
.
w
,
$screen
.
h
,
0x000000
)
end
@windows
.
each
do
|
window
|
@windows
.
each
do
|
window
|
window
.
draw
(
$screen
)
window
.
draw
(
$screen
)
end
end
...
...
lib/scene_duel.rb
View file @
fb3c071a
...
@@ -28,7 +28,6 @@ class Scene_Duel < Scene
...
@@ -28,7 +28,6 @@ class Scene_Duel < Scene
@deck
=
deck
@deck
=
deck
end
end
def
start
def
start
$game
.
refresh
if
$game
@bgm
=
Mixer
::
Music
.
load
"audio/bgm/title.ogg"
@bgm
=
Mixer
::
Music
.
load
"audio/bgm/title.ogg"
Mixer
.
fade_in_music
(
@bgm
,
8000
,
-
1
)
Mixer
.
fade_in_music
(
@bgm
,
8000
,
-
1
)
@background
=
Surface
.
load
"graphics/field/main.png"
@background
=
Surface
.
load
"graphics/field/main.png"
...
@@ -43,7 +42,7 @@ class Scene_Duel < Scene
...
@@ -43,7 +42,7 @@ class Scene_Duel < Scene
@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
@opponent_field_window
.
angle
=
180
@phases_window
=
Window_Phases
.
new
(
12
4
,
357
)
@phases_window
=
Window_Phases
.
new
(
12
2
,
356
)
@fieldback_window
=
Window_FieldBack
.
new
(
130
,
174
)
@fieldback_window
=
Window_FieldBack
.
new
(
130
,
174
)
@cardinfo_window
=
Window_CardInfo
.
new
(
715
,
0
)
@cardinfo_window
=
Window_CardInfo
.
new
(
715
,
0
)
...
@@ -69,7 +68,6 @@ class Scene_Duel < Scene
...
@@ -69,7 +68,6 @@ class Scene_Duel < Scene
end
end
def
change_phase
(
phase
)
def
change_phase
(
phase
)
action
Action
::
ChangePhase
.
new
(
true
,
phase
)
action
Action
::
ChangePhase
.
new
(
true
,
phase
)
$game
.
refresh
end
end
def
reset
def
reset
action
Action
::
Reset
.
new
(
true
)
action
Action
::
Reset
.
new
(
true
)
...
@@ -112,6 +110,7 @@ class Scene_Duel < Scene
...
@@ -112,6 +110,7 @@ class Scene_Duel < Scene
def
action
(
action
)
def
action
(
action
)
$game
.
action
action
# if @from_player
Game_Event
.
push
Game_Event
::
Action
.
new
(
action
)
Game_Event
.
push
Game_Event
::
Action
.
new
(
action
)
end
end
...
@@ -129,11 +128,7 @@ class Scene_Duel < Scene
...
@@ -129,11 +128,7 @@ class Scene_Duel < Scene
end
end
$chat_window
.
add
event
.
action
.
from_player
,
str
$chat_window
.
add
event
.
action
.
from_player
,
str
event
.
action
.
run
event
.
action
.
run
@player_field_window
.
refresh
refresh
@opponent_field_window
.
refresh
@phases_window
.
player
=
$game
.
turn_player
@phases_window
.
phase
=
$game
.
phase
@fieldback_window
.
card
=
$game
.
player_field
.
field
[
0
]
||
$game
.
opponent_field
.
field
[
0
]
when
Game_Event
::
Error
when
Game_Event
::
Error
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
when
Game_Event
::
Leave
when
Game_Event
::
Leave
...
@@ -153,11 +148,14 @@ class Scene_Duel < Scene
...
@@ -153,11 +148,14 @@ class Scene_Duel < Scene
end
end
super
super
end
end
def
refresh_rect
(
x
,
y
,
width
,
height
)
def
refresh
return
unless
$scene
==
self
#线程的情况
@player_field_window
.
refresh
Surface
.
blit
(
@background
,
x
,
y
,
width
,
height
,
$screen
,
x
,
y
)
rescue
p
"------奇怪的nil错误----"
,
@background
,
x
,
y
,
width
,
height
,
$screen
,
x
,
y
@opponent_field_window
.
refresh
yield
@phases_window
.
player
=
$game
.
turn_player
$screen
.
update_rect
(
x
,
y
,
width
,
height
)
@phases_window
.
phase
=
$game
.
phase
@fieldback_window
.
card
=
$game
.
player_field
.
field
[
0
]
||
$game
.
opponent_field
.
field
[
0
]
@player_lp_window
.
lp
=
$game
.
player_field
.
lp
@opponent_lp_window
.
lp
=
$game
.
opponent_field
.
lp
end
end
def
terminate
def
terminate
save_replay
save_replay
...
...
lib/scene_login.rb
View file @
fb3c071a
#encoding: UTF-8
#==============================================================================
#==============================================================================
# ■ Scene_Login
# ■ Scene_Login
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
...
@@ -8,7 +9,7 @@ class Scene_Login < Scene
...
@@ -8,7 +9,7 @@ class Scene_Login < Scene
Vocab_Logging
=
"Logging"
Vocab_Logging
=
"Logging"
def
start
def
start
require_relative
'iduel/iduel'
require_relative
'iduel/iduel'
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
24
)
#
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 24)
if
$config
[
"autologin"
]
if
$config
[
"autologin"
]
@username
=
$config
[
"username"
]
@username
=
$config
[
"username"
]
@password
=
$config
[
"password"
]
@password
=
$config
[
"password"
]
...
@@ -16,7 +17,8 @@ class Scene_Login < Scene
...
@@ -16,7 +17,8 @@ class Scene_Login < Scene
end
end
end
end
def
login
def
login
@font
.
draw_blended_utf8
(
$screen
,
Vocab_Logging
,
0
,
0
,
255
,
0
,
255
)
#@font.draw_blended_utf8($screen, Vocab_Logging, 0,0,255,0,255)
Widget_Msgbox
.
new
(
"iduel"
,
"正在登陆"
)
$game
=
Iduel
.
new
$game
=
Iduel
.
new
$game
.
login
(
@username
,
@password
)
$game
.
login
(
@username
,
@password
)
end
end
...
@@ -26,19 +28,13 @@ class Scene_Login < Scene
...
@@ -26,19 +28,13 @@ class Scene_Login < Scene
end
end
super
super
end
end
def
handle
(
event
)
case
event
when
Event
::
Quit
$scene
=
nil
end
end
def
handle_game
(
event
)
def
handle_game
(
event
)
case
event
case
event
when
Game_Event
::
Login
when
Game_Event
::
Login
require_relative
'scene_hall'
require_relative
'scene_hall'
$scene
=
Scene_Hall
.
new
$scene
=
Scene_Hall
.
new
when
Game_Event
::
Error
when
Game_Event
::
Error
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
,
:ok
=>
"确定"
){
$scene
=
Scene_Title
.
new
}
else
else
p
event
p
event
end
end
...
...
lib/scene_title.rb
View file @
fb3c071a
...
@@ -14,9 +14,9 @@ class Scene_Title < Scene
...
@@ -14,9 +14,9 @@ class Scene_Title < Scene
@background
=
Surface
.
load
(
title
)
@background
=
Surface
.
load
(
title
)
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
0
,
0
)
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
0
,
0
)
@command_window
=
Window_Title
.
new
(
title
[
"left"
]
?
200
:
title
[
"right"
]
?
600
:
400
,
300
)
@command_window
=
Window_Title
.
new
(
title
[
"left"
]
?
200
:
title
[
"right"
]
?
600
:
400
,
300
)
logo
=
Surface
.
load
(
"graphics/system/logo.png"
)
@logo
=
Surface
.
load
(
"graphics/system/logo.png"
)
@logo
_window
=
Window
.
new
(
@command_window
.
x
-
(
logo
.
w
-
@command_window
.
width
)
/
2
,
150
,
logo
.
w
,
logo
.
h
)
Surface
.
blit
(
@logo
,
0
,
0
,
0
,
0
,
$screen
,
@command_window
.
x
-
(
@logo
.
w
-
@command_window
.
width
)
/
2
,
150
)
@logo_window
.
contents
=
logo
$screen
.
update_rect
(
0
,
0
,
0
,
0
)
$screen
.
update_rect
(
0
,
0
,
0
,
0
)
@bgm
=
Mixer
::
Music
.
load
'audio/bgm/title.ogg'
@bgm
=
Mixer
::
Music
.
load
'audio/bgm/title.ogg'
@decision_se
=
Mixer
::
Wave
.
load
(
"audio/se/decision.ogg"
)
@decision_se
=
Mixer
::
Wave
.
load
(
"audio/se/decision.ogg"
)
...
...
lib/scene_watch.rb
View file @
fb3c071a
...
@@ -9,11 +9,18 @@ class Scene_Watch < Scene_Duel
...
@@ -9,11 +9,18 @@ class Scene_Watch < Scene_Duel
def
create_action_window
def
create_action_window
end
end
def
action
(
action
)
def
action
(
action
)
if
action
.
from_player
==
:me
super
end
end
def
start
super
$game
.
action
Action
::
Chat
.
new
(
true
,
"
#{
$game
.
user
.
name
}
(
#{
$game
.
user
.
id
}
)进入了观战"
)
end
end
def
handle_game
(
event
)
def
handle_game
(
event
)
case
event
case
event
when
Game_Event
::
Leave
when
Game_Event
::
Leave
Widget_Msgbox
.
new
(
"离开房间"
,
"观战结束"
)
{
$scene
=
Scene_Hall
.
new
}
Widget_Msgbox
.
new
(
"离开房间"
,
"观战结束"
,
:ok
=>
"确定"
)
{
$scene
=
Scene_Hall
.
new
}
else
else
super
super
end
end
...
...
lib/widget_inputbox.rb
View file @
fb3c071a
class
Widget_InputBox
<
Window
class
Widget_InputBox
<
Window
=begin
attr_accessor
:text
,
:proc
attr_accessor
:text
,
:proc
require
'tk'
require
'tk'
@@font
=
TkFont
.
new
(
"family"
=>
'WenQuanYi Micro Hei'
,
@@font
=
TkFont
.
new
(
"family"
=>
'WenQuanYi Micro Hei'
,
...
@@ -39,5 +39,4 @@ class Widget_InputBox < Window
...
@@ -39,5 +39,4 @@ class Widget_InputBox < Window
@@entry
.
focus
:force
@@entry
.
focus
:force
end
end
=end
end
end
lib/widget_msgbox.rb
View file @
fb3c071a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
class
Widget_Msgbox
<
Window
class
Widget_Msgbox
<
Window
Title_Color
=
[
0xFF
,
0xFF
,
0xFF
]
Title_Color
=
[
0xFF
,
0xFF
,
0xFF
]
Message_Color
=
[
0x04
,
0x47
,
0x7c
]
Message_Color
=
[
0x04
,
0x47
,
0x7c
]
def
initialize
(
title
,
message
,
buttons
=
{
:ok
=>
"确定"
},
&
proc
)
def
initialize
(
title
,
message
,
buttons
=
{},
&
proc
)
#@background = Surface.load 'graphics/system/msgbox.png'
#@background = Surface.load 'graphics/system/msgbox.png'
@contents
=
Surface
.
load
'graphics/system/msgbox.png'
@contents
=
Surface
.
load
'graphics/system/msgbox.png'
@button
=
Surface
.
load
'graphics/system/button.png'
@button
=
Surface
.
load
'graphics/system/button.png'
...
...
lib/window_cardinfo.rb
View file @
fb3c071a
...
@@ -45,6 +45,6 @@ class Window_CardInfo < Window
...
@@ -45,6 +45,6 @@ class Window_CardInfo < Window
@lore_start
=
0
@lore_start
=
0
@lore_pos
=
[
0
,
234
]
@lore_pos
=
[
0
,
234
]
@font
.
draw_blended_utf8
(
@contents
,
@card
.
inspect
,
0
,
300
,
0xFF
,
0xFF
,
0x66
)
#
@font.draw_blended_utf8(@contents, @card.inspect, 0, 300, 0xFF, 0xFF, 0x66)
end
end
end
end
lib/window_lp.rb
View file @
fb3c071a
...
@@ -6,27 +6,25 @@ class Window_LP < Window
...
@@ -6,27 +6,25 @@ class Window_LP < Window
@position
=
position
@position
=
position
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
24
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
24
)
@color
=
[
255
,
255
,
255
]
@color
=
[
255
,
255
,
255
]
self
.
player
=
player
self
.
lp
=
8000
end
def
player
=
(
player
)
return
if
@player
==
player
@player
=
player
if
@player
if
@player
@player
.
avatar
do
|
avatar
|
@player
.
avatar
do
|
avatar
|
clear
(
position
?
0
:
@width
-
Avatar_Size
,
24
,
Avatar_Size
,
Avatar_Size
)
clear
(
position
?
0
:
@width
-
Avatar_Size
,
24
,
Avatar_Size
,
Avatar_Size
)
@contents
.
put
avatar
,
position
?
0
:
@width
-
Avatar_Size
,
24
@contents
.
put
avatar
,
position
?
0
:
@width
-
Avatar_Size
,
24
end
end
end
end
self
.
lp
=
8000
end
end
def
lp
=
(
lp
)
def
lp
=
(
lp
)
return
if
lp
==
@lp
@lp
=
lp
if
@position
if
@position
@font
.
draw_blended_utf8
(
@contents
,
lp
.
to_s
,
0
,
0
,
*
@color
)
@contents
.
fill_rect
(
64
,
0
,[
0
,
[(
200
*
lp
/
8000
),
200
].
min
].
max
,
24
,
0xFFFF0000
)
@contents
.
fill_rect
(
64
,
0
,[
0
,
[(
200
*
lp
/
8000
),
200
].
min
].
max
,
24
,
0xFFFF0000
)
@font
.
draw_blended_utf8
(
@contents
,
@lp
.
to_s
,
64
,
0
,
*
@color
)
else
else
@font
.
draw_blended_utf8
(
@contents
,
lp
.
to_s
,
@width
-
64
,
0
,
*
@color
)
width
=
[
0
,
[(
200
*
lp
/
8000
),
200
].
min
].
max
width
=
[
0
,
[(
200
*
lp
/
8000
),
200
].
min
].
max
@contents
.
fill_rect
(
@width
-
width
-
64
,
0
,
width
,
24
,
0xFFFF0000
)
@contents
.
fill_rect
(
@width
-
width
-
64
,
0
,
width
,
24
,
0xFFFF0000
)
@font
.
draw_blended_utf8
(
@contents
,
@lp
.
to_s
,
@width
-
width
-
64
,
0
,
*
@color
)
end
end
end
end
#def draw_item(player)
#def draw_item(player)
...
...
lib/window_phases.rb
View file @
fb3c071a
class
Window_Phases
<
Window_List
class
Window_Phases
<
Window_List
WLH
=
8
0
#其实是列宽
WLH
=
8
1
#其实是列宽
Phases
=
[
:DP
,
:SP
,
:M1
,
:BP
,
:M2
,
:EP
]
Phases
=
[
:DP
,
:SP
,
:M1
,
:BP
,
:M2
,
:EP
]
def
initialize
(
x
,
y
)
def
initialize
(
x
,
y
)
@phases_player
=
Surface
.
load
'graphics/system/phases_player.png'
@phases_player
=
Surface
.
load
'graphics/system/phases_player.png'
@phases_player
.
set_alpha
(
RLEACCEL
,
255
)
@phases_opponent
=
Surface
.
load
'graphics/system/phases_opponent.png'
@phases_opponent
=
Surface
.
load
'graphics/system/phases_opponent.png'
@phases_opponent
.
set_alpha
(
RLEACCEL
,
255
)
super
(
x
,
y
,
5
*
WLH
+
@phases_player
.
w
/
3
,
@phases_player
.
h
/
6
)
super
(
x
,
y
,
5
*
WLH
+
@phases_player
.
w
/
3
,
@phases_player
.
h
/
6
)
@column_max
=
@item_max
=
6
@column_max
=
@item_max
=
6
self
.
player
=
true
self
.
player
=
true
...
@@ -31,4 +33,7 @@ class Window_Phases < Window_List
...
@@ -31,4 +33,7 @@ class Window_Phases < Window_List
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
self
.
index
=
include
?(
x
,
y
)
?
(
x
-
@x
)
/
WLH
:
nil
self
.
index
=
include
?(
x
,
y
)
?
(
x
-
@x
)
/
WLH
:
nil
end
end
def
clear
(
x
=
0
,
y
=
0
,
width
=
@width
,
height
=
@height
)
@contents
.
fill_rect
(
x
,
y
,
width
,
height
,
0x00000000
)
end
end
end
\ No newline at end of file
lib/window_roomchat.rb
View file @
fb3c071a
...
@@ -8,7 +8,12 @@ class Window_RoomChat < Window
...
@@ -8,7 +8,12 @@ class Window_RoomChat < Window
Opponent_Color
=
[
0
,
0x66
,
0
]
Opponent_Color
=
[
0
,
0x66
,
0
]
def
initialize
(
x
,
y
,
width
,
height
)
def
initialize
(
x
,
y
,
width
,
height
)
super
(
x
,
y
,
width
,
height
-
WLH
)
super
(
x
,
y
,
width
,
height
-
WLH
)
@chat_input
=
Widget_InputBox
.
new
(
@x
,
@y
+
@height
,
@width
,
WLH
){
|
text
|
Action
::
Chat
.
new
(
true
,
text
).
run
}
@chat_input
=
Widget_InputBox
.
new
(
@x
,
@y
+
@height
,
@width
,
WLH
){
|
text
|
$game
.
actaction
=
Action
::
Chat
.
new
(
true
,
text
)
action
.
from_player
=
:me
$scene
.
action
action
}
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
14
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
14
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x99FFFFFF
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x99FFFFFF
)
@scroll
=
Widget_ScrollBar
.
new
(
@x
+
@width
-
20
,
@y
,
@height
,
0
)
@scroll
=
Widget_ScrollBar
.
new
(
@x
+
@width
-
20
,
@y
,
@height
,
0
)
...
...
lib/window_title.rb
View file @
fb3c071a
...
@@ -4,6 +4,7 @@ class Window_Title < Window_List
...
@@ -4,6 +4,7 @@ class Window_Title < Window_List
attr_reader
:x
,
:y
,
:width
,
:height
,
:single_height
,
:index
attr_reader
:x
,
:y
,
:width
,
:height
,
:single_height
,
:index
def
initialize
(
x
,
y
)
def
initialize
(
x
,
y
)
@button
=
Surface
.
load
"graphics/system/titlebuttons.png"
@button
=
Surface
.
load
"graphics/system/titlebuttons.png"
@button
.
set_alpha
(
RLEACCEL
,
255
)
@single_height
=
@button
.
h
/
Button_Count
@single_height
=
@button
.
h
/
Button_Count
super
(
x
,
y
,
@button
.
w
/
3
,
WLH
*
Button_Count
-
(
WLH
-
@button
.
h
/
Button_Count
))
super
(
x
,
y
,
@button
.
w
/
3
,
WLH
*
Button_Count
-
(
WLH
-
@button
.
h
/
Button_Count
))
@cursor_se
=
Mixer
::
Wave
.
load
'audio/se/cursor.ogg'
@cursor_se
=
Mixer
::
Wave
.
load
'audio/se/cursor.ogg'
...
@@ -25,4 +26,7 @@ class Window_Title < Window_List
...
@@ -25,4 +26,7 @@ class Window_Title < Window_List
def
clicked
def
clicked
$scene
.
determine
$scene
.
determine
end
end
def
clear
(
x
=
0
,
y
=
0
,
width
=
@width
,
height
=
@height
)
@contents
.
fill_rect
(
x
,
y
,
width
,
height
,
0x00000000
)
end
end
end
\ No newline at end of file
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