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
7678d09f
Commit
7678d09f
authored
Dec 26, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log初步
parent
912ec683
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
46 additions
and
30 deletions
+46
-30
.gitignore
.gitignore
+0
-1
Rakefile
Rakefile
+1
-1
error-程序出错请到论坛反馈.txt
error-程序出错请到论坛反馈.txt
+0
-4
lib/game.rb
lib/game.rb
+4
-0
lib/iduel/action.rb
lib/iduel/action.rb
+0
-1
lib/iduel/iduel.rb
lib/iduel/iduel.rb
+7
-6
lib/main.rb
lib/main.rb
+9
-4
lib/nbx/action.rb
lib/nbx/action.rb
+0
-1
lib/room.rb
lib/room.rb
+1
-0
lib/scene.rb
lib/scene.rb
+1
-1
lib/scene_duel.rb
lib/scene_duel.rb
+5
-0
lib/scene_error.rb
lib/scene_error.rb
+2
-1
lib/scene_login.rb
lib/scene_login.rb
+3
-1
lib/scene_title.rb
lib/scene_title.rb
+2
-2
lib/user.rb
lib/user.rb
+1
-0
lib/window_list.rb
lib/window_list.rb
+1
-1
lib/window_lp.rb
lib/window_lp.rb
+7
-3
lib/window_title.rb
lib/window_title.rb
+1
-0
mycard.cmd
mycard.cmd
+1
-3
No files found.
.gitignore
View file @
7678d09f
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
/ruby/
/ruby/
/pkg/
/pkg/
/log.log
/log.log
/err.log
/replay/*
/replay/*
/graphics/avatars/*_*.png
/graphics/avatars/*_*.png
Thumbs.db
Thumbs.db
\ No newline at end of file
Rakefile
View file @
7678d09f
...
@@ -36,4 +36,4 @@ Rake::GemPackageTask.new(spec) do |p|
...
@@ -36,4 +36,4 @@ Rake::GemPackageTask.new(spec) do |p|
end
end
end
end
CLOBBER
.
include
%w(log.log err.log)
+
Dir
.
glob
(
"{replay}/**/*"
)
+
Dir
.
glob
(
"**/Thumbs.db"
)
+
Dir
.
glob
(
"graphics/avatars/*_*.png"
)
CLOBBER
.
include
%w(log.log)
+
Dir
.
glob
(
"{replay}/**/*"
)
+
Dir
.
glob
(
"**/Thumbs.db"
)
+
Dir
.
glob
(
"graphics/avatars/*_*.png"
)
\ No newline at end of file
\ No newline at end of file
error-程序出错请到论坛反馈.txt
deleted
100644 → 0
View file @
912ec683
#<TypeError: can't convert false into Integer>
/home/zh99998/NetBeansProjects/mycard/lib/main.rb:13:in `|'
/home/zh99998/NetBeansProjects/mycard/lib/main.rb:13:in `<main>'
\ No newline at end of file
lib/game.rb
View file @
7678d09f
#encoding: UTF-8
#encoding: UTF-8
#游戏适配器的抽象类
#游戏适配器的抽象类
require_relative
'game_event'
require_relative
'action'
require_relative
'user'
require_relative
'room'
class
Game
class
Game
attr_reader
:users
,
:rooms
attr_reader
:users
,
:rooms
attr_accessor
:user
,
:room
,
:player_field
,
:opponent_field
,
:turn
,
:turn_player
,
:phase
attr_accessor
:user
,
:room
,
:player_field
,
:opponent_field
,
:turn
,
:turn_player
,
:phase
...
...
lib/iduel/action.rb
View file @
7678d09f
#encoding: UTF-8
#encoding: UTF-8
#这个文件iduel和nbx相同,编辑时推荐使用软/硬链接来保持一致
#这个文件iduel和nbx相同,编辑时推荐使用软/硬链接来保持一致
require_relative
'../action'
class
Action
class
Action
CardFilter
=
/((?:<)?(?:\[.*?\])?\[(?:.*?)\][\s\d]*(?:>)?|一张怪兽卡|一张魔\/陷卡|\?\?)/
CardFilter
=
/((?:<)?(?:\[.*?\])?\[(?:.*?)\][\s\d]*(?:>)?|一张怪兽卡|一张魔\/陷卡|\?\?)/
PosFilter
=
/((?:手卡|手牌|场上|魔陷区|怪兽区|墓地|额外牌堆|除外区|卡组|卡组顶端|\(\d+\)){1,2})/
PosFilter
=
/((?:手卡|手牌|场上|魔陷区|怪兽区|墓地|额外牌堆|除外区|卡组|卡组顶端|\(\d+\)){1,2})/
...
...
lib/iduel/iduel.rb
View file @
7678d09f
...
@@ -24,15 +24,16 @@ class Iduel < Game
...
@@ -24,15 +24,16 @@ class Iduel < Game
@recv
=
Thread
.
new
do
@recv
=
Thread
.
new
do
begin
begin
recv
@conn
.
gets
(
RS
)
while
@conn
recv
@conn
.
gets
(
RS
)
while
@conn
rescue
rescue
=>
exception
Game_Event
.
push
Game_Event
::
Error
.
new
(
$!
.
class
.
to_s
,
$!
.
message
)
Game_Event
.
push
Game_Event
::
Error
.
new
(
exception
.
class
.
to_s
,
exception
.
message
)
$log
.
info
$!
.
backtrace
$log
.
warn
([
exception
.
inspect
]
+
exception
.
backtrace
).
join
(
"
\n
"
)
ensure
ensure
exit
self
.
exit
end
end
end
end
rescue
rescue
=>
exception
Game_Event
.
push
Game_Event
::
Error
.
new
(
$!
.
class
.
to_s
,
$!
.
message
)
Game_Event
.
push
Game_Event
::
Error
.
new
(
exception
.
class
.
to_s
,
exception
.
message
)
$log
.
warn
([
exception
.
inspect
]
+
exception
.
backtrace
).
join
(
"
\n
"
)
end
end
end
end
def
login
(
username
,
password
)
def
login
(
username
,
password
)
...
...
lib/main.rb
View file @
7678d09f
#!/usr/bin/env ruby
#encoding: UTF-8
#encoding: UTF-8
begin
begin
#切换工作目录
Dir
.
chdir
(
File
.
expand_path
(
".."
,
File
.
dirname
(
__FILE__
)))
#读取配置文件
#读取配置文件
require
'yaml'
require
'yaml'
$config
=
YAML
.
load_file
(
"config.yml"
)
rescue
YAML
.
load_file
(
"data/config_default.yml"
)
$config
=
YAML
.
load_file
(
"config.yml"
)
rescue
YAML
.
load_file
(
"data/config_default.yml"
)
...
@@ -10,7 +14,7 @@ begin
...
@@ -10,7 +14,7 @@ begin
SDL
.
init
(
INIT_VIDEO
|
INIT_AUDIO
)
SDL
.
init
(
INIT_VIDEO
|
INIT_AUDIO
)
WM
::
set_caption
(
"MyCard"
,
"graphics/system/icon.gif"
)
WM
::
set_caption
(
"MyCard"
,
"graphics/system/icon.gif"
)
WM
::
icon
=
Surface
.
load
(
"graphics/system/icon.gif"
)
WM
::
icon
=
Surface
.
load
(
"graphics/system/icon.gif"
)
$screen
=
Screen
.
open
(
$config
[
"width"
],
$config
[
"height"
],
0
,
HWSURFACE
|
$config
[
"fullscreen"
]
?
FULLSCREEN
:
0
)
$screen
=
Screen
.
open
(
$config
[
"width"
],
$config
[
"height"
],
0
,
HWSURFACE
|
(
$config
[
"fullscreen"
]
?
FULLSCREEN
:
0
)
)
Mixer
.
open
(
Mixer
::
DEFAULT_FREQUENCY
,
Mixer
::
DEFAULT_FORMAT
,
Mixer
::
DEFAULT_CHANNELS
,
512
)
Mixer
.
open
(
Mixer
::
DEFAULT_FREQUENCY
,
Mixer
::
DEFAULT_FORMAT
,
Mixer
::
DEFAULT_CHANNELS
,
512
)
TTF
.
init
TTF
.
init
...
@@ -20,19 +24,20 @@ begin
...
@@ -20,19 +24,20 @@ begin
#初始化日志
#初始化日志
require
'logger'
require
'logger'
$log
=
Logger
.
new
(
STDOUT
)
$log
=
Logger
.
new
(
STDOUT
)
#调试用,发布时改为log.log并删掉下面那句
STDOUT
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
if
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
$log
.
info
(
"main"
){
"初始化成功"
}
$log
.
info
(
"main"
){
"初始化成功"
}
rescue
Exception
=>
exception
rescue
Exception
=>
exception
open
(
'error-程序出错请到论坛反馈.txt'
,
'w'
){
|
f
|
f
.
write
([
exception
.
inspect
]
+
exception
.
backtrace
).
join
(
"
\n
"
)}
open
(
'error-程序出错请到论坛反馈.txt'
,
'w'
){
|
f
|
f
.
write
([
exception
.
inspect
]
+
exception
.
backtrace
).
join
(
"
\n
"
)}
exit
(
1
)
exit
(
1
)
end
end
#主循环
begin
begin
$scene
.
main
while
$scene
$scene
.
main
while
$scene
rescue
Exception
=>
exception
rescue
Exception
=>
exception
exception
.
backtrace
.
each
{
|
backtrace
|
break
if
backtrace
=~
/^(.*)\.rb:\d+:in `.*'"$/
}
#由于脚本是从main.rb开始执行的,总会有个能匹配成功的文件
exception
.
backtrace
.
each
{
|
backtrace
|
break
if
backtrace
=~
/^(.*)\.rb:\d+:in `.*'"$/
}
#由于脚本是从main.rb开始执行的,总会有个能匹配成功的文件
$log
.
fatal
(
$1
){
[
$scene
.
inspect
,
exception
.
backtrace
.
inspect
]
.
join
(
"
\n
"
)}
$log
.
fatal
(
$1
){
([
exception
.
inspect
]
+
exception
.
backtrace
)
.
join
(
"
\n
"
)}
require_relative
'scene_error'
require_relative
'scene_error'
$scene
=
Scene_Error
.
new
$scene
=
Scene_Error
.
new
retry
retry
...
...
lib/nbx/action.rb
View file @
7678d09f
#encoding: UTF-8
#encoding: UTF-8
#这个文件iduel和nbx相同,编辑时推荐使用软/硬链接来保持一致
#这个文件iduel和nbx相同,编辑时推荐使用软/硬链接来保持一致
require_relative
'../action'
class
Action
class
Action
CardFilter
=
/((?:<)?(?:\[.*?\])?\[(?:.*?)\][\s\d]*(?:>)?|一张怪兽卡|一张魔\/陷卡|\?\?)/
CardFilter
=
/((?:<)?(?:\[.*?\])?\[(?:.*?)\][\s\d]*(?:>)?|一张怪兽卡|一张魔\/陷卡|\?\?)/
PosFilter
=
/((?:手卡|手牌|场上|魔陷区|怪兽区|墓地|额外牌堆|除外区|卡组|卡组顶端|\(\d+\)){1,2})/
PosFilter
=
/((?:手卡|手牌|场上|魔陷区|怪兽区|墓地|额外牌堆|除外区|卡组|卡组顶端|\(\d+\)){1,2})/
...
...
lib/room.rb
View file @
7678d09f
#encoding: UTF-8
#encoding: UTF-8
require_relative
'cacheable'
class
Room
class
Room
Color
=
[[
0
,
0
,
0
],
[
255
,
0
,
0
],
[
0
,
255
,
0
],
[
0
,
0
,
255
],
[
255
,
165
,
0
]]
Color
=
[[
0
,
0
,
0
],
[
255
,
0
,
0
],
[
0
,
255
,
0
],
[
0
,
0
,
255
],
[
255
,
165
,
0
]]
extend
Cacheable
extend
Cacheable
...
...
lib/scene.rb
View file @
7678d09f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# 游戏中全部画面的超级类。
# 游戏中全部画面的超级类。
#==============================================================================
#==============================================================================
require
'fpstimer'
require
_relative
'fpstimer'
class
Scene
class
Scene
attr_reader
:windows
attr_reader
:windows
attr_reader
:background
attr_reader
:background
...
...
lib/scene_duel.rb
View file @
7678d09f
...
@@ -142,6 +142,7 @@ class Scene_Duel < Scene
...
@@ -142,6 +142,7 @@ class Scene_Duel < Scene
if
event
.
room
==
$game
.
room
if
event
.
room
==
$game
.
room
@player_lp_window
.
player
=
$game
.
room
.
player1
@player_lp_window
.
player
=
$game
.
room
.
player1
@opponent_lp_window
.
player
=
$game
.
room
.
player2
@opponent_lp_window
.
player
=
$game
.
room
.
player2
notify_send
(
"mycard"
,
"对手加入房间"
)
end
end
end
end
end
end
...
@@ -171,4 +172,8 @@ class Scene_Duel < Scene
...
@@ -171,4 +172,8 @@ class Scene_Duel < Scene
save_replay
save_replay
super
super
end
end
def
notify_send
(
title
,
msg
)
puts
"notify-send -i graphics/system/icon.ico
#{
title
}
#{
msg
}
"
system
(
"notify-send -i graphics/system/icon.ico
#{
title
}
#{
msg
}
"
)
end
end
end
\ No newline at end of file
lib/scene_error.rb
View file @
7678d09f
require
'widget_msgbox'
#encoding: UTF-8
require_relative
'widget_msgbox'
class
Scene_Error
<
Scene
class
Scene_Error
<
Scene
def
start
def
start
Widget_Msgbox
.
new
(
"程序出错"
,
"似乎出现了一个bug,请到论坛反馈"
,
:ok
=>
"确定"
){
$scene
=
Scene_Title
.
new
}
Widget_Msgbox
.
new
(
"程序出错"
,
"似乎出现了一个bug,请到论坛反馈"
,
:ok
=>
"确定"
){
$scene
=
Scene_Title
.
new
}
...
...
lib/scene_login.rb
View file @
7678d09f
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
class
Scene_Login
<
Scene
class
Scene_Login
<
Scene
Vocab_Logging
=
"Logging"
Vocab_Logging
=
"Logging"
def
start
def
start
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"
]
...
@@ -18,6 +17,9 @@ class Scene_Login < Scene
...
@@ -18,6 +17,9 @@ class Scene_Login < Scene
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)
require_relative
'game'
require_relative
'iduel/iduel'
require_relative
'widget_msgbox'
Widget_Msgbox
.
new
(
"iduel"
,
"正在登陆"
)
Widget_Msgbox
.
new
(
"iduel"
,
"正在登陆"
)
$game
=
Iduel
.
new
$game
=
Iduel
.
new
$game
.
login
(
@username
,
@password
)
$game
.
login
(
@username
,
@password
)
...
...
lib/scene_title.rb
View file @
7678d09f
...
@@ -4,10 +4,10 @@
...
@@ -4,10 +4,10 @@
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# 銆�itle
# 銆�itle
#==============================================================================
#==============================================================================
require_relative
'scene'
require_relative
'window_title'
class
Scene_Title
<
Scene
class
Scene_Title
<
Scene
require_relative
'window_title'
def
start
def
start
title
=
Dir
.
glob
(
"graphics/titles/title_*.*"
)
title
=
Dir
.
glob
(
"graphics/titles/title_*.*"
)
title
=
title
[
rand
(
title
.
size
)]
title
=
title
[
rand
(
title
.
size
)]
@background
=
Surface
.
load
(
title
)
@background
=
Surface
.
load
(
title
)
...
...
lib/user.rb
View file @
7678d09f
require_relative
'cacheable'
class
User
class
User
attr_accessor
:id
,
:name
attr_accessor
:id
,
:name
extend
Cacheable
extend
Cacheable
...
...
lib/window_list.rb
View file @
7678d09f
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# 大厅内房间列表
# 大厅内房间列表
#==============================================================================
#==============================================================================
require_relative
'window'
class
Window_List
<
Window
class
Window_List
<
Window
attr_reader
:list
attr_reader
:list
attr_reader
:index
attr_reader
:index
...
...
lib/window_lp.rb
View file @
7678d09f
...
@@ -6,10 +6,15 @@ class Window_LP < Window
...
@@ -6,10 +6,15 @@ class Window_LP < Window
@position
=
position
@position
=
position
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
20
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
20
)
@color
=
[
255
,
255
,
255
]
@color
=
[
255
,
255
,
255
]
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
if
@position
if
@position
@font
.
draw_solid_utf8
(
@contents
,
@player
.
name
,
Avatar_Size
,
24
,
*
@color
)
@font
.
draw_solid_utf8
(
@contents
,
@player
.
name
,
Avatar_Size
,
24
,
*
@color
)
...
@@ -17,7 +22,6 @@ class Window_LP < Window
...
@@ -17,7 +22,6 @@ class Window_LP < Window
@font
.
draw_solid_utf8
(
@contents
,
@player
.
name
,
@width
-
Avatar_Size
-
96
,
24
,
*
@color
)
@font
.
draw_solid_utf8
(
@contents
,
@player
.
name
,
@width
-
Avatar_Size
-
96
,
24
,
*
@color
)
end
end
end
end
self
.
lp
=
8000
end
end
def
lp
=
(
lp
)
def
lp
=
(
lp
)
return
if
lp
==
@lp
return
if
lp
==
@lp
...
...
lib/window_title.rb
View file @
7678d09f
require_relative
'window_list'
class
Window_Title
<
Window_List
class
Window_Title
<
Window_List
Button_Count
=
5
Button_Count
=
5
WLH
=
50
WLH
=
50
...
...
mycard.cmd
View file @
7678d09f
@echo
off
@echo
off
cd
/d
%~dp0
cd
/d
%~dp0
echo
------------------
>>
log
.log
ruby
\bin\ruby
lib
/main
.rb
echo
------------------
>>
err
.log
\ No newline at end of file
ruby
\bin\ruby
lib
/main
.rb
0
>>
log
.log
2
>>
err
.log
\ 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