end # module M5CES20141001
module M5CES20141001
#--------------------------------------------------------------------------
# ● Screen & Picture
#--------------------------------------------------------------------------
class Game_NewScreen < Game_Screen
def initialize
super
@pictures = Game_NewPictures.new
end
end
class Game_NewPicture < Game_Picture
end
class Game_NewPictures < Game_Pictures
def [](number)
@data[number] ||= Game_NewPicture.new(number)
end
end
class Sprite_NewPicture < Sprite_Picture
end
end # module M5CES20141001
module M5CES20141001
#--------------------------------------------------------------------------
# ● Interpreter
#--------------------------------------------------------------------------
class Interpreter < Game_Interpreter
def initialize(scene,depth = 0)
super(depth) @Scene = scene
end
def setup(list, flag = :normal)
return unless list @Flag = flag
super(list, 0)
update while running?
end
def wait(duration)
return if @Flag == :open
duration.times do
Graphics.update
@scene.update_for_wait
end
end
def map_interpreter
SceneManager.goto(Scene_Map)
$game_map.interpreter.setup(@list[@index, @list.length])
end
def screen
@scene.screen
end
def wait_for_message;end
def command_204
type,value,speed = @params[0], @params[1], @params[2]
background = @scene.background_plane
case type
when 4,6 then background.set_x((type - 5) * value, speed)
when 2,8 then background.set_y((5 - type) / 3 * value, speed)
end
end
def command_105
window = @scene.info_windows[@params[0]-1]
return unless window
message = ""
while next_event_code == 405
@index += 1
message += @list[@index].parameters[0]
message += "\n"
end
window.refresh message
end
def command_101
end
def command_355
script = @list[@index].parameters[0] + "\n"
while next_event_code == 655
@index += 1
script += @list[@index].parameters[0] + "\n"
end
@scene.eval_code(script)
end
alias m5_20150202_command_244 command_244
def command_244
return m5_20150202_command_244 unless @flag == :end
@scene.bgm.play
@scene.bgs.play
end
def command_117
common_event = $data_common_events[@params[0]]
if common_event
child = Interpreter.new(@scene, @depth + 1)
child.setup(common_event.list, 0)
child.run
end
end
[201,205,212,213,217].each do |m|
define_method "command_#{m}".to_sym do
map_interpreter
end
end
end
end # module M5CES20141001
module M5CES20141001
#--------------------------------------------------------------------------
# ● Plane_Background
#--------------------------------------------------------------------------
class Plane_Background < Plane
def initialize
super
@x = @y = @update_x = @update_y = 0
end
def update
return unless self.bitmap
@x += @update_x
@y += @update_y
self.ox, self.oy = @x, @y
end
def set_x(x, speed)
@x = self.ox
@update_x = move_speed(x, speed)
end
def set_y(y, speed)
@y = self.oy
@update_y = move_speed(y, speed)
end
def move_speed(value,speed)
value * case speed
when 1 then 0.125 ; when 2 then 0.25
when 3 then 0.5 ; when 4 then 1.0
when 5 then 2.0 ; when 6 then 4.0
end
end
def dispose
self.bitmap.dispose if self.bitmap
super
end
end
end # module M5CES20141001
module M5CES20141001
#--------------------------------------------------------------------------
# ● Window_Content
#--------------------------------------------------------------------------
class Window_Content < Window_Base
include Window_Method
def initialize(setting_main,setting,index)
super(0, 0, 1, 1)
@setting = setting_main || {}
@setting = @setting.clone
@setting.merge!(setting)
set_window(@setting)
reset_font_settings
end
def refresh(text = "")
contents.clear
draw_text_ex(4, 0, text)
end
def window_height
0
end
def window_width
0
end
def normal_color
text_color(c2number(@setting[:FontColor],0))
end
def reset_font_settings
change_color(normal_color)
contents.font.name = @setting[:FontName] || Font.default_name
contents.font.size = c2number(@setting[:FontSize],Font.default_size)
contents.font.bold = Font.default_bold
contents.font.italic = Font.default_italic
contents.font.bold = !contents.font.bold if @setting[:FontBold]
contents.font.italic = !contents.font.italic if @setting[:FontItalic]
end
end
end # module M5CES20141001
module M5CES20141001
#--------------------------------------------------------------------------
# ● Window_NewCommand
#--------------------------------------------------------------------------
class Window_NewCommand < Window_Command
include Window_Method
def initialize(setting,command,scene) @Scene = scene
@command = M5CES20141001::Load.new.setup2(command)
@setting = setting || {}
@index = -1
super(0, 0)
set_window(@setting)
refresh
@load_over = true unless @setting[:NoUpdate]
@index = -1
load_setting
@load_over = true
end
def window_height
[super,Graphics.height].min
end
def make_command_list
@command.each do |command|
add_command(command[0], :nil, true)
end
end
def load_setting
self.arrows_visible = false if @setting[:Horz]
if @setting[:Select]
select(@setting[:Select].to_i - 1)
else
select(0)
end
end
def select(index)
return if @index == index
super(index)
return unless @load_over
return unless @command[@index]
@scene.interpre.setup(@command[@index][2])
@scene.interpre.setup(@command[@index][1]) if @setting[:AutoUpdate]
end
def process_ok
return unless @command[@index]
@scene.interpre.setup(@command[@index][1])
activate
end
def process_cancel
SceneManager.return
end
def ok_enabled?
!@setting[:OkAble]
end
def cancel_enabled?
!@setting[:CancelAble]
end
alias m5_ces_cursor_down1 cursor_down
def cursor_down *arg
return if @setting[:Horz]
m5_ces_cursor_down1 *arg
end
alias m5_ces_cursor_up1 cursor_up
def cursor_up *arg
return if @setting[:Horz]
m5_ces_cursor_up1 *arg
end
def cursor_right *arg
return unless @setting[:Horz]
m5_ces_cursor_down1 *arg
end
def cursor_left *arg
return unless @setting[:Horz]
m5_ces_cursor_up1 *arg
end
end
end # module M5CES20141001
module M5CES20141001
#--------------------------------------------------------------------------
# ● Scene_M5CES20141001
#--------------------------------------------------------------------------
class Scene < Scene_Base
attr_reader :ev,:bgm,:bgs
attr_reader :interpre
attr_reader :info_windows,:command_window
attr_reader :picture_sprites,:background_plane,:screen
def prepare(id,bgm = nil,bgs = nil)
@ev = id
@bgm = bgm
@bgs = bgs
end
def start
super
@bgm ||= RPG::BGM.last
@bgs ||= RPG::BGS.last
load_events(@ev)
@interpre = Interpreter.new(self)
create_background
creat_sprites
creat_windows
@interpre.setup(@open,:open)
creat_command
update
end
def post_start
super
@interpre.setup(@after_open)
update
end
def load_events(id)
ev = $data_common_events[id]
raise "公共事件读取失败!" unless ev
ev_list = ev.list.clone
load = Load.new
@open, @after_open, @command, @input, @end, @setting = load.setup(ev_list)
@setting[:Scene] ||= {}
end
def creat_windows
@setting[:Info2] ||= {}
@info_windows = Array.new(8) do |i|
set = @setting[ ("Info#{i+1}").to_sym ]
set ? Window_Content.new(@setting[:Info], set, i) : nil
end
end
def creat_command
@command_window = Window_NewCommand.new(@setting[:Command], @command, self)
end
def creat_sprites
@picture_sprites = []
@background_plane = Plane_Background.new
if name = @setting[:Scene][:Background]
@background_plane.bitmap = Cache.picture(name)
end
@screen = Game_NewScreen.new
end
def create_background
@background_sprite = Sprite.new
@background_sprite.bitmap = SceneManager.background_bitmap
@background_sprite.color.set(16, 16, 16, 128)
end
def update_for_wait
update_graphics
Graphics.update
end
def update
super
update_graphics
update_input
end
def update_graphics
@background_plane.update
@screen.update
@screen.pictures.each do |pic|
@picture_sprites[pic.number] ||= Sprite_NewPicture.new(nil, pic)
@picture_sprites[pic.number].update
end
end
def update_input
@input.keys.each do |key|
@interpre.setup(@input[key]) if Input.trigger?(key)
end
end
def terminate
@interpre.setup(@end,:end)
super
dispose_scene_windows
dispose_scene_sprites
end
def dispose_scene_windows
@info_windows.each {|win| win.dispose if win }
end
def dispose_scene_sprites
@screen.clear
@background_plane.dispose
@background_sprite.dispose
@picture_sprites.compact!
@picture_sprites.each do |pic|
pic.bitmap.dispose if pic.bitmap
pic.dispose
end
end
def eval_code(code); eval code; end
def 退出界面; SceneManager.return; end
def 刷新界面; M5CES20141001.refresh; end
def 切换界面(id); M5CES20141001.jump(id); end
def 打开界面(id); M5CES20141001.call(id); end
end
end # module M5CES20141001
#--------------------------------------------------------------------------
# ● Window_MenuCommand
#--------------------------------------------------------------------------
class Window_MenuCommand
alias m5_20141001_add_formation_command add_formation_command
def add_formation_command
m5_20141001_add_formation_command
M5CES20141001::MENU.each_with_index do |set|
add_command(set[0],"m5_ces20141001_#{set[1]}".to_sym)
end
end
alias m5_20141001_handle? handle?
def handle?(symbol)
if /m5_ces20141001_\S+/ =~ symbol.to_s
return true
else
return m5_20141001_handle?(symbol)
end
end
alias m5_20141001_call_handler call_handler
def call_handler(symbol)
id = /m5_ces20141001_(\S+)/ =~ symbol.to_s ? $1.to_i : nil
return m5_20141001_call_handler(symbol) unless id
M5CES20141001.call(id)
end
end
#--------------------------------------------------------------------------
# ● Scene_Map
#--------------------------------------------------------------------------
class Scene_Map
alias m5_20150226_call_menu call_menu
def call_menu
var = $game_variables[ M5CES20141001::VAR ]
if var > 0
M5CES20141001.call(var)
else
m5_20150226_call_menu
end
end
end 作者: 52129848 时间: 2016-6-3 07:19
自己解决啦! 直接指定传送时的载具位置就好啦 。一时只想用脚本解决 忽略啦!