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
2719711f
Commit
2719711f
authored
Nov 18, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
聊天
parent
f554109f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
91 additions
and
44 deletions
+91
-44
lib/iduel.rb
lib/iduel.rb
+5
-1
lib/iduel_event.rb
lib/iduel_event.rb
+1
-1
lib/scene.rb
lib/scene.rb
+1
-1
lib/scene_duel.rb
lib/scene_duel.rb
+14
-3
lib/scene_hall.rb
lib/scene_hall.rb
+21
-7
lib/scene_title.rb
lib/scene_title.rb
+2
-2
lib/widget_inputbox.rb
lib/widget_inputbox.rb
+27
-9
lib/window_chat.rb
lib/window_chat.rb
+19
-19
lib/window_config.rb
lib/window_config.rb
+1
-1
No files found.
lib/iduel.rb
View file @
2719711f
...
...
@@ -61,7 +61,7 @@ class Iduel
send
(
10
,
@key
,
room
.
id
,
checknum
(
"QROOM"
,
@session
+
room
.
id
.
to_s
))
end
def
action
(
action
)
send
(
2
,
"
#{
checknum
(
"RMSG"
,
@session
)
}
@
#{
@key
}
"
,
"
#{
action
.
escape
}
▊▊▊000000"
)
#TODO
send
(
2
,
"
#{
checknum
(
"RMSG"
,
@session
)
}
@
#{
@key
}
"
,
"
#{
action
.
escape
}
▊▊▊000000"
)
#TODO
:iduel校验字串
end
def
host
(
name
,
password
=
""
,
lv
=
0
,
color
=
0
)
send
(
6
,
@key
,
name
,
password
,
checknum
(
"JOINROOMMSG"
,
@session
+
name
+
password
+
"0"
),
0
,
color
,
lv
,
0
,
nil
,
nil
)
#TODO:v.ak, v.al
...
...
@@ -69,6 +69,10 @@ class Iduel
def
watch
(
room
,
password
=
""
)
send
(
5
,
@key
,
room
.
id
,
password
,
checknum
(
"WATCHROOMMSG"
,
"
#{
@session
}#{
room
.
id
}#{
password
}
"
))
end
def
chat
(
msg
)
send
(
4
,
@key
,
msg
,
checknum
(
"CHATP"
,
@session
))
#4|241019,test,2368c6b89b3e2eedb92e1b624a2a157c
end
def
quitwatchroom
send
(
"QUITWATCHROOM"
,
@key
,
checknum
(
"QUITWATCHROOM"
,
@session
))
end
...
...
lib/iduel_event.rb
View file @
2719711f
...
...
@@ -104,7 +104,7 @@ class Iduel::Event::PCHAT < Iduel::Event
attr_reader
:user
,
:content
def
initialize
(
info
)
user
,
@content
=
info
.
split
(
","
,
2
)
@user
=
Iduel
::
User
.
new
user
@user
=
user
==
"System"
?
Iduel
::
User
.
new
(
100000
,
"iDuel管理中心"
)
:
Iduel
::
User
.
new
(
user
)
end
end
class
Iduel
::
Event
::
JOINROOMOK
<
Iduel
::
Event
...
...
lib/scene.rb
View file @
2719711f
...
...
@@ -14,7 +14,7 @@ class Scene
start
while
$scene
==
self
update
#
sleep 0.01
sleep
0.01
end
terminate
end
...
...
lib/scene_duel.rb
View file @
2719711f
...
...
@@ -73,6 +73,7 @@ class Scene_Duel < Scene
when
Event
::
MouseMotion
if
@active_window
and
!
@active_window
.
include?
event
.
x
,
event
.
y
@active_window
.
lostfocus
@active_window
=
nil
end
self
.
windows
.
reverse
.
each
do
|
window
|
if
window
.
include?
event
.
x
,
event
.
y
...
...
@@ -84,8 +85,18 @@ class Scene_Duel < Scene
when
Event
::
MouseButtonDown
case
event
.
button
when
Mouse
::
BUTTON_LEFT
@active_window
.
mousemoved
(
event
.
x
,
event
.
y
)
@active_window
.
clicked
if
@active_window
and
!
@active_window
.
include?
event
.
x
,
event
.
y
@active_window
.
lostfocus
@active_window
=
nil
end
self
.
windows
.
reverse
.
each
do
|
window
|
if
window
.
include?
event
.
x
,
event
.
y
@active_window
=
window
@active_window
.
mousemoved
(
event
.
x
,
event
.
y
)
break
true
end
end
@active_window
.
clicked
if
@active_window
when
4
@active_window
.
cursor_up
when
5
...
...
@@ -102,7 +113,7 @@ class Scene_Duel < Scene
@phases_window
.
index
=
@phase
end
end
when
Mouse
::
BUTTON_RIGHT
when
Mouse
::
BUTTON_RIGHT
if
@action_window
@action_window
.
next
end
...
...
lib/scene_hall.rb
View file @
2719711f
...
...
@@ -8,18 +8,16 @@ class Scene_Hall < Scene
require_relative
'window_playerlist'
require_relative
'window_userinfo'
require_relative
'window_roomlist'
#require_relative 'window_chat'
require_relative
'window_chat'
def
start
$iduel
.
upinfo
@background
=
Surface
.
load
"graphics/hall/background.png"
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
0
,
0
)
@playerlist
=
Window_PlayerList
.
new
(
24
,
204
)
@userinfo
=
Window_UserInfo
.
new
(
24
,
24
,
$iduel
.
user
)
@roomlist
=
Window_RoomList
.
new
(
320
,
51
)
@active_window
=
@roomlist
#@chat = Window_Chat.new(320,550
)
@chat
=
Window_Chat
.
new
(
320
,
550
,
680
,
168
)
$screen
.
update_rect
(
0
,
0
,
0
,
0
)
bgm
=
Mixer
::
Music
.
load
(
"audio/bgm/hall.ogg"
)
...
...
@@ -31,11 +29,15 @@ class Scene_Hall < Scene
def
handle
(
event
)
case
event
when
Event
::
MouseMotion
if
@active_window
and
!
@active_window
.
include?
event
.
x
,
event
.
y
@active_window
.
lostfocus
@active_window
=
nil
end
self
.
windows
.
reverse
.
each
do
|
window
|
if
window
.
include?
event
.
x
,
event
.
y
@active_window
=
window
@active_window
.
mousemoved
(
event
.
x
,
event
.
y
)
break
break
true
end
end
when
Event
::
KeyDown
...
...
@@ -66,8 +68,18 @@ class Scene_Hall < Scene
when
Event
::
MouseButtonDown
case
event
.
button
when
Mouse
::
BUTTON_LEFT
@active_window
.
mousemoved
(
event
.
x
,
event
.
y
)
@active_window
.
clicked
if
@active_window
and
!
@active_window
.
include?
event
.
x
,
event
.
y
@active_window
.
lostfocus
@active_window
=
nil
end
self
.
windows
.
reverse
.
each
do
|
window
|
if
window
.
include?
event
.
x
,
event
.
y
@active_window
=
window
@active_window
.
mousemoved
(
event
.
x
,
event
.
y
)
break
end
end
@active_window
.
clicked
if
@active_window
when
4
@active_window
.
cursor_up
when
5
...
...
@@ -94,6 +106,8 @@ class Scene_Hall < Scene
when
Iduel
::
Event
::
WATCHROOMSTART
require_relative
'scene_watch'
$scene
=
Scene_Watch
.
new
(
event
.
room
)
when
Iduel
::
Event
::
PCHAT
@chat
.
add
event
.
user
,
event
.
content
else
puts
"---unhandled iduel event----"
p
event
...
...
lib/scene_title.rb
View file @
2719711f
...
...
@@ -21,6 +21,8 @@ class Scene_Title < Scene
@bgm
=
Mixer
::
Music
.
load
'audio/bgm/title.ogg'
@decision_se
=
Mixer
::
Wave
.
load
(
"audio/se/decision.ogg"
)
Mixer
.
fade_in_music
@bgm
,
-
1
,
800
end
def
clear
(
x
,
y
,
width
,
height
)
Surface
.
blit
(
@background
,
x
,
y
,
width
,
height
,
$screen
,
x
,
y
)
...
...
@@ -39,13 +41,11 @@ class Scene_Title < Scene
case
event
.
button
when
Mouse
::
BUTTON_LEFT
Widget_InputBox
.
show
(
0
,
0
){
|
text
,
finished
|
p
text
,
finished
}
if
@command_window
.
include?
(
event
.
x
,
event
.
y
)
@command_window
.
click
((
event
.
y
-
@command_window
.
y
)
/
@command_window
.
class
::
Button_Height
)
end
when
Mouse
::
BUTTON_RIGHT
Widget_InputBox
.
right
when
4
#scrool_up
@command_window
.
index
=
@index
?
(
@index
-
1
)
%
Buttons
.
size
:
0
when
5
...
...
lib/widget_inputbox.rb
View file @
2719711f
class
Widget_InputBox
class
Widget_InputBox
<
Window
attr_accessor
:text
,
:proc
require
'tk'
@@font
=
TkFont
.
new
(
"family"
=>
'WenQuanYi Micro Hei'
,
"size"
=>
15
)
#这字号尼玛?!
@@root
=
TkRoot
.
new
{
withdraw
overrideredirect
true
attributes
:topmost
,
true
}
@@entry
=
TkEntry
.
new
(
@@root
){
takefocus
1
font
@@font
validate
:focusout
validatecommand
{
@@
root
.
withdraw
;
@@proc
.
call
(
get
,
false
)
;
true
}
bind
(
'Key-Return'
){
@@
root
.
withdraw
;
@@proc
.
call
(
get
,
true
);
true
}
validatecommand
{
@@
active
.
text
.
replace
(
get
);
@@root
.
withdraw
(
true
);
@@active
.
refresh
;
true
}
bind
(
'Key-Return'
){
@@
active
.
proc
.
call
(
get
);
delete
(
0
,
get
.
size
);
@@root
.
withdraw
(
true
);
true
}
pack
}
def
self
.
show
(
x
,
y
,
text
=
nil
,
&
proc
)
@@root
.
geometry
"+
#{
x
+
TkWinfo
.
pointerx
(
@@root
)
-
Mouse
.
state
[
0
]
}
+
#{
y
+
TkWinfo
.
pointery
(
@@root
)
-
Mouse
.
state
[
1
]
}
"
Thread
.
new
{
Tk
.
mainloop
}
def
initialize
(
x
,
y
,
width
,
height
,
z
=
300
,
&
block
)
super
(
x
,
y
,
width
,
height
,
z
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
20
)
@proc
=
block
@text
=
""
end
def
refresh
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x66000000
)
@font
.
draw_blended_utf8
(
@contents
,
@text
,
0
,
0
,
0xFF
,
0xFF
,
0xFF
)
unless
@text
.
empty?
end
def
mousemoved
(
x
,
y
)
end
def
clicked
@@active
=
self
@@root
.
geometry
"
#{
@width
}
x
#{
@height
}
+
#{
@x
+
TkWinfo
.
pointerx
(
@@root
)
-
Mouse
.
state
[
0
]
}
+
#{
@y
+
TkWinfo
.
pointery
(
@@root
)
-
Mouse
.
state
[
1
]
}
"
@@entry
.
text
@text
@@entry
.
width
@width
@@root
.
deiconify
@@entry
.
text
text
if
text
@@proc
=
proc
@@entry
.
focus
:force
end
Thread
.
new
{
Tk
.
mainloop
}
end
lib/window_chat.rb
View file @
2719711f
...
...
@@ -4,28 +4,28 @@
# title
#==============================================================================
class
Window_Chat
<
Sprite
class
Window_Chat
<
Window
User_Color
=
[
0
,
0
,
0xFF
]
Text_Color
=
[
0
,
0
,
0
]
def
initialize
(
x
,
y
,
width
,
height
)
super
(
Image
.
new
(
width
,
height
)
){
|
sprite
|
sprite
.
x
=
x
sprite
.
y
=
y
sprite
.
width
=
width
sprite
.
height
=
height
sprite
.
contents
[
0
].
font
.
size
=
16
sprite
.
contents
[
0
].
font
.
color
=
Color
.
new
(
0x031122
)
sprite
.
contents
[
0
].
font
.
smooth
=
true
@font_bold
=
sprite
.
contents
[
0
].
font
.
dup
@font_bold
.
bold
=
true
}
yield
self
if
block_given?
super
(
x
,
y
,
width
,
height
)
@chat_input
=
Widget_InputBox
.
new
(
416
,
723
,
586
,
24
){
|
text
|
$iduel
.
chat
text
;
add
(
$iduel
.
user
,
text
)}
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFFFFFFFF
)
@list
=
[]
end
def
add
(
user
,
content
)
contents
[
0
].
blit
(
contents
[
0
],
0
,
0
,
0
,
24
,
contents
[
0
].
width
,
contents
[
0
].
height
-
16
)
#滚动条泥煤啊
contents
[
0
].
fill_rect
(
Color
::
White
,
0
,
contents
[
0
].
height
-
16
,
contents
[
0
].
width
,
16
)
name
=
user
.
name
+
": "
name_width
=
@font_bold
.
text_size
(
name
)[
0
]
contents
[
0
].
draw_text
(
name
,
0
,
contents
[
0
].
height
-
16
,
@font_bold
)
contents
[
0
].
draw_text
(
content
,
name_width
,
contents
[
0
].
height
-
16
)
@list
<<
[
user
,
content
]
refresh
end
def
refresh
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFFFFFFFF
)
@list
.
last
(
7
).
each_with_index
do
|
chat
,
index
|
user
,
content
=
*
chat
@font
.
draw_blended_utf8
(
@contents
,
user
.
name
,
0
,
index
*
WLH
,
*
User_Color
)
name_width
=
@font
.
text_size
(
user
.
name
)[
0
]
@font
.
draw_blended_utf8
(
@contents
,
':'
+
content
,
name_width
,
index
*
WLH
,
*
Text_Color
)
end
end
end
lib/window_config.rb
View file @
2719711f
...
...
@@ -54,7 +54,7 @@ class Window_Config < Window
clear
(
*
item_rect
(
@index
))
draw_item
(
@index
,
0
)
end
if
index
.
nil?
or
index
.
is_a?
(
Emulator
)
if
index
.
nil?
or
!
@items
.
include?
index
@index
=
nil
else
@index
=
index
...
...
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