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

Project1

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

[已经过期] 请大家帮改一下这个脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
99 小时
注册时间
2012-3-11
帖子
74
跳转到指定楼层
1
发表于 2012-8-2 16:21:58 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 公牛大冒险 于 2012-8-2 16:55 编辑

#==============================================================================
# ★ RGSS3_成就系统 Ver1.01
#==============================================================================
=begin

作者:tomoaky
素材来自:(http://hikimoki.sakura.ne.jp/)

你可以用事件中“脚本”命令获取成就
  例如)gain_medal(0)   # 获得第零个成就
  设置对应的编号再设置主要内容


2012.01.25  Ver1.01
  修正改变场景时重置成就
  
2012.01.16  Ver1.0
  公開

=end

#==============================================================================
# □ 設定項目
#==============================================================================
module TMMEDAL
  COMMAND_MEDAL = "成就"     # 菜单命令名称
  
  # メダルが1枚もない状態でメダルコマンドを隠すかどうか(true で隠す)
  HIDE_COMMAND = false
  
  # メダル獲得時の効果音
  SE_GAIN_MEDAL = RPG::SE.new("魔兽世界-成就", 90, 0)
  
  # メダル名とアイコンIDと説明文の設定
  MEDAL_DATA = {}
  MEDAL_DATA[0] = ["", 187, ""]
  MEDAL_DATA[1] = ["10级!", 187, "等级提升到10。"]
end

#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :medals                   # 獲得済みメダル
  attr_reader   :new_medals               # 新規獲得メダル
  attr_accessor :medal_info_count         # メダル情報表示カウント
  attr_accessor :medal_info_opacity       # メダル情報表示不透明度
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias tmmedal_game_party_initialize initialize
  def initialize
    tmmedal_game_party_initialize
    @medals = []
    @new_medals = []
    @medal_info_count = 0
    @medal_info_opacity = 0
  end
  #--------------------------------------------------------------------------
  # ○ メダルの獲得
  #--------------------------------------------------------------------------
  def gain_medal(medal_id)
    return if @medals.any? {|medal| medal[0] == medal_id }
    t = Time.now.strftime(" (%Y/%m/%d %H:%M)")
    @medals.push([medal_id, t])
    @new_medals.push([medal_id, t])
  end
  #--------------------------------------------------------------------------
  # ○ 獲得メダル情報の消去
  #--------------------------------------------------------------------------
  def delete_new_medal
    @new_medals.shift
  end
end

#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # ○ メダルの獲得
  #--------------------------------------------------------------------------
  def gain_medal(medal_id)
    $game_party.gain_medal(medal_id)
  end
end

#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand
  #--------------------------------------------------------------------------
  # ● 独自コマンドの追加用
  #--------------------------------------------------------------------------
  alias tmmedal_window_menucommand_add_original_commands add_original_commands
  def add_original_commands
    tmmedal_window_menucommand_add_original_commands
    unless TMMEDAL::HIDE_COMMAND && !medal_enabled
      add_command(TMMEDAL::COMMAND_MEDAL, :medal, medal_enabled)
    end
  end
  #--------------------------------------------------------------------------
  # ○ メダルの有効状態を取得
  #--------------------------------------------------------------------------
  def medal_enabled
    !$game_party.medals.empty?
  end
end

