Commit 5a2f4348 authored by 神楽坂玲奈's avatar 神楽坂玲奈

把所有的background和contents都做了display_format,速度提高不少

parent 1f985569
#<SyntaxError: E:/zh99998/Documents/NetBeansProjects/mycard/lib/window.rb:82: syntax error, unexpected keyword_end, expecting $end>
E:/zh99998/Documents/NetBeansProjects/mycard/lib/window_list.rb:7:in `require_relative'
E:/zh99998/Documents/NetBeansProjects/mycard/lib/window_list.rb:7:in `<top (required)>'
E:/zh99998/Documents/NetBeansProjects/mycard/lib/window_title.rb:1:in `require_relative'
E:/zh99998/Documents/NetBeansProjects/mycard/lib/window_title.rb:1:in `<top (required)>'
E:/zh99998/Documents/NetBeansProjects/mycard/lib/scene_title.rb:8:in `require_relative'
E:/zh99998/Documents/NetBeansProjects/mycard/lib/scene_title.rb:8:in `<top (required)>'
E:/zh99998/Documents/NetBeansProjects/mycard/lib/main.rb:29:in `require_relative'
E:/zh99998/Documents/NetBeansProjects/mycard/lib/main.rb:29:in `<main>'
\ No newline at end of file
......@@ -26,7 +26,7 @@ class User
yield result
Thread.new do
open("http://www.duelcn.com/uc_server/avatar.php?uid=#{id-100000}&size=#{size}", 'rb') {|io|open(cache, 'wb') {|c|c.write io.read}} rescue cache = "graphics/avatars/noavatar_#{size}.gif"
yield Surface.load cache
yield Surface.load(cache)
end
else
result
......
......@@ -8,7 +8,7 @@
class Scene_Config < Scene
require_relative 'window_config'
def start
@background = Surface.load "graphics/config/background.png"
@background = Surface.load("graphics/config/background.png").display_format
@config_window = Window_Config.new(0,0)
end
def handle(event)
......
......@@ -30,7 +30,7 @@ class Scene_Duel < Scene
def start
@bgm = Mixer::Music.load "audio/bgm/title.ogg"
Mixer.fade_in_music(@bgm, -1, 800)
@background = Surface.load "graphics/field/main.png"
@background = Surface.load("graphics/field/main.png").display_format
Surface.blit(@background, 0, 0, 0, 0, $screen, 0, 0)
init_game
......
......@@ -12,7 +12,7 @@ class Scene_Hall < Scene
require_relative 'window_chat'
def start
$game.refresh
@background = Surface.load "graphics/hall/background.png"
@background = Surface.load("graphics/hall/background.png").display_format
Surface.blit(@background,0,0,0,0,$screen,0,0)
@userlist = Window_UserList.new(24,204,$game.users)
@roomlist = Window_RoomList.new(320,50,$game.rooms)
......
......@@ -10,7 +10,7 @@ require_relative 'scene_replay'
class Scene_Login < Scene
Vocab_Logging = "Logging"
def start
@background = Surface.load("graphics/login/background.png")
@background = Surface.load("graphics/login/background.png").display_format
@gameselect_window = Window_GameSelect.new(117,269,$config["game"])
end
#def handle(event)
......
......@@ -10,7 +10,7 @@ class Scene_Title < Scene
def start
title = Dir.glob("graphics/titles/title_*.*")
title = title[rand(title.size)]
@background = Surface.load(title)
@background = Surface.load(title).display_format
Surface.blit(@background,0,0,0,0,$screen,0,0)
@command_window = Window_Title.new(title["left"] ? 200 : title["right"] ? 600 : 400, 300)
#logo = Surface.load("graphics/system/logo.png")
......
......@@ -15,8 +15,8 @@ class Widget_Msgbox < Window
end
def initialize(title, message, buttons={}, &proc)
#@background = Surface.load 'graphics/system/msgbox.png'
@contents = Surface.load 'graphics/system/msgbox.png'
@button = Surface.load 'graphics/system/button.png'
@contents = Surface.load('graphics/system/msgbox.png').display_format
@button = Surface.load('graphics/system/button.png')
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16)
super((1024-@contents.w)/2, 230, @contents.w, @contents.h)
set(title, message, buttons, &proc)
......
......@@ -6,9 +6,9 @@ class Window_Action < Window_List
def initialize#,list,list_available=Array.new(list.size, true))
super(0,0,123,20*WLH,300)
#@skin = Surface.load 'graphics/field/action.png'
@up = Surface.load 'graphics/field/action_up.png'
@down = Surface.load 'graphics/field/action_down.png'
@middle = Surface.load 'graphics/field/action.png'
@up = Surface.load('graphics/field/action_up.png')
@down = Surface.load('graphics/field/action_down.png')
@middle = Surface.load('graphics/field/action.png')
@up.set_alpha(RLEACCEL,255)
@middle.set_alpha(RLEACCEL,255)
@down.set_alpha(RLEACCEL,255)
......
......@@ -3,10 +3,10 @@ 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'
@checkbox = Surface.load('graphics/system/checkbox.png')
@button = Surface.load('graphics/system/button.png')
@background = Surface.load('graphics/config/background.png').display_format
@contents = Surface.load('graphics/config/background.png').display_format
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 20)
@index = nil
......
......@@ -21,8 +21,8 @@ class Window_Field < Window
Card_Size = [54, 81]
attr_accessor :action_window
def initialize(x, y, field,player=true)
@border = Surface.load 'graphics/field/border.png'
@border_horizontal = Surface.load 'graphics/field/border_horizontal.png' #@border.transform_surface(0x66000000,90,1,1,Surface::TRANSFORM_SAFE|Surface::TRANSFORM_AA)#FUCK!
@border = Surface.load('graphics/field/border.png')
@border_horizontal = Surface.load('graphics/field/border_horizontal.png') #@border.transform_surface(0x66000000,90,1,1,Surface::TRANSFORM_SAFE|Surface::TRANSFORM_AA)#FUCK!
super(x,y,711,282)
@field = field
@player = player
......
......@@ -9,7 +9,7 @@ class Window_FieldBack < Window
return if @card == card
@card = card
if card and File.file? file = "graphics/fields/#{card.name}.gif"
@contents = Surface.load file
@contents = Surface.load(file).display_format
self.visible=true
else
self.visible=false
......
......@@ -2,9 +2,9 @@ class Window_Phases < Window_List
WLH = 81 #其实是列宽
Phases = [:DP, :SP, :M1, :BP, :M2, :EP]
def initialize(x,y)
@phases_player = Surface.load 'graphics/system/phases_player.png'
@phases_player = Surface.load('graphics/system/phases_player.png')
@phases_player.set_alpha(RLEACCEL,255)
@phases_opponent = Surface.load 'graphics/system/phases_opponent.png'
@phases_opponent = Surface.load('graphics/system/phases_opponent.png')
@phases_opponent.set_alpha(RLEACCEL,255)
super(x,y,5*WLH+@phases_player.w/3, @phases_player.h/6)
@column_max = @item_max = 6
......
......@@ -9,7 +9,7 @@ class Window_RoomList < Window_List
attr_reader :list
WLH = 48
def initialize(x, y, list)
@button = Surface.load 'graphics/hall/room.png'
@button = Surface.load('graphics/hall/room.png')
@button.set_alpha(RLEACCEL, 255)
#@background = Surface.load 'graphics/hall/roomlist.png'
#@contents = Surface.load 'graphics/hall/roomlist.png'
......
......@@ -4,7 +4,7 @@ class Window_Title < Window_List
WLH = 50
attr_reader :x, :y, :width, :height, :single_height, :index
def initialize(x,y)
@button = Surface.load "graphics/system/titlebuttons.png"
@button = Surface.load("graphics/system/titlebuttons.png")
@button.set_alpha(RLEACCEL,255)
@single_height = @button.h / Button_Count
super(x,y,@button.w / 3,WLH * Button_Count - (WLH - @button.h / Button_Count))
......
......@@ -2,13 +2,13 @@
class Window_User < Window_List
WLH = 20
def initialize(x, y, user)
@background = Surface.load "graphics/hall/user.png"
@background = Surface.load("graphics/hall/user.png").display_format
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:调用已经加载了的背景
@contents = Surface.load("graphics/hall/user.png").display_format #TODO:调用已经加载了的背景
@avatar_boarder = Surface.load "graphics/hall/avatar_boader.png"
@avatar_boarder = Surface.load("graphics/hall/avatar_boader.png")
@list = ["发送消息", "查看资料"]
@list << "加入游戏" if user.status == :waiting
@list << "观战" if user.status == :dueling
......
......@@ -7,11 +7,11 @@
class Window_UserInfo < Window
def initialize(x, y, user)
@avatar_boarder = Surface.load "graphics/hall/avatar_boader.png"
@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"
@background = Surface.load("graphics/hall/userinfo.png").display_format
refresh
end
......
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