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

Project1

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

[已经解决] 这东西怎么用啊(羞耻

[复制链接]

Lv1.梦旅人

史莱姆的信徒
12-B

梦石
0
星屑
53
在线时间
368 小时
注册时间
2013-8-14
帖子
1011
跳转到指定楼层
1
发表于 2015-2-12 15:16:26 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 机械守护者 于 2015-2-12 15:20 编辑

打开姿势正确时的效果


代码:  @index
  1. #==============================================================================
  2. #   XS - Message
  3. #   Author: Nicke
  4. #   Created: 08/11/2012
  5. #   Edited: 19/11/2012
  6. #   Version: 1.0b
  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. # Requires: XS - Core Script.
  14. #==============================================================================
  15. # A message system based on using variables ingame.
  16. # If the variable has the value 0 the default value will take place.
  17. # To setup a simple message dialog do as you would normally do when adding
  18. # text in events but before it set the variables you want to change.
  19. #
  20. # When changing width and height you should know that height is visible
  21. # line numbers which means the numbers 1 to 4 is prefered to use.
  22. #
  23. # Example:
  24. # You could set the width to 544 and height to 4 which is pretty much how
  25. # the default message window looks like.
  26. #
  27. # This script also support sound effect to be played each time a character is
  28. # processed. Can be tweaked in the settings.
  29. #
  30. # When setting variables for bold, shadow, namebox and skin etc. Remember to use
  31. # the script area in the variable.
  32. #
  33. # If I wanted to enable bold and setting a custom skin I would do this:
  34. # Set the value "true" in the script section for variable 41.
  35. # Set the value "Window" in the script section for variable 44.
  36. #
  37. # Note: When changing the message window skin you must use this method after
  38. # setting the variable in order to properly update to the new skin:
  39. # SceneManager.scene.set_message_skin
  40. #
  41. # Example:
  42. # So after setting variable 44 (default one) to "Window3" call that method.
  43. #
  44. # *** Only for RPG Maker VX Ace. ***
  45. #==============================================================================
  46. ($imported ||= {})["XAIL-MESSAGE-SYSTEM"] = true

  47. module XAIL
  48.   module MSG
  49.   #--------------------------------------------------------------------------#
  50.   # * Settings
  51.   #--------------------------------------------------------------------------#
  52.     # Set the window variables.
  53.     # WINDOW_VAR = [width, height, padding, x, y, delay,
  54.     # font_name, font_size, font_color, outline, bold, shadow, namebox, skin]
  55.     WINDOW_VAR = [31,32,33,34,35,36,37,38,39,40,41,42,43,44]
  56.    
  57.     # Set the window open/close animation in frames.
  58.     # WINDOW_ANIMATE = [openness, closeness]
  59.     WINDOW_ANIMATE = [15, 15]
  60.    
  61.     # Name box options.
  62.     # NAME = [font, size, color, bold, shadow]
  63.     NAME = [["Verdana", "Anklada�"], 14, Color.new(255,225,235,225), true, true]
  64.    
  65.     # Set the sound for when the characters are processing.
  66.     # The sound effect will be played each time the occurence is met.
  67.     # From the default it will happen every odd processed character.
  68.     # Can be set to nil to disable.
  69.     # SE = [occurence, name, vol, pitch]
  70.     SE = [2, "Decision1", 60, 150]
  71.    
  72.     # Set the animation options for face window.
  73.     # For type only :fade exists at the moment.
  74.     # ANIM_FACE = [enabled, type, animation_speed_in, animation_speed_out]
  75.     ANIM_FACE = [true, :fade, 12, 8]
  76.    
  77.     # Set the animation options for name window.
  78.     # For type only :fade exists at the moment.
  79.     # ANIM_NAME = [animation_speed_in, animation_speed_out]
  80.     ANIM_NAME = [true, :fade, 12, 8]
  81.    
  82.   end
  83. end
  84. # *** Don't edit below unless you know what you are doing. ***
  85. #==============================================================================#
  86. # ** Error Handler
  87. #==============================================================================#
  88.   unless $imported["XAIL-XS-CORE"]
  89.     # // Error handler when XS - Core is not installed.
  90.     msg = "The script %s requires the latest version of XS - Core in order to function properly."
  91.     name = "XS - Message"
  92.     msgbox(sprintf(msg, name))
  93.     exit
  94.   end
  95. #==============================================================================#
  96. # ** Window_Base
  97. #==============================================================================#
  98. class Window_Base < Window
  99.   
  100.   alias xail_msg_winbase_upd_open update_open
  101.   def update_open(*args, &block)
  102.     # // Method to update openness
  103.     # This should only occur when $game_message is visible.
  104.     if $game_message.visible
  105.       self.openness += XAIL::MSG::WINDOW_ANIMATE[0]
  106.       self.opacity = self.openness unless self.opacity == 0
  107.       self.back_opacity = self.openness unless self.opacity == 0
  108.       @opening = false if open?
  109.     else
  110.       xail_msg_winbase_upd_open(*args, &block)
  111.     end
  112.   end

  113.   alias xail_msg_winbase_upd_close update_close
  114.   def update_close(*args, &block)
  115.     # // Method override to update closeness.
  116.     # This should only occur when $game_message is visible.
  117.     if $game_message.visible
  118.       self.openness -= XAIL::MSG::WINDOW_ANIMATE[1]
  119.       self.opacity = self.openness unless self.opacity == 0
  120.       self.back_opacity = self.openness unless self.opacity == 0
  121.       @closing = false if close?
  122.     else
  123.       xail_msg_winbase_upd_close(*args, &block)
  124.     end
  125.   end
  126.   
  127. end
  128. #==============================================================================#
  129. # ** Window_Message_Face
  130. #==============================================================================#
  131. class Window_Message_Face < Window_Base
  132.   
  133.   def initialize(x, y, width, height)
  134.     # // Method to initialize.
  135.     super(x, y, width, height)
  136.     skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
  137.     self.windowskin = Cache.system(skin)
  138.     refresh
  139.   end
  140.   
  141.   def refresh
  142.     # // Method to refresh.
  143.     contents.clear
  144.     r = Rect.new(0, 0, width, height)
  145.     r2 = Rect.new(2, 2, width-28, height-28)
  146.     contents.fill_rect(r, Color.new(75,125,135,245))
  147.     contents.gradient_fill_rect(r2, Color.new(125,125,125,255), Color.new(0,0,0,255), false)
  148.     draw_face($game_message.face_name, $game_message.face_index, 4, 4)
  149.   end
  150.   
  151. end
  152. #==============================================================================#
  153. # ** Window_Message_Name
  154. #==============================================================================#
  155. class Window_Message_Name < Window_Base
  156.   
  157.   def initialize(name, x, y, width, height)
  158.     # // Method to initialize.
  159.     super(x, y, width, height)
  160.     skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
  161.     self.windowskin = Cache.system(skin)
  162.     @name = name
  163.     refresh
  164.   end
  165.   
  166.   def standard_padding
  167.     # // Method to set standard padding
  168.     return 4
  169.   end
  170.   
  171.   def name=(name)
  172.     # // Method to refresh and set name.
  173.     return if @name == name
  174.     @name = name
  175.     refresh
  176.   end
  177.   
  178.   def refresh
  179.     # // Method to refresh.
  180.     contents.clear
  181.     draw_font_text(@name, 0, 0, contents_width, 1, XAIL::MSG::NAME[0], XAIL::MSG::NAME[1], XAIL::MSG::NAME[2])
  182.   end
  183.   
  184. end
  185. #==============================================================================#
  186. # ** Window_Message
  187. #==============================================================================#
  188. class Window_Message < Window_Base
  189.   
  190.   def initialize
  191.     # // Method override initialize for window message.
  192.     super(0, 0, window_width, window_height)
  193.     self.z = 200
  194.     self.openness = 0
  195.     create_all_windows
  196.     create_back_bitmap
  197.     create_back_sprite
  198.     clear_instance_variables
  199.     set_window_skins
  200.   end
  201.   
  202.   def set_window_skins
  203.     # // Method to set window skins.
  204.     @gold_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
  205.     @choice_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
  206.     @number_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
  207.     @item_window.windowskin = Cache.system(get_var(XAIL::MSG::WINDOW_VAR[13], :skin))
  208.   end
  209.   
  210. #~   alias xail_msg_winmsg_create_all_windows create_all_windows
  211. #~   def create_all_windows(*args, &block)
  212. #~     # // Method to create all windows.
  213. #~     xail_msg_winmsg_create_all_windows(*args, &block)
  214. #~     @choice_window = Window_ChoiceList.new(self)
  215. #~     @number_window = Window_NumberInput.new(self)
  216. #~     @item_window = Window_KeyItem.new(self)
  217. #~     @choice_window.windowskin
  218. #~   end
  219.   
  220.   def window_width
  221.     # // Method override to return width.
  222.     get_var(XAIL::MSG::WINDOW_VAR[0], :width)
  223.   end

  224.   def window_height
  225.     # // Method override to return height.
  226.     fitting_height(get_var(XAIL::MSG::WINDOW_VAR[1], :height))
  227.   end
  228.   
  229.   def standard_padding
  230.     # // Method to return the padding.
  231.     get_var(XAIL::MSG::WINDOW_VAR[2], :padding)
  232.   end
  233.   
  234.   def window_x
  235.     # // Method to return x value of window.
  236.     get_var(XAIL::MSG::WINDOW_VAR[3], :win_x)
  237.   end
  238.   
  239.   def window_y
  240.     # // Method to return y value of window.
  241.     get_var(XAIL::MSG::WINDOW_VAR[4], :win_y)
  242.   end
  243.   
  244.   def get_var(var, type)
  245.     # // Method to return variable value if conditions met.
  246.     unless var.nil? or $game_variables[var] == 0
  247.       return $game_variables[var]
  248.     else
  249.       case type
  250.       when :width           ; return Graphics.width
  251.       when :height          ; return visible_line_number
  252.       when :padding         ; return 12
  253.       when :win_x           ; return 0
  254.       when :win_y           ; return 0
  255.       when :wait            ; return 0
  256.       when :font_name       ; return Font.default_name
  257.       when :font_size       ; return Font.default_size
  258.       when :font_color      ; return Font.default_color
  259.       when :font_out_color  ; return Font.default_out_color
  260.       when :font_bold       ; return Font.default_bold
  261.       when :font_shadow     ; return Font.default_shadow
  262.       when :name            ; return ""
  263.       when :skin            ; return "Window"
  264.       end
  265.     end
  266.   end
  267.   
  268.   alias xail_msg_winmsg_upd_placement update_placement
  269.   def update_placement(*args, &block)
  270.     # // Method to update placement.
  271.     xail_msg_winmsg_upd_placement(*args, &block)
  272.     self.width = window_width
  273.     self.height = window_height
  274.     self.x = window_x
  275.     self.y = window_y
  276.     create_contents
  277.   end
  278.   
  279.   def fiber_main
  280.     # // Method override for fiber main.
  281.     $game_message.visible = true
  282.     update_background
  283.     update_placement
  284.     loop do
  285.       process_all_text if $game_message.has_text?
  286.       process_input
  287.       $game_message.clear
  288.       @gold_window.close
  289.       dispose_face
  290.       dispose_name
  291.       Fiber.yield
  292.       break unless text_continue?
  293.     end
  294.     close_and_wait
  295.     $game_message.visible = false
  296.     @fiber = nil
  297.   end
  298.   
  299.   def draw_message_face
  300.     # //  Method to draw face window.
  301.     unless $game_message.face_name.empty?
  302.       x = window_x - 44
  303.       @face_window = Window_Message_Face.new(x, window_y, 128, 128)
  304.       @face_window.z = 201
  305.       @face_window.opacity = 0
  306.       if XAIL::MSG::ANIM_FACE[0]
  307.         case XAIL::MSG::ANIM_FACE[1]
  308.         when :fade
  309.           @face_window.contents_opacity = 0
  310.           fade(XAIL::MSG::ANIM_FACE[2], @face_window, :in)
  311.         end
  312.       end
  313.     end
  314.   end
  315.   
  316.   def draw_message_name
  317.     # // Method to draw name window.
  318.     name = get_var(XAIL::MSG::WINDOW_VAR[12], :name)
  319.     unless name == ""
  320.       w = text_size(name).width + 24
  321.       x = window_x + 16
  322.       @name_window = Window_Message_Name.new(name, x, window_y - 31, w, 34)
  323.       @name_window.z = 199
  324.       if XAIL::MSG::ANIM_NAME[0]
  325.         case XAIL::MSG::ANIM_NAME[1]
  326.         when :fade
  327.           @name_window.opacity = @name_window.contents_opacity = 0
  328.           fade(XAIL::MSG::ANIM_NAME[2], @name_window, :in, true, true)
  329.         end
  330.       end
  331.     end
  332.   end
  333.   
  334.   alias xail_msg_winmsg_process_normal_character process_normal_character
  335.   def process_normal_character(c, pos)
  336.     # // Method to set a wait time for each processed character.
  337.     # This will also play a SE based on if the pos is a odd number.
  338.     xail_msg_winmsg_process_normal_character(c, pos)
  339.     wait(get_var(XAIL::MSG::WINDOW_VAR[5], :wait))
  340.     if (pos[:x] % XAIL::MSG::SE[0] > 0)
  341.       Sound.play(XAIL::MSG::SE[1], XAIL::MSG::SE[2], XAIL::MSG::SE[3]) unless XAIL::MSG::SE.nil?
  342.     end
  343.   end
  344.   
  345.   alias xail_msg_winmsg_open_and_wait open_and_wait
  346.   def open_and_wait(*args, &block)
  347.     # // Method for open and wait.
  348.     xail_msg_winmsg_open_and_wait(*args, &block)
  349.     draw_message_face ; draw_message_name
  350.   end
  351.   
  352.   def new_page(text, pos)
  353.     # // Method override for new page.
  354.     contents.clear
  355.     contents.font.name = get_var(XAIL::MSG::WINDOW_VAR[6], :font_name)
  356.     contents.font.size = get_var(XAIL::MSG::WINDOW_VAR[7], :font_size)
  357.     contents.font.color = get_var(XAIL::MSG::WINDOW_VAR[8], :font_color)
  358.     contents.font.out_color = get_var(XAIL::MSG::WINDOW_VAR[9], :font_out_color)
  359.     contents.font.bold = eval(get_var(XAIL::MSG::WINDOW_VAR[10], :font_bold)) unless $game_variables[XAIL::MSG::WINDOW_VAR[10]] == 0
  360.     contents.font.shadow = eval(get_var(XAIL::MSG::WINDOW_VAR[11], :font_shadow)) unless $game_variables[XAIL::MSG::WINDOW_VAR[11]] == 0
  361.     pos[:x] = new_line_x
  362.     pos[:y] = 0
  363.     pos[:new_x] = new_line_x
  364.     pos[:height] = calc_line_height(text)
  365.     clear_flags
  366.   end
  367.   
  368.   def new_line_x
  369.     # // Method for new line x pos.
  370.     $game_message.face_name.empty? ? 0 : @face_window.width / 2 + 4
  371.   end
  372.   
  373.   def input_choice
  374.     # // Method to start the input choice.
  375.     @choice_window.start
  376.     skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
  377.     @choice_window.windowskin = Cache.system(skin)
  378.     @choice_window.opacity = 255
  379.     Fiber.yield while @choice_window.active
  380.   end

  381.   def input_number
  382.     # // Method to start the input number.
  383.     @number_window.start
  384.     skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
  385.     @number_window.windowskin = Cache.system(skin)
  386.     @number_window.opacity = 255
  387.     Fiber.yield while @number_window.active
  388.   end
  389.   
  390.   def fade(max, window, type, con_op = true, op = false)
  391.     # // Method to fade in/out the windows opacity and/or contents_opacity.
  392.     return if window.is_a?(Array)
  393.     case type
  394.     when :in
  395.       for i in 1..max
  396.         Graphics.update
  397.         window.contents_opacity = i * (255 / max) if con_op
  398.         window.opacity = i * (255 / max) if op
  399.       end
  400.     when :out
  401.       for i in 1..max
  402.         Graphics.update
  403.         window.contents_opacity = 255 - i * (255 / max) if con_op
  404.         window.opacity = 255 - i * (255 / max) if op
  405.       end
  406.     end
  407.   end
  408.   
  409.   def dispose_face
  410.     # // Method to dispose face window.
  411.     unless @face_window.nil? or @face_window.is_a?(Array)
  412.       if XAIL::MSG::ANIM_FACE[0]
  413.         case XAIL::MSG::ANIM_FACE[1]
  414.         when :fade
  415.           fade(XAIL::MSG::ANIM_FACE[3], @face_window, :out)
  416.         end
  417.       end
  418.       @face_window = nil, @face_window.dispose
  419.     end
  420.   end
  421.   
  422.   def dispose_name
  423.     # // Method to dispose name window.
  424.     unless @name_window.nil? or @name_window.is_a?(Array)
  425.       if XAIL::MSG::ANIM_NAME[0]
  426.         case XAIL::MSG::ANIM_NAME[1]
  427.         when :fade
  428.           fade(XAIL::MSG::ANIM_NAME[3], @name_window, :out)
  429.         end
  430.       end
  431.       @name_window = nil, @name_window.dispose
  432.     end
  433.   end
  434.   
  435. end
  436. #==============================================================================#
  437. # ** Scene_Map
  438. #==============================================================================#
  439. class Scene_Map < Scene_Base

  440.   def set_message_skin
  441.     # // Method to set message window skin.
  442.     skin = $game_variables[XAIL::MSG::WINDOW_VAR[13]] == 0 ? "Window" : $game_variables[XAIL::MSG::WINDOW_VAR[13]]
  443.     @message_window.windowskin = Cache.system(skin)
  444.   end

  445. end # END OF FILE

  446. #=*==========================================================================*=#
  447. # ** END OF FILE
  448. #=*==========================================================================*=#
复制代码
所需BASE
RUBY 代码复制
  1. #==============================================================================
  2. #   XaiL System - Core
  3. #   Author: Nicke
  4. #   Created: 07/01/2012
  5. #   Edited: 08/10/2013
  6. #   Version: 2.1f
  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. # Core script for XaiL System.
  14. # Caution! This needs to be located before any other XS scripts.
  15. #
  16. # *** Only for RPG Maker VX Ace. ***
  17. #==============================================================================
  18. ($imported ||= {})["XAIL-XS-CORE"] = true
  19.  
  20. module Colors
  21.   #--------------------------------------------------------------------------#
  22.   # * Colors
  23.   #--------------------------------------------------------------------------#
  24.   White = Color.new(255,255,255)
  25.   LightRed = Color.new(255,150,150)
  26.   LightGreen = Color.new(150,255,150)
  27.   LightBlue = Color.new(150,150,255)
  28.   DarkYellow = Color.new(225,225,20)
  29.   Alpha = Color.new(0,0,0,128)
  30.   AlphaMenu = 100
  31. end
  32. module XAIL
  33.   module CORE
  34.   #--------------------------------------------------------------------------#
  35.   # * Settings
  36.   #--------------------------------------------------------------------------#
  37.   # Graphics.resize_screen(width, height )
  38.   Graphics.resize_screen(544,416)
  39.  
  40.   # FONT DEFAULTS:
  41.   Font.default_name = ["VL Gothic"]
  42.   Font.default_size = 20
  43.   Font.default_bold = false
  44.   Font.default_italic = false
  45.   Font.default_shadow = true
  46.   Font.default_outline = true
  47.   Font.default_color = Colors::White
  48.   Font.default_out_color = Colors::Alpha
  49.  
  50.   # USE_TONE = true/false:
  51.   # Window tone for all windows ingame. Default: true.
  52.   USE_TONE = false
  53.  
  54.   # SAVE
  55.   SAVE_MAX = 20       # Default 16.
  56.   SAVE_FILE_VIS = 4   # Default 4.
  57.  
  58.   # JAPANESE = true/false
  59.   JAPANESE = false
  60.  
  61.   end
  62. end
  63. # *** Don't edit below unless you know what you are doing. ***
  64. #==============================================================================#
  65. # ** Game_System
  66. #==============================================================================#
  67. class Game_System
  68.  
  69.   # // Method to determine japanese game.
  70.   def japanese? ; return XAIL::CORE::JAPANESE ; end
  71.  
  72. end
  73. #==============================================================================#
  74. # ** String
  75. #==============================================================================#
  76. class String
  77.  
  78.   def to_class(parent = Kernel)
  79.     # // Method to convert string to class.
  80.     chain = self.split "::"
  81.     klass = parent.const_get chain.shift
  82.     return chain.size < 1 ? (klass.is_a?(Class) ? klass : nil) : chain.join("::").to_class(klass)
  83.     rescue
  84.     nil
  85.   end
  86.  
  87.   def cap_words
  88.     # // Method to capitalize every word.
  89.     self.split(' ').map {|w| w.capitalize }.join(' ')
  90.   end
  91.  
  92.   def slice_char(char)
  93.     # // Method to slice char.
  94.     self.split(char).map {|w| w.sub(char, " ") }.join(" ")
  95.   end
  96.  
  97. end
  98. #==============================================================================#
  99. # ** Vocab
  100. #==============================================================================#
  101. class << Vocab
  102.  
  103.   def xparam(id)
  104.     # // Method to return xparam name.
  105.     case id
  106.     when 0 ; "Hit Chance"
  107.     when 1 ; "Evasion"
  108.     when 2 ; "Critical Chance"
  109.     when 3 ; "Critical Evasion"
  110.     when 4 ; "Magic Evasion"
  111.     when 5 ; "Magic Reflection"
  112.     when 6 ; "Counter Attack"
  113.     when 7 ; "HP Regeneration"
  114.     when 8 ; "MP Regeneration"
  115.     when 9 ; "TP Regeneration"
  116.     end
  117.   end
  118.  
  119. end
  120. #==============================================================================
  121. # ** Sound
  122. #==============================================================================
  123. class << Sound
  124.  
  125.   def play(name, volume, pitch, type = :se)
  126.     # // Method to play a sound. If specified name isn't valid throw an error.
  127.     case type
  128.     when :se   ; RPG::SE.new(name, volume, pitch).play rescue valid?(name)
  129.     when :me   ; RPG::ME.new(name, volume, pitch).play rescue valid?(name)
  130.     when :bgm  ; RPG::BGM.new(name, volume, pitch).play rescue valid?(name)
  131.     when :bgs  ; RPG::BGS.new(name, volume, pitch).play rescue valid?(name)
  132.     end
  133.   end
  134.  
  135.   def valid?(name)
  136.     # // Method to raise error if specified sound name is invalid.
  137.     msgbox("Error. Unable to find sound file: " + name)
  138.     exit
  139.   end
  140.  
  141. end
  142. #==============================================================================
  143. # ** DataManager
  144. #==============================================================================
  145. class << DataManager
  146.  
  147.   def savefile_max
  148.     # // Method override, save file max.
  149.     return XAIL::CORE::SAVE_MAX
  150.   end
  151.  
  152. end
  153. #==============================================================================
  154. # ** SceneManager
  155. #==============================================================================
  156. class << SceneManager
  157.  
  158.   def call_ext(scene_class, args = nil)
  159.     # // Method to call a scene with arguments.
  160.     @stack.push(@scene)
  161.     @scene = scene_class.new(args)
  162.   end
  163.  
  164. end
  165. #==============================================================================
  166. # ** Scene_File
  167. #==============================================================================
  168. class Scene_File < Scene_MenuBase
  169.  
  170.   def visible_max
  171.     # // Method override, visible_max for save files.
  172.     return XAIL::CORE::SAVE_FILE_VIS
  173.   end
  174.  
  175. end
  176. #==============================================================================
  177. # ** Window_Base
  178. #------------------------------------------------------------------------------
  179. # Importing font fix that will remove weird characters.
  180. # Adding new methods such as new gauge, actor param, font text, icon drawing,
  181. # big icon drawing and a line with a shadow.
  182. #==============================================================================
  183. class Window_Base < Window
  184.  
  185.   # // Importing Custom font fix. (Credit Lone Wolf).
  186.   alias :process_normal_character_vxa :process_normal_character
  187.   def process_normal_character(c, pos)
  188.     return unless c >= ' '
  189.     process_normal_character_vxa(c, pos)
  190.   end unless method_defined? :process_normal_character
  191.  
  192.   def draw_text_ex_no_reset(x, y, text)
  193.     # // Method to draw ex text without resetting the font.
  194.     text = convert_escape_characters(text)
  195.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  196.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  197.   end
  198.  
  199.   alias xail_core_winbase_upt_tone update_tone
  200.   def update_tone(*args, &block)
  201.     # // Method to change tone of the window.
  202.     return unless XAIL::CORE::USE_TONE
  203.     xail_core_winbase_upt_tone(*args, &block)
  204.   end
  205.  
  206.   def draw_gauge_ex(x, y, width, height, rate, color1, color2)
  207.     # // Method to draw a gauge.
  208.     fill_w = (width * rate).to_i
  209.     gauge_y = y + line_height - 8
  210.     contents.fill_rect(x, gauge_y, width + 1, height + 1, Color.new(255,255,255,64))
  211.     contents.fill_rect(x, gauge_y, width, height, Color.new(0,0,0,100))
  212.     contents.gradient_fill_rect(x, gauge_y, fill_w, height, color1, color2)
  213.   end
  214.  
  215.   def draw_actor_param_gauge(actor, x, y, width, param_id, font, size, bar_color1, bar_color2, txt_color1, txt_color2)
  216.     # // Method to draw actor parameters with a gauge.
  217.     case param_id
  218.     when 2 ; param_rate = actor.param(2) / actor.param_max(2).to_f
  219.     when 3 ; param_rate = actor.param(3) / actor.param_max(3).to_f
  220.     when 4 ; param_rate = actor.param(4) / actor.param_max(4).to_f
  221.     when 5 ; param_rate = actor.param(5) / actor.param_max(5).to_f
  222.     when 6 ; param_rate = actor.param(6) / actor.param_max(6).to_f
  223.     when 7 ; param_rate = actor.param(7) / actor.param_max(7).to_f
  224.     end
  225.     contents.font.name = font
  226.     contents.font.size = size
  227.     contents.font.bold = true
  228.     contents.font.shadow = false
  229.     draw_gauge_ex(x, y - 14, width, 20, param_rate, bar_color1, bar_color2)
  230.     contents.font.color = txt_color1
  231.     draw_text(x + 10, y, 120, line_height, Vocab::param(param_id))
  232.     contents.font.color = txt_color2
  233.     draw_text(x + width - 38, y, 36, line_height, actor.param(param_id), 2)
  234.     reset_font_settings
  235.   end
  236.  
  237.   def draw_actor_xparam_gauge(actor, x, y, width, xparam_id, font, size, bar_color1, bar_color2, txt_color1, txt_color2)
  238.     # // Method to draw actor xparameters with a gauge.
  239.     case xparam_id
  240.     when 0
  241.       xparam_rate = actor.xparam(0) / 100.to_f
  242.       xparam_name = Vocab.xparam(0)
  243.     when 1
  244.       xparam_rate = actor.xparam(1) / 100.to_f
  245.       xparam_name = Vocab.xparam(1)
  246.     when 2
  247.       xparam_rate = actor.xparam(2) / 100.to_f
  248.       xparam_name = Vocab.xparam(2)
  249.     when 3
  250.       xparam_rate = actor.xparam(3) / 100.to_f
  251.       xparam_name = Vocab.xparam(3)
  252.     when 4
  253.       xparam_rate = actor.xparam(4) / 100.to_f
  254.       xparam_name = Vocab.xparam(4)
  255.     when 5
  256.       xparam_rate = actor.xparam(5) / 100.to_f
  257.       xparam_name = Vocab.xparam(5)
  258.     when 6
  259.       xparam_rate = actor.xparam(6) / 100.to_f
  260.       xparam_name = Vocab.xparam(6)
  261.     when 7
  262.       xparam_rate = actor.xparam(7) / 100.to_f
  263.       xparam_name = Vocab.xparam(7)
  264.     when 8
  265.       xparam_rate = actor.xparam(8) / 100.to_f
  266.       xparam_name = Vocab.xparam(8)
  267.     when 9
  268.       xparam_rate = actor.xparam(9) / 100.to_f
  269.       xparam_name = Vocab.xparam(9)
  270.     end
  271.     contents.font.name = font
  272.     contents.font.size = size
  273.     contents.font.bold = true
  274.     contents.font.shadow = false
  275.     draw_gauge_ex(x, y - 14, width, 20, xparam_rate, bar_color1, bar_color2)
  276.     contents.font.color = txt_color1
  277.     draw_text(x + 10, y, 120, line_height, xparam_name)
  278.     contents.font.color = txt_color2
  279.     draw_text(x + width - 38, y, 36, line_height, "#{actor.xparam(xparam_id)}%", 2)
  280.     reset_font_settings
  281.   end
  282.  
  283.   def draw_line_ex(x, y, color, shadow)
  284.     # // Method to draw a horizontal line with a shadow.
  285.     line_y = y + line_height / 2 - 1
  286.     contents.fill_rect(x, line_y, contents_width, 2, color)
  287.     line_y += 1
  288.     contents.fill_rect(x, line_y, contents_width, 2, shadow)
  289.   end
  290.  
  291.   def draw_box(x, y, width, height, color, shadow)
  292.     # // Method to draw a box with shadow.
  293.     contents.fill_rect(x, y, width, height, color)
  294.     x += 1
  295.     y += 1
  296.     contents.fill_rect(x, y, width, height, shadow)
  297.   end
  298.  
  299.   def draw_vertical_line_ex(x, y, color, shadow)
  300.     # // Method to draw a vertical line with a shadow.
  301.     line_x = x + line_height / 2 - 1
  302.     contents.fill_rect(line_x, y, 2, contents_height, color)
  303.     line_x += 1
  304.     contents.fill_rect(line_x, y, 2, contents_height, shadow)
  305.   end
  306.  
  307.   def draw_icons(icons, alignment, x = 0, y = 0, offset_icon = [])
  308.     # // Method to draw icons in a horizonal or vertical alignment.
  309.     icons.each {|icon|
  310.       next if icon.nil?
  311.       # // If included in offset do extra spacing.
  312.       offset_icon.each {|offset|
  313.         if icon == offset
  314.           y += line_height * 1 if alignment == :vertical
  315.           x += line_height * 1 if alignment == :horizontal
  316.         end
  317.       }
  318.       draw_icon(icon.nil? ? nil : icon, x.nil? ? 0 : x, y.nil? ? 0 : y) rescue nil
  319.       y += line_height if alignment == :vertical
  320.       x += line_height if alignment == :horizontal
  321.     }
  322.   end
  323.  
  324.   def draw_big_icon(icon, x, y, width, height, opacity = 255)
  325.     # // Method to draw a big icon.
  326.     bitmap = Cache.system("Iconset")
  327.     rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
  328.     rect2 = Rect.new(x, y, width, height)
  329.     contents.stretch_blt(rect2, bitmap, rect, opacity)
  330.   end
  331.  
  332.   def draw_font_text(text, x, y, width, alignment, font, size, color, bold = true, shadow = true)
  333.     # // Method to draw font text.
  334.     contents.font.name = font
  335.     contents.font.size = size
  336.     contents.font.color = color
  337.     contents.font.bold = bold
  338.     contents.font.shadow = shadow
  339.     contents.font.out_color = Color.new(0,0,0,255)
  340.     draw_text(x, y, width, calc_line_height(text), text, alignment)
  341.     reset_font_settings
  342.   end
  343.  
  344.   def draw_font_text_ex(text, x, y, font, size, color, bold = true, shadow = true)
  345.     # // Method to draw font text ex.
  346.     contents.font.name = font
  347.     contents.font.size = size
  348.     contents.font.color = color
  349.     contents.font.bold = bold
  350.     contents.font.shadow = shadow
  351.     contents.font.out_color = Color.new(0,0,0,255)
  352.     text = convert_escape_characters(text)
  353.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  354.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  355.     reset_font_settings
  356.   end
  357.  
  358. end
  359. #==============================================================================#
  360. # ** Window_Selectable
  361. #------------------------------------------------------------------------------
  362. #  Adding support for pageleft and pageright for window selectable.
  363. #==============================================================================#
  364. class Window_Selectable < Window_Base
  365.  
  366.   def cursor_pageright ; end
  367.   def cursor_pageleft ; end
  368.  
  369.   alias xail_core_winselect_process_cursor_move process_cursor_move
  370.   def process_cursor_move(*args, &block)
  371.     # // Method to process cursor movement.
  372.     xail_core_winselect_process_cursor_move(*args, &block)
  373.     cursor_pageright if !handle?(:pageright) && Input.trigger?(:RIGHT)
  374.     cursor_pageright if !handle?(:pageleft) && Input.trigger?(:LEFT)
  375.   end
  376.  
  377.   alias xail_core_winselect_process_handling process_handling
  378.   def process_handling(*args, &block)
  379.     # // Method to process handling.
  380.     xail_core_winselect_process_handling(*args, &block)
  381.     return process_pageright if handle?(:pageright) && Input.trigger?(:RIGHT)
  382.     return process_pageleft if handle?(:pageleft) && Input.trigger?(:LEFT)
  383.   end
  384.  
  385.   def process_pageright
  386.     # // Method to process page right.
  387.     Sound.play_cursor
  388.     Input.update
  389.     deactivate
  390.     call_handler(:pageright)
  391.   end
  392.  
  393.   def process_pageleft
  394.     # // Method to process page left.
  395.     Sound.play_cursor
  396.     Input.update
  397.     deactivate
  398.     call_handler(:pageleft)
  399.   end
  400.  
  401. end
  402. #==============================================================================#
  403. # ** Window_Icon
  404. #------------------------------------------------------------------------------
  405. #  New Window :: Window_Icon - A window for drawing icon(s).
  406. #==============================================================================#
  407. class Window_Icon < Window_Base
  408.  
  409.   attr_accessor :enabled
  410.   attr_accessor :alignment
  411.  
  412.   def initialize(x, y, window_width, hsize)
  413.     # // Method to initialize the icon window.
  414.     super(0, 0, window_width, window_height(hsize))
  415.     @icons = []
  416.     @index = 0
  417.     @enabled = true
  418.     @alignment = 0
  419.     refresh
  420.   end
  421.  
  422.   def window_height(hsize)
  423.     # // Method to return the height.
  424.     fitting_height(hsize)
  425.   end
  426.  
  427.   def refresh
  428.     # // Method to refresh the icon window.
  429.     contents.clear
  430.   end
  431.  
  432.   def draw_cmd_icons(icons, index)
  433.     # // Draw all of the icons.
  434.     return if !@enabled
  435.     count = 0
  436.     for i in icons
  437.       align = 0
  438.       x = 110
  439.       next if i[index].nil?
  440.       case @alignment
  441.       when 1, 2 ; align = -110
  442.       end
  443.       draw_icon(i[index], x + align, 24 * count)
  444.       count += 1
  445.       break if (24 * count > height - 24)
  446.     end
  447.   end
  448.  
  449. end
  450. #==============================================================================
  451. # ** Game_Party
  452. #------------------------------------------------------------------------------
  453. # Adding check item method to return a item based on the type.
  454. #==============================================================================
  455. class Game_Party < Game_Unit
  456.  
  457.   def check_item?(item, type)
  458.     # // Method to return a item based on the type.
  459.     case type
  460.     when :items    ; $data_items[item]
  461.     when :weapons  ; $data_weapons[item]
  462.     when :armors   ; $data_armors[item]
  463.     when :gold     ; item
  464.     when :exp      ; item
  465.     end
  466.   end
  467.  
  468. end
  469. #==============================================================================
  470. # ** Game_Event
  471. #------------------------------------------------------------------------------
  472. # Adding methods to check for comments on events.
  473. #==============================================================================
  474. class Game_Event < Game_Character
  475.  
  476.   def comment?(comment)
  477.     # // Method to check if comment is included in event.
  478.     unless empty? or @list.nil?
  479.       for evt in @list
  480.         if evt.code == 108 or evt.code == 408
  481.           if evt.parameters[0].include?(comment)
  482.             return true
  483.           end
  484.         end
  485.       end
  486.     end
  487.     return false
  488.   end
  489.  
  490.   def comment_int?(comment)
  491.     # // Method to check for a integer in event.
  492.     unless empty? or @list.nil?
  493.       for evt in @list
  494.         if evt.code == 108 or evt.code == 408
  495.           if evt.parameters[0] =~ /<#{comment}:[ ]?(\d*)>?/
  496.             return ($1.to_i > 0 ? $1.to_i : 0)
  497.           end
  498.         end
  499.       end
  500.     end
  501.   end
  502.  
  503.   def comment_string?(comment)
  504.     # // Method to check for a string in event.
  505.     unless empty? or @list.nil?
  506.       for evt in @list
  507.         if evt.code == 108 or evt.code == 408
  508.           if evt.parameters[0] =~ /<#{comment}:[ ]?(\w*)>?/
  509.             return $1.to_s
  510.           end
  511.         end
  512.       end
  513.     end
  514.   end
  515.  
  516.  
  517. end # END OF FILE
  518.  
  519. #=*==========================================================================*=#
  520. # ** END OF FILE
  521. #=*==========================================================================*=#
david_ng223 该用户已被删除
2
发表于 2015-2-12 15:26:33 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-15 23:36

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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