[Solved] Save Slot information

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Pixchel
Posts: 9
Joined: Tue Jun 18, 2024 11:40 am

[Solved] Save Slot information

Post by Pixchel »

Hello, I searched on the forum but didn't found any answer.
Can you help me to know how to add informations on the display slot informations ? (like default is :
"Slot X
Time : date/hour"

that's it

How can I add (for example) the player displayName (I store it in an other script) or the player level to this information?

PS : I use Menu FrameWork
Last edited by Pixchel on Thu Aug 08, 2024 5:48 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save Slot information

Post by Tony Li »

Hi,

For the Menu Framework in specific, see step 12 on page 4 of the Menu Framework manual:
During gameplay, you can set a Dialogue System text variable named "CurrentStage". The
contents of this variable will added to the saved game summary information, which is shown in
the details section of the load game panel when the player selects a saved game. For example,
you can use a DialogueSystemTrigger set to OnStart that sets Variable[“CurrentStage”] to the
name of the scene, or use a dialogue entry’s Script field to set “CurrentStage” after major story
events.

If you want to add more information to the saved game summary, assign your own delegate
methods to SaveHelper.RecordExtraSlotDetailsHandler.

To show saved game details differently in the load game panel, you can assign an event handler
to LoadGamePanel's On Set Details event.
In general (not Menu Framework), please see: How To: Include Summary Info In Saved Games
Pixchel
Posts: 9
Joined: Tue Jun 18, 2024 11:40 am

Re: Save Slot information

Post by Pixchel »

I already seen manual speak about CurrentStage, but I don't really get it... Can we have an example for this ? please. It would be helpfull
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save Slot information

Post by Tony Li »

Try adding a script like this to your MenuSystem GameObject/prefab:

AddMoreSaveInfo.cs

Code: Select all

using System;
using UnityEngine;
using PixelCrushers.DialogueSystem.MenuSystem;
public class AddMoreSaveInfo : MonoBehaviour
{
    private void Start()
    {
        GetComponent<SaveHelper>().RecordExtraSlotDetailsHandler = RecordExtraSlotDetails;
    }
    private void RecordExtraSlotDetails(int slotNum, ref string summaryInfo)
    {
        summaryInfo += $"\nSlot {slotNum}\nTime: {DateTime.Now}";
    }
}
Pixchel
Posts: 9
Joined: Tue Jun 18, 2024 11:40 am

Re: Save Slot information

Post by Pixchel »

Okay, it add more detail on the summary when we press the slot button to load, but it not displayed in the button itself (in save and load menu)
ImageImage
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save Slot information

Post by Tony Li »

Hi,

Each save slot has two areas of information: slot summary, and slot details.

The script above adds information to the slot details.

To add information to the slot summary, you must make a subclass of SaveHelper, replace the SaveHelper component on your MenuSystem prefab with the subclass, and override the GetCurrentSummary() summary in your subclass. Something like:

Code: Select all

public class CustomSaveHelper : SaveHelper
{
    public override string GetCurrentSummary(int slotNum)
    {
        return base.GetCurrentSummary(slotNum) + "\n" + EXTRA INFO HERE;
    }
}
Pixchel
Posts: 9
Joined: Tue Jun 18, 2024 11:40 am

Re: Save Slot information

Post by Pixchel »

Okay, got it, but if we add thing to summary, it will be added to detail too. So I have found the reference in the savehelper itself to modify it, Thanks for your answer and your time, you are the best
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save Slot information

Post by Tony Li »

Happy to help!
Post Reply