注册会员 登录
Project1 返回首页

失去记忆总比什么都没有好 ... https://rpg.blue/?310500 [收藏] [复制] [分享] [RSS] 总有一天,你一定会完全记得我的吧?夫拉特蕾?

日志

F10 - 变量窗口

热度 5已有 1557 次阅读2013-3-9 13:00 |个人分类:脚本

#==============================================================================
# F10 - 变量窗口 - By芙蕾娅
#------------------------------------------------------------------------------
#  ★ - 新增  ☆ - 修改  ■ - 删除 ● - 无变更
#==============================================================================
module Freya
  # 初始游戏时是否显示窗口
  BeginShow = true
  # 控制显示当前进度的变量ID
  WindowVariableID = 1
  # 进度最大值的变量ID
  MaxWindowVariableID = 2
  # 进度条颜色,数字和事件的文字颜色同理
  VariableColor1 = 11
  VariableColor2 = 3
  # $game_system.variable_show = true
  # 为显示进度窗口,要关闭则设把true设为false
end
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
#  处理系统附属数据的类。保存存档和菜单的禁止状态之类的数据。
#   本类的实例请参考 $game_system 。
#==============================================================================
class Game_System
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_accessor :variable_show_text            # 进度名称
  attr_accessor :variable_show                 # 进度窗口是否显示
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias vw_initialize initialize
  def initialize
    vw_initialize
    @variable_show_text = ""
    @variable_show = Freya::BeginShow
  end
end
#==============================================================================
# ■ Window_Variable
#------------------------------------------------------------------------------
#  显示变量窗口
#==============================================================================
class Window_Variable < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, fitting_height(1))
    unless $game_system.variable_show
      self.opacity = 0
      self.contents_opacity = 0
    end
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    if $game_system.variable_show
      self.opacity = 255
      self.contents_opacity = 255
    else
      self.opacity = 0
      self.contents_opacity = 0
    end
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    color1 = text_color(Freya::VariableColor1)
    color2 = text_color(Freya::VariableColor2)
    if $game_variables[Freya::MaxWindowVariableID] != 0
      rate = $game_variables[Freya::WindowVariableID].to_f / $game_variables[Freya::MaxWindowVariableID]
      draw_gauge(0, 0, contents.width, rate, color1, color2)
      text = "#{$game_variables[Freya::WindowVariableID]}/#{$game_variables[Freya::MaxWindowVariableID]}"
      draw_text(contents.rect, text, 2)
    else
      draw_text(contents.rect, $game_variables[Freya::WindowVariableID], 2)     
    end
    contents.font.size = 15
    draw_text(contents.rect, $game_system.variable_show_text)
    contents.font.size = Font.default_size
  end
end

#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
#  菜单画面
#==============================================================================
class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 生成金钱窗口
  #--------------------------------------------------------------------------
  alias create_variable_window create_gold_window
  def create_gold_window
    create_variable_window
    @variable_window = Window_Variable.new
    @variable_window.y = @command_window.y + @command_window.height
  end
end


#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
#  地图画面
#==============================================================================
class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● 生成所有窗口
  #--------------------------------------------------------------------------
  alias vw_create_all_windows create_all_windows
  def create_all_windows
    vw_create_all_windows
    @variable_window = Window_Variable.new
    @variable_window.y = Graphics.height - @variable_window.height
  end
end

鸡蛋
3

鲜花

刚表态过的朋友 (3 人)

评论 (0 个评论)

facelist doodle 涂鸦笔

您需要登录后才可以评论 登录 | 注册会员

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-20 14:06

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

返回顶部