Commit 873082dc authored by 神楽坂玲奈's avatar 神楽坂玲奈

Merge pull request #2 from IamIpanda/master

parents 194e405d 7701d054
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.
...@@ -8,7 +8,7 @@ begin ...@@ -8,7 +8,7 @@ begin
$config['bgm'] = true if $config['bgm'].nil? $config['bgm'] = true if $config['bgm'].nil?
$config['screen'] ||= {} $config['screen'] ||= {}
$config['screen']['width'] ||= 1024 $config['screen']['width'] ||= 1024
$config['screen']['height'] ||= 768 $config['screen']['height'] ||= 640
end end
def save_config(file="config.yml") def save_config(file="config.yml")
......
...@@ -25,7 +25,7 @@ class Scene_Lobby < Scene ...@@ -25,7 +25,7 @@ class Scene_Lobby < Scene
@userinfo = Window_UserInfo.new(24,24, $game.user) @userinfo = Window_UserInfo.new(24,24, $game.user)
@host_window = Window_LobbyButtons.new(748,18) @host_window = Window_LobbyButtons.new(748,18)
@active_window = @roomlist @active_window = @roomlist
@chat_window = Window_Chat.new(313,543,698,212) @chat_window = Window_Chat.new(313,$config['screen']['height'] - 225,698,212)
@count = 0 @count = 0
super super
end end
......
#encoding: UTF-8 #encoding: UTF-8
#============================================================================== #==============================================================================
# ■ Scene_Login # ■ Scene_Login
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
#  login #  login
#============================================================================== #==============================================================================
require_relative 'window_gameselect' require_relative 'window_gameselect'
require_relative 'window_announcements' require_relative 'window_announcements'
require_relative 'window_login' require_relative 'window_login'
require_relative 'scene_replay' require_relative 'scene_replay'
require_relative 'scene_lobby' require_relative 'scene_lobby'
class Scene_Login < Scene class Scene_Login < Scene
def start def start
WM::set_caption("MyCard v#{Update::Version}", "MyCard") WM::set_caption("MyCard v#{Update::Version}", "MyCard")
@background = Surface.load("graphics/login/background.png").display_format @background = Surface.load("graphics/login/background.png").display_format
@gameselect_window = Window_GameSelect.new(117,269) #======================================================
super # We'll pay fpr that soon or later.
end #======================================================
def update if $config['screen']['height'] == 768
@gameselect_window.update @gameselect_window = Window_GameSelect.new(117,269)
super elsif $config['screen']['height'] == 640
end @gameselect_window = Window_GameSelect.new(117,134)
def handle_game(event) else
case event raise "无法分辨的分辨率"
when Game_Event::Login end
require_relative 'scene_lobby' #======================================================
$scene = Scene_Lobby.new # ENDS HERE
else #======================================================
super super
end end
end def update
#def terminate @gameselect_window.update
# @gameselect_window.destroy super
#end end
def handle_game(event)
case event
when Game_Event::Login
require_relative 'scene_lobby'
$scene = Scene_Lobby.new
else
super
end
end
#def terminate
# @gameselect_window.destroy
#end
end end
\ No newline at end of file
class Window_GameSelect < Window_List class Window_GameSelect < Window_List
WLH = 56 WLH = 56
def initialize(x,y) def initialize(x,y)
@font = TTF.open("fonts/wqy-microhei.ttc", 24) @font = TTF.open("fonts/wqy-microhei.ttc", 24)
@color = [255,255,255] @color = [255,255,255]
@game_color = [47,156,192] @game_color = [47,156,192]
@game_stroke_color = [0xFF,0xFF,0xFF] @game_stroke_color = [0xFF,0xFF,0xFF]
@items = [] @items = []
Dir.glob('lib/**/game.yml') do |file| Dir.glob('lib/**/game.yml') do |file|
game = YAML.load_file(file) game = YAML.load_file(file)
if game.is_a?(Hash) && game["name"] if game.is_a?(Hash) && game["name"]
game['file'] ||= 'game.rb' game['file'] ||= 'game.rb'
game['file'] = File.expand_path(game['file'], File.dirname(file)) game['file'] = File.expand_path(game['file'], File.dirname(file))
$config[game['name']] ||= {} $config[game['name']] ||= {}
@items << game @items << game
else else
$log.error "#{game.inspect}读取失败(#{file})" $log.error "#{game.inspect}读取失败(#{file})"
end end
end end
super(x,y,160,@items.size*WLH) super(x,y,160,@items.size*WLH)
clear clear
@button = Surface.load("graphics/login/game_background.png") @button = Surface.load("graphics/login/game_background.png")
#@button.set_alpha(RLEACCEL,255) #@button.set_alpha(RLEACCEL,255)
self.items = @items self.items = @items
self.index = @items.find_index{|game|game["name"] == $config['game']} || 0 self.index = @items.find_index{|game|game["name"] == $config['game']} || 0
clicked clicked
@announcements_window = Window_Announcements.new(313,265,600,24) #======================================================
refresh # We'll pay fpr that soon or later.
end #======================================================
def draw_item(index, status=0) if $config['screen']['height'] == 768
Surface.blit(@button, @button.w/3*status, @game == index ? @button.h/2 : 0, @button.w/3, @button.h/2, @contents, 0, WLH*index) @announcements_window = Window_Announcements.new(313,265,600,24)
draw_stroked_text(@items[index]["name"], 24, WLH*index+14, 2) elsif $config['screen']['height'] == 640
end @announcements_window = Window_Announcements.new(313,130,600,24)
def item_rect(index) else
return [0,0,0,0] unless index raise "无法分辨的分辨率"
[0, WLH*index, @button.w/3, @button.h/2] end
end #======================================================
def draw_stroked_text(text,x,y,size=1) # ENDS HERE
[[x-size,y-size], [x-size,y], [x-size,y+size], #======================================================
[x,y-size], [x,y+size], refresh
[x+size,y-size], [x+size,y], [x+size,y+size], end
].each{|pos|@font.draw_blended_utf8(@contents, text, pos[0], pos[1], *@game_stroke_color)} def draw_item(index, status=0)
@font.draw_blended_utf8(@contents, text, x, y, *@game_color) Surface.blit(@button, @button.w/3*status, @game == index ? @button.h/2 : 0, @button.w/3, @button.h/2, @contents, 0, WLH*index)
end draw_stroked_text(@items[index]["name"], 24, WLH*index+14, 2)
def mousemoved(x,y) end
self.index = (y-@y) / WLH def item_rect(index)
end return [0,0,0,0] unless index
def index=(index) [0, WLH*index, @button.w/3, @button.h/2]
return if @index == index# or index.nil? end
if @index def draw_stroked_text(text,x,y,size=1)
clear(*item_rect(@index)) [[x-size,y-size], [x-size,y], [x-size,y+size],
draw_item(@index, 0) [x,y-size], [x,y+size],
end [x+size,y-size], [x+size,y], [x+size,y+size],
@index = index ].each{|pos|@font.draw_blended_utf8(@contents, text, pos[0], pos[1], *@game_stroke_color)}
clear(*item_rect(@index)) @font.draw_blended_utf8(@contents, text, x, y, *@game_color)
draw_item(@index, 1) if @index end
end def mousemoved(x,y)
def clicked self.index = (y-@y) / WLH
return unless @index end
load @items[@index]["file"].encode("GBK") #TODO: load的这种架构微蛋疼,一时想不到更好的方案 def index=(index)
$config['game'] = @items[@index]['name'] return if @index == index# or index.nil?
@login_window.destroy if @login_window if @index
@login_window = Window_Login.new(316,316,$config[$config['game']]["username"],$config[$config['game']]["password"]) clear(*item_rect(@index))
@announcements_window.refresh if @announcements_window draw_item(@index, 0)
@game = @index end
refresh @index = index
end clear(*item_rect(@index))
def update draw_item(@index, 1) if @index
@login_window.update if @login_window end
@announcements_window.update if @announcements_window def clicked
end return unless @index
#def lostfocus load @items[@index]["file"].encode("GBK") #TODO: load的这种架构微蛋疼,一时想不到更好的方案
# self.index = nil $config['game'] = @items[@index]['name']
#end @login_window.destroy if @login_window
#def destroy #======================================================
# @login_window.destroy if @login_window # We'll pay fpr that soon or later.
# super #======================================================
#end if $config['screen']['height'] == 768
end @login_window = Window_Login.new(316,316,$config[$config['game']]["username"],$config[$config['game']]["password"])
elsif $config['screen']['height'] == 640
@login_window = Window_Login.new(316,183,$config[$config['game']]["username"],$config[$config['game']]["password"])
else
raise "无法分辨的分辨率"
end
#======================================================
# ENDS HERE
#======================================================
@announcements_window.refresh if @announcements_window
@game = @index
refresh
end
def update
@login_window.update if @login_window
@announcements_window.update if @announcements_window
end
#def lostfocus
# self.index = nil
#end
#def destroy
# @login_window.destroy if @login_window
# super
#end
end
...@@ -14,7 +14,7 @@ class Window_RoomList < Window_Scrollable ...@@ -14,7 +14,7 @@ class Window_RoomList < Window_Scrollable
@button.set_alpha(RLEACCEL, 255) @button.set_alpha(RLEACCEL, 255)
#@background = Surface.load 'graphics/lobby/roomitems.png' #@background = Surface.load 'graphics/lobby/roomitems.png'
#@contents = Surface.load 'graphics/lobby/roomitems.png' #@contents = Surface.load 'graphics/lobby/roomitems.png'
super(x,y,@button.w / 3, 48 * 10) super(x,y,@button.w / 3, ($config['screen']['height'] - 288) / 48 * 48)
@item_max = 0 @item_max = 0
@font = TTF.open("fonts/wqy-microhei.ttc", 16) @font = TTF.open("fonts/wqy-microhei.ttc", 16)
@color = [0x03, 0x11, 0x22] @color = [0x03, 0x11, 0x22]
......
...@@ -11,7 +11,7 @@ class Window_UserList < Window_Scrollable ...@@ -11,7 +11,7 @@ class Window_UserList < Window_Scrollable
def initialize(x, y, items) def initialize(x, y, items)
#@contents = Surface.load "graphics/lobby/useritems.png" #@contents = Surface.load "graphics/lobby/useritems.png"
#@background = Surface.load "graphics/lobby/useritems.png" #@background = Surface.load "graphics/lobby/useritems.png"
super(x,y,272,540) super(x,y,272,$config['screen']['height'] - 220)
@font = TTF.open("fonts/wqy-microhei.ttc", 16) @font = TTF.open("fonts/wqy-microhei.ttc", 16)
@color = [0x03, 0x11, 0x22] @color = [0x03, 0x11, 0x22]
@color_friend = [0, 128, 0] @color_friend = [0, 128, 0]
......
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.
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.
This diff was suppressed by a .gitattributes entry.
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