查看: 2147|回复: 9

[已经解决] 请问怎么在选取菜单的时候让背景完全透明

[复制链接]
梦石
0
星屑
50
在线时间
10 小时
注册时间
2016-1-9
回帖
4
发表于 2016-11-16 22:22:42 | 显示全部楼层 |阅读模式

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

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

×
   想做成像仙剑那样除了状态栏和金钱栏外其余完全透明的窗口。
    #--------------------------------------------------------------------------
  # ● 生成背景
  #--------------------------------------------------------------------------
  def create_background
    @background_sprite = Sprite.new
    @background_sprite.bitmap = SceneManager.background_bitmap
    @background_sprite.color.set(0, 0, 0, 0)#(16, 16, 16, 128)
  end

#--------------------------------------------------------------------------
  # ● 获取背景用的场景截图
  #--------------------------------------------------------------------------
  def self.background_bitmap
    @background_bitmap
  end
end
#------------------------------------------------------------------
@background_bitmap = nil      
9529.tmp.png
891E.tmp.jpg

评分

参与人数 1星屑 +50 收起 理由
RaidenInfinity + 50 结帖

查看全部评分

梦石
0
星屑
50
在线时间
10 小时
注册时间
2016-1-9
回帖
4
 楼主| 发表于 2016-11-16 22:31:42 | 显示全部楼层
顺便再请教个问题,结束游戏之类的符号 按照我目前的理解是在游戏的"Data/System.rvdata2"文件中

如果我想将"结束游戏"改成"结束"应该怎么做?

回复

使用道具 举报

梦石
0
星屑
644
在线时间
830 小时
注册时间
2016-7-24
回帖
644

开拓者

发表于 2016-11-16 22:51:49 | 显示全部楼层
修改畫紅線的地方
Zagfa未命名.png

第一個你不是做好了嗎~
2016/07/17 加入RPG製作,勿忘初衷!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
10 小时
注册时间
2016-1-9
回帖
4
 楼主| 发表于 2016-11-16 22:58:07 | 显示全部楼层

  谢谢啦~ 原来资料库里就可以改啊~

第一个我做出来的效果不是完全透明
有一种贴了一层毛玻璃的感觉。。。。
回复

使用道具 举报

梦石
0
星屑
644
在线时间
830 小时
注册时间
2016-7-24
回帖
644

开拓者

发表于 2016-11-16 23:33:24 | 显示全部楼层
本帖最后由 QQ蚊子湯 于 2016-11-17 00:13 编辑

