Class: GamePlay::Save

Inherits:
Load show all
Defined in:
docs/4_Systems_106_Save_Load.rb,
docs/4_Systems_901_GTS.rb

Overview

Save game scene

Constant Summary collapse

MULTI_SAVE_FORMAT =

MultiSave file format

'%s-%d'
SAVE_ROOT_PATHS =

List of the usable root path for the save state

['.', ENV['APPDATA'] || Dir.home, Dir.home]
BEFORE_SAVE_HOOKS =

Returns all the before save hooks.

Returns:

  • (Hash)

    all the before save hooks

{game_map: proc {$game_map.begin_save }, encounters_history: proc {$wild_battle.begin_save }}
AFTER_SAVE_HOOKS =

Returns all the after save hooks.

Returns:

  • (Hash)

    all the after save hooks

{game_map: proc {$game_map.end_save }, encounters_history: proc {$wild_battle.end_save }}

Constants inherited from Load

Load::ACTIONS

Constants inherited from BaseCleanUpdate

BaseCleanUpdate::AIU_KEY2METHOD

Constants inherited from Base

Base::DEFAULT_TRANSITION, Base::DEFAULT_TRANSITION_PARAMETER

Constants included from Input

Input::ALIAS_KEYS, Input::AXIS_MAPPING, Input::AXIS_SENSITIVITY, Input::DEAD_ZONE, Input::Keyboard, Input::Keys, Input::NON_TRIGGER_ZONE, Input::REPEAT_COOLDOWN, Input::REPEAT_SPACE

Constants included from DisplayMessage

DisplayMessage::MESSAGE_ERROR, DisplayMessage::MESSAGE_PROCESS_ERROR

Class Attribute Summary collapse

Instance Attribute Summary collapse

Attributes inherited from Base

#__last_scene, #__result_process, #running, #viewport

Attributes included from DisplayMessage

#message_window

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Load

#create_new_game, #should_make_new_game?, #update_graphics, #update_inputs, #update_mouse

Methods inherited from BaseCleanUpdate

#automatic_input_update, #update

Methods inherited from Base

#add_disposable, #call_scene, #dispose, #find_parent, #main, #return_to_scene, #snap_to_bitmap, #update, #visible, #visible=

Methods included from Input

dir4, dir8, get_text, joy_axis_position, press?, register_events, released?, repeat?, swap_states, trigger?

Methods included from DisplayMessage

#can_display_message_be_called?, #close_message_window, #display_message, #display_message_and_wait, #message_class, #message_processing?, #message_visible, #message_visible=

Constructor Details

#initializeSave

Create a new GamePlay::Save



234
235
# File 'docs/4_Systems_106_Save_Load.rb', line 234

def initialize
end

Class Attribute Details

.save_indexInteger

Returns index of the save file (to allow multi-save).

Returns:

  • (Integer)

    index of the save file (to allow multi-save)



271
272
273
# File 'docs/4_Systems_106_Save_Load.rb', line 271

def save_index
  @save_index
end

Instance Attribute Details

#savedBoolean (readonly)

Returns if the game was saved.

Returns:

  • (Boolean)

    if the game was saved



232
233
234
# File 'docs/4_Systems_106_Save_Load.rb', line 232

def saved
  @saved
end

Class Method Details

.load(filename = nil, no_load_parameter: false) ⇒ PFM::GameState?

Note:

Change PFM.game_state

Load a game

Parameters:

  • filename (String, nil) (defaults to: nil)

    name of the save file (nil = auto name the save file)

  • no_load_parameter (Boolean) (defaults to: false)

    if the system should not call load_parameters

Returns:

  • (PFM::GameState, nil)

    The save data (nil = no save data / data corruption)



282
283
# File 'docs/4_Systems_106_Save_Load.rb', line 282

def load(filename = nil, no_load_parameter: false)
end

.save(filename = nil, no_file = false)

Save a game

Parameters:

  • filename (String, nil) (defaults to: nil)

    name of the save file (nil = auto name the save file)

  • no_file (Boolean) (defaults to: false)

    tell if the save should not be saved to file and just be returned



275
276
# File 'docs/4_Systems_106_Save_Load.rb', line 275

def save(filename = nil, no_file = false)
end

.save_filename

Get the filename of the current save



288
289
# File 'docs/4_Systems_106_Save_Load.rb', line 288

def save_filename
end

.save_root_path

Get the root path of the save for the game



285
286
# File 'docs/4_Systems_106_Save_Load.rb', line 285

def save_root_path
end

Instance Method Details

#current_game_stateGameState?

Return the current GameState object

Returns:

  • (GameState, nil)


238
239
# File 'docs/4_Systems_106_Save_Load.rb', line 238

def current_game_state
end

#gts_save_game



328
# File 'docs/4_Systems_901_GTS.rb', line 328

alias gts_save_game save_game

#save_game

Save the game (method allowing hooks on the save)



241
242
# File 'docs/4_Systems_106_Save_Load.rb', line 241

def save_game
end