查看: 5106|回复: 6

[原创发布] 自己写的一个菜单界面的美化脚本

[复制链接]
梦石
0
星屑
129
在线时间
219 小时
注册时间
2011-1-19
回帖
92
发表于 2015-8-4 14:18:13 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 xingxing991219 于 2015-8-4 14:21 编辑

嗯……第一次正儿八经地写一个脚本,第一次在发布区发布我的作品,心情还是很激动很忐忑的{:2_285:}
其实说这是我写的吧,也不完全算是,基本上还是用默认脚本改的,另外Window_Base类中几个新方法的定义也是引用了其他大神的脚本里的内容。总共改动了9个类,Game一个,Window4个,Scene4个,主要是对Scene_Menu类和Window_MenuStatus类的改写。可能在高手看来,真的好蠢好蠢……不过看在我是第一次的份上,就宽容一下嘛{:2_251:} 希望可以给我提出一些宝贵意见,不论是脚本结构方面、算法方面和效果方面,都可以尽情地提出来,如果发现什么bug,也希望可以第一时间告诉我~
下面放出效果截图、代码内容和范例工程(范例工程里什么也没做,只是放了几张头像图而已。。头像图来自66rpg整合素材包,不会告我侵权吧= =)

另外,注释里写的by 飞云,飞云就是我啦…………只不过当时注册论坛号的时候不知道可以打中文,只好用xingxing991219,现在知道了也没法改= =很郁闷的说,其实飞云才是我的真正艺名~_~

