Class: Scene_Equip

Inherits:
Scene_MenuBase show all
Defined in:
Scene_Equip.rb

Overview

** Scene_Equip


This class performs the equipment screen processing.

Instance Method Summary (collapse)

Methods inherited from Scene_MenuBase

#create_background, #create_help_window, #dispose_background, #next_actor, #prev_actor, #terminate

Methods inherited from Scene_Base

#check_gameover, #create_main_viewport, #dispose_all_windows, #dispose_main_viewport, #fadeout_all, #main, #perform_transition, #post_start, #pre_terminate, #return_scene, #scene_changing?, #terminate, #transition_speed, #update, #update_all_windows, #update_basic

Instance Method Details

- (Object) command_clear


  • Remove All

    Command




96
97
98
99
100
101
102
# File 'Scene_Equip.rb', line 96

def command_clear
  Sound.play_equip
  @actor.clear_equipments
  @status_window.refresh
  @slot_window.refresh
  @command_window.activate
end

- (Object) command_equip


  • Change Equipment

    Command




79
80
81
82
# File 'Scene_Equip.rb', line 79

def command_equip
  @slot_window.activate
  @slot_window.select(0)
end

- (Object) command_optimize


  • Ultimate Equipment

    Command




86
87
88
89
90
91
92
# File 'Scene_Equip.rb', line 86

def command_optimize
  Sound.play_equip
  @actor.optimize_equipments
  @status_window.refresh
  @slot_window.refresh
  @command_window.activate
end

- (Object) create_command_window


  • Create Command Window




30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'Scene_Equip.rb', line 30

def create_command_window
  wx = @status_window.width
  wy = @help_window.height
  ww = Graphics.width - @status_window.width
  @command_window = Window_EquipCommand.new(wx, wy, ww)
  @command_window.viewport = @viewport
  @command_window.help_window = @help_window
  @command_window.set_handler(:equip,    method(:command_equip))
  @command_window.set_handler(:optimize, method(:command_optimize))
  @command_window.set_handler(:clear,    method(:command_clear))
  @command_window.set_handler(:cancel,   method(:return_scene))
  @command_window.set_handler(:pagedown, method(:next_actor))
  @command_window.set_handler(:pageup,   method(:prev_actor))
end

- (Object) create_item_window


  • Create Item Window




62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'Scene_Equip.rb', line 62

def create_item_window
  wx = 0
  wy = @slot_window.y + @slot_window.height
  ww = Graphics.width
  wh = Graphics.height - wy
  @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  @item_window.viewport = @viewport
  @item_window.help_window = @help_window
  @item_window.status_window = @status_window
  @item_window.actor = @actor
  @item_window.set_handler(:ok,     method(:on_item_ok))
  @item_window.set_handler(:cancel, method(:on_item_cancel))
  @slot_window.item_window = @item_window
end

- (Object) create_slot_window


  • Create Slot Window




47
48
49
50
51
52
53
54
55
56
57
58
# File 'Scene_Equip.rb', line 47

def create_slot_window
  wx = @status_window.width
  wy = @command_window.y + @command_window.height
  ww = Graphics.width - @status_window.width
  @slot_window = Window_EquipSlot.new(wx, wy, ww)
  @slot_window.viewport = @viewport
  @slot_window.help_window = @help_window
  @slot_window.status_window = @status_window
  @slot_window.actor = @actor
  @slot_window.set_handler(:ok,       method(:on_slot_ok))
  @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
end

- (Object) create_status_window


  • Create Status Window




22
23
24
25
26
# File 'Scene_Equip.rb', line 22

def create_status_window
  @status_window = Window_EquipStatus.new(0, @help_window.height)
  @status_window.viewport = @viewport
  @status_window.actor = @actor
end

- (Object) on_actor_change


  • Change Actors




138
139
140
141
142
143
# File 'Scene_Equip.rb', line 138

def on_actor_change
  @status_window.actor = @actor
  @slot_window.actor = @actor
  @item_window.actor = @actor
  @command_window.activate
end

- (Object) on_item_cancel


  • Item [Cancel]




131
132
133
134
# File 'Scene_Equip.rb', line 131

def on_item_cancel
  @slot_window.activate
  @item_window.unselect
end

- (Object) on_item_ok


  • Item [OK]




120
121
122
123
124
125
126
127
# File 'Scene_Equip.rb', line 120

def on_item_ok
  Sound.play_equip
  @actor.change_equip(@slot_window.index, @item_window.item)
  @slot_window.activate
  @slot_window.refresh
  @item_window.unselect
  @item_window.refresh
end

- (Object) on_slot_cancel


  • Slot [Cancel]




113
114
115
116
# File 'Scene_Equip.rb', line 113

def on_slot_cancel
  @slot_window.unselect
  @command_window.activate
end

- (Object) on_slot_ok


  • Slot [OK]




106
107
108
109
# File 'Scene_Equip.rb', line 106

def on_slot_ok
  @item_window.activate
  @item_window.select(0)
end

- (Object) start


  • Start Processing




11
12
13
14
15
16
17
18
# File 'Scene_Equip.rb', line 11

def start
  super
  create_help_window
  create_status_window
  create_command_window
  create_slot_window
  create_item_window
end