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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
129
在线时间
219 小时
注册时间
2011-1-19
帖子
108
跳转到指定楼层
1
发表于 2015-8-4 14:18:13 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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

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

好吧,就扯这么多。

RUBY 代码复制
  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. # 菜单栏选项文字
  23. ITEM = "查看背包"
  24. SKILL = "功夫武学"
  25. EQUIP = "更换装备"
  26. STATUS = "角色状态"
  27. SAVE = "保存记录"
  28. EXIT = "离开游戏"
  29. # 金钱窗口的标题
  30. GOLD = "银两"
  31. # 等级的前缀,如Lv  Lv.  Level等
  32. LEVEL = "等级"
  33.  
  34. class Game_Actor
  35.   #--------------------------------------------------------------------------
  36.   # ★ 2个 EXP 字符串函数 by 小翼 [FDU]alwing
  37.   #--------------------------------------------------------------------------
  38.   def now_exp
  39.     return @exp - @exp_list[@level]
  40.   end
  41.   def next_exp
  42.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  43.         end
  44. end
  45. class Window_Base < Window
  46.   #--------------------------------------------------------------------------
  47.   # ★ 获取文字色 by 小翼 [FDU]alwing WOW
  48.   #     n : 颜色编号
  49.   #--------------------------------------------------------------------------
  50.   def rec_color(n)
  51.     case n
  52.     # 蓝色
  53.     when 0
  54.       return Color.new(0, 16, 65, 255)
  55.     when 1
  56.       return Color.new(0, 40, 160, 255)
  57.     when 2
  58.       return Color.new(0, 54, 215, 255)
  59.     when 3
  60.       return Color.new(0, 49, 195, 255)
  61.     when 4
  62.       return Color.new(0, 41, 165, 255)
  63.     when 5
  64.       return Color.new(0, 35, 140, 255)
  65.     when 6
  66.       return Color.new(0, 26, 105, 255)
  67.     when 7
  68.       return Color.new(0, 10, 40, 255)
  69.     # 橙色
  70.     when 10
  71.       return Color.new(65, 32, 0, 255)
  72.     when 11
  73.       return Color.new(160, 80, 0, 255)
  74.     when 12
  75.       return Color.new(215, 107, 0, 255)
  76.     when 13
  77.       return Color.new(195, 97, 0, 255)
  78.     when 14
  79.       return Color.new(165, 82, 0, 255)
  80.     when 15
  81.       return Color.new(140, 70, 0, 255)
  82.     when 16
  83.       return Color.new(105, 52, 0, 255)
  84.     when 17
  85.       return Color.new(40, 20, 0, 255)
  86.     # 青色
  87.     when 20
  88.       return Color.new(0, 65, 65, 255)
  89.     when 21
  90.       return Color.new(0, 160, 160, 255)
  91.     when 22
  92.       return Color.new(0, 215, 215, 255)
  93.     when 23
  94.       return Color.new(0, 195, 195, 255)
  95.     when 24
  96.       return Color.new(0, 165, 165, 255)
  97.     when 25
  98.       return Color.new(0, 140, 140, 255)
  99.     when 26
  100.       return Color.new(0, 105, 105, 255)
  101.     when 27
  102.       return Color.new(0, 40, 40, 255)
  103.     # 紫红
  104.     when 30
  105.       return Color.new(65, 0, 32, 255)
  106.     when 31
  107.       return Color.new(160, 0, 80, 255)
  108.     when 32
  109.       return Color.new(215, 0, 107, 255)
  110.     when 33
  111.       return Color.new(195, 0, 97, 255)
  112.     when 34
  113.       return Color.new(165, 0, 82, 255)
  114.     when 35
  115.       return Color.new(140, 0, 70, 255)
  116.     when 36
  117.       return Color.new(105, 0, 52, 255)
  118.     when 37
  119.       return Color.new(40, 0, 20, 255)
  120.     end
  121.   end
  122. #--------------------------------------------------------------------------
  123.   # ● 职业的描绘
  124.   #     actor : 角色
  125.   #     x     : 描画目标 X 坐标
  126.   #     y     : 描画目标 Y 坐标
  127.   #--------------------------------------------------------------------------
  128.   def draw_actor_class(actor, x, y)
  129.     self.contents.font.color = normal_color
  130.     self.contents.draw_text(x, y, 236, 32, "[" + actor.class_name + "]")
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● 描画 EXP ★主菜单
  134.   #     actor : 角色
  135.   #     x     : 描画目标 X 坐标
  136.   #     y     : 描画目标 Y 坐标
  137.   #--------------------------------------------------------------------------
  138.   def draw_actor_exp(actor, x, y)
  139.     self.contents.font.size = 20
  140.     self.contents.font.color = system_color
  141.     self.contents.draw_text(x+1, y, 80, 32, "EXP")
  142.     self.contents.font.color = normal_color
  143.     self.contents.draw_text(x - 10 , y, 84, 32, actor.exp_s, 2)
  144.     self.contents.draw_text(x + 74, y, 12, 32, "/", 1)
  145.     self.contents.draw_text(x + 88, y, 84, 32, actor.next_exp_s)
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 描画 EXP ★状态窗口
  149.   #     actor : 角色
  150.   #     x     : 描画目标 X 坐标
  151.   #     y     : 描画目标 Y 坐标
  152.   #--------------------------------------------------------------------------
  153.   def draw_actor_exp_status(actor, x, y)
  154.     self.contents.font.size = 20
  155.     self.contents.font.color = system_color
  156.     self.contents.draw_text(x+1, y, 80, 32, "EXP")
  157.     self.contents.font.color = normal_color
  158.     self.contents.draw_text(x + 108, y, 84, 32, actor.exp_s, 2)
  159.     self.contents.draw_text(x + 192, y, 12, 32, "/", 1)
  160.     self.contents.draw_text(x + 204, y, 84, 32, actor.next_exp_s)
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ★ 描绘 EXP 矩形 by 小翼 [FDU]alwing
  164.   #     actor : 角色
  165.   #     x     : 描画目标 X 坐标
  166.   #     y     : 描画目标 Y 坐标
  167.   #     width : 描画目标的宽
  168.   #--------------------------------------------------------------------------
  169.   def EXP(actor,x,y,width = 128)
  170.     self.contents.fill_rect(x+26, y+60, width+4,9, Color.new(0,0,0,255))
  171.     self.contents.fill_rect(x+27, y+61, width+2,7, Color.new(255,255,255,255))
  172.     self.contents.fill_rect(x+28, y+62, width,5, Color.new(0,0,0,255))
  173.     if actor.next_exp > 0
  174.       @EXPw = width * actor.now_exp/actor.next_exp
  175.       self.contents.fill_rect(x+28, y+62, @EXPw,1, Color.new(100,50,150,255))
  176.       self.contents.fill_rect(x+28, y+63, @EXPw,1, Color.new(150,100,200,255))
  177.       self.contents.fill_rect(x+28, y+64, @EXPw,1, Color.new(200,150,255,255))
  178.       self.contents.fill_rect(x+28, y+65, @EXPw,1, Color.new(150,100,200,255))
  179.       self.contents.fill_rect(x+28, y+66, @EXPw,1, Color.new(100,50,150,255))
  180.     else
  181.       self.contents.fill_rect(x+28, y+62, width,1, Color.new(50,150,150,255))
  182.       self.contents.fill_rect(x+28, y+63, width,1, Color.new(100,200,200,255))
  183.       self.contents.fill_rect(x+28, y+64, width,1, Color.new(150,255,255,255))
  184.       self.contents.fill_rect(x+28, y+65, width,1, Color.new(100,200,200,255))
  185.       self.contents.fill_rect(x+28, y+66, width,1, Color.new(50,150,150,255))
  186.     end
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ● 描绘 HP
  190.   #     actor : 角色
  191.   #     x     : 描画目标 X 坐标
  192.   #     y     : 描画目标 Y 坐标
  193.   #     width : 描画目标的宽
  194.   #--------------------------------------------------------------------------
  195.   def draw_actor_hp(actor, x, y, width = 144)
  196.     # 描绘字符串 "HP"
  197.     self.contents.font.color = system_color
  198.     self.contents.font.size = 20
  199.     self.contents.draw_text(x+16, y, 32, 32, "体")
  200.     # 计算描绘 MaxHP 所需的空间
  201.     if width - 32 >= 108
  202.       hp_x = x + width - 108
  203.       flag = true
  204.     elsif width - 32 >= 48
  205.       hp_x = x + width - 48
  206.       flag = false
  207.     end
  208.     # 描绘 HP
  209.     if flag
  210.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  211.         actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  212.       self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  213.     else
  214.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  215.         actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  216.       self.contents.draw_text(hp_x-36, y, 48, 32, actor.hp.to_s, 0)
  217.     end
  218.     # 描绘 MaxHP
  219.     if flag
  220.       self.contents.font.color = normal_color
  221.       self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  222.       self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  223.     else
  224.       self.contents.font.color = normal_color
  225.       self.contents.draw_text(hp_x, y, 12, 32, "/", 1)
  226.       self.contents.draw_text(hp_x + 12, y, 48, 32, actor.maxhp.to_s)
  227.     end
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● 描绘 SP
  231.   #     actor : 角色
  232.   #     x     : 描画目标 X 坐标
  233.   #     y     : 描画目标 Y 坐标
  234.   #     width : 描画目标的宽
  235.   #--------------------------------------------------------------------------
  236.   def draw_actor_sp(actor, x, y, width = 144)
  237.     # 描绘字符串 "SP"
  238.     self.contents.font.color = system_color
  239.     self.contents.draw_text(x+16, y, 32, 32, "气")
  240.     # 计算描绘 MaxSP 所需的空间
  241.     if width - 32 >= 108
  242.       sp_x = x + width - 108
  243.       flag = true
  244.     elsif width - 32 >= 48
  245.       sp_x = x + width - 48
  246.       flag = false
  247.     end
  248.     # 描绘 SP
  249.     if flag
  250.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  251.         actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  252.       self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  253.     else
  254.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  255.         actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  256.       self.contents.draw_text(sp_x-36, y, 48, 32, actor.sp.to_s, 0)
  257.     end
  258.     # 描绘 MaxSP
  259.     if flag
  260.       self.contents.font.color = normal_color
  261.       self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  262.       self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  263.     else
  264.       self.contents.font.color = normal_color
  265.       self.contents.draw_text(sp_x, y, 12, 32, "/", 1)
  266.       self.contents.draw_text(sp_x + 12, y, 48, 32, actor.maxsp.to_s)
  267.     end
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● 描绘能力值
  271.   #     actor : 角色
  272.   #     x     : 描画目标 X 坐标
  273.   #     y     : 描画目标 Y 坐标
  274.   #     type  : 能力值种类 (0~6)
  275.   #--------------------------------------------------------------------------
  276.   def draw_actor_parameter(actor, x, y, type)
  277.     case type
  278.     when 0
  279.       parameter_name = $data_system.words.atk
  280.       parameter_value = actor.atk
  281.     when 1
  282.       parameter_name = $data_system.words.pdef
  283.       parameter_value = actor.pdef
  284.     when 2
  285.       parameter_name = $data_system.words.mdef
  286.       parameter_value = actor.mdef
  287.     when 3
  288.       parameter_name = $data_system.words.str
  289.       parameter_value = actor.str
  290.     when 4
  291.       parameter_name = $data_system.words.dex
  292.       parameter_value = actor.dex
  293.     when 5
  294.       parameter_name = $data_system.words.agi
  295.       parameter_value = actor.agi
  296.     when 6
  297.       parameter_name = $data_system.words.int
  298.       parameter_value = actor.int
  299.     end
  300.     self.contents.font.color = system_color
  301.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  302.     self.contents.font.color = normal_color
  303.     self.contents.draw_text(x + 160, y, 36, 32, parameter_value.to_s, 2)
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● 描绘能力值 ★装备窗口
  307.   #     actor : 角色
  308.   #     x     : 描画目标 X 坐标
  309.   #     y     : 描画目标 Y 坐标
  310.   #     type  : 能力值种类 (0~6)
  311.   #--------------------------------------------------------------------------
  312.   def draw_actor_parameter_equip(actor, x, y, type)
  313.     case type
  314.     when 0
  315.       parameter_name = $data_system.words.atk
  316.       parameter_value = actor.atk
  317.     when 1
  318.       parameter_name = $data_system.words.pdef
  319.       parameter_value = actor.pdef
  320.     when 2
  321.       parameter_name = $data_system.words.mdef
  322.       parameter_value = actor.mdef
  323.     when 3
  324.       parameter_name = $data_system.words.str
  325.       parameter_value = actor.str
  326.     when 4
  327.       parameter_name = $data_system.words.dex
  328.       parameter_value = actor.dex
  329.     when 5
  330.       parameter_name = $data_system.words.agi
  331.       parameter_value = actor.agi
  332.     when 6
  333.       parameter_name = $data_system.words.int
  334.       parameter_value = actor.int
  335.     end
  336.     self.contents.font.color = system_color
  337.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  338.     self.contents.font.color = normal_color
  339.     self.contents.draw_text(x + 196, y, 36, 32, parameter_value.to_s, 2)
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ● 描绘物品名
  343.   #     item : 物品
  344.   #     x    : 描画目标 X 坐标
  345.   #     y    : 描画目标 Y 坐标
  346.   #--------------------------------------------------------------------------
  347.   def draw_item_name(item, x, y)
  348.     if item == nil
  349.       return
  350.     end
  351.     bitmap = RPG::Cache.icon(item.icon_name)
  352.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  353.     self.contents.font.color = normal_color
  354.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  355.   end
  356.         #--------------------------------------------------------------------------
  357.   # ● 等级的描绘
  358.   #     actor : 角色
  359.   #     x     : 描画目标 X 坐标
  360.   #     y     : 描画目标 Y 坐标
  361.   #--------------------------------------------------------------------------
  362.   def draw_actor_level(actor, x, y)
  363.     self.contents.font.color = system_color
  364.     self.contents.draw_text(x, y, 64, 32, LEVEL)
  365.     self.contents.font.color = normal_color
  366.     self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  367.   end
  368.  
  369.   #--------------------------------------------------------------------------
  370.   # ★ 描绘 HP 矩形 by 小翼 [FDU]alwing
  371.   #     actor : 角色
  372.   #     x     : 描画目标 X 坐标
  373.   #     y     : 描画目标 Y 坐标
  374.   #     width : 描画目标的宽
  375.   #--------------------------------------------------------------------------
  376.   # HP定义
  377.   def HP(actor,x,y,width=96)
  378.     #底色定义
  379.     self.contents.fill_rect(x+26, y+13, width+4,12, Color.new(0,0,0,255))
  380.     self.contents.fill_rect(x+27, y+14, width+2,10, Color.new(255,255,255,255))
  381.     self.contents.fill_rect(x+28, y+15, width,8, Color.new(0,0,0,255))
  382.     #HP宽度定义
  383.     @HPw = width * actor.hp/actor.maxhp
  384.     #中
  385.     if actor.hp > actor.maxhp/2
  386.       @HPcg0 = 65
  387.       @HPcg1 = 160
  388.       @HPcg2 = 215
  389.       @HPcg3 = 195
  390.       @HPcg4 = 165
  391.       @HPcg5 = 140
  392.       @HPcg6 = 105
  393.       @HPcg7 = 40
  394.       @HPcr0 = 65 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  395.       @HPcr1 = 160 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  396.       @HPcr2 = 215 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  397.       @HPcr3 = 195 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  398.       @HPcr4 = 165 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  399.       @HPcr5 = 140 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  400.       @HPcr6 = 105 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  401.       @HPcr7 = 40 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
  402.     else
  403.       @HPcr0 = 65
  404.       @HPcr1 = 160
  405.       @HPcr2 = 215
  406.       @HPcr3 = 195
  407.       @HPcr4 = 165
  408.       @HPcr5 = 140
  409.       @HPcr6 = 105
  410.       @HPcr7 = 40
  411.       @HPcg0 = 65 * actor.hp/(actor.maxhp/2)
  412.       @HPcg1 = 160 * actor.hp/(actor.maxhp/2)
  413.       @HPcg2 = 215 * actor.hp/(actor.maxhp/2)
  414.       @HPcg3 = 195 * actor.hp/(actor.maxhp/2)
  415.       @HPcg4 = 165 * actor.hp/(actor.maxhp/2)
  416.       @HPcg5 = 140 * actor.hp/(actor.maxhp/2)
  417.       @HPcg6 = 105 * actor.hp/(actor.maxhp/2)
  418.       @HPcg7 = 40 * actor.hp/(actor.maxhp/2)
  419.     end
  420.     #HP条定义
  421.     self.contents.fill_rect(x+28, y+15, @HPw,1, Color.new(@HPcr0,@HPcg0,0,255))
  422.     self.contents.fill_rect(x+28, y+16, @HPw,1, Color.new(@HPcr1,@HPcg1,0,255))
  423.     self.contents.fill_rect(x+28, y+17, @HPw,1, Color.new(@HPcr2,@HPcg2,0,255))
  424.     self.contents.fill_rect(x+28, y+18, @HPw,1, Color.new(@HPcr3,@HPcg3,0,255))
  425.     self.contents.fill_rect(x+28, y+19, @HPw,1, Color.new(@HPcr4,@HPcg4,0,255))
  426.     self.contents.fill_rect(x+28, y+20, @HPw,1, Color.new(@HPcr5,@HPcg5,0,255))
  427.     self.contents.fill_rect(x+28, y+21, @HPw,1, Color.new(@HPcr6,@HPcg6,0,255))
  428.     self.contents.fill_rect(x+28, y+22, @HPw,1, Color.new(@HPcr7,@HPcg7,0,255))
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ★ 描绘 SP 矩形 by 小翼 [FDU]alwing
  432.   #     actor : 角色
  433.   #     x     : 描画目标 X 坐标
  434.   #     y     : 描画目标 Y 坐标
  435.   #     width : 描画目标的宽
  436.   #--------------------------------------------------------------------------
  437.   def MP(actor,x,y,width=96)
  438.     self.contents.fill_rect(x+26, y+45, width+4,12, Color.new(0,0,0,255))
  439.     self.contents.fill_rect(x+27, y+46, width+2,10, Color.new(255,255,255,255))
  440.     self.contents.fill_rect(x+28, y+47, width,8, Color.new(0,0,0,255))
  441.     @MPw = width * actor.sp/actor.maxsp
  442.     self.contents.fill_rect(x+28, y+47, @MPw,1, rec_color(0))
  443.     self.contents.fill_rect(x+28, y+48, @MPw,1, rec_color(1))
  444.     self.contents.fill_rect(x+28, y+49, @MPw,1, rec_color(2))
  445.     self.contents.fill_rect(x+28, y+50, @MPw,1, rec_color(3))
  446.     self.contents.fill_rect(x+28, y+51, @MPw,1, rec_color(4))
  447.     self.contents.fill_rect(x+28, y+52, @MPw,1, rec_color(5))
  448.     self.contents.fill_rect(x+28, y+53, @MPw,1, rec_color(6))
  449.     self.contents.fill_rect(x+28, y+54, @MPw,1, rec_color(7))
  450.   end
  451. end
  452.  
  453. class Window_Gold < Window_Base
  454.   #--------------------------------------------------------------------------
  455.   # ● 初始化对像
  456.   #--------------------------------------------------------------------------
  457.   def initialize
  458.     super(0, 0, 160, 96)
  459.     self.contents = Bitmap.new(width - 32, height - 32)
  460.     refresh
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # ● 刷新
  464.   #--------------------------------------------------------------------------
  465.   def refresh
  466.     self.contents.clear
  467.     self.contents.font.color = system_color
  468.     self.contents.draw_text(4, 0, 120, 32, GOLD)
  469.                  self.contents.font.color = normal_color
  470.     self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s)
  471.     self.contents.font.color = system_color
  472.     self.contents.draw_text(4, 32, 120, 32, $data_system.words.gold, 2)
  473.   end
  474. end
  475.  
  476. class Window_MenuList < Window_Selectable
  477.   #--------------------------------------------------------------------------
  478.   # ● 初始化对像
  479.   #     width    : 窗口的宽
  480.   #     commands : 命令字符串序列
  481.   #--------------------------------------------------------------------------
  482.   def initialize(width, commands)
  483.     # 由命令的个数计算出窗口的高
  484.     super(0, 0, 480, 96)
  485.     @item_max = commands.size
  486.     @commands = [ITEM, SKILL, EQUIP, STATUS, SAVE, EXIT]
  487.     self.contents = Bitmap.new(width - 32, 64)
  488.     refresh
  489.     self.index = 0
  490.                  @column_max = 3
  491.   end
  492.   #--------------------------------------------------------------------------
  493.   # ● 刷新
  494.   #--------------------------------------------------------------------------
  495.   def refresh
  496.     self.contents.clear
  497.     for i in 0...@item_max
  498.       draw_item(i, normal_color)
  499.     end
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 描绘项目
  503.   #     index : 项目编号
  504.   #     color : 文字色
  505.   #--------------------------------------------------------------------------
  506.   def draw_item(index, color)
  507.     self.contents.font.color = color
  508.                  if index >= 0 && index <= 2
  509.                         rect = Rect.new(160 * index + 4, 0, self.contents.width - 8, 32)
  510.                 elsif index >= 3 && index <= 5
  511.                         rect = Rect.new(160 * (index - 3) + 4, 32, self.contents.width - 8, 32)
  512.                 end
  513.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  514.     self.contents.draw_text(rect, @commands[index])
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ● 项目无效化
  518.   #     index : 项目编号
  519.   #--------------------------------------------------------------------------
  520.   def disable_item(index)
  521.     draw_item(index, disabled_color)
  522.   end
  523. end
  524. class Window_MenuStatus < Window_Selectable
  525.   #--------------------------------------------------------------------------
  526.   # ● 初始化目标   #actor_id: 角色编号 (0号为第一个角色,依此类推)
  527.   #--------------------------------------------------------------------------
  528.   def initialize(actor_id)
  529.     super(0, 0, 160, 384)
  530.                  @actor_id = actor_id
  531.     self.contents = Bitmap.new(width - 32, height - 32)
  532.     refresh
  533.     self.active = false
  534.     self.index = -1
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # ● 刷新
  538.   #--------------------------------------------------------------------------
  539.   def refresh
  540.     self.contents.clear
  541.     @item_max = 1
  542.                  actor = $game_party.actors[@actor_id]
  543.                   #------------------------------------------------------------------------
  544.       # ★ 头像调用
  545.                 #------------------------------------------------------------------------
  546.                 if actor.id < 10
  547.                         testname = "Actor00"+actor.id.to_s
  548.                 elsif actor.id >= 10 && actor.id < 100
  549.                         testname = "Actor0"+ actor.id.to_s
  550.                 elsif actor.id >= 100 && actor.id <= 999
  551.                         testname = "Actor" + actor.id.to_s
  552.                 end
  553.     bitmap = Bitmap.new("Graphics/Heads/#{testname}")
  554.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  555.                 self.contents.blt(14, y + 10, bitmap, src_rect)
  556.                 draw_actor_name(actor, 22, 115)
  557.                 HP(actor, 0, 200)
  558.                 MP(actor, 0, 214)
  559.                 draw_actor_hp(actor, 0, 180)
  560.                 draw_actor_sp(actor, 0, 227)
  561.                 EXP(actor, 0, 238, 96)
  562.                 draw_actor_exp(actor, 10, 270)
  563.                 draw_actor_level(actor, 36, 315)
  564.                  #$game_party.actors.size
  565.     #for i in 0...$game_party.actors.size
  566.       #x = 64
  567.       #y = 116
  568.       #actor = $game_party.actors[@actor_id]
  569.       #draw_actor_graphic(actor, x - 40, y + 80)
  570.       #draw_actor_name(actor, x, y)
  571.       draw_actor_class(actor, 22,115 + 32)#x + 144, y)
  572.       #draw_actor_level(actor, x, y + 32)
  573.       #draw_actor_state(actor, 22, 180)#x + 90, y + 32)
  574.       #draw_actor_exp(actor, x, y + 64)
  575.       #draw_actor_hp(actor, x + 236, y + 32)
  576.       #draw_actor_sp(actor, x + 236, y + 64)
  577.     #end
  578.   end
  579.   #--------------------------------------------------------------------------
  580.   # ● 刷新光标矩形
  581.   #--------------------------------------------------------------------------
  582.   def update_cursor_rect
  583.     if @index < 0
  584.       self.cursor_rect.empty
  585.     else
  586.       self.cursor_rect.set(0, @index * 116, self.width - 32, self.height - 32)
  587.     end
  588.   end
  589. end
  590.  
  591. class Scene_Menu
  592.   #--------------------------------------------------------------------------
  593.   # ● 主处理
  594.   #--------------------------------------------------------------------------
  595.   def main
  596.                  @status_index = 0
  597.                  @spriteset = Spriteset_Map.new
  598.     # 生成命令窗口
  599.     s1 = ITEM
  600.     s2 = SKILL
  601.     s3 = EQUIP
  602.     s4 = STATUS
  603.     s5 = SAVE
  604.     s6 = EXIT
  605.     @command_window = Window_MenuList.new(480, [s1, s2, s3, s4, s5, s6])
  606.     @command_window.index = @menu_index
  607.                  @command_window.opacity = 160
  608.                  #@command_window.height = 196
  609.     # 同伴人数为 0 的情况下
  610.     if $game_party.actors.size == 0
  611.       # 物品、特技、装备、状态无效化
  612.       @command_window.disable_item(0)
  613.       @command_window.disable_item(1)
  614.       @command_window.disable_item(2)
  615.       @command_window.disable_item(3)
  616.     end
  617.     # 禁止存档的情况下
  618.     if $game_system.save_disabled
  619.       # 存档无效
  620.       @command_window.disable_item(4)
  621.     end
  622.     # 生成金钱窗口
  623.     @gold_window = Window_Gold.new
  624.     @gold_window.x = 480
  625.     @gold_window.y = 0
  626.                  @gold_window.opacity = 160
  627.     # 生成状态窗口
  628.                 @status_window = []
  629.                  for i in 0...$game_party.actors.size
  630.       @status_window[i] = Window_MenuStatus.new(i)
  631.       @status_window[i].x = 160 * i
  632.       @status_window[i].y = 96
  633.                         @status_window[i].opacity = 160
  634.                         end
  635.     # 执行过渡
  636.     Graphics.transition
  637.     # 主循环
  638.     loop do
  639.       # 刷新游戏画面
  640.       Graphics.update
  641.       # 刷新输入信息
  642.       Input.update
  643.       # 刷新画面
  644.       update
  645.       # 如果切换画面就中断循环
  646.       if $scene != self
  647.         break
  648.       end
  649.     end
  650.     # 准备过渡
  651.     Graphics.freeze
  652.     # 释放窗口
  653.     @command_window.dispose
  654.     @gold_window.dispose
  655.                 for i in 0...$game_party.actors.size
  656.                         @status_window[i].dispose
  657.                 end
  658.   end
  659.          #--------------------------------------------------------------------------
  660.   # ● 刷新画面
  661.   #--------------------------------------------------------------------------
  662.   def update
  663.     # 刷新窗口
  664.     @command_window.update
  665.     @gold_window.update
  666.     #@status_window.update
  667.                 for i in 0...$game_party.actors.size
  668.                         @status_window[i].update
  669.                 end
  670.                 if $cancel
  671.                         @command_window.active = false
  672.                         @status_window[$index].active = true
  673.                         @status_window[$index].index = 0
  674.                         @status_index = $index
  675.                         $cancel = false
  676.                 end
  677.     # 命令窗口被激活的情况下: 调用 update_command
  678.     if @command_window.active
  679.       update_command
  680.       return
  681.     end
  682.     # 状态窗口被激活的情况下: 调用 update_status
  683.     if @status_window[@status_index]#@status_window[0].active || @status_window[1].active || @status_window[2].active  || @status_window[3].active
  684.       update_status
  685.       return
  686.                 end
  687.  
  688.   end
  689.           #--------------------------------------------------------------------------
  690.   # ● 刷新画面 (命令窗口被激活的情况下)
  691.   #--------------------------------------------------------------------------
  692.   def update_command
  693.     # 按下 B 键的情况下
  694.     if Input.trigger?(Input::B)
  695.       # 演奏取消 SE
  696.       $game_system.se_play($data_system.cancel_se)
  697.       # 切换的地图画面
  698.       $scene = Scene_Map.new
  699.       return
  700.     end
  701.     # 按下 C 键的情况下
  702.     if Input.trigger?(Input::C)
  703.       # 同伴人数为 0、存档、游戏结束以外的场合
  704.       if $game_party.actors.size == 0 and @command_window.index < 4
  705.         # 演奏冻结 SE
  706.         $game_system.se_play($data_system.buzzer_se)
  707.         return
  708.       end
  709.       # 命令窗口的光标位置分支
  710.       case @command_window.index
  711.       when 0  # 物品
  712.         # 演奏确定 SE
  713.         $game_system.se_play($data_system.decision_se)
  714.         # 切换到物品画面
  715.         $scene = Scene_Item.new
  716.       when 1  # 特技
  717.         # 演奏确定 SE
  718.         $game_system.se_play($data_system.decision_se)
  719.         # 激活状态窗口
  720.         @command_window.active = false
  721.         @status_window[0].active = true
  722.         @status_window[0].index = 0
  723.       when 2  # 装备
  724.         # 演奏确定 SE
  725.         $game_system.se_play($data_system.decision_se)
  726.         # 激活状态窗口
  727.         @command_window.active = false
  728.         @status_window[0].active = true
  729.         @status_window[0].index = 0
  730.       when 3  # 状态
  731.         # 演奏确定 SE
  732.         $game_system.se_play($data_system.decision_se)
  733.         # 激活状态窗口
  734.         @command_window.active = false
  735.         @status_window[0].active = true
  736.         @status_window[0].index = 0
  737.       when 4  # 存档
  738.         # 禁止存档的情况下
  739.         if $game_system.save_disabled
  740.           # 演奏冻结 SE
  741.           $game_system.se_play($data_system.buzzer_se)
  742.           return
  743.         end
  744.         # 演奏确定 SE
  745.         $game_system.se_play($data_system.decision_se)
  746.         # 切换到存档画面
  747.         $scene = Scene_Save.new
  748.       when 5  # 游戏结束
  749.         # 演奏确定 SE
  750.         $game_system.se_play($data_system.decision_se)
  751.         # 切换到游戏结束画面
  752.         $scene = Scene_End.new
  753.       end
  754.       return
  755.     end
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # ● 刷新画面 (状态窗口被激活的情况下)
  759.   #--------------------------------------------------------------------------
  760.   def update_status
  761.                 #p @status_index
  762.                 #for i in 0..3
  763.                 #        p @status_window[i].active
  764.                 #end
  765.                 for i in 0...$game_party.actors.size
  766.                         @status_window[i].update
  767.                 end
  768.  
  769.                 if Input.trigger?(Input::LEFT)
  770.                  $game_system.se_play($data_system.cursor_se)
  771.                         if @status_index == 0
  772.                                 @status_index = $game_party.actors.size - 1
  773.                         else
  774.                                 @status_index -= 1
  775.                         end
  776.                 end
  777.                 if Input.trigger?(Input::RIGHT)
  778.      $game_system.se_play($data_system.cursor_se)
  779.                         if @status_index == $game_party.actors.size - 1
  780.                                 @status_index = 0
  781.                         else
  782.                                 @status_index += 1
  783.                         end
  784.                 end
  785.                         case @status_index
  786.                         when 0
  787.                         @status_window[0].active = true
  788.                         @status_window[0].index = 0
  789.                         if $game_party.actors.size >= 2
  790.                                 @status_window[1].active = false
  791.                                 @status_window[1].index = -1
  792.                            if $game_party.actors.size >= 3
  793.                                    @status_window[2].active = false
  794.                                    @status_window[2].index = -1
  795.                               if $game_party.actors.size >= 4
  796.                                       @status_window[3].active = false
  797.                                                    @status_window[3].index = -1
  798.                                            end
  799.                                   end
  800.                         end
  801.  
  802.                         when 1
  803.                         @status_window[0].active = false
  804.                         @status_window[0].index = -1
  805.                         if $game_party.actors.size >= 2
  806.                                 @status_window[1].active = true
  807.                                 @status_window[1].index = 0
  808.                            if $game_party.actors.size >= 3
  809.                                    @status_window[2].active = false
  810.                                    @status_window[2].index = -1
  811.                               if $game_party.actors.size >= 4
  812.                                       @status_window[3].active = false
  813.                                                    @status_window[3].index = -1
  814.                                            end
  815.                                   end
  816.                         end
  817.                         when 2
  818.                         @status_window[0].active = false
  819.                         @status_window[0].index = -1
  820.                         if $game_party.actors.size >= 2
  821.                                 @status_window[1].active = false
  822.                                 @status_window[1].index = -1
  823.                            if $game_party.actors.size >= 3
  824.                                    @status_window[2].active = true
  825.                                    @status_window[2].index = 0
  826.                               if $game_party.actors.size >= 4
  827.                                       @status_window[3].active = false
  828.                                                    @status_window[3].index = -1
  829.                                            end
  830.                                   end
  831.                         end
  832.                                 @status_window[0].active = false
  833.                                 @status_window[0].index = -1
  834.                                 @status_window[1].active = false
  835.                                 @status_window[1].index = -1
  836.                                 @status_window[2].active = true
  837.                                 @status_window[2].index = 0
  838.                                 @status_window[3].active = false
  839.                                 @status_window[3].index = -1
  840.                         when 3
  841.                         @status_window[0].active = false
  842.                         @status_window[0].index = -1
  843.                         if $game_party.actors.size >= 2
  844.                                 @status_window[1].active = false
  845.                                 @status_window[1].index = -1
  846.                            if $game_party.actors.size >= 3
  847.                                    @status_window[2].active = false
  848.                                    @status_window[2].index = -1
  849.                               if $game_party.actors.size >= 4
  850.                                       @status_window[3].active = true
  851.                                                    @status_window[3].index = 0
  852.                                            end
  853.                                   end
  854.                         end
  855.                 end
  856.  
  857.     # 按下 B 键的情况下
  858.     if Input.trigger?(Input::B)
  859.       # 演奏取消 SE
  860.       $game_system.se_play($data_system.cancel_se)
  861.       # 激活命令窗口
  862.       @command_window.active = true
  863.       @status_window[@status_index].active = false
  864.       @status_window[@status_index].index = -1
  865.                          @status_index = 0
  866.       return
  867.     end
  868.     # 按下 C 键的情况下
  869.     if Input.trigger?(Input::C)
  870.       # 命令窗口的光标位置分支
  871.       case @command_window.index
  872.       when 1  # 特技
  873.         # 本角色的行动限制在 2 以上的情况下
  874.         if $game_party.actors[@status_index].restriction >= 2
  875.           # 演奏冻结 SE
  876.           $game_system.se_play($data_system.buzzer_se)
  877.           return
  878.         end
  879.         # 演奏确定 SE
  880.         $game_system.se_play($data_system.decision_se)
  881.         # 切换到特技画面
  882.         $scene = Scene_Skill.new(@status_index)#window.index)
  883.       when 2  # 装备
  884.         # 演奏确定 SE
  885.         $game_system.se_play($data_system.decision_se)
  886.         # 切换的装备画面
  887.         $scene = Scene_Equip.new(@status_index)#@status_window.index)
  888.       when 3  # 状态
  889.         # 演奏确定 SE
  890.         $game_system.se_play($data_system.decision_se)
  891.         # 切换到状态画面
  892.         $scene = Scene_Status.new(@status_index)#@status_window.index)
  893.       end
  894.       return
  895.     end
  896.   end
  897. end
  898.  
  899. class Scene_Skill
  900.   def update_skill
  901.     # 按下 B 键的情况下
  902.                 $cancel = true
  903.                 $index = @actor_index
  904.     if Input.trigger?(Input::B)
  905.       # 演奏取消 SE
  906.       $game_system.se_play($data_system.cancel_se)
  907.       # 切换到菜单画面
  908.       $scene = Scene_Menu.new(1)
  909.       return
  910.     end
  911.     # 按下 C 键的情况下
  912.     if Input.trigger?(Input::C)
  913.       # 获取特技窗口现在选择的特技的数据
  914.       @skill = @skill_window.skill
  915.       # 不能使用的情况下
  916.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  917.         # 演奏冻结 SE
  918.         $game_system.se_play($data_system.buzzer_se)
  919.         return
  920.       end
  921.       # 演奏确定 SE
  922.       $game_system.se_play($data_system.decision_se)
  923.       # 效果范围是我方的情况下
  924.       if @skill.scope >= 3
  925.         # 激活目标窗口
  926.         @skill_window.active = false
  927.         @target_window.x = (@skill_window.index + 1) % 2 * 304
  928.         @target_window.visible = true
  929.         @target_window.active = true
  930.         # 设置效果范围 (单体/全体) 的对应光标位置
  931.         if @skill.scope == 4 || @skill.scope == 6
  932.           @target_window.index = -1
  933.         elsif @skill.scope == 7
  934.           @target_window.index = @actor_index - 10
  935.         else
  936.           @target_window.index = 0
  937.         end
  938.       # 效果在我方以外的情况下
  939.       else
  940.         # 公共事件 ID 有效的情况下
  941.         if @skill.common_event_id > 0
  942.           # 预约调用公共事件
  943.           $game_temp.common_event_id = @skill.common_event_id
  944.           # 演奏特技使用时的 SE
  945.           $game_system.se_play(@skill.menu_se)
  946.           # 消耗 SP
  947.           @actor.sp -= @skill.sp_cost
  948.           # 再生成各窗口的内容
  949.           @status_window.refresh
  950.           @skill_window.refresh
  951.           @target_window.refresh
  952.           # 切换到地图画面
  953.           $scene = Scene_Map.new
  954.           return
  955.         end
  956.       end
  957.       return
  958.     end
  959.     # 按下 R 键的情况下
  960.     if Input.trigger?(Input::R)
  961.       # 演奏光标 SE
  962.       $game_system.se_play($data_system.cursor_se)
  963.       # 移至下一位角色
  964.       @actor_index += 1
  965.       @actor_index %= $game_party.actors.size
  966.       # 切换到别的特技画面
  967.       $scene = Scene_Skill.new(@actor_index)
  968.       return
  969.     end
  970.     # 按下 L 键的情况下
  971.     if Input.trigger?(Input::L)
  972.       # 演奏光标 SE
  973.       $game_system.se_play($data_system.cursor_se)
  974.       # 移至上一位角色
  975.       @actor_index += $game_party.actors.size - 1
  976.       @actor_index %= $game_party.actors.size
  977.       # 切换到别的特技画面
  978.       $scene = Scene_Skill.new(@actor_index)
  979.       return
  980.     end
  981.   end
  982. end
  983.  
  984. class Scene_Equip
  985.   def update_right
  986.     # 按下 B 键的情况下
  987.     if Input.trigger?(Input::B)
  988.                         $cancel = true
  989.                   $index = @actor_index
  990.       # 演奏取消 SE
  991.       $game_system.se_play($data_system.cancel_se)
  992.       # 切换到菜单画面
  993.       $scene = Scene_Menu.new(2)
  994.       return
  995.     end
  996.     # 按下 C 键的情况下
  997.     if Input.trigger?(Input::C)
  998.       # 固定装备的情况下
  999.       if @actor.equip_fix?(@right_window.index)
  1000.         # 演奏冻结 SE
  1001.         $game_system.se_play($data_system.buzzer_se)
  1002.         return
  1003.       end
  1004.       # 演奏确定 SE
  1005.       $game_system.se_play($data_system.decision_se)
  1006.       # 激活物品窗口
  1007.       @right_window.active = false
  1008.       @item_window.active = true
  1009.       @item_window.index = 0
  1010.       return
  1011.     end
  1012.     # 按下 R 键的情况下
  1013.     if Input.trigger?(Input::R)
  1014.       # 演奏光标 SE
  1015.       $game_system.se_play($data_system.cursor_se)
  1016.       # 移至下一位角色
  1017.       @actor_index += 1
  1018.       @actor_index %= $game_party.actors.size
  1019.       # 切换到别的装备画面
  1020.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1021.       return
  1022.     end
  1023.     # 按下 L 键的情况下
  1024.     if Input.trigger?(Input::L)
  1025.       # 演奏光标 SE
  1026.       $game_system.se_play($data_system.cursor_se)
  1027.       # 移至上一位角色
  1028.       @actor_index += $game_party.actors.size - 1
  1029.       @actor_index %= $game_party.actors.size
  1030.       # 切换到别的装备画面
  1031.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  1032.       return
  1033.     end
  1034.   end
  1035. end
  1036.  
  1037. class Scene_Status
  1038.   def update
  1039.     # 按下 B 键的情况下
  1040.     if Input.trigger?(Input::B)
  1041.                         $cancel = true
  1042.                         $index = @actor_index
  1043.       # 演奏取消 SE
  1044.       $game_system.se_play($data_system.cancel_se)
  1045.       # 切换到菜单画面
  1046.       $scene = Scene_Menu.new(3)
  1047.       return
  1048.     end
  1049.     # 按下 R 键的情况下
  1050.     if Input.trigger?(Input::R)
  1051.       # 演奏光标 SE
  1052.       $game_system.se_play($data_system.cursor_se)
  1053.       # 移至下一位角色
  1054.       @actor_index += 1
  1055.       @actor_index %= $game_party.actors.size
  1056.       # 切换到别的状态画面
  1057.       $scene = Scene_Status.new(@actor_index)
  1058.       return
  1059.     end
  1060.     # 按下 L 键的情况下
  1061.     if Input.trigger?(Input::L)
  1062.       # 演奏光标 SE
  1063.       $game_system.se_play($data_system.cursor_se)
  1064.       # 移至上一位角色
  1065.       @actor_index += $game_party.actors.size - 1
  1066.       @actor_index %= $game_party.actors.size
  1067.       # 切换到别的状态画面
  1068.       $scene = Scene_Status.new(@actor_index)
  1069.       return
  1070.     end
  1071.   end
  1072. end


