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

Project1

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

[已经过期] 谁能改下这个个性菜单

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
41 小时
注册时间
2010-7-15
帖子
35
跳转到指定楼层
1
发表于 2011-7-17 14:50:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
http://rpg.blue/forum.php?mod=viewthread&tid=189311&highlight=%B2%CB%B5%A5


菜单代码
  1. module Cache
  2.   def self.menu(filename)
  3.     load_bitmap("Graphics/Menus/", filename)
  4.   end
  5. end
  6. class Window_Base < Window  
  7.   def draw_actor_level_menu(actor, x, y)
  8.     self.contents.font.color = system_color
  9.     self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
  10.     self.contents.font.color = normal_color
  11.     self.contents.draw_text(x + 16, y, 24, WLH, actor.level, 2)
  12.   end  
  13.   def draw_currency_value_menu(value, x, y, width)
  14.     cx = contents.text_size(Vocab::gold).width
  15.     self.contents.font.color = normal_color
  16.     self.contents.draw_text(x, y, width-cx-2, WLH, value, 1)
  17.   end
  18. def draw_actor_hp_menu(actor, x, y)
  19. back = Cache.menu("Meter_Back")   
  20. cw = back.width  
  21. ch = back.height
  22. src_rect = Rect.new(0, 0, cw, ch)   
  23. self.contents.blt(x + 65, y - ch + 30, back, src_rect)
  24. meter = Cache.menu("HP_Meter")   
  25. cw = meter.width  * actor.hp / actor.maxhp
  26. ch = meter.height
  27. src_rect = Rect.new(0, 0, cw, ch)
  28. self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
  29. text = Cache.menu("HP_Text")   
  30. cw = text.width  
  31. ch = text.height
  32. src_rect = Rect.new(0, 0, cw, ch)
  33. self.contents.blt(x + 35, y - ch + 30, text, src_rect)
  34. self.contents.font.color = Color.new(255,255,255,255)
  35. self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)
  36. self.contents.font.color = Color.new(255,255,255,255)
  37. self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)   
  38. end     
  39. def draw_actor_mp_menu(actor, x, y)
  40. back = Cache.menu("Meter_Back")   
  41. cw = back.width  
  42. ch = back.height
  43. src_rect = Rect.new(0, 0, cw, ch)   
  44. self.contents.blt(x + 65, y - ch + 30, back, src_rect)
  45. meter = Cache.menu("MP_Meter")   
  46. cw = meter.width  * actor.mp / actor.maxmp
  47. ch = meter.height
  48. src_rect = Rect.new(0, 0, cw, ch)
  49. self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
  50. text = Cache.menu("MP_Text")   
  51. cw = text.width  
  52. ch = text.height
  53. src_rect = Rect.new(0, 0, cw, ch)
  54. self.contents.blt(x + 35, y - ch + 30, text, src_rect)
  55. self.contents.font.color = Color.new(0,0,0,255)
  56. self.contents.draw_text(x + 81, y - 1, 48, 32, actor.mp.to_s, 2)
  57. self.contents.font.color = Color.new(255,255,255,255)
  58. self.contents.draw_text(x + 80, y - 2, 48, 32, actor.mp.to_s, 2)   
  59. end      
  60. def draw_actor_name_menu(actor, x, y)
  61.     self.contents.font.color = text_color(23)
  62.     self.contents.draw_text(x, y, 108, WLH, actor.name,1)
  63. end  
  64. def draw_actor_level_menu(actor, x, y)
  65.     self.contents.font.color = system_color
  66.     self.contents.draw_text(x, y, 32, WLH, "LV")
  67.     self.contents.font.color = text_color(10)
  68.     self.contents.draw_text(x + 18, y, 24, WLH, actor.level, 1)
  69. end  
  70. end
  71. class Game_Map
  72. attr_reader   :map_id  
  73. def mpname
  74. $mpname = load_data("Data/MapInfos.rvdata")
  75. $mpname[@map_id].name
  76. end
  77. end
  78. class Window_Selectable_Menu < Window_Base
  79.   attr_reader   :item_max              
  80.   attr_reader   :column_max            
  81.   attr_reader   :index                    
  82.   def initialize(x, y, width, height, spacing = 32)
  83.     @item_max = 1
  84.     @column_max = 1
  85.     @index = -1
  86.     @spacing = spacing
  87.     super(x, y, width, height)
  88.   end
  89.   def create_contents
  90.     self.contents.dispose
  91.     self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max)
  92.   end  
  93.   def index=(index)
  94.     @index = index
  95.   end
  96.   def row_max
  97.     return (@item_max + @column_max - 1) / @column_max
  98.   end
  99.   def top_row
  100.     return self.oy / WLH
  101.   end
  102.   def top_row=(row)
  103.     row = 0 if row < 0
  104.     row = row_max - 1 if row > row_max - 1
  105.     self.oy = row * WLH
  106.   end
  107.   def page_row_max
  108.     return (self.height - 32) / WLH
  109.   end
  110.   def page_item_max
  111.     return page_row_max * @column_max
  112.   end
  113.   def bottom_row
  114.     return top_row + page_row_max - 1
  115.   end
  116.   def bottom_row=(row)
  117.     self.top_row = row - (page_row_max - 1)
  118.   end
  119.   def cursor_movable?
  120.     return false if (not visible or not active)
  121.     return false if (index < 0 or index > @item_max or @item_max == 0)
  122.     return false if (@opening or @closing)
  123.     return true
  124.   end
  125.   def cursor_down(wrap = false)
  126.     if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
  127.       @index = (@index + @column_max) % @item_max
  128.     end
  129.   end
  130.   def cursor_up(wrap = false)
  131.     if (@index >= @column_max) or (wrap and @column_max == 1)
  132.       @index = (@index - @column_max + @item_max) % @item_max
  133.     end
  134.   end
  135.   def cursor_right(wrap = false)
  136.     if (@column_max >= 2) and
  137.        (@index < @item_max - 1 or (wrap and page_row_max == 1))
  138.       @index = (@index + 1) % @item_max
  139.     end
  140.   end
  141.   def cursor_left(wrap = false)
  142.     if (@column_max >= 2) and
  143.        (@index > 0 or (wrap and page_row_max == 1))
  144.       @index = (@index - 1 + @item_max) % @item_max
  145.     end
  146.   end
  147.   def update
  148.     super
  149.     if cursor_movable?
  150.       last_index = @index
  151.       if Input.repeat?(Input::DOWN)
  152.         cursor_down(Input.trigger?(Input::DOWN))
  153.       end
  154.       if Input.repeat?(Input::UP)
  155.         cursor_up(Input.trigger?(Input::UP))
  156.       end
  157.       if Input.repeat?(Input::RIGHT)
  158.         cursor_down(Input.trigger?(Input::DOWN))
  159.       end
  160.       if Input.repeat?(Input::LEFT)
  161.         cursor_up(Input.trigger?(Input::UP))
  162.       end

  163.       if @index != last_index
  164.         Sound.play_cursor
  165.       end
  166.     end
  167.   end
  168. end
  169. class Window_MenuStatus_Yui < Window_Selectable_Menu
  170.   def initialize(x, y)
  171.     super(x, y, 460, 300)
  172.     self.contents.font.bold = true
  173.     self.contents.font.shadow = true
  174.     self.contents.font.size = 16
  175.     refresh
  176.     self.active = false
  177.     self.index = -1
  178.   end
  179.   def refresh
  180.     self.contents.clear
  181.     @item_max = $game_party.members.size
  182.     for actor in $game_party.members
  183.       if actor.index == 0
  184.       draw_actor_graphic(actor, 172,115)
  185.       draw_actor_name_menu(actor, 120,130)
  186.       draw_actor_level_menu(actor, 90,55)     
  187.       draw_actor_state(actor, 125,110)      
  188.       draw_actor_hp_menu(actor,  90,20)
  189.       draw_actor_mp_menu(actor, 120,45)      
  190.       elsif actor.index == 1
  191.       draw_actor_graphic(actor, 61, 228)
  192.       draw_actor_name_menu(actor, 10, 245)
  193.       draw_actor_level_menu(actor, 0, 165)   
  194.       draw_actor_state(actor, 15, 145)            
  195.       draw_actor_hp_menu(actor,  -15, 130)
  196.       draw_actor_mp_menu(actor, 15, 155)           
  197.       elsif actor.index == 2
  198.       draw_actor_graphic(actor, 290, 228)
  199.       draw_actor_name_menu(actor, 240, 245)   
  200.       draw_actor_level_menu(actor, 225, 165)   
  201.       draw_actor_state(actor, 230, 145)            
  202.       draw_actor_hp_menu(actor,  210, 130)
  203.       draw_actor_mp_menu(actor, 240, 155)        
  204.       end
  205.     end
  206.   end
  207.   def update_cursor
  208.   end
  209. end
  210. class Window_Mapname < Window_Base
  211.   def initialize(x, y)
  212.     super(x, y, 160, WLH + 32)
  213.     self.contents.font.bold = true
  214.     self.contents.font.size = 16   
  215.     refresh
  216.   end  
  217. def refresh
  218.     self.contents.clear
  219.     self.contents.font.color = normal_color
  220.     self.contents.draw_text(4, 0, 120, 30, $game_map.mpname.to_s, 1)
  221. end
  222. end
  223. class Window_Gold_Menu < Window_Base
  224.   def initialize(x, y)
  225.     super(x, y, 160, WLH + 32)
  226.     self.contents.font.bold = true
  227.     self.contents.font.size = 16
  228.     self.contents.font.color = power_up_color   
  229.     refresh
  230.   end
  231.   def refresh
  232.     self.contents.clear
  233.     draw_currency_value_menu($game_party.gold, 10, 0, 120)
  234.   end
  235. end
  236. class Window_Time < Window_Base
  237.   def initialize(x, y)
  238.     super(x, y, 160, WLH + 32)
  239.     self.contents.font.bold = true
  240.     self.contents.font.size = 16
  241.     self.contents.font.color = power_up_color
  242.     refresh
  243.   end
  244.   def refresh
  245.     self.contents.clear
  246.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  247.     hour = @total_sec / 60 / 60
  248.     min = @total_sec / 60 % 60
  249.     sec = @total_sec % 60
  250.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  251.     self.contents.draw_text(4, 0, 120, 32,  text, 2)
  252. end
  253.   def update
  254.     super
  255.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  256.       refresh
  257.     end
  258.   end
  259. end
  260. class Scene_Menu   
  261.   def main
  262.     start                        
  263.     perform_transition            
  264.     Input.update                 
  265.     loop do
  266.       Graphics.update            
  267.       Input.update              
  268.       update                     
  269.       break if $scene != self      
  270.     end
  271.     Graphics.update
  272.     pre_terminate            
  273.     Graphics.freeze               
  274.     terminate                  
  275.   end  
  276.   def initialize(menu_index = 0)
  277.     @menu_index = menu_index
  278.   end  
  279.   def perform_transition
  280.     Graphics.transition(10, "Graphics/System/BattleStart", 80)     
  281.   end
  282.   def start
  283.     @menu_back = Plane.new   
  284.     @menu_back.bitmap = Cache.menu("Background")
  285.     @menu_layout = Sprite.new  
  286.     @menu_layout.bitmap = Cache.menu("EanBack")
  287.     @menu_com = Sprite.new  
  288.     @menu_com.bitmap = Cache.menu("选项底色")
  289.     @menu_select = Sprite.new  
  290.     @menu_select.bitmap = Cache.menu("底盘")
  291.     create_command_window
  292.     @gold_window = Window_Gold_Menu.new(305,348)
  293.     @status_window = Window_MenuStatus_Yui.new(100, 60)
  294.     @playtime_window = Window_Time .new(160,345)
  295.     @mapname_window = Window_Mapname.new(20,345)
  296.     @status_window.opacity = 0
  297.     @playtime_window.opacity = 0
  298.     @mapname_window.opacity = 0
  299.     @gold_window.opacity = 0   
  300.   end
  301.   def pre_terminate
  302.   end  
  303.   def terminate
  304.     @menu_back.dispose
  305.     @menu_layout.dispose
  306.     @menu_com.dispose
  307.     @menu_select.dispose
  308.     @command_window.dispose
  309.     @gold_window.dispose
  310.     @status_window.dispose
  311.     @playtime_window.dispose
  312.     @mapname_window.dispose
  313.   end
  314.   def update
  315.     @menu_back.ox += 1
  316.     @command_window.update
  317.     @gold_window.update
  318.     @status_window.update
  319.     @mapname_window.update
  320.     @playtime_window.update
  321.     if @command_window.active
  322.       update_command_selection
  323.     elsif @status_window.active
  324.       update_actor_selection
  325.     end
  326.   end
  327.   def create_command_window
  328.     s1 = Vocab::item
  329.     s2 = Vocab::skill
  330.     s3 = Vocab::equip
  331.     s4 = Vocab::status
  332.     s5 = Vocab::save
  333.     s6 = "任务"
  334.     s7 = "Magic shop"
  335.     s8 = "技能分配"
  336.     s9 = Vocab::game_end
  337.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
  338.     @command_window.index = @menu_index
  339.     @command_window.openness = 0
  340.     @command_window.open
  341.     @command_window.opacity = 0
  342.     @command_window.contents_opacity = 0
  343.     if $game_system.save_disabled              
  344.       @command_window.draw_item(4, false)     
  345.     end
  346.   end
  347.   def update_command_selection   
  348.      case @command_window.index
  349.      when 0
  350.     @menu_com.bitmap = Cache.menu("物品")
  351.      when 1
  352.     @menu_com.bitmap = Cache.menu("技能")
  353.      when 2
  354.     @menu_com.bitmap = Cache.menu("装备")
  355.      when 3
  356.     @menu_com.bitmap = Cache.menu("状态")
  357.      when 4
  358.     @menu_com.bitmap = Cache.menu("存档")
  359.      when 5
  360.     @menu_com.bitmap = Cache.menu("任务")
  361.      when 6
  362.     @menu_com.bitmap = Cache.menu("魔法商店")
  363.      when 7
  364.     @menu_com.bitmap = Cache.menu("加点")
  365.      when 8
  366.     @menu_com.bitmap = Cache.menu("退出")
  367.     end         
  368.     if Input.trigger?(Input::B)
  369.       Sound.play_cancel
  370.       $scene = Scene_Map.new
  371.     elsif Input.trigger?(Input::C)
  372.       if $game_party.members.size == 0 and @command_window.index < 4
  373.         Sound.play_buzzer
  374.         return
  375.       elsif $game_system.save_disabled and @command_window.index == 4
  376.         Sound.play_buzzer
  377.         return
  378.       end
  379.       Sound.play_decision
  380.       case @command_window.index
  381.       when 0      
  382.         $scene = Scene_Item.new
  383.       when 1,2,3   
  384.         start_actor_selection
  385.       when 4      
  386.         $scene = Scene_File.new(true, false, false)
  387.       when 5     
  388.         $scene = Scene_Task.new
  389.       when 6
  390.         $skill_shop = [1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
  391.         $scene = Scene_Skill_Shop.new
  392.       when 7
  393.         $scene = Scene_Lvup.new(0)
  394.       when 8
  395.         $scene = Scene_End.new
  396.       end
  397.     end
  398.   end
  399.   def start_actor_selection
  400.     @command_window.active = false
  401.     @status_window.active = true
  402.     if $game_party.last_actor_index < @status_window.item_max
  403.       @status_window.index = $game_party.last_actor_index
  404.     else
  405.       @status_window.index = 0
  406.     end
  407.   end
  408.   def end_actor_selection
  409.     @command_window.active = true
  410.     @status_window.active = false
  411.     @menu_select.bitmap = Cache.menu("底盘")
  412.     @status_window.index = -1
  413.   end
  414.   def update_actor_selection   
  415.      case @status_window.index
  416.      when 0
  417.     @menu_select.bitmap = Cache.menu("底盘1")
  418.      when 1
  419.     @menu_select.bitmap = Cache.menu("底盘2")
  420.      when 2
  421.     @menu_select.bitmap = Cache.menu("底盘3")
  422.     end
  423.     if Input.trigger?(Input::B)
  424.       Sound.play_cancel
  425.       end_actor_selection
  426.     elsif Input.trigger?(Input::C)
  427.       $game_party.last_actor_index = @status_window.index
  428.       Sound.play_decision
  429.       case @command_window.index
  430.       when 1
  431.         $scene = Scene_Skill.new(@status_window.index)
  432.       when 2   
  433.         $scene = Scene_Equip.new(@status_window.index)
  434.       when 3  
  435.         $scene = Scene_Status.new(@status_window.index)
  436.       end
  437.     end
  438.   end
  439. end
  440. $mogscript = {} if $mogscript == nil
  441. $mogscript["menu_yui"] = true
复制代码



谁能把改成4个人,,,,,
代码地址如下
http://u.115.com/file/clnmywch


liyikunl于2011-7-17 15:07补充以下内容:
求解啊。。。。。。不会来的都是下代码的吧。。。。。。。。。。。


liyikunl于2011-7-17 16:04补充以下内容:
求人不如求己,自己改了。。。。。。。
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2025-1-11 00:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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