好吧,就扯这么多。

  1. #==============================================================
  2. # 菜单界面大调整脚本   by 飞云
  3. #==============================================================
  4. # 本脚本大幅度调整了Esc菜单界面的结构,窗口为半透明状态,各文字内容
  5. # 可在下方修改,具体对应关系可在游戏测试中查看。
  6. #
  7. # 本脚本兼容性较差,重新定义了Scene_Menu脚本的大部分方法,如果您
  8. # 使用了其他修改菜单界面的脚本,请慎重使用本脚本,如有冲突,请自
  9. # 行整合。
  10. #
  11. # 使用方法:将全部内容插入到Main上方,并在Graphics目录下新建一个
  12. # Heads文件夹,将头像文件放入,格式为Actorx.png(注:x为该角色在数
  13. # 据库内的编号,1、2、3、4……11、12、13…… 比如一号角色的头像文件名
  14. # 为Actor001,二十号角色的头像文件名为Actor020,128号角色的头像文
  15. # 件名为Actor128,如果序号超过999,请自行修改脚本= =)
  16. #
  17. # 转载和使用请保留本信息,谢谢合作!
  18. #
  19. # (已知本脚本不与柳柳大人的技能分类脚本、小翼的值槽脚本冲突,其他
  20. # 脚本一概请大家自行测试,带来的不便请谅解~)

  21. # 菜单栏选项文字
  22. ITEM = "查看背包"
  23. SKILL = "功夫武学"
  24. EQUIP = "更换装备"
  25. STATUS = "角色状态"
  26. SAVE = "保存记录"
  27. EXIT = "离开游戏"
  28. # 金钱窗口的标题
  29. GOLD = "银两"
  30. # 等级的前缀,如Lv  Lv.  Level等
  31. LEVEL = "等级"

  32. class Game_Actor
  33.   #--------------------------------------------------------------------------
  34.   # ★ 2个 EXP 字符串函数 by 小翼 [FDU]alwing
  35.   #--------------------------------------------------------------------------
  36.   def now_exp
  37.     return @exp - @exp_list[@level]
  38.   end
  39.   def next_exp
  40.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  41.         end
  42. end
  43. class Window_Base < Window
  44.   #--------------------------------------------------------------------------
  45.   # ★ 获取文字色 by 小翼 [FDU]alwing WOW
  46.   #     n : 颜色编号
  47.   #--------------------------------------------------------------------------
  48.   def rec_color(n)
  49.     case n
  50.     # 蓝色
  51.     when 0
  52.       return Color.new(0, 16, 65, 255)
  53.     when 1
  54.       return Color.new(0, 40, 160, 255)
  55.     when 2
  56.       return Color.new(0, 54, 215, 255)
  57.     when 3
  58.       return Color.new(0, 49, 195, 255)
  59.     when 4
  60.       return Color.new(0, 41, 165, 255)
  61.     when 5
  62.       return Color.new(0, 35, 140, 255)
  63.     when 6
  64.       return Color.new(0, 26, 105, 255)
  65.     when 7
  66.       return Color.new(0, 10, 40, 255)
  67.     # 橙色
  68.     when 10
  69.       return Color.new(65, 32, 0, 255)
  70.     when 11
  71.       return Color.new(160, 80, 0, 255)
  72.     when 12
  73.       return Color.new(215, 107, 0, 255)
  74.     when 13
  75.       return Color.new(195, 97, 0, 255)
  76.     when 14
  77.       return Color.new(165, 82, 0, 255)
  78.     when 15
  79.       return Color.new(140, 70, 0, 255)
  80.     when 16
  81.       return Color.new(105, 52, 0, 255)
  82.     when 17
  83.       return Color.new(40, 20, 0, 255)
  84.     # 青色
  85.     when 20
  86.       return Color.new(0, 65, 65, 255)
  87.     when 21
  88.       return Color.new(0, 160, 160, 255)
  89.     when 22
  90.       return Color.new(0, 215, 215, 255)
  91.     when 23
  92.       return Color.new(0, 195, 195, 255)
  93.     when 24
  94.       return Color.new(0, 165, 165, 255)
  95.     when 25
  96.       return Color.new(0, 140, 140, 255)
  97.     when 26
  98.       return Color.new(0, 105, 105, 255)
  99.     when 27
  100.       return Color.new(0, 40, 40, 255)
  101.     # 紫红
  102.     when 30
  103.       return Color.new(65, 0, 32, 255)
  104.     when 31
  105.       return Color.new(160, 0, 80, 255)
  106.     when 32
  107.       return Color.new(215, 0, 107, 255)
  108.     when 33
  109.       return Color.new(195, 0, 97, 255)
  110.     when 34
  111.       return Color.new(165, 0, 82, 255)
  112.     when 35
  113.       return Color.new(140, 0, 70, 255)
  114.     when 36
  115.       return Color.new(105, 0, 52, 255)
  116.     when 37
  117.       return Color.new(40, 0, 20, 255)
  118.     end
  119.   end
  120. #--------------------------------------------------------------------------
  121.   # ● 职业的描绘
  122.   #     actor : 角色
  123.   #     x     : 描画目标 X 坐标
  124.   #     y     : 描画目标 Y 坐标
  125.   #--------------------------------------------------------------------------
  126.   def draw_actor_class(actor, x, y)
  127.     self.contents.font.color = normal_color
  128.     self.contents.draw_text(x, y, 236, 32, "[" + actor.class_name + "]")
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 描画 EXP ★主菜单
  132.   #     actor : 角色
  133.   #     x     : 描画目标 X 坐标
  134.   #     y     : 描画目标 Y 坐标
  135.   #--------------------------------------------------------------------------
  136.   def draw_actor_exp(actor, x, y)
  137.     self.contents.font.size = 20
  138.     self.contents.font.color = system_color
  139.     self.contents.draw_text(x+1, y, 80, 32, "EXP")
  140.     self.contents.font.color = normal_color
  141.     self.contents.draw_text(x - 10 , y, 84, 32, actor.exp_s, 2)
  142.     self.contents.draw_text(x + 74, y, 12, 32, "/", 1)
  143.     self.contents.draw_text(x + 88, y, 84, 32, actor.next_exp_s)
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 描画 EXP ★状态窗口
  147.   #     actor : 角色
  148.   #     x     : 描画目标 X 坐标
  149.   #     y     : 描画目标 Y 坐标
  150.   #--------------------------------------------------------------------------
  151.   def draw_actor_exp_status(actor, x, y)
  152.     self.contents.font.size = 20
  153.     self.contents.font.color = system_color
  154.     self.contents.draw_text(x+1, y, 80, 32, "EXP")
  155.     self.contents.font.color = normal_color
  156.     self.contents.draw_text(x + 108, y, 84, 32, actor.exp_s, 2)
  157.     self.contents.draw_text(x + 192, y, 12, 32, "/", 1)
  158.     self.contents.draw_text(x + 204, y, 84, 32, actor.next_exp_s)
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ★ 描绘 EXP 矩形 by 小翼 [FDU]alwing
  162.   #     actor : 角色
  163.   #     x     : 描画目标 X 坐标
  164.   #     y     : 描画目标 Y 坐标
  165.   #     width : 描画目标的宽
  166.   #--------------------------------------------------------------------------
  167.   def EXP(actor,x,y,width = 128)
  168.     self.contents.fill_rect(x+26, y+60, width+4,9, Color.new(0,0,0,255))
  169.     self.contents.fill_rect(x+27, y+61, width+2,7, Color.new(255,255,255,255))
  170.     self.contents.fill_rect(x+28, y+62, width,5, Color.new(0,0,0,255))
  171.     if actor.next_exp > 0
  172.       @EXPw = width * actor.now_exp/actor.next_exp
  173.       self.contents.fill_rect(x+28, y+62, @EXPw,1, Color.new(100,50,150,255))
  174.       self.contents.fill_rect(x+28, y+63, @EXPw,1, Color.new(150,100,200,255))
  175.       self.contents.fill_rect(x+28, y+64, @EXPw,1, Color.new(200,150,255,255))
  176.       self.contents.fill_rect(x+28, y+65, @EXPw,1, Color.new(150,100,200,255))
  177.       self.contents.fill_rect(x+28, y+66, @EXPw,1, Color.new(100,50,150,255))
  178.     else
  179.       self.contents.fill_rect(x+28, y+62, width,1, Color.new(50,150,150,255))
  180.       self.contents.fill_rect(x+28, y+63, width,1, Color.new(100,200,200,255))
  181.       self.contents.fill_rect(x+28, y+64, width,1, Color.new(150,255,255,255))
  182.       self.contents.fill_rect(x+28, y+65, width,1, Color.new(100,200,200,255))
  183.       self.contents.fill_rect(x+28, y+66, width,1, Color.new(50,150,150,255))
  184.     end
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 描绘 HP
  188.   #     actor : 角色
  189.   #     x     : 描画目标 X 坐标
  190.   #     y     : 描画目标 Y 坐标
  191.   #     width : 描画目标的宽
  192.   #--------------------------------------------------------------------------
  193.   def draw_actor_hp(actor, x, y, width = 144)
  194.     # 描绘字符串 "HP"
  195.     self.contents.font.color = system_color
  196.     self.contents.font.size = 20
  197.     self.contents.draw_text(x+16, y, 32, 32, "体")
  198.     # 计算描绘 MaxHP 所需的空间
  199.     if width - 32 >= 108
  200.       hp_x = x + width - 108
  201.       flag = true
  202.     elsif width - 32 >= 48
  203.       hp_x = x + width - 48
  204.       flag = false
  205.     end
  206.     # 描绘 HP
  207.     if flag
  208.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  209.         actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  210.       self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  211.     else
  212.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  213.         actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  214.       self.contents.draw_text(hp_x-36, y, 48, 32, actor.hp.to_s, 0)
  215.     end
  216.     # 描绘 MaxHP
  217.     if flag
  218.       self.contents.font.color = normal_color
  219.       self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  220.       self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  221.     else
  222.       self.contents.font.color = normal_color
  223.       self.contents.draw_text(hp_x, y, 12, 32, "/", 1)
  224.       self.contents.draw_text(hp_x + 12, y, 48, 32, actor.maxhp.to_s)
  225.     end
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 描绘 SP
  229.   #     actor : 角色
  230.   #     x     : 描画目标 X 坐标
  231.   #     y     : 描画目标 Y 坐标
  232.   #     width : 描画目标的宽
  233.   #--------------------------------------------------------------------------
  234.   def draw_actor_sp(actor, x, y, width = 144)
  235.     # 描绘字符串 "SP"
  236.     self.contents.font.color = system_color
  237.     self.contents.draw_text(x+16, y, 32, 32, "气")
  238.     # 计算描绘 MaxSP 所需的空间
  239.     if width - 32 >= 108
  240.       sp_x = x + width - 108
  241.       flag = true
  242.     elsif width - 32 >= 48
  243.       sp_x = x + width - 48
  244.       flag = false
  245.     end
  246.     # 描绘 SP
  247.     if flag
  248.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  249.         actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  250.       self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  251.     else
  252.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  253.         actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  254.       self.contents.draw_text(sp_x-36, y, 48, 32, actor.sp.to_s, 0)
  255.     end
  256.     # 描绘 MaxSP
  257.     if flag
  258.       self.contents.font.color = normal_color
  259.       self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  260.       self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  261.     else
  262.       self.contents.font.color = normal_color
  263.       self.contents.draw_text(sp_x, y, 12, 32, "/", 1)
  264.       self.contents.draw_text(sp_x + 12, y, 48, 32, actor.maxsp.to_s)
  265.     end
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 描绘能力值
  269.   #     actor : 角色
  270.   #     x     : 描画目标 X 坐标
  271.   #     y     : 描画目标 Y 坐标
  272.   #     type  : 能力值种类 (0~6)
  273.   #--------------------------------------------------------------------------
  274.   def draw_actor_parameter(actor, x, y, type)
  275.     case type
  276.     when 0
  277.       parameter_name = $data_system.words.atk
  278.       parameter_value = actor.atk
  279.     when 1
  280.       parameter_name = $data_system.words.pdef
  281.       parameter_value = actor.pdef
  282.     when 2
  283.       parameter_name = $data_system.words.mdef
  284.       parameter_value = actor.mdef
  285.     when 3
  286.       parameter_name = $data_system.words.str
  287.       parameter_value = actor.str
  288.     when 4
  289.       parameter_name = $data_system.words.dex
  290.       parameter_value = actor.dex
  291.     when 5
  292.       parameter_name = $data_system.words.agi
  293.       parameter_value = actor.agi
  294.     when 6
  295.       parameter_name = $data_system.words.int
  296.       parameter_value = actor.int
  297.     end
  298.     self.contents.font.color = system_color
  299.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  300.     self.contents.font.color = normal_color
  301.     self.contents.draw_text(x + 160, y, 36, 32, parameter_value.to_s, 2)
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 描绘能力值 ★装备窗口
  305.   #     actor : 角色
  306.   #     x     : 描画目标 X 坐标
  307.   #     y     : 描画目标 Y 坐标
  308.   #     type  : 能力值种类 (0~6)
  309.   #--------------------------------------------------------------------------
  310.   def draw_actor_parameter_equip(actor, x, y, type)
  311.     case type
  312.     when 0
  313.       parameter_name = $data_system.words.atk
  314.       parameter_value = actor.atk
  315.     when 1
  316.       parameter_name = $data_system.words.pdef
  317.       parameter_value = actor.pdef
  318.     when 2
  319.       parameter_name = $data_system.words.mdef
  320.       parameter_value = actor.mdef
  321.     when 3
  322.       parameter_name = $data_system.words.str
  323.       parameter_value = actor.str
  324.     when 4
  325.       parameter_name = $data_system.words.dex
  326.       parameter_value = actor.dex
  327.     when 5
  328.       parameter_name = $data_system.words.agi
  329.       parameter_value = actor.agi
  330.     when 6
  331.       parameter_name = $data_system.words.int
  332.       parameter_value = actor.int
  333.     end
  334.     self.contents.font.color = system_color
  335.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  336.     self.contents.font.color = normal_color
  337.     self.contents.draw_text(x + 196, y, 36, 32, parameter_value.to_s, 2)
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● 描绘物品名
  341.   #     item : 物品
  342.   #     x    : 描画目标 X 坐标
  343.   #     y    : 描画目标 Y 坐标
  344.   #--------------------------------------------------------------------------
  345.   def draw_item_name(item, x, y)
  346.     if item == nil
  347.       return
  348.     end
  349.     bitmap = RPG::Cache.icon(item.icon_name)
  350.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  351.     self.contents.font.color = normal_color
  352.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  353.   end
  354.         #--------------------------------------------------------------------------
  355.   # ● 等级的描绘
  356.   #     actor : 角色
  357.   #     x     : 描画目标 X 坐标
  358.   #     y     : 描画目标 Y 坐标
  359.   #--------------------------------------------------------------------------
  360.   def draw_actor_level(actor, x, y)
  361.     self.contents.font.color = system_color
  362.     self.contents.draw_text(x, y, 64, 32, LEVEL)
  363.     self.contents.font.color = normal_color
  364.     self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  365.   end

  366.   #--------------------------------------------------------------------------
  367.   # ★ 描绘 HP 矩形 by 小翼 [FDU]alwing
  368.   #     actor : 角色
  369.   #     x     : 描画目标 X 坐标
  370.   #     y     : 描画目标 Y 坐标
  371.   #     width : 描画目标的宽
  372.   #--------------------------------------------------------------------------
  373.   # HP定义
  374.   def HP(actor,x,y,width=96)
  375.     #底色定义
  376.     self.contents.fill_rect(x+26, y+13, width+4,12, Color.new(0,0,0,255))
  377.     self.contents.fill_rect(x+27, y+14, width+2,10, Color.new(255,255,255,255))
  378.     self.contents.fill_rect(x+28, y+15, width,8, Color.new(0,0,0,255))
  379.     #HP宽度定义
  380.     @HPw = width * actor.hp/actor.maxhp
  381.     #中
  382.     if actor.hp > actor.maxhp/2
  383.       @HPcg0 = 65
  384.       @HPcg1 = 160
  385.       @HPcg2 = 215
  386.       @HPcg3 = 195
  387.       @HPcg4 = 165
  388.       @HPcg5 = 140
  389.       @HPcg6 = 105
  390.       @HPcg7 = 40
  391.       @HPcr0 = 65 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  392.       @HPcr1 = 160 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  393.       @HPcr2 = 215 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  394.       @HPcr3 = 195 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  395.       @HPcr4 = 165 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  396.       @HPcr5 = 140 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  397.       @HPcr6 = 105 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  398.       @HPcr7 = 40 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  399.     else
  400.       @HPcr0 = 65
  401.       @HPcr1 = 160
  402.       @HPcr2 = 215
  403.       @HPcr3 = 195
  404.       @HPcr4 = 165
  405.       @HPcr5 = 140
  406.       @HPcr6 = 105
  407.       @HPcr7 = 40
  408.       @HPcg0 = 65 * actor.hp/(actor.maxhp/2)
  409.       @HPcg1 = 160 * actor.hp/(actor.maxhp/2)
  410.       @HPcg2 = 215 * actor.hp/(actor.maxhp/2)
  411.       @HPcg3 = 195 * actor.hp/(actor.maxhp/2)
  412.       @HPcg4 = 165 * actor.hp/(actor.maxhp/2)
  413.       @HPcg5 = 140 * actor.hp/(actor.maxhp/2)
  414.       @HPcg6 = 105 * actor.hp/(actor.maxhp/2)
  415.       @HPcg7 = 40 * actor.hp/(actor.maxhp/2)
  416.     end
  417.     #HP条定义
  418.     self.contents.fill_rect(x+28, y+15, @HPw,1, Color.new(@HPcr0,@HPcg0,0,255))
  419.     self.contents.fill_rect(x+28, y+16, @HPw,1, Color.new(@HPcr1,@HPcg1,0,255))
  420.     self.contents.fill_rect(x+28, y+17, @HPw,1, Color.new(@HPcr2,@HPcg2,0,255))
  421.     self.contents.fill_rect(x+28, y+18, @HPw,1, Color.new(@HPcr3,@HPcg3,0,255))
  422.     self.contents.fill_rect(x+28, y+19, @HPw,1, Color.new(@HPcr4,@HPcg4,0,255))
  423.     self.contents.fill_rect(x+28, y+20, @HPw,1, Color.new(@HPcr5,@HPcg5,0,255))
  424.     self.contents.fill_rect(x+28, y+21, @HPw,1, Color.new(@HPcr6,@HPcg6,0,255))
  425.     self.contents.fill_rect(x+28, y+22, @HPw,1, Color.new(@HPcr7,@HPcg7,0,255))
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # ★ 描绘 SP 矩形 by 小翼 [FDU]alwing
  429.   #     actor : 角色
  430.   #     x     : 描画目标 X 坐标
  431.   #     y     : 描画目标 Y 坐标
  432.   #     width : 描画目标的宽
  433.   #--------------------------------------------------------------------------
  434.   def MP(actor,x,y,width=96)
  435.     self.contents.fill_rect(x+26, y+45, width+4,12, Color.new(0,0,0,255))
  436.     self.contents.fill_rect(x+27, y+46, width+2,10, Color.new(255,255,255,255))
  437.     self.contents.fill_rect(x+28, y+47, width,8, Color.new(0,0,0,255))
  438.     @MPw = width * actor.sp/actor.maxsp
  439.     self.contents.fill_rect(x+28, y+47, @MPw,1, rec_color(0))
  440.     self.contents.fill_rect(x+28, y+48, @MPw,1, rec_color(1))
  441.     self.contents.fill_rect(x+28, y+49, @MPw,1, rec_color(2))
  442.     self.contents.fill_rect(x+28, y+50, @MPw,1, rec_color(3))
  443.     self.contents.fill_rect(x+28, y+51, @MPw,1, rec_color(4))
  444.     self.contents.fill_rect(x+28, y+52, @MPw,1, rec_color(5))
  445.     self.contents.fill_rect(x+28, y+53, @MPw,1, rec_color(6))
  446.     self.contents.fill_rect(x+28, y+54, @MPw,1, rec_color(7))
  447.   end
  448. end

  449. class Window_Gold < Window_Base
  450.   #--------------------------------------------------------------------------
  451.   # ● 初始化对像
  452.   #--------------------------------------------------------------------------
  453.   def initialize
  454.     super(0, 0, 160, 96)
  455.     self.contents = Bitmap.new(width - 32, height - 32)
  456.     refresh
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ● 刷新
  460.   #--------------------------------------------------------------------------
  461.   def refresh
  462.     self.contents.clear
  463.     self.contents.font.color = system_color
  464.     self.contents.draw_text(4, 0, 120, 32, GOLD)
  465.                  self.contents.font.color = normal_color
  466.     self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s)
  467.     self.contents.font.color = system_color
  468.     self.contents.draw_text(4, 32, 120, 32, $data_system.words.gold, 2)
  469.   end
  470. end

  471. class Window_MenuList < Window_Selectable
  472.   #--------------------------------------------------------------------------
  473.   # ● 初始化对像
  474.   #     width    : 窗口的宽
  475.   #     commands : 命令字符串序列
  476.   #--------------------------------------------------------------------------
  477.   def initialize(width, commands)
  478.     # 由命令的个数计算出窗口的高
  479.     super(0, 0, 480, 96)
  480.     @item_max = commands.size
  481.     @commands = [ITEM, SKILL, EQUIP, STATUS, SAVE, EXIT]
  482.     self.contents = Bitmap.new(width - 32, 64)
  483.     refresh
  484.     self.index = 0
  485.                  @column_max = 3
  486.   end
  487.   #--------------------------------------------------------------------------
  488.   # ● 刷新
  489.   #--------------------------------------------------------------------------
  490.   def refresh
  491.     self.contents.clear
  492.     for i in 0...@item_max
  493.       draw_item(i, normal_color)
  494.     end
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ● 描绘项目
  498.   #     index : 项目编号
  499.   #     color : 文字色
  500.   #--------------------------------------------------------------------------
  501.   def draw_item(index, color)
  502.     self.contents.font.color = color
  503.                  if index >= 0 && index <= 2
  504.                         rect = Rect.new(160 * index + 4, 0, self.contents.width - 8, 32)
  505.                 elsif index >= 3 && index <= 5
  506.                         rect = Rect.new(160 * (index - 3) + 4, 32, self.contents.width - 8, 32)
  507.                 end
  508.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  509.     self.contents.draw_text(rect, @commands[index])
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ● 项目无效化
  513.   #     index : 项目编号
  514.   #--------------------------------------------------------------------------
  515.   def disable_item(index)
  516.     draw_item(index, disabled_color)
  517.   end
  518. end
  519. class Window_MenuStatus < Window_Selectable
  520.   #--------------------------------------------------------------------------
  521.   # ● 初始化目标   #actor_id: 角色编号 (0号为第一个角色,依此类推)
  522.   #--------------------------------------------------------------------------
  523.   def initialize(actor_id)
  524.     super(0, 0, 160, 384)
  525.                  @actor_id = actor_id
  526.     self.contents = Bitmap.new(width - 32, height - 32)
  527.     refresh
  528.     self.active = false
  529.     self.index = -1
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # ● 刷新
  533.   #--------------------------------------------------------------------------
  534.   def refresh
  535.     self.contents.clear
  536.     @item_max = 1
  537.                  actor = $game_party.actors[@actor_id]
  538.                   #------------------------------------------------------------------------
  539.       # ★ 头像调用
  540.                 #------------------------------------------------------------------------
  541.                 if actor.id < 10
  542.                         testname = "Actor00"+actor.id.to_s
  543.                 elsif actor.id >= 10 && actor.id < 100
  544.                         testname = "Actor0"+ actor.id.to_s
  545.                 elsif actor.id >= 100 && actor.id <= 999
  546.                         testname = "Actor" + actor.id.to_s
  547.                 end
  548.     bitmap = Bitmap.new("Graphics/Heads/#{testname}")
  549.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  550.                 self.contents.blt(14, y + 10, bitmap, src_rect)
  551.                 draw_actor_name(actor, 22, 115)
  552.                 HP(actor, 0, 200)
  553.                 MP(actor, 0, 214)
  554.                 draw_actor_hp(actor, 0, 180)
  555.                 draw_actor_sp(actor, 0, 227)
  556.                 EXP(actor, 0, 238, 96)
  557.                 draw_actor_exp(actor, 10, 270)
  558.                 draw_actor_level(actor, 36, 315)
  559.                  #$game_party.actors.size
  560.     #for i in 0...$game_party.actors.size
  561.       #x = 64
  562.       #y = 116
  563.       #actor = $game_party.actors[@actor_id]
  564.       #draw_actor_graphic(actor, x - 40, y + 80)
  565.       #draw_actor_name(actor, x, y)
  566.       draw_actor_class(actor, 22,115 + 32)#x + 144, y)
  567.       #draw_actor_level(actor, x, y + 32)
  568.       #draw_actor_state(actor, 22, 180)#x + 90, y + 32)
  569.       #draw_actor_exp(actor, x, y + 64)
  570.       #draw_actor_hp(actor, x + 236, y + 32)
  571.       #draw_actor_sp(actor, x + 236, y + 64)
  572.     #end
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● 刷新光标矩形
  576.   #--------------------------------------------------------------------------
  577.   def update_cursor_rect
  578.     if @index < 0
  579.       self.cursor_rect.empty
  580.     else
  581.       self.cursor_rect.set(0, @index * 116, self.width - 32, self.height - 32)
  582.     end
  583.   end
  584. end

  585. class Scene_Menu
  586.   #--------------------------------------------------------------------------
  587.   # ● 主处理
  588.   #--------------------------------------------------------------------------
  589.   def main
  590.                  @status_index = 0
  591.                  @spriteset = Spriteset_Map.new
  592.     # 生成命令窗口
  593.     s1 = ITEM
  594.     s2 = SKILL
  595.     s3 = EQUIP
  596.     s4 = STATUS
  597.     s5 = SAVE
  598.     s6 = EXIT
  599.     @command_window = Window_MenuList.new(480, [s1, s2, s3, s4, s5, s6])
  600.     @command_window.index = @menu_index
  601.                  @command_window.opacity = 160
  602.                  #@command_window.height = 196
  603.     # 同伴人数为 0 的情况下
  604.     if $game_party.actors.size == 0
  605.       # 物品、特技、装备、状态无效化
  606.       @command_window.disable_item(0)
  607.       @command_window.disable_item(1)
  608.       @command_window.disable_item(2)
  609.       @command_window.disable_item(3)
  610.     end
  611.     # 禁止存档的情况下
  612.     if $game_system.save_disabled
  613.       # 存档无效
  614.       @command_window.disable_item(4)
  615.     end
  616.     # 生成金钱窗口
  617.     @gold_window = Window_Gold.new
  618.     @gold_window.x = 480
  619.     @gold_window.y = 0
  620.                  @gold_window.opacity = 160
  621.     # 生成状态窗口
  622.                 @status_window = []
  623.                  for i in 0...$game_party.actors.size
  624.       @status_window[i] = Window_MenuStatus.new(i)
  625.       @status_window[i].x = 160 * i
  626.       @status_window[i].y = 96
  627.                         @status_window[i].opacity = 160
  628.                         end
  629.     # 执行过渡
  630.     Graphics.transition
  631.     # 主循环
  632.     loop do
  633.       # 刷新游戏画面
  634.       Graphics.update
  635.       # 刷新输入信息
  636.       Input.update
  637.       # 刷新画面
  638.       update
  639.       # 如果切换画面就中断循环
  640.       if $scene != self
  641.         break
  642.       end
  643.     end
  644.     # 准备过渡
  645.     Graphics.freeze
  646.     # 释放窗口
  647.     @command_window.dispose
  648.     @gold_window.dispose
  649.                 for i in 0...$game_party.actors.size
  650.                         @status_window[i].dispose
  651.                 end
  652.   end
  653.          #--------------------------------------------------------------------------
  654.   # ● 刷新画面
  655.   #--------------------------------------------------------------------------
  656.   def update
  657.     # 刷新窗口
  658.     @command_window.update
  659.     @gold_window.update
  660.     #@status_window.update
  661.                 for i in 0...$game_party.actors.size
  662.                         @status_window[i].update
  663.                 end
  664.                 if $cancel
  665.                         @command_window.active = false
  666.                         @status_window[$index].active = true
  667.                         @status_window[$index].index = 0
  668.                         @status_index = $index
  669.                         $cancel = false
  670.                 end
  671.     # 命令窗口被激活的情况下: 调用 update_command
  672.     if @command_window.active
  673.       update_command
  674.       return
  675.     end
  676.     # 状态窗口被激活的情况下: 调用 update_status
  677.     if @status_window[@status_index]#@status_window[0].active || @status_window[1].active || @status_window[2].active  || @status_window[3].active
  678.       update_status
  679.       return
  680.                 end
  681.                
  682.   end
  683.           #--------------------------------------------------------------------------
  684.   # ● 刷新画面 (命令窗口被激活的情况下)
  685.   #--------------------------------------------------------------------------
  686.   def update_command
  687.     # 按下 B 键的情况下
  688.     if Input.trigger?(Input::B)
  689.       # 演奏取消 SE
  690.       $game_system.se_play($data_system.cancel_se)
  691.       # 切换的地图画面
  692.       $scene = Scene_Map.new
  693.       return
  694.     end
  695.     # 按下 C 键的情况下
  696.     if Input.trigger?(Input::C)
  697.       # 同伴人数为 0、存档、游戏结束以外的场合
  698.       if $game_party.actors.size == 0 and @command_window.index < 4
  699.         # 演奏冻结 SE
  700.         $game_system.se_play($data_system.buzzer_se)
  701.         return
  702.       end
  703.       # 命令窗口的光标位置分支
  704.       case @command_window.index
  705.       when 0  # 物品
  706.         # 演奏确定 SE
  707.         $game_system.se_play($data_system.decision_se)
  708.         # 切换到物品画面
  709.         $scene = Scene_Item.new
  710.       when 1  # 特技
  711.         # 演奏确定 SE
  712.         $game_system.se_play($data_system.decision_se)
  713.         # 激活状态窗口
  714.         @command_window.active = false
  715.         @status_window[0].active = true
  716.         @status_window[0].index = 0
  717.       when 2  # 装备
  718.         # 演奏确定 SE
  719.         $game_system.se_play($data_system.decision_se)
  720.         # 激活状态窗口
  721.         @command_window.active = false
  722.         @status_window[0].active = true
  723.         @status_window[0].index = 0
  724.       when 3  # 状态
  725.         # 演奏确定 SE
  726.         $game_system.se_play($data_system.decision_se)
  727.         # 激活状态窗口
  728.         @command_window.active = false
  729.         @status_window[0].active = true
  730.         @status_window[0].index = 0
  731.       when 4  # 存档
  732.         # 禁止存档的情况下
  733.         if $game_system.save_disabled
  734.           # 演奏冻结 SE
  735.           $game_system.se_play($data_system.buzzer_se)
  736.           return
  737.         end
  738.         # 演奏确定 SE
  739.         $game_system.se_play($data_system.decision_se)
  740.         # 切换到存档画面
  741.         $scene = Scene_Save.new
  742.       when 5  # 游戏结束
  743.         # 演奏确定 SE
  744.         $game_system.se_play($data_system.decision_se)
  745.         # 切换到游戏结束画面
  746.         $scene = Scene_End.new
  747.       end
  748.       return
  749.     end
  750.   end
  751.   #--------------------------------------------------------------------------
  752.   # ● 刷新画面 (状态窗口被激活的情况下)
  753.   #--------------------------------------------------------------------------
  754.   def update_status
  755.                 #p @status_index
  756.                 #for i in 0..3
  757.                 #        p @status_window[i].active
  758.                 #end
  759.                 for i in 0...$game_party.actors.size
  760.                         @status_window[i].update
  761.                 end

  762.                 if Input.trigger?(Input::LEFT)
  763.                  $game_system.se_play($data_system.cursor_se)
  764.                         if @status_index == 0
  765.                                 @status_index = $game_party.actors.size - 1
  766.                         else
  767.                                 @status_index -= 1
  768.                         end
  769.                 end
  770.                 if Input.trigger?(Input::RIGHT)
  771.      $game_system.se_play($data_system.cursor_se)
  772.                         if @status_index == $game_party.actors.size - 1
  773.                                 @status_index = 0
  774.                         else
  775.                                 @status_index += 1
  776.                         end
  777.                 end
  778.                         case @status_index
  779.                         when 0
  780.                         @status_window[0].active = true
  781.                         @status_window[0].index = 0
  782.                         if $game_party.actors.size >= 2
  783.                                 @status_window[1].active = false
  784.                                 @status_window[1].index = -1
  785.                            if $game_party.actors.size >= 3
  786.                                    @status_window[2].active = false
  787.                                    @status_window[2].index = -1
  788.                               if $game_party.actors.size >= 4
  789.                                       @status_window[3].active = false
  790.                                                    @status_window[3].index = -1
  791.                                            end
  792.                                   end
  793.                         end
  794.                        
  795.                         when 1
  796.                         @status_window[0].active = false
  797.                         @status_window[0].index = -1
  798.                         if $game_party.actors.size >= 2
  799.                                 @status_window[1].active = true
  800.                                 @status_window[1].index = 0
  801.                            if $game_party.actors.size >= 3
  802.                                    @status_window[2].active = false
  803.                                    @status_window[2].index = -1
  804.                               if $game_party.actors.size >= 4
  805.                                       @status_window[3].active = false
  806.                                                    @status_window[3].index = -1
  807.                                            end
  808.                                   end
  809.                         end
  810.                         when 2
  811.                         @status_window[0].active = false
  812.                         @status_window[0].index = -1
  813.                         if $game_party.actors.size >= 2
  814.                                 @status_window[1].active = false
  815.                                 @status_window[1].index = -1
  816.                            if $game_party.actors.size >= 3
  817.                                    @status_window[2].active = true
  818.                                    @status_window[2].index = 0
  819.                               if $game_party.actors.size >= 4
  820.                                       @status_window[3].active = false
  821.                                                    @status_window[3].index = -1
  822.                                            end
  823.                                   end
  824.                         end
  825.                                 @status_window[0].active = false
  826.                                 @status_window[0].index = -1
  827.                                 @status_window[1].active = false
  828.                                 @status_window[1].index = -1
  829.                                 @status_window[2].active = true
  830.                                 @status_window[2].index = 0
  831.                                 @status_window[3].active = false
  832.                                 @status_window[3].index = -1
  833.                         when 3
  834.                         @status_window[0].active = false
  835.                         @status_window[0].index = -1
  836.                         if $game_party.actors.size >= 2
  837.                                 @status_window[1].active = false
  838.                                 @status_window[1].index = -1
  839.                            if $game_party.actors.size >= 3
  840.                                    @status_window[2].active = false
  841.                                    @status_window[2].index = -1
  842.                               if $game_party.actors.size >= 4
  843.                                       @status_window[3].active = true
  844.                                                    @status_window[3].index = 0
  845.                                            end
  846.                                   end
  847.                         end
  848.                 end

  849.     # 按下 B 键的情况下
  850.     if Input.trigger?(Input::B)
  851.       # 演奏取消 SE
  852.       $game_system.se_play($data_system.cancel_se)
  853.       # 激活命令窗口
  854.       @command_window.active = true
  855.       @status_window[@status_index].active = false
  856.       @status_window[@status_index].index = -1
  857.                          @status_index = 0
  858.       return
  859.     end
  860.     # 按下 C 键的情况下
  861.     if Input.trigger?(Input::C)
  862.       # 命令窗口的光标位置分支
  863.       case @command_window.index
  864.       when 1  # 特技
  865.         # 本角色的行动限制在 2 以上的情况下
  866.         if $game_party.actors[@status_index].restriction >= 2
  867.           # 演奏冻结 SE
  868.           $game_system.se_play($data_system.buzzer_se)
  869.           return
  870.         end
  871.         # 演奏确定 SE
  872.         $game_system.se_play($data_system.decision_se)
  873.         # 切换到特技画面
  874.         $scene = Scene_Skill.new(@status_index)#window.index)
  875.       when 2  # 装备
  876.         # 演奏确定 SE
  877.         $game_system.se_play($data_system.decision_se)
  878.         # 切换的装备画面
  879.         $scene = Scene_Equip.new(@status_index)#@status_window.index)
  880.       when 3  # 状态
  881.         # 演奏确定 SE
  882.         $game_system.se_play($data_system.decision_se)
  883.         # 切换到状态画面
  884.         $scene = Scene_Status.new(@status_index)#@status_window.index)
  885.       end
  886.       return
  887.     end
  888.   end
  889. end

  890. class Scene_Skill
  891.   def update_skill
  892.     # 按下 B 键的情况下
  893.                 $cancel = true
  894.                 $index = @actor_index
  895.     if Input.trigger?(Input::B)
  896.       # 演奏取消 SE
  897.       $game_system.se_play($data_system.cancel_se)
  898.       # 切换到菜单画面
  899.       $scene = Scene_Menu.new(1)
  900.       return
  901.     end
  902.     # 按下 C 键的情况下
  903.     if Input.trigger?(Input::C)
  904.       # 获取特技窗口现在选择的特技的数据
  905.       @skill = @skill_window.skill
  906.       # 不能使用的情况下
  907.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  908.         # 演奏冻结 SE
  909.         $game_system.se_play($data_system.buzzer_se)
  910.         return
  911.       end
  912.       # 演奏确定 SE
  913.       $game_system.se_play($data_system.decision_se)
  914.       # 效果范围是我方的情况下
  915.       if @skill.scope >= 3
  916.         # 激活目标窗口
  917.         @skill_window.active = false
  918.         @target_window.x = (@skill_window.index + 1) % 2 * 304
  919.         @target_window.visible = true
  920.         @target_window.active = true
  921.         # 设置效果范围 (单体/全体) 的对应光标位置
  922.         if @skill.scope == 4 || @skill.scope == 6
  923.           @target_window.index = -1
  924.         elsif @skill.scope == 7
  925.           @target_window.index = @actor_index - 10
  926.         else
  927.           @target_window.index = 0
  928.         end
  929.       # 效果在我方以外的情况下
  930.       else
  931.         # 公共事件 ID 有效的情况下
  932.         if @skill.common_event_id > 0
  933.           # 预约调用公共事件
  934.           $game_temp.common_event_id = @skill.common_event_id
  935.           # 演奏特技使用时的 SE
  936.           $game_system.se_play(@skill.menu_se)
  937.           # 消耗 SP
  938.           @actor.sp -= @skill.sp_cost
  939.           # 再生成各窗口的内容
  940.           @status_window.refresh
  941.           @skill_window.refresh
  942.           @target_window.refresh
  943.           # 切换到地图画面
  944.           $scene = Scene_Map.new
  945.           return
  946.         end
  947.       end
  948.       return
  949.     end
  950.     # 按下 R 键的情况下
  951.     if Input.trigger?(Input::R)
  952.       # 演奏光标 SE
  953.       $game_system.se_play($data_system.cursor_se)
  954.       # 移至下一位角色
  955.       @actor_index += 1
  956.       @actor_index %= $game_party.actors.size
  957.       # 切换到别的特技画面
  958.       $scene = Scene_Skill.new(@actor_index)
  959.       return
  960.     end
  961.     # 按下 L 键的情况下
  962.     if Input.trigger?(Input::L)
  963.       # 演奏光标 SE
  964.       $game_system.se_play($data_system.cursor_se)
  965.       # 移至上一位角色
  966.       @actor_index += $game_party.actors.size - 1
  967.       @actor_index %= $game_party.actors.size
  968.       # 切换到别的特技画面
  969.       $scene = Scene_Skill.new(@actor_index)
  970.       return
  971.     end
  972.   end
  973. end

  974. class Scene_Equip
  975.   def update_right
  976.     # 按下 B 键的情况下
  977.     if Input.trigger?(Input::B)
  978.                         $cancel = true
  979.                   $index = @actor_index
  980.       # 演奏取消 SE
  981.       $game_system.se_play($data_system.cancel_se)
  982.       # 切换到菜单画面
  983.       $scene = Scene_Menu.new(2)
  984.       return
  985.     end
  986.     # 按下 C 键的情况下
  987.     if Input.trigger?(Input::C)
  988.       # 固定装备的情况下
  989.       if @actor.equip_fix?(@right_window.index)
  990.         # 演奏冻结 SE
  991.         $game_system.se_play($data_system.buzzer_se)
  992.         return
  993.       end
  994.       # 演奏确定 SE
  995.       $game_system.se_play($data_system.decision_se)
  996.       # 激活物品窗口
  997.       @right_window.active = false
  998.       @item_window.active = true
  999.       @item_window.index = 0
  1000.       return
  1001.     end
  1002.     # 按下 R 键的情况下
  1003.     if Input.trigger?(Input::R)
  1004.       # 演奏光标 SE
  1005.       $game_system.se_play($data_system.cursor_se)
  1006.       # 移至下一位角色
  1007.       @actor_index += 1
  1008.       @actor_index %= $game_party.actors.size
  1009.       # 切换到别的装备画面
  1010.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1011.       return
  1012.     end
  1013.     # 按下 L 键的情况下
  1014.     if Input.trigger?(Input::L)
  1015.       # 演奏光标 SE
  1016.       $game_system.se_play($data_system.cursor_se)
  1017.       # 移至上一位角色
  1018.       @actor_index += $game_party.actors.size - 1
  1019.       @actor_index %= $game_party.actors.size
  1020.       # 切换到别的装备画面
  1021.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1022.       return
  1023.     end
  1024.   end
  1025. end

  1026. class Scene_Status
  1027.   def update
  1028.     # 按下 B 键的情况下
  1029.     if Input.trigger?(Input::B)
  1030.                         $cancel = true
  1031.                         $index = @actor_index
  1032.       # 演奏取消 SE
  1033.       $game_system.se_play($data_system.cancel_se)
  1034.       # 切换到菜单画面
  1035.       $scene = Scene_Menu.new(3)
  1036.       return
  1037.     end
  1038.     # 按下 R 键的情况下
  1039.     if Input.trigger?(Input::R)
  1040.       # 演奏光标 SE
  1041.       $game_system.se_play($data_system.cursor_se)
  1042.       # 移至下一位角色
  1043.       @actor_index += 1
  1044.       @actor_index %= $game_party.actors.size
  1045.       # 切换到别的状态画面
  1046.       $scene = Scene_Status.new(@actor_index)
  1047.       return
  1048.     end
  1049.     # 按下 L 键的情况下
  1050.     if Input.trigger?(Input::L)
  1051.       # 演奏光标 SE
  1052.       $game_system.se_play($data_system.cursor_se)
  1053.       # 移至上一位角色
  1054.       @actor_index += $game_party.actors.size - 1
  1055.       @actor_index %= $game_party.actors.size
  1056.       # 切换到别的状态画面
  1057.       $scene = Scene_Status.new(@actor_index)
  1058.       return
  1059.     end
  1060.   end
  1061. end
