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

Project1

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

[已经过期] 脚本冲突造成图片显示问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
148 小时
注册时间
2013-11-9
帖子
20
跳转到指定楼层
1
发表于 2014-8-27 17:10:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
虽然说是冲突,但并不影响游戏的运行

目前知道这个脚本似乎会造成其他脚本的图片显示透明化问题

例如喵呜喵5大的地图名显示美化的图片会变成透明,但文字依旧也显示,也没报错

其他脚本只要有用到图片显示也会出现此问题

还请有时间的大触帮忙看一下

问题脚本如下(脚本作者为KilloZapit

RUBY 代码复制
  1. module Cache
  2.  
  3.   # When this is true, cached bitmaps are not disposed normaly
  4.   KEEP_DISPOSED_BITMAPS = true
  5.  
  6.   # When this is true disposed bitmaps in the cache are disposed when
  7.   # the current scene terminates. Try turning this on if there is too
  8.   # much memory being used.
  9.   BUFFER_DISPOSED_BITMAPS = false
  10.  
  11.   # When this is not null, every map change or return to the map scene,
  12.   # all cached bitmaps have their age value increased by one. Bitmaps
  13.   # with an age value over the max are disposed. The age value is reset
  14.   # when the bitmap is loaded from the cache. 1 is the recommended
  15.   # minimum, otherwise lots of bitmap are likely to be disposed  and
  16.   # reloaded returning from menus.   
  17.   BITMAP_MAX_AGE = 1
  18.  
  19.   # Print messages when the cache is cleaned up if this is true.
  20.   PRINT_CACHE_STATUS = false
  21.  
  22.   # Print messages when a bitmap is loaded in the cache if this is true.
  23.   PRINT_LOADED_BITMAPS = false
  24.  
  25.   # Temporarily disables ruby garbage collection while disposing old
  26.   # bitmaps. May or may not help stability.
  27.   GARBAGE_COLLECTION_TWEAK = true
  28.  
  29.   # Precaches character sprites for all actors. Better to turn it off
  30.   # if there are a lot of actors/sprites.
  31.   PRECACHE_ACTOR_SPRITES = false
  32.   # Same as above but for faces.
  33.   PRECACHE_ACTOR_FACES = false
  34.  
  35.  
  36.   # * New Method: run when the game starts and when the cache is cleared
  37.   # Load any bitmaps you want to keep around here, and set keep_cached
  38.   # on them to true like below.
  39.   def self.precache
  40.     theme = $game_system ? $game_system.menu_theme : GMENU::DEFAULT_THEME
  41.  
  42.     gmenu("Background", theme ).keep_cached = true
  43.     gmenu("Windowskin", theme ).keep_cached = true
  44.     gmenu("MenuButton", theme ).keep_cached = true
  45.     gmenu("ActorBackground", theme ).keep_cached = true
  46.     gmenu("ActorBackgroundDisabled", theme ).keep_cached = true
  47.     system("IconSet").keep_cached = true
  48.     system("Window").keep_cached = true
  49.  
  50.  
  51.     for actor in $data_actors
  52.       next unless actor
  53.       if PRECACHE_ACTOR_SPRITES
  54.         character(actor.character_name).keep_cached = true
  55.       end
  56.       if PRECACHE_ACTOR_FACES
  57.         face(actor.face_name).keep_cached = true
  58.       end
  59.     end if PRECACHE_ACTOR_SPRITES || PRECACHE_ACTOR_FACES
  60.  
  61.     if PRINT_CACHE_STATUS
  62.       n = @cache.values.count {|bitmap| bitmap.keep_cached}
  63.       puts("Cashe contains " + n.to_s + " precashed objects.")
  64.     end
  65.  
  66.   end
  67.  
  68.   # * Alias: Load bitmap and set flags
  69.   class << self
  70.     alias load_bitmap_cache load_bitmap
  71.   end
  72.   def self.load_bitmap(folder_name, filename, hue = 0)
  73.     bitmap = load_bitmap_cache(folder_name.downcase, filename.downcase, hue)
  74.     bitmap.cached = true
  75.     bitmap.age = 0
  76.     bitmap
  77.   end
  78.  
  79.   # * Overwriten Method: Clear Cache
  80.   # Is this even ever used? Well it's here just incase.
  81.   def self.clear
  82.     @disposed_bitmaps = nil
  83.     [url=home.php?mod=space&uid=341345]@Cache[/url] ||= {}
  84.     @cache.each {|bitmap| bitmap.cache_dispose rescue next}
  85.     @cache.clear
  86.     GC.start
  87.     precache
  88.     puts("Cleared Cache") if PRINT_CACHE_STATUS
  89.   end
  90.  
  91.   # * New Method: Adds bitmap to an array to be disposed later
  92.   def self.add_dispose(bitmap)
  93.     @disposed_bitmaps ||= []
  94.     @disposed_bitmaps |= [bitmap]
  95.   end
  96.  
  97.   # * New Method: Dispose bitmaps needing to be disposed
  98.   def self.do_dispose
  99.     GC.disable if GARBAGE_COLLECTION_TWEAK
  100.     # dispose disposed bitmaps for this scene
  101.     # (mostly animations and stuff)
  102.     if @disposed_bitmaps
  103.       for bitmap in @disposed_bitmaps
  104.         bitmap.cache_dispose unless bitmap.disposed?
  105.       end
  106.       puts("Disposed of " + @disposed_bitmaps.size.to_s + " objects.") if PRINT_CACHE_STATUS
  107.       @disposed_bitmaps = nil
  108.     end
  109.     # dispose bitmaps that haven't been used in a while.
  110.     if BITMAP_MAX_AGE && SceneManager.scene_is?(Scene_Map)
  111.       n = 0
  112.       @cache.values.each do |bitmap|
  113.         next if bitmap.keep_cached || bitmap.disposed?
  114.         bitmap.age ||= 0
  115.         if bitmap.age > BITMAP_MAX_AGE
  116.           bitmap.cache_dispose
  117.           n += 1
  118.         else
  119.           bitmap.age += 1
  120.         end
  121.       end
  122.       puts("Disposed of " + n.to_s + " old objects.") if PRINT_CACHE_STATUS
  123.     end
  124.     # Clean up cache hash, because I wanted to count the non-disposed
  125.     # bitmaps during debugging anyway, so why not?
  126.     @cache.delete_if do |key, bitmap|
  127.       bitmap.disposed? && !bitmap.keep_cached
  128.     end
  129.     puts("Cache now contains " + @cache.size.to_s + " objects.") if PRINT_CACHE_STATUS
  130.     if GARBAGE_COLLECTION_TWEAK
  131.       GC.enable
  132.       GC.start
  133.     end
  134.   end
  135.  
  136.   def self.set_key(key, value)
  137.     unless include?(key)
  138.       puts("Cache Key Set: " + key.to_s) if PRINT_CACHE_STATUS
  139.       @cache[key] = value
  140.     end
  141.     value.cached = true
  142.     value.age = 0
  143.   end
  144.  
  145.   def self.get_key(key)
  146.     return nil unless include?(key)
  147.     value = @cache[key]
  148.     value.age = 0
  149.     value
  150.   end
  151.  
  152.   if PRINT_LOADED_BITMAPS
  153.  
  154.   def self.normal_bitmap(path)
  155.     unless include?(path)
  156.       puts("Loading Bitmap: " + path)
  157.       @cache[path] = Bitmap.new(path)
  158.     end
  159.     @cache[path]
  160.   end
  161.  
  162.   end
  163.  
  164. end
  165.  
  166. class Bitmap
  167.  
  168.   # * Added Public Instance Variable: Flag set when a bitmap is cached
  169.   attr_accessor :cached
  170.   # * Added Public Instance Variable: Flag set to keep bitmap in memory
  171.   attr_accessor :keep_cached
  172.   # * Added Public Instance Variable: Bitmap age value
  173.   attr_accessor :age
  174.  
  175.   # * Alias: Code run when a bitmap is erased/unloaded
  176.   alias_method :cache_dispose, :dispose
  177.   def dispose
  178.     # Never dispose bitmaps with keep_cached set
  179.     return if self.disposed? || @keep_cached
  180.     # Don't despose chached bitmaps if the settings say to keep them
  181.     if @cached && Cache::KEEP_DISPOSED_BITMAPS
  182.       # Tell the cache to add this bitmap to it's list of bitmaps
  183.       # to be disposed later (if BUFFER_DISPOSED_BITMAPS is true)
  184.       Cache.add_dispose(self) if Cache::BUFFER_DISPOSED_BITMAPS
  185.     else
  186.       cache_dispose
  187.     end
  188.   end
  189.  
  190.   # * Alias: clear flags when copying bitmaps
  191.   alias_method :cache_dup, :dup
  192.   def dup
  193.     bitmap = cache_dup
  194.     bitmap.cached = false
  195.     bitmap.keep_cached = false
  196.     bitmap
  197.   end
  198.  
  199.   # * Alias: same as above (clone and dup are not QUITE the same)
  200.   alias_method :cache_clone, :clone
  201.   def clone
  202.     bitmap = cache_clone
  203.     bitmap.cached = false
  204.     bitmap.keep_cached = false
  205.     bitmap
  206.   end   
  207.  
  208. end
  209.  
  210. class Scene_Base
  211.  
  212.   # * Alias: tell the cache to dispose stuff when the scene changes
  213.   alias_method :cache_main_base, :main
  214.   def main
  215.     cache_main_base
  216.     Cache.do_dispose
  217.   end
  218.  
  219. end
  220.  
  221. class Game_Map
  222.   # * Alias: tell the cache to dispose stuff when the map changes too
  223.   alias_method :cache_setup_base, :setup
  224.   def setup(map_id)
  225.     Cache.do_dispose
  226.     cache_setup_base(map_id)
  227.     # Force recache of tileset bitmaps if needed
  228.     $game_map.tileset.tileset_names.each_with_index do |name, i|
  229.       Cache.tileset(name)
  230.     end if Cache::BITMAP_MAX_AGE
  231.   end
  232.  
  233. end
  234.  
  235. module DataManager
  236.  
  237.   class << self
  238.     alias load_database_cache load_database
  239.   end
  240.   def self.load_database
  241.     load_database_cache
  242.     Cache.precache
  243.   end
  244.  
  245. end

评分

参与人数 2星屑 +200 收起 理由
VIPArcher + 100 貌似又被论坛奇怪的防水墙自动禁言了啥的。.
taroxd + 100 对于论坛奇怪的防水墙和自动禁言什么的,我.

查看全部评分

Lv1.梦旅人

梦石
0
星屑
54
在线时间
197 小时
注册时间
2012-12-15
帖子
689
2
发表于 2014-8-28 10:29:56 | 只看该作者
为毛这帖被加分而且lz被屏蔽?!

点评

XD大不是有写理由吗?,对于论坛奇怪的防水墙和自动禁言什么的。  发表于 2014-8-28 11:43
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-14 09:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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