Commit 748fed7e authored by 神楽坂玲奈's avatar 神楽坂玲奈

继续完善

parent 74d56beb
--- ---
fullscreen: false fullscreen: false
width: 1024 width: 1024
height: 768 height: 768
autologin: true autologin: true
username: zh99997 username: zh99997
password: '111111' password: "111111"
...@@ -153,7 +153,7 @@ class Action ...@@ -153,7 +153,7 @@ class Action
end end
if @position if @position
if @position == :"face-up" if @position == :"face-up"
if card.position == :set and (6..10).include?(@to_pos || @from_pos) #里侧表示的怪兽 if card.position != :attack and (6..10).include?(@to_pos || @from_pos) #里侧表示的怪兽
card.position = :defense card.position = :defense
else else
card.position = :attack card.position = :attack
......
...@@ -44,7 +44,7 @@ class FPSTimer ...@@ -44,7 +44,7 @@ class FPSTimer
private private
def wait(nxt) def wait(nxt)
p nxt print "-"# 加了这货tk输入框不卡,原因不明=.=
sleeptime = nxt-get_ticks sleeptime = nxt-get_ticks
sleep(sleeptime) if sleeptime > 0 sleep(sleeptime) if sleeptime > 0
end end
......
...@@ -125,12 +125,12 @@ class Game_Event ...@@ -125,12 +125,12 @@ class Game_Event
class Error < Game_Event class Error < Game_Event
attr_reader :title, :message attr_reader :title, :message, :fatal
def initialize(title, message) def initialize(title, message, fatal=true)
@title = title @title = title
@message = message @message = message
$log.info @title @fatal = fatal
$log.info @message $log.error(@title){@message}
end end
end end
class Unknown < Error class Unknown < Error
......
...@@ -82,9 +82,9 @@ class Scene ...@@ -82,9 +82,9 @@ class Scene
when Mouse::BUTTON_LEFT when Mouse::BUTTON_LEFT
@active_window.clicked if @active_window @active_window.clicked if @active_window
when 4 when 4
@active_window.cursor_up @active_window.cursor_up if @active_window
when 5 when 5
@active_window.cursor_down @active_window.cursor_down if @active_window
end end
when Event::KeyDown when Event::KeyDown
case event.sym case event.sym
...@@ -102,7 +102,7 @@ class Scene ...@@ -102,7 +102,7 @@ class Scene
def handle_game(event) def handle_game(event)
case event case event
when Game_Event::Error when Game_Event::Error
Widget_Msgbox.new(event.title, event.message, :ok => "确定"){$scene = Scene_Title.new} Widget_Msgbox.new(event.title, event.message, :ok => "确定"){$scene = Scene_Title.new if event.fatal}
else else
$log.debug event $log.debug event
end end
......
...@@ -11,16 +11,17 @@ class Scene_Replay < Scene_Watch ...@@ -11,16 +11,17 @@ class Scene_Replay < Scene_Watch
def save_replay def save_replay
end end
def update def update
if @count >= 10#60 if @count and @count >= 10#60
event = @replay.get event = @replay.get
if event if event
Game_Event.push event Game_Event.push event
@count = 0 @count = 0
else else
Widget_Msgbox.new("回放", "战报回放完毕", :ok => "确定") { $scene = Scene_Login.new } Widget_Msgbox.new("回放", "战报回放完毕", :ok => "确定") { $scene = Scene_Login.new }
@count = nil #播放完毕标记
end end
end end
@count += 1 @count += 1 if @count
super super
end end
end end
...@@ -13,10 +13,10 @@ class Scene_Title < Scene ...@@ -13,10 +13,10 @@ class Scene_Title < Scene
@background = Surface.load(title) @background = Surface.load(title)
Surface.blit(@background,0,0,0,0,$screen,0,0) Surface.blit(@background,0,0,0,0,$screen,0,0)
@command_window = Window_Title.new(title["left"] ? 200 : title["right"] ? 600 : 400, 300) @command_window = Window_Title.new(title["left"] ? 200 : title["right"] ? 600 : 400, 300)
logo = Surface.load("graphics/system/logo.png") #logo = Surface.load("graphics/system/logo.png")
@logo_window = Window.new(@command_window.x-(logo.w-@command_window.width)/2,150,logo.w,logo.h) #@logo_window = Window.new(@command_window.x-(logo.w-@command_window.width)/2,150,logo.w,logo.h)
@logo_window.contents = logo #@logo_window.contents = logo
$screen.update_rect(0,0,0,0) #$screen.update_rect(0,0,0,0)
@bgm = Mixer::Music.load 'audio/bgm/title.ogg' @bgm = Mixer::Music.load 'audio/bgm/title.ogg'
@decision_se = Mixer::Wave.load("audio/se/decision.ogg") @decision_se = Mixer::Wave.load("audio/se/decision.ogg")
Mixer.fade_in_music @bgm, -1, 800 Mixer.fade_in_music @bgm, -1, 800
...@@ -29,21 +29,25 @@ class Scene_Title < Scene ...@@ -29,21 +29,25 @@ class Scene_Title < Scene
def determine def determine
return unless @command_window.index return unless @command_window.index
Mixer.play_channel(-1,@decision_se,0) Mixer.play_channel(-1,@decision_se,0)
$scene = case @command_window.index case @command_window.index
when 0 when 0
require_relative 'scene_login' require_relative 'scene_login'
Scene_Login.new $scene = Scene_Login.new
when 1 when 1
require_relative 'scene_single' #require_relative 'scene_single'
Scene_Single.new require_relative 'widget_msgbox'
Widget_Msgbox.new("mycard", "功能未实现", :ok => "确定")
#Scene_Single.new
when 2 when 2
require_relative 'scene_deck' require_relative 'widget_msgbox'
Scene_Deck.new Widget_Msgbox.new("mycard", "功能未实现", :ok => "确定")
#require_relative 'scene_deck'
#Scene_Deck.new
when 3 when 3
require_relative 'scene_config' require_relative 'scene_config'
Scene_Config.new $scene = Scene_Config.new
when 4 when 4
nil $scene = nil
end end
end end
def terminate def terminate
......
...@@ -37,12 +37,11 @@ class Widget_InputBox < Window ...@@ -37,12 +37,11 @@ class Widget_InputBox < Window
clear clear
@font.draw_blended_utf8(@contents, @type == :password ? '*' * @value.size : @value, 0, 0, 0x00, 0x00, 0x00) unless @value.empty? @font.draw_blended_utf8(@contents, @type == :password ? '*' * @value.size : @value, 0, 0, 0x00, 0x00, 0x00) unless @value.empty?
end end
def mousemoved(x,y)
end
def clicked def clicked
@@entry.value = @value @@entry.value = @value
@@entry.show @type == :password ? '*' : nil @@entry.show @type == :password ? '*' : nil
@@entry.focus :force @@entry.focus :force
@@entry.width @width
@@root.geometry "#{@width}x#{@height}+#{@x+TkWinfo.pointerx(@@root)-Mouse.state[0]}+#{@y+TkWinfo.pointery(@@root)-Mouse.state[1]}" #根据鼠标位置来确定游戏窗口的相对位置,点击的瞬间鼠标移动了的话会有误差 @@root.geometry "#{@width}x#{@height}+#{@x+TkWinfo.pointerx(@@root)-Mouse.state[0]}+#{@y+TkWinfo.pointery(@@root)-Mouse.state[1]}" #根据鼠标位置来确定游戏窗口的相对位置,点击的瞬间鼠标移动了的话会有误差
@@root.deiconify @@root.deiconify
@@active = self #TODO:存在线程安全问题 @@active = self #TODO:存在线程安全问题
......
...@@ -2,12 +2,26 @@ ...@@ -2,12 +2,26 @@
class Widget_Msgbox < Window class Widget_Msgbox < Window
Title_Color = [0xFF, 0xFF, 0xFF] Title_Color = [0xFF, 0xFF, 0xFF]
Message_Color = [0x04, 0x47, 0x7c] Message_Color = [0x04, 0x47, 0x7c]
class <<self
alias old_new new
def new(title, message, buttons={}, &proc)
if instance = $scene.windows.find{|window|window.class == self and !window.destroyed?}
instance.set(title, message, buttons, &proc)
instance
else
old_new(title, message, buttons, &proc)
end
end
end
def initialize(title, message, buttons={}, &proc) def initialize(title, message, buttons={}, &proc)
#@background = Surface.load 'graphics/system/msgbox.png' #@background = Surface.load 'graphics/system/msgbox.png'
@contents = Surface.load 'graphics/system/msgbox.png' @contents = Surface.load 'graphics/system/msgbox.png'
@button = Surface.load 'graphics/system/button.png' @button = Surface.load 'graphics/system/button.png'
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16) @font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16)
super((1024-@contents.w)/2, 230, @contents.w, @contents.h) super((1024-@contents.w)/2, 230, @contents.w, @contents.h)
set(title, message, buttons, &proc)
end
def set(title, message, buttons={}, &proc)
@title = title @title = title
@message = message @message = message
@buttons = buttons @buttons = buttons
......
...@@ -52,7 +52,7 @@ class Window ...@@ -52,7 +52,7 @@ class Window
end end
end end
def clear(x=0, y=0, width=@width, height=@height) def clear(x=0, y=0, width=@width, height=@height)
if $scene.background if $scene and $scene.background
Surface.blit($scene.background,@x+x,@y+y,width,height,@contents,x,y) Surface.blit($scene.background,@x+x,@y+y,width,height,@contents,x,y)
else else
@contents.fill_rect(x,y,width,height,0xFF000000) @contents.fill_rect(x,y,width,height,0xFF000000)
......
...@@ -13,7 +13,6 @@ class Window_Chat < Window ...@@ -13,7 +13,6 @@ class Window_Chat < Window
super(x,y,width,height) super(x,y,width,height)
@chat_input = Widget_InputBox.new(416,723,586,24){|text|$game.chat text; add($game.user, text)} @chat_input = Widget_InputBox.new(416,723,586,24){|text|$game.chat text; add($game.user, text)}
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16) @font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16)
#@contents.fill_rect(0,0,@width, @height, 0xFFFFFFFF)
@scroll = Widget_ScrollBar.new(@x+@width-20,@y,@height,0) @scroll = Widget_ScrollBar.new(@x+@width-20,@y,@height,0)
@list = [] @list = []
end end
...@@ -22,7 +21,7 @@ class Window_Chat < Window ...@@ -22,7 +21,7 @@ class Window_Chat < Window
refresh refresh
end end
def refresh def refresh
#@contents.fill_rect(0,0,@width, @height, 0x66FFFFFF) clear
@list.last(7).each_with_index do |chat, index| @list.last(7).each_with_index do |chat, index|
user, content = *chat user, content = *chat
@font.draw_blended_utf8(@contents, user.name, 0, index*WLH, *User_Color) @font.draw_blended_utf8(@contents, user.name, 0, index*WLH, *User_Color)
......
...@@ -200,10 +200,10 @@ class Window_Field < Window ...@@ -200,10 +200,10 @@ class Window_Field < Window
end end
end end
def cursor_up def cursor_up
@action_window.cursor_up @action_window.cursor_up if @action_window
end end
def cursor_down def cursor_down
@action_window.cursor_down @action_window.cursor_down if @action_window
end end
def cursor_left def cursor_left
#self.index = @index ? (@index - 1) % [@list.size, @item_max].min : 0 #self.index = @index ? (@index - 1) % [@list.size, @item_max].min : 0
......
...@@ -5,8 +5,8 @@ class Window_RoomChat < Window ...@@ -5,8 +5,8 @@ class Window_RoomChat < Window
Player_Color = [0,0,0xFF] Player_Color = [0,0,0xFF]
Opponent_Color = [0,0x66,0] Opponent_Color = [0,0x66,0]
def initialize(x, y, width, height) def initialize(x, y, width, height)
super(x,y,width,height-WLH) super(x,y,width,height-24)
@chat_input = Widget_InputBox.new(@x,@y+@height,@width,WLH){|text|($scene.is_a?(Scene_Watch) ? $game : $scene).action Action::Chat.new(true, text)} @chat_input = Widget_InputBox.new(@x,@y+@height,@width,24){|text|($scene.is_a?(Scene_Watch) ? $game : $scene).action Action::Chat.new(true, text)}
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 14) @font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 14)
@contents.fill_rect(0,0,@width, @height, 0x99FFFFFF) @contents.fill_rect(0,0,@width, @height, 0x99FFFFFF)
@scroll = Widget_ScrollBar.new(@x+@width-20,@y,@height,0) @scroll = Widget_ScrollBar.new(@x+@width-20,@y,@height,0)
......
...@@ -19,6 +19,7 @@ class Window_User < Window_List ...@@ -19,6 +19,7 @@ class Window_User < Window_List
@thread.kill if @thread @thread.kill if @thread
super super
@thread = @user.avatar(:middle) do |avatar| @thread = @user.avatar(:middle) do |avatar|
clear(12,12,@avatar_boarder.w, @avatar_boarder.h)
@contents.put(avatar, 24, 24) @contents.put(avatar, 24, 24)
@contents.put(@avatar_boarder, 12, 12) @contents.put(@avatar_boarder, 12, 12)
end end
......
...@@ -18,15 +18,16 @@ class Window_UserInfo < Window ...@@ -18,15 +18,16 @@ class Window_UserInfo < Window
def refresh def refresh
@contents.put(@background, 0, 0) @contents.put(@background, 0, 0)
@thread = @user.avatar(:middle) do |avatar| @thread = @user.avatar(:middle) do |avatar|
clear(0,0,@avatar_boarder.w, @avatar_boarder.h)
@contents.put(avatar, 12, 12) @contents.put(avatar, 12, 12)
@contents.put(@avatar_boarder, 0, 0) @contents.put(@avatar_boarder, 0, 0)
end end
@font.draw_blended_utf8(@contents, @user.name, 160, 12, 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, "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, "Lv: #{@user.level}" , 160, 12+16*3, 0x00,0x00,0x00) if @user.respond_to? :level #TODO:规范化,level是iduel专属的,但是又不太想让iduel来重定义这个window
#@font.draw_blended_utf8(@contents, "经验: #{@user.exp}", 160, 12+16*4, 0x00,0x00,0x00) @font.draw_blended_utf8(@contents, "经验: #{@user.exp}", 160, 12+16*4, 0x00,0x00,0x00) if @user.respond_to? :exp
end end
def dispose def dispose
@thread.exit @thread.exit
......
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