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
f3143cf8
Commit
f3143cf8
authored
Mar 05, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
好友系统
parent
900c79a9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
27 deletions
+66
-27
lib/iduel/event.rb
lib/iduel/event.rb
+11
-1
lib/iduel/game.rb
lib/iduel/game.rb
+42
-18
lib/iduel/user.rb
lib/iduel/user.rb
+1
-1
lib/scene_lobby.rb
lib/scene_lobby.rb
+1
-1
lib/user.rb
lib/user.rb
+2
-1
lib/window_userlist.rb
lib/window_userlist.rb
+9
-5
No files found.
lib/iduel/event.rb
View file @
f3143cf8
...
@@ -39,6 +39,7 @@ class Game_Event
...
@@ -39,6 +39,7 @@ class Game_Event
#>> $B|201629,zh99997,5da9e5fa,Level-1 (总经验:183),,20101118
#>> $B|201629,zh99997,5da9e5fa,Level-1 (总经验:183),,20101118
info
[
3
]
=~
/Level-(\d)+ \(总经验:(\d+)\)/
info
[
3
]
=~
/Level-(\d)+ \(总经验:(\d+)\)/
result
=
self
.
new
User
.
new
(
info
[
0
].
to_i
,
info
[
1
],
$1
.
to_i
,
$2
.
to_i
)
result
=
self
.
new
User
.
new
(
info
[
0
].
to_i
,
info
[
1
],
$1
.
to_i
,
$2
.
to_i
)
$game
.
get_friends
$game
.
session
=
info
[
2
]
$game
.
session
=
info
[
2
]
$game
.
key
=
(
$game
.
user
.
id
-
0x186a0
)
^
0x22133
$game
.
key
=
(
$game
.
user
.
id
-
0x186a0
)
^
0x22133
result
result
...
@@ -46,7 +47,16 @@ class Game_Event
...
@@ -46,7 +47,16 @@ class Game_Event
end
end
class
AllUsers
class
AllUsers
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
self
.
new
info
.
split
(
','
).
collect
{
|
user
|
User
.
parse
(
user
)}
users
=
[]
info
.
split
(
','
).
each
do
|
user
|
user
=
User
.
parse
(
user
)
if
user
.
friend?
users
.
unshift
user
else
users
<<
user
end
end
self
.
new
users
end
end
end
end
class
AllRooms
class
AllRooms
...
...
lib/iduel/game.rb
View file @
f3143cf8
...
@@ -96,6 +96,27 @@ class Iduel < Game
...
@@ -96,6 +96,27 @@ class Iduel < Game
#4|241019,test,2368c6b89b3e2eedb92e1b624a2a157c
#4|241019,test,2368c6b89b3e2eedb92e1b624a2a157c
end
end
def
get_friends
$config
[
'iDuel'
][
'friends'
]
||=
[]
$config
[
'iDuel'
][
'friends'
].
each
{
|
id
|
User
.
new
(
id
).
friend
=
true
}
Thread
.
new
do
begin
open
(
"http://www.duelcn.com/home.php?mod=space&uid=
#{
@user
.
id
-
100000
}
&do=friend&view=me&from=space"
)
do
|
file
|
$config
[
'iDuel'
][
'friends'
].
each
{
|
id
|
User
.
new
(
id
).
friend
=
false
}
$config
[
'iDuel'
][
'friends'
].
clear
file
.
set_encoding
"GBK"
,
"UTF-8"
file
.
read
.
scan
(
/<a href="home.php\?mod=space&uid=(\d+)" title=".*" target="_blank">.*<\/a>/
)
do
|
uid
,
others
|
id
=
uid
.
to_i
+
100000
User
.
new
(
id
).
friend
=
true
$config
[
'iDuel'
][
'friends'
]
<<
id
end
save_config
end
rescue
Exception
=>
exception
$log
.
error
(
'读取好友信息'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
).
encode
(
"UTF-8"
)}
end
end
end
private
private
def
connect
def
connect
require
'socket'
require
'socket'
...
@@ -129,6 +150,7 @@ class Iduel < Game
...
@@ -129,6 +150,7 @@ class Iduel < Game
info
.
gsub!
(
"
\n
"
,
"
\r\n
"
)
info
.
gsub!
(
"
\n
"
,
"
\r\n
"
)
(
@conn
.
write
info
)
rescue
Game_Event
.
push
Game_Event
::
Error
.
new
(
$!
.
class
.
to_s
,
$!
.
message
)
(
@conn
.
write
info
)
rescue
Game_Event
.
push
Game_Event
::
Error
.
new
(
$!
.
class
.
to_s
,
$!
.
message
)
end
end
def
self
.
get_announcements
#公告
#公告
$config
[
'iDuel'
][
'announcements'
]
||=
[
Announcement
.
new
(
"正在读取公告..."
,
nil
,
nil
)]
$config
[
'iDuel'
][
'announcements'
]
||=
[
Announcement
.
new
(
"正在读取公告..."
,
nil
,
nil
)]
Thread
.
new
do
Thread
.
new
do
...
@@ -151,4 +173,6 @@ class Iduel < Game
...
@@ -151,4 +173,6 @@ class Iduel < Game
$log
.
error
(
'公告'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
)}
$log
.
error
(
'公告'
)
{[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
)}
end
end
end
end
end
get_announcements
end
end
lib/iduel/user.rb
View file @
f3143cf8
lib/scene_lobby.rb
View file @
f3143cf8
...
@@ -69,7 +69,7 @@ class Scene_Lobby < Scene
...
@@ -69,7 +69,7 @@ class Scene_Lobby < Scene
when
Game_Event
::
AllRooms
when
Game_Event
::
AllRooms
@roomlist
.
items
=
$game
.
rooms
@roomlist
.
items
=
$game
.
rooms
when
Game_Event
::
Join
when
Game_Event
::
Join
$scene
=
Scene_Duel
.
new
(
event
.
room
,
Deck
.
load
(
"
妖鸟.TXT
"
))
$scene
=
Scene_Duel
.
new
(
event
.
room
,
Deck
.
load
(
"
老I FTK2.txt
"
))
when
Game_Event
::
Watch
when
Game_Event
::
Watch
require_relative
'scene_watch'
require_relative
'scene_watch'
$scene
=
Scene_Watch
.
new
(
event
.
room
)
$scene
=
Scene_Watch
.
new
(
event
.
room
)
...
...
lib/user.rb
View file @
f3143cf8
require_relative
'cacheable'
require_relative
'cacheable'
class
User
class
User
attr_accessor
:id
,
:name
attr_accessor
:id
,
:name
,
:friend
alias
friend?
friend
extend
Cacheable
extend
Cacheable
def
initialize
(
id
,
name
=
""
)
def
initialize
(
id
,
name
=
""
)
@id
=
id
@id
=
id
...
...
lib/window_userlist.rb
View file @
f3143cf8
...
@@ -14,8 +14,9 @@ class Window_UserList < Window_Scrollable
...
@@ -14,8 +14,9 @@ class Window_UserList < Window_Scrollable
super
(
x
,
y
,
272
,
540
)
super
(
x
,
y
,
272
,
540
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
@color
=
[
0x03
,
0x11
,
0x22
]
@color
=
[
0x03
,
0x11
,
0x22
]
@color_over
=
[
0x03
,
0x11
,
0x22
,
200
,
200
,
255
]
@color_friend
=
[
0
,
128
,
0
]
@color_click
=
[
200
,
200
,
255
,
0x03
,
0x11
,
0x22
]
@color_over
=
[
200
,
200
,
255
]
@color_click
=
[
0x03
,
0x11
,
0x22
]
#@contents.set_alpha(RLEACCEL, 80)
#@contents.set_alpha(RLEACCEL, 80)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFFFFFFFF
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFFFFFFFF
)
self
.
items
=
items
self
.
items
=
items
...
@@ -24,13 +25,16 @@ class Window_UserList < Window_Scrollable
...
@@ -24,13 +25,16 @@ class Window_UserList < Window_Scrollable
def
draw_item
(
index
,
status
=
0
)
def
draw_item
(
index
,
status
=
0
)
case
status
case
status
when
0
when
0
@font
.
draw_blended_utf8
(
@contents
,
@items
[
index
].
name
,
0
,
item_rect
(
index
)[
1
],
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
@items
[
index
].
name
,
0
,
item_rect
(
index
)[
1
],
*
(
item_color
(
index
))
)
when
1
when
1
@font
.
draw_shaded_utf8
(
@contents
,
@items
[
index
].
name
,
0
,
item_rect
(
index
)[
1
],
*
@color_over
)
@font
.
draw_shaded_utf8
(
@contents
,
@items
[
index
].
name
,
0
,
item_rect
(
index
)[
1
],
*
(
item_color
(
index
)
+
@color_over
)
)
when
2
when
2
@font
.
draw_shaded_utf8
(
@contents
,
@items
[
index
].
name
,
0
,
item_rect
(
index
)[
1
],
*
@color_click
)
@font
.
draw_shaded_utf8
(
@contents
,
@items
[
index
].
name
,
0
,
item_rect
(
index
)[
1
],
*
(
item_color
(
index
)
+
@color_click
)
)
end
end
end
end
def
item_color
(
index
)
@items
[
index
].
friend?
?
@color_friend
:
@color
end
#def clear(x=0, y=0, width=@width, height=@height)
#def clear(x=0, y=0, width=@width, height=@height)
# Surface.blit(x, )
# Surface.blit(x, )
#end
#end
...
...
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