赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 235 |
最后登录 | 2013-10-19 |
在线时间 | 2 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 2 小时
- 注册时间
- 2006-9-3
- 帖子
- 61
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
一个比较简单的效果,大家可以看一下,也许有用。
获得2个以上相同物品的时候就直接
2 x 恢复剂...
就不会像默认的
恢复剂
恢复剂
- #==============================================================================
- # Window_BattleResult
- #==============================================================================
- class Window_BattleResult < Window_Base
- def initialize(exp, gold, treasures)
- @exp = exp
- @gold = gold
- set_treasures(treasures)
- super(160, 0, 320, @treasures[0].size * 32 + 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- if $fontface != nil
- self.contents.font.name = $fontface
- elsif $defaultfonttype != nil
- self.contents.font.name = $defaultfonttype
- end
- self.y = 160 - height / 2
- self.back_opacity = 160
- self.visible = false
- refresh
- end
-
- def refresh
- self.contents.clear
- x = 4
- self.contents.font.color = normal_color
- cx = contents.text_size(@exp.to_s).width
- self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
- x += cx + 4
- self.contents.font.color = system_color
- cx = contents.text_size("EXP").width
- self.contents.draw_text(x, 0, 64, 32, "EXP")
- x += cx + 16
- self.contents.font.color = normal_color
- cx = contents.text_size(@gold.to_s).width
- self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
- x += cx + 4
- self.contents.font.color = system_color
- self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
- y = 32
- for i in [email protected]
- draw_item(@treasures[0][i], 4, y, @treasures[1][i])
- y += 32
- end
- end
-
- def set_treasures(treasures)
- items = []
- weapons = []
- armors = []
- stuff = []
- qua = []
- for i in treasures
- items.push(i.id) if i.is_a?(RPG::Item)
- weapons.push(i.id) if i.is_a?(RPG::Weapon)
- armors.push(i.id) if i.is_a?(RPG::Armor)
- end
- for id in items
- if stuff.include?($data_items[id])
- qua[stuff.index($data_items[id])] += 1
- else
- stuff.push($data_items[id])
- qua.push(1)
- end
- end
- for id in weapons
- if stuff.include?($data_weapons[id])
- qua[stuff.index($data_weapons[id])] += 1
- else
- stuff.push($data_weapons[id])
- qua.push(1)
- end
- end
- for id in armors
- if stuff.include?($data_armors[id])
- qua[stuff.index($data_armors[id])] += 1
- else
- stuff.push($data_armors[id])
- qua.push(1)
- end
- end
- @treasures = []
- @treasures.push(stuff)
- @treasures.push(qua)
- end
-
- def draw_item(item, x, y, qua = 1)
- if item == nil
- return
- end
- w1 = self.contents.text_size("0").width
- w2 = self.contents.text_size("x ").width
- x += w1 + w2 + 4
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.font.color = normal_color
- self.contents.draw_text(4, y, w1, 32, qua.to_s, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(w1 + 8, y, w2, 32, "x")
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 28, y, 212, 32, item.name)
- end
-
- end
复制代码 |
|