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

继续完善

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