81 lines
2.7 KiB
C#
81 lines
2.7 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace GameLauncher.Models
|
|
{
|
|
/// <summary>
|
|
/// セーブデータ内の1つのプロパティ(変数・項目)を表すGUI表示・編集モデル
|
|
/// </summary>
|
|
public class SaveDataPropertyEntry : INotifyPropertyChanged
|
|
{
|
|
private string _key = string.Empty;
|
|
private string _category = string.Empty;
|
|
private string _type = string.Empty;
|
|
private string _editValue = string.Empty;
|
|
private bool _isModified;
|
|
private string _description = string.Empty;
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
|
|
/// <summary>項目名(キー名、変数名)</summary>
|
|
public string Key
|
|
{
|
|
get => _key;
|
|
set { if (_key != value) { _key = value; OnPropertyChanged(); } }
|
|
}
|
|
|
|
/// <summary>分類・カテゴリ(セクション、オブジェクト名など)</summary>
|
|
public string Category
|
|
{
|
|
get => _category;
|
|
set { if (_category != value) { _category = value; OnPropertyChanged(); } }
|
|
}
|
|
|
|
/// <summary>データ型(Int, Float, Bool, String など)</summary>
|
|
public string Type
|
|
{
|
|
get => _type;
|
|
set { if (_type != value) { _type = value; OnPropertyChanged(); } }
|
|
}
|
|
|
|
/// <summary>GUI編集用の値文字列</summary>
|
|
public string EditValue
|
|
{
|
|
get => _editValue;
|
|
set
|
|
{
|
|
if (_editValue != value)
|
|
{
|
|
_editValue = value;
|
|
_isModified = true;
|
|
OnPropertyChanged();
|
|
OnPropertyChanged(nameof(IsModified));
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>値がユーザーによって変更されたかどうか</summary>
|
|
public bool IsModified
|
|
{
|
|
get => _isModified;
|
|
set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } }
|
|
}
|
|
|
|
/// <summary>備考・説明・オフセット位置など</summary>
|
|
public string Description
|
|
{
|
|
get => _description;
|
|
set { if (_description != value) { _description = value; OnPropertyChanged(); } }
|
|
}
|
|
|
|
/// <summary>内部保持用の生データや元データ(再エンコード用)</summary>
|
|
public object? RawData { get; set; }
|
|
}
|
|
}
|