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
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
@message
=
message
@channel
=
channel
@time
=
time
end
def
name_visible?
case
channel
when
Symbol
true
when
Room
!
channel
.
include?
(
user
)
when
User
false
when
Symbol
true
when
Room
!
channel
.
include?
(
user
)
when
User
false
end
end
def
name_color
if
user
==
$game
.
user
[
0
,
128
,
0
]
else
[
0
,
0
,
255
]
case
user
.
role
when
:moderator
[
148
,
43
,
226
]
else
user
==
$game
.
user
?
[
0
,
128
,
0
]
:
[
0
,
0
,
255
]
end
end
def
message_color
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
)
[
0
,
128
,
0
]
[
0
,
128
,
0
]
else
[
255
,
0
,
0
]
[
255
,
0
,
0
]
end
end
def
self
.
channel_name
(
channel
)
case
channel
when
:lobby
"#大厅"
when
Symbol
"#
#{
channel
}
"
when
Room
"[
#{
channel
.
name
}
]"
when
User
"@
#{
channel
.
name
}
"
else
channel
when
:lobby
"#大厅"
when
Symbol
"#
#{
channel
}
"
when
Room
"[
#{
channel
.
name
}
]"
when
User
"@
#{
channel
.
name
}
"
else
channel
end
end
def
self
.
channel_color
(
channel
)
case
channel
when
Symbol
[
0x34
,
0x92
,
0xEA
]
when
Room
[
0xF2
,
0x83
,
0xC4
]
when
Symbol
[
0x34
,
0x92
,
0xEA
]
when
Room
[
0xF2
,
0x83
,
0xC4
]
#[255,250,240]
when
User
[
0xFA
,
0x27
,
0x27
]
else
[
0
,
0
,
0
]
when
User
[
0xFA
,
0x27
,
0x27
]
else
[
0
,
0
,
0
]
end
end
end
lib/game_event.rb
View file @
d03c8796
...
...
@@ -53,8 +53,10 @@ class Game_Event
def
initialize
(
user
)
@user
=
user
unless
$game
.
users
.
include?
@user
if
@user
.
friend?
if
@user
.
friend?
or
@user
.
role
==
:moderator
$game
.
users
.
unshift
@user
#p $game.users
#$a = 2
else
$game
.
users
<<
@user
end
...
...
lib/main.rb
View file @
d03c8796
...
...
@@ -2,7 +2,7 @@
begin
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}'`
Dir
.
glob
(
'post_update_*.rb'
).
sort
.
each
{
|
file
|
load
file
}
...
...
lib/resolution.rb
View file @
d03c8796
...
...
@@ -14,7 +14,7 @@ module Resolution
get_system_metrics
=
Win32API
.
new
"User32.dll"
,
"GetSystemMetrics"
,
[
"L"
],
"L"
[
get_system_metrics
.
call
(
0
),
get_system_metrics
.
call
(
1
)]
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
...
...
lib/scene_lobby.rb
View file @
d03c8796
...
...
@@ -38,48 +38,48 @@ class Scene_Lobby < Scene
def
handle
(
event
)
case
event
when
Event
::
KeyDown
case
event
.
sym
when
Key
::
UP
@active_window
.
cursor_up
when
Key
::
DOWN
@active_window
.
cursor_down
when
Key
::
F2
#@joinroom_msgbox = Widget_Msgbox.new("创建房间", "正在等待对手")
#$game.host Room.new(0, $game.user.name)
when
Key
::
F3
#@joinroom_msgbox = Widget_Msgbox.new("加入房间", "正在加入房间")
#$game.join 'localhost'
when
Key
::
F5
$game
.
refresh
when
Key
::
F12
$game
.
exit
$scene
=
Scene_Login
.
new
end
else
super
when
Event
::
KeyDown
case
event
.
sym
when
Key
::
UP
@active_window
.
cursor_up
when
Key
::
DOWN
@active_window
.
cursor_down
when
Key
::
F2
#@joinroom_msgbox = Widget_Msgbox.new("创建房间", "正在等待对手")
#$game.host Room.new(0, $game.user.name)
when
Key
::
F3
#@joinroom_msgbox = Widget_Msgbox.new("加入房间", "正在加入房间")
#$game.join 'localhost'
when
Key
::
F5
$game
.
refresh
when
Key
::
F12
$game
.
exit
$scene
=
Scene_Login
.
new
end
else
super
end
end
def
handle_game
(
event
)
case
event
when
Game_Event
::
AllUsers
@userlist
.
items
=
$game
.
users
when
Game_Event
::
AllRooms
,
Game_Event
::
AllServers
@roomlist
.
items
=
$game
.
rooms
.
find_all
{
|
room
|
$game
.
filter
[
:servers
].
include?
(
room
.
server
)
and
$game
.
filter
[
:waiting_only
]
?
(
room
.
status
==
:
wait
)
:
true
and
$game
.
filter
[
:normal_only
]
?
(
!
room
.
tag?
&&
(
room
.
ot
==
0
)
&&
(
room
.
lp
=
8000
))
:
true
}
when
Game_Event
::
Join
join
(
event
.
room
)
when
Game_Event
::
Watch
require_relative
'scene_watch'
$scene
=
Scene_Watch
.
new
(
event
.
room
)
when
Game_Event
::
Chat
@chat_window
.
add
event
.
chatmessage
else
super
when
Game_Event
::
AllUsers
@userlist
.
items
=
$game
.
users
when
Game_Event
::
AllRooms
,
Game_Event
::
AllServers
@roomlist
.
items
=
$game
.
rooms
.
find_all
{
|
room
|
$game
.
filter
[
:servers
].
include?
(
room
.
server
)
and
$game
.
filter
[
:waiting_only
]
?
(
room
.
status
==
:
wait
)
:
true
and
$game
.
filter
[
:normal_only
]
?
(
!
room
.
tag?
&&
(
room
.
ot
==
0
)
&&
(
room
.
lp
=
8000
))
:
true
}
when
Game_Event
::
Join
join
(
event
.
room
)
when
Game_Event
::
Watch
require_relative
'scene_watch'
$scene
=
Scene_Watch
.
new
(
event
.
room
)
when
Game_Event
::
Chat
@chat_window
.
add
event
.
chatmessage
else
super
end
end
...
...
lib/user.rb
View file @
d03c8796
require_relative
'cacheable'
class
User
attr_accessor
:id
,
:name
,
:friend
attr_accessor
:id
,
:name
,
:friend
,
:role
alias
friend?
friend
extend
Cacheable
def
initialize
(
id
,
name
=
""
)
...
...
lib/widget_inputbox.rb
View file @
d03c8796
...
...
@@ -279,7 +279,7 @@ class Widget_InputBox < Window
if
RM_IME
.
tab?
self
.
value
=
''
if
@proc
.
call
:TAB
end
if
RM_IME
.
enter?
if
RM_IME
.
enter?
and
text
.
empty?
self
.
value
=
''
if
@proc
.
call
:ENTER
end
end
...
...
lib/window_chat.rb
View file @
d03c8796
...
...
@@ -129,7 +129,7 @@ class Window_Chat < Window_Scrollable
chatmessage
,
message
=
@items
[
index
]
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
,
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
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
,
y
,
*
chatmessage
)
unless
message
.
empty?
end
...
...
lib/window_host.rb
View file @
d03c8796
...
...
@@ -2,8 +2,8 @@ class Window_Host < Window
attr_reader
:index
def
initialize
(
x
,
y
)
@button
=
Surface
.
load
(
"graphics/system/button.png"
)
@items
=
{
:ok
=>
[
46
,
240
,
@button
.
w
/
3
,
@button
.
h
],
:cancel
=>
[
156
,
240
,
@button
.
w
/
3
,
@button
.
h
]}
@buttons
=
{
:ok
=>
"确定"
,
:cancel
=>
"取消"
}
@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
=>
"取消"
,
:share
=>
"约战"
}
@background
=
Surface
.
load
(
'graphics/lobby/host.png'
).
display_format
super
((
1024
-
@background
.
w
)
/
2
,
230
,
@background
.
w
,
@background
.
h
)
@font
=
TTF
.
open
(
Font
,
16
)
...
...
@@ -11,23 +11,23 @@ class Window_Host < Window
@color
=
[
0x04
,
0x47
,
0x7c
]
@roomname_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
,
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
)
@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
}
@pvp
.
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
,
33
+
@x
,
@y
+
41
+
WLH
*
4
+
4
,
120
,
24
,
false
,
"TAG双打"
){
|
checked
|
@pvp
.
checked
=
@match
.
checked
=
false
if
checked
}
@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
}
@lp_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
+
WLH
*
5
+
4
,
64
,
WLH
)
@match
=
Widget_Checkbox
.
new
(
self
,
33
+
@x
,
@y
+
41
+
WLH
*
2
,
120
,
24
,
true
,
"三回决斗"
)
{
|
checked
|
@tag
.
checked
=
false
if
checked
}
@match
.
background
=
@background
.
copy_rect
(
33
,
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
.
background
=
@background
.
copy_rect
(
150
,
70
,
120
,
24
)
@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
)
@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
)
@roomname_inputbox
.
value
=
rand
(
1000
).
to_s
@lp_inputbox
.
value
=
8000
.
to_s
@password_inputbox
.
refresh
@pvp
.
refresh
@match
.
refresh
@tag
.
refresh
@ocg
.
refresh
...
...
@@ -40,8 +40,9 @@ class Window_Host < Window
@font
.
draw_blended_utf8
(
@contents
,
"房间名"
,
33
,
43
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"房间密码"
,
33
,
43
+
WLH
,
*
@color
)
@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
,
"初始LP"
,
33
,
44
+
WLH
*
6
+
4
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"卡片允许"
,
20
,
43
+
WLH
*
3
+
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
|
draw_item
(
index
,
self
.
index
==
index
?
1
:
0
)
end
...
...
@@ -80,7 +81,7 @@ class Window_Host < Window
end
def
clicked
case
self
.
index
when
:ok
when
:ok
,
:share
if
@roomname_inputbox
.
value
.
empty?
Widget_Msgbox
.
new
(
"建立房间"
,
"请输入房间名"
,
ok:
"确定"
)
elsif
!
name_check
...
...
@@ -90,7 +91,34 @@ class Window_Host < Window
else
Widget_Msgbox
.
new
(
"建立房间"
,
"正在建立房间"
)
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
when
:cancel
destroy
...
...
@@ -100,7 +128,6 @@ class Window_Host < Window
@roomname_inputbox
.
destroy
@password_inputbox
.
destroy
@lp_inputbox
.
destroy
@pvp
.
destroy
@match
.
destroy
@tag
.
destroy
@ocg
.
destroy
...
...
@@ -121,10 +148,9 @@ class Window_Host < Window
if
@tcg
.
checked
#代码自定义房
max
=
5
max
-=
1
if
name
.
ascii_only?
elsif
@
pvp
.
checked
or
@
match
.
checked
or
@tag
.
checked
elsif
@match
.
checked
or
@tag
.
checked
# 去掉那个#占用的
max
=
12
max
-=
1
if
@pvp
.
checked
max
-=
1
if
@match
.
checked
max
-=
1
if
@tag
.
checked
else
...
...
lib/window_lobbybuttons.rb
View file @
d03c8796
...
...
@@ -55,9 +55,10 @@ class Window_LobbyButtons < Window_List
begin
open
(
'https://my-card.in/match'
)
{
|
f
|
@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
.
server
=
Server
.
new
(
nil
,
nil
,
$1
,
$2
.
to_i
,
false
)
room
.
server
=
Server
.
new
(
nil
,
nil
,
$1
,
$2
.
to_i
,
!!
$4
)
$game
.
join
(
room
)
else
$log
.
error
(
'自动匹配非法回复'
){
f
.
read
}
...
...
lib/ygocore/game.rb
View file @
d03c8796
...
...
@@ -49,17 +49,21 @@ class Ygocore < Game
Game_Event
.
push
(
Game_Event
::
Chat
.
new
(
ChatMessage
.
new
(
User
.
new
(
:system
,
'System'
),
'聊天服务连接中断: '
+
exception
.
to_s
)))
end
@@im_room
.
add_message_callback
do
|
m
|
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
(
'收到聊天消息'
)
{
$!
}
if
m
.
from
.
resource
and
m
.
body
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
@@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
)
Game_Event
.
push
Game_Event
::
Chat
.
new
ChatMessage
.
new
(
user
,
m
.
body
,
user
)
rescue
$log
.
error
(
'收到私聊消息'
)
{
$!
}
end
end
@@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
@@im_room
.
add_leave_callback
do
|
m
|
Game_Event
.
push
Game_Event
::
MissingUser
.
new
User
.
new
m
.
from
.
resource
.
to_sym
,
m
.
from
.
resource
...
...
@@ -171,7 +175,7 @@ class Ygocore < Game
retry
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
rescue
StandardError
=>
exception
$log
.
error
(
'聊天连接出错'
)
{
exception
}
...
...
@@ -214,8 +218,10 @@ class Ygocore < Game
if
$game
.
rooms
.
any?
{
|
game_room
|
game_room
.
name
==
room_name
}
Widget_Msgbox
.
new
(
"建立房间"
,
"房间名已存在"
,
:ok
=>
"确定"
)
false
else
Game_Event
.
push
Game_Event
::
Join
.
new
(
room
)
room
end
end
...
...
@@ -285,7 +291,7 @@ class Ygocore < Game
system_conf
[
'textfont'
]
=
"
#{
font_path
}
14"
end
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
options
.
each
do
|
key
,
value
|
system_conf
[
key
]
=
value
...
...
lib/ygocore/room.rb
View file @
d03c8796
...
...
@@ -47,8 +47,6 @@ class Room
server
=
servers
.
min_by
{
|
server
|
$game
.
rooms
.
select
{
|
room
|
room
.
server
==
server
}.
size
}
p
server
server
||=
Server
.
new
(
nil
,
""
,
$game
.
server
,
$game
.
port
,
true
)
self
.
server
=
server
server
...
...
lib/ygocore/user.rb
View file @
d03c8796
...
...
@@ -11,7 +11,12 @@ class User
@certified
=
certified
unless
certified
==
:keep
end
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
def
space
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