| 
 
| 赞 | 1 |  
| VIP | 0 |  
| 好人卡 | 3 |  
| 积分 | 0 |  
| 经验 | 6939 |  
| 最后登录 | 2015-12-25 |  
| 在线时间 | 47 小时 |  
 Lv1.梦旅人 
	梦石0 星屑45 在线时间47 小时注册时间2009-6-1帖子127 | 
| 
本帖最后由 WildDagger 于 2012-2-19 00:56 编辑
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  
 說穿了這個是拿很多WINDOW_BASE內建的涵式改出來的
 能夠在按ESC進入選單的時候看到EXP條。
 
 
 #===================================#  ●設定區域#=================================== module WDmodule Exp_Gauge  #EXP條COLOR,請修改成TEXT文字  EXP_GAUGE_COLOR1 = 6  EXP_GAUGE_COLOR2 = 14   #EXP條文字顯示設定,true為打開,false為關閉  EXP_TEXT_DISPLAY = falseendend #==============================================================================# ■ Window_Base#------------------------------------------------------------------------------#  ゲーム中の全てのウィンドウのスーパークラスです。#============================================================================== class Window_Base < Window  include WD::Exp_Gauge   def exp_gauge_color1;   text_color(EXP_GAUGE_COLOR1);  end;    # EXP ゲージ 1  def exp_gauge_color2;   text_color(EXP_GAUGE_COLOR2);  end;    # EXP ゲージ 2   #--------------------------------------------------------------------------  # ● シンプルなステータスの描画  #--------------------------------------------------------------------------  def draw_actor_simple_status(actor, x, y)    draw_actor_name(actor, x, y + line_height * 0.5)    draw_actor_level(actor, x, y - line_height * 0.5)    draw_actor_icons(actor, x, y + line_height * 1.5)    draw_actor_class(actor, x + 120, y - line_height * 0.5)    draw_actor_hp(actor, x + 120, y + line_height * 0.5)    draw_actor_mp(actor, x + 120, y + line_height * 1.5)    draw_actor_exp(actor, x, y + line_height * 2.5, EXP_TEXT_DISPLAY)  end  #--------------------------------------------------------------------------  # ● EXP の描画  #--------------------------------------------------------------------------  def draw_actor_exp(actor, x, y, display = true, width = 244)    this_level = actor.exp - actor.past_level_exp    next_level = actor.next_level_exp - actor.past_level_exp    draw_gauge(x, y, width, actor.exp_rate, exp_gauge_color1, exp_gauge_color2)    change_color(system_color)    if display      draw_text(x, y, 30, line_height, "EXP")      draw_current_and_max_values(x, y, width, this_level, next_level, mp_color(actor), normal_color)    end  endend class Game_Actor < Game_Battler  #--------------------------------------------------------------------------  # ● EXP の割合を取得  #--------------------------------------------------------------------------  def exp_rate    this_level = exp - past_level_exp    next_level = next_level_exp - past_level_exp    next_level > 0 ? this_level.to_f / next_level : 0  end  #--------------------------------------------------------------------------  # ● 前のレベルの経験値を取得  #--------------------------------------------------------------------------  def past_level_exp    @level > 1 ? exp_for_level(@level - 1) : 0  endend
#=================================== 
#  ●設定區域 
#=================================== 
  
module WD 
module Exp_Gauge 
  #EXP條COLOR,請修改成TEXT文字 
  EXP_GAUGE_COLOR1 = 6 
  EXP_GAUGE_COLOR2 = 14 
  
  #EXP條文字顯示設定,true為打開,false為關閉 
  EXP_TEXT_DISPLAY = false 
end 
end 
  
#============================================================================== 
# ■ Window_Base 
#------------------------------------------------------------------------------ 
#  ゲーム中の全てのウィンドウのスーパークラスです。 
#============================================================================== 
  
class Window_Base < Window 
  include WD::Exp_Gauge 
  
  def exp_gauge_color1;   text_color(EXP_GAUGE_COLOR1);  end;    # EXP ゲージ 1 
  def exp_gauge_color2;   text_color(EXP_GAUGE_COLOR2);  end;    # EXP ゲージ 2 
  
  #-------------------------------------------------------------------------- 
  # ● シンプルなステータスの描画 
  #-------------------------------------------------------------------------- 
  def draw_actor_simple_status(actor, x, y) 
    draw_actor_name(actor, x, y + line_height * 0.5) 
    draw_actor_level(actor, x, y - line_height * 0.5) 
    draw_actor_icons(actor, x, y + line_height * 1.5) 
    draw_actor_class(actor, x + 120, y - line_height * 0.5) 
    draw_actor_hp(actor, x + 120, y + line_height * 0.5) 
    draw_actor_mp(actor, x + 120, y + line_height * 1.5) 
    draw_actor_exp(actor, x, y + line_height * 2.5, EXP_TEXT_DISPLAY) 
  end 
  #-------------------------------------------------------------------------- 
  # ● EXP の描画 
  #-------------------------------------------------------------------------- 
  def draw_actor_exp(actor, x, y, display = true, width = 244) 
    this_level = actor.exp - actor.past_level_exp 
    next_level = actor.next_level_exp - actor.past_level_exp 
    draw_gauge(x, y, width, actor.exp_rate, exp_gauge_color1, exp_gauge_color2) 
    change_color(system_color) 
    if display 
      draw_text(x, y, 30, line_height, "EXP") 
      draw_current_and_max_values(x, y, width, this_level, next_level, mp_color(actor), normal_color) 
    end 
  end 
end 
  
class Game_Actor < Game_Battler 
  #-------------------------------------------------------------------------- 
  # ● EXP の割合を取得 
  #-------------------------------------------------------------------------- 
  def exp_rate 
    this_level = exp - past_level_exp 
    next_level = next_level_exp - past_level_exp 
    next_level > 0 ? this_level.to_f / next_level : 0 
  end 
  #-------------------------------------------------------------------------- 
  # ● 前のレベルの経験値を取得 
  #-------------------------------------------------------------------------- 
  def past_level_exp 
    @level > 1 ? exp_for_level(@level - 1) : 0 
  end 
end 
 需要的話,EXP條也可以拿去其他地方用,就看大家是怎麼想的了。
 (玩過軒轅劍五後,會很想把技能、狀態與裝備全部合成在一個介面,所以正在朝能夠完全整合進一個「檢視」介面的方向研究中,應該會是從YEA的Equip腳本來改)
 
 執行圖:
 
   (旁邊有Load和System是因為我這個測試用專案裝了選單增加讀取檔案選項腳本與增加系統調整腳本。
 
 
 2012/2/19 追加:
 追加EXP_TEXT_DISPLAY選項,可以顯示EXP字串或者不顯示,單獨呼叫draw_actor_exp函式時亦可自行決定是否顯示EXP字串。
 | 
 |