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
cd5faab0
Commit
cd5faab0
authored
May 15, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.6.0,TAG,密码房
parent
77a785ca
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
200 additions
and
35 deletions
+200
-35
Rakefile
Rakefile
+1
-1
graphics/lobby/host.png
graphics/lobby/host.png
+0
-0
lib/iduel/game.rb
lib/iduel/game.rb
+2
-8
lib/room.rb
lib/room.rb
+1
-0
lib/scene_lobby.rb
lib/scene_lobby.rb
+1
-0
lib/update.rb
lib/update.rb
+1
-1
lib/widget_checkbox.rb
lib/widget_checkbox.rb
+4
-0
lib/widget_msgbox.rb
lib/widget_msgbox.rb
+1
-1
lib/window_host.rb
lib/window_host.rb
+63
-18
lib/window_join.rb
lib/window_join.rb
+85
-0
lib/window_roomlist.rb
lib/window_roomlist.rb
+10
-3
lib/ygocore/event.rb
lib/ygocore/event.rb
+3
-0
lib/ygocore/game.rb
lib/ygocore/game.rb
+12
-1
lib/ygocore/room.rb
lib/ygocore/room.rb
+16
-2
No files found.
Rakefile
View file @
cd5faab0
...
@@ -24,7 +24,7 @@ end
...
@@ -24,7 +24,7 @@ end
spec
=
Gem
::
Specification
.
new
do
|
s
|
spec
=
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
'mycard'
s
.
name
=
'mycard'
s
.
version
=
'0.
5.8
'
s
.
version
=
'0.
6.0
'
s
.
extra_rdoc_files
=
[
'README.txt'
,
'LICENSE.txt'
]
s
.
extra_rdoc_files
=
[
'README.txt'
,
'LICENSE.txt'
]
s
.
summary
=
'a card game'
s
.
summary
=
'a card game'
s
.
description
=
s
.
summary
s
.
description
=
s
.
summary
...
...
graphics/lobby/host.png
0 → 100644
View file @
cd5faab0
This diff was suppressed by a .gitattributes entry.
lib/iduel/game.rb
View file @
cd5faab0
...
@@ -164,15 +164,9 @@ class Iduel < Game
...
@@ -164,15 +164,9 @@ class Iduel < Game
Thread
.
new
do
Thread
.
new
do
begin
begin
open
(
'http://www.duelcn.com/topic-Announce.html'
)
do
|
file
|
open
(
'http://www.duelcn.com/topic-Announce.html'
)
do
|
file
|
file
.
set_encoding
"GBK"
announcements
=
[]
announcements
=
[]
file
.
read
.
scan
(
/<li><em>(.*?)<\/em><a href="(.*?)" title="(.*?)" target="_blank">.*?<\/a><\/li>/
).
each
do
|
time
,
url
,
title
|
file
.
read
.
scan
(
/<li><a href="(.*?)" title="(.*?)" target="_blank">/
).
each
do
|
url
,
title
|
if
time
=~
/(\d+)-(\d+)-(\d+)/
announcements
<<
Announcement
.
new
(
title
.
encode
(
"UTF-8"
),
"http://www.duelcn.com/
#{
url
}
"
,
nil
)
time
=
Time
.
new
(
$1
,
$2
,
$3
)
else
time
=
nil
end
announcements
<<
Announcement
.
new
(
title
.
encode
(
"UTF-8"
),
"http://www.duelcn.com/
#{
url
}
"
,
time
)
end
end
$config
[
'iDuel'
][
'announcements'
].
replace
announcements
$config
[
'iDuel'
][
'announcements'
].
replace
announcements
save_config
save_config
...
...
lib/room.rb
View file @
cd5faab0
...
@@ -3,6 +3,7 @@ class Room
...
@@ -3,6 +3,7 @@ class Room
Color
=
[[
0
,
0
,
0
],
[
255
,
0
,
0
],
[
0
,
128
,
0
],
[
0
,
0
,
255
],
[
255
,
165
,
0
]]
Color
=
[[
0
,
0
,
0
],
[
255
,
0
,
0
],
[
0
,
128
,
0
],
[
0
,
0
,
255
],
[
255
,
165
,
0
]]
extend
Cacheable
extend
Cacheable
attr_accessor
:id
,
:name
,
:player1
,
:player2
,
:private
,
:color
,
:forbid
attr_accessor
:id
,
:name
,
:player1
,
:player2
,
:private
,
:color
,
:forbid
attr_accessor
:password
def
initialize
(
id
,
name
=
"等待更新"
,
player1
=
nil
,
player2
=
nil
,
private
=
false
,
color
=
[
0
,
0
,
0
],
session
=
nil
,
forbid
=
nil
)
def
initialize
(
id
,
name
=
"等待更新"
,
player1
=
nil
,
player2
=
nil
,
private
=
false
,
color
=
[
0
,
0
,
0
],
session
=
nil
,
forbid
=
nil
)
@id
=
id
@id
=
id
@name
=
name
@name
=
name
...
...
lib/scene_lobby.rb
View file @
cd5faab0
...
@@ -80,6 +80,7 @@ class Scene_Lobby < Scene
...
@@ -80,6 +80,7 @@ class Scene_Lobby < Scene
def
update
def
update
@chat_window
.
update
@chat_window
.
update
@host_window
.
update
@host_window
.
update
@roomlist
.
update
if
@count
>=
$game
.
refresh_interval
*
60
if
@count
>=
$game
.
refresh_interval
*
60
$game
.
refresh
$game
.
refresh
@count
=
0
@count
=
0
...
...
lib/update.rb
View file @
cd5faab0
...
@@ -2,7 +2,7 @@ require 'open-uri'
...
@@ -2,7 +2,7 @@ require 'open-uri'
require
"fileutils"
require
"fileutils"
require_relative
'card'
require_relative
'card'
module
Update
module
Update
Version
=
'0.
5.8
'
Version
=
'0.
6.0
'
URL
=
"http://card.touhou.cc/mycard/update.json?version=
#{
Version
}
"
URL
=
"http://card.touhou.cc/mycard/update.json?version=
#{
Version
}
"
class
<<
self
class
<<
self
attr_reader
:thumbnails
,
:images
,
:status
attr_reader
:thumbnails
,
:images
,
:status
...
...
lib/widget_checkbox.rb
View file @
cd5faab0
...
@@ -14,6 +14,10 @@ class Widget_Checkbox < Window
...
@@ -14,6 +14,10 @@ class Widget_Checkbox < Window
@proc
=
proc
@proc
=
proc
refresh
refresh
end
end
def
checked
=
(
checked
)
@checked
=
checked
refresh
end
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
if
x
-
@x
<
24
if
x
-
@x
<
24
@index
=
0
@index
=
0
...
...
lib/widget_msgbox.rb
View file @
cd5faab0
...
@@ -17,7 +17,7 @@ class Widget_Msgbox < Window
...
@@ -17,7 +17,7 @@ class Widget_Msgbox < Window
@contents
=
Surface
.
load
(
'graphics/system/msgbox.png'
).
display_format
@contents
=
Surface
.
load
(
'graphics/system/msgbox.png'
).
display_format
@button
=
Surface
.
load
(
'graphics/system/button.png'
)
@button
=
Surface
.
load
(
'graphics/system/button.png'
)
@font
=
TTF
.
open
(
"fonts/wqy-microhei.ttc"
,
16
)
@font
=
TTF
.
open
(
"fonts/wqy-microhei.ttc"
,
16
)
super
((
1024
-
@contents
.
w
)
/
2
,
230
,
@contents
.
w
,
@contents
.
h
)
super
((
1024
-
@contents
.
w
)
/
2
,
230
,
@contents
.
w
,
@contents
.
h
,
500
)
set
(
title
,
message
,
buttons
,
&
proc
)
set
(
title
,
message
,
buttons
,
&
proc
)
end
end
def
set
(
title
,
message
,
buttons
=
{},
&
proc
)
def
set
(
title
,
message
,
buttons
=
{},
&
proc
)
...
...
lib/window_host.rb
View file @
cd5faab0
...
@@ -2,35 +2,44 @@ class Window_Host < Window
...
@@ -2,35 +2,44 @@ 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
,
110
,
@button
.
w
/
3
,
@button
.
h
],
:cancel
=>
[
156
,
11
0
,
@button
.
w
/
3
,
@button
.
h
]}
@items
=
{
:ok
=>
[
46
,
240
,
@button
.
w
/
3
,
@button
.
h
],
:cancel
=>
[
156
,
24
0
,
@button
.
w
/
3
,
@button
.
h
]}
@buttons
=
{
:ok
=>
"确定"
,
:cancel
=>
"取消"
}
@buttons
=
{
:ok
=>
"确定"
,
:cancel
=>
"取消"
}
@background
=
Surface
.
load
(
'graphics/
system/msgbox
.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
(
"fonts/wqy-microhei.ttc"
,
16
)
@font
=
TTF
.
open
(
"fonts/wqy-microhei.ttc"
,
16
)
@title_color
=
[
0xFF
,
0xFF
,
0xFF
]
@title_color
=
[
0xFF
,
0xFF
,
0xFF
]
@color
=
[
0x04
,
0x47
,
0x7c
]
@color
=
[
0x04
,
0x47
,
0x7c
]
@roomname_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
,
165
,
WLH
)
do
|
key
|
@roomname_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
,
165
,
WLH
)
case
key
@password_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
+
WLH
,
165
,
WLH
)
when
:ENTER
clicked
@pvp
=
Widget_Checkbox
.
new
(
self
,
33
+
@x
,
@y
+
41
+
WLH
*
2
,
120
,
24
,
false
,
"竞技场"
)
{
|
checked
|
@tag
.
checked
=
false
if
checked
}
false
when
:ESC
true
end
end
@roomname_inputbox
.
value
=
rand
(
1000
).
to_s
@pvp
=
Widget_Checkbox
.
new
(
self
,
33
+
@x
,
70
+
@y
,
120
,
24
,
false
,
"竞技场"
)
@pvp
.
background
=
@background
.
copy_rect
(
33
,
70
,
120
,
24
)
@pvp
.
background
=
@background
.
copy_rect
(
33
,
70
,
120
,
24
)
@match
=
Widget_Checkbox
.
new
(
self
,
120
+
@x
,
70
+
@y
,
120
,
24
,
true
,
"三回决斗"
)
@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
)
@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
=
false
;
@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
}
@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
.
background
=
@background
.
copy_rect
(
120
,
70
,
120
,
24
)
@roomname_inputbox
.
value
=
rand
(
1000
).
to_s
@password_inputbox
.
refresh
@pvp
.
refresh
@pvp
.
refresh
@match
.
refresh
@match
.
refresh
@tag
.
refresh
@ocg
.
refresh
@tcg
.
refresh
refresh
refresh
end
end
def
refresh
def
refresh
clear
clear
@font
.
draw_blended_utf8
(
@contents
,
"新房间"
,
(
@width
-
@font
.
text_size
(
"新房间"
)[
0
])
/
2
,
2
,
*
@title_color
)
@font
.
draw_blended_utf8
(
@contents
,
"新房间"
,
(
@width
-
@font
.
text_size
(
"新房间"
)[
0
])
/
2
,
2
,
*
@title_color
)
@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
)
@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
,
"TCG目前不能用,只是给以后预留位置"
,
20
,
43
+
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
...
@@ -70,21 +79,57 @@ class Window_Host < Window
...
@@ -70,21 +79,57 @@ class Window_Host < Window
def
clicked
def
clicked
case
self
.
index
case
self
.
index
when
:ok
when
:ok
return
if
@roomname_inputbox
.
value
.
empty?
if
@roomname_inputbox
.
value
.
empty?
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"建立房间"
,
"正在建立房间"
)
Widget_Msgbox
.
new
(
"建立房间"
,
"请输入房间名"
,
ok:
"确定"
)
destroy
elsif
!
name_check
$game
.
host
(
@roomname_inputbox
.
value
,
:pvp
=>
@pvp
.
checked?
,
:match
=>
@match
.
checked?
)
Widget_Msgbox
.
new
(
"建立房间"
,
"房间名/房间密码超过长度上限"
,
ok:
"确定"
)
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
)
end
when
:cancel
when
:cancel
destroy
destroy
end
end
end
end
def
destroy
def
destroy
@roomname_inputbox
.
destroy
@roomname_inputbox
.
destroy
@password_inputbox
.
destroy
@pvp
.
destroy
@pvp
.
destroy
@match
.
destroy
@match
.
destroy
@tag
.
destroy
@ocg
.
destroy
@tcg
.
destroy
super
super
end
end
def
update
def
update
@roomname_inputbox
.
update
@roomname_inputbox
.
update
@password_inputbox
.
update
end
def
name_check
name
=
@roomname_inputbox
.
value
# P#/PM#/M#/T# 的总房名长度允许为13
# 其他情况下如果全英文,那么上限19,否则上限20
# TCG代码自定义房占15个字符
# 一个汉字两个字符,密码算在内
if
@tcg
.
checked
#代码自定义房
max
=
5
max
-=
1
if
name
.
ascii_only?
elsif
@pvp
.
checked
or
@match
.
checked
or
@tag
.
checked
# 去掉那个#占用的
max
=
12
max
-=
1
if
@pvp
.
checked
max
-=
1
if
@match
.
checked
max
-=
1
if
@tag
.
checked
else
max
=
20
max
-=
1
if
name
.
ascii_only?
end
if
!
@password_inputbox
.
value
.
empty?
max
-=
1
max
-=
@password_inputbox
.
value
.
encode
(
"GBK"
).
bytesize
end
max
-=
name
.
encode
(
"GBK"
).
bytesize
return
max
>=
0
end
end
end
end
\ No newline at end of file
lib/window_join.rb
0 → 100644
View file @
cd5faab0
class
Window_Join
<
Window
attr_reader
:index
def
initialize
(
x
,
y
,
room
)
@room
=
room
@button
=
Surface
.
load
(
"graphics/system/button.png"
)
@items
=
{
:ok
=>
[
46
,
110
,
@button
.
w
/
3
,
@button
.
h
],
:cancel
=>
[
156
,
110
,
@button
.
w
/
3
,
@button
.
h
]}
@buttons
=
{
:ok
=>
"确定"
,
:cancel
=>
"取消"
}
@background
=
Surface
.
load
(
'graphics/system/msgbox.png'
).
display_format
super
((
1024
-
@background
.
w
)
/
2
,
230
,
@background
.
w
,
@background
.
h
)
@font
=
TTF
.
open
(
"fonts/wqy-microhei.ttc"
,
16
)
@title_color
=
[
0xFF
,
0xFF
,
0xFF
]
@color
=
[
0x04
,
0x47
,
0x7c
]
@password_inputbox
=
Widget_InputBox
.
new
(
@x
+
96
,
@y
+
41
,
165
,
WLH
)
do
|
key
|
case
key
when
:ENTER
clicked
false
when
:ESC
true
end
end
@password_inputbox
.
refresh
refresh
end
def
refresh
clear
@font
.
draw_blended_utf8
(
@contents
,
"加入私密房间"
,
(
@width
-
@font
.
text_size
(
"加入私密房间"
)[
0
])
/
2
,
2
,
*
@title_color
)
@font
.
draw_blended_utf8
(
@contents
,
"房间密码"
,
33
,
43
,
*
@color
)
@items
.
each_key
do
|
index
|
draw_item
(
index
,
self
.
index
==
index
?
1
:
0
)
end
@font
.
draw_blended_utf8
(
@contents
,
"如果确定后创建了新房间,是密码错误"
,
20
,
43
+
WLH
,
*
@color
)
end
def
draw_item
(
index
,
status
=
0
)
Surface
.
blit
(
@button
,
@button
.
w
/
3
*
status
,
0
,
@button
.
w
/
3
,
@button
.
h
,
@contents
,
@items
[
index
][
0
],
@items
[
index
][
1
])
text_size
=
@font
.
text_size
(
@buttons
[
index
])
@font
.
draw_blended_utf8
(
@contents
,
@buttons
[
index
],
@items
[
index
][
0
]
+
(
@button
.
w
/
3
-
text_size
[
0
])
/
2
,
@items
[
index
][
1
]
+
(
@button
.
h
-
text_size
[
1
])
/
2
,
0xFF
,
0xFF
,
0xFF
)
end
def
mousemoved
(
x
,
y
)
new_index
=
nil
@items
.
each_key
do
|
index
|
if
(
x
-
@x
).
between?
(
@items
[
index
][
0
],
@items
[
index
][
0
]
+
@items
[
index
][
2
])
and
(
y
-
@y
).
between?
(
@items
[
index
][
1
],
@items
[
index
][
1
]
+
@items
[
index
][
3
])
new_index
=
index
break
end
end
self
.
index
=
new_index
end
def
item_rect
(
index
)
@items
[
index
]
end
def
index
=
(
index
)
return
if
index
==
@index
if
@index
clear
(
*
item_rect
(
@index
))
draw_item
(
@index
,
0
)
end
if
index
.
nil?
or
!
@items
.
include?
index
@index
=
nil
else
@index
=
index
draw_item
(
@index
,
1
)
end
end
def
clicked
case
self
.
index
when
:ok
return
if
@password_inputbox
.
value
.
empty?
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入"
,
"正在加入房间"
)
destroy
@room
.
password
=
@password_inputbox
.
value
$game
.
join
(
@room
)
when
:cancel
destroy
end
end
def
destroy
@password_inputbox
.
destroy
super
end
def
update
@password_inputbox
.
update
end
end
\ No newline at end of file
lib/window_roomlist.rb
View file @
cd5faab0
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
# 大厅内房间列表
# 大厅内房间列表
#==============================================================================
#==============================================================================
require_relative
'window_scrollable'
require_relative
'window_scrollable'
require_relative
'window_join'
class
Window_RoomList
<
Window_Scrollable
class
Window_RoomList
<
Window_Scrollable
attr_reader
:items
attr_reader
:items
WLH
=
48
WLH
=
48
...
@@ -36,7 +37,9 @@ class Window_RoomList < Window_Scrollable
...
@@ -36,7 +37,9 @@ class Window_RoomList < Window_Scrollable
@font
.
draw_blended_utf8
(
@contents
,
str
,
300
+
index
*
96
,
y
+
8
,
*
color
)
@font
.
draw_blended_utf8
(
@contents
,
str
,
300
+
index
*
96
,
y
+
8
,
*
color
)
end
end
end
end
def
update
@join_window
.
update
if
@join_window
and
!
@join_window
.
destroyed?
end
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
return
unless
self
.
include?
(
x
,
y
)
return
unless
self
.
include?
(
x
,
y
)
self
.
index
=
(
y
-
@y
)
/
WLH
+
@scroll
self
.
index
=
(
y
-
@y
)
/
WLH
+
@scroll
...
@@ -47,8 +50,12 @@ class Window_RoomList < Window_Scrollable
...
@@ -47,8 +50,12 @@ class Window_RoomList < Window_Scrollable
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入观战"
)
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入观战"
)
$game
.
watch
room
$game
.
watch
room
else
else
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入房间"
)
if
room
.
private
$game
.
join
room
@join_window
=
Window_Join
.
new
(
0
,
0
,
room
)
else
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入房间"
)
$game
.
join
room
end
end
end
end
end
end
end
\ No newline at end of file
lib/ygocore/event.rb
View file @
cd5faab0
...
@@ -42,8 +42,11 @@ class Game_Event
...
@@ -42,8 +42,11 @@ class Game_Event
result
=
Room
.
new
(
room
[
:id
],
room
[
:name
])
result
=
Room
.
new
(
room
[
:id
],
room
[
:name
])
result
.
player1
=
room
[
:player1
]
&&
parse_user
(
room
[
:player1
])
result
.
player1
=
room
[
:player1
]
&&
parse_user
(
room
[
:player1
])
result
.
player2
=
room
[
:player2
]
&&
parse_user
(
room
[
:player2
])
result
.
player2
=
room
[
:player2
]
&&
parse_user
(
room
[
:player2
])
result
.
private
=
room
[
:private
]
result
.
pvp
=
room
[
:pvp
]
result
.
pvp
=
room
[
:pvp
]
result
.
match
=
room
[
:match
]
result
.
match
=
room
[
:match
]
result
.
tag
=
room
[
:tag
]
result
.
ot
=
room
[
:ot
]
result
.
status
=
room
[
:status
]
result
.
status
=
room
[
:status
]
result
result
end
end
...
...
lib/ygocore/game.rb
View file @
cd5faab0
...
@@ -42,6 +42,9 @@ class Ygocore < Game
...
@@ -42,6 +42,9 @@ class Ygocore < Game
room
=
Room
.
new
(
0
,
room_name
)
room
=
Room
.
new
(
0
,
room_name
)
room
.
pvp
=
room_config
[
:pvp
]
room
.
pvp
=
room_config
[
:pvp
]
room
.
match
=
room_config
[
:match
]
room
.
match
=
room_config
[
:match
]
room
.
tag
=
room_config
[
:tag
]
room
.
password
=
room_config
[
:password
]
room
.
ot
=
room_config
[
:ot
]
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
=>
"确定"
)
else
else
...
@@ -89,7 +92,12 @@ class Ygocore < Game
...
@@ -89,7 +92,12 @@ class Ygocore < Game
case
option
case
option
when
Room
when
Room
room
=
option
room
=
option
room_name
=
if
room
.
pvp?
and
room
.
match?
room_name
=
if
room
.
ot
!=
0
mode
=
case
when
room
.
match?
then
1
;
when
room
.
tag?
then
2
else
0
end
room_name
=
"
#{
room
.
ot
}#{
mode
}
FFF8000,5,1,
#{
room
.
name
}
"
elsif
room
.
tag?
"T#"
+
room
.
name
elsif
room
.
pvp?
and
room
.
match?
"PM#"
+
room
.
name
"PM#"
+
room
.
name
elsif
room
.
pvp?
elsif
room
.
pvp?
"P#"
+
room
.
name
"P#"
+
room
.
name
...
@@ -98,6 +106,9 @@ class Ygocore < Game
...
@@ -98,6 +106,9 @@ class Ygocore < Game
else
else
room
.
name
room
.
name
end
end
if
room
.
password
and
!
room
.
password
.
empty?
room_name
+=
"$"
+
room
.
password
end
system_conf
=
{}
system_conf
=
{}
begin
begin
IO
.
readlines
(
'system.conf'
).
each
do
|
line
|
IO
.
readlines
(
'system.conf'
).
each
do
|
line
|
...
...
lib/ygocore/room.rb
View file @
cd5faab0
class
Room
class
Room
attr_accessor
:pvp
attr_accessor
:pvp
attr_accessor
:match
attr_accessor
:match
attr_accessor
:tag
attr_accessor
:ot
attr_accessor
:status
attr_accessor
:status
alias
pvp?
pvp
alias
pvp?
pvp
alias
match?
match
alias
match?
match
alias
tag?
tag
def
ot
@ot
||=
0
end
def
full?
def
full?
$game
.
is_a?
(
Ygocore
)
?
(
@status
==
:
start
)
:
player2
#不规范修正iduel房间识别问题
$game
.
is_a?
(
Ygocore
)
?
(
@status
==
:
start
)
:
player2
#不规范修正iduel房间识别问题
end
end
...
@@ -12,8 +19,15 @@ class Room
...
@@ -12,8 +19,15 @@ class Room
if
pvp?
if
pvp?
result
[
"[竞技场]"
]
=
[
255
,
0
,
0
]
result
[
"[竞技场]"
]
=
[
255
,
0
,
0
]
end
end
if
match?
if
tag?
result
[
"[三回决斗]"
]
=
[
255
,
0
,
0
]
result
[
"[TAG双打]"
]
=
[
128
,
0
,
255
]
elsif
match?
result
[
"[三回决斗]"
]
=
[
0xff
,
0x72
,
0
]
end
if
ot
==
1
result
[
"[TCG]"
]
=
[
255
,
0
,
0
]
elsif
ot
==
2
result
[
"[O/T混]"
]
=
[
255
,
0
,
0
]
end
end
result
result
end
end
...
...
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