#==============================================================================
# □ Window_MedalInfo
#==============================================================================
class Window_MedalInfo < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(Graphics.width - window_width, 0, window_width, fitting_height(4))
    self.opacity = 0
    self.contents_opacity = $game_party.medal_info_opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ幅の取得
  #--------------------------------------------------------------------------
  def window_width
    return 480
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    if $game_party.medal_info_count > 0
      self.contents_opacity += 16
      $game_party.medal_info_count -= 1
      $game_party.delete_new_medal if $game_party.medal_info_count == 0
    else
      self.contents_opacity -= 16
      if self.contents_opacity == 0
        open unless $game_party.new_medals.empty?
      end
    end
    $game_party.medal_info_opacity = self.contents_opacity
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウを開く
  #--------------------------------------------------------------------------
  def open
    refresh
    TMMEDAL::SE_GAIN_MEDAL.play
    $game_party.medal_info_count = 150
    self.contents_opacity = 0
    self
  end
  #--------------------------------------------------------------------------
  # ○ リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    unless $game_party.new_medals.empty?
      draw_background(contents.rect)
      medal = TMMEDAL::MEDAL_DATA[$game_party.new_medals[0][0]]
      rect = contents.rect.clone
      draw_icon(medal[1], rect.x, rect.y)
      rect.x += 24
      rect.width -= 24
      draw_text(rect, medal[0])
    end
  end
  #--------------------------------------------------------------------------
  # ○ 背景の描画
  #--------------------------------------------------------------------------
  def draw_background(rect)
    temp_rect = rect.clone
    temp_rect.width /= 2
    contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
    temp_rect.x = temp_rect.width
    contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
  end
  #--------------------------------------------------------------------------
  # ○ 背景色 1 の取得
  #--------------------------------------------------------------------------
  def back_color1
    Color.new(0, 0, 0, 192)
  end
  #--------------------------------------------------------------------------
  # ○ 背景色 2 の取得
  #--------------------------------------------------------------------------
  def back_color2
    Color.new(0, 0, 0, 0)
  end
end

#==============================================================================
# □ Window_Medal
#==============================================================================
class Window_Medal < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super
    refresh
    select(0)
    activate
  end
  #--------------------------------------------------------------------------
  # ● 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
  #--------------------------------------------------------------------------
  # ● 項目数の取得
  #--------------------------------------------------------------------------
  def item_max
    @data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # ● アイテムの取得
  #--------------------------------------------------------------------------
  def item
    @data && index >= 0 ? @data[index] : nil
  end
  #--------------------------------------------------------------------------
  # ● アイテムリストの作成
  #--------------------------------------------------------------------------
  def make_item_list
    @data = $game_party.medals
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    medal = TMMEDAL::MEDAL_DATA[item[0]]
    rect = item_rect(index)
    draw_icon(medal[1], rect.x, rect.y)
    rect.x += 24
    rect.width -= 216
    draw_text(rect, medal[0])
    rect.x = contents.width - 192
    rect.width = 192
    draw_text(rect, item[1], 2)
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    if item
      medal = TMMEDAL::MEDAL_DATA[item[0]]
      text = medal[2]
      @help_window.set_text(text)
    end
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    make_item_list
    create_contents
    draw_all_items
  end
end

#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # ● 全ウィンドウの作成
  #--------------------------------------------------------------------------
  alias tmmedal_scene_map_create_all_windows create_all_windows
  def create_all_windows
    tmmedal_scene_map_create_all_windows
    create_medal_window
  end
  #--------------------------------------------------------------------------
  # ○ メダルウィンドウの作成
  #--------------------------------------------------------------------------
  def create_medal_window
    @medal_window = Window_MedalInfo.new
  end
end

#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
  #--------------------------------------------------------------------------
  # ● コマンドウィンドウの作成
  #--------------------------------------------------------------------------
  alias tmmedal_scene_menu_create_command_window create_command_window
  def create_command_window
    tmmedal_scene_menu_create_command_window
    @command_window.set_handler(:medal, method(:command_medal))
  end
  #--------------------------------------------------------------------------
  # ○ コマンド[メダル]
  #--------------------------------------------------------------------------
  def command_medal
    SceneManager.call(Scene_Medal)
  end
end

#==============================================================================
# □ Scene_Medal
#==============================================================================
class Scene_Medal < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
    create_help_window
    create_item_window
  end
  #--------------------------------------------------------------------------
  # ○ アイテムウィンドウの作成
  #--------------------------------------------------------------------------
  def create_item_window
    wy = @help_window.height
    wh = Graphics.height - wy
    @item_window = Window_Medal.new(0, wy, Graphics.width, wh)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.set_handler(:cancel, method(:return_scene))
  end
end



那些的备注是日文的实在看不懂啦……
我想请大家帮忙把右上角的成就框框移到图片中的的红框处- -
还有显示的汉字最好能到框的中间  图标调大一点
大小已经自己调好啦
谢谢啦

360截图-23821093.jpg (61.68 KB, 下载次数: 23)

360截图-23821093.jpg
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-11-30 19:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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