复制代码


(o゚ω゚o)( ゚ω゚)(o゚ω゚o)  
效果截图1.jpg
效果截图2.jpg

菜单修改.zip

784.17 KB, 下载次数: 355

范例工程

评分

参与人数 2星屑 +240 赞 +1 收起 理由
qw7971216 + 1 精品文章
紫英晓狼1130 + 240 精品文章

查看全部评分

本人渣渣一枚,求个合伙人  一起做游戏,有意者联系QQ 980497385
梦石
0
星屑
129
在线时间
219 小时
注册时间
2011-1-19
回帖
92
 楼主| 发表于 2015-8-4 14:25:52 | 显示全部楼层
据最新测试,在六个选项的文字前加一个空格可能能够略微提高美观程度= =本人不再修改脚本,如有需要大家可以自行添加~
本人渣渣一枚,求个合伙人  一起做游戏,有意者联系QQ 980497385
回复

使用道具 举报

梦石
0
星屑
9557
在线时间
5074 小时
注册时间
2013-6-21
回帖
3459

开拓者贵宾剧作品鉴家

发表于 2015-8-4 22:23:04 | 显示全部楼层
用了5分钟的时间大致看了一下脚本,总体来说修改的效果还不错,在这里说说我发现的问题。
1. Window_Base#text_color里面好像把else的部分去掉了,希望补上。因为这个地方是为了防止传入无效参数而设定的,没有else会出问题。
2. SP条的描绘要考虑角色的maxsp是否为0,这点我在视频教学里面也有提到过。
3. 脚本的缩进是硬伤,看起来不舒服。
4. 貌似Window_Base里面无需改动的方法也被重新写了一遍,建议删掉。
5. @status_window.update在update中被调用了2次(当状态窗口被激活时),这个问题是致命的,不过你的状态窗口还好选项只有一个,如果像命令窗口一样有多个光标的话,按一下'↓'光标会移动两格。
6. Scene_Menu#update_status写的太啰嗦。具体来说,你是生成了四个独立的窗口,然后分别控制刷新。这个做法在默认脚本里面的Scene_File中有使用,但是刷新应该没有这么复杂,可以参考默认脚本的做法。
7. 你用了两个全局变量$cancel和$index来控制从别的场景返回时,Scene_Menu的不同响应。如果从特技等场景返回时,光标应该停在那个状态窗口上。这个设定很好,但是全局变量让我看着太不舒服了。请把它改成别的写法。
8. 推荐使用alias关键字(能用则用),以减小脚本冲突的可能。例如你的Scene_Skill#update_skill,就完全可以使用alias进行追加定义(如果你使用全局变量的话)。

