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
b33ab42f
Commit
b33ab42f
authored
Dec 27, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log
parent
7678d09f
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
26 additions
and
38 deletions
+26
-38
lib/action.rb
lib/action.rb
+1
-1
lib/iduel/event.rb
lib/iduel/event.rb
+0
-5
lib/iduel/iduel.rb
lib/iduel/iduel.rb
+2
-2
lib/main.rb
lib/main.rb
+9
-7
lib/scene.rb
lib/scene.rb
+6
-4
lib/scene_hall.rb
lib/scene_hall.rb
+1
-1
lib/widget_scrollbar.rb
lib/widget_scrollbar.rb
+0
-2
lib/window.rb
lib/window.rb
+3
-10
lib/window_list.rb
lib/window_list.rb
+4
-6
No files found.
lib/action.rb
View file @
b33ab42f
lib/iduel/event.rb
View file @
b33ab42f
...
@@ -115,14 +115,12 @@ class Game_Event
...
@@ -115,14 +115,12 @@ class Game_Event
#"Q"
#"Q"
#"273,1,zh99998(201448),zh99997(201629)"
#"273,1,zh99998(201448),zh99997(201629)"
class
Watch
class
Watch
attr_reader
:room
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
id
,
name
=
info
.
split
(
","
,
2
)
id
,
name
=
info
.
split
(
","
,
2
)
self
.
new
Room
.
new
(
id
.
to_i
,
name
)
self
.
new
Room
.
new
(
id
.
to_i
,
name
)
end
end
end
end
class
Action
class
Action
attr_reader
:action
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
info
=~
/(.*)▊▊▊.*?$/m
info
=~
/(.*)▊▊▊.*?$/m
info
=
$1
info
=
$1
...
@@ -133,8 +131,6 @@ class Game_Event
...
@@ -133,8 +131,6 @@ class Game_Event
class
Leave
class
Leave
end
end
class
Chat
class
Chat
attr_reader
:user
,
:content
alias
old_initialize
initialize
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
user
,
content
=
info
.
split
(
","
,
2
)
user
,
content
=
info
.
split
(
","
,
2
)
user
=
user
==
"System"
?
User
.
new
(
100000
,
"iDuel管理中心"
)
:
User
.
parse
(
user
)
user
=
user
==
"System"
?
User
.
new
(
100000
,
"iDuel管理中心"
)
:
User
.
parse
(
user
)
...
@@ -142,7 +138,6 @@ class Game_Event
...
@@ -142,7 +138,6 @@ class Game_Event
end
end
end
end
class
Error
class
Error
attr_reader
:title
,
:message
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
title
,
message
=
case
info
.
to_i
title
,
message
=
case
info
.
to_i
when
0x00
when
0x00
...
...
lib/iduel/iduel.rb
View file @
b33ab42f
...
@@ -26,14 +26,14 @@ class Iduel < Game
...
@@ -26,14 +26,14 @@ class Iduel < Game
recv
@conn
.
gets
(
RS
)
while
@conn
recv
@conn
.
gets
(
RS
)
while
@conn
rescue
=>
exception
rescue
=>
exception
Game_Event
.
push
Game_Event
::
Error
.
new
(
exception
.
class
.
to_s
,
exception
.
message
)
Game_Event
.
push
Game_Event
::
Error
.
new
(
exception
.
class
.
to_s
,
exception
.
message
)
$log
.
warn
([
exception
.
inspect
]
+
exception
.
backtrace
)
.
join
(
"
\n
"
)
$log
.
error
[
exception
.
inspect
,
*
exception
.
backtrace
]
.
join
(
"
\n
"
)
ensure
ensure
self
.
exit
self
.
exit
end
end
end
end
rescue
=>
exception
rescue
=>
exception
Game_Event
.
push
Game_Event
::
Error
.
new
(
exception
.
class
.
to_s
,
exception
.
message
)
Game_Event
.
push
Game_Event
::
Error
.
new
(
exception
.
class
.
to_s
,
exception
.
message
)
$log
.
warn
([
exception
.
inspect
]
+
exception
.
backtrace
)
.
join
(
"
\n
"
)
$log
.
error
[
exception
.
inspect
,
*
exception
.
backtrace
]
.
join
(
"
\n
"
)
end
end
end
end
def
login
(
username
,
password
)
def
login
(
username
,
password
)
...
...
lib/main.rb
View file @
b33ab42f
#!/usr/bin/env ruby
#!/usr/bin/env ruby
#encoding: UTF-8
#encoding: UTF-8
begin
#切换工作目录
Dir
.
chdir
(
File
.
expand_path
(
".."
,
File
.
dirname
(
__FILE__
)))
begin
#读取配置文件
#读取配置文件
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"
)
...
@@ -24,11 +22,15 @@ begin
...
@@ -24,11 +22,15 @@ begin
#初始化日志
#初始化日志
require
'logger'
require
'logger'
$log
=
Logger
.
new
(
STDOUT
)
#调试用,发布时改为log.log并删掉下面那句
if
true
#调试用,由于将$DEBUG设成true时tk库会输出一大坨奇怪的东西,所以这里不能使用$DEBUG
STDOUT
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
if
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
STDOUT
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
if
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
$log
=
Logger
.
new
(
STDOUT
)
else
$log
=
Logger
.
new
(
"log.log"
)
end
$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
...
@@ -37,7 +39,7 @@ begin
...
@@ -37,7 +39,7 @@ 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
){
([
exception
.
inspect
]
+
exception
.
backtrace
)
.
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/scene.rb
View file @
b33ab42f
...
@@ -11,6 +11,12 @@ class Scene
...
@@ -11,6 +11,12 @@ class Scene
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 主处理
# ● 主处理
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def
initialize
@background
=
nil
@windows
=
[]
@active_window
=
nil
@font
=
TTF
.
open
(
'fonts/WenQuanYi Micro Hei.ttf'
,
16
)
end
def
main
def
main
start
start
while
$scene
==
self
while
$scene
==
self
...
@@ -30,10 +36,6 @@ class Scene
...
@@ -30,10 +36,6 @@ class Scene
end
end
terminate
terminate
end
end
def
initialize
@windows
=
[]
@font
=
TTF
.
open
(
'fonts/WenQuanYi Micro Hei.ttf'
,
16
)
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 开始处理
# ● 开始处理
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
...
...
lib/scene_hall.rb
View file @
b33ab42f
lib/widget_scrollbar.rb
View file @
b33ab42f
...
@@ -10,9 +10,7 @@ class Widget_ScrollBar < Window
...
@@ -10,9 +10,7 @@ class Widget_ScrollBar < Window
@back
=
Surface
.
load
(
'graphics/hall/scroll_background.png'
)
@back
=
Surface
.
load
(
'graphics/hall/scroll_background.png'
)
@bar
=
Surface
.
load
(
'graphics/hall/scroll.png'
)
@bar
=
Surface
.
load
(
'graphics/hall/scroll.png'
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFFFFFFFF
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFFFFFFFF
)
@background
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFFFFFFFF
)
Surface
.
transform_draw
(
@back
,
@contents
,
0
,
1
,
@contents
.
h
.
to_f
/
@back
.
h
,
0
,
0
,
0
,
0
,
0
)
Surface
.
transform_draw
(
@back
,
@contents
,
0
,
1
,
@contents
.
h
.
to_f
/
@back
.
h
,
0
,
0
,
0
,
0
,
0
)
Surface
.
transform_draw
(
@back
,
@background
,
0
,
1
,
@contents
.
h
.
to_f
/
@back
.
h
,
0
,
0
,
0
,
0
,
0
)
refresh
refresh
end
end
def
index
=
(
index
)
def
index
=
(
index
)
...
...
lib/window.rb
View file @
b33ab42f
...
@@ -10,20 +10,13 @@ class Window
...
@@ -10,20 +10,13 @@ class Window
@visible
=
true
@visible
=
true
@angle
=
0
@angle
=
0
@viewport
=
[
0
,
0
,
@width
,
@height
]
@viewport
=
[
0
,
0
,
@width
,
@height
]
@destroyed
=
false
amask
=
0xff000000
amask
=
0xff000000
rmask
=
0x00ff0000
rmask
=
0x00ff0000
gmask
=
0x0000ff00
gmask
=
0x0000ff00
bmask
=
0x000000ff
bmask
=
0x000000ff
#@background ||= Surface.new(SWSURFACE, @width, @height, 32, rmask, gmask, bmask, amask)
@contents
||=
Surface
.
new
(
SWSURFACE
,
@width
,
@height
,
32
,
rmask
,
gmask
,
bmask
,
amask
)
unless
@background
@background
=
Surface
.
new
(
SWSURFACE
,
@width
,
@height
,
32
,
rmask
,
gmask
,
bmask
,
amask
)
#@background.fill_rect(0,0,@width,@height,0x66000000)
end
unless
@contents
@contents
=
Surface
.
new
(
SWSURFACE
,
@width
,
@height
,
32
,
rmask
,
gmask
,
bmask
,
amask
)
#@contents.fill_rect(0,0,@width,@height,0x66000000)
end
#按Z坐标插入
#按Z坐标插入
unless
$scene
.
windows
.
each_with_index
do
|
window
,
index
|
unless
$scene
.
windows
.
each_with_index
do
|
window
,
index
|
if
window
.
z
>
@z
if
window
.
z
>
@z
...
...
lib/window_list.rb
View file @
b33ab42f
...
@@ -9,8 +9,9 @@ class Window_List < Window
...
@@ -9,8 +9,9 @@ class Window_List < Window
attr_reader
:list
attr_reader
:list
attr_reader
:index
attr_reader
:index
def
initialize
(
x
,
y
,
width
,
height
,
z
=
200
)
def
initialize
(
x
,
y
,
width
,
height
,
z
=
200
)
@list
||=
[]
@index
||=
nil
super
(
x
,
y
,
width
,
height
,
z
)
super
(
x
,
y
,
width
,
height
,
z
)
@list
=
[]
unless
@list
@o_index
=
0
@o_index
=
0
@item_max
=
0
@item_max
=
0
@column_max
=
1
@column_max
=
1
...
@@ -45,10 +46,7 @@ class Window_List < Window
...
@@ -45,10 +46,7 @@ class Window_List < Window
end
end
def
refresh
def
refresh
clear
clear
@item_max
.
times
{
|
index
|
draw_item
(
index
,
index
==
@index
?
1
:
0
)}
@item_max
.
times
do
|
index
|
draw_item
(
index
,
index
==
@index
?
1
:
0
)
end
end
end
def
cursor_up
def
cursor_up
self
.
index
=
@index
?
(
@index
-
@column_max
)
%
[
@list
.
size
,
@item_max
].
min
:
0
self
.
index
=
@index
?
(
@index
-
@column_max
)
%
[
@list
.
size
,
@item_max
].
min
:
0
...
...
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