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

Project1

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

[转载] 生化危机1代的界面

[复制链接]

Lv2.观梦者

梦石
0
星屑
258
在线时间
1574 小时
注册时间
2010-6-17
帖子
2892

开拓者贵宾

跳转到指定楼层
1
发表于 2015-2-11 11:37:27 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 月华风 于 2015-3-14 20:50 编辑

预览效果




RUBY 代码复制
  1. #==============================================================================
  2. # ** Scene_Menu
  3. #------------------------------------------------------------------------------
  4. #  Esta classe executa o processamento da tela de menu.
  5. #==============================================================================
  6. module RE_MENU
  7.   #--------------------------------------------------------------------------
  8.   # * receitas de combinações de itens
  9.   # * coloque Reciepe[a] = [b, c, d] sendo
  10.   # * a o valor crescente da receita de 1 a sla quantos
  11.   # * b e c o valor dos intens da receitas que vam combinar
  12.   # * d o item que será formado apartir dos outrs
  13.   #--------------------------------------------------------------------------
  14.  
  15.   Recipe = {}
  16.   Recipe[1] = [12, 13 , 14]
  17.   Recipe[2] = [12, 15, 16]
  18.   Recipe[3] = [13, 16, 17]
  19.   Recipe[4] = [15, 14, 17]
  20.   Recipe[5] = [12, 12, 18]
  21.   Recipe[6] = [12, 18, 19]
  22.   #--------------------------------------------------------------------------
  23.   # * Vocabulario do menu
  24.   #--------------------------------------------------------------------------
  25.   # * Menu que mostra o item equipado
  26.   Equip = "Equipado: "
  27.   # * Para descarta itens
  28.   Descarte = "Descartar"
  29.   # * Para combinar itens
  30.   Combine = "Combinar"
  31.   # * Para usar itens
  32.   Use = "Usar"
  33.   # * para equipar itens
  34.   Equipe = "Equipar"
  35.   # * para cabeçalho do invetario
  36.   Inventario = "Inventario"
  37.   # * para cabeçalhos dos keys itens
  38.   Key_itens = "Documentos"
  39.   # * para janela de help, nome da descrição
  40.   Help_desc = "Descrição: "
  41.   # * para janela de help, nome para o item
  42.   Help_name = "Nome: "
  43.  
  44.  
  45.   #--------------------------------------------------------------------------
  46.   # * Som tocado quando combina os itens
  47.   #--------------------------------------------------------------------------
  48.   def self.playcombine
  49.       Sound.play_use_item
  50.   end
  51.  
  52. end
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. #==============================================================================
  61. # ** Window_Help
  62. #------------------------------------------------------------------------------
  63. #  Esta janela exibe explicação de habilidades e itens e outras informações.
  64. #==============================================================================
  65.  
  66. class RE_Window_Help < Window_Base
  67.   #--------------------------------------------------------------------------
  68.   # * Inicialização do objeto
  69.   #     line_number : número de linhas
  70.   #--------------------------------------------------------------------------
  71.   def initialize(line_number = 3)
  72.     super(0, 150, 345, Graphics.height - 150)
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # * Configuração de texto
  76.   #     text : texto
  77.   #--------------------------------------------------------------------------
  78.   def set_text(text)
  79.     if text != @text
  80.       @text = text
  81.       refresh
  82.     end
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # * Limpeza
  86.   #--------------------------------------------------------------------------
  87.   def clear
  88.     set_text("")
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # * Definição de item
  92.   #     item : habilidades, itens, etc.
  93.   #--------------------------------------------------------------------------
  94.   def set_item(item)
  95.     set_text(item ? item.description : "")
  96.     @item = item
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # * Renovação
  100.   #--------------------------------------------------------------------------
  101.   def refresh
  102.     contents.clear
  103.     if @item != nil
  104.  
  105.       draw_text(5, 70, 150, 50, RE_MENU::Help_desc)
  106.       draw_text(5, 100, 300, 100, @text)
  107.       #draw_text_ex(5, 170, @text)
  108.       draw_text(5, 0 , 350, 50, RE_MENU::Help_name + @item.name)
  109.     end
  110.  
  111.   end
  112. end
  113.  
  114. #==============================================================================
  115. # ** Window_MenuCommand
  116. #------------------------------------------------------------------------------
  117. #  Esta janela exibe os comandos do menu.
  118. #==============================================================================
  119. class MenuCommand < Window_HorzCommand
  120.   #--------------------------------------------------------------------------
  121.   # * Inicialização da posição do comando de seleção (método da classe)
  122.   #--------------------------------------------------------------------------
  123.   def self.init_command_position
  124.     @@last_command_symbol = nil
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # * Inicialização do objeto
  128.   #--------------------------------------------------------------------------
  129.   def initialize
  130.     super(244, 0)
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # * Aquisição da largura da janela
  134.   #--------------------------------------------------------------------------
  135.   def window_width
  136.     return 300
  137.   end
  138.  
  139.   #--------------------------------------------------------------------------
  140.   # * Aquisição da largura da janela
  141.   #--------------------------------------------------------------------------
  142.   def window_height
  143.     50
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # * Aquisição do número de linhas exibidas
  147.   #--------------------------------------------------------------------------
  148.   def col_max
  149.     return 3
  150.   end
  151.   #def visible_line_number
  152.    # 3
  153. # end
  154.   #--------------------------------------------------------------------------
  155.   # * Criação da lista de comandos
  156.   #--------------------------------------------------------------------------
  157.   def make_command_list
  158.     add_main_commands
  159.     add_game_end_command
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # * Adição dos comandos principais
  163.   #--------------------------------------------------------------------------
  164.   def add_main_commands
  165.     add_command(RE_MENU::Inventario,   :item,   main_commands_enabled)
  166.     add_command(RE_MENU::Key_itens, :key_item, main_commands_enabled)
  167.   end
  168.  
  169.   #--------------------------------------------------------------------------
  170.   # * Definição de habilitação dos comandos principais
  171.   #--------------------------------------------------------------------------
  172.   def main_commands_enabled
  173.     $game_party.exists
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # * Adição do comando de fim do jogo
  177.   #--------------------------------------------------------------------------
  178.   def add_game_end_command
  179.     add_command(Vocab::game_end, :game_end)
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # * Definição de resultado ao pressionar o botão de confirmação
  183.   #--------------------------------------------------------------------------
  184.   def process_ok
  185.     @@last_command_symbol = current_symbol
  186.     super
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # * Definição da janela de itens
  190.   #     item_window : janela de itens
  191.   #--------------------------------------------------------------------------
  192.   def item_window=(item_window)
  193.     @item_window = item_window
  194.     @item_window.category = current_symbol
  195.   end
  196. end
  197.  
  198. class Window_ItemList < Window_Selectable
  199.   #--------------------------------------------------------------------------
  200.   # * Inicialização do objeto
  201.   #     x      : coordenada X
  202.   #     y      : coordenada Y
  203.   #     width  : largura
  204.   #     height : altura
  205.   #--------------------------------------------------------------------------
  206.   def initialize(x, y, width, height)
  207.     super
  208.     @category = :none
  209.     @data = []
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # * Definição de categoria
  213.   #--------------------------------------------------------------------------
  214.   def category=(category)
  215.     return if @category == category
  216.     @category = category
  217.     refresh
  218.     self.oy = 0
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # * Aquisição do número de colunas
  222.   #--------------------------------------------------------------------------
  223.   def col_max
  224.     return 2
  225.   end
  226.  
  227.   #--------------------------------------------------------------------------
  228.   # * Aquisição do número máximo de itens
  229.   #--------------------------------------------------------------------------
  230.   def item_max
  231.     @data ? @data.size : 1
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # * Aquisição do espaçamento entre os itens
  235.   #--------------------------------------------------------------------------
  236.   def spacing
  237.     return 5
  238.   end
  239.  
  240.   #--------------------------------------------------------------------------
  241.   # * Aquisição de altura do item
  242.   #--------------------------------------------------------------------------
  243.   def item_height
  244.     80
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # * Aquisição das informações do item
  248.   #--------------------------------------------------------------------------
  249.   def item
  250.     @data && index >= 0 ? @data[index] : nil
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # * Definição de habilitação de seleção
  254.   #--------------------------------------------------------------------------
  255.   def current_item_enabled?
  256.     enable?(@data[index])
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # * Inclusão do item na lista
  260.   #     item : item
  261.   #--------------------------------------------------------------------------
  262.   def include?(item)
  263.     case @category
  264.     when :item
  265.       item.is_a?(RPG::Item) && !item.key_item? or item.is_a?(RPG::Weapon)
  266.     when :key_item
  267.       item.is_a?(RPG::Item) && item.key_item?
  268.     else
  269.       false
  270.     end
  271.   end
  272.   #--------------------------------------------------------------------------
  273.   # * Definição de itens disponíveis para uso
  274.   #--------------------------------------------------------------------------
  275.   def usable?(item)
  276.     if item.is_a?(RPG::Weapon)
  277.       return true
  278.     else
  279.       return $game_party.usable?(item)
  280.     end
  281.     return false
  282.  
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # * Definição de habilitação do item
  286.   #     item : item
  287.   #--------------------------------------------------------------------------
  288.   def enable?(item)
  289.     #$game_party.usable?(item)
  290.     return true
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # * Criação da lista de itens
  294.   #--------------------------------------------------------------------------
  295.   def make_item_list
  296.     @data = $game_party.all_items.select {|item| include?(item) }
  297.     @data.push(nil) if include?(nil)
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # * Retorno à seleção anterior
  301.   #--------------------------------------------------------------------------
  302.  
  303.   def select_last
  304.     select(@data.index($game_party.last_item.object) || 0)
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # * desenhar o item
  308.   #--------------------------------------------------------------------------
  309.  
  310.   def draw_item_name(item, x, y, enabled = true, width = 80)
  311.     return unless item
  312.     draw_icon(item.icon_index, x + 30, y + 20, enabled)
  313.     change_color(normal_color, enabled)
  314.     draw_text(x + 5, y + 50, width, line_height, item.name)
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # * Desenho de um item
  318.   #     index : índice do item
  319.   #--------------------------------------------------------------------------
  320.   def draw_item(index)
  321.     item = @data[index]
  322.  
  323.     if item
  324.       rect = item_rect(index)
  325.       rect.width -= 4
  326.       draw_item_name(item, rect.x , rect.y, true)
  327.       rect.y -= 20
  328.       draw_item_number(rect, item)
  329.     end
  330.   end
  331.  
  332.   #--------------------------------------------------------------------------
  333.   # * Desenho do número de itens possuido
  334.   #     rect : retângulo
  335.   #     item : item
  336.   #--------------------------------------------------------------------------
  337.   def draw_item_number(rect, item)
  338.     draw_text(rect, sprintf(" %2d", $game_party.item_number(item)), 2)
  339.   end
  340.   #--------------------------------------------------------------------------
  341.   # * Atualização da janela de ajuda
  342.   #--------------------------------------------------------------------------
  343.   def update_help
  344.     @help_window.set_item(item)
  345.     @help_window.refresh
  346.   end
  347.  
  348.   #--------------------------------------------------------------------------
  349.   # * Renovação
  350.   #--------------------------------------------------------------------------
  351.   def refresh
  352.     make_item_list
  353.     create_contents
  354.     draw_all_items
  355.     update_help
  356.   end
  357. end
  358.  
  359. class Comand_itens < Window_Command
  360.   #--------------------------------------------------------------------------
  361.   # * Inicialização do objeto
  362.   #--------------------------------------------------------------------------
  363.   def initialize
  364.     super(300, 200)
  365.     refresh
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # * Aquisição da largura da janela
  369.   #--------------------------------------------------------------------------
  370.   def window_width
  371.     return 100
  372.   end
  373.   def window_height
  374.     return 100
  375.   end
  376.   def activeCombine=(active)
  377.     @activecombine = active
  378.   end
  379.   def usename=(name)
  380.     @usename = name
  381.   end
  382.   def activeCombine
  383.     return @activecombine
  384.   end
  385.   def usename
  386.     return @usename
  387.   end
  388.   def important=(value)
  389.     @important = value
  390.   end
  391.   def important
  392.     return @important
  393.   end
  394.   def isuse=(value)
  395.     @isuse = value
  396.   end
  397.   def isuse
  398.     return @isuse
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # * Criação da lista de comandos
  402.   #--------------------------------------------------------------------------
  403.   def make_command_list
  404.     add_command(usename,   :usar,   isuse)
  405.     add_command(RE_MENU::Combine,  :combine,  activeCombine)
  406.     add_command(RE_MENU::Descarte,  :discart,  important)
  407.   end
  408. end
  409. class Scene_Menu < Scene_MenuBase
  410.   #--------------------------------------------------------------------------
  411.   # * Inicialização do processo
  412.   #--------------------------------------------------------------------------
  413.   def start
  414.     super
  415.     create_Help_window
  416.     create_command_window
  417.     create_item_window
  418.     create_status_window
  419.     create_command_itens
  420.     create_Equip_window
  421.     @iscombine = false
  422.     @actor = $game_party.members[0]
  423.   end
  424.  
  425.   #--------------------------------------------------------------------------
  426.   # * Criação da janela de comando
  427.   #--------------------------------------------------------------------------
  428.   def create_command_window
  429.     @command_window = MenuCommand.new
  430.     @command_window.set_handler(:item,      method(:command_item))
  431.     @command_window.set_handler(:key_item,      method(:command_item))
  432.     @command_window.set_handler(:game_end,  method(:command_game_end))
  433.     @command_window.set_handler(:cancel,    method(:return_scene))
  434.   end
  435.  
  436.   #--------------------------------------------------------------------------
  437.   # * Criação da janela de itens
  438.   #--------------------------------------------------------------------------
  439.   def create_item_window
  440.     wy = @command_window.y + @command_window.height + 100
  441.     wh = Graphics.height - wy
  442.     @item_window = Window_ItemList.new(344, wy, 200, wh)
  443.     @item_window.help_window = @help_window
  444.     @item_window.set_handler(:ok,     method(:on_item_ok))
  445.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  446.     @command_window.item_window = @item_window
  447.     #@command_window.item_window = @item_window
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # * Criação da janela de comando dos intems
  451.   #--------------------------------------------------------------------------
  452.   def create_command_itens
  453.     @command_item = Comand_itens.new
  454.     @command_item.set_handler(:usar,      method(:use_item))
  455.     @command_item.set_handler(:combine,      method(:combine_item))
  456.     @command_item.set_handler(:discart,  method(:discart_item))
  457.     @command_item.set_handler(:cancel,    method(:return_itens))
  458.     @command_item.visible = false
  459.     @command_item.active = false
  460.   end
  461.  
  462.   #--------------------------------------------------------------------------
  463.   # * Criação das janelas
  464.   #--------------------------------------------------------------------------
  465.   def create_status_window
  466.     @Status_window = Window_Base.new(0,0,245,150)
  467.     @Status_window.contents.clear
  468.     @Status_window.draw_actor_face(@actor, 1, 10)
  469.     @Status_window.draw_text(100, 10 , 120, 50, @actor.name)
  470.     @Status_window.draw_actor_hp(@actor, 100, 40, 120)
  471.   end
  472.  
  473.   def create_Help_window
  474.     @help_window = RE_Window_Help.new()
  475.   end
  476.   def create_Equip_window
  477.     @Equip_window = Window_Base.new(244,50,300,100)
  478.     @Equip_window.contents.clear
  479.     if @actor.equips[0] != nil
  480.       @Equip_window.draw_icon(@actor.equips[0].icon_index, 30, 20, true)
  481.       @Equip_window.draw_text(0, -15 , 120, 50, RE_MENU::Equip)
  482.       @Equip_window.draw_text(10, 40 , 150, 50, @actor.equips[0].name)
  483.     end
  484.  
  485.  
  486.   end
  487.   def use_item
  488.     if @item.is_a?(RPG::Weapon)
  489.       @actor.change_equip(0,@item)
  490.       Sound.play_equip
  491.     else
  492.       Sound.play_use_item
  493.       @actor.use_item(@item)
  494.       use_item_to_actors
  495.  
  496.     end
  497.     return_itens
  498.     refresh
  499.     check_common_event
  500.   end
  501.   def use_item_to_actors
  502.     $game_party.members.each do |target|
  503.       @item.repeats.times { target.item_apply(@actor, @item) }
  504.     end
  505.   end
  506.   def check_common_event
  507.     if $game_temp.common_event_reserved?
  508.       SceneManager.goto(Scene_Map)
  509.       @iscombine = false
  510.     end
  511.   end
  512.   def combine_item
  513.     if @iscombine == false
  514.       @iscombine = true
  515.       @combineitem = @item
  516.     else
  517.       recipe = RE_MENU::Recipe
  518.       if @combineitem.id == @item.id
  519.         if $game_party.item_number(@item) <= 1
  520.           @combineitem = nil
  521.         end
  522.       end
  523.       if @combineitem != nil
  524.         for x in 1..recipe.size
  525.         recipe1 = recipe[x]
  526.  
  527.           if recipe1[0] == @combineitem.id and recipe1[1] == @item.id
  528.             @iscombine = false
  529.             combineitens(x)
  530.             break
  531.           elsif recipe1[1] == @combineitem.id and recipe1[0] == @item.id
  532.             @iscombine = false
  533.             combineitens(x)
  534.             break
  535.           end
  536.         end
  537.       end
  538.       if @iscombine == true
  539.         Sound.play_buzzer
  540.           @iscombine = false
  541.       end
  542.  
  543.     end
  544.     refresh
  545.     return_itens
  546.  
  547.  
  548.   end
  549.   def combineitens(x)
  550.     RE_MENU::playcombine
  551.     $game_party.gain_item(@item, -1, true)
  552.     $game_party.gain_item(@combineitem, -1, true)
  553.     for y in 0..$data_items.size
  554.         novoitem = $data_items[y] if y == RE_MENU::Recipe[x][2]
  555.     end
  556.     $game_party.gain_item(novoitem, 1)
  557.   end
  558.   def discart_item
  559.     $game_party.gain_item(@item, -1, true)
  560.     return_itens
  561.   end
  562.   def return_itens
  563.     @command_item.visible = false
  564.     @command_item.active = false
  565.     @item_window.active = true
  566.     @item_window.refresh
  567.   end
  568.   #--------------------------------------------------------------------------
  569.   # * Item [Confirmação]
  570.   #--------------------------------------------------------------------------
  571.   def on_item_ok
  572.     @item = @item_window.item
  573.     if @item != nil
  574.       if @item.is_a?(RPG::Weapon)
  575.         @command_item.activeCombine = false
  576.         @command_item.usename = RE_MENU::Equipe
  577.       else
  578.         @command_item.activeCombine = true
  579.         @command_item.usename = RE_MENU::Use
  580.       end
  581.       if @item.is_a?(RPG::Item) and @item.key_item?
  582.         @command_item.important = false
  583.       else
  584.         @command_item.important = true
  585.       end
  586.       if @item_window.usable?(@item)
  587.         @command_item.isuse = true
  588.       else
  589.         @command_item.isuse = false
  590.       end
  591.  
  592.       @command_item.refresh
  593.       @command_item.visible = true
  594.       @command_item.active = true
  595.     else
  596.       Sound.play_buzzer
  597.       @item_window.active = true
  598.     end
  599.     @help_window.set_item(@item)
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # * Item [Cancelamento]
  603.   #--------------------------------------------------------------------------
  604.   def on_item_cancel
  605.     @item_window.unselect
  606.     @command_window.activate
  607.     @iscombine = false
  608.   end
  609.  
  610.   #--------------------------------------------------------------------------
  611.   # * Comando [Item]
  612.   #--------------------------------------------------------------------------
  613.   def command_item
  614.     @command_window.item_window = @item_window
  615.     @item_window.activate
  616.     @item_window.select_last
  617.  
  618.   end
  619.   #--------------------------------------------------------------------------
  620.   # * Comando [Fim do Jogo]
  621.   #--------------------------------------------------------------------------
  622.   def command_game_end
  623.     SceneManager.call(Scene_End)
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # * Comandos individuais [Cancelamento]
  627.   #--------------------------------------------------------------------------
  628.   def on_personal_cancel
  629.     @status_window.unselect
  630.     @command_window.activate
  631.   end
  632.  
  633.   def refresh
  634.     @actor = $game_party.members[0]
  635.     @item_window.refresh
  636.     @Equip_window.contents.clear
  637.     if @actor.equips[0] != nil
  638.       @Equip_window.draw_icon(@actor.equips[0].icon_index, 30, 20, true)
  639.       @Equip_window.draw_text(0, -15 , 120, 50, RE_MENU::Equip)
  640.       @Equip_window.draw_text(10, 40 , 150, 50, @actor.equips[0].name)
  641.     end
  642.     @Status_window.contents.clear
  643.     @Status_window.draw_actor_face(@actor, 1, 10)
  644.     @Status_window.draw_text(100, 10 , 120, 50, @actor.name)
  645.     @Status_window.draw_actor_hp(@actor, 100, 40, 120)
  646.   end
  647. end


快来点我一下,你会豁然开朗的
喵Kano特制
←开发中……

←暂时弃坑 电脑上资源全没
david_ng223 该用户已被删除
2
发表于 2015-3-14 12:49:22 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-24 21:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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