设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2067|回复: 1
打印 上一主题 下一主题

[已经过期] 變量系統

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
41 小时
注册时间
2013-3-19
帖子
44
跳转到指定楼层
1
发表于 2013-4-29 22:57:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如何再地圖的最左上方顯示一個變量,並使用一個開關操縱是否顯示?

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21484
在线时间
9389 小时
注册时间
2012-6-19
帖子
7114

开拓者短篇九导演组冠军

2
发表于 2013-4-29 23:16:20 | 只看该作者
RUBY 代码复制
  1. #==============================================================================
  2. #   XS - Variable Hud
  3. #   Author: Nicke
  4. #   Created: 02/04/2012
  5. #   Edited: 09/04/2012
  6. #   Version: 1.0a
  7. #==============================================================================
  8. # Instructions
  9. # -----------------------------------------------------------------------------
  10. # To install this script, open up your script editor and copy/paste this script
  11. # to an open slot below ? Materials but above ? Main. Remember to save.
  12. #
  13. # A small hud to display variables on the map.
  14. #
  15. # *** Only for RPG Maker VX Ace. ***
  16. #==============================================================================
  17. ($imported ||= {})["XAIL-VAR-WIN-HUD"] = true
  18.  
  19. module XAIL
  20.   module VAR_HUD
  21.   #--------------------------------------------------------------------------#
  22.   # * Settings
  23.   #--------------------------------------------------------------------------#
  24.       # FONT = [name, size, color, bold, shadow]
  25.       FONT = [["Verdana"], 14, Color.new(255,255,255), true, true] #这里修改显示变量的字体(字体、颜色、加粗、阴影)
  26.  
  27.       # HUD = [width, x, y, z, opacity, skin]
  28.       HUD = [270, 295, -5,  200, 0, nil] #这里修改显示的位置
  29.  
  30.       # VAR_HUD_SWITCH = switch_id
  31.       VAR_HUD_SWITCH = 1 #这里设置开关,开关关闭则脚本失效
  32.  
  33.       # VAR_LIST = [variable_id, vocab (nil), icon_index (nil), x, y] #这里设置要显示的变量
  34.       VAR_LIST = [] # Don't remove!
  35.       VAR_LIST[0] = [5, "HP", nil]
  36.       VAR_LIST[1] = [6, "MP", nil]
  37.  
  38.       # Set the symbol for the amount.
  39.       # Can be set to "" to disable.
  40.       # SYMBOL = string
  41.       SYMBOL = ""
  42.  
  43.       # The space beetween the variables.
  44.       # SPACING = number
  45.       SPACING = 24
  46.  
  47.   end
  48. end
  49. # *** Don't edit below unless you know what you are doing. ***
  50. #==============================================================================#
  51. # ** Window_Var_Hud
  52. #------------------------------------------------------------------------------
  53. #  Class for drawing the variable hud.
  54. #==============================================================================#
  55. class Window_Var_Hud < Window_Base
  56.  
  57.   def initialize
  58.     # // Method to initialize the var hud window.
  59.     super(0, 0, window_width, fitting_height(XAIL::VAR_HUD::VAR_LIST.size))
  60.     refresh
  61.   end
  62.  
  63.   def window_width
  64.     # // Method to return the width.
  65.     return XAIL::VAR_HUD::HUD[0]
  66.   end
  67.  
  68.   def draw_var(var, unit, x, y, width)
  69.     # // Method to draw a variable with the content.
  70.     value = "#{$game_variables[var]}#{XAIL::VAR_HUD::SYMBOL}"
  71.     contents.font = Font.new(XAIL::VAR_HUD::FONT[0], XAIL::VAR_HUD::FONT[1])
  72.     contents.font.color = XAIL::VAR_HUD::FONT[2]
  73.     contents.font.bold = XAIL::VAR_HUD::FONT[3]
  74.     contents.font.shadow = XAIL::VAR_HUD::FONT[4]
  75.     draw_text(x, y, width - 60, line_height, value, 2)
  76.     draw_text(x, y, width - 18, line_height, unit, 2) unless unit.nil?
  77.     reset_font_settings
  78.   end
  79.  
  80.   def refresh
  81.     # // Method to refresh the variable hud.
  82.     contents.clear
  83.     draw_var_hud
  84.   end
  85.  
  86.   def draw_var_hud
  87.     # // Method to draw the var hud.
  88.     y = 0
  89.     @vars = {}
  90.     for i in XAIL::VAR_HUD::VAR_LIST
  91.       x = i[1].nil? ? 32 : -10
  92.       draw_var(i[0], i[1], x, y, contents.width - 8)
  93.       draw_icon(i[2], 210, y - 2) unless i[2].nil?
  94.       y += XAIL::VAR_HUD::SPACING
  95.       @vars[i[0]] = $game_variables[i[0]]
  96.     end
  97.   end
  98.  
  99.   def update
  100.     # // Method to update the variable hud if a value has been changed.
  101.     super
  102.     for i in XAIL::VAR_HUD::VAR_LIST
  103.       refresh if($game_variables[i[0]] != @vars[i[0]])
  104.     end
  105.   end
  106.  
  107. end
  108. #==============================================================================
  109. # ** Scene_Map
  110. #------------------------------------------------------------------------------
  111. #  Show variable hud on the map.
  112. #==============================================================================
  113. class Scene_Map < Scene_Base
  114.  
  115.   alias xail_var_hud_window_start start
  116.   def start(*args, &block)
  117.     # // Method to start the var hud window on the map.
  118.     xail_var_hud_window_start(*args, &block)
  119.     create_var_hud_window
  120.     @var_hud_window.visible = $game_switches[XAIL::VAR_HUD::VAR_HUD_SWITCH]
  121.   end
  122.  
  123.   alias xail_var_hud_window_terminate terminate
  124.   def terminate(*args, &block)
  125.     # // Method to terminate the var hud window on the map.
  126.     xail_var_hud_window_terminate(*args, &block)
  127.   end
  128.  
  129.   def create_var_hud_window
  130.     # // Method to create the variable window.
  131.     @var_hud_window = Window_Var_Hud.new
  132.     @var_hud_window.x = XAIL::VAR_HUD::HUD[1]
  133.     @var_hud_window.y = XAIL::VAR_HUD::HUD[2]
  134.     @var_hud_window.z = XAIL::VAR_HUD::HUD[3]
  135.     @var_hud_window.opacity = XAIL::VAR_HUD::HUD[4]
  136.     @var_hud_window.windowskin = Cache.system(XAIL::VAR_HUD::HUD[5]) unless XAIL::VAR_HUD::HUD[5].nil?
  137.   end
  138.  
  139.   alias xail_var_hud_window_update update
  140.   def update(*args, &block)
  141.     # // Method to update the var hud window on the map.
  142.     xail_var_hud_window_update(*args, &block)
  143.     @var_hud_window.visible = $game_switches[XAIL::VAR_HUD::VAR_HUD_SWITCH]
  144.   end
  145.  
  146. end # END OF FILE
  147.  
  148. #=*==========================================================================*=#
  149. # ** END OF FILE
  150. #=*==========================================================================*=#
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-9-24 23:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表