Project1

标题: Yanfly戰鬥結算的道具獲得畫面的編排問題 [打印本页]

作者: 御之嵐    时间: 2015-8-27 15:07
标题: Yanfly戰鬥結算的道具獲得畫面的編排問題
RT

他原本像是道具欄式
左右左右的顯示方式

我想把它改成了直列式的方式去顯示


目前道具名稱顯示已經成功了
但是後面數量的顯示
你會發現第二個數字特別的黑
因為他似乎重疊了

弄了很久還是不知道該怎麼把他分開ლ(゚Д゚ლ)

因為腳本很長
所以我擷取了可能會用到的部分、參數
  1. #--------------------------------------------------------------------------
  2.   # item_rect
  3.   #--------------------------------------------------------------------------
  4.   def item_rect(index)
  5.     rect = Rect.new
  6.     rect.width = item_width
  7.     rect.height = contents.height
  8.     rect.x = index % col_max * (item_width + spacing)
  9.     rect.y = index / col_max * item_height
  10.     return rect
  11.   end
复制代码
RUBY 代码复制
  1. #==============================================================================
  2. # ¡ Window_VictorySpoils
  3. #==============================================================================
  4.  
  5. class Window_VictorySpoils < Window_ItemList
  6.  
  7.   #--------------------------------------------------------------------------
  8.   # initialize
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(0, fitting_height(1), Graphics.width, window_height)
  12.     self.z = 200
  13.     hide
  14.   end
  15.  
  16.   #--------------------------------------------------------------------------
  17.   # window_height
  18.   #--------------------------------------------------------------------------
  19.   def window_height
  20.     return Graphics.height - fitting_height(4) - fitting_height(1)
  21.   end
  22.  
  23.   #--------------------------------------------------------------------------
  24.   # spacing
  25.   #--------------------------------------------------------------------------
  26.   def spacing; return 32; end
  27.  
  28.   #--------------------------------------------------------------------------
  29.   # make
  30.   #--------------------------------------------------------------------------
  31.   def make(gold, drops)
  32.     @gold = gold
  33.     @drops = drops
  34.     refresh
  35.     unselect
  36.   end
  37.  
  38.   #--------------------------------------------------------------------------
  39.   # make_item_list
  40.   #--------------------------------------------------------------------------
  41.   def make_item_list
  42.     @data = [nil]
  43.     items = {}
  44.     weapons = {}
  45.     armours = {}
  46.     @goods = {}
  47.     for item in @drops
  48.       case item
  49.       when RPG::Item
  50.         items[item] = 0 if items[item].nil?
  51.         items[item] += 1
  52.       when RPG::Weapon
  53.         weapons[item] = 0 if weapons[item].nil?
  54.         weapons[item] += 1
  55.       when RPG::Armor
  56.         armours[item] = 0 if armours[item].nil?
  57.         armours[item] += 1
  58.       end
  59.     end
  60.     items = items.sort { |a,b| a[0].id <=> b[0].id }
  61.     weapons = weapons.sort { |a,b| a[0].id <=> b[0].id }
  62.     armours = armours.sort { |a,b| a[0].id <=> b[0].id }
  63.     for key in items; @goods[key[0]] = key[1]; @data.push(key[0]); end
  64.     for key in weapons; @goods[key[0]] = key[1]; @data.push(key[0]); end
  65.     for key in armours; @goods[key[0]] = key[1]; @data.push(key[0]); end
  66.   end
  67.  
  68.   #--------------------------------------------------------------------------
  69.   # draw_item
  70.   #--------------------------------------------------------------------------
  71.   def draw_item(index)
  72.     item = @data[index]
  73.     rect = item_rect(index)
  74.     reset_font_settings
  75.     if item.nil?
  76.       draw_gold(rect)
  77.       return
  78.     end
  79.     rect.width -= 4
  80.     draw_item_name(item, 20, 24*index, true, rect.width - 24)
  81.     draw_item_number(rect, item)
  82.   end
  83.  
  84.   #--------------------------------------------------------------------------
  85.   # draw_gold
  86.   #--------------------------------------------------------------------------
  87.   def draw_gold(rect)
  88.     text = Vocab.currency_unit
  89.     draw_currency_value(@gold, text, rect.x, rect.y, rect.width)
  90.   end
  91.  
  92.   #--------------------------------------------------------------------------
  93.   # draw_item_number
  94.   #--------------------------------------------------------------------------
  95.   def draw_item_number(rect, item)
  96.     number = @goods[item].group
  97.     if $imported["YEA-AdjustLimits"]
  98.       contents.font.size = YEA::LIMIT::ITEM_FONT
  99.       text = sprintf(YEA::LIMIT::ITEM_PREFIX, number)
  100.       draw_text(20, rect.y+20, rect.width, rect.height, text, 2)
  101.     else
  102.       draw_text(20, rect.y, rect.width, rect.height, sprintf(":%s", number), 2)
  103.     end
  104.   end
  105.  
  106. end # Window_VictorySpoils



如果還有缺少腳本的部分
請再提出來

還請大家幫忙解惑
謝謝_(:з」∠)_
作者: 墨凌羽    时间: 2015-8-27 15:24
忽然想哭。。。回帖还要验证码。。。ORZ
话说把整个结算的窗口重写不就好了
作者: 御之嵐    时间: 2015-8-27 22:32

嘖嘖
問題解決了

  1. def draw_item_number(rect, item)
复制代码
裡面的東西全部搬到
  1. def draw_item(index)
复制代码
裡面

再稍微修改 X、Y 做排版
莫名其妙的就好了 (ᇂдᇂ )


這是我目前的成果 _(:з」∠)_

感覺還是好空
不知道要加什麼進去




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1