試試看這個ˊ
  1. class Scene_Menu < Scene_MenuBase
  2.   def start
  3.     super
  4.     create_command_window
  5.     create_gold_window
  6.     create_status_window
  7.   end
  8.   def create_gold_window
  9.     @gold_window = Window_Gold.new
  10.   end
  11.   def create_command_window
  12.     @command_window = Window_MenuCommand.new
  13.     @command_window.set_handler(:item,    method(:command_item))
  14.     @command_window.set_handler(:skill,    method(:command_personal))
  15.     @command_window.set_handler(:equip,    method(:command_personal))
  16.     @command_window.set_handler(:status,    method(:command_personal))
  17.     @command_window.set_handler(:formation,    method(:command_formation))
  18.     @command_window.set_handler(:save,    method(:command_save))
  19.     @command_window.set_handler(:game_end,    method(:command_game_end))

  20.     @command_window.set_handler(:cancel,    method(:return_scene))
  21.   end
  22.   def create_status_window
  23.     @status_window = Window_MenuStatus.new(160, 0)
  24.     @status_window.visible = false
  25.   end
  26.   def command_personal
  27.     on_personal_ok
  28.   end
  29. end
  30. class Window_MenuCommand < Window_Command
  31.   def initialize
  32.     super(0, 47)
  33.     self.opacity = 255 if SceneManager.scene_is?(Scene_Menu)
  34.     select_last
  35.   end
  36.   def window_width
  37.     return 160
  38.   end
  39.   def window_height
  40.     return 192
  41.   end
  42.   def make_command_list
  43.     add_command(Vocab::item,   :item,   main_commands_enabled)
  44.     add_command(Vocab::skill,   :skill,   main_commands_enabled)
  45.     add_command(Vocab::equip,   :equip,   main_commands_enabled)
  46.     add_command(Vocab::status,   :status,   main_commands_enabled)
  47.     add_command(Vocab::formation,   :formation,   false)
  48.     add_command(Vocab::save,   :save,   save_enabled)
  49.     add_command(Vocab::game_end,   :game_end)

  50.   end
  51.   def alignment
  52.     return 0
  53.   end
  54. end
  55. class Window_MenuStatus < Window_Selectable
  56.   def initialize(x, y)
  57.     super(x, y, window_width, window_height)
  58.     @pending_index = -1
  59.     self.opacity = 0 if SceneManager.scene_is?(Scene_Menu)
  60.     refresh
  61.   end
  62.   def window_width
  63.     return 384
  64.   end
  65.   def window_height
  66.     return 416
  67.   end
  68.   def item_height
  69.     return (height - standard_padding * 2) / 4
  70.   end
  71.   def draw_item(index)
  72.     actor = $game_party.members[index]
  73.     enabled = $game_party.battle_members.include?(actor)
  74.     rect = item_rect(index)
  75.     draw_item_background(index)
  76.     draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
  77.     draw_actor_simple_status(actor, rect.x, rect.y)
  78.   end
  79.   def draw_actor_simple_status(actor, x, y)
  80.     draw_actor_name(actor, x + 108, y + 12)
  81.     draw_actor_level(actor, x + 108, y + 36)
  82.     draw_actor_icons(actor, x + 108, y + 60)
  83.     draw_actor_class(actor, x + 228, y + 12)
  84.     draw_actor_hp(actor, x + 228, y + 36)
  85.     draw_actor_mp(actor, x + 228, y + 60)
  86.   end
  87.   def draw_face(face_name, face_index, x, y, enabled = true)
  88.     bitmap = Cache.face(face_name)
  89.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
  90.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  91.     bitmap.dispose
  92.   end
  93.   def draw_actor_name(actor, x, y, width = 112)
  94.     change_color(hp_color(actor))
  95.     draw_text(x, y, width, 24, actor.name)
  96.   end
  97.   def draw_actor_level(actor, x, y)
  98.     change_color(system_color)
  99.     draw_text(x, y, 32, line_height, Vocab::level_a)
  100.     change_color(normal_color)
  101.     draw_text(x + 56 - 24, y, 24, 24, actor.level, 2)
  102.   end
  103.   def draw_actor_icons(actor, x, y, width = 96)
  104.     icons = (actor.state_icons + actor.buff_icons)[0, ((24/24)*width)/24]
  105.     icons.each_with_index {|n, i| draw_icon(n, x + 24 * (i % (width / 24)), y + 24 * (i / (width / 24))) }
  106.   end
  107.   def draw_actor_class(actor, x, y, width = 112)
  108.     change_color(normal_color)
  109.     draw_text(x, y, width, 24, actor.class.name)
  110.   end
  111.   def draw_actor_hp(actor, x, y, width = 124)
  112.     draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  113.     change_color(system_color)
  114.     draw_text(x, y, 30, line_height, Vocab::hp_a)
  115.     draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
  116.     hp_color(actor), normal_color)
  117.     end
  118.   def draw_actor_mp(actor, x, y, width = 124)
  119.     draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  120.     change_color(system_color)
  121.     draw_text(x, y, 30, line_height, Vocab::mp_a)
  122.     draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
  123.     mp_color(actor), normal_color)
  124.   end
  125. end
  126. class Window_MenuActor < Window_MenuStatus
  127.   def initialize
  128.     super(0, 0)
  129.     self.visible = false
  130.   end
  131.   def window_height
  132.     Graphics.height
  133.   end
  134. end
  135. class Window_Gold < Window_Base
  136.   def initialize
  137.     super(0, 0, window_width, 48)
  138.     self.opacity = 255 if SceneManager.scene_is?(Scene_Menu)
  139.     refresh
  140.   end
  141.   def window_width
  142.     return 160
  143.   end
  144.   def refresh
  145.     contents.clear
  146.     change_color(system_color)
  147.     draw_text(4, 0, contents_width - 8, line_height, 'Gold')
  148.     cx = text_size(currency_unit).width
  149.     change_color(normal_color)
  150.     draw_text(4, contents_height - line_height, contents.width - 8 - cx - 2, line_height, value, 2)
  151.     change_color(system_color)
  152.     draw_text(4, contents_height - line_height, contents.width - 8, line_height, currency_unit, 2)
  153.   end
  154. end
复制代码


毛玻璃的現象可以用這段去除

  1. module SceneManager
  2. def self.snapshot_for_background
  3.     @background_bitmap.dispose if @background_bitmap
  4.     @background_bitmap = Graphics.snap_to_bitmap
  5.   end
  6.   end
复制代码

点评

補上一段代碼 順便咬一口肉包~  发表于 2016-11-17 00:15
補上一段代碼 順便咬一口肉包~  发表于 2016-11-17 00:15
"想做成像仙剑那样除了状态栏和金钱栏外其余完全透明的窗口"我是照這個要求,再參考附圖的配置作的!  发表于 2016-11-17 00:08
楼主意思应该是希望create_background透明(看上去就像没有create_background一样),不是窗口透明化吧...  发表于 2016-11-16 23:58

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 认可答案

查看全部评分

2016/07/17 加入RPG製作,勿忘初衷!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
10 小时
注册时间
2016-1-9
回帖
4
 楼主| 发表于 2016-11-17 09:52:39 | 显示全部楼层
QQ蚊子湯 发表于 2016-11-16 23:33
試試看這個ˊ
class Scene_Menu < Scene_MenuBase
  def start

谢谢啦~~~  用你的方法问题已经解决了,之前自己有些问题理解错了,现在看明白了~ A3C0.tmp.jpg

前面修改的Scene_Menu类应该是排版的一些问题吧?
我先自己试着排下,然后有问题再照你的改~{:2_280:}

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部