Files
LonaRPG-Online-Games/Data/Scripts/Frames/14_Game_Switches.rb
T
2026-10-29 21:59:06 +04:00

43 lines
1.6 KiB
Ruby

#==============================================================================
# ** Game_Switches
#------------------------------------------------------------------------------
# This class handles switches. It's a wrapper for the built-in class "Array."
# The instance of this class is referenced by $game_switches.
#==============================================================================
class Game_Switches
attr_accessor :data
attr_accessor :data_common_event
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@data = []
init_common_event
end
def init_common_event
@data_common_event = {}
@data_common_event[:default] = true
end
#--------------------------------------------------------------------------
# * Get Switch
#--------------------------------------------------------------------------
def [](switch_id)
@data[switch_id] || false
end
#--------------------------------------------------------------------------
# * Set Switch
# value : ON (true) / OFF (false)
#--------------------------------------------------------------------------
def []=(switch_id, value)
@data[switch_id] = value
on_change
end
#--------------------------------------------------------------------------
# * Processing When Setting Switches
#--------------------------------------------------------------------------
def on_change
$game_map.need_refresh = true
end
end