以上就先总结这么多,看的并不是很仔细。此外鼓励楼主多多进行这样的脚本练习。

点评

可以定义Scene_Menu的initialize方法,将两个参数传进去。当然有关角色索引位置的建议传默认参数,否则兼容性不好。  发表于 2015-8-5 10:30
谢谢RB大神的点评,另外请教一下$cancel和$index这个如果不用全局变量的话应该怎么写呢  发表于 2015-8-5 09:24
回复

使用道具 举报

梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

发表于 2015-8-5 22:26:40 | 显示全部楼层
fz反正我不会。。。
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
回复

使用道具 举报

梦石
0
星屑
129
在线时间
219 小时
注册时间
2011-1-19
回帖
92
 楼主| 发表于 2015-8-6 13:53:10 | 显示全部楼层
RyanBern 发表于 2015-8-4 22:23
用了5分钟的时间大致看了一下脚本,总体来说修改的效果还不错,在这里说说我发现的问题。
1. Window_Base#t ...

你好,RB大神~~我遇到一个问题想请教您一下。我的游戏突然出现一个问题,就是当我打开游戏,第一次调出菜单画面的时候,没有问题,但是当我关掉菜单画面,再按第三次Esc的时候,就出现了一个什么什么该内存不能为read。每次都是这样,然后我把每一个脚本都放到main下边试了一次,都不行,后来我干脆把我写的那个菜单美好的脚本删了,还是不行。于是我新建了一个工程,把除了script以外的所有data文件全拷进去,然后依次把我加的所有脚本加进去,加到我写的那个菜单美化的时候,又出现了同样的状况,然后我又删了这个脚本,结果可以了。我又回老工程里,又删了菜单美化,还是报错……请问应该如何解决?是不是我的脚本哪些地方有什么问题?
本人渣渣一枚,求个合伙人  一起做游戏,有意者联系QQ 980497385
回复

