end
def calc_speed
end
def set_rand_stats
@x_speed=(rand(4)-2)*0.8
@y_speed=(rand(4)-2)*0.8
@x_speed+=rand(2)-1 if @x_speed==0
@y_speed+=rand(2)-1 if @y_speed==0
@opacity_speed=2
@angle_speed=rand(3)-3
self.opacity = 1
self.angle = rand(360)
rand_num=rand(9)
case rand_num
when 0
self.x,self.y=0,0
when 1
self.x,self.y=RESOLUTION[0],RESOLUTION[1]
when 2
self.x,self.y=RESOLUTION[0],0
when 3
self.x,self.y=0,RESOLUTION[1]
when 4
self.x,self.y=RESOLUTION[0]/2,0
when 5
self.x,self.y=RESOLUTION[0]/2,RESOLUTION[1]
when 6
self.x,self.y=0,208
when 7
self.x,self.y=RESOLUTION[0],RESOLUTION[1]/2
when 8
self.x,self.y=RESOLUTION[0]/2 ,RESOLUTION[1]/2
end
self.zoom_x=(rand(100) + 100) / 100.0
self.zoom_y = self.zoom_x
self.blend_type=1
end
def get_rand_pos
pos=[]
case rand(4)
when 0
pos[0]=0
when 1
pos[0]=200
when 2
pos[0]=300
when 3
pos[0]=500
when 4
pos[0]=100
end
case rand(4)
when 0
pos[1]=0
when 1
pos[1]=200
when 2
pos[1]=300
when 3
pos[1]=500
when 4
pos[1]=100
end
return pos
end
end
#==============================================================================
# ■ MC Choice
#------------------------------------------------------------------------------
# 可爱的选项~
#==============================================================================
# 选项用精灵类
class Sprite_MCchoice < Sprite_Base
include LBQ::MC_Title
#设置
MAX_INDEX=3
MIN_INDEX=1
#初始化
def initialize(viewport=nil)
super(viewport)
#光标Index
if DataManager.save_file_exists?
@index=2
else
@index=1
end
#动态阶段
@stage=1
end
#更新方法
def update
#super
super
#基础的动态设定
case @stage
when 1
#更新选项
update_cursor
#再次强化不透明度
self.opacity=0
#之后转成第二步
@stage+=1
when 2
#变得透明
self.opacity+=FADE_SPEED
#如果已经变完了
if self.opacity>=255
#进入第三步
@stage+=1
end
when 3
#好的,于是咱来进行光标更新
if Input.trigger?(:LEFT)
Sound.play_cursor
if @index==MIN_INDEX
@index=MAX_INDEX
else
@index-=1
end
#输入完毕之后再更新
update_cursor
elsif Input.trigger?(:RIGHT)
Sound.play_cursor
if @index==MAX_INDEX
#强化条件
@index=MIN_INDEX
else
@index+=1
end
#输入完毕之后再更新
update_cursor
end
end
end
#index外置接口
def index
@index
end
#更新光标
def update_cursor
#设置当前bitmap名字
bitmap_name="#{GRAPHICS[0]}#{@index}"
self.bitmap=Cache.mc_title(bitmap_name)
end
#设置当前index
def set_index(index)
@index=index
end
end
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 标题类
#==============================================================================
# Scene类
class Scene_Title < Scene_Base
include LBQ::MC_Title
def start
super
@sparks=[]
#设置背景图像
@bg_sprite.bitmap=Cache.mc_title(GRAPHICS[3])
end
#更新
def update
super
#计时器+
@timer+=1
#滚动
@bg_sprite.ox+=SHIFT_SPEED[1] if @timer%SHIFT_SPEED[0]==0
@sparks.push(Sprite_lbqSpark.new(@spark_vp)) if @timer%TIME_SPARK==0
@sparks.each{|spk|spk.update }
#~ unless spk.disposed?
case @stage
when 0
@mask_sprite.opacity-=MASK_FADE[0]
if @mask_sprite.opacity<=0
@stage=1
end
when 1
#淡入阶段
@logo_sprite.opacity+=FADE_SPEED
if @logo_sprite.opacity>=255
@stage=2
end
#更新选项
@choice_sprite.update
when 2
@choice_sprite.update
#如果确定了
if Input.trigger?(:C)
Sound.play_ok
case @choice_sprite.index
when 1
@stage=3
when 2
@stage=4
when 3
@stage=5
end
end
when 3
Audio.bgm_fade(BGM_FADE)
@mask_sprite.opacity+=MASK_FADE[1]
if @mask_sprite.opacity>=255
command_new_game
end
when 4
command_continue
when 5
Audio.bgm_fade(BGM_FADE)
@mask_sprite.opacity+=MASK_FADE[1]
if @mask_sprite.opacity>=255
exit
end
end
end
#--------------------------------------------------------------------------
# ● 指令“继续游戏”
#--------------------------------------------------------------------------
def command_continue
SceneManager.call(Scene_Load)
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
SceneManager.snapshot_for_background
@logo_sprite.dispose
@choice_sprite.dispose
@bg_sprite.dispose
@bg_vp.dispose
@choice_vp.dispose
end
#--------------------------------------------------------------------------
# ● 指令“开始游戏”
#--------------------------------------------------------------------------
def command_new_game
DataManager.setup_new_game
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
def create_sprites
@logo_sprite=Sprite_Base.new(@choice_vp)
@logo_sprite.bitmap=Cache.mc_title(GRAPHICS[2])
@logo_sprite.opacity=0
@mask_sprite=Sprite.new(@mask_vp)
@mask_sprite.bitmap=Bitmap.new(RESOLUTION[0],RESOLUTION[1])
@mask_sprite.bitmap.fill_rect(0,0,RESOLUTION[0],RESOLUTION[1],Color.new(0,0,0))
end
def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end
class Window_Help2 < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(line_number = 0)
super(0, 0, 210, 0)
self.z = 150
contents.font.size = 14
hide
end
#--------------------------------------------------------------------------
# ● 设置内容
#--------------------------------------------------------------------------
def set_text(text)
@text = text
refresh
end
#--------------------------------------------------------------------------
# ● 清除
#--------------------------------------------------------------------------
def clear
set_text("")
end
#--------------------------------------------------------------------------
# ● 更新帮助位置
#--------------------------------------------------------------------------
def uppos(index,rect,window)
self.height = fitting_height2(Equipplus.getline(@xtext,13))
create_contents
contents.font.size = 14
rect.x -= window.ox
rect.y -= window.oy
ax = rect.x + rect.width + 10
ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
ax += window.x
ax = 0 if ax < 0
ay = rect.y + rect.height
ay = rect.y - self.height if ay + self.height > window.height
ay += window.y
ay = 0 if ay < 0
self.x = ax
self.y = ay
set_text(@xtext)
show
end
#--------------------------------------------------------------------------
# ● 设置物品
# item : 技能、物品等
#--------------------------------------------------------------------------
def set_item(item)
if item == nil
set_text("")
return
end
@xtext = ""
@xtext = "名称:" + item.name + "\n"
@xtext += "介绍:" + item.description + "\n"
@xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
@xtext += Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
@xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
hide if @text == ""
draw_text_ex(4, 0, @text,width,40,false)
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 计算窗口显示指定行数时的应用高度2*************************
#--------------------------------------------------------------------------
def fitting_height2(line_number)
line_number * contents.font.size + standard_padding * 2
end
#~ draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan
#--------------------------------------------------------------------------
# ● 绘制带有控制符的文本内容
# 如果传递了width参数的话,会自动换行
#--------------------------------------------------------------------------
def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
reset_font_settings if normalfont == true
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
if width != nil
pos[:height] = contents.font.size
pos[:width] = width
pos[:textwidth] = textwidth
end
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
#--------------------------------------------------------------------------
# ● 文字的处理
# c : 文字
# text : 绘制处理中的字符串缓存(字符串可能会被修改)
# pos : 绘制位置 {:x, :y, :new_x, :height}
#--------------------------------------------------------------------------
def process_character(c, text, pos)
case c
when "\r" # 回车
return
when "\n" # 换行
process_new_line(text, pos)
when "\f" # 翻页
process_new_page(text, pos)
when "\e" # 控制符
process_escape_character(obtain_escape_code(text), text, pos)
else # 普通文字
pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
process_new_line(text, pos)
end
process_normal_character(c, pos)
end
end
end
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
end
end
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
end
end
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item) if @help_window
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
@status_window.item = item if @status_window
end
end
class Window_EquipSlot < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
super
@help_window.set_item(item) if @help_window
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
@status_window.set_temp_actor(nil) if @status_window
end
end
class Scene_Shop < Scene_MenuBase
alias on_sell_ok_old on_sell_ok
def on_sell_ok
on_sell_ok_old
@help_window.hide
end
alias on_buy_ok_old on_buy_ok
def on_buy_ok
on_buy_ok_old
@help_window.hide
end
alias on_number_ok_old on_number_ok
def on_number_ok
on_number_ok_old
@help_window.refresh
@help_window.show
end
alias on_number_cancel_old on_number_cancel
def on_number_cancel
on_number_cancel_old
@help_window.refresh
@help_window.show
end
end
class Scene_Title < Scene_Base
alias start_old start
def start
start_old
Equipplus.equiphelpready
end
end
class Scene_ItemBase < Scene_MenuBase
alias old_on_actor_cancel on_actor_cancel
def on_actor_cancel
old_on_actor_cancel
@help_window.refresh
end
alias old_on_actor_ok on_actor_ok
def on_actor_ok
old_on_actor_ok
@help_window.refresh
end
end
class Window_Base < Window
alias old_process_new_line process_new_line
def process_new_line(text, pos)
old_process_new_line(text, pos)
pos[:height] = contents.font.size if pos[:width] != nil
end
end
class Scene_MenuBase < Scene_Base
def create_help_window
@help_window = Window_Help2.new
@help_window.viewport = @viewport
end
end
class Scene_Battle < Scene_Base
def create_help_window
@help_window = Window_Help2.new
@help_window.visible = false
end
end作者: 战斗的双手 时间: 2016-3-26 14:18 本帖最后由 战斗的双手 于 2016-3-26 14:25 编辑