查看: 1628|回复: 2

[已经过期] 帮我看看我这个脚本为什么会掉贞,是哪没释放

[复制链接]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2016-10-29 13:59:57 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 yang1zhi 于 2016-10-30 20:17 编辑
  1. #==============================================================================
  2. # ■ $scene =Scene_cunli.new
  3. #------------------------------------------------------------------------------
  4. module CUNLI
  5.   #列表
  6.   CL_LB = {
  7.   4 => ["休息","镇街","兽栏","探险"], #主角家
  8.   6 => ["传授间","怪伴间","道具间","回家"],    #兽栏
  9.   7 => ["食品店","装备店","宠物店","镇街"],  #商店街
  10.   14 => ["竞技","决斗街"],  #竞技场
  11.   21 => ["商店街","决斗街","公园","回家"] ,     #镇街
  12.   33 => ["买卖","商店街"] ,     #食品店
  13.   34 => ["买卖","商店街"] ,     #装备店
  14.   35 => ["买卖","商店街"] ,     #道具店
  15.   38 => [] ,     #休息
  16.   39 => ["竞技场","比赛","镇街"] ,     #决斗街
  17.   40 => ["竞技场","比赛","镇街"]      #公园
  18.   }
  19. end
  20. class Scene_cunli
  21.       
  22. #--------------------------------------------------------------------------
  23.   # ● 主处理
  24.   #--------------------------------------------------------------------------
  25.   def main
  26.     #清理变量
  27.     $game_temp.common_event_id = 5
  28.     # 生成活动块
  29.     @spriteset = Spriteset_Map.new
  30.     # 生成信息窗口
  31.     @message_window = Window_Message.new
  32.     #生成对话框
  33.     @duihua_window = Window_Duihua.new
  34.     @duihua_window.z = 0
  35.     @duihua_window.opacity = 255
  36.     @duihua_window.back_opacity = 255
  37.       # 生成介绍窗口
  38.     @jies_window = Window_cunlijies.new
  39.     @jies_window.z =10
  40.     #生成选择窗口
  41.      @cunlicommand_window = Window_cunliCommand.new
  42.     @cunlicommand_window.z =10
  43.      @cunlicommand_window.index = 0      
  44.     @cunlicommand_window.opacity = 255
  45. @cunlicommand_window.back_opacity = 255
  46. $game_map.autoplay
  47.     # 执行过度
  48.     Graphics.transition
  49.     # 主循环
  50.     loop do
  51.       # 刷新游戏画面
  52.       Graphics.update
  53.       # 刷新输入信息
  54.       Input.update
  55.       # 刷新画面
  56.       update
  57.       # 如果画面切换就中断循环
  58.       if $scene != self
  59.         break
  60.       end
  61.     end
  62.     # 装备过渡
  63.     Graphics.freeze
  64.     # 释放窗口
  65.     @message_window.dispose
  66.     @spriteset.dispose
  67.     @jies_window.dispose
  68.     @cunlicommand_window.dispose
  69.     @duihua_window.dispose

  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 刷新画面
  73.   #--------------------------------------------------------------------------
  74.   def update
  75.     if   $game_switches[51] == true
  76.       @duihua_window.z = 20
  77.     else
  78.       @duihua_window.z = 0
  79.       end
  80.         #对话以及奖励
  81.     duihua_jiangli
  82.     updatenew
  83.     # 更新判断
  84.       update_command
  85.       #对话中不能选项
  86.       if $game_switches[51] == false
  87.       # 光标下 (+1)
  88.       if Input.trigger?(Input::UP)
  89.         #播放SE
  90.         $game_system.se_play($data_system.cursor_se)
  91.         @cunlicommand_window.index -= 1
  92.     @cunlicommand_window.index = CUNLI::CL_LB[$game_map.map_id].size - 1   if @cunlicommand_window.index < 0

  93.     end
  94.       # 光标上 (-1)
  95.       if Input.trigger?(Input::DOWN)
  96.         $game_system.se_play($data_system.cursor_se)
  97.         @cunlicommand_window.index += 1
  98.      @cunlicommand_window.index = 0   if @cunlicommand_window.index > CUNLI::CL_LB[$game_map.map_id].size - 1
  99.    end
  100.    end
  101.    #介绍窗口
  102.     @jies_window.set_ren(@cunlicommand_window.index)
  103.    end
  104. def update_command
  105.    if Input.trigger?(Input::B)
  106.       # 演奏取消 SE
  107.       $game_system.se_play($data_system.cancel_se)
  108.       # 切换的菜单画面
  109.       $scene = Scene_Menu.new
  110.       return
  111.     end
  112.    if Input.trigger?(Input::C)  and  $game_switches[51] == false and @duihua_window.z == 0
  113.       # 演奏取消 SE
  114.       $game_system.se_play($data_system.cancel_se)
  115.       if $game_map.map_id == 4 #主角的房间
  116.       if @cunlicommand_window.index == 0 #休息
  117.       $scene = Scene_Save.new
  118.   if $game_variables[74] == 0
  119.     $game_variables[72] = "初梦"
  120.     $game_variables[57] = "ZZZZZZZZZ/"
  121.     $game_party.gb_quan_huifu
  122.     $game_switches[51] = true
  123.     $game_switches[52] = true
  124. end
  125.       return

  126.      elsif @cunlicommand_window.index == 1 #镇街
  127.        # 设置新地图
  128.       $game_map.setup(21)
  129.       # 设置主角位置
  130.       $game_player.moveto(9,9)
  131.       elsif @cunlicommand_window.index == 2 #兽栏
  132.       # 设置新地图
  133.       $game_map.setup(6)
  134.       # 设置主角位置
  135.       $game_player.moveto(9, 9)
  136.     elsif @cunlicommand_window.index == 3 #探险
  137.       $game_temp.common_event_id = 1
  138.       # 设置新地图
  139.       $game_map.setup(11)
  140.       # 设置主角位置
  141.       $game_player.moveto(0,15)
  142.     end
  143.   elsif $game_map.map_id == 6 #兽栏
  144.     if @cunlicommand_window.index == 0 #传授间
  145.                   #队伍刷新
  146. $game_variables[1] = 7
  147. $game_party.refresh_fbs
  148. $game_party.friend_party_update
  149. BFS_Friends.weapon_recheck
  150. $game_temp.friends_need_refresh
  151.       $scene = Scene_jiaojineng_xuanren.new
  152.       return
  153.     elsif @cunlicommand_window.index == 1 #怪伴间
  154.       $scene = Chaochao_Scene_Party.new
  155.       return
  156.     elsif @cunlicommand_window.index == 2 #道具间
  157.       $scene = Scene_Warehouse.new
  158.       return
  159.     elsif @cunlicommand_window.index == 3 #回家
  160.       # 设置新地图
  161.       $game_map.setup(4)
  162.       # 设置主角位置
  163.       $game_player.moveto(9,9)
  164.     end
  165.   elsif $game_map.map_id == 7 #商店街
  166.       if @cunlicommand_window.index == 0 #食品店
  167.       # 设置新地图
  168.       $game_map.setup(33)
  169.       # 设置主角位置
  170.       $game_player.moveto(9,9)
  171.     elsif @cunlicommand_window.index == 1 #装备店
  172.       # 设置新地图
  173.       $game_map.setup(34)
  174.       # 设置主角位置
  175.       $game_player.moveto(9,9)
  176.     elsif @cunlicommand_window.index == 2 #道具店
  177.       # 设置新地图
  178.       $game_map.setup(35)
  179.       # 设置主角位置
  180.       $game_player.moveto(9,9)
  181.     elsif @cunlicommand_window.index == 3 #镇街
  182.       # 设置新地图
  183.       $game_map.setup(21)
  184.       # 设置主角位置
  185.       $game_player.moveto(9,9)
  186.     end
  187.   elsif $game_map.map_id == 33 #食品店
  188.       if @cunlicommand_window.index == 0 #买卖
  189.       $game_temp.shop_goods = []
  190.       for i in 1..6
  191.     $game_temp.shop_goods.push([0,i])
  192.     end
  193.       for i in 35..43
  194.     $game_temp.shop_goods.push([0,i])
  195.     end
  196.     # 清除商店调用标志
  197.     $game_temp.shop_calling = false
  198.     # 矫正主角姿势
  199.     $game_player.straighten
  200.     # 切换到商店画面
  201.     $scene = Scene_Shop.new
  202.     return
  203.     elsif @cunlicommand_window.index == 1 #商店街
  204.       # 设置新地图
  205.       $game_map.setup(7)
  206.       # 设置主角位置
  207.       $game_player.moveto(9,9)
  208.     end
  209.   elsif $game_map.map_id == 34 #装备店
  210.       if @cunlicommand_window.index == 0 #买卖
  211.       $game_temp.shop_goods = []
  212.       for i in 11..25
  213.     $game_temp.shop_goods.push([2,i])
  214.     end
  215.     # 清除商店调用标志
  216.     $game_temp.shop_calling = false
  217.     # 矫正主角姿势
  218.     $game_player.straighten
  219.     # 切换到商店画面
  220.     $scene = Scene_Shop.new
  221.     return
  222.     elsif @cunlicommand_window.index == 1 #商店街
  223.       # 设置新地图
  224.       $game_map.setup(7)
  225.       # 设置主角位置
  226.       $game_player.moveto(9,9)
  227.     end  elsif $game_map.map_id == 35 #道具店
  228.       if @cunlicommand_window.index == 0 #买卖
  229.       $game_temp.shop_goods = []
  230.       for i in 100..102
  231.     $game_temp.shop_goods.push([0,i])
  232.     end
  233.     # 清除商店调用标志
  234.     $game_temp.shop_calling = false
  235.     # 矫正主角姿势
  236.     $game_player.straighten
  237.     # 切换到商店画面
  238.     $scene = Scene_Shop.new
  239.     return
  240.     elsif @cunlicommand_window.index == 1 #商店街
  241.       # 设置新地图
  242.       $game_map.setup(7)
  243.       # 设置主角位置
  244.       $game_player.moveto(9,9)
  245.     end
  246.   elsif $game_map.map_id == 21 #镇街
  247.       if @cunlicommand_window.index == 0 #商店街
  248.       # 设置新地图
  249.       $game_map.setup(7)
  250.       # 设置主角位置
  251.       $game_player.moveto(9,9)
  252.     elsif @cunlicommand_window.index == 1 #决斗街
  253.       # 设置新地图
  254.       $game_map.setup(39)
  255.       # 设置主角位置
  256.       $game_player.moveto(9,9)
  257.     elsif @cunlicommand_window.index == 2 #公园
  258.       # 设置新地图
  259.       $game_map.setup(40)
  260.       # 设置主角位置
  261.       $game_player.moveto(9,9)
  262.     elsif @cunlicommand_window.index == 3 #回家
  263.       # 设置新地图
  264.       $game_map.setup(4)
  265.       # 设置主角位置
  266.       $game_player.moveto(9,9)
  267.     end
  268.     elsif $game_map.map_id == 39 #决斗街
  269.       if @cunlicommand_window.index == 0 #竞技场
  270.       # 设置新地图
  271.       $game_map.setup(14)
  272.       # 设置主角位置
  273.       $game_player.moveto(9,9)
  274.     elsif @cunlicommand_window.index == 1 #比赛
  275.       # 设置新地图
  276.       $game_map.setup(8)
  277.       # 设置主角位置
  278.       $game_player.moveto(9,9)
  279.     elsif @cunlicommand_window.index == 2 #镇街
  280.       # 设置新地图
  281.       $game_map.setup(21)
  282.       # 设置主角位置
  283.       $game_player.moveto(9, 9)
  284.     end
  285.     elsif $game_map.map_id == 14 #竞技场
  286.       if @cunlicommand_window.index == 0 #竞技
  287.       $scene =Scene_jjc.new
  288.       return
  289.      elsif @cunlicommand_window.index == 1 #决斗街
  290.       # 设置新地图
  291.       $game_map.setup(39)
  292.       # 设置主角位置
  293.       $game_player.moveto(9,9)
  294.     end
  295.   elsif $game_map.map_id == 40 #公园

  296.     end
  297.       $scene = Scene_Map.new
  298.       return
  299.     end

  300. end
  301.     #--------------------------------------------------------------------------
  302.   # ● 刷新画面
  303.   #--------------------------------------------------------------------------
  304.   def updatenew
  305.     $game_party.refresh_fbs  if $game_variables[49] != $game_map.map_id
  306.     $game_variables[49] = $game_map.map_id
  307.     # 循环
  308.     loop do
  309.       # 按照地图、实例、主角的顺序刷新
  310.       # (本更新顺序不会在满足事件的执行条件下成为给予角色瞬间移动
  311.       #  的机会的重要因素)
  312.       $game_map.update
  313.    #   $game_system.map_interpreter.update
  314.       $game_player.update
  315.       # 系统 (计时器)、画面刷新
  316.       $game_system.update
  317.       $game_screen.update
  318.       # 如果主角在场所移动中就中断循环
  319.       unless $game_temp.player_transferring
  320.         break
  321.      end
  322.       # 执行场所移动
  323.       transfer_player
  324.       # 处理过渡中的情况下、中断循环
  325.       if $game_temp.transition_processing
  326.         break
  327.       end
  328.     end
  329.     # 刷新活动块
  330.     @spriteset.update
  331.     # 刷新信息窗口
  332.     @message_window.update
  333.     # 游戏结束的情况下
  334.   #  if $game_temp.gameover
  335.       # 切换的游戏结束画面
  336.   #    $scene = Scene_Gameover.new
  337.   #    return
  338.   #  end
  339.     # 返回标题画面的情况下
  340. #   if $game_temp.to_title
  341.       # 切换到标题画面
  342.   #    $scene = Scene_Title.new
  343.   #    return
  344. #   end
  345.     # 处理过渡中的情况下
  346.     if $game_temp.transition_processing
  347.       # 清除过渡处理中标志
  348.       $game_temp.transition_processing = false
  349.       # 执行过渡
  350.       if $game_temp.transition_name == ""
  351.         Graphics.transition(20)
  352.       else
  353.         Graphics.transition(40, "Graphics/Transitions/" +
  354.           $game_temp.transition_name)
  355.       end
  356.     end

  357.     # 显示信息窗口中的情况下
  358. #   if $game_temp.message_window_showing
  359.   #    return
  360. #   end
  361.   end

  362.   end



  363. ##########
  364. #光标窗口
  365. class Window_cunliCommand < Window_Selectable
  366.   #--------------------------------------------------------------------------
  367.   # ● 初始化对像
  368.   #     width    : 窗口的宽
  369.   #     commands : 命令字符串序列
  370.   #--------------------------------------------------------------------------
  371.   def initialize
  372.     # 由命令的个数计算出窗口的高
  373.         super(0, 320, 120, 160)
  374.         self.contents = Bitmap.new(width - 32, height - 32)
  375.     $cunliCommands = CUNLI::CL_LB[$game_map.map_id]
  376.     refresh
  377.     self.opacity = 255
  378.     self.back_opacity = 255
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 刷新
  382.   #--------------------------------------------------------------------------
  383.   def refresh
  384.     self.contents.clear
  385.     for i in 0...CUNLI::CL_LB[$game_map.map_id].size
  386.       draw_lieb(i, normal_color)
  387.     end

  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # ● 描绘项目
  391.   #     index : 项目编号
  392.   #     color : 文字色
  393.   #--------------------------------------------------------------------------
  394.   def draw_lieb(index, color)
  395.     self.contents.font.color = color
  396.     rect = Rect.new(20, 32 * index, 64, 32)
  397.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  398.       name_lb = []
  399.   suoyou_gb = [] if suoyou_gb == nil
  400.   suoyou_gb = $game_party.actors + $game_party.waiting_actors + $game_party.actors2
  401.   self.contents.draw_text(rect, $cunliCommands[index]) if index < $cunliCommands.size
  402.     self.contents.font.color.set(200, 200, 0)
  403.     rectid = Rect.new(0, 32 * index, 32 , 32)
  404.     self.contents.draw_text(rectid, (index+1).to_s)

  405.     end
  406.   #--------------------------------------------------------------------------
  407.   # ● 项目无效化
  408.   #     index : 项目编号
  409.   #--------------------------------------------------------------------------
  410.   def disable_lieb(index)
  411.     draw_lieb(index, disabled_color)
  412.   end
  413. end
  414. ################
  415. #################
  416. class Window_cunlijies < Window_Base
  417.   #--------------------------------------------------------------------------
  418.   # ● 初始化对像
  419.   #--------------------------------------------------------------------------
  420.   def initialize
  421.     #坐标,长宽
  422.     super(120, 320, 520, 160)
  423.     #位图大小
  424.     self.contents = Bitmap.new(width - 32, height - 32)
  425.         self.opacity = 255
  426. self.back_opacity = 255
  427.   end
  428.   #--------------------------------------------------------------------------
  429.   # ● 设置敌人
  430.   #     enemy : 要显示名字和状态的敌人
  431.   #--------------------------------------------------------------------------
  432.   def set_ren(ren)
  433.     draw_cunli_graphic($cunliCommands[ren],ren) unless $cunliCommands == nil
  434.   end
  435.   

  436.     #########################################
  437.   def draw_cunli_graphic(name,id)
  438.     self.contents.font.color = system_color
  439.   bitmap = RPG::Cache.Panoramas($cunliCommands[id]) rescue nil
  440.   cw = bitmap.width
  441.   ch = bitmap.height
  442.   src_rect = Rect.new(0, 0, cw, ch)
  443.   self.contents.blt(0,0, bitmap, src_rect)
  444. end
  445.   ###########################################


  446. end
复制代码

老黄鸡

梦石
4
星屑
46133
在线时间
7978 小时
注册时间
2009-7-6
回帖
13342

MZ评测员RM创作大赛01组委会开拓者贵宾

发表于 2016-10-29 16:29:46 | 显示全部楼层
可能你使用了一些不完善的脚本,在场景过渡时没有销毁部分资源(bitmap,sprite之类),导致泄露产生卡顿。
RGDirect - DirectX驱动的RGSS,点我了解.
(排满,暂停)RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复

使用道具 举报

梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

 楼主| 发表于 2016-10-30 20:18:15 | 显示全部楼层
fux2 发表于 2016-10-29 16:29
可能你使用了一些不完善的脚本,在场景过渡时没有销毁部分资源(bitmap,sprite之类),导致泄露产生卡顿。 ...

放上脚本了,能帮我看看吗
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部