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, #clock, #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

clear, close_virtual_keyboard, dir4, dir8, get_text, joy_axis_position, load_touch_screen, open_virtual_keyboard, 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

#initialize ⇒ Save

Create a new GamePlay::Save



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

def initialize
end

Class Attribute Details

.save_index ⇒ Integer

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

Returns:

  • (Integer) —

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



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

def save_index
  @save_index
end

Instance Attribute Details

#saved ⇒ Boolean (readonly)

Returns if the game was saved.

Returns:

  • (Boolean) —

    if the game was saved



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

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)



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

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



280
281
# File 'docs/4_Systems_106_Save_Load.rb', line 280

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

.save_filename

Get the filename of the current save



293
294
# File 'docs/4_Systems_106_Save_Load.rb', line 293

def save_filename
end

.save_root_path

Get the root path of the save for the game



290
291
# File 'docs/4_Systems_106_Save_Load.rb', line 290

def save_root_path
end

Instance Method Details

#current_game_state ⇒ GameState?

Return the current GameState object

Returns:

  • (GameState, nil)


245
246
# File 'docs/4_Systems_106_Save_Load.rb', line 245

def current_game_state
end

#gts_save_game



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

alias gts_save_game save_game

#save_game

Save the game (method allowing hooks on the save)



248
249
# File 'docs/4_Systems_106_Save_Load.rb', line 248

def save_game
end