赞 | 0 |
VIP | 3 |
好人卡 | 7 |
积分 | 7 |
经验 | 34794 |
最后登录 | 2024-2-21 |
在线时间 | 684 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 719
- 在线时间
- 684 小时
- 注册时间
- 2009-5-29
- 帖子
- 461
|
5楼
楼主 |
发表于 2009-7-29 13:27:40
|
只看该作者
我在 Scene_Shop里面相应的地方加了这一段:- @Compare_window = Window_ShopStatus.new
- @Compare_window.set_item(nil)
- @Compare_window.active = false
- @Compare_window.visible = false
复制代码 Window_ShopBuy和Window_ShopSell加了这一段:- def update_compare
- @Compare_window.set_item(item)
- end
复制代码 新增的装备比较窗口代码:- class Window_ShopStatus < Window_Base
- def initialize
- super(336, 56, 208, 248)
- for actor in $game_party.members
- @actor = actor
- end
- refresh
- end
- def refresh
- self.contents.clear
- draw_actor_name(@actor, 4, 0)
- draw_parameter(0, WLH * 1, 0)
- draw_parameter(0, WLH * 2, 1)
- draw_parameter(0, WLH * 3, 2)
- draw_parameter(0, WLH * 4, 3)
- end
- def set_new_parameters(new_atk, new_def, new_spi, new_agi)
- if @new_atk != new_atk or @new_def != new_def or
- @new_spi != new_spi or @new_agi != new_agi
- @new_atk = new_atk
- @new_def = new_def
- @new_spi = new_spi
- @new_agi = new_agi
- refresh
- end
- end
- def new_parameter_color(old_value, new_value)
- if new_value > old_value # 变强
- return power_up_color
- elsif new_value == old_value # 没有变化
- return normal_color
- else # 变弱
- return power_down_color
- end
- end
- def draw_parameter(x, y, type)
- case type
- when 0
- name = Vocab::atk
- value = @actor.atk
- new_value = @new_atk
- when 1
- name = Vocab::def
- value = @actor.def
- new_value = @new_def
- when 2
- name = Vocab::spi
- value = @actor.spi
- new_value = @new_spi
- when 3
- name = Vocab::agi
- value = @actor.agi
- new_value = @new_agi
- end
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 56, WLH, name)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 56, y, 48, WLH, value, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(x + 112, y, 36, WLH, "→", 1)
- if new_value != nil
- self.contents.font.color = new_parameter_color(value, new_value)
- self.contents.draw_text(x + 152, y, 48, WLH, new_value, 2)
- end
- end
-
- def set_item(item)
- if item.nil?
- @item = nil
- return
- end
- if item != @item
- @item = item
- end
- refresh
- end
- end
复制代码 运行的时候却提示 “未定义@Compare_window的set_item方法”,谁告诉下是什么情况? |
|