使用道具 举报

梦石
0
星屑
9557
在线时间
5074 小时
注册时间
2013-6-21
回帖
3459

开拓者贵宾剧作品鉴家

发表于 2015-8-6 14:13:21 | 显示全部楼层
xingxing991219 发表于 2015-8-6 13:53
你好,RB大神~~我遇到一个问题想请教您一下。我的游戏突然出现一个问题,就是当我打开游戏,第一次调出菜 ...

一般来讲,出现这种问题原因比较复杂,你这里脚本众多所以不太好判断。
一个可能的原因是内存不足(内存泄露),在你使用脚本生成状态窗口人物头像的时候,建立的方式为直接使用的Bitmap.new(path)的形式,使用之后没有释放导致内存不足。所以以这种方式建立的位图使用完毕后必须释放。或者也可以定义高速缓存:
  1. module RPG
  2.   module Cache
  3.     def self.head(filename)
  4.       self.load_bitmap("Graphics/Heads/", filename)
  5.     end
  6.   end
  7. end
复制代码

使用的时候直接RPG::Cache.head(filename)即可,不需要释放。
不过我也无法肯定就是这个问题,或许也可能是别的脚本出现错误。
回复

使用道具 举报

梦石
0
星屑
129
在线时间
219 小时
注册时间
2011-1-19
回帖
92
 楼主| 发表于 2015-8-6 14:47:00 | 显示全部楼层
RyanBern 发表于 2015-8-6 14:13
一般来讲,出现这种问题原因比较复杂,你这里脚本众多所以不太好判断。
一个可能的原因是内存不足(内存 ...


好吧,谢谢了。不过我试了你的方法,的确不行……我去找个别的菜单脚本直接用了
本人渣渣一枚,求个合伙人  一起做游戏,有意者联系QQ 980497385
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部