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
d03c8796
Commit
d03c8796
authored
Jul 15, 2013
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
113
parent
77321a9d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
151 additions
and
106 deletions
+151
-106
lib/chatmessage.rb
lib/chatmessage.rb
+39
-32
lib/game_event.rb
lib/game_event.rb
+3
-1
lib/main.rb
lib/main.rb
+1
-1
lib/resolution.rb
lib/resolution.rb
+1
-1
lib/scene_lobby.rb
lib/scene_lobby.rb
+37
-37
lib/user.rb
lib/user.rb
+1
-1
lib/widget_inputbox.rb
lib/widget_inputbox.rb
+1
-1
lib/window_chat.rb
lib/window_chat.rb
+1
-1
lib/window_host.rb
lib/window_host.rb
+46
-20
lib/window_lobbybuttons.rb
lib/window_lobbybuttons.rb
+3
-2
lib/ygocore/game.rb
lib/ygocore/game.rb
+12
-6
lib/ygocore/room.rb
lib/ygocore/room.rb
+0
-2
lib/ygocore/user.rb
lib/ygocore/user.rb
+6
-1
No files found.
lib/chatmessage.rb
View file @
d03c8796
class
ChatMessage
class
ChatMessage
attr_accessor
:user
,
:message
,
:channel
,
:time
attr_accessor
:user
,
:message
,
:channel
,
:time
def
initialize
(
user
,
message
,
channel
=
:lobby
,
time
=
Time
.
now
)
def
initialize
(
user
,
message
,
channel
=
:lobby
,
time
=
Time
.
now
)
@user
=
user
@user
=
user
@message
=
message
@message
=
message
@channel
=
channel
@channel
=
channel
@time
=
time
@time
=
time
end
end
def
name_visible?
def
name_visible?
case
channel
case
channel
when
Symbol
when
Symbol
true
true
when
Room
when
Room
!
channel
.
include?
(
user
)
!
channel
.
include?
(
user
)
when
User
when
User
false
false
end
end
end
end
def
name_color
def
name_color
if
user
==
$game
.
user
case
user
.
role
[
0
,
128
,
0
]
when
:moderator
else
[
148
,
43
,
226
]
[
0
,
0
,
255
]
else
user
==
$game
.
user
?
[
0
,
128
,
0
]
:
[
0
,
0
,
255
]
end
end
end
end
def
message_color
def
message_color
if
name_visible?
if
name_visible?
[
0
,
0
,
0
]
[
0
,
0
,
0
]
elsif
user
==
$game
.
user
or
(
$game
.
room
and
!
$game
.
room
.
include?
(
$user
)
and
user
==
$game
.
room
.
player1
)
elsif
user
==
$game
.
user
or
(
$game
.
room
and
!
$game
.
room
.
include?
(
$user
)
and
user
==
$game
.
room
.
player1
)
[
0
,
128
,
0
]
[
0
,
128
,
0
]
else
else
[
255
,
0
,
0
]
[
255
,
0
,
0
]
end
end
end
end
def
self
.
channel_name
(
channel
)
def
self
.
channel_name
(
channel
)
case
channel
case
channel
when
:lobby
when
:lobby
"#大厅"
"#大厅"
when
Symbol
when
Symbol
"#
#{
channel
}
"
"#
#{
channel
}
"
when
Room
when
Room
"[
#{
channel
.
name
}
]"
"[
#{
channel
.
name
}
]"
when
User
when
User
"@
#{
channel
.
name
}
"
"@
#{
channel
.
name
}
"
else
else
channel
channel
end
end
end
end
def
self
.
channel_color
(
channel
)
def
self
.
channel_color
(
channel
)
case
channel
case
channel
when
Symbol
when
Symbol
[
0x34
,
0x92
,
0xEA
]
[
0x34
,
0x92
,
0xEA
]
when
Room
when
Room
[
0xF2
,
0x83
,
0xC4
]
[
0xF2
,
0x83
,
0xC4
]
#[255,250,240]
#[255,250,240]
when
User
when
User
[
0xFA
,
0x27
,
0x27
]
[
0xFA
,
0x27
,
0x27
]
else
else
[
0
,
0
,
0
]
[
0
,
0
,
0
]
end
end
end
end
end
end
lib/game_event.rb
View file @
d03c8796
...
@@ -53,8 +53,10 @@ class Game_Event
...
@@ -53,8 +53,10 @@ class Game_Event
def
initialize
(
user
)
def
initialize
(
user
)
@user
=
user
@user
=
user
unless
$game
.
users
.
include?
@user
unless
$game
.
users
.
include?
@user
if
@user
.
friend?
if
@user
.
friend?
or
@user
.
role
==
:moderator
$game
.
users
.
unshift
@user
$game
.
users
.
unshift
@user
#p $game.users
#$a = 2
else
else
$game
.
users
<<
@user
$game
.
users
<<
@user
end
end
...
...
lib/main.rb
View file @
d03c8796
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
begin
begin
Windows
=
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
Windows
=
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
Font
=
Windows
?
'fonts/wqy-microhei.ttc'
:
'/usr/share/fonts/wqy-microhei/wqy-microhei.ttc'
Font
=
[
'fonts/wqy-microhei.ttc'
,
'/usr/share/fonts/wqy-microhei/wqy-microhei.ttc'
,
'/usr/share/fonts/truetype/wqy/wqy-microhei.ttc'
].
find
{
|
file
|
File
.
file?
file
}
#System_Encoding = Windows ? "CP#{`chcp`.scan(/\d+$/)}" : `locale |grep LANG |awk -F '=' '{print $2}'`
#System_Encoding = Windows ? "CP#{`chcp`.scan(/\d+$/)}" : `locale |grep LANG |awk -F '=' '{print $2}'`
Dir
.
glob
(
'post_update_*.rb'
).
sort
.
each
{
|
file
|
load
file
}
Dir
.
glob
(
'post_update_*.rb'
).
sort
.
each
{
|
file
|
load
file
}
...
...
lib/resolution.rb
View file @
d03c8796
...
@@ -14,7 +14,7 @@ module Resolution
...
@@ -14,7 +14,7 @@ module Resolution
get_system_metrics
=
Win32API
.
new
"User32.dll"
,
"GetSystemMetrics"
,
[
"L"
],
"L"
get_system_metrics
=
Win32API
.
new
"User32.dll"
,
"GetSystemMetrics"
,
[
"L"
],
"L"
[
get_system_metrics
.
call
(
0
),
get_system_metrics
.
call
(
1
)]
[
get_system_metrics
.
call
(
0
),
get_system_metrics
.
call
(
1
)]
else
else
`x
randr`
.
scan
(
/current (\d+) x (\d+)
/
).
flatten
.
collect
{
|
n
|
n
.
to_i
}
`x
dpyinfo`
.
scan
(
/dimensions: (\d+)x(\d+) pixels
/
).
flatten
.
collect
{
|
n
|
n
.
to_i
}
end
end
end
end
...
...
lib/scene_lobby.rb
View file @
d03c8796
...
@@ -38,48 +38,48 @@ class Scene_Lobby < Scene
...
@@ -38,48 +38,48 @@ class Scene_Lobby < Scene
def
handle
(
event
)
def
handle
(
event
)
case
event
case
event
when
Event
::
KeyDown
when
Event
::
KeyDown
case
event
.
sym
case
event
.
sym
when
Key
::
UP
when
Key
::
UP
@active_window
.
cursor_up
@active_window
.
cursor_up
when
Key
::
DOWN
when
Key
::
DOWN
@active_window
.
cursor_down
@active_window
.
cursor_down
when
Key
::
F2
when
Key
::
F2
#@joinroom_msgbox = Widget_Msgbox.new("创建房间", "正在等待对手")
#@joinroom_msgbox = Widget_Msgbox.new("创建房间", "正在等待对手")
#$game.host Room.new(0, $game.user.name)
#$game.host Room.new(0, $game.user.name)
when
Key
::
F3
when
Key
::
F3
#@joinroom_msgbox = Widget_Msgbox.new("加入房间", "正在加入房间")
#@joinroom_msgbox = Widget_Msgbox.new("加入房间", "正在加入房间")
#$game.join 'localhost'
#$game.join 'localhost'
when
Key
::
F5
when
Key
::
F5
$game
.
refresh
$game
.
refresh
when
Key
::
F12
when
Key
::
F12
$game
.
exit
$game
.
exit
$scene
=
Scene_Login
.
new
$scene
=
Scene_Login
.
new
end
end
else
else
super
super
end
end
end
end
def
handle_game
(
event
)
def
handle_game
(
event
)
case
event
case
event
when
Game_Event
::
AllUsers
when
Game_Event
::
AllUsers
@userlist
.
items
=
$game
.
users
@userlist
.
items
=
$game
.
users
when
Game_Event
::
AllRooms
,
Game_Event
::
AllServers
when
Game_Event
::
AllRooms
,
Game_Event
::
AllServers
@roomlist
.
items
=
$game
.
rooms
.
find_all
{
|
room
|
@roomlist
.
items
=
$game
.
rooms
.
find_all
{
|
room
|
$game
.
filter
[
:servers
].
include?
(
room
.
server
)
and
$game
.
filter
[
:servers
].
include?
(
room
.
server
)
and
$game
.
filter
[
:waiting_only
]
?
(
room
.
status
==
:
wait
)
:
true
and
$game
.
filter
[
:waiting_only
]
?
(
room
.
status
==
:
wait
)
:
true
and
$game
.
filter
[
:normal_only
]
?
(
!
room
.
tag?
&&
(
room
.
ot
==
0
)
&&
(
room
.
lp
=
8000
))
:
true
$game
.
filter
[
:normal_only
]
?
(
!
room
.
tag?
&&
(
room
.
ot
==
0
)
&&
(
room
.
lp
=
8000
))
:
true
}
}
when
Game_Event
::
Join
when
Game_Event
::
Join
join
(
event
.
room
)
join
(
event
.
room
)
when
Game_Event
::
Watch
when
Game_Event
::
Watch
require_relative
'scene_watch'
require_relative
'scene_watch'
$scene
=
Scene_Watch
.
new
(
event
.
room
)
$scene
=
Scene_Watch
.
new
(
event
.
room
)
when
Game_Event
::
Chat
when
Game_Event
::
Chat
@chat_window
.
add
event
.
chatmessage
@chat_window
.
add
event
.
chatmessage
else
else
super
super
end
end
end
end
...
...
lib/user.rb
View file @
d03c8796
require_relative
'cacheable'
require_relative
'cacheable'
class
User
class
User
attr_accessor
:id
,
:name
,
:friend
attr_accessor
:id
,
:name
,
:friend
,
:role
alias
friend?
friend
alias
friend?
friend
extend
Cacheable
extend
Cacheable
def
initialize
(
id
,
name
=
""
)
def
initialize
(
id
,
name
=
""
)
...
...
lib/widget_inputbox.rb
View file @
d03c8796
...
@@ -279,7 +279,7 @@ class Widget_InputBox < Window
...
@@ -279,7 +279,7 @@ class Widget_InputBox < Window
if
RM_IME
.
tab?
if
RM_IME
.
tab?
self
.
value
=
''
if
@proc
.
call
:TAB
self
.
value
=
''
if
@proc
.
call
:TAB
end
end
if
RM_IME
.
enter?
if
RM_IME
.
enter?
and
text
.
empty?
self
.
value
=
''
if
@proc
.
call
:ENTER
self
.
value
=
''
if
@proc
.
call
:ENTER
end
end
end
end
...
...
lib/window_chat.rb
View file @
d03c8796
...
@@ -129,7 +129,7 @@ class Window_Chat < Window_Scrollable
...
@@ -129,7 +129,7 @@ class Window_Chat < Window_Scrollable
chatmessage
,
message
=
@items
[
index
]
chatmessage
,
message
=
@items
[
index
]
if
chatmessage
.
is_a?
ChatMessage
if
chatmessage
.
is_a?
ChatMessage
@font
.
draw_blended_utf8
(
@contents
,
chatmessage
.
user
.
name
+
':'
,
x
,
y
,
*
chatmessage
.
name_color
)
if
chatmessage
.
name_visible?
@font
.
draw_blended_utf8
(
@contents
,
chatmessage
.
user
.
name
+
':'
,
x
,
y
,
*
chatmessage
.
name_color
)
if
chatmessage
.
name_visible?
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
+
name_width
(
chatmessage
),
y
,
*
chatmessage
.
message_color
)
unless
chatmessage
.
message
.
empty?
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
+
name_width
(
chatmessage
),
y
,
*
chatmessage
.
message_color
)
unless
chatmessage
.
message
.
lines
.
first
.
chomp
.
empty?
else
else
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
,
y
,
*
chatmessage
)
unless
message
.
empty?
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
,
y
,
*
chatmessage
)
unless
message
.
empty?
end
end
...
...
lib/window_host.rb
View file @
d03c8796
...
@@ -2,8 +2,8 @@ class Window_Host < Window
...
@@ -2,8 +2,8 @@ class Window_Host < Window
attr_reader
:index
attr_reader
:index
def
initialize
(
x
,
y
)
def
initialize
(
x
,
y
)
@button
=
Surface
.
load
(
"graphics/system/button.png"
)
@button
=
Surface
.
load
(
"graphics/system/button.png"
)
@items
=
{
:ok
=>
[
46
,
240
,
@button
.
w
/
3
,
@button
.
h
],
:cancel
=>
[
156
,
240
,
@button
.
w
/
3
,
@button
.
h
]}
@items
=
{
:ok
=>
[
20
,
240
,
@button
.
w
/
3
,
@button
.
h
],
:cancel
=>
[
110
,
240
,
@button
.
w
/
3
,
@button
.
h
],
:share
=>
[
200
,
240
,
@button
.
w
/
3
,
@button
.
h
]}
@buttons
=
{
:ok
=>
"确定"
,
:cancel
=>
"取消"
}
@buttons
=
{
:ok
=>
"确定"
,
:cancel
=>
"取消"
,
:share
=>
"约战"
}
@background
=
Surface
.
load
(
'graphics/lobby/host.png'
).
display_format
@background
=
Surface
.
load
(
'graphics/lobby/host.png'
).
display_format
super
((
1024
-
@background
.
w
)
/
2
,
230
,
@background
.
w
,
@background
.
h
)
super
((
1024
-
@background
.
w
)
/
2
,
230
,
@background
.
w
,
@background
.
h
)
@font
=
TTF
.
open
(
Font
,
16
)
@font
=
TTF
.
open
(
Font
,
16
)
...
@@ -11,23 +11,23 @@ class Window_Host < Window
...
@@ -11,23 +11,23 @@ class Window_Host < Window
@color
=
[
0x04
,
0x47
,
0x7c
]
@color
=
[
0x04
,
0x47
,
0x7c
]
@roomname_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
,
165
,
WLH
)
@roomname_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
,
165
,
WLH
)
@password_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
+
WLH
,
165
,
WLH
)
@password_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
+
WLH
,
165
,
WLH
)
@lp_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
+
WLH
*
6
+
4
,
64
,
WLH
)
@lp_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
+
WLH
*
5
+
4
,
64
,
WLH
)
@pvp
=
Widget_Checkbox
.
new
(
self
,
33
+
@x
,
@y
+
41
+
WLH
*
2
,
120
,
24
,
false
,
"竞技场"
)
{
|
checked
|
(
@ocg
.
checked
=
true
;
@tcg
.
checked
=
@tag
.
checked
=
false
;
@lp_inputbox
.
value
=
"8000"
)
if
checked
}
@match
=
Widget_Checkbox
.
new
(
self
,
33
+
@x
,
@y
+
41
+
WLH
*
2
,
120
,
24
,
true
,
"三回决斗"
)
{
|
checked
|
@tag
.
checked
=
false
if
checked
}
@pvp
.
background
=
@background
.
copy_rect
(
33
,
70
,
120
,
24
)
@match
.
background
=
@background
.
copy_rect
(
33
,
70
,
120
,
24
)
@match
=
Widget_Checkbox
.
new
(
self
,
120
+
@x
,
@y
+
41
+
WLH
*
2
,
120
,
24
,
true
,
"三回决斗"
){
|
checked
|
@tag
.
checked
=
false
if
checked
}
@match
.
background
=
@background
.
copy_rect
(
120
,
70
,
120
,
24
)
@tag
=
Widget_Checkbox
.
new
(
self
,
150
+
@x
,
@y
+
41
+
WLH
*
2
,
120
,
24
,
false
,
"TAG双打"
)
{
|
checked
|
@match
.
checked
=
false
if
checked
}
@tag
=
Widget_Checkbox
.
new
(
self
,
33
+
@x
,
@y
+
41
+
WLH
*
4
+
4
,
120
,
24
,
false
,
"TAG双打"
){
|
checked
|
@pvp
.
checked
=
@match
.
checked
=
false
if
checked
}
@tag
.
background
=
@background
.
copy_rect
(
150
,
70
,
120
,
24
)
@tag
.
background
=
@background
.
copy_rect
(
120
,
70
,
120
,
24
)
@ocg
=
Widget_Checkbox
.
new
(
self
,
33
+
@x
,
@y
+
41
+
WLH
*
5
+
4
,
120
,
24
,
true
,
"OCG"
){
|
checked
|
@tcg
.
checked
=
true
if
!
checked
}
@ocg
=
Widget_Checkbox
.
new
(
self
,
33
+
@x
,
@y
+
41
+
WLH
*
4
+
4
,
120
,
24
,
true
,
"OCG"
){
|
checked
|
@tcg
.
checked
=
true
if
!
checked
}
@ocg
.
background
=
@background
.
copy_rect
(
120
,
70
,
120
,
24
)
@ocg
.
background
=
@background
.
copy_rect
(
120
,
70
,
120
,
24
)
@tcg
=
Widget_Checkbox
.
new
(
self
,
120
+
@x
,
@y
+
41
+
WLH
*
5
+
4
,
120
,
24
,
false
,
"TCG"
){
|
checked
|
@pvp
.
checked
=
false
if
checked
;
@ocg
.
checked
=
true
if
!
checked
}
@tcg
=
Widget_Checkbox
.
new
(
self
,
120
+
@x
,
@y
+
41
+
WLH
*
4
+
4
,
120
,
24
,
false
,
"TCG"
){
|
checked
|
@ocg
.
checked
=
true
if
!
checked
}
@tcg
.
background
=
@background
.
copy_rect
(
120
,
70
,
120
,
24
)
@tcg
.
background
=
@background
.
copy_rect
(
120
,
70
,
120
,
24
)
@roomname_inputbox
.
value
=
rand
(
1000
).
to_s
@roomname_inputbox
.
value
=
rand
(
1000
).
to_s
@lp_inputbox
.
value
=
8000
.
to_s
@lp_inputbox
.
value
=
8000
.
to_s
@password_inputbox
.
refresh
@password_inputbox
.
refresh
@pvp
.
refresh
@match
.
refresh
@match
.
refresh
@tag
.
refresh
@tag
.
refresh
@ocg
.
refresh
@ocg
.
refresh
...
@@ -40,8 +40,9 @@ class Window_Host < Window
...
@@ -40,8 +40,9 @@ class Window_Host < Window
@font
.
draw_blended_utf8
(
@contents
,
"房间名"
,
33
,
43
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"房间名"
,
33
,
43
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"房间密码"
,
33
,
43
+
WLH
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"房间密码"
,
33
,
43
+
WLH
,
*
@color
)
@contents
.
fill_rect
(
4
,
43
+
WLH
*
3
,
@contents
.
w
-
8
,
2
,
0xAA0A7AC5
)
@contents
.
fill_rect
(
4
,
43
+
WLH
*
3
,
@contents
.
w
-
8
,
2
,
0xAA0A7AC5
)
@font
.
draw_blended_utf8
(
@contents
,
"自定义模式"
,
20
,
43
+
WLH
*
3
+
4
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"卡片允许"
,
20
,
43
+
WLH
*
3
+
4
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"初始LP"
,
33
,
44
+
WLH
*
6
+
4
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"初始LP"
,
20
,
44
+
WLH
*
5
+
4
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"约战时建议设置房间密码以防乱入"
,
20
,
44
+
WLH
*
6
+
4
,
*
@color
)
@items
.
each_key
do
|
index
|
@items
.
each_key
do
|
index
|
draw_item
(
index
,
self
.
index
==
index
?
1
:
0
)
draw_item
(
index
,
self
.
index
==
index
?
1
:
0
)
end
end
...
@@ -80,7 +81,7 @@ class Window_Host < Window
...
@@ -80,7 +81,7 @@ class Window_Host < Window
end
end
def
clicked
def
clicked
case
self
.
index
case
self
.
index
when
:ok
when
:ok
,
:share
if
@roomname_inputbox
.
value
.
empty?
if
@roomname_inputbox
.
value
.
empty?
Widget_Msgbox
.
new
(
"建立房间"
,
"请输入房间名"
,
ok:
"确定"
)
Widget_Msgbox
.
new
(
"建立房间"
,
"请输入房间名"
,
ok:
"确定"
)
elsif
!
name_check
elsif
!
name_check
...
@@ -90,7 +91,34 @@ class Window_Host < Window
...
@@ -90,7 +91,34 @@ class Window_Host < Window
else
else
Widget_Msgbox
.
new
(
"建立房间"
,
"正在建立房间"
)
Widget_Msgbox
.
new
(
"建立房间"
,
"正在建立房间"
)
destroy
destroy
$game
.
host
(
@roomname_inputbox
.
value
,
password:
@password_inputbox
.
value
,
pvp:
@pvp
.
checked?
,
match:
@match
.
checked?
,
tag:
@tag
.
checked?
,
ot:
@tcg
.
checked?
?
@ocg
.
checked?
?
2
:
1
:
0
,
lp:
@lp_inputbox
.
value
.
to_i
)
room
=
$game
.
host
(
@roomname_inputbox
.
value
,
password:
@password_inputbox
.
value
,
match:
@match
.
checked?
,
tag:
@tag
.
checked?
,
ot:
@tcg
.
checked?
?
@ocg
.
checked?
?
2
:
1
:
0
,
lp:
@lp_inputbox
.
value
.
to_i
)
if
room
and
self
.
index
==
:share
require
'uri'
room_name
=
if
room
.
ot
!=
0
or
room
.
lp
!=
8000
mode
=
case
when
room
.
match?
then
1
;
when
room
.
tag?
then
2
else
0
end
room_name
=
"
#{
room
.
ot
}#{
mode
}
FFF
#{
room
.
lp
}
,5,1,
#{
room
.
name
}
"
elsif
room
.
tag?
"T#"
+
room
.
name
elsif
room
.
pvp?
and
room
.
match?
"PM#"
+
room
.
name
elsif
room
.
pvp?
"P#"
+
room
.
name
elsif
room
.
match?
"M#"
+
room
.
name
else
room
.
name
end
if
room
.
password
and
!
room
.
password
.
empty?
room_name
+=
"$"
+
room
.
password
end
Dialog
.
web
(
"http://my-card.in/rooms/
#{
room
.
server
.
ip
}
:
#{
room
.
server
.
port
}
/
#{
URI
.
escape
(
room_name
)
}#{
'?server_auth=true'
if
room
.
server
.
auth
}
#share"
)
end
end
end
when
:cancel
when
:cancel
destroy
destroy
...
@@ -100,7 +128,6 @@ class Window_Host < Window
...
@@ -100,7 +128,6 @@ class Window_Host < Window
@roomname_inputbox
.
destroy
@roomname_inputbox
.
destroy
@password_inputbox
.
destroy
@password_inputbox
.
destroy
@lp_inputbox
.
destroy
@lp_inputbox
.
destroy
@pvp
.
destroy
@match
.
destroy
@match
.
destroy
@tag
.
destroy
@tag
.
destroy
@ocg
.
destroy
@ocg
.
destroy
...
@@ -121,10 +148,9 @@ class Window_Host < Window
...
@@ -121,10 +148,9 @@ class Window_Host < Window
if
@tcg
.
checked
#代码自定义房
if
@tcg
.
checked
#代码自定义房
max
=
5
max
=
5
max
-=
1
if
name
.
ascii_only?
max
-=
1
if
name
.
ascii_only?
elsif
@
pvp
.
checked
or
@
match
.
checked
or
@tag
.
checked
elsif
@match
.
checked
or
@tag
.
checked
# 去掉那个#占用的
# 去掉那个#占用的
max
=
12
max
=
12
max
-=
1
if
@pvp
.
checked
max
-=
1
if
@match
.
checked
max
-=
1
if
@match
.
checked
max
-=
1
if
@tag
.
checked
max
-=
1
if
@tag
.
checked
else
else
...
...
lib/window_lobbybuttons.rb
View file @
d03c8796
...
@@ -55,9 +55,10 @@ class Window_LobbyButtons < Window_List
...
@@ -55,9 +55,10 @@ class Window_LobbyButtons < Window_List
begin
begin
open
(
'https://my-card.in/match'
)
{
|
f
|
open
(
'https://my-card.in/match'
)
{
|
f
|
@waiting
=
false
@waiting
=
false
if
f
.
read
=~
/^mycard:\/\/([\d\.]+):(\d+)\/(.*)$/
if
f
.
read
=~
/^mycard:\/\/([\d\.]+):(\d+)\/(.*?)(\?server_auth=true)?$/
room
=
Room
.
new
(
nil
,
$3
.
to_s
)
room
=
Room
.
new
(
nil
,
$3
.
to_s
)
room
.
server
=
Server
.
new
(
nil
,
nil
,
$1
,
$2
.
to_i
,
false
)
room
.
server
=
Server
.
new
(
nil
,
nil
,
$1
,
$2
.
to_i
,
!!
$4
)
$game
.
join
(
room
)
$game
.
join
(
room
)
else
else
$log
.
error
(
'自动匹配非法回复'
){
f
.
read
}
$log
.
error
(
'自动匹配非法回复'
){
f
.
read
}
...
...
lib/ygocore/game.rb
View file @
d03c8796
...
@@ -49,17 +49,21 @@ class Ygocore < Game
...
@@ -49,17 +49,21 @@ class Ygocore < Game
Game_Event
.
push
(
Game_Event
::
Chat
.
new
(
ChatMessage
.
new
(
User
.
new
(
:system
,
'System'
),
'聊天服务连接中断: '
+
exception
.
to_s
)))
Game_Event
.
push
(
Game_Event
::
Chat
.
new
(
ChatMessage
.
new
(
User
.
new
(
:system
,
'System'
),
'聊天服务连接中断: '
+
exception
.
to_s
)))
end
end
@@im_room
.
add_message_callback
do
|
m
|
@@im_room
.
add_message_callback
do
|
m
|
user
=
m
.
from
.
resource
==
nickname
?
@user
:
User
.
new
(
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
)
if
m
.
from
.
resource
and
m
.
body
Game_Event
.
push
Game_Event
::
Chat
.
new
ChatMessage
.
new
(
user
,
m
.
body
,
:lobby
)
rescue
$log
.
error
(
'收到聊天消息'
)
{
$!
}
user
=
m
.
from
.
resource
==
nickname
?
@user
:
User
.
new
(
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
)
Game_Event
.
push
Game_Event
::
Chat
.
new
ChatMessage
.
new
(
user
,
m
.
body
,
:lobby
)
rescue
$log
.
error
(
'收到聊天消息'
)
{
$!
}
end
end
end
@@im_room
.
add_private_message_callback
do
|
m
|
@@im_room
.
add_private_message_callback
do
|
m
|
if
m
.
body
#忽略无消息的正在输入等内容
if
m
.
from
.
resource
and
m
.
body
#忽略无消息的正在输入等内容
user
=
m
.
from
.
resource
==
nickname
?
@user
:
User
.
new
(
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
)
user
=
m
.
from
.
resource
==
nickname
?
@user
:
User
.
new
(
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
)
Game_Event
.
push
Game_Event
::
Chat
.
new
ChatMessage
.
new
(
user
,
m
.
body
,
user
)
rescue
$log
.
error
(
'收到私聊消息'
)
{
$!
}
Game_Event
.
push
Game_Event
::
Chat
.
new
ChatMessage
.
new
(
user
,
m
.
body
,
user
)
rescue
$log
.
error
(
'收到私聊消息'
)
{
$!
}
end
end
end
end
@@im_room
.
add_join_callback
do
|
m
|
@@im_room
.
add_join_callback
do
|
m
|
Game_Event
.
push
Game_Event
::
NewUser
.
new
User
.
new
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
user
=
User
.
new
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
user
.
role
=
m
.
x
.
first_element
(
'item'
).
role
rescue
nil
Game_Event
.
push
Game_Event
::
NewUser
.
new
user
end
end
@@im_room
.
add_leave_callback
do
|
m
|
@@im_room
.
add_leave_callback
do
|
m
|
Game_Event
.
push
Game_Event
::
MissingUser
.
new
User
.
new
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
Game_Event
.
push
Game_Event
::
MissingUser
.
new
User
.
new
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
...
@@ -171,7 +175,7 @@ class Ygocore < Game
...
@@ -171,7 +175,7 @@ class Ygocore < Game
retry
retry
end
end
end
end
Game_Event
.
push
Game_Event
::
AllUsers
.
new
@@im_room
.
roster
.
keys
.
collect
{
|
nick
|
User
.
new
(
nick
.
to_sym
,
nick
)
}
rescue
p
$!
#
Game_Event.push Game_Event::AllUsers.new @@im_room.roster.keys.collect { |nick| User.new(nick.to_sym, nick) } rescue p $!
end
end
rescue
StandardError
=>
exception
rescue
StandardError
=>
exception
$log
.
error
(
'聊天连接出错'
)
{
exception
}
$log
.
error
(
'聊天连接出错'
)
{
exception
}
...
@@ -214,8 +218,10 @@ class Ygocore < Game
...
@@ -214,8 +218,10 @@ class Ygocore < Game
if
$game
.
rooms
.
any?
{
|
game_room
|
game_room
.
name
==
room_name
}
if
$game
.
rooms
.
any?
{
|
game_room
|
game_room
.
name
==
room_name
}
Widget_Msgbox
.
new
(
"建立房间"
,
"房间名已存在"
,
:ok
=>
"确定"
)
Widget_Msgbox
.
new
(
"建立房间"
,
"房间名已存在"
,
:ok
=>
"确定"
)
false
else
else
Game_Event
.
push
Game_Event
::
Join
.
new
(
room
)
Game_Event
.
push
Game_Event
::
Join
.
new
(
room
)
room
end
end
end
end
...
@@ -285,7 +291,7 @@ class Ygocore < Game
...
@@ -285,7 +291,7 @@ class Ygocore < Game
system_conf
[
'textfont'
]
=
"
#{
font_path
}
14"
system_conf
[
'textfont'
]
=
"
#{
font_path
}
14"
end
end
if
!
File
.
file?
(
system_conf
[
'numfont'
])
if
!
File
.
file?
(
system_conf
[
'numfont'
])
system_conf
[
'
text
font'
]
=
Windows
?
'c:/windows/fonts/arialbd.ttf'
:
'/usr/share/fonts/gnu-free/FreeSansBold.ttf'
system_conf
[
'
num
font'
]
=
Windows
?
'c:/windows/fonts/arialbd.ttf'
:
'/usr/share/fonts/gnu-free/FreeSansBold.ttf'
end
end
options
.
each
do
|
key
,
value
|
options
.
each
do
|
key
,
value
|
system_conf
[
key
]
=
value
system_conf
[
key
]
=
value
...
...
lib/ygocore/room.rb
View file @
d03c8796
...
@@ -47,8 +47,6 @@ class Room
...
@@ -47,8 +47,6 @@ class Room
server
=
servers
.
min_by
{
|
server
|
$game
.
rooms
.
select
{
|
room
|
room
.
server
==
server
}.
size
}
server
=
servers
.
min_by
{
|
server
|
$game
.
rooms
.
select
{
|
room
|
room
.
server
==
server
}.
size
}
p
server
server
||=
Server
.
new
(
nil
,
""
,
$game
.
server
,
$game
.
port
,
true
)
server
||=
Server
.
new
(
nil
,
""
,
$game
.
server
,
$game
.
port
,
true
)
self
.
server
=
server
self
.
server
=
server
server
server
...
...
lib/ygocore/user.rb
View file @
d03c8796
...
@@ -11,7 +11,12 @@ class User
...
@@ -11,7 +11,12 @@ class User
@certified
=
certified
unless
certified
==
:keep
@certified
=
certified
unless
certified
==
:keep
end
end
def
color
def
color
@certified
?
[
0
,
0
,
0
]
:
[
128
,
128
,
128
]
case
@role
when
:moderator
[
148
,
43
,
226
]
else
@certified
?
[
0
,
0
,
0
]
:
[
128
,
128
,
128
]
end
end
end
def
space
def
space
if
@certified
if
@certified
...
...
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