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 @@
#==============================================================================
class
Scene
attr_reader
:windows
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
...
...
@@ -16,6 +17,9 @@ class Scene
end
terminate
end
def
initialize
@windows
=
[]
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
...
...
@@ -44,6 +48,11 @@ class Scene
while
event
=
Event
.
poll
handle
(
event
)
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
def
handle
(
event
)
case
event
...
...
lib/window.rb
View file @
2bf29600
class
Window
attr_reader
:x
,
:y
,
:width
,
:height
def
initialize
(
x
,
y
,
width
,
height
)
attr_reader
:x
,
:y
,
:width
,
:height
,
:z
,
:contents
def
initialize
(
x
,
y
,
width
,
height
,
z
=
200
)
@x
=
x
@y
=
y
@z
=
z
@width
=
width
@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
def
refresh
end
def
include?
(
x
,
y
)
x
>
@x
&&
x
<
@x
+
@width
&&
y
>
@y
&&
y
<
@y
+
@height
end
def
dispose
$scene
.
refresh_rect
(
@x
,
@y
,
@width
,
@height
)
def
destroy
@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
\ No newline at end of file
lib/window_list.rb
View file @
2bf29600
...
...
@@ -16,9 +16,9 @@ class Window_List < Window
end
def
index
=
(
index
)
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
$scene
.
refresh_rect
(
*
item_rect
(
@index
)){
draw_item
(
@index
,
1
)}
if
@index
draw_item
(
@index
,
1
)
if
@index
end
...
...
@@ -29,11 +29,7 @@ class Window_List < Window
#子类定义
end
def
refresh
$scene
.
refresh_rect
(
@x
,
@y
,
@width
,
@height
)
do
@item_max
.
times
do
|
index
|
draw_item
(
index
)
end
end
@item_max
.
times
{
|
index
|
draw_item
(
index
)}
end
def
cursor_up
self
.
index
=
@index
?
(
@index
-
@column_max
)
%
[
@list
.
size
,
@item_max
].
min
:
0
...
...
lib/window_playerlist.rb
View file @
2bf29600
...
...
@@ -5,27 +5,32 @@
#==============================================================================
class
Window_PlayerList
<
Window_List
BackGround
=
Surface
.
load
"graphics/hall/playerlist.png"
attr_reader
:x
,
:y
,
:width
,
:height
WLH
=
16
WLH
=
24
def
initialize
(
x
,
y
)
super
(
x
,
y
,
272
,
16
*
34
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
WLH
)
@contents
=
Surface
.
load
"graphics/hall/playerlist.png"
super
(
x
,
y
,
272
,
WLH
*
22
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
20
)
@color
=
[
0x03
,
0x11
,
0x22
]
@color_over
=
[
0x03
,
0x11
,
0x22
,
200
,
200
,
255
]
@color_click
=
[
200
,
200
,
255
,
0x03
,
0x11
,
0x22
]
#@contents.fill_rect(0,0,0,0,0xFFFFFFFF)
refresh
#@contents.f
end
def
draw_item
(
index
,
status
=
0
)
case
status
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
@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
@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
def
item_rect
(
index
)
[
@x
,
@y
+
WLH
*
index
,
@width
,
WLH
]
[
0
,
WLH
*
index
,
@width
,
WLH
]
end
def
list
=
(
list
)
@list
=
list
...
...
@@ -34,7 +39,7 @@ class Window_PlayerList < Window_List
refresh
end
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
])
end
def
mousemoved
(
x
,
y
)
...
...
lib/window_user.rb
View file @
2bf29600
class
Window_User
<
Window
BackGround
=
Surface
.
load
"graphics/hall/user.png"
Boarder
=
Surface
.
load
"graphics/hall/avatar_boader.png"
def
initialize
(
x
,
y
,
user
)
@background
=
Surface
.
load
"graphics/hall/user.png"
@boarder
=
Surface
.
load
"graphics/hall/avatar_boader.png"
super
(
x
,
y
,
@background
.
w
,
@background
.
h
)
super
(
x
,
y
,
BackGround
.
w
,
BackGround
.
h
)
@font
=
TTF
.
open
(
'fonts/WenQuanYi Micro Hei.ttf'
,
16
)
@user
=
user
@contents
=
Surface
.
load
"graphics/hall/user.png"
#TODO:调用已经加载了的背景
refresh
end
def
refresh
(
x
=
@x
,
y
=
@y
,
width
=
@width
,
height
=
@height
)
$scene
.
refresh_rect
(
@x
,
@y
,
@width
,
@height
,
@background
,
-
@x
,
-
@y
)
do
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
@x
,
@y
)
@thread
=
@user
.
avatar
(
:middle
)
do
|
avatar
|
$scene
.
refresh_rect
(
@x
+
12
,
@y
+
12
,
@boarder
.
w
,
@boarder
.
h
,
@background
,
-
@x
,
-
@y
)
do
Surface
.
blit
(
avatar
,
0
,
0
,
0
,
0
,
$screen
,
@x
+
24
,
@y
+
24
)
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
)
def
refresh
@thread
.
kill
if
@thread
@contents
.
put
(
BackGround
,
0
,
0
)
@thread
=
@user
.
avatar
(
:middle
)
do
|
avatar
|
@contents
.
put
(
avatar
,
24
,
24
)
@contents
.
put
(
Boarder
,
12
,
12
)
end
@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
(
$screen
,
"查看资料"
,
@x
+
172
,
@y
+
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
(
$screen
,
"加入游戏"
,
@x
+
172
,
@y
+
24
+
16
*
7
+
8
,
0x00
,
0x00
,
0x00
)
end
@font
.
draw_blended_utf8
(
@contents
,
"发送消息"
,
172
,
24
+
16
*
4
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
"查看资料"
,
172
,
24
+
16
*
5
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
"加为好友"
,
172
,
24
+
16
*
6
+
8
,
0x00
,
0x00
,
0x00
)
@font
.
draw_blended_utf8
(
@contents
,
"加入游戏"
,
172
,
24
+
16
*
7
+
8
,
0x00
,
0x00
,
0x00
)
end
def
clicked
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