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
7252ed1a
Commit
7252ed1a
authored
Jul 18, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp2
parent
59e18392
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
475 additions
and
475 deletions
+475
-475
lib/main.rb
lib/main.rb
+174
-174
lib/scene_lobby.rb
lib/scene_lobby.rb
+95
-95
lib/update.rb
lib/update.rb
+146
-146
lib/window_roomlist.rb
lib/window_roomlist.rb
+60
-60
No files found.
lib/main.rb
View file @
7252ed1a
This diff is collapsed.
Click to expand it.
lib/scene_lobby.rb
View file @
7252ed1a
#encoding: UTF-8
#==============================================================================
# Scene_Lobby
#------------------------------------------------------------------------------
# 大厅
#==============================================================================
class
Scene_Lobby
<
Scene
require_relative
'window_userlist'
require_relative
'window_userinfo'
require_relative
'window_roomlist'
require_relative
'window_chat'
require_relative
'window_host'
require_relative
'window_lobbybuttons'
require_relative
'chatmessage'
require_relative
'scene_duel'
attr_reader
:chat_window
def
start
WM
::
set_caption
(
"MyCard v
#{
Update
::
Version
}
-
#{
$config
[
'game'
]
}
-
#{
$game
.
user
.
name
}
(
#{
$game
.
user
.
id
}
)"
,
"MyCard"
)
$game
.
refresh
@background
=
Surface
.
load
(
"graphics/lobby/background.png"
).
display_format
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
0
,
0
)
@userlist
=
Window_UserList
.
new
(
24
,
204
,
$game
.
users
)
@roomlist
=
Window_RoomList
.
new
(
320
,
50
,
$game
.
rooms
)
@userinfo
=
Window_UserInfo
.
new
(
24
,
24
,
$game
.
user
)
@host_window
=
Window_LobbyButtons
.
new
(
748
,
18
)
@active_window
=
@roomlist
@chat_window
=
Window_Chat
.
new
(
313
,
543
,
698
,
212
)
@count
=
0
super
end
def
bgm
"lobby.ogg"
end
def
handle
(
event
)
case
event
when
Event
::
KeyDown
case
event
.
sym
when
Key
::
UP
@active_window
.
cursor_up
when
Key
::
DOWN
@active_window
.
cursor_down
when
Key
::
F2
#@joinroom_msgbox = Widget_Msgbox.new("创建房间", "正在等待对手")
#$game.host Room.new(0, $game.user.name)
when
Key
::
F3
#@joinroom_msgbox = Widget_Msgbox.new("加入房间", "正在加入房间")
#$game.join 'localhost'
when
Key
::
F5
$game
.
refresh
when
Key
::
F12
$game
.
exit
$scene
=
Scene_Login
.
new
end
else
super
end
end
def
handle_game
(
event
)
case
event
when
Game_Event
::
AllUsers
@userlist
.
items
=
$game
.
users
when
Game_Event
::
AllRooms
@roomlist
.
items
=
$game
.
rooms
when
Game_Event
::
Join
join
(
event
.
room
)
when
Game_Event
::
Watch
require_relative
'scene_watch'
$scene
=
Scene_Watch
.
new
(
event
.
room
)
when
Game_Event
::
Chat
@chat_window
.
add
event
.
chatmessage
else
super
end
end
def
join
(
room
)
$scene
=
Scene_Duel
.
new
(
room
)
end
def
update
@chat_window
.
update
@host_window
.
update
@roomlist
.
update
if
@count
>=
$game
.
refresh_interval
*
60
$game
.
refresh
@count
=
0
end
@count
+=
1
super
end
def
terminate
unless
$scene
.
is_a?
Scene_Lobby
or
$scene
.
is_a?
Scene_Duel
$game
.
exit
end
end
#encoding: UTF-8
#==============================================================================
# Scene_Lobby
#------------------------------------------------------------------------------
# 大厅
#==============================================================================
class
Scene_Lobby
<
Scene
require_relative
'window_userlist'
require_relative
'window_userinfo'
require_relative
'window_roomlist'
require_relative
'window_chat'
require_relative
'window_host'
require_relative
'window_lobbybuttons'
require_relative
'chatmessage'
require_relative
'scene_duel'
attr_reader
:chat_window
def
start
WM
::
set_caption
(
"MyCard v
#{
Update
::
Version
}
-
#{
$config
[
'game'
]
}
-
#{
$game
.
user
.
name
}
(
#{
$game
.
user
.
id
}
)"
,
"MyCard"
)
$game
.
refresh
@background
=
Surface
.
load
(
"graphics/lobby/background.png"
).
display_format
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
0
,
0
)
@userlist
=
Window_UserList
.
new
(
24
,
204
,
$game
.
users
)
@roomlist
=
Window_RoomList
.
new
(
320
,
50
,
$game
.
rooms
)
@userinfo
=
Window_UserInfo
.
new
(
24
,
24
,
$game
.
user
)
@host_window
=
Window_LobbyButtons
.
new
(
748
,
18
)
@active_window
=
@roomlist
@chat_window
=
Window_Chat
.
new
(
313
,
543
,
698
,
212
)
@count
=
0
super
end
def
bgm
"lobby.ogg"
end
def
handle
(
event
)
case
event
when
Event
::
KeyDown
case
event
.
sym
when
Key
::
UP
@active_window
.
cursor_up
when
Key
::
DOWN
@active_window
.
cursor_down
when
Key
::
F2
#@joinroom_msgbox = Widget_Msgbox.new("创建房间", "正在等待对手")
#$game.host Room.new(0, $game.user.name)
when
Key
::
F3
#@joinroom_msgbox = Widget_Msgbox.new("加入房间", "正在加入房间")
#$game.join 'localhost'
when
Key
::
F5
$game
.
refresh
when
Key
::
F12
$game
.
exit
$scene
=
Scene_Login
.
new
end
else
super
end
end
def
handle_game
(
event
)
case
event
when
Game_Event
::
AllUsers
@userlist
.
items
=
$game
.
users
when
Game_Event
::
AllRooms
@roomlist
.
items
=
$game
.
rooms
when
Game_Event
::
Join
join
(
event
.
room
)
when
Game_Event
::
Watch
require_relative
'scene_watch'
$scene
=
Scene_Watch
.
new
(
event
.
room
)
when
Game_Event
::
Chat
@chat_window
.
add
event
.
chatmessage
else
super
end
end
def
join
(
room
)
$scene
=
Scene_Duel
.
new
(
room
)
end
def
update
@chat_window
.
update
@host_window
.
update
@roomlist
.
update
if
@count
>=
$game
.
refresh_interval
*
60
$game
.
refresh
@count
=
0
end
@count
+=
1
super
end
def
terminate
unless
$scene
.
is_a?
Scene_Lobby
or
$scene
.
is_a?
Scene_Duel
$game
.
exit
end
end
end
\ No newline at end of file
lib/update.rb
View file @
7252ed1a
This diff is collapsed.
Click to expand it.
lib/window_roomlist.rb
View file @
7252ed1a
#encoding: UTF-8
#==============================================================================
# ■ Window_Roomitems
#------------------------------------------------------------------------------
# 大厅内房间列表
#==============================================================================
require_relative
'window_scrollable'
require_relative
'window_join'
class
Window_RoomList
<
Window_Scrollable
attr_reader
:items
WLH
=
48
def
initialize
(
x
,
y
,
items
)
@button
=
Surface
.
load
(
'graphics/lobby/room.png'
)
@button
.
set_alpha
(
RLEACCEL
,
255
)
#@background = Surface.load 'graphics/lobby/roomitems.png'
#@contents = Surface.load 'graphics/lobby/roomitems.png'
super
(
x
,
y
,
@button
.
w
/
3
,
48
*
10
)
@item_max
=
0
@font
=
TTF
.
open
(
"fonts/wqy-microhei.ttc"
,
16
)
@color
=
[
0x03
,
0x11
,
0x22
]
@scrollbar
=
Widget_ScrollBar
.
new
(
self
,
@x
+
@width
,
@y
,
@height
)
self
.
items
=
items
end
def
draw_item
(
index
,
status
=
0
)
y
=
item_rect
(
index
)[
1
]
room
=
@items
[
index
]
Surface
.
blit
(
@button
,
@width
*
status
,
room
.
full?
?
WLH
:
0
,
@width
,
WLH
,
@contents
,
0
,
y
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
id
.
to_s
,
24
,
y
+
8
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
full?
?
"【决斗中】"
:
room
.
private?
?
"【私密房】"
:
"【等待中】"
,
8
,
y
+
24
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
name
,
128
,
y
+
8
,
*
room
.
color
)
unless
room
.
name
.
empty?
or
room
.
name
.
size
>
100
$log
.
error
(
'标题过长'
)
{
room
.
name
}
if
room
.
name
.
size
>
100
@font
.
draw_blended_utf8
(
@contents
,
room
.
player1
.
name
,
128
,
y
+
24
,
*
room
.
player1
.
color
)
if
room
.
player1
and
!
room
.
player1
.
name
.
empty?
@font
.
draw_blended_utf8
(
@contents
,
room
.
player2
.
name
,
320
,
y
+
24
,
*
room
.
player2
.
color
)
if
room
.
player2
and
!
room
.
player2
.
name
.
empty?
room
.
extra
.
each_with_index
do
|
extra
,
index
|
str
,
color
=
extra
@font
.
draw_blended_utf8
(
@contents
,
str
,
300
+
index
*
96
,
y
+
8
,
*
color
)
end
end
def
update
@join_window
.
update
if
@join_window
and
!
@join_window
.
destroyed?
end
def
mousemoved
(
x
,
y
)
return
unless
self
.
include?
(
x
,
y
)
self
.
index
=
(
y
-
@y
)
/
WLH
+
@scroll
end
def
clicked
return
unless
@index
and
room
=
@items
[
@index
]
if
room
.
full?
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入观战"
)
$game
.
watch
room
else
if
room
.
private
@join_window
=
Window_Join
.
new
(
0
,
0
,
room
)
else
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入房间"
)
$game
.
join
room
end
end
end
#encoding: UTF-8
#==============================================================================
# ■ Window_Roomitems
#------------------------------------------------------------------------------
# 大厅内房间列表
#==============================================================================
require_relative
'window_scrollable'
require_relative
'window_join'
class
Window_RoomList
<
Window_Scrollable
attr_reader
:items
WLH
=
48
def
initialize
(
x
,
y
,
items
)
@button
=
Surface
.
load
(
'graphics/lobby/room.png'
)
@button
.
set_alpha
(
RLEACCEL
,
255
)
#@background = Surface.load 'graphics/lobby/roomitems.png'
#@contents = Surface.load 'graphics/lobby/roomitems.png'
super
(
x
,
y
,
@button
.
w
/
3
,
48
*
10
)
@item_max
=
0
@font
=
TTF
.
open
(
"fonts/wqy-microhei.ttc"
,
16
)
@color
=
[
0x03
,
0x11
,
0x22
]
@scrollbar
=
Widget_ScrollBar
.
new
(
self
,
@x
+
@width
,
@y
,
@height
)
self
.
items
=
items
end
def
draw_item
(
index
,
status
=
0
)
y
=
item_rect
(
index
)[
1
]
room
=
@items
[
index
]
Surface
.
blit
(
@button
,
@width
*
status
,
room
.
full?
?
WLH
:
0
,
@width
,
WLH
,
@contents
,
0
,
y
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
id
.
to_s
,
24
,
y
+
8
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
full?
?
"【决斗中】"
:
room
.
private?
?
"【私密房】"
:
"【等待中】"
,
8
,
y
+
24
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
name
,
128
,
y
+
8
,
*
room
.
color
)
unless
room
.
name
.
empty?
or
room
.
name
.
size
>
100
$log
.
error
(
'标题过长'
)
{
room
.
name
}
if
room
.
name
.
size
>
100
@font
.
draw_blended_utf8
(
@contents
,
room
.
player1
.
name
,
128
,
y
+
24
,
*
room
.
player1
.
color
)
if
room
.
player1
and
!
room
.
player1
.
name
.
empty?
@font
.
draw_blended_utf8
(
@contents
,
room
.
player2
.
name
,
320
,
y
+
24
,
*
room
.
player2
.
color
)
if
room
.
player2
and
!
room
.
player2
.
name
.
empty?
room
.
extra
.
each_with_index
do
|
extra
,
index
|
str
,
color
=
extra
@font
.
draw_blended_utf8
(
@contents
,
str
,
300
+
index
*
96
,
y
+
8
,
*
color
)
end
end
def
update
@join_window
.
update
if
@join_window
and
!
@join_window
.
destroyed?
end
def
mousemoved
(
x
,
y
)
return
unless
self
.
include?
(
x
,
y
)
self
.
index
=
(
y
-
@y
)
/
WLH
+
@scroll
end
def
clicked
return
unless
@index
and
room
=
@items
[
@index
]
if
room
.
full?
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入观战"
)
$game
.
watch
room
else
if
room
.
private
@join_window
=
Window_Join
.
new
(
0
,
0
,
room
)
else
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入房间"
)
$game
.
join
room
end
end
end
end
\ 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