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
e075ad12
Commit
e075ad12
authored
Apr 10, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本0.5.3 大厅实时刷新
parent
d4b6da98
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
16 deletions
+49
-16
Rakefile
Rakefile
+1
-1
lib/game.rb
lib/game.rb
+3
-0
lib/game_event.rb
lib/game_event.rb
+7
-2
lib/scene_lobby.rb
lib/scene_lobby.rb
+1
-1
lib/update.rb
lib/update.rb
+1
-1
lib/ygocore/event.rb
lib/ygocore/event.rb
+33
-11
lib/ygocore/game.rb
lib/ygocore/game.rb
+3
-0
No files found.
Rakefile
View file @
e075ad12
...
...
@@ -24,7 +24,7 @@ end
spec
=
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
'mycard'
s
.
version
=
'0.5.
2
'
s
.
version
=
'0.5.
3
'
s
.
extra_rdoc_files
=
[
'README.txt'
,
'LICENSE.txt'
]
s
.
summary
=
'a card game'
s
.
description
=
s
.
summary
...
...
lib/game.rb
View file @
e075ad12
...
...
@@ -34,6 +34,9 @@ class Game
end
def
self
.
deck_edit
end
def
refresh_interval
5
end
end
lib/game_event.rb
View file @
e075ad12
...
...
@@ -69,10 +69,15 @@ class Game_Event
attr_reader
:room
def
initialize
(
room
)
@room
=
room
$game
.
rooms
<<
@room
unless
$game
.
rooms
.
include?
@room
unless
$game
.
rooms
.
include?
@room
if
@room
.
full?
$game
.
rooms
<<
@room
else
$game
.
rooms
.
unshift
@room
end
end
end
end
class
MissingRoom
<
AllRooms
attr_reader
:room
def
initialize
(
room
)
...
...
lib/scene_lobby.rb
View file @
e075ad12
...
...
@@ -88,7 +88,7 @@ class Scene_Lobby < Scene
def
update
@chat_window
.
update
@host_window
.
update
if
@count
>=
60
0
if
@count
>=
$game
.
refresh_interval
*
6
0
$game
.
refresh
@count
=
0
end
...
...
lib/update.rb
View file @
e075ad12
...
...
@@ -2,7 +2,7 @@ require 'open-uri'
require
"fileutils"
require_relative
'card'
module
Update
Version
=
'0.5.
2
'
Version
=
'0.5.
3
'
URL
=
"http://card.touhou.cc/mycard/update.json?version=
#{
Version
}
"
class
<<
self
attr_reader
:thumbnails
,
:images
,
:status
...
...
lib/ygocore/event.rb
View file @
e075ad12
...
...
@@ -3,22 +3,32 @@ class Game_Event
case
header
when
:login
if
data
Login
.
new
User
.
new
(
data
[
:id
],
data
[
:name
])
Login
.
new
parse_user
data
else
Error
.
new
(
'登录'
,
'用户名或密码错误'
)
end
when
:users
AllUsers
.
new
data
.
collect
{
|
user
|
User
.
new
(
user
[
:id
],
user
[
:name
],
user
[
:certified
]
)}
AllUsers
.
new
data
.
collect
{
|
user
|
parse_user
(
user
)}
when
:rooms
AllRooms
.
new
data
.
collect
{
|
room
|
result
=
Room
.
new
(
room
[
:id
],
room
[
:name
])
result
.
player1
=
room
[
:player1
]
&&
User
.
new
(
room
[
:player1
][
:id
],
room
[
:player1
][
:name
])
result
.
player2
=
room
[
:player2
]
&&
User
.
new
(
room
[
:player2
][
:id
],
room
[
:player2
][
:name
])
result
.
pvp
=
room
[
:pvp
]
result
.
match
=
room
[
:match
]
result
.
status
=
room
[
:status
]
result
}.
sort_by
{
|
room
|
room
.
full?
?
1
:
0
}
rooms_wait
=
[]
rooms_start
=
[]
data
.
each
do
|
room
|
room
=
parse_room
(
room
)
if
room
.
full?
rooms_start
<<
room
else
rooms_wait
<<
room
end
end
AllRooms
.
new
rooms_wait
+
rooms_start
when
:newuser
NewUser
.
new
parse_user
data
when
:missinguser
MissingUser
.
new
parse_user
data
when
:newroom
NewRoom
.
new
parse_room
data
when
:missingroom
MissingRoom
.
new
parse_room
data
when
:chat
case
data
[
:channel
]
when
:lobby
...
...
@@ -28,4 +38,16 @@ class Game_Event
end
end
end
def
self
.
parse_room
(
room
)
result
=
Room
.
new
(
room
[
:id
],
room
[
:name
])
result
.
player1
=
room
[
:player1
]
&&
parse_user
(
room
[
:player1
])
result
.
player2
=
room
[
:player2
]
&&
parse_user
(
room
[
:player2
])
result
.
pvp
=
room
[
:pvp
]
result
.
match
=
room
[
:match
]
result
.
status
=
room
[
:status
]
result
end
def
self
.
parse_user
(
user
)
User
.
new
(
user
[
:id
],
user
[
:name
],
user
[
:certified
])
end
end
\ No newline at end of file
lib/ygocore/game.rb
View file @
e075ad12
...
...
@@ -14,6 +14,9 @@ class Ygocore < Game
load
'lib/ygocore/scene_lobby.rb'
require
'json'
end
def
refresh_interval
60
end
def
login
(
username
,
password
)
@username
=
username
@password
=
password
...
...
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