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
xiaoye
mycard
Commits
940f2b07
Commit
940f2b07
authored
Mar 16, 2012
by
zh99998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
取消#encoding: UTF-8声明,改为-KU参数,因为在logger里不声明-KU会比较纠结
parent
1cd3c81c
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
32 additions
and
64 deletions
+32
-64
README.txt
README.txt
+21
-21
Rakefile
Rakefile
+2
-2
lib/chatmessage.rb
lib/chatmessage.rb
+0
-1
lib/game.rb
lib/game.rb
+0
-2
lib/game_card.rb
lib/game_card.rb
+0
-1
lib/game_event.rb
lib/game_event.rb
+2
-3
lib/game_field.rb
lib/game_field.rb
+0
-1
lib/iduel/action.rb
lib/iduel/action.rb
+0
-1
lib/iduel/event.rb
lib/iduel/event.rb
+0
-1
lib/iduel/game.rb
lib/iduel/game.rb
+5
-4
lib/iduel/replay.rb
lib/iduel/replay.rb
+0
-1
lib/iduel/window_login.rb
lib/iduel/window_login.rb
+0
-1
lib/main.rb
lib/main.rb
+2
-3
lib/room.rb
lib/room.rb
+0
-1
lib/scene_error.rb
lib/scene_error.rb
+0
-1
lib/scene_replay.rb
lib/scene_replay.rb
+0
-1
lib/widget_inputbox.rb
lib/widget_inputbox.rb
+0
-1
lib/widget_msgbox.rb
lib/widget_msgbox.rb
+0
-1
lib/window_bgm.rb
lib/window_bgm.rb
+0
-1
lib/window_cardinfo.rb
lib/window_cardinfo.rb
+0
-1
lib/window_config.rb
lib/window_config.rb
+0
-1
lib/window_field.rb
lib/window_field.rb
+0
-1
lib/window_gameselect.rb
lib/window_gameselect.rb
+0
-1
lib/window_host.rb
lib/window_host.rb
+0
-1
lib/window_list.rb
lib/window_list.rb
+0
-1
lib/window_lobbybuttons.rb
lib/window_lobbybuttons.rb
+0
-1
lib/window_login.rb
lib/window_login.rb
+0
-1
lib/window_scrollable.rb
lib/window_scrollable.rb
+0
-1
lib/window_title.rb
lib/window_title.rb
+0
-1
lib/window_user.rb
lib/window_user.rb
+0
-1
lib/ygocore/event.rb
lib/ygocore/event.rb
+0
-1
lib/ygocore/room.rb
lib/ygocore/room.rb
+0
-1
lib/ygocore/scene_lobby.rb
lib/ygocore/scene_lobby.rb
+0
-1
lib/ygocore/user.rb
lib/ygocore/user.rb
+0
-1
lib/ygocore/window_login.rb
lib/ygocore/window_login.rb
+0
-1
No files found.
README.txt
View file @
940f2b07
== mycard
这是一个游戏王对战器,与NBX和iDuel、ygocore协议兼容
目前开发进度约60%,iDuel实现了观战、播放Replay和几个简单的战斗指令,ygocore的大厅
快捷键:
F12 返回标题画面
iduel观战时 F10退出房间
常见问题:
Q: 运行主程序没有任何反应
A: 不支持中文目录,请把程序放到没有中文的目录下,例如d:\mycard,而不要放到d:\游戏\mycard,也不要放到桌面。
Q: 切换输入法时卡死
A: 这个故障只在WinXP上出现,暂时没有解决方案,可以临时在其他地方写好文字复制进来;如果一点决斗开始立即卡死,那么可能是默认有输入法,把默认输入法调成英文。
Q: 加入或建立房间时提示连接已断开
A: 可能是ygocore版本不正确,截止到3月13日服务器支持的ygocore版本是0x1023,一般ygocore发布新版本后会在1到3天升级,请留意公告。如果大厅内没有房间,并且无法建立房间,那么可能是服务器维护。
Q: 弹出【程序可能出现了一个bug,请到论坛反馈】
== mycard
这是一个游戏王对战器,与NBX和iDuel、ygocore协议兼容
目前开发进度约60%,iDuel实现了观战、播放Replay和几个简单的战斗指令,ygocore的大厅
快捷键:
F12 返回标题画面
iduel观战时 F10退出房间
常见问题:
Q: 运行主程序没有任何反应
A: 不支持中文目录,请把程序放到没有中文的目录下,例如d:\mycard,而不要放到d:\游戏\mycard,也不要放到桌面。
Q: 切换输入法时卡死
A: 这个故障只在WinXP上出现,暂时没有解决方案,可以临时在其他地方写好文字复制进来;如果一点决斗开始立即卡死,那么可能是默认有输入法,把默认输入法调成英文。
Q: 加入或建立房间时提示连接已断开
A: 可能是ygocore版本不正确,截止到3月13日服务器支持的ygocore版本是0x1023,一般ygocore发布新版本后会在1到3天升级,请留意公告。如果大厅内没有房间,并且无法建立房间,那么可能是服务器维护。
Q: 弹出【程序可能出现了一个bug,请到论坛反馈】
A: 联系作者 E-mail/QQ/GT: zh99998@gmail.com,或者到iduel社区的mycard发布帖留言。
\ No newline at end of file
Rakefile
View file @
940f2b07
...
...
@@ -47,9 +47,9 @@ Gem::PackageTask.new(spec) do |p|
p
.
gem_spec
=
spec
if
Windows
p
.
need_zip
=
true
p
.
zip_command
=
'../7z.exe a
-tzip
'
p
.
zip_command
=
'../7z.exe a'
def
p
.
zip_file
"
#{
package_name
}
-win32.
zip
"
"
#{
package_name
}
-win32.
7z
"
end
else
p
.
need_tar
=
true
...
...
lib/chatmessage.rb
View file @
940f2b07
#encoding: UTF-8
class
ChatMessage
attr_accessor
:user
,
:message
,
:channel
,
:time
def
initialize
(
user
,
message
,
channel
=
:lobby
,
time
=
Time
.
now
)
...
...
lib/game.rb
View file @
940f2b07
#encoding: UTF-8
#游戏适配器的抽象类
require_relative
'game_event'
require_relative
'action'
...
...
lib/game_card.rb
View file @
940f2b07
#encoding: UTF-8
class
Game_Card
attr_accessor
:card
,
:position
,
:counters
,
:note
attr_writer
:atk
,
:def
...
...
lib/game_event.rb
View file @
940f2b07
#encoding: UTF-8
#游戏事件的抽象类
class
Game_Event
@queue
=
[]
...
...
@@ -140,7 +138,8 @@ class Game_Event
@title
=
title
@message
=
message
@fatal
=
fatal
$log
.
error
(
@fatal
?
"致命错误"
:
"一般错误"
){
"
#{
@title
}
:
#{
@message
}
#{
caller
}
"
}
p
@title
,
@title
.
encoding
,
@message
,
@message
.
encoding
,
caller
.
to_s
.
encoding
$log
.
error
(
@fatal
?
"致命错误"
:
"一般错误"
){
"
#{
@title
}
:
#{
@message
.
encode
(
"UTF-8"
)
}
#{
caller
}
"
}
end
end
class
Unknown
<
Error
...
...
lib/game_field.rb
View file @
940f2b07
#encoding: UTF-8
#==============================================================================
# ■ Field
#------------------------------------------------------------------------------
...
...
lib/iduel/action.rb
View file @
940f2b07
#encoding: UTF-8
class
Action
CardFilter
=
/(<?\[?Token[ \\\d]*\]?>?|<?(?:\[.*?\])?\[(?:.*?)\][ \d?]*>?|一张怪兽卡|一张魔\/陷卡|一张卡|\?\?)/
.
to_s
PosFilter
=
/((?:手卡|手牌|场上|魔陷区|怪兽区|墓地|墓地\|,,,,,\|\*\:\d+张\:\*|额外牌堆|除外区|卡组|卡组顶端|\(\d+\)){1,2})/
.
to_s
...
...
lib/iduel/event.rb
View file @
940f2b07
#encoding: UTF-8
class
Game_Event
def
self
.
parse
(
info
)
info
=~
/^\$([A-Z])\|(.*)$/m
...
...
lib/iduel/game.rb
View file @
940f2b07
...
...
@@ -113,7 +113,7 @@ class Iduel < Game
save_config
end
rescue
Exception
=>
exception
$log
.
error
(
'读取好友信息'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
).
encode
(
"UTF-8
"
)}
$log
.
error
(
'读取好友信息'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
collect
{
|
str
|
str
.
encode
(
"UTF-8"
)}.
join
(
"
\n
"
)}
end
end
end
...
...
@@ -124,19 +124,20 @@ class Iduel < Game
@conn
=
TCPSocket
.
new
(
Server
,
Port
)
#TODO: 阻塞优化,注意login。下面注释掉的两句实现connect无阻塞,但是login依然会阻塞所以只优化这里没有意义
#@conn = Socket.new(:INET, :STREAM)
@conn
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
Thread
.
abort_on_exception
=
true
@recv
=
Thread
.
new
do
begin
#@conn.connect Socket.pack_sockaddr_in(Port, Server)
recv
@conn
.
gets
(
RS
)
while
@conn
rescue
=>
exception
$log
.
error
(
'iduel-connect-1'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
)}
$log
.
error
(
'iduel-connect-1'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
collect
{
|
str
|
str
.
encode
(
"UTF-8"
)}.
join
(
"
\n
"
)}
Game_Event
.
push
Game_Event
::
Error
.
new
(
exception
.
class
.
to_s
,
exception
.
message
)
ensure
self
.
exit
end
end
rescue
=>
exception
$log
.
error
(
'iduel-connect-2'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
)}
$log
.
error
(
'iduel-connect-2'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
collect
{
|
str
|
str
.
encode
(
"UTF-8"
)}.
join
(
"
\n
"
)}
Game_Event
.
push
Game_Event
::
Error
.
new
(
"网络错误"
,
"连接服务器失败"
)
end
end
...
...
@@ -170,7 +171,7 @@ class Iduel < Game
save_config
end
rescue
Exception
=>
exception
$log
.
error
(
'公告'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
)}
$log
.
error
(
'公告'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
collect
{
|
str
|
str
.
encode
(
"UTF-8"
)}.
join
(
"
\n
"
)}
end
end
end
...
...
lib/iduel/replay.rb
View file @
940f2b07
#encoding: UTF-8
class
Replay
User_Filter
=
/(.+?)(?:\((\d+)\))?(?:\(\d+:\d+:\d+\))?(?:: |:) */
Delimiter
=
/^
#{
User_Filter
}
\n ?/
...
...
lib/iduel/window_login.rb
View file @
940f2b07
#encoding: UTF-8
class
Window_Login
def
clicked
return
if
@last_clicked
and
Time
.
now
-
@last_clicked
<
3
#防止重复点击
...
...
lib/main.rb
View file @
940f2b07
#!/usr/bin/env ruby
#encoding: UTF-8
begin
#定义全局方法
...
...
@@ -46,13 +45,13 @@ begin
$screen
=
Screen
.
open
(
$config
[
'screen'
][
'width'
],
$config
[
'screen'
][
'height'
],
0
,
HWSURFACE
|
(
$config
[
'screen'
][
'fullscreen'
]
?
FULLSCREEN
:
0
))
Mixer
.
open
(
Mixer
::
DEFAULT_FREQUENCY
,
Mixer
::
DEFAULT_FORMAT
,
Mixer
::
DEFAULT_CHANNELS
,
512
)
TTF
.
init
#设置标准输出编码(windows)
STDOUT
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
if
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
Thread
.
abort_on_exception
=
true
#初始化日志
require
'logger'
if
log
==
"STDOUT"
#调试用
log
=
STDOUT
STDOUT
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
if
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
end
$log
=
Logger
.
new
(
log
)
$log
.
level
=
Logger
.
const_get
log_level
...
...
lib/room.rb
View file @
940f2b07
#encoding: UTF-8
require_relative
'cacheable'
class
Room
Color
=
[[
0
,
0
,
0
],
[
255
,
0
,
0
],
[
0
,
128
,
0
],
[
0
,
0
,
255
],
[
255
,
165
,
0
]]
...
...
lib/scene_error.rb
View file @
940f2b07
#encoding: UTF-8
require_relative
'widget_msgbox'
class
Scene_Error
<
Scene
def
start
...
...
lib/scene_replay.rb
View file @
940f2b07
#encoding: UTF-8
require_relative
'scene_watch'
class
Scene_Replay
<
Scene_Watch
def
initialize
(
replay
)
...
...
lib/widget_inputbox.rb
View file @
940f2b07
#encoding: UTF-8
class
Widget_InputBox
<
Window
attr_reader
:value
,
:proc
attr_accessor
:type
...
...
lib/widget_msgbox.rb
View file @
940f2b07
#encoding: UTF-8
class
Widget_Msgbox
<
Window
Title_Color
=
[
0xFF
,
0xFF
,
0xFF
]
Message_Color
=
[
0x04
,
0x47
,
0x7c
]
...
...
lib/window_bgm.rb
View file @
940f2b07
#encoding: UTF-8
require_relative
'window'
class
Window_BGM
<
Window
WLH
=
20
...
...
lib/window_cardinfo.rb
View file @
940f2b07
#encoding: UTF-8
class
Window_CardInfo
<
Window
WLH
=
20
def
initialize
(
x
,
y
)
...
...
lib/window_config.rb
View file @
940f2b07
#encoding: UTF-8
class
Window_Config
<
Window
def
initialize
(
x
,
y
)
super
(
x
,
y
,
$screen
.
w
,
$screen
.
h
)
...
...
lib/window_field.rb
View file @
940f2b07
#encoding: UTF-8
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
...
...
lib/window_gameselect.rb
View file @
940f2b07
#encoding: UTF-8
class
Window_GameSelect
<
Window_List
WLH
=
56
def
initialize
(
x
,
y
)
...
...
lib/window_host.rb
View file @
940f2b07
#encoding: UTF-8
class
Window_Host
<
Window
attr_reader
:index
def
initialize
(
x
,
y
)
...
...
lib/window_list.rb
View file @
940f2b07
#encoding: UTF-8
#==============================================================================
# ■ Window_Roomitems
#------------------------------------------------------------------------------
...
...
lib/window_lobbybuttons.rb
View file @
940f2b07
#encoding: UTF-8
require_relative
'window_host'
class
Window_LobbyButtons
<
Window_List
def
initialize
(
x
,
y
)
...
...
lib/window_login.rb
View file @
940f2b07
#encoding: UTF-8
require_relative
'widget_inputbox'
require_relative
'widget_msgbox'
require_relative
'widget_checkbox'
...
...
lib/window_scrollable.rb
View file @
940f2b07
#encoding: UTF-8
require_relative
'window_list'
class
Window_Scrollable
<
Window_List
attr_reader
:scroll
...
...
lib/window_title.rb
View file @
940f2b07
#encoding: UTF-8
require_relative
'window_list'
class
Window_Title
<
Window_List
Button_Count
=
5
...
...
lib/window_user.rb
View file @
940f2b07
#encoding: UTF-8
class
Window_User
<
Window_List
WLH
=
20
def
initialize
(
x
,
y
,
user
)
...
...
lib/ygocore/event.rb
View file @
940f2b07
#encoding: UTF-8
class
Game_Event
User_Filter
=
/\[(\d+),<font color="(?:blue|gray)">(.+?)(\(未认证\)|)<\/font>\]/
Room_Filter
=
/\[(\d+),(.+?),(wait|start)
#{
User_Filter
}
+?\]/
...
...
lib/ygocore/room.rb
View file @
940f2b07
#encoding: UTF-8
class
Room
attr_accessor
:pvp
attr_accessor
:match
...
...
lib/ygocore/scene_lobby.rb
View file @
940f2b07
#encoding: UTF-8
class
Scene_Lobby
WM_LBUTTONDOWN
=
0x201
WM_LBUTTONUP
=
0x202
...
...
lib/ygocore/user.rb
View file @
940f2b07
#encoding: UTF-8
class
User
def
initialize
(
id
,
name
=
""
,
certified
=
true
)
@id
=
id
...
...
lib/ygocore/window_login.rb
View file @
940f2b07
#encoding: UTF-8
class
Window_Login
def
clicked
return
if
@last_clicked
and
Time
.
now
-
@last_clicked
<
3
#防止重复点击
...
...
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