Project1

标题: 如何进入某一个场景后地图上显示金钱 [打印本页]

作者: qingfengjian    时间: 2013-1-22 14:50
标题: 如何进入某一个场景后地图上显示金钱
本帖最后由 qingfengjian 于 2013-1-24 17:43 编辑

如题,并不是全局都显示金钱,是进入某一个特定的场景里面才显示?
作者: Sion    时间: 2013-1-22 16:20
  1. # 说明:在地图备注里加入<ShowGold>可以在该地图显示金钱。

  2. #==============================================================================
  3. # ■ Scene_Map
  4. #==============================================================================

  5. class Scene_Map
  6.   
  7.   alias old_create_all_windows create_all_windows  
  8.   def create_all_windows
  9.     old_create_all_windows
  10.     creat_gold_window
  11.     @gold_window.open if show_gold_window?
  12.   end
  13.   
  14.   alias old_pre_transfer pre_transfer
  15.   def pre_transfer
  16.     @gold_window.close
  17.     old_pre_transfer
  18.   end
  19.   
  20.   alias old_post_transfer post_transfer
  21.   def post_transfer
  22.     old_post_transfer
  23.     @gold_window.open if show_gold_window?
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 创建金钱窗口,跟默认菜单中的一样
  27.   #--------------------------------------------------------------------------
  28.   def creat_gold_window
  29.     @gold_window = Window_Map_Gold.new
  30.     @gold_window.x = 0
  31.     @gold_window.y = Graphics.height - @gold_window.height
  32.   end
  33.   
  34.   def show_gold_window?
  35.     map = load_data(sprintf("Data/Map%03d.rvdata2", $game_map.map_id))
  36.     map.note.each_line do |line|
  37.       return true if line.include?("<ShowGold>")
  38.     end
  39.     return false
  40.   end
  41.   
  42.   alias old_update update
  43.   def update
  44.     old_update
  45.     @gold_window.refresh if show_gold_window?
  46.   end
  47.   
  48. end

  49. #==============================================================================
  50. # ■ Window_Map_Gold
  51. #==============================================================================

  52. class Window_Map_Gold < Window_Gold
  53.   
  54.   def initialize
  55.     super
  56.     self.opacity = 0;self.contents_opacity = 0
  57.   end
  58.   
  59.   def open
  60.     self.opacity = 255;self.contents_opacity = 255
  61.     super
  62.   end
  63.   
  64.   def close
  65.     self.opacity = 0;self.contents_opacity = 0
  66.   end

  67. end
复制代码

作者: qingfengjian    时间: 2013-1-22 18:14
Sion 发表于 2013-1-22 16:20

谢谢,成功了{:2_275:}
感谢感谢感谢!!!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1