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
6790eed8
Commit
6790eed8
authored
Feb 28, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BGM显示标题
parent
0d173898
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
221 additions
and
10 deletions
+221
-10
audio/bgm/duel.ogg
audio/bgm/duel.ogg
+0
-0
audio/bgm/lobby.ogg
audio/bgm/lobby.ogg
+0
-0
audio/bgm/title.ogg
audio/bgm/title.ogg
+0
-0
lib/ogginfo.rb
lib/ogginfo.rb
+180
-0
lib/scene.rb
lib/scene.rb
+11
-1
lib/scene_duel.rb
lib/scene_duel.rb
+1
-2
lib/scene_lobby.rb
lib/scene_lobby.rb
+1
-4
lib/scene_login.rb
lib/scene_login.rb
+2
-0
lib/scene_title.rb
lib/scene_title.rb
+1
-2
lib/window_bgm.rb
lib/window_bgm.rb
+24
-0
lib/window_cardinfo.rb
lib/window_cardinfo.rb
+1
-1
No files found.
audio/bgm/duel.ogg
View file @
6790eed8
No preview for this file type
audio/bgm/lobby.ogg
View file @
6790eed8
No preview for this file type
audio/bgm/title.ogg
View file @
6790eed8
No preview for this file type
lib/ogginfo.rb
0 → 100644
View file @
6790eed8
# $Id$
# = Description
#
# ruby-ogginfo gives you access to low level information on ogg files
# (bitrate, length, samplerate, encoder, etc... ), as well as tag.
# It is written in pure ruby.
#
#
# = Download
#
#
# http://rubyforge.org/projects/ruby-ogginfo/
#
#
# = Generate documentation
#
# rdoc --template=kilmer ogginfo.rb
#
#
# = Changelog
#
# [0.1 20/06/2004]
#
# * first public version
#
#
# License:: Ruby
# Author:: Guillaume Pierronnet (mailto:moumar_AT__rubyforge_DOT_org)
# Website:: http://ruby-ogginfo.rubyforge.org/
#
# see http://www.xiph.org/ogg/vorbis/docs.html for documentation on vorbis format
# http://www.xiph.org/ogg/vorbis/doc/v-comment.html
require
"iconv"
# Raised on any kind of error related to ruby-ogginfo
class
OggInfoError
<
StandardError
;
end
class
OggInfo
=begin
FIELDS_MAPPING = {
"title" => "songname",
"artist" => "artist",
"album" => "album",
"date" => "year",
"description" => "comment",
"tracknumber" => "tracknum",
"genre" => "genre"
}
=end
attr_reader
:channels
,
:samplerate
,
:bitrate
,
:tag
,
:length
def
initialize
(
filename
,
charset
=
"iso-8859-1"
)
begin
@file
=
File
.
new
(
filename
,
"rb"
)
find_page
()
extract_infos
()
find_page
()
extract_tag
(
charset
)
extract_end
()
ensure
close
end
end
# "block version" of ::new()
def
self
.
open
(
filename
)
m
=
self
.
new
(
filename
)
ret
=
nil
if
block_given?
begin
ret
=
yield
(
m
)
ensure
m
.
close
end
else
ret
=
m
end
ret
end
def
close
@file
.
close
if
@file
and
not
@file
.
closed?
end
def
hastag?
not
@tag
.
empty?
end
def
to_s
"channels
#{
@channels
}
samplerate
#{
@samplerate
}
bitrate
#{
@bitrate
}
length
#{
@length
}
"
end
private
def
find_page
header
=
'OggS'
# 0xf4 . 0x67 . 0x 67 . 0x53
bytes
=
@file
.
read
(
4
)
bytes_read
=
4
while
header
!=
bytes
#raise OggInfoError if bytes_read > 4096 or @file.eof? #bytes.nil?
raise
OggInfoError
if
@file
.
eof?
#bytes.nil?
bytes
.
slice!
(
0
)
char
=
@file
.
read
(
1
)
bytes_read
+=
1
bytes
<<
char
end
end
def
extract_infos
# @bitrate = {}
@file
.
seek
(
35
,
IO
::
SEEK_CUR
)
# seek after "vorbis"
# @channels, @samplerate, @bitrate["upper"], @bitrate["nominal"], @bitrate["lower"] =
@channels
,
@samplerate
,
up_br
,
br
,
down_br
=
@file
.
read
(
17
).
unpack
(
"CV4"
)
@bitrate
=
if
br
==
0
if
up
==
2
**
32
-
1
or
down
==
2
**
32
-
1
0
else
(
up_br
+
down_br
)
/
2
end
else
br
end
end
def
extract_tag
(
charset
)
@tag
=
{}
@file
.
seek
(
22
,
IO
::
SEEK_CUR
)
segs
=
@file
.
read
(
1
).
unpack
(
"C"
)[
0
]
@file
.
seek
(
segs
+
7
,
IO
::
SEEK_CUR
)
size
=
@file
.
read
(
4
).
unpack
(
"V"
)[
0
]
@file
.
seek
(
size
,
IO
::
SEEK_CUR
)
tag_size
=
@file
.
read
(
4
).
unpack
(
"V"
)[
0
]
#ic = Iconv.new(charset, "utf8")
tag_size
.
times
do
|
i
|
size
=
@file
.
read
(
4
).
unpack
(
"V"
)[
0
]
com
=
@file
.
read
(
size
)
comment
=
com
comment
.
force_encoding
"UTF-8"
# begin
# comment = ic.iconv( com )
# rescue Iconv::IllegalSequence, Iconv::InvalidCharacter
# comment = com
# end
key
,
val
=
comment
.
split
(
/=/
)
@tag
[
key
.
downcase
]
=
val
end
#ic.close
end
def
extract_end
begin
#Errno::EINVAL
@file
.
seek
(
-
5000
,
IO
::
SEEK_END
)
#FIXME size of seeking
find_page
pos
=
@file
.
read
(
6
).
unpack
(
"x2 V"
)[
0
]
#FIXME pos is int64
@length
=
pos
.
to_f
/
@samplerate
rescue
Errno
::
EINVAL
@length
=
0
end
end
end
if
$0
==
__FILE__
while
filename
=
ARGV
.
shift
puts
"Getting info from
#{
filename
}
"
begin
ogg
=
OggInfo
.
new
(
filename
)
rescue
OggInfoError
puts
"error: doesn't appear to be an ogg file"
else
puts
ogg
ogg
.
tag
.
each
{
|
key
,
value
|
puts
"
#{
key
}
=>
#{
value
}
"
}
end
puts
end
end
\ No newline at end of file
lib/scene.rb
View file @
6790eed8
...
@@ -6,10 +6,13 @@
...
@@ -6,10 +6,13 @@
#==============================================================================
#==============================================================================
require_relative
'fpstimer'
require_relative
'fpstimer'
require_relative
'game'
require_relative
'game'
require_relative
'window_bgm'
require_relative
'ogginfo'
class
Scene
class
Scene
attr_reader
:windows
attr_reader
:windows
attr_reader
:background
attr_reader
:background
@@fpstimer
=
FPSTimer
.
new
@@fpstimer
=
FPSTimer
.
new
@@last_bgm
=
@@bgm
=
nil
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 主处理
# ● 主处理
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
...
@@ -43,7 +46,13 @@ class Scene
...
@@ -43,7 +46,13 @@ class Scene
# ● 开始处理
# ● 开始处理
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def
start
def
start
if
@@last_bgm
!=
self
.
class
::
BGM
@@bgm
.
destroy
if
@@bgm
@@bgm
=
Mixer
::
Music
.
load
"audio/bgm/
#{
self
.
class
::
BGM
}
"
Mixer
.
fade_in_music
(
@@bgm
,
-
1
,
800
)
@bgm_window
=
Window_BGM
.
new
OggInfo
.
new
(
"audio/bgm/
#{
self
.
class
::
BGM
}
"
,
"UTF-8"
).
tag
[
"title"
]
@@last_bgm
=
self
.
class
::
BGM
end
end
end
def
refresh_rect
(
x
,
y
,
width
,
height
,
background
=
@background
,
ox
=
0
,
oy
=
0
)
def
refresh_rect
(
x
,
y
,
width
,
height
,
background
=
@background
,
ox
=
0
,
oy
=
0
)
Surface
.
blit
(
background
,
x
+
ox
,
y
+
oy
,
width
,
height
,
$screen
,
x
,
y
)
Surface
.
blit
(
background
,
x
+
ox
,
y
+
oy
,
width
,
height
,
$screen
,
x
,
y
)
...
@@ -65,6 +74,7 @@ class Scene
...
@@ -65,6 +74,7 @@ class Scene
# ● 更新画面
# ● 更新画面
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def
update
def
update
@bgm_window
.
update
if
@bgm_window
and
!
@bgm_window
.
destroyed?
while
event
=
Event
.
poll
while
event
=
Event
.
poll
handle
(
event
)
handle
(
event
)
end
end
...
...
lib/scene_duel.rb
View file @
6790eed8
...
@@ -21,6 +21,7 @@ class Scene_Duel < Scene
...
@@ -21,6 +21,7 @@ class Scene_Duel < Scene
attr_reader
:player_field_window
attr_reader
:player_field_window
attr_reader
:opponent_field_window
attr_reader
:opponent_field_window
attr_reader
:fieldback_window
attr_reader
:fieldback_window
BGM
=
"audio/bgm/duel.ogg"
def
initialize
(
room
,
deck
=
nil
)
def
initialize
(
room
,
deck
=
nil
)
super
()
super
()
@room
=
room
@room
=
room
...
@@ -28,8 +29,6 @@ class Scene_Duel < Scene
...
@@ -28,8 +29,6 @@ class Scene_Duel < Scene
end
end
def
start
def
start
WM
::
set_caption
(
"MyCard -
#{
$config
[
'game'
]
}
-
#{
$game
.
user
.
name
}
(
#{
$game
.
user
.
id
}
) -
#{
@room
.
name
}
(
#{
@room
.
id
}
)"
,
"MyCard"
)
WM
::
set_caption
(
"MyCard -
#{
$config
[
'game'
]
}
-
#{
$game
.
user
.
name
}
(
#{
$game
.
user
.
id
}
) -
#{
@room
.
name
}
(
#{
@room
.
id
}
)"
,
"MyCard"
)
@bgm
=
Mixer
::
Music
.
load
"audio/bgm/duel.ogg"
Mixer
.
fade_in_music
(
@bgm
,
-
1
,
800
)
@background
=
Surface
.
load
(
"graphics/field/main.png"
).
display_format
@background
=
Surface
.
load
(
"graphics/field/main.png"
).
display_format
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
0
,
0
)
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
0
,
0
)
...
...
lib/scene_lobby.rb
View file @
6790eed8
...
@@ -13,6 +13,7 @@ class Scene_Lobby < Scene
...
@@ -13,6 +13,7 @@ class Scene_Lobby < Scene
require_relative
'chatmessage'
require_relative
'chatmessage'
require_relative
'scene_duel'
require_relative
'scene_duel'
attr_reader
:chat_window
attr_reader
:chat_window
BGM
=
"lobby.ogg"
def
start
def
start
WM
::
set_caption
(
"MyCard -
#{
$config
[
'game'
]
}
-
#{
$game
.
user
.
name
}
(
#{
$game
.
user
.
id
}
)"
,
"MyCard"
)
WM
::
set_caption
(
"MyCard -
#{
$config
[
'game'
]
}
-
#{
$game
.
user
.
name
}
(
#{
$game
.
user
.
id
}
)"
,
"MyCard"
)
$game
.
refresh
$game
.
refresh
...
@@ -24,10 +25,6 @@ class Scene_Lobby < Scene
...
@@ -24,10 +25,6 @@ class Scene_Lobby < Scene
@active_window
=
@roomlist
@active_window
=
@roomlist
@chat_window
=
Window_Chat
.
new
(
313
,
543
,
698
,
212
)
@chat_window
=
Window_Chat
.
new
(
313
,
543
,
698
,
212
)
bgm
=
Mixer
::
Music
.
load
(
"audio/bgm/lobby.ogg"
)
Mixer
.
fade_in_music
(
bgm
,
-
1
,
800
)
@bgm
.
destroy
if
@bgm
@bgm
=
bgm
@count
=
0
@count
=
0
super
super
end
end
...
...
lib/scene_login.rb
View file @
6790eed8
...
@@ -8,6 +8,7 @@ require_relative 'window_gameselect'
...
@@ -8,6 +8,7 @@ require_relative 'window_gameselect'
require_relative
'window_announcements'
require_relative
'window_announcements'
require_relative
'window_login'
require_relative
'window_login'
require_relative
'scene_replay'
require_relative
'scene_replay'
BGM
=
"title.ogg"
class
Scene_Login
<
Scene
class
Scene_Login
<
Scene
def
start
def
start
WM
::
set_caption
(
"MyCard"
,
"MyCard"
)
WM
::
set_caption
(
"MyCard"
,
"MyCard"
)
...
@@ -15,6 +16,7 @@ class Scene_Login < Scene
...
@@ -15,6 +16,7 @@ class Scene_Login < Scene
$config
[
'game'
]
=
'iDuel'
#临时修补点击过一次局域网之后无限进入局域网的问题
$config
[
'game'
]
=
'iDuel'
#临时修补点击过一次局域网之后无限进入局域网的问题
@gameselect_window
=
Window_GameSelect
.
new
(
117
,
269
)
@gameselect_window
=
Window_GameSelect
.
new
(
117
,
269
)
@announcements_window
=
Window_Announcements
.
new
(
313
,
265
,
600
,
24
)
@announcements_window
=
Window_Announcements
.
new
(
313
,
265
,
600
,
24
)
super
end
end
def
update
def
update
@announcements_window
.
update
@announcements_window
.
update
...
...
lib/scene_title.rb
View file @
6790eed8
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#==============================================================================
#==============================================================================
require_relative
'scene'
require_relative
'scene'
require_relative
'window_title'
require_relative
'window_title'
BGM
=
'title.ogg'
class
Scene_Title
<
Scene
class
Scene_Title
<
Scene
def
start
def
start
WM
::
set_caption
(
"MyCard"
,
"MyCard"
)
WM
::
set_caption
(
"MyCard"
,
"MyCard"
)
...
@@ -18,9 +19,7 @@ class Scene_Title < Scene
...
@@ -18,9 +19,7 @@ class Scene_Title < Scene
#@logo_window = Window.new(@command_window.x-(logo.w-@command_window.width)/2,150,logo.w,logo.h)
#@logo_window = Window.new(@command_window.x-(logo.w-@command_window.width)/2,150,logo.w,logo.h)
#@logo_window.contents = logo
#@logo_window.contents = logo
#$screen.update_rect(0,0,0,0)
#$screen.update_rect(0,0,0,0)
@bgm
=
Mixer
::
Music
.
load
'audio/bgm/title.ogg'
@decision_se
=
Mixer
::
Wave
.
load
(
"audio/se/decision.ogg"
)
@decision_se
=
Mixer
::
Wave
.
load
(
"audio/se/decision.ogg"
)
Mixer
.
fade_in_music
@bgm
,
-
1
,
800
super
super
end
end
...
...
lib/window_bgm.rb
0 → 100644
View file @
6790eed8
require_relative
'window'
class
Window_BGM
<
Window
def
initialize
(
bgm_name
)
@bgm_name
=
bgm_name
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
18
)
width
=
@font
.
text_size
(
"♪
#{
@bgm_name
}
"
)[
0
]
@count
=
0
@contents
=
@font
.
render_blended_utf8
(
"♪
#{
@bgm_name
}
"
,
255
,
255
,
255
)
super
(
$config
[
'screen'
][
'width'
],
0
,
width
,
24
,
999
)
end
def
update
if
@count
>=
180
if
@x
>=
$config
[
'screen'
][
'width'
]
self
.
destroy
else
self
.
x
+=
1.5
end
elsif
$config
[
'screen'
][
'width'
]
-
@x
<
@width
self
.
x
-=
1.5
else
@count
+=
1
end
end
end
\ No newline at end of file
lib/window_cardinfo.rb
View file @
6790eed8
...
@@ -4,7 +4,7 @@ class Window_CardInfo < Window
...
@@ -4,7 +4,7 @@ class Window_CardInfo < Window
def
initialize
(
x
,
y
)
def
initialize
(
x
,
y
)
super
(
x
,
y
,
1024
-
x
,
524
,
300
)
super
(
x
,
y
,
1024
-
x
,
524
,
300
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
self
.
card
=
Game_Card
.
new
Card
.
find
(
'name'
=>
:mycard
,
'number'
=>
:"000000"
,
'lore'
=>
"提示:
\n
快捷键:
\n
F10退出房间
\n
F12 返回主界面"
,
'card_type'
=>
:" "
,
'stats'
=>
""
,
'archettypes'
=>
""
,
"mediums"
=>
""
,
"tokens"
=>
0
)
self
.
card
=
Game_Card
.
new
Card
.
find
(
'name'
=>
:mycard
,
'number'
=>
:"000000"
,
'lore'
=>
"提示:
\n
快捷键:
\n
F10
退出房间
\n
F12 返回主界面"
,
'card_type'
=>
:" "
,
'stats'
=>
""
,
'archettypes'
=>
""
,
"mediums"
=>
""
,
"tokens"
=>
0
)
end
end
def
card
=
(
card
)
def
card
=
(
card
)
return
if
card
.
nil?
or
card
==
@card
or
!
card
.
known?
return
if
card
.
nil?
or
card
==
@card
or
!
card
.
known?
...
...
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