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
f7ebe964
Commit
f7ebe964
authored
Feb 29, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
滚动条
parent
13a0b92e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
30 deletions
+44
-30
lib/scene.rb
lib/scene.rb
+6
-0
lib/scene_lobby.rb
lib/scene_lobby.rb
+0
-24
lib/widget_scrollbar.rb
lib/widget_scrollbar.rb
+17
-0
lib/window.rb
lib/window.rb
+3
-0
lib/window_chat.rb
lib/window_chat.rb
+2
-2
lib/window_roomlist.rb
lib/window_roomlist.rb
+11
-1
lib/window_scrollable.rb
lib/window_scrollable.rb
+5
-3
No files found.
lib/scene.rb
View file @
f7ebe964
...
@@ -97,6 +97,12 @@ class Scene
...
@@ -97,6 +97,12 @@ class Scene
when
5
when
5
@active_window
.
scroll_down
if
@active_window
@active_window
.
scroll_down
if
@active_window
end
end
when
Event
::
MouseButtonUp
case
event
.
button
when
Mouse
::
BUTTON_LEFT
update_active_window
(
event
.
x
,
event
.
y
)
@active_window
.
mouseleftbuttonup
if
@active_window
end
when
Event
::
KeyDown
when
Event
::
KeyDown
case
event
.
sym
case
event
.
sym
when
Key
::
F12
when
Key
::
F12
...
...
lib/scene_lobby.rb
View file @
f7ebe964
...
@@ -57,16 +57,6 @@ class Scene_Lobby < Scene
...
@@ -57,16 +57,6 @@ class Scene_Lobby < Scene
$game
.
exit
$game
.
exit
$scene
=
Scene_Login
.
new
$scene
=
Scene_Login
.
new
end
end
when
Event
::
KeyUp
case
event
.
sym
when
Key
::
RETURN
determine
end
when
Event
::
MouseButtonUp
case
event
.
button
when
Mouse
::
BUTTON_LEFT
determine
end
else
else
super
super
end
end
...
@@ -98,20 +88,6 @@ class Scene_Lobby < Scene
...
@@ -98,20 +88,6 @@ class Scene_Lobby < Scene
@count
+=
1
@count
+=
1
super
super
end
end
def
determine
case
@active_window
when
@roomlist
return
unless
@roomlist
.
index
and
room
=
@roomlist
.
items
[
@roomlist
.
index
]
if
room
.
full?
$game
.
watch
room
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入观战"
)
else
$game
.
join
room
,
"test"
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入房间"
)
end
end
end
def
terminate
def
terminate
unless
$scene
.
is_a?
Scene_Lobby
or
$scene
.
is_a?
Scene_Duel
unless
$scene
.
is_a?
Scene_Lobby
or
$scene
.
is_a?
Scene_Duel
$game
.
exit
$game
.
exit
...
...
lib/widget_scrollbar.rb
View file @
f7ebe964
...
@@ -10,6 +10,7 @@ class Widget_ScrollBar < Window
...
@@ -10,6 +10,7 @@ class Widget_ScrollBar < Window
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFFFFFFFF
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFFFFFFFF
)
@scroll
||=
0
@scroll
||=
0
@scroll_max
||=
0
@scroll_max
||=
0
@scrolling
=
nil
Surface
.
transform_draw
(
@back
,
@contents
,
0
,
1
,
@contents
.
h
.
to_f
/
@back
.
h
,
0
,
0
,
0
,
0
,
0
)
Surface
.
transform_draw
(
@back
,
@contents
,
0
,
1
,
@contents
.
h
.
to_f
/
@back
.
h
,
0
,
0
,
0
,
0
,
0
)
refresh
refresh
end
end
...
@@ -55,6 +56,9 @@ class Widget_ScrollBar < Window
...
@@ -55,6 +56,9 @@ class Widget_ScrollBar < Window
end
end
end
end
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
if
Mouse
.
state
[
2
]
and
@scrolling
and
@scroll_max
>
0
@parent_window
.
scroll
=
[[
0
,
(
y
-
@y
-
@scrolling
)
/
((
@height
-
40
-
24
)
/
@scroll_max
)].
max
,
@scroll_max
].
min
end
case
y
-
@y
case
y
-
@y
when
0
...
20
#上按钮
when
0
...
20
#上按钮
self
.
index
=
:up
self
.
index
=
:up
...
@@ -70,8 +74,21 @@ class Widget_ScrollBar < Window
...
@@ -70,8 +74,21 @@ class Widget_ScrollBar < Window
scroll_up
scroll_up
when
:down
when
:down
scroll_down
scroll_down
when
:scroll
y
=
(
@height
-
40
-
24
)
*
@scroll
/
(
@scroll_max
)
case
Mouse
.
state
[
1
]
-
@y
-
20
when
0
...
y
scroll_up
when
y
..
(
y
+
24
)
@scrolling
=
Mouse
.
state
[
1
]
-
@y
-
y
else
scroll_down
end
end
end
end
end
def
mouseleftbuttonup
@scrolling
=
nil
end
def
scroll_up
def
scroll_up
@parent_window
.
scroll_up
@parent_window
.
scroll_up
end
end
...
...
lib/window.rb
View file @
f7ebe964
...
@@ -72,6 +72,9 @@ class Window
...
@@ -72,6 +72,9 @@ class Window
def
clicked
def
clicked
#子类定义
#子类定义
end
end
def
mouseleftbuttonup
#子类定义
end
def
lostfocus
(
active_window
=
nil
)
def
lostfocus
(
active_window
=
nil
)
#子类定义
#子类定义
end
end
...
...
lib/window_chat.rb
View file @
f7ebe964
...
@@ -27,7 +27,7 @@ class Window_Chat < Window_Scrollable
...
@@ -27,7 +27,7 @@ class Window_Chat < Window_Scrollable
Game_Event
.
push
Game_Event
::
Chat
.
new
(
chatmessage
)
Game_Event
.
push
Game_Event
::
Chat
.
new
(
chatmessage
)
end
end
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
14
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
14
)
@scroll
ing
=
Widget_ScrollBar
.
new
(
self
,
@x
+
@width
-
20
-
8
,
@y
+
31
+
3
,
@height
-
68
)
@scroll
bar
=
Widget_ScrollBar
.
new
(
self
,
@x
+
@width
-
20
-
8
,
@y
+
31
+
3
,
@height
-
68
)
@page_size
=
(
@height
-
68
)
/
WLH
@page_size
=
(
@height
-
68
)
/
WLH
@@list
||=
{}
@@list
||=
{}
@list_splited
=
{}
@list_splited
=
{}
...
@@ -121,7 +121,7 @@ class Window_Chat < Window_Scrollable
...
@@ -121,7 +121,7 @@ class Window_Chat < Window_Scrollable
@font
.
draw_blended_utf8
(
@contents
,
chatmessage
.
user
.
name
+
':'
,
x
,
y
,
*
chatmessage
.
name_color
)
if
chatmessage
.
name_visible?
@font
.
draw_blended_utf8
(
@contents
,
chatmessage
.
user
.
name
+
':'
,
x
,
y
,
*
chatmessage
.
name_color
)
if
chatmessage
.
name_visible?
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
+
name_width
(
chatmessage
),
y
,
*
chatmessage
.
message_color
)
unless
chatmessage
.
message
.
empty?
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
+
name_width
(
chatmessage
),
y
,
*
chatmessage
.
message_color
)
unless
chatmessage
.
message
.
empty?
else
else
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
,
y
,
*
chatmessage
)
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
,
y
,
*
chatmessage
)
unless
message
.
empty?
end
end
end
end
def
item_rect
(
index
)
def
item_rect
(
index
)
...
...
lib/window_roomlist.rb
View file @
f7ebe964
...
@@ -17,7 +17,7 @@ class Window_RoomList < Window_Scrollable
...
@@ -17,7 +17,7 @@ class Window_RoomList < Window_Scrollable
@item_max
=
0
@item_max
=
0
@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
]
@scroll
ing
=
Widget_ScrollBar
.
new
(
self
,
@x
+
@width
,
@y
,
@height
)
@scroll
bar
=
Widget_ScrollBar
.
new
(
self
,
@x
+
@width
,
@y
,
@height
)
self
.
items
=
items
self
.
items
=
items
end
end
...
@@ -36,4 +36,14 @@ class Window_RoomList < Window_Scrollable
...
@@ -36,4 +36,14 @@ class Window_RoomList < Window_Scrollable
return
unless
self
.
include?
(
x
,
y
)
return
unless
self
.
include?
(
x
,
y
)
self
.
index
=
(
y
-
@y
)
/
WLH
+
@scroll
self
.
index
=
(
y
-
@y
)
/
WLH
+
@scroll
end
end
def
clicked
return
unless
@index
and
room
=
@items
[
@index
]
if
room
.
full?
$game
.
watch
room
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入观战"
)
else
$game
.
join
room
,
"test"
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入房间"
)
end
end
end
end
\ No newline at end of file
lib/window_scrollable.rb
View file @
f7ebe964
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
require_relative
'window_list'
require_relative
'window_list'
class
Window_Scrollable
<
Window_List
class
Window_Scrollable
<
Window_List
attr_reader
:scroll
attr_reader
:scroll
attr_accessor
:scroll
ing
attr_accessor
:scroll
bar
def
initialize
(
x
,
y
,
width
,
height
,
z
=
200
)
def
initialize
(
x
,
y
,
width
,
height
,
z
=
200
)
super
(
x
,
y
,
width
,
height
,
z
)
super
(
x
,
y
,
width
,
height
,
z
)
@page_size
||=
@height
/
self
.
class
::
WLH
@page_size
||=
@height
/
self
.
class
::
WLH
...
@@ -40,8 +40,10 @@ class Window_Scrollable < Window_List
...
@@ -40,8 +40,10 @@ class Window_Scrollable < Window_List
def
refresh
def
refresh
clear
clear
(
@scroll
...
[(
@scroll
+
@page_size
),
@items
.
size
].
min
).
each
{
|
index
|
draw_item
(
index
,
@index
==
index
?
1
:
0
)}
(
@scroll
...
[(
@scroll
+
@page_size
),
@items
.
size
].
min
).
each
{
|
index
|
draw_item
(
index
,
@index
==
index
?
1
:
0
)}
@scrolling
.
scroll_max
=
[
@items
.
size
-
@page_size
,
0
].
max
if
@scrolling
if
@scrollbar
@scrolling
.
scroll
=
@scroll
if
@scrolling
@scrollbar
.
scroll_max
=
[
@items
.
size
-
@page_size
,
0
].
max
@scrollbar
.
scroll
=
@scroll
end
end
end
def
item_rect
(
index
)
def
item_rect
(
index
)
[
0
,
(
index
-
@scroll
)
*
self
.
class
::
WLH
,
@width
,
self
.
class
::
WLH
]
[
0
,
(
index
-
@scroll
)
*
self
.
class
::
WLH
,
@width
,
self
.
class
::
WLH
]
...
...
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