Commit ed27ab0c authored by 神楽坂玲奈's avatar 神楽坂玲奈

选项设置

parent 2bf29600
fullscreen: false
width: 1024
height: 768
autologin: true
username: "zh99997"
password: "111111"
\ No newline at end of file
---
fullscreen: false
width: 1024
height: 768
autologin: true
username: zh99997
password: "111111"
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
......@@ -10,7 +10,7 @@ class Card
@all = []
@count = @db.get_first_value("select COUNT(*) from YGODATA") rescue 0
@db.results_as_hash = true
PicPath = 'E:/game/yu-gi-oh/YGODATA/YGOPIC'
PicPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/YGODATA/YGOPIC'
CardBack = Surface.load "graphics/field/card.png"
class << self
def find(id, order_by=nil)
......
......@@ -10,7 +10,7 @@ class Deck
attr_accessor :side
attr_accessor :extra
attr_accessor :temp
DeckPath = "E:/game/yu-gi-oh/deck"
DeckPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/deck'
def initialize(main, side=[], extra=[], temp=[])
@main = main
@side = side
......
......@@ -27,9 +27,12 @@ class Iduel
def send(head, *args)
info = "##{head.to_s(16).upcase}|#{args.join(',')}".encode("GBK") + RS
puts "<< #{info}"
(@conn.write info) rescue Iduel::Event.push Event::Error.new(0)
(@conn.write info) rescue Event.push Error.new(0)
end
def recv(info)
if info.nil?
Event.push Error.new(0)
end
info.chomp!(RS)
info.encode! "UTF-8"
puts ">> #{info}"
......
......@@ -139,7 +139,7 @@ class Action
Note.new from_player, $2, Card.find($1.to_sym)
when /^※(.*)$/
Chat.new from_player, $1
when /^(◎|●)→=\[0:0:0\]==回合结束==<(\d+)>=\[0\]\r\nLP:(\d+)\r\n手卡:(\d+)\r\n卡组:(\d+)\r\n墓地:(\d+)\r\n除外:(\d+)\r\n前场:\r\n #{PosotionFilter}#{CardFilter}\r\n #{CardFilter}\r\n #{CardFilter}\r\n #{CardFilter}\r\n #{CardFilter}\r\n后场:#{CardFilter}#{CardFilter}#{CardFilter}#{CardFilter}#{CardFilter}\r\n场地|#{CardFilter}\r\n◎→\\(.*)$/
when /^(◎|●)→=\[0:0:0\]==回合结束==<(\d+)>=\[0\]\r\nLP:(\d+)\r\n手卡:(\d+)\r\n卡组:(\d+)\r\n墓地:(\d+)\r\n除外:(\d+)\r\n前场:\r\n #{PositionFilter}#{CardFilter}\r\n #{CardFilter}\r\n #{CardFilter}\r\n #{CardFilter}\r\n #{CardFilter}\r\n后场:#{CardFilter}#{CardFilter}#{CardFilter}#{CardFilter}#{CardFilter}\r\n场地|#{CardFilter}\r\n◎→\\(.*)$/
Turn_End.new($1 == "◎", $19, $3.to_i, $4.to_i, $5.to_i, $6.to_i, $7.to_i, [parse_fieldcard($18), parse_fieldcard($13), parse_fieldcard($14), parse_fieldcard($15), parse_fieldcard($16), parse_fieldcard($17), parse_fieldcard($8), parse_fieldcard($9), parse_fieldcard($10), parse_fieldcard($11), parse_fieldcard($12)], $2.to_i)
when /^(?:(.*)\r\n){0,1}(◎|●)→(.*)$/m
from_player = $2 == "◎"
......
......@@ -28,6 +28,8 @@ class Iduel::User
@name = name
@level = level
@exp = exp
#@status = :waiting
#@room = nil
end
def avatar(size = :small)
cache = "graphics/avatars/#{@id}_#{size}.png"
......@@ -43,15 +45,18 @@ class Iduel::User
end
end
def status
room = $iduel.rooms.find{|room|room.player1 == @user or room.player2 == @user}
room = room()
result = case
when room.nil?
"等待中"
:hall
when room.player2
"房间#{room.id}决斗中"
:dueling
else
"房间#{room.id}等待中"
:waiting
end
result
end
def room
$iduel.rooms.find{|room|room.player1 == self or room.player2 == self}
end
end
\ No newline at end of file
#encoding: UTF-8
$: << "/usr/lib"
alias gbk_puts puts
def puts(*args)
gbk_puts(*(args.collect{|item|item.encode "UTF-8"}))
end
alias gbk_puts puts
def puts(*args)
gbk_puts(*(args.collect{|item|item.encode "UTF-8"}))
end
def p(*args)
print(args.collect{|item|item.inspect.encode "UTF-8"}.join("\n")+"\n") rescue print(args.join("\n")+"\n")
end
def p(*args)
print(args.collect{|item|item.inspect.encode "UTF-8"}.join("\n")+"\n") rescue print(args.join("\n")+"\n")
def filesize_inspect(size)
case size
when 0...1024
size.to_s + "B"
when 1024...1024*1024
(size/1024).to_s + "KB"
else
(size/1024/1024).to_s + "MB"
end
end
require 'sdl'
include SDL
......@@ -16,16 +28,15 @@ $config = YAML.load_file("config.yml") rescue YAML.load_file("data/config_defaul
SDL.init(INIT_VIDEO | INIT_AUDIO)
WM::set_caption("iDuel - 享受决斗", "graphics/system/iDuelPanel_32512.ico")
WM::icon = Surface.load("graphics/system/iDuelPanel_32512.ico")
#WM::icon = Surface.load("graphics/system/iDuelPanel_32512.ico")
style = HWSURFACE
style |= FULLSCREEN if $config["fullscreen"]
$screen = Screen.open($config["width"], $config["height"], 0, style)
SDL::TTF.init
TTF.init
SDL::Mixer.open(Mixer::DEFAULT_FREQUENCY,Mixer::DEFAULT_FORMAT,Mixer::DEFAULT_CHANNELS,512)
#SDL::Mixer.open
Mixer.open(Mixer::DEFAULT_FREQUENCY,Mixer::DEFAULT_FORMAT,Mixer::DEFAULT_CHANNELS,512)
require_relative 'scene'
require_relative 'window'
......@@ -37,5 +48,4 @@ $scene = Scene_Title.new
while $scene
$scene.main
end
SDL.quit #这货居然会卡一下///囧
\ No newline at end of file
......@@ -6,6 +6,7 @@
class Scene
attr_reader :windows
attr_reader :background
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
......@@ -48,7 +49,7 @@ class Scene
while event = Event.poll
handle(event)
end
$screen.fill_rect(0,0,0,0,0x000000)
$screen.put(@background,0,0)
@windows.each do |window|
$screen.put(window.contents, window.x, window.y) if window.contents
end
......@@ -69,7 +70,7 @@ class Scene
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
$screen.fill_rect(0,0,$screen.w, $screen.h, 0xFF000000)
#$screen.fill_rect(0,0,$screen.w, $screen.h, 0xFF000000)
end
end
#==============================================================================
# ■ Scene_Title
# ■ Scene_Config
#------------------------------------------------------------------------------
#  title
#  config
#==============================================================================
class Scene_Title < Scene
class Scene_Config < Scene
require_relative 'window_config'
def start
@background = Sprite.new
@background.contents = Picture.new("title_0.jpg")
@command_window = Window.new(600,250,300,500)
@command_window.contents.color = [255,0,0]
@command_window.contents.font.size = 32
@command_window.contents.blt(0,32*0, "duel")
@command_window.contents.blt(0,32*1, "single mode")
@command_window.contents.blt(0,32*2, "deck edit")
@command_window.contents.blt(0,32*3, "config")
@command_window.contents.blt(0,32*4, "quit")
$screen.make_magic_hooks(Screen::MousePressed => proc { |owner, event|
if event.pos[0].between?(@command_window.x, @command_window.x+ @command_window.width) && event.pos[1].between?(@command_window.y, @command_window.y+ @command_window.height)
$scene = case (event.pos[1] - @command_window.y) / 32
when 0
Scene_Login.new
when 1
Scene_Single.new
when 2
Scene_DeckEdit.new
when 3
Scene_Config.new
when 4
nil
end
end
})
@background = Surface.load "graphics/config/background.png"
@config_window = Window_Config.new(0,0)
#全屏模式
#p $config
#
#
#
#
end
def update
#$scene = Scene_Title.new
end
end
def handle(event)
case event
when Event::MouseMotion
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
when Event::MouseButtonDown
case event.button
when Mouse::BUTTON_LEFT
@active_window.mousemoved(event.x, event.y)
@active_window.clicked
when 4
@active_window.cursor_up
when 5
@active_window.cursor_down
end
else
super
end
end
end
\ No newline at end of file
......@@ -16,6 +16,7 @@ class Scene_Duel < Scene
require_relative 'game_field'
def initialize(room)
super()
@room = room
end
def start
......
#==============================================================================
# 鈻�Scene_Hall
# Scene_Hall
#------------------------------------------------------------------------------
# 銆�all
# 大厅
#==============================================================================
class Scene_Hall < Scene
......@@ -15,9 +15,9 @@ class Scene_Hall < Scene
@background = Surface.load "graphics/hall/background.png"
Surface.blit(@background,0,0,0,0,$screen,0,0)
@playerlist = Window_PlayerList.new(24,200)
@playerlist = Window_PlayerList.new(24,204)
@userinfo = Window_UserInfo.new(24,24, $iduel.user)
@roomlist = Window_RoomList.new(320,50)
@roomlist = Window_RoomList.new(320,51)
@active_window = @roomlist
#@chat = Window_Chat.new(320,550)
......@@ -31,7 +31,7 @@ class Scene_Hall < Scene
def handle(event)
case event
when Event::MouseMotion
[@playerlist, @roomlist].each do |window|
self.windows.reverse.each do |window|
if window.include? event.x, event.y
@active_window = window
@active_window.mousemoved(event.x, event.y)
......
# To change this template, choose Tools | Templates
# and open the template in the editor.
class Widget_checkbox
def initialize(window, text, x,y,width=window.width-x,height=20,checked=false)
@x = x
@y = y
@text = text
@window = window
@checked = checked
@checkbox = Surface.load 'graphics/system/checkbox.png'
end
def mouseover(x,y)
end
def refresh
end
end
class Window
WLH = 24
attr_reader :x, :y, :width, :height, :z, :contents
def initialize(x, y, width, height, z=200)
@x = x
......@@ -36,14 +37,19 @@ class Window
def destroted?
@destroted
end
def clear(x, y, width, height)
Surface.blit(@background, x,y,width,height,@contents,x,y)
end
def update
#子类定义
end
def refresh
#子类定义
end
def clear(x, y, width, height)
Surface.blit()
@contents.put(background.put
def mousemoved(x,y)
#子类定义
end
def clicked
#子类定义
end
end
\ No newline at end of file
class Window_Config < Window
def initialize(x,y)
super(x,y,$screen.w, $screen.h)
@checkbox = Surface.load 'graphics/system/checkbox.png'
@button = Surface.load 'graphics/system/button.png'
@background = Surface.load 'graphics/config/background.png'
@contents = Surface.load 'graphics/config/background.png'
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 20)
@index = nil
@items = {
:fullscreen => [0,0,120,WLH],
:avatar_cache => [220, WLH,@button.w/3, @button.h],
:return => [0,WLH*2,100,WLH]
}
refresh
end
def draw_item(index, status=0)
case index
when :fullscreen
clear(0,0,100,WLH)
Surface.blit(@checkbox, 20*status, $config["fullscreen"] ? 20 : 0, 20, 20, @contents, 0, 0)
case status
when 0
@font.draw_blended_utf8(@contents, "全屏模式", WLH, 0, 0x00,0x00,0x00)
when 1
@font.draw_shaded_utf8(@contents, "全屏模式", WLH, 0, 0x00,0x00,0x00, 0xEE, 0xEE, 0xEE)
when 2
@font.draw_shaded_utf8(@contents, "全屏模式", WLH, 0, 0xEE,0xEE,0xEE, 0x00, 0x00, 0x00)
end
when :avatar_cache
clear(0,WLH,220+@button.w/3,@button.h)
size = 0
count = 0
Dir.glob("graphics/avatars/*_*.png") do |file|
count += 1
size += File.size(file)
end
@font.draw_blended_utf8(@contents, "头像缓存: #{count}个文件, #{filesize_inspect(size)}", 0, WLH, 0x00,0x00,0x00)
Surface.blit(@button, @button.w/3*status, 0, @button.w/3, @button.h, @contents, 220, WLH)
when :return
@font.draw_blended_utf8(@contents, "回到标题画面", 0, WLH*2, 0x00,0x00,0x00)
end
end
def item_rect(index)
@items[index]
end
def index=(index)
return if index == @index
if @index
clear(*item_rect(@index))
draw_item(@index, 0)
end
if index.nil? or !index.is_a?(Symbol)
@index = nil
else
@index = index
draw_item(@index, 1)
end
end
def mousemoved(x,y)
self.index = @items.each do |index, item_rect|
if x.between?(@x+item_rect[0], @x+item_rect[0]+item_rect[2]) and y.between?(@y+item_rect[1], @y+item_rect[1]+item_rect[3])
break index
end
end
end
def refresh
@items.each_key{|index|draw_item(index)}
end
def clicked
case @index
when :fullscreen
clear(*item_rect(@index))
$config["fullscreen"] = !$config["fullscreen"]
$screen.destroy
style = HWSURFACE
style |= FULLSCREEN if $config["fullscreen"]
$screen = Screen.open($config["width"], $config["height"], 0, style)
draw_item(@index, 2)
when :avatar_cache
Dir.glob("graphics/avatars/*_*.png") do |file|
File.delete file
end
draw_item(:avatar_cache)
when :return
File.open("config.yml","w") do |config|
YAML.dump($config, config)
end
$scene = Scene_Title.new
end
end
end
\ No newline at end of file
......@@ -8,17 +8,25 @@
class Window_List < Window
attr_reader :list
attr_reader :index
def initialize(x, y, width, height)
super(x,y,width, height)
def initialize(x, y, width, height, z=200)
super(x,y,width, height,z)
@o_index = 0
@item_max = 0
@column_max = 1
end
def index=(index)
return if index == @index || @item_max.zero?
draw_item(@index, 0) if @index
@index = index
draw_item(@index, 1) if @index
return if index == @index
if @index
clear(*item_rect(@index))
draw_item(@index, 0)
end
if index.nil? or index < 0 or index >= @item_max
@index = nil
else
@index = index
draw_item(@index, 1)
end
end
......@@ -26,7 +34,7 @@ class Window_List < Window
#子类定义
end
def item_rect(index)
#子类定义
[0, @index*self.class::WLH, @width, self.class::WLH]
end
def refresh
@item_max.times {|index|draw_item(index)}
......
class Window_LP
class Window_LP < Window
Avatar_Size = 48
def initialize(x,y,player,position=true) #true:左�false:右�
@x = x
@y = y
@width = 360
@height = 72
def initialize(x,y,player,position=true) #true:左 false:右
super(x,y,360,72)
@player = player
@position = position
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 24)
@color = [255,255,255]
#p @x+@width-Avatar_Size
Surface.blit(@player.avatar do |avatar|
$scene.refresh_rect(position ? @x : @x+@width-Avatar_Size, @y+24, Avatar_Size,Avatar_Size) do
Surface.blit(avatar, 0,0,0,0,$screen, position ? @x : @x+@width-Avatar_Size, @y+24)
end
end,0,0,0,0,$screen, position ? @x : @x+@width-Avatar_Size, @y+24)
@player.avatar do |avatar|
clear(position ? 0 : @width-Avatar_Size, 24, Avatar_Size, Avatar_Size)
@contents.put avatar, position ? 0 : @width-Avatar_Size, 24
end
self.lp = 8000
end
def lp=(lp)
$scene.refresh_rect(@x, @y, @width, 24) do
if @position
@font.draw_blended_utf8($screen, lp.to_s, @x, @y, *@color)
$screen.fill_rect(@x+64,@y,[0, [(200*lp/8000), 200].min].max, 24, 0xFFFF0000)
@font.draw_blended_utf8(@contents, lp.to_s, 0, 0, *@color)
@contents.fill_rect(64,0,[0, [(200*lp/8000), 200].min].max, 24, 0xFFFF0000)
else
@font.draw_blended_utf8($screen, lp.to_s, @x+@width-64, @y, *@color)
@font.draw_blended_utf8(@contents, lp.to_s, @width-64, 0, *@color)
width = [0, [(200*lp/8000), 200].min].max
$screen.fill_rect(@x+@width-width-64,@y,width , 24, 0xFFFF0000)
@contents.fill_rect(@width-width-64,0,width , 24, 0xFFFF0000)
end
end
end
#def draw_item(player)
# if player == @player
......
class Window_Phases < Window_List
WLH = 80 #其实是列宽
def initialize(x,y)
@background_player = Surface.load 'graphics/system/phases_player.png'
@background_opponent = Surface.load 'graphics/system/phases_opponent.png'
super(x,y,5*WLH+@background_player.w/3, @background_player.h/6)
@phases_player = Surface.load 'graphics/system/phases_player.png'
@phases_opponent = Surface.load 'graphics/system/phases_opponent.png'
super(x,y,5*WLH+@phases_player.w/3, @phases_player.h/6)
@column_max = @item_max = 6
self.player = true
end
def player=(player)
return if player == (@background == @background_player)
@background = player ? @background_player : @background_opponent
return if player == (@phases == @phases_player)
@phases = player ? @phases_player : @phases_opponent
@phase = 0
refresh
end
......@@ -21,10 +21,10 @@ class Window_Phases < Window_List
end
def draw_item(index, status=0)
status = 2 if index == @phase
Surface.blit(@background, status*@background.w/3, index*@height, @background.w/3, @height, $screen, @x+index*WLH, @y)
Surface.blit(@phases, status*@phases.w/3, index*@height, @phases.w/3, @height, @contents, index*WLH, 0)
end
def item_rect(index)
[@x+WLH*index, @y, @background.w/3, @height]
[WLH*index, 0, @phases.w/3, @height]
end
def mousemoved(x,y)
self.index = include?(x,y) ? (x - @x) / WLH : nil
......
......@@ -5,16 +5,16 @@
#==============================================================================
class Window_PlayerList < Window_List
BackGround = Surface.load "graphics/hall/playerlist.png"
attr_reader :x, :y, :width, :height
WLH = 24
WLH = 20
def initialize(x, y)
@contents = Surface.load "graphics/hall/playerlist.png"
super(x,y,272,WLH*22)
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 20)
super(x,y,272,540)
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16)
@color = [0x03, 0x11, 0x22]
@color_over = [0x03, 0x11, 0x22, 200,200,255]
@color_click = [200,200,255, 0x03, 0x11, 0x22]
@background = Surface.load "graphics/hall/playerlist.png"
#@contents.fill_rect(0,0,0,0,0xFFFFFFFF)
refresh
#@contents.f
......
......@@ -9,8 +9,10 @@ class Window_RoomList < Window_List
attr_reader :list
WLH = 48
def initialize(x, y)
@background = Surface.load 'graphics/hall/room.png'
super(x,y,@background.w / 3, 48 * 10)
@button = Surface.load 'graphics/hall/room.png'
@background = Surface.load 'graphics/hall/roomlist.png'
@contents = Surface.load 'graphics/hall/roomlist.png'
super(x,y,@button.w / 3, 48 * 10)
@item_max = 0
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16)
@color = [0x03, 0x11, 0x22]
......@@ -18,15 +20,15 @@ class Window_RoomList < Window_List
def draw_item(index, status=0)
room = @list[index]
Surface.blit(@background, @width*status, room.full? ? WLH : 0, @width, WLH, $screen, @x, @y+WLH*index)
@font.draw_blended_utf8($screen, "R-#{room.id}", @x+24, @y+WLH*index+8, *@color)
@font.draw_blended_utf8($screen, room.full? ? "【决斗中】" : room.private? ? "【私密房】" : "【等待中】", @x+8, @y+WLH*index+24, *@color)
@font.draw_blended_utf8($screen, room.name, @x+128, @y+WLH*index+8, *room.color)
@font.draw_blended_utf8($screen, room.player1.name, @x+128, @y+WLH*index+24, *@color)
@font.draw_blended_utf8($screen, room.player2.name, @x+256, @y+WLH*index+24, *@color) if room.full?
Surface.blit(@button, @width*status, room.full? ? WLH : 0, @width, WLH, @contents, 0, WLH*index)
@font.draw_blended_utf8(@contents, "R-#{room.id}", 24, WLH*index+8, *@color)
@font.draw_blended_utf8(@contents, room.full? ? "【决斗中】" : room.private? ? "【私密房】" : "【等待中】", 8, WLH*index+24, *@color)
@font.draw_blended_utf8(@contents, room.name, 128, WLH*index+8, *room.color)
@font.draw_blended_utf8(@contents, room.player1.name, 128, WLH*index+24, *@color)
@font.draw_blended_utf8(@contents, room.player2.name, 256, WLH*index+24, *@color) if room.full?
end
def item_rect(index)
[@x, @y+WLH*index, @width, WLH]
[@x, WLH*index, @width, WLH]
end
def list=(list)
@list = list
......
class Window_User < Window
BackGround = Surface.load "graphics/hall/user.png"
Boarder = Surface.load "graphics/hall/avatar_boader.png"
class Window_User < Window_List
WLH = 20
def initialize(x, y, user)
super(x,y,BackGround.w,BackGround.h)
@background = Surface.load "graphics/hall/user.png"
super(x,y,@background.w,@background.h, 300)
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 16)
@user = user
@contents = Surface.load "graphics/hall/user.png" #TODO:调用已经加载了的背景
@avatar_boarder = Surface.load "graphics/hall/avatar_boader.png"
@list = ["发送消息", "查看资料"]
@list << "加入游戏" if user.status == :waiting
@list << "观战" if user.status == :dueling
@item_max = @list.size
refresh
end
def refresh
@thread.kill if @thread
@contents.put(BackGround, 0,0)
@contents.put(@background, 0,0)
@thread = @user.avatar(:middle) do |avatar|
clear(12,12,144,144)
@contents.put(avatar, 24, 24)
@contents.put(Boarder, 12, 12)
@contents.put(@avatar_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(@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)
@font.draw_blended_utf8(@contents, "id: #{@user.id}" , 172, 32+WLH, 0x00,0x00,0x00)
@font.draw_blended_utf8(@contents, "#{'房间' + @user.room.id.to_s + ' ' if @user.room}#{case @user.status;when :hall;'大厅';when :dueling;'决斗中';when :waiting;'等待中';end}", 172, 32+WLH*2, 0x00,0x00,0x00)
super
end
def draw_item(index, status=0)
@font.draw_blended_utf8(@contents, @list[index] , 172, 96+index*WLH, 0x00,0x00,0x00)
end
def item_rect(index)
[172, 96+index*WLH, 128, WLH]
end
def clicked
case index
when 0
#发送消息
when 1
require 'launchy'
Launchy.open("http://google.com")
when 2
if @user.status == :waiting
$iduel.join(@user.room)
elsif @user.status == :dueling
$iduel.watch(@user.room)
end
end
end
def mousemoved(x,y)
if x.between?(@x+172, @x+@width) and y.between?(@y+96, @y+96+@item_max*WLH)
self.index = (y - @y - 96) / WLH
else
self.index = nil
end
end
def dispose
@thread.exit
......
......@@ -7,26 +7,26 @@
class Window_UserInfo < Window
def initialize(x, y, user)
@boarder = Surface.load "graphics/hall/avatar_boader.png"
super(x,y,240,@boarder.h)
@avatar_boarder = Surface.load "graphics/hall/avatar_boader.png"
super(x,y,240,144)
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 16)
@user = user
@background = Surface.load "graphics/hall/userinfo.png"
refresh
end
def refresh(x=@x, y=@y, width=@width, height=@height)
def refresh
@contents.put(@background, 0, 0)
@thread = @user.avatar(:middle) do |avatar|
$scene.refresh_rect(@x, @y, @boarder.w, @boarder.h) do
Surface.blit(avatar, 0,0,0,0,$screen,@x+12,@y+12)
Surface.blit(@boarder, 0,0,0,0,$screen,@x,@y)
end
@contents.put(avatar, 12, 12)
@contents.put(@avatar_boarder, 0, 0)
end
@font.draw_blended_utf8($screen, @user.name, @x+160, @y+12, 0x00,0x00,0x00)
@font.draw_blended_utf8($screen, "id: #{@user.id}" , @x+160, @y+12+16*2, 0x00,0x00,0x00)
@font.draw_blended_utf8($screen, "Level: #{@user.level}" , @x+160, @y+12+16*3, 0x00,0x00,0x00)
@font.draw_blended_utf8($screen, "总经验: #{@user.exp}", @x+160, @y+12+16*4, 0x00,0x00,0x00)
@font.draw_blended_utf8(@contents, @user.name, 160, 12, 0x00,0x00,0x00)
@font.draw_blended_utf8(@contents, "id: #{@user.id}" , 160, 12+16*2, 0x00,0x00,0x00)
@font.draw_blended_utf8(@contents, "Lv: #{@user.level}" , 160, 12+16*3, 0x00,0x00,0x00)
@font.draw_blended_utf8(@contents, "经验: #{@user.exp}", 160, 12+16*4, 0x00,0x00,0x00)
end
def dispose
@thread.exit
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment