Пример #1
0
    private void RefreshDisplay()
    {
        Godot.File file = new Godot.File();
        file.Open(this.SaveLocation, File.ModeFlags.Read);
        if (file.IsOpen())
        {
            this.HasSaveData = true;
        }
        else
        {
            this.HasSaveData = false;
        }
        file.Close();

        if (this.HasSaveData)
        {
            this._loadButton.Text = String.Format("Save Slot {0} - (data)", this.SlotNumber);
            var modified     = file.GetModifiedTime(this.SaveLocation);
            var modifiedDate = DateTimeOffset.FromUnixTimeSeconds((long)modified).ToLocalTime().ToString("yyyy-MM-dd");
            this._lastPlayedLabel.Text = String.Format("Last Played: {0}", modifiedDate);
            this._clearButton.Disabled = false;
        }
        else
        {
            this._loadButton.Text      = String.Format("Save Slot {0} - (empty)", this.SlotNumber);
            this._lastPlayedLabel.Text = "Last Played: never";
            this._clearButton.Disabled = true;
        }
    }