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
2bf29600
Commit
2bf29600
authored
Nov 12, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
临时,不能用
parent
3d02ed93
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
43 deletions
+81
-43
graphics/hall/playerlist.png
graphics/hall/playerlist.png
+0
-0
lib/scene.rb
lib/scene.rb
+9
-0
lib/window.rb
lib/window.rb
+37
-6
lib/window_list.rb
lib/window_list.rb
+3
-7
lib/window_playerlist.rb
lib/window_playerlist.rb
+13
-8
lib/window_user.rb
lib/window_user.rb
+19
-22
No files found.
graphics/hall/playerlist.png
0 → 100644
View file @
2bf29600
This diff was suppressed by a .gitattributes entry.
lib/scene.rb
View file @
2bf29600
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#==============================================================================
#==============================================================================
class
Scene
class
Scene
attr_reader
:windows
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 主处理
# ● 主处理
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
...
@@ -16,6 +17,9 @@ class Scene
...
@@ -16,6 +17,9 @@ class Scene
end
end
terminate
terminate
end
end
def
initialize
@windows
=
[]
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 开始处理
# ● 开始处理
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
...
@@ -44,6 +48,11 @@ class Scene
...
@@ -44,6 +48,11 @@ class Scene
while
event
=
Event
.
poll
while
event
=
Event
.
poll
handle
(
event
)
handle
(
event
)
end
end
$screen
.
fill_rect
(
0
,
0
,
0
,
0
,
0x000000
)
@windows
.
each
do
|
window
|
$screen
.
put
(
window
.
contents
,
window
.
x
,
window
.
y
)
if
window
.
contents
end
$screen
.
update_rect
(
0
,
0
,
0
,
0
)
end
end
def
handle
(
event
)
def
handle
(
event
)
case
event
case
event
...
...
lib/window.rb
View file @
2bf29600
class
Window
class
Window
attr_reader
:x
,
:y
,
:width
,
:height
attr_reader
:x
,
:y
,
:width
,
:height
,
:z
,
:contents
def
initialize
(
x
,
y
,
width
,
height
)
def
initialize
(
x
,
y
,
width
,
height
,
z
=
200
)
@x
=
x
@x
=
x
@y
=
y
@y
=
y
@z
=
z
@width
=
width
@width
=
width
@height
=
height
@height
=
height
unless
@background
@background
=
Surface
.
new
(
SWSURFACE
|
SRCALPHA
,
@width
,
@height
,
32
,
0xFF0000
,
0x00FF00
,
0x0000FF
,
0xFF000000
)
@background
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFF00FF00
)
end
unless
@contents
@contents
=
Surface
.
new
(
SWSURFACE
|
SRCALPHA
,
@width
,
@height
,
32
,
0xFF0000
,
0x00FF00
,
0x0000FF
,
0xFF000000
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0xFF00FF00
)
end
#按Z坐标插入
unless
$scene
.
windows
.
each_with_index
do
|
window
,
index
|
if
window
.
z
>
@z
$scene
.
windows
.
insert
(
index
,
self
)
break
true
end
end
==
true
$scene
.
windows
<<
self
end
end
end
def
refresh
end
def
include?
(
x
,
y
)
def
include?
(
x
,
y
)
x
>
@x
&&
x
<
@x
+
@width
&&
y
>
@y
&&
y
<
@y
+
@height
x
>
@x
&&
x
<
@x
+
@width
&&
y
>
@y
&&
y
<
@y
+
@height
end
end
def
dispose
def
destroy
$scene
.
refresh_rect
(
@x
,
@y
,
@width
,
@height
)
@destroted
=
true
@contents
.
destroy
if
@contents
end
def
destroted?
@destroted
end
def
update
#子类定义
end
def
refresh
#子类定义
end
def
clear
(
x
,
y
,
width
,
height
)
Surface
.
blit
()
@contents
.
put
(
background
.
put
end
end
end
end
\ No newline at end of file
lib/window_list.rb
View file @
2bf29600
...
@@ -16,9 +16,9 @@ class Window_List < Window
...
@@ -16,9 +16,9 @@ class Window_List < Window
end
end
def
index
=
(
index
)
def
index
=
(
index
)
return
if
index
==
@index
||
@item_max
.
zero?
return
if
index
==
@index
||
@item_max
.
zero?
$scene
.
refresh_rect
(
*
item_rect
(
@index
)){
draw_item
(
@index
,
0
)}
if
@index
draw_item
(
@index
,
0
)
if
@index
@index
=
index
@index
=
index
$scene
.
refresh_rect
(
*
item_rect
(
@index
)){
draw_item
(
@index
,
1
)}
if
@index
draw_item
(
@index
,
1
)
if
@index
end
end
...
@@ -29,11 +29,7 @@ class Window_List < Window
...
@@ -29,11 +29,7 @@ class Window_List < Window
#子类定义
#子类定义
end
end
def
refresh
def
refresh
$scene
.
refresh_rect
(
@x
,
@y
,
@width
,
@height
)
do
@item_max
.
times
{
|
index
|
draw_item
(
index
)}
@item_max
.
times
do
|
index
|
draw_item
(
index
)
end
end
end
end
def
cursor_up
def
cursor_up
self
.
index
=
@index
?
(
@index
-
@column_max
)
%
[
@list
.
size
,
@item_max
].
min
:
0
self
.
index
=
@index
?
(
@index
-
@column_max
)
%
[
@list
.
size
,
@item_max
].
min
:
0
...
...
lib/window_playerlist.rb
View file @
2bf29600
...
@@ -5,27 +5,32 @@
...
@@ -5,27 +5,32 @@
#==============================================================================
#==============================================================================
class
Window_PlayerList
<
Window_List
class
Window_PlayerList
<
Window_List
BackGround
=
Surface
.
load
"graphics/hall/playerlist.png"
attr_reader
:x
,
:y
,
:width
,
:height
attr_reader
:x
,
:y
,
:width
,
:height
WLH
=
16
WLH
=
24
def
initialize
(
x
,
y
)
def
initialize
(
x
,
y
)
super
(
x
,
y
,
272
,
16
*
34
)
@contents
=
Surface
.
load
"graphics/hall/playerlist.png"
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
WLH
)
super
(
x
,
y
,
272
,
WLH
*
22
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
20
)
@color
=
[
0x03
,
0x11
,
0x22
]
@color
=
[
0x03
,
0x11
,
0x22
]
@color_over
=
[
0x03
,
0x11
,
0x22
,
200
,
200
,
255
]
@color_over
=
[
0x03
,
0x11
,
0x22
,
200
,
200
,
255
]
@color_click
=
[
200
,
200
,
255
,
0x03
,
0x11
,
0x22
]
@color_click
=
[
200
,
200
,
255
,
0x03
,
0x11
,
0x22
]
#@contents.fill_rect(0,0,0,0,0xFFFFFFFF)
refresh
#@contents.f
end
end
def
draw_item
(
index
,
status
=
0
)
def
draw_item
(
index
,
status
=
0
)
case
status
case
status
when
0
when
0
@font
.
draw_blended_utf8
(
$screen
,
@list
[
index
].
name
,
@x
,
@y
+
index
*
WLH
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
@list
[
index
].
name
,
0
,
index
*
WLH
,
*
@color
)
when
1
when
1
@font
.
draw_shaded_utf8
(
$screen
,
@list
[
index
].
name
,
@x
,
@y
+
index
*
WLH
,
*
@color_over
)
@font
.
draw_shaded_utf8
(
@contents
,
@list
[
index
].
name
,
0
,
index
*
WLH
,
*
@color_over
)
when
2
when
2
@font
.
draw_shaded_utf8
(
$screen
,
@list
[
index
].
name
,
@x
,
@y
+
index
*
WLH
,
*
@color_click
)
@font
.
draw_shaded_utf8
(
@contents
,
@list
[
index
].
name
,
0
,
index
*
WLH
,
*
@color_click
)
end
end
end
end
def
item_rect
(
index
)
def
item_rect
(
index
)
[
@x
,
@y
+
WLH
*
index
,
@width
,
WLH
]
[
0
,
WLH
*
index
,
@width
,
WLH
]
end
end
def
list
=
(
list
)
def
list
=
(
list
)
@list
=
list
@list
=
list
...
@@ -34,7 +39,7 @@ class Window_PlayerList < Window_List
...
@@ -34,7 +39,7 @@ class Window_PlayerList < Window_List
refresh
refresh
end
end
def
clicked
def
clicked
$scene
.
refresh_rect
(
*
item_rect
(
@index
)){
draw_item
(
@index
,
2
)}
if
@index
#
$scene.refresh_rect(*item_rect(@index)){draw_item(@index, 2)} if @index
@userwindow
=
Window_User
.
new
(
100
,
100
,
@list
[
@index
])
@userwindow
=
Window_User
.
new
(
100
,
100
,
@list
[
@index
])
end
end
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
...
...
lib/window_user.rb
View file @
2bf29600
class
Window_User
<
Window
class
Window_User
<
Window
BackGround
=
Surface
.
load
"graphics/hall/user.png"
Boarder
=
Surface
.
load
"graphics/hall/avatar_boader.png"
def
initialize
(
x
,
y
,
user
)
def
initialize
(
x
,
y
,
user
)
@background
=
Surface
.
load
"graphics/hall/user.png"
super
(
x
,
y
,
BackGround
.
w
,
BackGround
.
h
)
@boarder
=
Surface
.
load
"graphics/hall/avatar_boader.png"
super
(
x
,
y
,
@background
.
w
,
@background
.
h
)
@font
=
TTF
.
open
(
'fonts/WenQuanYi Micro Hei.ttf'
,
16
)
@font
=
TTF
.
open
(
'fonts/WenQuanYi Micro Hei.ttf'
,
16
)
@user
=
user
@user
=
user
@contents
=
Surface
.
load
"graphics/hall/user.png"
#TODO:调用已经加载了的背景
refresh
refresh
end
end
def
refresh
(
x
=
@x
,
y
=
@y
,
width
=
@width
,
height
=
@height
)
def
refresh
$scene
.
refresh_rect
(
@x
,
@y
,
@width
,
@height
,
@background
,
-
@x
,
-
@y
)
do
@thread
.
kill
if
@thread
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
@x
,
@y
)
@contents
.
put
(
BackGround
,
0
,
0
)
@thread
=
@user
.
avatar
(
:middle
)
do
|
avatar
|
@thread
=
@user
.
avatar
(
:middle
)
do
|
avatar
|
@contents
.
put
(
avatar
,
24
,
24
)
$scene
.
refresh_rect
(
@x
+
12
,
@y
+
12
,
@boarder
.
w
,
@boarder
.
h
,
@background
,
-
@x
,
-
@y
)
do
@contents
.
put
(
Boarder
,
12
,
12
)
Surface
.
blit
(
avatar
,
0
,
0
,
0
,
0
,
$screen
,
@x
+
24
,
@y
+
24
)
end
Surface
.
blit
(
@boarder
,
0
,
0
,
0
,
0
,
$screen
,
@x
+
12
,
@y
+
12
)
end
end
@font
.
draw_blended_utf8
(
$screen
,
@user
.
name
,
@x
+
172
,
@y
+
24
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
$screen
,
"id:
#{
@user
.
id
}
"
,
@x
+
172
,
@y
+
24
+
16
*
2
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
$screen
,
@user
.
status
,
@x
+
172
,
@y
+
24
+
16
*
3
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
@user
.
name
,
172
,
24
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
"id:
#{
@user
.
id
}
"
,
172
,
24
+
16
*
2
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
@user
.
status
,
172
,
24
+
16
*
3
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
$screen
,
"发送消息"
,
@x
+
172
,
@y
+
24
+
16
*
4
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
"发送消息"
,
172
,
24
+
16
*
4
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
$screen
,
"查看资料"
,
@x
+
172
,
@y
+
24
+
16
*
5
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
"查看资料"
,
172
,
24
+
16
*
5
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
$screen
,
"加为好友"
,
@x
+
172
,
@y
+
24
+
16
*
6
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
"加为好友"
,
172
,
24
+
16
*
6
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
$screen
,
"加入游戏"
,
@x
+
172
,
@y
+
24
+
16
*
7
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
"加入游戏"
,
172
,
24
+
16
*
7
+
8
,
0x00
,
0x00
,
0x00
)
end
end
end
def
clicked
def
clicked
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