(o゚ω゚o)( ゚ω゚)(o゚ω゚o)  

效果截图1.jpg (450.41 KB, 下载次数: 47)

效果截图1.jpg

效果截图2.jpg (450.87 KB, 下载次数: 29)

效果截图2.jpg

菜单修改.zip

784.17 KB, 下载次数: 355

范例工程

评分

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

查看全部评分

本人渣渣一枚,求个合伙人  一起做游戏,有意者联系QQ 980497385

Lv1.梦旅人

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

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9497
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

3
发表于 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
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv3.寻梦者

梦石
0
星屑
2379
在线时间
912 小时
注册时间
2014-10-14
帖子
1331

开拓者

4
发表于 2015-8-5 22:26:40 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
129
在线时间
219 小时
注册时间
2011-1-19
帖子
108
5
 楼主| 发表于 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
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9497
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

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

一般来讲,出现这种问题原因比较复杂,你这里脚本众多所以不太好判断。
一个可能的原因是内存不足(内存泄露),在你使用脚本生成状态窗口人物头像的时候,建立的方式为直接使用的Bitmap.new(path)的形式,使用之后没有释放导致内存不足。所以以这种方式建立的位图使用完毕后必须释放。或者也可以定义高速缓存:
RUBY 代码复制
  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)即可,不需要释放。
不过我也无法肯定就是这个问题,或许也可能是别的脚本出现错误。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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


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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 16:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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